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
namespace RealEstates.Services.Models { public class PropertyViewModel { public string District { get; set; } public string BuildingType { get; set; } public string PropertyType { get; set; } public int Price { get; set; } public int? Year { get; set; } public int Size { get; set; } public string Floor { get; set; } } }
18.136364
48
0.573935
[ "MIT" ]
Iceto04/SoftUni
Entity Framework Core/10. Best Practices And Architecture/RealEstates/RealEstates.Services/Models/PropertyViewModel.cs
401
C#
using System; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using FunFair.Trulioo.Client.Model.BusinessSearch; using FunFair.Trulioo.Client.URI; namespace FunFair.Trulioo.Client; [SuppressMessage(category: "ReSharper", checkId: "UnusedType.Global", Justification = "TODO: Review")] public class BusinessSearch { #region Constructors /// <summary> /// Initializes a new instance of the <see cref="BusinessSearch" /> class. /// </summary> /// <param name="service"> /// An object representing the root of Trulioo configuration service. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="service" /> is <c>null</c>. /// </exception> protected internal BusinessSearch(TruliooApiClient service) { this._service = service ?? throw new ArgumentNullException(nameof(service)); } #endregion #region Methods /// <summary> /// Business Search call for Trulioo API Client V1 /// </summary> /// <param name="request"> Request object containing parameters to search for </param> /// <returns> Contains the List of possible businesses from search </returns> [SuppressMessage(category: "ReSharper", checkId: "UnusedMember.Global", Justification = "TODO: Review")] public async Task<BusinessSearchResponse> BusinessSearchAsync(BusinessSearchRequest request) { ResourceName resource = new("search"); BusinessSearchResponse response = await this._context.PostAsync<BusinessSearchResponse>(ns: this._businessNamespace, resource: resource, content: request); return response; } /// <summary> /// Gets Business Search transaction information /// </summary> /// <param name="id"> TransactionRecordID of Business Search to retreive </param> /// <returns> Contains the Business Search transaction result </returns> [SuppressMessage(category: "ReSharper", checkId: "UnusedMember.Global", Justification = "TODO: Review")] public async Task<BusinessSearchResponse> BusinessSearchResultAsync(string id) { ResourceName resource = new("search", "transactionrecord", id); BusinessSearchResponse response = await this._context.GetAsync<BusinessSearchResponse>(ns: this._businessNamespace, resource: resource); return response; } #endregion #region Privates/internals private readonly TruliooApiClient _service; [SuppressMessage(category: "ReSharper", checkId: "InconsistentNaming", Justification = "TODO: Review")] private Context _context => this._service?.Context; private readonly Namespace _businessNamespace = new(value: "business"); #endregion }
37.763889
163
0.705774
[ "Apache-2.0" ]
funfair-tech/funfair-trulioo-client
src/FunFair.Trulioo.Client/BusinessSearch.cs
2,719
C#
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; namespace Asyncify { internal static class LambdaFixProvider { public static SyntaxNode FixLambda(SyntaxNode root, LambdaExpressionSyntax lambda, CSharpSyntaxNode newBody) { var simpleLambda = lambda as SimpleLambdaExpressionSyntax; var parenthesizedLambda = lambda as ParenthesizedLambdaExpressionSyntax; if (simpleLambda != null) { return root.ReplaceNode(lambda, simpleLambda .WithAsyncKeyword(Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(Space)) .WithBody(newBody)); } else { return root.ReplaceNode(lambda, parenthesizedLambda .WithAsyncKeyword(Token(SyntaxKind.AsyncKeyword).WithTrailingTrivia(Space)) .WithBody(newBody)); } } } }
36.448276
116
0.644276
[ "MIT" ]
AdaskoTheBeAsT/Asyncify-CSharp
Asyncify/Asyncify/LambdaFixProvider.cs
1,059
C#
using System; using System.Collections.Generic; using System.Linq; using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Calculators { public partial class TI83 { private readonly Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>(); private IMemoryDomains _memoryDomains; private bool _memoryDomainsInit = false; private void SetupMemoryDomains() { var domains = new List<MemoryDomain>(); var systemBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little, (addr) => { if (addr < 0 || addr >= 65536) throw new ArgumentOutOfRangeException(); return _cpu.ReadMemory((ushort)addr); }, (addr, value) => { if (addr < 0 || addr >= 65536) throw new ArgumentOutOfRangeException(); _cpu.WriteMemory((ushort)addr, value); }, 1); domains.Add(systemBusDomain); SyncAllByteArrayDomains(); _memoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList()); (ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains); _memoryDomainsInit = true; } private void SyncAllByteArrayDomains() { SyncByteArrayDomain("Main RAM", _ram); } private void SyncByteArrayDomain(string name, byte[] data) { if (_memoryDomainsInit) { var m = _byteArrayDomains[name]; m.Data = data; } else { var m = new MemoryDomainByteArray(name, MemoryDomain.Endian.Little, data, true, 1); _byteArrayDomains.Add(name, m); } } } }
25.095238
129
0.705882
[ "MIT" ]
CognitiaAI/StreetFighterRL
emulator/Bizhawk/BizHawk-master/BizHawk.Emulation.Cores/Calculator/TI83.IMemoryDomains.cs
1,583
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("KettyGaatDingenDoenV2")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("KettyGaatDingenDoenV2")] [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("5946c553-b9f8-4981-a137-e1bba7312eae")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
38.108108
84
0.751064
[ "MIT" ]
devedse/SparkleypieFiguresOutInheritance
KettyGaatDingenDoenV2/Properties/AssemblyInfo.cs
1,413
C#
using System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Xml.Serialization; namespace Workday.Staffing { [GeneratedCode("System.Xml", "4.6.1590.0"), DesignerCategory("code"), DebuggerStepThrough, XmlType(Namespace = "urn:com.workday/bsvc")] [Serializable] public class Employee_Period_Salary_Plan_Assignment_DataType : INotifyPropertyChanged { private Period_Salary_PlanObjectType compensation_Plan_ReferenceField; private Compensation_Pay_EarningObjectType compensation_Element_ReferenceField; private Compensation_PeriodObjectType compensation_Period_ReferenceField; private CurrencyObjectType currency_ReferenceField; private decimal compensation_Period_MultiplierField; private bool compensation_Period_MultiplierFieldSpecified; private FrequencyObjectType frequency_ReferenceField; private DateTime assignment_Effective_DateField; private bool assignment_Effective_DateFieldSpecified; [method: CompilerGenerated] [CompilerGenerated] public event PropertyChangedEventHandler PropertyChanged; [XmlElement(Order = 0)] public Period_Salary_PlanObjectType Compensation_Plan_Reference { get { return this.compensation_Plan_ReferenceField; } set { this.compensation_Plan_ReferenceField = value; this.RaisePropertyChanged("Compensation_Plan_Reference"); } } [XmlElement(Order = 1)] public Compensation_Pay_EarningObjectType Compensation_Element_Reference { get { return this.compensation_Element_ReferenceField; } set { this.compensation_Element_ReferenceField = value; this.RaisePropertyChanged("Compensation_Element_Reference"); } } [XmlElement(Order = 2)] public Compensation_PeriodObjectType Compensation_Period_Reference { get { return this.compensation_Period_ReferenceField; } set { this.compensation_Period_ReferenceField = value; this.RaisePropertyChanged("Compensation_Period_Reference"); } } [XmlElement(Order = 3)] public CurrencyObjectType Currency_Reference { get { return this.currency_ReferenceField; } set { this.currency_ReferenceField = value; this.RaisePropertyChanged("Currency_Reference"); } } [XmlElement(Order = 4)] public decimal Compensation_Period_Multiplier { get { return this.compensation_Period_MultiplierField; } set { this.compensation_Period_MultiplierField = value; this.RaisePropertyChanged("Compensation_Period_Multiplier"); } } [XmlIgnore] public bool Compensation_Period_MultiplierSpecified { get { return this.compensation_Period_MultiplierFieldSpecified; } set { this.compensation_Period_MultiplierFieldSpecified = value; this.RaisePropertyChanged("Compensation_Period_MultiplierSpecified"); } } [XmlElement(Order = 5)] public FrequencyObjectType Frequency_Reference { get { return this.frequency_ReferenceField; } set { this.frequency_ReferenceField = value; this.RaisePropertyChanged("Frequency_Reference"); } } [XmlElement(DataType = "date", Order = 6)] public DateTime Assignment_Effective_Date { get { return this.assignment_Effective_DateField; } set { this.assignment_Effective_DateField = value; this.RaisePropertyChanged("Assignment_Effective_Date"); } } [XmlIgnore] public bool Assignment_Effective_DateSpecified { get { return this.assignment_Effective_DateFieldSpecified; } set { this.assignment_Effective_DateFieldSpecified = value; this.RaisePropertyChanged("Assignment_Effective_DateSpecified"); } } protected void RaisePropertyChanged(string propertyName) { PropertyChangedEventHandler propertyChanged = this.PropertyChanged; if (propertyChanged != null) { propertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } }
23.22093
136
0.760641
[ "MIT" ]
matteofabbri/Workday.WebServices
Workday.Staffing/Employee_Period_Salary_Plan_Assignment_DataType.cs
3,994
C#
using AutoMapper; using MyApp.Core.Commands.Contracts; using MyApp.Data; using System; using System.Collections.Generic; using System.Text; namespace MyApp.Core.Commands { public class SetManagerCommand : ICommand { private readonly MyAppContext context; public SetManagerCommand(MyAppContext context) { this.context = context; } public string Execute(string[] inputArgs) { int employeeId = int.Parse(inputArgs[0]); int managerId = int.Parse(inputArgs[1]); var employee = this.context.Employees.Find(employeeId); var manager = this.context.Employees.Find(managerId); employee.Manager = manager; this.context.SaveChanges(); return "Command completed successfully!"; } } }
24.085714
67
0.631079
[ "MIT" ]
StefanLB/Databases-Advanced---Entity-Framework---February-2019
08. DB-Advanced-EF-Core-CSharp-Auto-Mapping-Objects-Exercises/MyApp/Core/Commands/SetManagerCommand.cs
845
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("Cookie factory")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Cookie factory")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("591cb554-905a-4557-8316-5eceef3884cc")] // 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.72973
84
0.747135
[ "Apache-2.0" ]
Vladimir-Dodnikov/CSharp-Programming-Basics-Problems
Homework_Task 7/Cookie factory/Properties/AssemblyInfo.cs
1,399
C#
using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; namespace advent.ConsoleCode { [SuppressMessage("ReSharper", "HeapView.BoxingAllocation")] [SuppressMessage("ReSharper", "UnusedMember.Local")] [SuppressMessage("ReSharper", "HeapView.ObjectAllocation.Possible")] [SuppressMessage("ReSharper", "CA1307")] [SuppressMessage("ReSharper", "HeapView.ClosureAllocation")] [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")] [SuppressMessage("ReSharper", "UnusedMember.Global")] internal class Console { public bool StopOnReexecute { get; set; } public bool StoppedOnReexecute { get; set; } public int Accumulator { get; private set; } public int Pointer { get; private set; } public int LastAccumulator { get; private set; } public int LastPointer { get; private set; } private int Lines { get; } private IDictionary<int, (Instruction, bool)> Program { get; } public Console(IEnumerable<Instruction> program) { if (program is null) throw new ArgumentException("missing program"); var instructions = program.ToArray(); if (instructions is null || !instructions.Any()) throw new ArgumentException("missing program"); Program = LoadProgram(instructions); Lines = Program.Keys.Count; } public Console(Program program) { if (program.Lines is null) throw new ArgumentException("missing program"); var instructions = program.Lines.ToList(); if (instructions is null || !instructions.Any()) throw new ArgumentException("missing program"); Program = LoadProgram(instructions); Lines = Program.Keys.Count; } public void Run() { Accumulator = 0; Pointer = 0; LastAccumulator = 0; LastPointer = 0; var steps = Program.Values.OrderBy(t => t.Item1.Line).ToArray(); while (Pointer < steps.Length) { // Save our old values LastPointer = Pointer; LastAccumulator = Accumulator; // Process the next instruction var (instruction, visited) = steps[Pointer]; if (visited && StopOnReexecute) { StoppedOnReexecute = true; break; } steps[Pointer].Item2 = true; // visited switch (instruction.Type.ToString()) { case "acc": Accumulator += instruction.Argument; Pointer++; break; case "jmp": Pointer += instruction.Argument; break; case "nop": Pointer++; break; } } } private static IDictionary<int, (Instruction, bool)> LoadProgram(IEnumerable<Instruction> program) { var result = new Dictionary<int, (Instruction, bool)>(); foreach (var line in program) { result[line.Line] = (line, false); } return result; } } }
33.536364
106
0.530496
[ "MIT" ]
rnelson/adventofcode
advent2020/advent/ConsoleCode/Console.cs
3,691
C#
using UnityEngine; using System.Collections; using System; namespace FORGE3D { public class F3DTurret : MonoBehaviour { [HideInInspector] public bool destroyIt; public enum TurretTrackingType { Step, Smooth, } public TurretTrackingType TrackingType; public GameObject Mount; public GameObject Swivel; private Vector3 defaultDir; private Quaternion defaultRot; private Transform headTransform; private Transform barrelTransform; public float HeadingTrackingSpeed = 2f; public float ElevationTrackingSpeed = 2f; private Vector3 targetPos; [HideInInspector] public Vector3 headingVetor; private float curHeadingAngle; private float curElevationAngle; public Vector2 HeadingLimit; public Vector2 ElevationLimit; public bool DebugDraw; public Transform DebugTarget; private bool fullAccess; public Animator[] Animators; void Awake() { headTransform = Swivel.GetComponent<Transform>(); barrelTransform = Mount.GetComponent<Transform>(); } public void PlayAnimation() { for (int i = 0; i < Animators.Length; i++) Animators[i].SetTrigger("FireTrigger"); } public void PlayAnimationLoop() { for (int i = 0; i < Animators.Length; i++) Animators[i].SetBool("FireLoopBool", true); } public void StopAnimation() { for (int i = 0; i < Animators.Length; i++) Animators[i].SetBool("FireLoopBool", false); } // Use this for initialization void Start() { targetPos = headTransform.transform.position + headTransform.transform.forward * 100f; defaultDir = Swivel.transform.forward; defaultRot = Quaternion.FromToRotation(transform.forward, defaultDir); if (HeadingLimit.y - HeadingLimit.x >= 359.9f) fullAccess = true; StopAnimation(); } // Autotrack public void SetNewTarget(Vector3 _targetPos) { targetPos = _targetPos; } // Angle between mount and target public float GetAngleToTarget() { return Vector3.Angle(Mount.transform.forward, targetPos - Mount.transform.position); } private Vector3 PreviousTargetPosition = Vector3.zero; void Update() { //return; if (DebugTarget != null) targetPos = DebugTarget.transform.position; if (TrackingType == TurretTrackingType.Step) { if (barrelTransform != null) { /////// Heading headingVetor = Vector3.Normalize(F3DMath.ProjectVectorOnPlane(headTransform.up, targetPos - headTransform.position)); float headingAngle = F3DMath.SignedVectorAngle(headTransform.forward, headingVetor, headTransform.up); float turretDefaultToTargetAngle = F3DMath.SignedVectorAngle(defaultRot * headTransform.forward, headingVetor, headTransform.up); float turretHeading = F3DMath.SignedVectorAngle(defaultRot * headTransform.forward, headTransform.forward, headTransform.up); float headingStep = HeadingTrackingSpeed * Time.deltaTime; // Heading step and correction // Full rotation if (HeadingLimit.x <= -180f && HeadingLimit.y >= 180f) headingStep *= Mathf.Sign(headingAngle); else // Limited rotation headingStep *= Mathf.Sign(turretDefaultToTargetAngle - turretHeading); // Hard stop on reach no overshooting if (Mathf.Abs(headingStep) > Mathf.Abs(headingAngle)) headingStep = headingAngle; // Heading limits if (curHeadingAngle + headingStep > HeadingLimit.x && curHeadingAngle + headingStep < HeadingLimit.y || HeadingLimit.x <= -180f && HeadingLimit.y >= 180f || fullAccess) { curHeadingAngle += headingStep; headTransform.rotation = headTransform.rotation * Quaternion.Euler(0f, headingStep, 0f); } /////// Elevation Vector3 elevationVector = Vector3.Normalize(F3DMath.ProjectVectorOnPlane(headTransform.right, targetPos - barrelTransform.position)); float elevationAngle = F3DMath.SignedVectorAngle(barrelTransform.forward, elevationVector, headTransform.right); // Elevation step and correction float elevationStep = Mathf.Sign(elevationAngle) * ElevationTrackingSpeed * Time.deltaTime; if (Mathf.Abs(elevationStep) > Mathf.Abs(elevationAngle)) elevationStep = elevationAngle; // Elevation limits if (curElevationAngle + elevationStep < ElevationLimit.y && curElevationAngle + elevationStep > ElevationLimit.x) { curElevationAngle += elevationStep; barrelTransform.rotation = barrelTransform.rotation * Quaternion.Euler(elevationStep, 0f, 0f); } } } else if(TrackingType == TurretTrackingType.Smooth) { Transform barrelX = barrelTransform; Transform barrelY = Swivel.transform; //finding position for turning just for X axis (down-up) Vector3 targetX = targetPos - barrelX.transform.position; Quaternion targetRotationX = Quaternion.LookRotation(targetX, headTransform.up); barrelX.transform.rotation = Quaternion.Slerp(barrelX.transform.rotation, targetRotationX, HeadingTrackingSpeed * Time.deltaTime); barrelX.transform.localEulerAngles = new Vector3(barrelX.transform.localEulerAngles.x, 0f, 0f); //checking for turning up too much if (barrelX.transform.localEulerAngles.x >= 180f && barrelX.transform.localEulerAngles.x < (360f - ElevationLimit.y)) { barrelX.transform.localEulerAngles = new Vector3(360f - ElevationLimit.y, 0f, 0f); } //down else if (barrelX.transform.localEulerAngles.x < 180f && barrelX.transform.localEulerAngles.x > -ElevationLimit.x) { barrelX.transform.localEulerAngles = new Vector3(-ElevationLimit.x, 0f, 0f); } //finding position for turning just for Y axis Vector3 targetY = targetPos; targetY.y = barrelY.position.y; Quaternion targetRotationY = Quaternion.LookRotation(targetY - barrelY.position, barrelY.transform.up); barrelY.transform.rotation = Quaternion.Slerp(barrelY.transform.rotation, targetRotationY, ElevationTrackingSpeed * Time.deltaTime); barrelY.transform.localEulerAngles = new Vector3(0f, barrelY.transform.localEulerAngles.y, 0f); if (!fullAccess) { //checking for turning left if (barrelY.transform.localEulerAngles.y >= 180f && barrelY.transform.localEulerAngles.y < (360f - HeadingLimit.y)) { barrelY.transform.localEulerAngles = new Vector3(0f, 360f - HeadingLimit.y, 0f); } //right else if (barrelY.transform.localEulerAngles.y < 180f && barrelY.transform.localEulerAngles.y > -HeadingLimit.x) { barrelY.transform.localEulerAngles = new Vector3(0f, -HeadingLimit.x, 0f); } } } if (DebugDraw) Debug.DrawLine(barrelTransform.position, barrelTransform.position + barrelTransform.forward * Vector3.Distance(barrelTransform.position, targetPos), Color.red); } } }
38.960352
119
0.550656
[ "MIT" ]
Bennef/FPS
Assets/3rd Party Assets/FORGE3D/Sci-Fi Effects/Code/Turrets/F3DTurret.cs
8,846
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.IO; using NMeCab; namespace NMeCabTest { class Program { static void Main(string[] args) { var mPara = new MeCabParam(); //辞書ファイルがあるフォルダを指定(NuGetで入れれば勝手に入る) mPara.DicDir = @"c:\dic\mecab-ipadic-neologd"; var mTagger = MeCabTagger.Create(mPara); string line = null; var receivers = new List<Func<string, bool>>(); while ((line = Console.ReadLine()) != null) { var node = mTagger.ParseToNode(line); while (node != null) { if (node.CharType > 0) { Console.WriteLine("{0}\t{1}", node.Surface, node.Feature); } node = node.Next; } } } } }
23.272727
64
0.66276
[ "MIT" ]
nQuantums/tips
windows/cs/NMeCabTest/Program.cs
822
C#
/* MIT License Copyright (c) 2020 stephenhaunts Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using DuckAttack.GameStates.Controller; using DuckAttack.Messages; using FlexoGraphics; using FlexoGraphics.Renderers; using Microsoft.Xna.Framework; namespace DuckAttack.GameActors.Hud { public class Hud : IRenderNode { private const int MAX_NUMBER_DUCKS = 12; private readonly int MAX_SHOTS = DifficultySettings.CurrentDifficulty.NumberBullets; private readonly DuckIndicator[] _duckIndicator = new DuckIndicator[MAX_NUMBER_DUCKS]; private readonly static BulletIndicator[] _bulletIndicator = new BulletIndicator[8]; public int NumberOfDucksShot { get; set; } public static int NumShotsLeft = DifficultySettings.CurrentDifficulty.NumberBullets; public Hud(string name) { Name = name; NumberOfDucksShot = 0; int x_offset = 1050; for (int i = 0; i < MAX_NUMBER_DUCKS; i++) { _duckIndicator[i] = new DuckIndicator("DuckIndicator_" + i, x_offset); x_offset += 30; } int bullet_x_offset = 550; for (int i = 0; i < MAX_SHOTS; i++) { _bulletIndicator[i] = new BulletIndicator("BulletIndicator_" + i, bullet_x_offset); bullet_x_offset += 30; } ResetHud(); } public void ResetHud() { NumShotsLeft = MAX_SHOTS; NumberOfDucksShot = 0; for (int i = 0; i < MAX_SHOTS; i++) { _bulletIndicator[i].State = BulletIndicatorState.NotFired; } for (int i = 0; i < MAX_NUMBER_DUCKS; i++) { _duckIndicator[i].State = DuckIndicatorState.None; } } public void ResetGun() { NumShotsLeft = MAX_SHOTS; for (int i = 0; i < MAX_SHOTS; i++) { _bulletIndicator[i].State = BulletIndicatorState.NotFired; } } public void ResetDuckCounter() { NumberOfDucksShot = 0; for (int i = 0; i < MAX_NUMBER_DUCKS; i++) { _duckIndicator[i].State = DuckIndicatorState.None; } } public void RegisterHit() { _duckIndicator[NumberOfDucksShot].State = DuckIndicatorState.Hit; NumberOfDucksShot++; } public void RegisterMiss() { _duckIndicator[NumberOfDucksShot].State = DuckIndicatorState.Miss; NumberOfDucksShot++; } public static void ShootBullet() { if (NumShotsLeft > 0) { _bulletIndicator[NumShotsLeft - 1].State = BulletIndicatorState.Fired; NumShotsLeft--; } } public string Name { get; set; } public void Update(GameTime gameTime) { if (Channels.Exists("duckhit")) { var message = Channels.LastMessageAs<DuckHitMessage>("duckhit"); if (message != null) { switch (message.State) { case DuckIndicatorState.Hit: RegisterHit(); break; case DuckIndicatorState.Miss: RegisterMiss(); break; } } } if (Channels.Exists("gunfired")) { var message = Channels.LastMessageAs<BulletFiredMessage>("gunfired"); if (message != null) { ShootBullet(); } } } public void Draw(DrawContext context, GameTime gameTime) { for (int i = 0; i < MAX_NUMBER_DUCKS; i++) { _duckIndicator[i].Draw(context, gameTime); } for (int i = 0; i < MAX_SHOTS; i++) { _bulletIndicator[i].Draw(context, gameTime); } } } }
30.143678
99
0.557102
[ "MIT" ]
obiwanjacobi/ExoGame2D
Source/Samples/DuckAttack/GameActors/Hud/Hud.cs
5,247
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("Task04")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Task04")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4677c990-bada-4cc1-b92d-242bb998b5e7")] // 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.297297
84
0.745652
[ "MIT" ]
RayHammer/xt-net-web
xt-net-web/Task04/Properties/AssemblyInfo.cs
1,383
C#
using Assets.Scripts.Model; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class CallReceiver : MonoBehaviour { // Start is called before the first frame update void Start() { } internal void TrigerMethod0() { //Debug.Log("TrigerMethod0"); } internal void TrigerMethod1(int nr) { //Debug.Log($"TrigerMethod1 {nr}"); } internal void TrigerMethod5(int nr, string text, float nr2, Vector2 vector2, MyData data) { //Debug.Log($"TrigerMethod5 {nr} {text} {nr2} {vector2.x} {data.Text}"); } // Update is called once per frame void Update() { } }
19.742857
93
0.632417
[ "MIT" ]
MindScriptAct/UnityPerformanceTesting
Assets/Scripts/Tests/DirectCalls/CallReceiver.cs
691
C#
using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Kuhpik { public sealed partial class GameState { public class Data { public IGameSystem[] StartingSystems { get; private set; } public IGameSystem[] StateEnteringSystems { get; private set; } public IGameSystem[] InitingSystems { get; private set; } public IGameSystem[] UpdatingSystems { get; private set; } public IGameSystem[] LateUpdatingSystems { get; private set; } public IGameSystem[] FixedUpdatingSystems { get; private set; } public IGameSystem[] TickingSystems { get; private set; } public IGameSystem[] StateExitingSystems { get; private set; } public IGameSystem[] GameEndingSystems { get; private set; } public Data(IEnumerable<IGameSystem> systems) { PrepareCollections(systems); } async void PrepareCollections(IEnumerable<IGameSystem> systems) { StartingSystems = systems.Where(x => IsOverride(x, "OnGameStart")).ToArray(); StateEnteringSystems = systems.Where(x => IsOverride(x, "OnStateEnter")).ToArray(); InitingSystems = systems.Where(x => IsOverride(x, "OnInit")).ToArray(); StateExitingSystems = systems.Where(x => IsOverride(x, "OnStateExit")).ToArray(); GameEndingSystems = systems.Where(x => IsOverride(x, "OnGameEnd")).ToArray(); UpdatingSystems = new IGameSystem[0]; LateUpdatingSystems = new IGameSystem[0]; FixedUpdatingSystems = new IGameSystem[0]; TickingSystems = new IGameSystem[0]; await Task.Yield(); UpdatingSystems = systems.Where(x => IsOverride(x, "OnUpdate")).ToArray(); LateUpdatingSystems = systems.Where(x => IsOverride(x, "OnLateUpdate")).ToArray(); FixedUpdatingSystems = systems.Where(x => IsOverride(x, "OnFixedUpdate")).ToArray(); TickingSystems = systems.Where(x => IsOverride(x, "OnCustomTick")).ToArray(); } bool IsOverride(IGameSystem system, string methodName) { var methodInfo = system.GetType().GetMethod(methodName); return methodInfo.DeclaringType != typeof(GameSystem); } } } }
45.87037
103
0.597497
[ "BSD-3-Clause" ]
KuhPik/Bootstrap
Assets/Kuhpik's Bootstrap/Source/Scripts/Game State/GameState.Data.cs
2,479
C#
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Data.Common; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.Query.Internal; using Microsoft.Extensions.Logging; using JetBrains.Annotations; using Microsoft.Extensions.Caching.Memory; namespace LinqToDB.EntityFrameworkCore { using Data; using Expressions; using Mapping; using Metadata; using Extensions; using SqlQuery; using Reflection; using Common.Internal.Cache; using DataProvider; using DataProvider.DB2; using DataProvider.Firebird; using DataProvider.MySql; using DataProvider.Oracle; using DataProvider.PostgreSQL; using DataProvider.SQLite; using DataProvider.SqlServer; using DataProvider.SqlCe; using System.Diagnostics.CodeAnalysis; // ReSharper disable once ClassWithVirtualMembersNeverInherited.Global /// <summary> /// Default EF Core - LINQ To DB integration bridge implementation. /// </summary> [PublicAPI] public class LinqToDBForEFToolsImplDefault : ILinqToDBForEFTools { class ProviderKey { public ProviderKey(string? providerName, string? connectionString) { ProviderName = providerName; ConnectionString = connectionString; } string? ProviderName { get; } string? ConnectionString { get; } #region Equality members protected bool Equals(ProviderKey other) { return string.Equals(ProviderName, other.ProviderName) && string.Equals(ConnectionString, other.ConnectionString); } public override bool Equals(object? obj) { if (obj is null) return false; if (ReferenceEquals(this, obj)) return true; if (obj.GetType() != GetType()) return false; return Equals((ProviderKey) obj); } public override int GetHashCode() { unchecked { return ((ProviderName != null ? ProviderName.GetHashCode() : 0) * 397) ^ (ConnectionString != null ? ConnectionString.GetHashCode() : 0); } } #endregion } readonly ConcurrentDictionary<ProviderKey, IDataProvider> _knownProviders = new(); private readonly MemoryCache _schemaCache = new( new Microsoft.Extensions.Caching.Memory.MemoryCacheOptions() { ExpirationScanFrequency = TimeSpan.FromHours(1.0) }); /// <summary> /// Force clear of internal caches. /// </summary> public virtual void ClearCaches() { _knownProviders.Clear(); _schemaCache.Compact(1.0); } /// <summary> /// Returns LINQ To DB provider, based on provider data from EF Core. /// Could be overriden if you have issues with default detection mechanisms. /// </summary> /// <param name="providerInfo">Provider information, extracted from EF Core.</param> /// <param name="connectionInfo"></param> /// <returns>LINQ TO DB provider instance.</returns> public virtual IDataProvider GetDataProvider(EFProviderInfo providerInfo, EFConnectionInfo connectionInfo) { var info = GetLinqToDbProviderInfo(providerInfo); return _knownProviders.GetOrAdd(new ProviderKey(info.ProviderName, connectionInfo.ConnectionString), k => { return CreateLinqToDbDataProvider(providerInfo, info, connectionInfo); }); } /// <summary> /// Converts EF Core provider settings to linq2db provider settings. /// </summary> /// <param name="providerInfo">EF Core provider settings.</param> /// <returns>linq2db provider settings.</returns> protected virtual LinqToDBProviderInfo GetLinqToDbProviderInfo(EFProviderInfo providerInfo) { var provInfo = new LinqToDBProviderInfo(); var relational = providerInfo.Options?.Extensions.OfType<RelationalOptionsExtension>().FirstOrDefault(); if (relational != null) { provInfo.Merge(GetLinqToDbProviderInfo(relational)); } if (providerInfo.Connection != null) { provInfo.Merge(GetLinqToDbProviderInfo(providerInfo.Connection)); } if (providerInfo.Context != null) { provInfo.Merge(GetLinqToDbProviderInfo(providerInfo.Context.Database)); } return provInfo; } /// <summary> /// Creates instance of linq2db database provider. /// </summary> /// <param name="providerInfo">EF Core provider settings.</param> /// <param name="provInfo">linq2db provider settings.</param> /// <param name="connectionInfo">EF Core connection settings.</param> /// <returns>linq2db database provider.</returns> protected virtual IDataProvider CreateLinqToDbDataProvider(EFProviderInfo providerInfo, LinqToDBProviderInfo provInfo, EFConnectionInfo connectionInfo) { if (provInfo.ProviderName == null) { throw new LinqToDBForEFToolsException("Can not detect data provider."); } switch (provInfo.ProviderName) { case ProviderName.SqlServer: return CreateSqlServerProvider(SqlServerDefaultVersion, connectionInfo.ConnectionString); case ProviderName.MySql: case ProviderName.MySqlConnector: return new MySqlDataProvider(provInfo.ProviderName); case ProviderName.PostgreSQL: return CreatePostgreSqlProvider(PostgreSqlDefaultVersion, connectionInfo.ConnectionString); case ProviderName.SQLite: return new SQLiteDataProvider(provInfo.ProviderName); case ProviderName.Firebird: return new FirebirdDataProvider(); case ProviderName.DB2: return new DB2DataProvider(ProviderName.DB2, DB2Version.LUW); case ProviderName.DB2LUW: return new DB2DataProvider(ProviderName.DB2, DB2Version.LUW); case ProviderName.DB2zOS: return new DB2DataProvider(ProviderName.DB2, DB2Version.zOS); case ProviderName.Oracle: return new OracleDataProvider(provInfo.ProviderName, OracleVersion.v11); case ProviderName.SqlCe: return new SqlCeDataProvider(); //case ProviderName.Access: // return new AccessDataProvider(); default: throw new LinqToDBForEFToolsException($"Can not instantiate data provider '{provInfo.ProviderName}'."); } } /// <summary> /// Creates linq2db provider settings object from <see cref="DatabaseFacade"/> instance. /// </summary> /// <param name="database">EF Core database information object.</param> /// <returns>linq2db provider settings.</returns> protected virtual LinqToDBProviderInfo? GetLinqToDbProviderInfo(DatabaseFacade database) { switch (database.ProviderName) { case "Microsoft.EntityFrameworkCore.SqlServer": return new LinqToDBProviderInfo { ProviderName = ProviderName.SqlServer }; case "Pomelo.EntityFrameworkCore.MySql": case "Devart.Data.MySql.EFCore": { return new LinqToDBProviderInfo { ProviderName = ProviderName.MySqlConnector }; } case "MySql.Data.EntityFrameworkCore": { return new LinqToDBProviderInfo { ProviderName = ProviderName.MySql }; } case "Npgsql.EntityFrameworkCore.PostgreSQL": case "Devart.Data.PostgreSql.EFCore": { return new LinqToDBProviderInfo { ProviderName = ProviderName.PostgreSQL }; } case "Microsoft.EntityFrameworkCore.Sqlite": case "Devart.Data.SQLite.EFCore": { return new LinqToDBProviderInfo { ProviderName = ProviderName.SQLite }; } case "FirebirdSql.EntityFrameworkCore.Firebird": case "EntityFrameworkCore.FirebirdSql": return new LinqToDBProviderInfo { ProviderName = ProviderName.Firebird }; case "IBM.EntityFrameworkCore": case "IBM.EntityFrameworkCore-lnx": case "IBM.EntityFrameworkCore-osx": return new LinqToDBProviderInfo { ProviderName = ProviderName.DB2LUW }; case "Devart.Data.Oracle.EFCore": return new LinqToDBProviderInfo { ProviderName = ProviderName.Oracle }; case "EntityFrameworkCore.Jet": return new LinqToDBProviderInfo { ProviderName = ProviderName.Access }; case "EntityFrameworkCore.SqlServerCompact40": case "EntityFrameworkCore.SqlServerCompact35": return new LinqToDBProviderInfo { ProviderName = ProviderName.SqlCe }; } return null; } /// <summary> /// Creates linq2db provider settings object from <see cref="DbConnection"/> instance. /// </summary> /// <param name="connection">Database connection.</param> /// <returns>linq2db provider settings.</returns> protected virtual LinqToDBProviderInfo? GetLinqToDbProviderInfo(DbConnection connection) { switch (connection.GetType().Name) { case "SqlConnection": return new LinqToDBProviderInfo { ProviderName = ProviderName.SqlServer }; case "MySqlConnection": return new LinqToDBProviderInfo { ProviderName = ProviderName.MySql }; case "NpgsqlConnection": case "PgSqlConnection": return new LinqToDBProviderInfo { ProviderName = ProviderName.PostgreSQL }; case "FbConnection": return new LinqToDBProviderInfo { ProviderName = ProviderName.Firebird }; case "DB2Connection": return new LinqToDBProviderInfo { ProviderName = ProviderName.DB2LUW }; case "OracleConnection": return new LinqToDBProviderInfo { ProviderName = ProviderName.Oracle }; case "SqliteConnection": case "SQLiteConnection": return new LinqToDBProviderInfo { ProviderName = ProviderName.SQLite }; case "JetConnection": return new LinqToDBProviderInfo { ProviderName = ProviderName.Access }; } return null; } /// <summary> /// Creates linq2db provider settings object from <see cref="RelationalOptionsExtension"/> instance. /// </summary> /// <param name="extensions">EF Core provider options.</param> /// <returns>linq2db provider settings.</returns> protected virtual LinqToDBProviderInfo? GetLinqToDbProviderInfo(RelationalOptionsExtension extensions) { switch (extensions.GetType().Name) { case "MySqlOptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.MySqlConnector }; case "MySQLOptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.MySql }; case "NpgsqlOptionsExtension": case "PgSqlOptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.PostgreSQL }; case "SqlServerOptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.SqlServer }; case "SqliteOptionsExtension": case "SQLiteOptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.SQLite }; case "SqlCeOptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.SqlCe }; case "FbOptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.Firebird }; case "Db2OptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.DB2LUW }; case "OracleOptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.Oracle }; case "JetOptionsExtension": return new LinqToDBProviderInfo { ProviderName = ProviderName.Access }; } return null; } /// <summary> /// Creates linq2db SQL Server database provider instance. /// </summary> /// <param name="version">SQL Server dialect.</param> /// <param name="connectionString">Connection string.</param> /// <returns>linq2db SQL Server provider instance.</returns> protected virtual IDataProvider CreateSqlServerProvider(SqlServerVersion version, string? connectionString) { string providerName; if (!string.IsNullOrEmpty(connectionString)) { providerName = "Microsoft.Data.SqlClient"; return DataConnection.GetDataProvider(providerName, connectionString)!; } switch (version) { case SqlServerVersion.v2000: providerName = ProviderName.SqlServer2000; break; case SqlServerVersion.v2005: providerName = ProviderName.SqlServer2005; break; case SqlServerVersion.v2008: providerName = ProviderName.SqlServer2008; break; case SqlServerVersion.v2012: providerName = ProviderName.SqlServer2012; break; default: throw new ArgumentOutOfRangeException($"Version '{version}' is not supported."); } return new SqlServerDataProvider(providerName, version); } /// <summary> /// Creates linq2db PostgreSQL database provider instance. /// </summary> /// <param name="version">PostgreSQL dialect.</param> /// <param name="connectionString">Connection string.</param> /// <returns>linq2db PostgreSQL provider instance.</returns> protected virtual IDataProvider CreatePostgreSqlProvider(PostgreSQLVersion version, string? connectionString) { if (!string.IsNullOrEmpty(connectionString)) return DataConnection.GetDataProvider(ProviderName.PostgreSQL, connectionString)!; string providerName; switch (version) { case PostgreSQLVersion.v92: providerName = ProviderName.PostgreSQL92; break; case PostgreSQLVersion.v93: providerName = ProviderName.PostgreSQL93; break; case PostgreSQLVersion.v95: providerName = ProviderName.PostgreSQL95; break; default: throw new ArgumentOutOfRangeException(nameof(version), version, null); } return new PostgreSQLDataProvider(providerName, version); } /// <summary> /// Creates metadata provider for specified EF Core data model. Default implementation uses /// <see cref="EFCoreMetadataReader"/> metadata provider. /// </summary> /// <param name="model">EF Core data model.</param> /// <param name="accessor">EF Core service provider.</param> /// <returns>LINQ To DB metadata provider for specified EF Core model.</returns> public virtual IMetadataReader CreateMetadataReader(IModel? model, IInfrastructure<IServiceProvider>? accessor) { return new EFCoreMetadataReader(model, accessor); } /// <summary> /// Creates mapping schema using provided EF Core data model and metadata provider. /// </summary> /// <param name="model">EF Core data model.</param> /// <param name="metadataReader">Additional optional LINQ To DB database metadata provider.</param> /// <param name="convertorSelector"></param> /// <returns>Mapping schema for provided EF.Core model.</returns> public virtual MappingSchema CreateMappingSchema( IModel model, IMetadataReader? metadataReader, IValueConverterSelector? convertorSelector) { var schema = new MappingSchema(); if (metadataReader != null) schema.AddMetadataReader(metadataReader); DefineConvertors(schema, model, convertorSelector); return schema; } /// <summary> /// Import type conversions from EF Core model into linq2db mapping schema. /// </summary> /// <param name="mappingSchema">linq2db mapping schema.</param> /// <param name="model">EF Core data mode.</param> /// <param name="convertorSelector">Type filter.</param> public virtual void DefineConvertors( MappingSchema mappingSchema, IModel model, IValueConverterSelector? convertorSelector) { if (mappingSchema == null) throw new ArgumentNullException(nameof(mappingSchema)); if (model == null) throw new ArgumentNullException(nameof(model)); if (convertorSelector == null) return; var entities = model.GetEntityTypes().ToArray(); var types = entities.SelectMany(e => e.GetProperties().Select(p => p.ClrType)) .Distinct() .ToArray(); var sqlConverter = mappingSchema.ValueToSqlConverter; foreach (var modelType in types) { // skipping enums if (modelType.IsEnum) continue; // skipping arrays if (modelType.IsArray) continue; MapEFCoreType(modelType); if (modelType.IsValueType && !typeof(Nullable<>).IsSameOrParentOf(modelType)) MapEFCoreType(typeof(Nullable<>).MakeGenericType(modelType)); } void MapEFCoreType(Type modelType) { var currentType = mappingSchema.GetDataType(modelType); if (currentType != SqlDataType.Undefined) return; var infos = convertorSelector.Select(modelType).ToArray(); if (infos.Length <= 0) return; var info = infos[0]; var providerType = info.ProviderClrType; var dataType = mappingSchema.GetDataType(providerType); var fromParam = Expression.Parameter(modelType, "t"); var toParam = Expression.Parameter(providerType, "t"); var converter = info.Create(); var valueExpression = Expression.Invoke(Expression.Constant(converter.ConvertToProvider), WithConvertToObject(fromParam)); var convertLambda = WithToDataParameter(valueExpression, dataType, fromParam); mappingSchema.SetConvertExpression(modelType, typeof(DataParameter), convertLambda, false); mappingSchema.SetConvertExpression(modelType, providerType, Expression.Lambda(Expression.Convert(valueExpression, providerType), fromParam)); mappingSchema.SetConvertExpression(providerType, modelType, Expression.Lambda( Expression.Convert( Expression.Invoke(Expression.Constant(converter.ConvertFromProvider), WithConvertToObject(toParam)), modelType), toParam)); mappingSchema.SetValueToSqlConverter(modelType, (sb, dt, v) => sqlConverter.Convert(sb, dt, converter.ConvertToProvider(v))); } } private static LambdaExpression WithToDataParameter(Expression valueExpression, SqlDataType dataType, ParameterExpression fromParam) => Expression.Lambda ( Expression.New ( DataParameterConstructor, Expression.Constant("Conv", typeof(string)), valueExpression, Expression.Constant(dataType.Type.DataType, typeof(DataType)), Expression.Constant(dataType.Type.DbType, typeof(string)) ), fromParam ); private static Expression WithConvertToObject(Expression valueExpression) => valueExpression.Type != typeof(object) ? Expression.Convert(valueExpression, typeof(object)) : valueExpression; /// <summary> /// Returns mapping schema using provided EF Core data model and metadata provider. /// </summary> /// <param name="model">EF Core data model.</param> /// <param name="metadataReader">Additional optional LINQ To DB database metadata provider.</param> /// <param name="convertorSelector"></param> /// <returns>Mapping schema for provided EF.Core model.</returns> public virtual MappingSchema GetMappingSchema( IModel model, IMetadataReader? metadataReader, IValueConverterSelector? convertorSelector) { var result = _schemaCache.GetOrCreate( Tuple.Create( model, metadataReader, convertorSelector, EnableChangeTracker ), e => { e.SlidingExpiration = TimeSpan.FromHours(1); return CreateMappingSchema(model, metadataReader, convertorSelector); }); return result; } /// <summary> /// Returns EF Core <see cref="IDbContextOptions"/> for specific <see cref="DbContext"/> instance. /// </summary> /// <param name="context">EF Core <see cref="DbContext"/> instance.</param> /// <returns><see cref="IDbContextOptions"/> instance.</returns> public virtual IDbContextOptions? GetContextOptions(DbContext? context) { return context?.GetService<IDbContextOptions>(); } static readonly MethodInfo IgnoreQueryFiltersMethodInfo = MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.IgnoreQueryFilters()); static readonly MethodInfo IncludeMethodInfo = MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.Include(o => o.ToString())); static readonly MethodInfo IncludeMethodInfoString = MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.Include(string.Empty)); static readonly MethodInfo ThenIncludeMethodInfo = MemberHelper.MethodOfGeneric<IIncludableQueryable<object, object>>(q => q.ThenInclude<object, object, object>(null)); static readonly MethodInfo ThenIncludeEnumerableMethodInfo = MemberHelper.MethodOfGeneric<IIncludableQueryable<object, IEnumerable<object>>>(q => q.ThenInclude<object, object, object>(null)); static readonly MethodInfo AsNoTrackingMethodInfo = MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.AsNoTracking()); static readonly MethodInfo EFProperty = MemberHelper.MethodOfGeneric(() => EF.Property<object>(1, "")); static readonly MethodInfo L2DBProperty = typeof(Sql).GetMethod(nameof(Sql.Property)).GetGenericMethodDefinition(); static readonly MethodInfo L2DBFromSqlMethodInfo = MemberHelper.MethodOfGeneric<IDataContext>(dc => dc.FromSql<object>(new Common.RawSqlString())); static readonly MethodInfo L2DBRemoveOrderByMethodInfo = MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.RemoveOrderBy()); static readonly ConstructorInfo RawSqlStringConstructor = MemberHelper.ConstructorOf(() => new Common.RawSqlString("")); static readonly ConstructorInfo DataParameterConstructor = MemberHelper.ConstructorOf(() => new DataParameter("", "", DataType.Undefined, "")); static readonly MethodInfo ToSql = MemberHelper.MethodOfGeneric(() => Sql.ToSql(1)); /// <summary> /// Removes conversions from expression. /// </summary> /// <param name="ex">Expression.</param> /// <returns>Unwrapped expression.</returns> [return: NotNullIfNotNull("ex")] public static Expression? Unwrap(Expression? ex) { if (ex == null) return null; switch (ex.NodeType) { case ExpressionType.Quote : return Unwrap(((UnaryExpression)ex).Operand); case ExpressionType.ConvertChecked : case ExpressionType.Convert : { var ue = (UnaryExpression)ex; if (!ue.Operand.Type.IsEnum) return Unwrap(ue.Operand); break; } } return ex; } /// <summary> /// Tests that method is <see cref="IQueryable{T}"/> extension. /// </summary> /// <param name="method">Method to test.</param> /// <param name="enumerable">Allow <see cref="IEnumerable{T}"/> extensions.</param> /// <returns><c>true</c> if method is <see cref="IQueryable{T}"/> extension.</returns> public static bool IsQueryable(MethodCallExpression method, bool enumerable = true) { var type = method.Method.DeclaringType; return type == typeof(Queryable) || (enumerable && type == typeof(Enumerable)) || type == typeof(LinqExtensions) || type == typeof(DataExtensions) || type == typeof(TableExtensions) || type == typeof(EntityFrameworkQueryableExtensions); } /// <summary> /// Evaluates value of expression. /// </summary> /// <param name="expr">Expression to evaluate.</param> /// <returns>Expression value.</returns> public static object? EvaluateExpression(Expression? expr) { if (expr == null) return null; switch (expr.NodeType) { case ExpressionType.Constant: return ((ConstantExpression)expr).Value; case ExpressionType.MemberAccess: { var member = (MemberExpression) expr; if (member.Member.IsFieldEx()) return ((FieldInfo)member.Member).GetValue(EvaluateExpression(member.Expression)); if (member.Member.IsPropertyEx()) return ((PropertyInfo)member.Member).GetValue(EvaluateExpression(member.Expression), null); break; } } var value = Expression.Lambda(expr).Compile().DynamicInvoke(); return value; } /// <summary> /// Compacts expression to handle big filters. /// </summary> /// <param name="expression"></param> /// <returns>Compacted expression.</returns> public static Expression CompactExpression(Expression expression) { switch (expression.NodeType) { case ExpressionType.Or: case ExpressionType.And: case ExpressionType.OrElse: case ExpressionType.AndAlso: { var stack = new Stack<Expression>(); var items = new List<Expression>(); var binary = (BinaryExpression) expression; stack.Push(binary.Right); stack.Push(binary.Left); while (stack.Count > 0) { var item = stack.Pop(); if (item.NodeType == expression.NodeType) { binary = (BinaryExpression) item; stack.Push(binary.Right); stack.Push(binary.Left); } else items.Add(item); } if (items.Count > 3) { // having N items will lead to NxM recursive calls in expression visitors and // will result in stack overflow on relatively small numbers (~1000 items). // To fix it we will rebalance condition tree here which will result in // LOG2(N)*M recursive calls, or 10*M calls for 1000 items. // // E.g. we have condition A OR B OR C OR D OR E // as an expression tree it represented as tree with depth 5 // OR // A OR // B OR // C OR // D E // for rebalanced tree it will have depth 4 // OR // OR // OR OR OR // A B C D E F // Not much on small numbers, but huge improvement on bigger numbers while (items.Count != 1) { items = CompactTree(items, expression.NodeType); } return items[0]; } break; } } return expression; } static List<Expression> CompactTree(List<Expression> items, ExpressionType nodeType) { var result = new List<Expression>(); // traverse list from left to right to preserve calculation order for (var i = 0; i < items.Count; i += 2) { if (i + 1 == items.Count) { // last non-paired item result.Add(items[i]); } else { result.Add(Expression.MakeBinary(nodeType, items[i], items[i + 1])); } } return result; } /// <summary> /// Transforms EF Core expression tree to LINQ To DB expression. /// Method replaces EF Core <see cref="EntityQueryable{TResult}"/> instances with LINQ To DB /// <see cref="DataExtensions.GetTable{T}(IDataContext)"/> calls. /// </summary> /// <param name="expression">EF Core expression tree.</param> /// <param name="dc">LINQ To DB <see cref="IDataContext"/> instance.</param> /// <param name="ctx">Optional DbContext instance.</param> /// <param name="model">EF Core data model instance.</param> /// <returns>Transformed expression.</returns> public virtual Expression TransformExpression(Expression expression, IDataContext dc, DbContext? ctx, IModel? model) { var tracking = true; var ignoreTracking = false; TransformInfo LocalTransform(Expression e) { e = CompactExpression(e); switch (e.NodeType) { case ExpressionType.Constant: { if (typeof(EntityQueryable<>).IsSameOrParentOf(e.Type) || typeof(DbSet<>).IsSameOrParentOf(e.Type)) { var entityType = e.Type.GenericTypeArguments[0]; var newExpr = Expression.Call(null, Methods.LinqToDB.GetTable.MakeGenericMethod(entityType), Expression.Constant(dc)); return new TransformInfo(newExpr); } break; } case ExpressionType.MemberAccess: { if (typeof(IQueryable<>).IsSameOrParentOf(e.Type)) { var ma = (MemberExpression)e; var query = (IQueryable)EvaluateExpression(ma)!; return new TransformInfo(query.Expression, false, true); } break; } case ExpressionType.Call: { var methodCall = (MethodCallExpression) e; var generic = methodCall.Method.IsGenericMethod ? methodCall.Method.GetGenericMethodDefinition() : methodCall.Method; if (IsQueryable(methodCall)) { if (methodCall.Method.IsGenericMethod) { var isTunnel = false; if (generic == IgnoreQueryFiltersMethodInfo) { var newMethod = Expression.Call( Methods.LinqToDB.IgnoreFilters.MakeGenericMethod(methodCall.Method.GetGenericArguments()), methodCall.Arguments[0], Expression.NewArrayInit(typeof(Type))); return new TransformInfo(newMethod, false, true); } else if (generic == AsNoTrackingMethodInfo) { isTunnel = true; tracking = false; } else if (generic == IncludeMethodInfo) { var method = Methods.LinqToDB.LoadWith.MakeGenericMethod(methodCall.Method .GetGenericArguments()); return new TransformInfo(Expression.Call(method, methodCall.Arguments), false, true); } else if (generic == IncludeMethodInfoString) { var arguments = new List<Expression>(2) { methodCall.Arguments[0] }; var propName = (string)EvaluateExpression(methodCall.Arguments[1])!; var param = Expression.Parameter(methodCall.Method.GetGenericArguments()[0], "e"); var propPath = propName.Split(new[] {'.'}, StringSplitOptions.RemoveEmptyEntries); var prop = (Expression)param; for (int i = 0; i < propPath.Length; i++) { prop = Expression.PropertyOrField(prop, propPath[i]); } arguments.Add(Expression.Lambda(prop, param)); var method = Methods.LinqToDB.LoadWith.MakeGenericMethod(param.Type, prop.Type); return new TransformInfo(Expression.Call(method, arguments.ToArray()), false, true); } else if (generic == ThenIncludeMethodInfo) { var method = Methods.LinqToDB.ThenLoadFromSingle.MakeGenericMethod(methodCall.Method .GetGenericArguments()); return new TransformInfo(Expression.Call(method, methodCall.Arguments.Select(a => a.Transform(l => LocalTransform(l))) .ToArray()), false, true); } else if (generic == ThenIncludeEnumerableMethodInfo) { var method = Methods.LinqToDB.ThenLoadFromMany.MakeGenericMethod(methodCall.Method .GetGenericArguments()); return new TransformInfo(Expression.Call(method, methodCall.Arguments.Select(a => a.Transform(l => LocalTransform(l))) .ToArray()), false, true); } else if (generic == L2DBRemoveOrderByMethodInfo) { // This is workaround. EagerLoading runs query again with RemoveOrderBy method. // it is only one possible way now how to detect nested query. ignoreTracking = true; } if (isTunnel) return new TransformInfo(methodCall.Arguments[0], false, true); } break; } if (typeof(ITable<>).IsSameOrParentOf(methodCall.Type)) { if (generic.Name == "ToLinqToDBTable") { return new TransformInfo(methodCall.Arguments[0], false, true); } break; } if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type)) { // Invoking function to evaluate EF's Subquery located in function var obj = EvaluateExpression(methodCall.Object); var arguments = methodCall.Arguments.Select(EvaluateExpression).ToArray(); if (methodCall.Method.Invoke(obj, arguments) is IQueryable result) { if (!ExpressionEqualityComparer.Instance.Equals(methodCall, result.Expression)) return new TransformInfo(result.Expression, false, true); } } if (generic == EFProperty) { var prop = Expression.Call(null, L2DBProperty.MakeGenericMethod(methodCall.Method.GetGenericArguments()[0]), methodCall.Arguments[0], methodCall.Arguments[1]); return new TransformInfo(prop, false, true); } List<Expression>? newArguments = null; var parameters = generic.GetParameters(); for (var i = 0; i < parameters.Length; i++) { var arg = methodCall.Arguments[i]; var canWrap = true; if (arg.NodeType == ExpressionType.Call) { var mc = (MethodCallExpression) arg; if (mc.Method.DeclaringType == typeof(Sql)) canWrap = false; } if (canWrap) { var parameterInfo = parameters[i]; var notParametrized = parameterInfo.GetCustomAttributes<NotParameterizedAttribute>() .FirstOrDefault(); if (notParametrized != null) { if (newArguments == null) { newArguments = new List<Expression>(methodCall.Arguments.Take(i)); } newArguments.Add(Expression.Call(ToSql.MakeGenericMethod(arg.Type), arg)); continue; } } newArguments?.Add(methodCall.Arguments[i]); } if (newArguments != null) return new TransformInfo(methodCall.Update(methodCall.Object, newArguments), false, true); break; } case ExpressionType.Extension: { if (e is FromSqlQueryRootExpression fromSqlQueryRoot) { //convert the arguments from the FromSqlOnQueryable method from EF, to a L2DB FromSql call return new TransformInfo(Expression.Call(null, L2DBFromSqlMethodInfo.MakeGenericMethod(fromSqlQueryRoot.EntityType.ClrType), Expression.Constant(dc), Expression.New(RawSqlStringConstructor, Expression.Constant(fromSqlQueryRoot.Sql)), fromSqlQueryRoot.Argument)); } else if (e is QueryRootExpression queryRoot) { var newExpr = Expression.Call(null, Methods.LinqToDB.GetTable.MakeGenericMethod(queryRoot.EntityType.ClrType), Expression.Constant(dc)); return new TransformInfo(newExpr); } break; } } return new TransformInfo(e); } var newExpression = expression.Transform(e => LocalTransform(e)); if (!ignoreTracking && dc is LinqToDBForEFToolsDataConnection dataConnection) { // ReSharper disable once ConditionIsAlwaysTrueOrFalse dataConnection.Tracking = tracking; } return newExpression; } static Expression EnsureEnumerable(Expression expression, MappingSchema mappingSchema) { var enumerable = typeof(IEnumerable<>).MakeGenericType(GetEnumerableElementType(expression.Type, mappingSchema)); if (expression.Type != enumerable) expression = Expression.Convert(expression, enumerable); return expression; } static Expression EnsureEnumerable(LambdaExpression lambda, MappingSchema mappingSchema) { var newBody = EnsureEnumerable(lambda.Body, mappingSchema); if (newBody != lambda.Body) lambda = Expression.Lambda(newBody, lambda.Parameters); return lambda; } static Type GetEnumerableElementType(Type type, MappingSchema mappingSchema) { if (!IsEnumerableType(type, mappingSchema)) return type; if (type.IsArray) return type.GetElementType(); if (typeof(IGrouping<,>).IsSameOrParentOf(type)) return type.GetGenericArguments()[1]; return type.GetGenericArguments()[0]; } static bool IsEnumerableType(Type type, MappingSchema mappingSchema) { if (mappingSchema.IsScalarType(type)) return false; if (!typeof(IEnumerable<>).IsSameOrParentOf(type)) return false; return true; } /// <summary> /// Extracts <see cref="DbContext"/> instance from <see cref="IQueryable"/> object. /// Due to unavailability of integration API in EF Core this method use reflection and could became broken after EF Core update. /// </summary> /// <param name="query">EF Core query.</param> /// <returns>Current <see cref="DbContext"/> instance.</returns> public virtual DbContext? GetCurrentContext(IQueryable query) { var compilerField = typeof (EntityQueryProvider).GetField("_queryCompiler", BindingFlags.NonPublic | BindingFlags.Instance); var compiler = (QueryCompiler) compilerField.GetValue(query.Provider); var queryContextFactoryField = compiler.GetType().GetField("_queryContextFactory", BindingFlags.NonPublic | BindingFlags.Instance); if (queryContextFactoryField == null) throw new LinqToDBForEFToolsException($"Can not find private field '{compiler.GetType()}._queryContextFactory' in current EFCore Version."); if (queryContextFactoryField.GetValue(compiler) is not RelationalQueryContextFactory queryContextFactory) throw new LinqToDBForEFToolsException("LinqToDB Tools for EFCore support only Relational Databases."); var dependenciesProperty = typeof(RelationalQueryContextFactory).GetField("_dependencies", BindingFlags.NonPublic | BindingFlags.Instance); if (dependenciesProperty == null) throw new LinqToDBForEFToolsException($"Can not find private property '{nameof(RelationalQueryContextFactory)}._dependencies' in current EFCore Version."); var dependencies = (QueryContextDependencies) dependenciesProperty.GetValue(queryContextFactory); return dependencies.CurrentContext?.Context; } /// <summary> /// Extracts EF Core connection information object from <see cref="IDbContextOptions"/>. /// </summary> /// <param name="options"><see cref="IDbContextOptions"/> instance.</param> /// <returns>EF Core connection data.</returns> public virtual EFConnectionInfo ExtractConnectionInfo(IDbContextOptions? options) { var relational = options?.Extensions.OfType<RelationalOptionsExtension>().FirstOrDefault(); return new EFConnectionInfo { ConnectionString = relational?.ConnectionString, Connection = relational?.Connection }; } /// <summary> /// Extracts EF Core data model instance from <see cref="IDbContextOptions"/>. /// </summary> /// <param name="options"><see cref="IDbContextOptions"/> instance.</param> /// <returns>EF Core data model instance.</returns> public virtual IModel? ExtractModel(IDbContextOptions? options) { var coreOptions = options?.Extensions.OfType<CoreOptionsExtension>().FirstOrDefault(); return coreOptions?.Model; } /// <summary> /// Logs lin2db trace event to logger. /// </summary> /// <param name="info">lin2db trace event.</param> /// <param name="logger">Logger instance.</param> public virtual void LogConnectionTrace(TraceInfo info, ILogger logger) { var logLevel = info.TraceLevel switch { TraceLevel.Off => LogLevel.None, TraceLevel.Error => LogLevel.Error, TraceLevel.Warning => LogLevel.Warning, TraceLevel.Info => LogLevel.Information, TraceLevel.Verbose => LogLevel.Debug, _ => LogLevel.Trace, }; using var _ = logger.BeginScope("TraceInfoStep: {TraceInfoStep}, IsAsync: {IsAsync}", info.TraceInfoStep, info.IsAsync); switch (info.TraceInfoStep) { case TraceInfoStep.BeforeExecute: logger.Log(logLevel, "{SqlText}", info.SqlText); break; case TraceInfoStep.AfterExecute: if (info.RecordsAffected is null) { logger.Log(logLevel, "Query Execution Time: {ExecutionTime}.", info.ExecutionTime); } else { logger.Log(logLevel, "Query Execution Time: {ExecutionTime}. Records Affected: {RecordsAffected}.", info.ExecutionTime, info.RecordsAffected); } break; case TraceInfoStep.Error: { logger.Log(logLevel, info.Exception, "Failed executing command."); break; } case TraceInfoStep.Completed: { if (info.RecordsAffected is null) { logger.Log(logLevel, "Total Execution Time: {TotalExecutionTime}.", info.ExecutionTime); } else { logger.Log(logLevel, "Total Execution Time: {TotalExecutionTime}. Rows Count: {RecordsAffected}.", info.ExecutionTime, info.RecordsAffected); } break; } } } /// <summary> /// Creates logger instance. /// </summary> /// <param name="options"><see cref="DbContext"/> options.</param> /// <returns>Logger instance.</returns> public virtual ILogger? CreateLogger(IDbContextOptions? options) { var coreOptions = options?.FindExtension<CoreOptionsExtension>(); var logger = coreOptions?.LoggerFactory?.CreateLogger("LinqToDB"); return logger; } /// <summary> /// Gets or sets default provider version for SQL Server. Set to <see cref="SqlServerVersion.v2008"/> dialect. /// </summary> public static SqlServerVersion SqlServerDefaultVersion { get; set; } = SqlServerVersion.v2008; /// <summary> /// Gets or sets default provider version for PostgreSQL Server. Set to <see cref="PostgreSQLVersion.v93"/> dialect. /// </summary> public static PostgreSQLVersion PostgreSqlDefaultVersion { get; set; } = PostgreSQLVersion.v93; /// <summary> /// Enables attaching entities to change tracker. /// Entities will be attached only if AsNoTracking() is not used in query and DbContext is configured to track entities. /// </summary> public virtual bool EnableChangeTracker { get; set; } = true; } }
35.511111
160
0.679648
[ "MIT" ]
jlukawska/linq2db.EntityFrameworkCore
Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs
41,550
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace Test { /// <summary> /// Hecho por Tomás Agustín Friz /// </summary> static class Program { /// <summary> /// Punto de entrada principal para la aplicación. /// Youtube/VaidrollTeam /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Login()); } } }
22.777778
65
0.596748
[ "MIT" ]
tomasfriz/TPs-DE-LABORATORIO-2
TP 3/Friz.Tomas.2D.TPFinal/Test/Program.cs
620
C#
using System; using ReMi.Common.Constants; using ReMi.Common.Constants.ReleaseExecution; using ReMi.Common.Utils.Enums; namespace ReMi.BusinessEntities.Metrics { public class Metric { public Guid ExternalId { get; set; } public DateTime? ExecutedOn { get; set; } public MetricType MetricType { get; set; } public int Order { get; set; } public string MetricTypeName { get { return EnumDescriptionHelper.GetDescription(MetricType); } } public override string ToString() { return String.Format( "[ExternalId={0}, ExecutedOn={1}, MetricType={2}, Order={3}]", ExternalId, ExecutedOn, MetricType, Order); } } }
28.961538
105
0.612218
[ "MIT" ]
vishalishere/remi
ReMi.Api/BusinessLogic/ReMi.BusinessEntities/Metrics/Metric.cs
753
C#
// // Copyright (c) .NET Foundation and Contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // namespace System { using Runtime.CompilerServices; using System.Collections; using System.Runtime.InteropServices; /// <summary> /// Represents text as a sequence of UTF-16 code units. /// </summary> [Serializable] #pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() #pragma warning disable CS0661 // Type defines operator == or operator != but does not override Object.GetHashCode() /////////////////////////////////////////////////////////////////////////////////////////////////////// // GetHashCode() implementation is provided by general native function CLR_RT_HeapBlock::GetHashCode // /////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma warning disable S1206 // "Equals(Object)" and "GetHashCode()" should be overridden in pairs public sealed class String : IComparable, IEnumerable #pragma warning restore S1206 // "Equals(Object)" and "GetHashCode()" should be overridden in pairs #pragma warning restore CS0661 // Type defines operator == or operator != but does not override Object.GetHashCode() #pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode() { [NativeValue("wchar_t*")] private global::wchar_t string_body__; /// <summary> /// **Not supported in NanoFramework** /// Return an enumerator that iterate on each char of the string. /// </summary> /// <returns>An IEnumerator object that can be used to iterate through the collection.</returns> public IEnumerator GetEnumerator() { // Not implemented because of assembly size constraint // Throw a NotSupportedException in compliance of .net practices // (no message to preserve assembly size/memory consumption) // See https://docs.microsoft.com/en-us/dotnet/api/system.notsupportedexception throw new NotSupportedException(); } /// <summary> /// Represents the empty string. This field is read-only. /// </summary> public static readonly String Empty = ""; /// <summary> /// Determines whether this instance and a specified object, which must also be a String object, have the same value. /// </summary> /// <param name="obj">The string to compare to this instance.</param> /// <returns>true if obj is a String and its value is the same as this instance; otherwise, false. If obj is null, the method returns false.</returns> public override bool Equals(object obj) { var s = obj as String; return s != null && Equals(this, s); } /// <summary> /// Determines whether two specified String objects have the same value. /// </summary> /// <param name="a">The first string to compare, or null.</param> /// <param name="b">The second string to compare, or null.</param> /// <returns>true if the value of a is the same as the value of b; otherwise, false. If both a and b are null, the method returns true.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public static extern bool Equals(String a, String b); /// <summary> /// Determines whether two specified strings have the same value. /// </summary> /// <param name="a">The first string to compare, or null.</param> /// <param name="b">The second string to compare, or null.</param> /// <returns>true if the value of a is the same as the value of b; otherwise, false.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public static extern bool operator ==(String a, String b); /// <summary> /// Determines whether two specified strings have different values. /// </summary> /// <param name="a">The first string to compare, or null.</param> /// <param name="b">The second string to compare, or null.</param> /// <returns>true if the value of a is different from the value of b; otherwise, false.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public static extern bool operator !=(String a, String b); /// <summary> /// Gets the Char object at a specified position in the current String object. /// </summary> /// <value>The object at position index.</value> /// <param name="index">A position in the current string.</param> [IndexerName("Chars")] public extern char this[int index] { [MethodImpl(MethodImplOptions.InternalCall)] get; } internal char GetCharByIndex(int index) { return this[index]; } /// <summary> /// Copies the characters in this instance to a Unicode character array. /// </summary> /// <returns>A Unicode character array whose elements are the individual characters of this instance. If this instance is an empty string, the returned array is empty and has a zero length.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern char[] ToCharArray(); /// <summary> /// Copies the characters in a specified substring in this instance to a Unicode character array. /// </summary> /// <param name="startIndex">The starting position of a substring in this instance.</param> /// <param name="length">The length of the substring in this instance.</param> /// <returns>A Unicode character array whose elements are the length number of characters in this instance starting from character position startIndex.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern char[] ToCharArray(int startIndex, int length); /// <summary> /// Gets the number of characters in the current String object. /// </summary> /// <value> /// The number of characters in the current string. /// </value> public extern int Length { [MethodImpl(MethodImplOptions.InternalCall)] get; } /// <summary> /// Splits a string into substrings that are based on the characters in an array. /// </summary> /// <param name="separator">A character array that delimits the substrings in this string, an empty array that contains no delimiters, or null.</param> /// <returns>An array whose elements contain the substrings from this instance that are delimited by one or more characters in separator. For more information, see the Remarks section.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String[] Split(params char[] separator); /// <summary> /// Splits a string into a maximum number of substrings based on the characters in an array. You also specify the maximum number of substrings to return. /// </summary> /// <param name="separator">A character array that delimits the substrings in this string, an empty array that contains no delimiters, or null.</param> /// <param name="count">The maximum number of substrings to return.</param> /// <returns>An array whose elements contain the substrings in this instance that are delimited by one or more characters in separator. For more information, see the Remarks section.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String[] Split(char[] separator, int count); /// <summary> /// Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string. /// </summary> /// <param name="startIndex">The zero-based starting character position of a substring in this instance.</param> /// <returns>A string that is equivalent to the substring that begins at startIndex in this instance, or Empty if startIndex is equal to the length of this instance.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String Substring(int startIndex); /// <summary> /// Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length. /// </summary> /// <param name="startIndex">The zero-based starting character position of a substring in this instance.</param> /// <param name="length">The number of characters in the substring.</param> /// <returns>A string that is equivalent to the substring of length length that begins at startIndex in this instance, or Empty if startIndex is equal to the length of this instance and length is zero.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String Substring(int startIndex, int length); /// <summary> /// Removes all leading and trailing occurrences of a set of characters specified in an array from the current String object. /// </summary> /// <param name="trimChars">An array of Unicode characters to remove, or null.</param> /// <returns>The string that remains after all occurrences of the characters in the trimChars parameter are removed from the start and end of the current string. /// If trimChars is null or an empty array, white-space characters are removed instead. If no characters can be trimmed from the current instance, /// the method returns the current instance unchanged.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String Trim(params char[] trimChars); /// <summary> /// Removes all leading occurrences of a set of characters specified in an array from the current String object. /// </summary> /// <param name="trimChars">An array of Unicode characters to remove, or null.</param> /// <returns>The string that remains after all occurrences of characters in the trimChars parameter are removed from the start of the current string. If trimChars is null or an empty array, white-space characters are removed instead.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String TrimStart(params char[] trimChars); /// <summary> /// Removes all trailing occurrences of a set of characters specified in an array from the current String object. /// </summary> /// <param name="trimChars">An array of Unicode characters to remove, or null.</param> /// <returns>The string that remains after all occurrences of the characters in the trimChars parameter are removed from the end of the current string. If trimChars is null or an empty array, Unicode white-space characters are removed instead. If no characters can be trimmed from the current instance, the method returns the current instance unchanged.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String TrimEnd(params char[] trimChars); /// <summary> /// Initializes a new instance of the String class to the value indicated by an array of Unicode characters, a starting character position within that array, and a length. /// </summary> /// <param name="value">An array of Unicode characters. </param> /// <param name="startIndex">The starting position within value. </param> /// <param name="length">The number of characters within value to use. </param> [MethodImpl(MethodImplOptions.InternalCall)] public extern String(char[] value, int startIndex, int length); /// <summary> /// Initializes a new instance of the String class to the value indicated by an array of Unicode characters. /// </summary> /// <param name="value">An array of Unicode characters.</param> [MethodImpl(MethodImplOptions.InternalCall)] public extern String(char[] value); /// <summary> /// Initializes a new instance of the String class to the value indicated by a specified Unicode character repeated a specified number of times. /// </summary> /// <param name="c">A Unicode character.</param> /// <param name="count">The number of times c occurs.</param> [MethodImpl(MethodImplOptions.InternalCall)] public extern String(char c, int count); /// <summary> /// Compares two specified String objects and returns an integer that indicates their relative position in the sort order. /// </summary> /// <param name="strA">The first string to compare.</param> /// <param name="strB">The second string to compare.</param> /// <returns>A 32-bit signed integer that indicates the lexical relationship between the two comparands.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public static extern int Compare(String strA, String strB); /// <summary> /// Compares this instance with a specified Object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified Object. /// </summary> /// <param name="value">An object that evaluates to a String.</param> /// <returns>A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the value parameter.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int CompareTo(Object value); /// <summary> /// Compares this instance with a specified String object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified string. /// </summary> /// <param name="strB">The string to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the strB parameter.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int CompareTo(String strB); /// <summary> /// Reports the zero-based index of the first occurrence of the specified Unicode character in this string. /// </summary> /// <param name="value">A Unicode character to seek.</param> /// <returns>The zero-based index position of value if that character is found, or -1 if it is not.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int IndexOf(char value); /// <summary> /// Reports the zero-based index of the first occurrence of the specified Unicode character in this string. The search starts at a specified character position. /// </summary> /// <param name="value">A Unicode character to seek.</param> /// <param name="startIndex">The search starting position.</param> /// <returns>The zero-based index position of value from the start of the string if that character is found, or -1 if it is not.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int IndexOf(char value, int startIndex); /// <summary> /// Reports the zero-based index of the first occurrence of the specified character in this instance. The search starts at a specified character position and examines a specified number of character positions. /// </summary> /// <param name="value">A Unicode character to seek. </param> /// <param name="startIndex">The search starting position. </param> /// <param name="count">The number of character positions to examine.</param> /// <returns>The zero-based index position of value if that character is found, or -1 if it is not.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int IndexOf(char value, int startIndex, int count); /// <summary> /// Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. /// </summary> /// <param name="anyOf">A Unicode character array containing one or more characters to seek.</param> /// <returns>The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int IndexOfAny(char[] anyOf); /// <summary> /// Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position. /// </summary> /// <param name="anyOf">A Unicode character array containing one or more characters to seek.</param> /// <param name="startIndex">The search starting position.</param> /// <returns>The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int IndexOfAny(char[] anyOf, int startIndex); /// <summary> /// Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions. /// </summary> /// <param name="anyOf">A Unicode character array containing one or more characters to seek.</param> /// <param name="startIndex">The search starting position.</param> /// <param name="count">The number of character positions to examine.</param> /// <returns>The zero-based index position of the first occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int IndexOfAny(char[] anyOf, int startIndex, int count); /// <summary> /// Reports the zero-based index of the first occurrence of the specified string in this instance. /// </summary> /// <param name="value">The string to seek.</param> /// <returns>The zero-based index position of value if that string is found, or -1 if it is not. If value is String.Empty, the return value is 0.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int IndexOf(String value); /// <summary> /// Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position. /// </summary> /// <param name="value">The string to seek.</param> /// <param name="startIndex">The search starting position.</param> /// <returns>The zero-based index position of value from the start of the current instance if that string is found, or -1 if it is not. If value is String.Empty, the return value is startIndex.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int IndexOf(String value, int startIndex); /// <summary> /// Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position and examines a specified number of character positions. /// </summary> /// <param name="value">The string to seek.</param> /// <param name="startIndex">The search starting position.</param> /// <param name="count">The number of character positions to examine.</param> /// <returns>The zero-based index position of value from the start of the current instance if that string is found, or -1 if it is not. If value is String.Empty, the return value is startIndex.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int IndexOf(String value, int startIndex, int count); /// <summary> /// Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. /// </summary> /// <param name="value">The Unicode character to seek.</param> /// <returns>The zero-based index position of value if that character is found, or -1 if it is not.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int LastIndexOf(char value); /// <summary> /// Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string. /// </summary> /// <param name="value">The Unicode character to seek.</param> /// <param name="startIndex">The starting position of the search. The search proceeds from startIndex toward the beginning of this instance.</param> /// <returns>The zero-based index position of value if that character is found, or -1 if it is not found or if the current instance equals String.Empty.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int LastIndexOf(char value, int startIndex); /// <summary> /// Reports the zero-based index position of the last occurrence of the specified Unicode character in a substring within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions. /// </summary> /// <param name="value">The Unicode character to seek. </param> /// <param name="startIndex">The starting position of the search. The search proceeds from startIndex toward the beginning of this instance.</param> /// <param name="count">The number of character positions to examine. </param> /// <returns>The zero-based index position of value if that character is found, or -1 if it is not found or if the current instance equals String.Empty.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int LastIndexOf(char value, int startIndex, int count); /// <summary> /// Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. /// </summary> /// <param name="anyOf">A Unicode character array containing one or more characters to seek.</param> /// <returns>The index position of the last occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int LastIndexOfAny(char[] anyOf); /// <summary> /// Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. The search starts at a specified character position and proceeds backward toward the beginning of the string. /// </summary> /// <param name="anyOf">A Unicode character array containing one or more characters to seek.</param> /// <param name="startIndex">The search starting position. The search proceeds from startIndex toward the beginning of this instance.</param> /// <returns>The index position of the last occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found or if the current instance equals String.Empty.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int LastIndexOfAny(char[] anyOf, int startIndex); /// <summary> /// Reports the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions. /// </summary> /// <param name="anyOf">A Unicode character array containing one or more characters to seek.</param> /// <param name="startIndex">The search starting position. The search proceeds from startIndex toward the beginning of this instance.</param> /// <param name="count">The number of character positions to examine.</param> /// <returns>The index position of the last occurrence in this instance where any character in anyOf was found; -1 if no character in anyOf was found or if the current instance equals String.Empty.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int LastIndexOfAny(char[] anyOf, int startIndex, int count); /// <summary> /// Reports the zero-based index position of the last occurrence of a specified string within this instance. /// </summary> /// <param name="value">The string to seek.</param> /// <returns>The zero-based starting index position of value if that string is found, or -1 if it is not. If value is String.Empty, the return value is the last index position in this instance.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int LastIndexOf(String value); /// <summary> /// Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string. /// </summary> /// <param name="value">The string to seek.</param> /// <param name="startIndex">The search starting position. The search proceeds from startIndex toward the beginning of this instance.</param> /// <returns>The zero-based starting index position of value if that string is found, or -1 if it is not found or if the current instance equals String.Empty. If value is String.Empty, the return value is the smaller of startIndex and the last index position in this instance.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int LastIndexOf(String value, int startIndex); /// <summary> /// Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string for a specified number of character positions. /// </summary> /// <param name="value">The string to seek.</param> /// <param name="startIndex">The search starting position. The search proceeds from startIndex toward the beginning of this instance.</param> /// <param name="count">The number of character positions to examine.</param> /// <returns>The zero-based starting index position of value if that string is found, or -1 if it is not found or if the current instance equals String.Empty. If value is Empty, the return value is the smaller of startIndex and the last index position in this instance.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern int LastIndexOf(String value, int startIndex, int count); /// <summary> /// Returns a copy of this string converted to lowercase. /// </summary> /// <returns>A string in lowercase.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String ToLower(); /// <summary> /// Returns a copy of this string converted to uppercase. /// </summary> /// <returns>The uppercase equivalent of the current string.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String ToUpper(); /// <summary> /// Returns this instance of String; no actual conversion is performed. /// </summary> /// <returns>The current string.</returns> public override String ToString() { return this; } /// <summary> /// Removes all leading and trailing white-space characters from the current String object. /// </summary> /// <returns>The string that remains after all white-space characters are removed from the start and end of the current string. If no characters can be trimmed from the current instance, the method returns the current instance unchanged.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public extern String Trim(); /// <summary> /// Creates the string representation of a specified object. /// </summary> /// <param name="arg0">The object to represent, or null.</param> /// <returns>The string representation of the value of arg0, or String.Empty if arg0 is null.</returns> public static String Concat(Object arg0) { return arg0 == null ? Empty : arg0.ToString(); } /// <summary> /// Concatenates the string representations of two specified objects. /// </summary> /// <param name="arg0">The first object to concatenate.</param> /// <param name="arg1">The second object to concatenate.</param> /// <returns>The concatenated string representations of the values of arg0 and arg1.</returns> public static String Concat(Object arg0, Object arg1) { if (arg0 == null) { arg0 = Empty; } if (arg1 == null) { arg1 = Empty; } return Concat(arg0.ToString(), arg1.ToString()); } /// <summary> /// Concatenates the string representations of three specified objects. /// </summary> /// <param name="arg0">The first object to concatenate.</param> /// <param name="arg1">The second object to concatenate.</param> /// <param name="arg2">The third object to concatenate.</param> /// <returns>The concatenated string representations of the values of arg0, arg1 and arg2.</returns> public static String Concat(Object arg0, Object arg1, Object arg2) { if (arg0 == null) { arg0 = Empty; } if (arg1 == null) { arg1 = Empty; } if (arg2 == null) { arg2 = Empty; } return Concat(arg0.ToString(), arg1.ToString(), arg2.ToString()); } /// <summary> /// Concatenates the string representations of the elements in a specified Object array. /// </summary> /// <param name="args">An object array that contains the elements to concatenate.</param> /// <returns>The concatenated string representations of the values of the elements in args.</returns> /// <exception cref="ArgumentNullException"></exception> public static String Concat(params Object[] args) { if (args == null) throw new ArgumentNullException("args"); var length = args.Length; var sArgs = new String[length]; for (var i = 0; i < length; i++) { sArgs[i] = args[i] == null ? Empty : args[i].ToString(); } return Concat(sArgs); } /// <summary> /// Concatenates two specified instances of String. /// </summary> /// <param name="str0">The first string to concatenate.</param> /// <param name="str1">The second string to concatenate.</param> /// <returns>The concatenation of str0 and str1.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public static extern String Concat(String str0, String str1); /// <summary> /// Concatenates three specified instances of String. /// </summary> /// <param name="str0">The first string to concatenate.</param> /// <param name="str1">The second string to concatenate.</param> /// <param name="str2">The third string to concatenate.</param> /// <returns>The concatenation of str0, str1 and str2.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public static extern String Concat(String str0, String str1, String str2); /// <summary> /// Concatenates four specified instances of String. /// </summary> /// <param name="str0">The first string to concatenate.</param> /// <param name="str1">The second string to concatenate.</param> /// <param name="str2">The third string to concatenate.</param> /// <param name="str3">The fourth string to concatenate.</param> /// <returns>The concatenation of str0, str1, str2 and str3.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public static extern String Concat(String str0, String str1, String str2, String str3); /// <summary> /// Concatenates the elements of a specified String array. /// </summary> /// <param name="values">An array of string instances.</param> /// <returns>The concatenated elements of values.</returns> [MethodImpl(MethodImplOptions.InternalCall)] public static extern String Concat(params String[] values); /// <summary> /// Retrieves the system's reference to the specified String. /// </summary> /// <param name="str">A string to search for in the intern pool.</param> /// <returns>The system's reference to str, if it is interned; otherwise, a new reference to a string with the value of str.</returns> public static String Intern(String str) { return str; } /// <summary> /// Retrieves a reference to a specified String. /// </summary> /// <param name="str">The string to search for in the intern pool.</param> /// <returns>A reference to str if it is in the common language runtime intern pool; otherwise, null.</returns> public static String IsInterned(String str) { return str; } /// <summary> /// Replaces the format items in a string with the string representations of corresponding objects in a specified array. /// </summary> /// <param name="format">A composite format string</param> /// <param name="args">An object array that contains zero or more objects to format.</param> /// <returns>A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.</returns> public static string Format(string format, params object[] args) { var index = 0; var alignment = 0; var chr = '\0'; var len = format.Length; var fmt = Empty; var token = Empty; var output = Empty; if (format is null) { throw new ArgumentNullException("format can't be null"); } for (var i = 0; i < len; i++) { token = Empty; chr = format[i]; if (chr == '{') { if (i + 1 == len) { throw new ArgumentException("Format error: no closed brace, column " + i); } if (format[i + 1] == '{') { output += chr; i++; continue; } else { alignment = 0; fmt = Empty; for (i++; i < len; i++) { chr = format[i]; if (chr >= '0' && chr <= '9') { token += chr; } else if (chr == ',' || chr == ':' || chr == '}') { break; } else { throw new ArgumentException("Format error: wrong symbol at {}, column " + i); } } if (token.Length > 0) { index = int.Parse(token); } else { throw new ArgumentException("Format error: empty {}, column " + i); } if (chr == ',') { if (format[i + 1] == '-') { token = "-"; i++; } else { token = Empty; } for (i++; i < len; i++) { chr = format[i]; if (chr >= '0' && chr <= '9') { token += chr; } else if (chr == ':' || chr == '}') { break; } else { throw new ArgumentException("Format error: wrong symbol at alignment, column " + i); } } if (token.Length > 0) { alignment = int.Parse(token); } else { throw new ArgumentException("Format error: empty alignment, column " + i); } } if (chr == ':') { token = Empty; for (i++; i < len; i++) { chr = format[i]; if (chr == '}') { break; } else { token += chr; } } if (token.Length > 0) { fmt = token; } else { throw new ArgumentException("Format error: empty format after ':', column " + i); } } } if (chr != '}') { throw new ArgumentException("Format error: no closed brace, column " + i); } if (fmt.Length > 0) { #if NANOCLR_REFLECTION if (args[index] is null) { token = ""; } else { var method = args[index].GetType().GetMethod("ToString", new Type[] { typeof(string) }); token = (method is null) ? args[index].ToString() : method.Invoke(args[index], new object[] { token }).ToString(); } #else throw new NotImplementedException(); #endif // NANOCLR_REFLECTION } else { token = args[index] == null ? "" : args[index].ToString(); } if (alignment > 0) { output += token.PadLeft(alignment); } else if (alignment < 0) { output += token.PadRight(MathInternal.Abs(alignment)); } else { output += token; } } else if (chr == '}') { if (i + 1 == len) { throw new ArgumentException("Format error: no closed brace, column " + i); } if (format[i + 1] == '}') { output += chr; i++; } else { throw new ArgumentException("Format error: no closed brace, column " + i); } } else { output += chr; } } return output; } /// <summary> /// Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a specified total length. /// </summary> /// <param name="totalWidth">The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.</param> /// <param name="paddingChar">A Unicode padding character.</param> /// <returns></returns> public String PadLeft(int totalWidth, char paddingChar = ' ') { if (totalWidth < 0) { #pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one throw new ArgumentOutOfRangeException("totalWidth can't be less than 0"); #pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one } if (Length >= totalWidth) { return this; } else { return new String(paddingChar, totalWidth - Length) + this; } } /// <summary> /// Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length. /// </summary> /// <param name="totalWidth">The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.</param> /// <param name="paddingChar">A Unicode padding character.</param> /// <returns></returns> public String PadRight(int totalWidth, char paddingChar = ' ') { if (totalWidth < 0) { #pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one throw new ArgumentOutOfRangeException("totalWidth can't be less than 0"); #pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one } if (Length >= totalWidth) { return this; } else { return this + new String(paddingChar, totalWidth - Length); } } /// <summary> /// Indicates whether the specified string is <see langword="null"/> or an empty string (""). /// </summary> /// <param name="value">The string to test.</param> /// <returns><see langword="true"/> if the value parameter is <see langword="null"/> or an empty string (""); otherwise, <see langword="false"/>.</returns> public static bool IsNullOrEmpty(string value) { return value == null || value.Length == 0; } /// <summary> /// Returns a value indicating whether a specified substring occurs within this string. /// </summary> /// <param name="value">The string to seek.</param> /// <returns><see langword="true"/> if the <paramref name="value"/> parameter occurs within this string, or if <paramref name="value"/> is the empty string (""); otherwise, <see langword="false"/>.</returns> public bool Contains(string value) { if (value == Empty) { return true; } return IndexOf(value) >= 0; } /// <summary> /// Determines whether the beginning of this string instance matches the specified string. /// </summary> /// <param name="value">The string to compare.</param> /// <returns><see langword="true"/> if <paramref name="value"/> matches the beginning of this string; otherwise, <see langword="false"/>.</returns> /// <exception cref="ArgumentNullException"><paramref name="value"/> is <see langword="null"/>.</exception> public bool StartsWith(string value) { if ((object)value == null) { throw new ArgumentNullException(); } if ((object)this == value) { return true; } if (value.Length == 0) { return true; } if (Length < value.Length) { return false; } return Compare( Substring(0, value.Length), value) == 0; } /// <summary> /// Determines whether the end of this string instance matches the specified string. /// </summary> /// <param name="value">The string to compare to the substring at the end of this instance.</param> /// <returns><see langword="true"/> if <paramref name="value"/> matches the end of this instance; otherwise, <see langword="false"/>.</returns> public bool EndsWith(string value) { if ((object)value == null) { throw new ArgumentNullException(); } if ((object)this == value) { return true; } if (value.Length == 0) { return true; } return Length >= value.Length && (Compare( Substring(Length - value.Length), value) == 0); } } }
52.051366
371
0.586411
[ "MIT" ]
cyborgyn/CoreLibrary
nanoFramework.CoreLibrary/System/String.cs
47,627
C#
 using Microsoft.EntityFrameworkCore; namespace Project.Data.Entities { public class CobraKaiDbContext : DbContext { public CobraKaiDbContext() { } public CobraKaiDbContext(DbContextOptions<CobraKaiDbContext> options) : base(options) { } public virtual DbSet<Entities.Journal> Journals { get; set; } public virtual DbSet<Entities.Person> People { get; set; } public virtual DbSet<Entities.Playlist> Playlists { get; set; } public virtual DbSet<Entities.Song> Songs { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) optionsBuilder.UseSqlServer("Server=tcp:utadbserverdc.database.windows.net,1433;Initial Catalog=Project2DB;Persist Security Info=False;User ID=danielcoombs005;Password=Password123;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"); } } }
25.365854
294
0.691346
[ "MIT" ]
1905-may06-dotnet/Team2-CobraKai-Project2
Project2Solution/Project.Data/Entities/CobraKaiDbContext.cs
1,042
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("Problem01ExchangeIfGreater")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Problem01ExchangeIfGreater")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bde939b9-7807-4f04-aa29-1c3a53806130")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
38.513514
84
0.750175
[ "MIT" ]
MarinMarinov/C-Sharp-Part1
05. Homework - ConditionalStatements/Problem01ExchangeIfGreater/Properties/AssemblyInfo.cs
1,428
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace NetSpeak___Server.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } }
34.580645
151
0.583955
[ "MIT" ]
boomtnt46/NetSpeak
NetSpeak - Server/Properties/Settings.Designer.cs
1,074
C#
/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ using Lucene.Net.Attributes; using Lucene.Net.Support; using NUnit.Framework; using System; namespace Lucene.Net.Benchmarks.Support { /// <summary> /// LUCENENET specific tests for ensuring API conventions are followed /// </summary> public class TestApiConsistency : ApiScanTestBase { [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestProtectedFieldNames(Type typeFromTargetAssembly) { base.TestProtectedFieldNames(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestPrivateFieldNames(Type typeFromTargetAssembly) { base.TestPrivateFieldNames(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestPublicFields(Type typeFromTargetAssembly) { base.TestPublicFields(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestMethodParameterNames(Type typeFromTargetAssembly) { base.TestMethodParameterNames(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestInterfaceNames(Type typeFromTargetAssembly) { base.TestInterfaceNames(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestClassNames(Type typeFromTargetAssembly) { base.TestClassNames(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestForPropertiesWithNoGetter(Type typeFromTargetAssembly) { base.TestForPropertiesWithNoGetter(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestForPropertiesThatReturnArray(Type typeFromTargetAssembly) { base.TestForPropertiesThatReturnArray(typeFromTargetAssembly); } #if !NETSTANDARD1_6 [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestForMethodsThatReturnWritableArray(Type typeFromTargetAssembly) { base.TestForMethodsThatReturnWritableArray(typeFromTargetAssembly); } #endif [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestForPublicMembersContainingComparer(Type typeFromTargetAssembly) { base.TestForPublicMembersContainingComparer(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestForPublicMembersNamedSize(Type typeFromTargetAssembly) { base.TestForPublicMembersNamedSize(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestForPublicMembersContainingNonNetNumeric(Type typeFromTargetAssembly) { base.TestForPublicMembersContainingNonNetNumeric(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestForTypesContainingNonNetNumeric(Type typeFromTargetAssembly) { base.TestForTypesContainingNonNetNumeric(typeFromTargetAssembly); } [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestForPublicMembersWithNullableEnum(Type typeFromTargetAssembly) { base.TestForPublicMembersWithNullableEnum(typeFromTargetAssembly); } // LUCENENET NOTE: This test is only for identifying members who were changed from // ICollection, IList or ISet to IEnumerable during the port (that should be changed back) //[Test, LuceneNetSpecific] //[TestCase(typeof(Lucene.Net.Benchmarks.Constants))] //public override void TestForMembersAcceptingOrReturningIEnumerable(Type typeFromTargetAssembly) //{ // base.TestForMembersAcceptingOrReturningIEnumerable(typeFromTargetAssembly); //} [Test, LuceneNetSpecific] [TestCase(typeof(Lucene.Net.Benchmarks.Constants))] public override void TestForMembersAcceptingOrReturningListOrDictionary(Type typeFromTargetAssembly) { base.TestForMembersAcceptingOrReturningListOrDictionary(typeFromTargetAssembly); } } }
38.476821
108
0.705508
[ "Apache-2.0" ]
DiogenesPolanco/lucenenet
src/Lucene.Net.Tests.Benchmark/Support/TestApiConsistency.cs
5,812
C#
#pragma warning disable 1591 //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.34014 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace AWAPI_Data.Data { using System.Data.Linq; using System.Data.Linq.Mapping; using System.Data; using System.Collections.Generic; using System.Reflection; using System.Linq; using System.Linq.Expressions; using System.ComponentModel; using System; [global::System.Data.Linq.Mapping.DatabaseAttribute(Name="Awapi")] public partial class SiteContextDataContext : System.Data.Linq.DataContext { private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource(); #region Extensibility Method Definitions partial void OnCreated(); partial void InsertawSiteDomainSecurity(awSiteDomainSecurity instance); partial void UpdateawSiteDomainSecurity(awSiteDomainSecurity instance); partial void DeleteawSiteDomainSecurity(awSiteDomainSecurity instance); partial void InsertawRoleMember(awRoleMember instance); partial void UpdateawRoleMember(awRoleMember instance); partial void DeleteawRoleMember(awRoleMember instance); partial void InsertawCulture(awCulture instance); partial void UpdateawCulture(awCulture instance); partial void DeleteawCulture(awCulture instance); partial void InsertawSiteCulture(awSiteCulture instance); partial void UpdateawSiteCulture(awSiteCulture instance); partial void DeleteawSiteCulture(awSiteCulture instance); partial void InsertawRole(awRole instance); partial void UpdateawRole(awRole instance); partial void DeleteawRole(awRole instance); partial void InsertawSiteUser(awSiteUser instance); partial void UpdateawSiteUser(awSiteUser instance); partial void DeleteawSiteUser(awSiteUser instance); partial void InsertawUser(awUser instance); partial void UpdateawUser(awUser instance); partial void DeleteawUser(awUser instance); partial void InsertawCultureValue(awCultureValue instance); partial void UpdateawCultureValue(awCultureValue instance); partial void DeleteawCultureValue(awCultureValue instance); partial void InsertawEnvironment(awEnvironment instance); partial void UpdateawEnvironment(awEnvironment instance); partial void DeleteawEnvironment(awEnvironment instance); partial void InsertawAutomatedTask(awAutomatedTask instance); partial void UpdateawAutomatedTask(awAutomatedTask instance); partial void DeleteawAutomatedTask(awAutomatedTask instance); partial void InsertawSite(awSite instance); partial void UpdateawSite(awSite instance); partial void DeleteawSite(awSite instance); #endregion public SiteContextDataContext() : base(global::AWAPI_Data.Properties.Settings.Default.AWAPIConnectionString, mappingSource) { OnCreated(); } public SiteContextDataContext(string connection) : base(connection, mappingSource) { OnCreated(); } public SiteContextDataContext(System.Data.IDbConnection connection) : base(connection, mappingSource) { OnCreated(); } public SiteContextDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } public SiteContextDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : base(connection, mappingSource) { OnCreated(); } public System.Data.Linq.Table<awSiteDomainSecurity> awSiteDomainSecurities { get { return this.GetTable<awSiteDomainSecurity>(); } } public System.Data.Linq.Table<awRoleMember> awRoleMembers { get { return this.GetTable<awRoleMember>(); } } public System.Data.Linq.Table<awCulture> awCultures { get { return this.GetTable<awCulture>(); } } public System.Data.Linq.Table<awSiteCulture> awSiteCultures { get { return this.GetTable<awSiteCulture>(); } } public System.Data.Linq.Table<awRole> awRoles { get { return this.GetTable<awRole>(); } } public System.Data.Linq.Table<awSiteUser> awSiteUsers { get { return this.GetTable<awSiteUser>(); } } public System.Data.Linq.Table<awUser> awUsers { get { return this.GetTable<awUser>(); } } public System.Data.Linq.Table<awCultureValue> awCultureValues { get { return this.GetTable<awCultureValue>(); } } public System.Data.Linq.Table<awEnvironment> awEnvironments { get { return this.GetTable<awEnvironment>(); } } public System.Data.Linq.Table<awAutomatedTask> awAutomatedTasks { get { return this.GetTable<awAutomatedTask>(); } } public System.Data.Linq.Table<awSite> awSites { get { return this.GetTable<awSite>(); } } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awSiteDomainSecurity")] public partial class awSiteDomainSecurity : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _siteDomainFilterId; private long _siteId; private string _domainAddress; private bool _allowRead; private bool _allowUpdate; private bool _allowCreate; private bool _allowDelete; private System.Nullable<long> _userId; private System.DateTime _lastBuildDate; private EntityRef<awUser> _awUser; private EntityRef<awSite> _awSite; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnsiteDomainFilterIdChanging(long value); partial void OnsiteDomainFilterIdChanged(); partial void OnsiteIdChanging(long value); partial void OnsiteIdChanged(); partial void OndomainAddressChanging(string value); partial void OndomainAddressChanged(); partial void OnallowReadChanging(bool value); partial void OnallowReadChanged(); partial void OnallowUpdateChanging(bool value); partial void OnallowUpdateChanged(); partial void OnallowCreateChanging(bool value); partial void OnallowCreateChanged(); partial void OnallowDeleteChanging(bool value); partial void OnallowDeleteChanged(); partial void OnuserIdChanging(System.Nullable<long> value); partial void OnuserIdChanged(); partial void OnlastBuildDateChanging(System.DateTime value); partial void OnlastBuildDateChanged(); #endregion public awSiteDomainSecurity() { this._awUser = default(EntityRef<awUser>); this._awSite = default(EntityRef<awSite>); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteDomainFilterId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long siteDomainFilterId { get { return this._siteDomainFilterId; } set { if ((this._siteDomainFilterId != value)) { this.OnsiteDomainFilterIdChanging(value); this.SendPropertyChanging(); this._siteDomainFilterId = value; this.SendPropertyChanged("siteDomainFilterId"); this.OnsiteDomainFilterIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteId", DbType="BigInt NOT NULL")] public long siteId { get { return this._siteId; } set { if ((this._siteId != value)) { if (this._awSite.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnsiteIdChanging(value); this.SendPropertyChanging(); this._siteId = value; this.SendPropertyChanged("siteId"); this.OnsiteIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_domainAddress", DbType="NChar(50) NOT NULL", CanBeNull=false)] public string domainAddress { get { return this._domainAddress; } set { if ((this._domainAddress != value)) { this.OndomainAddressChanging(value); this.SendPropertyChanging(); this._domainAddress = value; this.SendPropertyChanged("domainAddress"); this.OndomainAddressChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_allowRead", DbType="Bit NOT NULL")] public bool allowRead { get { return this._allowRead; } set { if ((this._allowRead != value)) { this.OnallowReadChanging(value); this.SendPropertyChanging(); this._allowRead = value; this.SendPropertyChanged("allowRead"); this.OnallowReadChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_allowUpdate", DbType="Bit NOT NULL")] public bool allowUpdate { get { return this._allowUpdate; } set { if ((this._allowUpdate != value)) { this.OnallowUpdateChanging(value); this.SendPropertyChanging(); this._allowUpdate = value; this.SendPropertyChanged("allowUpdate"); this.OnallowUpdateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_allowCreate", DbType="Bit NOT NULL")] public bool allowCreate { get { return this._allowCreate; } set { if ((this._allowCreate != value)) { this.OnallowCreateChanging(value); this.SendPropertyChanging(); this._allowCreate = value; this.SendPropertyChanged("allowCreate"); this.OnallowCreateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_allowDelete", DbType="Bit NOT NULL")] public bool allowDelete { get { return this._allowDelete; } set { if ((this._allowDelete != value)) { this.OnallowDeleteChanging(value); this.SendPropertyChanging(); this._allowDelete = value; this.SendPropertyChanged("allowDelete"); this.OnallowDeleteChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userId", DbType="BigInt")] public System.Nullable<long> userId { get { return this._userId; } set { if ((this._userId != value)) { if (this._awUser.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnuserIdChanging(value); this.SendPropertyChanging(); this._userId = value; this.SendPropertyChanged("userId"); this.OnuserIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_lastBuildDate", DbType="DateTime NOT NULL")] public System.DateTime lastBuildDate { get { return this._lastBuildDate; } set { if ((this._lastBuildDate != value)) { this.OnlastBuildDateChanging(value); this.SendPropertyChanging(); this._lastBuildDate = value; this.SendPropertyChanged("lastBuildDate"); this.OnlastBuildDateChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awUser_awSiteDomainSecurity", Storage="_awUser", ThisKey="userId", OtherKey="userId", IsForeignKey=true)] public awUser awUser { get { return this._awUser.Entity; } set { awUser previousValue = this._awUser.Entity; if (((previousValue != value) || (this._awUser.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awUser.Entity = null; previousValue.awSiteDomainSecurities.Remove(this); } this._awUser.Entity = value; if ((value != null)) { value.awSiteDomainSecurities.Add(this); this._userId = value.userId; } else { this._userId = default(Nullable<long>); } this.SendPropertyChanged("awUser"); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awSiteDomainSecurity", Storage="_awSite", ThisKey="siteId", OtherKey="siteId", IsForeignKey=true)] public awSite awSite { get { return this._awSite.Entity; } set { awSite previousValue = this._awSite.Entity; if (((previousValue != value) || (this._awSite.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awSite.Entity = null; previousValue.awSiteDomainSecurities.Remove(this); } this._awSite.Entity = value; if ((value != null)) { value.awSiteDomainSecurities.Add(this); this._siteId = value.siteId; } else { this._siteId = default(long); } this.SendPropertyChanged("awSite"); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awRoleMember")] public partial class awRoleMember : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _roleMemberId; private long _siteId; private long _roleId; private long _userId; private EntityRef<awRole> _awRole; private EntityRef<awUser> _awUser; private EntityRef<awSite> _awSite; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnroleMemberIdChanging(long value); partial void OnroleMemberIdChanged(); partial void OnsiteIdChanging(long value); partial void OnsiteIdChanged(); partial void OnroleIdChanging(long value); partial void OnroleIdChanged(); partial void OnuserIdChanging(long value); partial void OnuserIdChanged(); #endregion public awRoleMember() { this._awRole = default(EntityRef<awRole>); this._awUser = default(EntityRef<awUser>); this._awSite = default(EntityRef<awSite>); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_roleMemberId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long roleMemberId { get { return this._roleMemberId; } set { if ((this._roleMemberId != value)) { this.OnroleMemberIdChanging(value); this.SendPropertyChanging(); this._roleMemberId = value; this.SendPropertyChanged("roleMemberId"); this.OnroleMemberIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteId", DbType="BigInt NOT NULL")] public long siteId { get { return this._siteId; } set { if ((this._siteId != value)) { if (this._awSite.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnsiteIdChanging(value); this.SendPropertyChanging(); this._siteId = value; this.SendPropertyChanged("siteId"); this.OnsiteIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_roleId", DbType="BigInt NOT NULL")] public long roleId { get { return this._roleId; } set { if ((this._roleId != value)) { if (this._awRole.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnroleIdChanging(value); this.SendPropertyChanging(); this._roleId = value; this.SendPropertyChanged("roleId"); this.OnroleIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userId", DbType="BigInt NOT NULL")] public long userId { get { return this._userId; } set { if ((this._userId != value)) { if (this._awUser.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnuserIdChanging(value); this.SendPropertyChanging(); this._userId = value; this.SendPropertyChanged("userId"); this.OnuserIdChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awRole_awRoleMember", Storage="_awRole", ThisKey="roleId", OtherKey="roleId", IsForeignKey=true)] public awRole awRole { get { return this._awRole.Entity; } set { awRole previousValue = this._awRole.Entity; if (((previousValue != value) || (this._awRole.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awRole.Entity = null; previousValue.awRoleMembers.Remove(this); } this._awRole.Entity = value; if ((value != null)) { value.awRoleMembers.Add(this); this._roleId = value.roleId; } else { this._roleId = default(long); } this.SendPropertyChanged("awRole"); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awUser_awRoleMember", Storage="_awUser", ThisKey="userId", OtherKey="userId", IsForeignKey=true)] public awUser awUser { get { return this._awUser.Entity; } set { awUser previousValue = this._awUser.Entity; if (((previousValue != value) || (this._awUser.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awUser.Entity = null; previousValue.awRoleMembers.Remove(this); } this._awUser.Entity = value; if ((value != null)) { value.awRoleMembers.Add(this); this._userId = value.userId; } else { this._userId = default(long); } this.SendPropertyChanged("awUser"); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awRoleMember", Storage="_awSite", ThisKey="siteId", OtherKey="siteId", IsForeignKey=true)] public awSite awSite { get { return this._awSite.Entity; } set { awSite previousValue = this._awSite.Entity; if (((previousValue != value) || (this._awSite.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awSite.Entity = null; previousValue.awRoleMembers.Remove(this); } this._awSite.Entity = value; if ((value != null)) { value.awRoleMembers.Add(this); this._siteId = value.siteId; } else { this._siteId = default(long); } this.SendPropertyChanged("awSite"); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awCulture")] public partial class awCulture : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private string _cultureCode; private string _title; private EntitySet<awSiteCulture> _awSiteCultures; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OncultureCodeChanging(string value); partial void OncultureCodeChanged(); partial void OntitleChanging(string value); partial void OntitleChanged(); #endregion public awCulture() { this._awSiteCultures = new EntitySet<awSiteCulture>(new Action<awSiteCulture>(this.attach_awSiteCultures), new Action<awSiteCulture>(this.detach_awSiteCultures)); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_cultureCode", DbType="NVarChar(2) NOT NULL", CanBeNull=false, IsPrimaryKey=true)] public string cultureCode { get { return this._cultureCode; } set { if ((this._cultureCode != value)) { this.OncultureCodeChanging(value); this.SendPropertyChanging(); this._cultureCode = value; this.SendPropertyChanged("cultureCode"); this.OncultureCodeChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_title", DbType="NVarChar(20) NOT NULL", CanBeNull=false)] public string title { get { return this._title; } set { if ((this._title != value)) { this.OntitleChanging(value); this.SendPropertyChanging(); this._title = value; this.SendPropertyChanged("title"); this.OntitleChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awCulture_awSiteCulture", Storage="_awSiteCultures", ThisKey="cultureCode", OtherKey="cultureCode")] public EntitySet<awSiteCulture> awSiteCultures { get { return this._awSiteCultures; } set { this._awSiteCultures.Assign(value); } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } private void attach_awSiteCultures(awSiteCulture entity) { this.SendPropertyChanging(); entity.awCulture = this; } private void detach_awSiteCultures(awSiteCulture entity) { this.SendPropertyChanging(); entity.awCulture = null; } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awSiteCulture")] public partial class awSiteCulture : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _siteCultureId; private long _siteId; private string _cultureCode; private EntityRef<awCulture> _awCulture; private EntityRef<awSite> _awSite; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnsiteCultureIdChanging(long value); partial void OnsiteCultureIdChanged(); partial void OnsiteIdChanging(long value); partial void OnsiteIdChanged(); partial void OncultureCodeChanging(string value); partial void OncultureCodeChanged(); #endregion public awSiteCulture() { this._awCulture = default(EntityRef<awCulture>); this._awSite = default(EntityRef<awSite>); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteCultureId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long siteCultureId { get { return this._siteCultureId; } set { if ((this._siteCultureId != value)) { this.OnsiteCultureIdChanging(value); this.SendPropertyChanging(); this._siteCultureId = value; this.SendPropertyChanged("siteCultureId"); this.OnsiteCultureIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteId", DbType="BigInt NOT NULL")] public long siteId { get { return this._siteId; } set { if ((this._siteId != value)) { if (this._awSite.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnsiteIdChanging(value); this.SendPropertyChanging(); this._siteId = value; this.SendPropertyChanged("siteId"); this.OnsiteIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_cultureCode", DbType="NVarChar(2) NOT NULL", CanBeNull=false)] public string cultureCode { get { return this._cultureCode; } set { if ((this._cultureCode != value)) { if (this._awCulture.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OncultureCodeChanging(value); this.SendPropertyChanging(); this._cultureCode = value; this.SendPropertyChanged("cultureCode"); this.OncultureCodeChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awCulture_awSiteCulture", Storage="_awCulture", ThisKey="cultureCode", OtherKey="cultureCode", IsForeignKey=true)] public awCulture awCulture { get { return this._awCulture.Entity; } set { awCulture previousValue = this._awCulture.Entity; if (((previousValue != value) || (this._awCulture.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awCulture.Entity = null; previousValue.awSiteCultures.Remove(this); } this._awCulture.Entity = value; if ((value != null)) { value.awSiteCultures.Add(this); this._cultureCode = value.cultureCode; } else { this._cultureCode = default(string); } this.SendPropertyChanged("awCulture"); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awSiteCulture", Storage="_awSite", ThisKey="siteId", OtherKey="siteId", IsForeignKey=true)] public awSite awSite { get { return this._awSite.Entity; } set { awSite previousValue = this._awSite.Entity; if (((previousValue != value) || (this._awSite.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awSite.Entity = null; previousValue.awSiteCultures.Remove(this); } this._awSite.Entity = value; if ((value != null)) { value.awSiteCultures.Add(this); this._siteId = value.siteId; } else { this._siteId = default(long); } this.SendPropertyChanged("awSite"); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awRole")] public partial class awRole : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _roleId; private string _title; private string _description; private string _module; private bool _canRead; private bool _canUpdateStatus; private bool _canUpdate; private bool _canAdd; private bool _canDelete; private System.Nullable<System.DateTime> _lastBuildDate; private System.DateTime _createDate; private EntitySet<awRoleMember> _awRoleMembers; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnroleIdChanging(long value); partial void OnroleIdChanged(); partial void OntitleChanging(string value); partial void OntitleChanged(); partial void OndescriptionChanging(string value); partial void OndescriptionChanged(); partial void OnmoduleChanging(string value); partial void OnmoduleChanged(); partial void OncanReadChanging(bool value); partial void OncanReadChanged(); partial void OncanUpdateStatusChanging(bool value); partial void OncanUpdateStatusChanged(); partial void OncanUpdateChanging(bool value); partial void OncanUpdateChanged(); partial void OncanAddChanging(bool value); partial void OncanAddChanged(); partial void OncanDeleteChanging(bool value); partial void OncanDeleteChanged(); partial void OnlastBuildDateChanging(System.Nullable<System.DateTime> value); partial void OnlastBuildDateChanged(); partial void OncreateDateChanging(System.DateTime value); partial void OncreateDateChanged(); #endregion public awRole() { this._awRoleMembers = new EntitySet<awRoleMember>(new Action<awRoleMember>(this.attach_awRoleMembers), new Action<awRoleMember>(this.detach_awRoleMembers)); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_roleId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long roleId { get { return this._roleId; } set { if ((this._roleId != value)) { this.OnroleIdChanging(value); this.SendPropertyChanging(); this._roleId = value; this.SendPropertyChanged("roleId"); this.OnroleIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_title", DbType="NVarChar(20) NOT NULL", CanBeNull=false)] public string title { get { return this._title; } set { if ((this._title != value)) { this.OntitleChanging(value); this.SendPropertyChanging(); this._title = value; this.SendPropertyChanged("title"); this.OntitleChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_description", DbType="NVarChar(255)")] public string description { get { return this._description; } set { if ((this._description != value)) { this.OndescriptionChanging(value); this.SendPropertyChanging(); this._description = value; this.SendPropertyChanged("description"); this.OndescriptionChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_module", DbType="NVarChar(20) NOT NULL", CanBeNull=false)] public string module { get { return this._module; } set { if ((this._module != value)) { this.OnmoduleChanging(value); this.SendPropertyChanging(); this._module = value; this.SendPropertyChanged("module"); this.OnmoduleChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_canRead", DbType="Bit NOT NULL")] public bool canRead { get { return this._canRead; } set { if ((this._canRead != value)) { this.OncanReadChanging(value); this.SendPropertyChanging(); this._canRead = value; this.SendPropertyChanged("canRead"); this.OncanReadChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_canUpdateStatus", DbType="Bit NOT NULL")] public bool canUpdateStatus { get { return this._canUpdateStatus; } set { if ((this._canUpdateStatus != value)) { this.OncanUpdateStatusChanging(value); this.SendPropertyChanging(); this._canUpdateStatus = value; this.SendPropertyChanged("canUpdateStatus"); this.OncanUpdateStatusChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_canUpdate", DbType="Bit NOT NULL")] public bool canUpdate { get { return this._canUpdate; } set { if ((this._canUpdate != value)) { this.OncanUpdateChanging(value); this.SendPropertyChanging(); this._canUpdate = value; this.SendPropertyChanged("canUpdate"); this.OncanUpdateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_canAdd", DbType="Bit NOT NULL")] public bool canAdd { get { return this._canAdd; } set { if ((this._canAdd != value)) { this.OncanAddChanging(value); this.SendPropertyChanging(); this._canAdd = value; this.SendPropertyChanged("canAdd"); this.OncanAddChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_canDelete", DbType="Bit NOT NULL")] public bool canDelete { get { return this._canDelete; } set { if ((this._canDelete != value)) { this.OncanDeleteChanging(value); this.SendPropertyChanging(); this._canDelete = value; this.SendPropertyChanged("canDelete"); this.OncanDeleteChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_lastBuildDate", DbType="DateTime")] public System.Nullable<System.DateTime> lastBuildDate { get { return this._lastBuildDate; } set { if ((this._lastBuildDate != value)) { this.OnlastBuildDateChanging(value); this.SendPropertyChanging(); this._lastBuildDate = value; this.SendPropertyChanged("lastBuildDate"); this.OnlastBuildDateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_createDate", DbType="DateTime NOT NULL")] public System.DateTime createDate { get { return this._createDate; } set { if ((this._createDate != value)) { this.OncreateDateChanging(value); this.SendPropertyChanging(); this._createDate = value; this.SendPropertyChanged("createDate"); this.OncreateDateChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awRole_awRoleMember", Storage="_awRoleMembers", ThisKey="roleId", OtherKey="roleId")] public EntitySet<awRoleMember> awRoleMembers { get { return this._awRoleMembers; } set { this._awRoleMembers.Assign(value); } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } private void attach_awRoleMembers(awRoleMember entity) { this.SendPropertyChanging(); entity.awRole = this; } private void detach_awRoleMembers(awRoleMember entity) { this.SendPropertyChanging(); entity.awRole = null; } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awSiteUser")] public partial class awSiteUser : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _siteUserId; private System.Nullable<long> _siteId; private System.Nullable<long> _userId; private bool _isEnabled; private System.Nullable<int> _status; private System.Nullable<System.DateTime> _joinDate; private System.Nullable<System.DateTime> _lastBuildDate; private System.DateTime _createDate; private EntityRef<awUser> _awUser; private EntityRef<awSite> _awSite; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnsiteUserIdChanging(long value); partial void OnsiteUserIdChanged(); partial void OnsiteIdChanging(System.Nullable<long> value); partial void OnsiteIdChanged(); partial void OnuserIdChanging(System.Nullable<long> value); partial void OnuserIdChanged(); partial void OnisEnabledChanging(bool value); partial void OnisEnabledChanged(); partial void OnstatusChanging(System.Nullable<int> value); partial void OnstatusChanged(); partial void OnjoinDateChanging(System.Nullable<System.DateTime> value); partial void OnjoinDateChanged(); partial void OnlastBuildDateChanging(System.Nullable<System.DateTime> value); partial void OnlastBuildDateChanged(); partial void OncreateDateChanging(System.DateTime value); partial void OncreateDateChanged(); #endregion public awSiteUser() { this._awUser = default(EntityRef<awUser>); this._awSite = default(EntityRef<awSite>); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteUserId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long siteUserId { get { return this._siteUserId; } set { if ((this._siteUserId != value)) { this.OnsiteUserIdChanging(value); this.SendPropertyChanging(); this._siteUserId = value; this.SendPropertyChanged("siteUserId"); this.OnsiteUserIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteId", DbType="BigInt")] public System.Nullable<long> siteId { get { return this._siteId; } set { if ((this._siteId != value)) { if (this._awSite.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnsiteIdChanging(value); this.SendPropertyChanging(); this._siteId = value; this.SendPropertyChanged("siteId"); this.OnsiteIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userId", DbType="BigInt")] public System.Nullable<long> userId { get { return this._userId; } set { if ((this._userId != value)) { if (this._awUser.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnuserIdChanging(value); this.SendPropertyChanging(); this._userId = value; this.SendPropertyChanged("userId"); this.OnuserIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_isEnabled", DbType="Bit NOT NULL")] public bool isEnabled { get { return this._isEnabled; } set { if ((this._isEnabled != value)) { this.OnisEnabledChanging(value); this.SendPropertyChanging(); this._isEnabled = value; this.SendPropertyChanged("isEnabled"); this.OnisEnabledChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_status", DbType="Int")] public System.Nullable<int> status { get { return this._status; } set { if ((this._status != value)) { this.OnstatusChanging(value); this.SendPropertyChanging(); this._status = value; this.SendPropertyChanged("status"); this.OnstatusChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_joinDate", DbType="DateTime")] public System.Nullable<System.DateTime> joinDate { get { return this._joinDate; } set { if ((this._joinDate != value)) { this.OnjoinDateChanging(value); this.SendPropertyChanging(); this._joinDate = value; this.SendPropertyChanged("joinDate"); this.OnjoinDateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_lastBuildDate", DbType="DateTime")] public System.Nullable<System.DateTime> lastBuildDate { get { return this._lastBuildDate; } set { if ((this._lastBuildDate != value)) { this.OnlastBuildDateChanging(value); this.SendPropertyChanging(); this._lastBuildDate = value; this.SendPropertyChanged("lastBuildDate"); this.OnlastBuildDateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_createDate", DbType="DateTime NOT NULL")] public System.DateTime createDate { get { return this._createDate; } set { if ((this._createDate != value)) { this.OncreateDateChanging(value); this.SendPropertyChanging(); this._createDate = value; this.SendPropertyChanged("createDate"); this.OncreateDateChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awUser_awSiteUser", Storage="_awUser", ThisKey="userId", OtherKey="userId", IsForeignKey=true)] public awUser awUser { get { return this._awUser.Entity; } set { awUser previousValue = this._awUser.Entity; if (((previousValue != value) || (this._awUser.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awUser.Entity = null; previousValue.awSiteUsers.Remove(this); } this._awUser.Entity = value; if ((value != null)) { value.awSiteUsers.Add(this); this._userId = value.userId; } else { this._userId = default(Nullable<long>); } this.SendPropertyChanged("awUser"); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awSiteUser", Storage="_awSite", ThisKey="siteId", OtherKey="siteId", IsForeignKey=true)] public awSite awSite { get { return this._awSite.Entity; } set { awSite previousValue = this._awSite.Entity; if (((previousValue != value) || (this._awSite.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awSite.Entity = null; previousValue.awSiteUsers.Remove(this); } this._awSite.Entity = value; if ((value != null)) { value.awSiteUsers.Add(this); this._siteId = value.siteId; } else { this._siteId = default(Nullable<long>); } this.SendPropertyChanged("awSite"); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awUser")] public partial class awUser : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _userId; private string _username; private string _email; private string _password; private string _firstName; private string _lastName; private bool _isSuperAdmin; private bool _isEnabled; private string _imageurl; private string _link; private string _description; private string _gender; private System.Nullable<System.DateTime> _birthday; private string _tel; private string _tel2; private string _address; private string _fax; private string _city; private string _state; private string _postalcode; private string _country; private System.Nullable<System.DateTime> _lastBuildDate; private System.DateTime _createDate; private EntitySet<awSiteDomainSecurity> _awSiteDomainSecurities; private EntitySet<awRoleMember> _awRoleMembers; private EntitySet<awSiteUser> _awSiteUsers; private EntitySet<awSite> _awSites; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnuserIdChanging(long value); partial void OnuserIdChanged(); partial void OnusernameChanging(string value); partial void OnusernameChanged(); partial void OnemailChanging(string value); partial void OnemailChanged(); partial void OnpasswordChanging(string value); partial void OnpasswordChanged(); partial void OnfirstNameChanging(string value); partial void OnfirstNameChanged(); partial void OnlastNameChanging(string value); partial void OnlastNameChanged(); partial void OnisSuperAdminChanging(bool value); partial void OnisSuperAdminChanged(); partial void OnisEnabledChanging(bool value); partial void OnisEnabledChanged(); partial void OnimageurlChanging(string value); partial void OnimageurlChanged(); partial void OnlinkChanging(string value); partial void OnlinkChanged(); partial void OndescriptionChanging(string value); partial void OndescriptionChanged(); partial void OngenderChanging(string value); partial void OngenderChanged(); partial void OnbirthdayChanging(System.Nullable<System.DateTime> value); partial void OnbirthdayChanged(); partial void OntelChanging(string value); partial void OntelChanged(); partial void Ontel2Changing(string value); partial void Ontel2Changed(); partial void OnaddressChanging(string value); partial void OnaddressChanged(); partial void OnfaxChanging(string value); partial void OnfaxChanged(); partial void OncityChanging(string value); partial void OncityChanged(); partial void OnstateChanging(string value); partial void OnstateChanged(); partial void OnpostalcodeChanging(string value); partial void OnpostalcodeChanged(); partial void OncountryChanging(string value); partial void OncountryChanged(); partial void OnlastBuildDateChanging(System.Nullable<System.DateTime> value); partial void OnlastBuildDateChanged(); partial void OncreateDateChanging(System.DateTime value); partial void OncreateDateChanged(); #endregion public awUser() { this._awSiteDomainSecurities = new EntitySet<awSiteDomainSecurity>(new Action<awSiteDomainSecurity>(this.attach_awSiteDomainSecurities), new Action<awSiteDomainSecurity>(this.detach_awSiteDomainSecurities)); this._awRoleMembers = new EntitySet<awRoleMember>(new Action<awRoleMember>(this.attach_awRoleMembers), new Action<awRoleMember>(this.detach_awRoleMembers)); this._awSiteUsers = new EntitySet<awSiteUser>(new Action<awSiteUser>(this.attach_awSiteUsers), new Action<awSiteUser>(this.detach_awSiteUsers)); this._awSites = new EntitySet<awSite>(new Action<awSite>(this.attach_awSites), new Action<awSite>(this.detach_awSites)); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long userId { get { return this._userId; } set { if ((this._userId != value)) { this.OnuserIdChanging(value); this.SendPropertyChanging(); this._userId = value; this.SendPropertyChanged("userId"); this.OnuserIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_username", DbType="NVarChar(50)")] public string username { get { return this._username; } set { if ((this._username != value)) { this.OnusernameChanging(value); this.SendPropertyChanging(); this._username = value; this.SendPropertyChanged("username"); this.OnusernameChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_email", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] public string email { get { return this._email; } set { if ((this._email != value)) { this.OnemailChanging(value); this.SendPropertyChanging(); this._email = value; this.SendPropertyChanged("email"); this.OnemailChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_password", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] public string password { get { return this._password; } set { if ((this._password != value)) { this.OnpasswordChanging(value); this.SendPropertyChanging(); this._password = value; this.SendPropertyChanged("password"); this.OnpasswordChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_firstName", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] public string firstName { get { return this._firstName; } set { if ((this._firstName != value)) { this.OnfirstNameChanging(value); this.SendPropertyChanging(); this._firstName = value; this.SendPropertyChanged("firstName"); this.OnfirstNameChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_lastName", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] public string lastName { get { return this._lastName; } set { if ((this._lastName != value)) { this.OnlastNameChanging(value); this.SendPropertyChanging(); this._lastName = value; this.SendPropertyChanged("lastName"); this.OnlastNameChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_isSuperAdmin", DbType="Bit NOT NULL")] public bool isSuperAdmin { get { return this._isSuperAdmin; } set { if ((this._isSuperAdmin != value)) { this.OnisSuperAdminChanging(value); this.SendPropertyChanging(); this._isSuperAdmin = value; this.SendPropertyChanged("isSuperAdmin"); this.OnisSuperAdminChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_isEnabled", DbType="Bit NOT NULL")] public bool isEnabled { get { return this._isEnabled; } set { if ((this._isEnabled != value)) { this.OnisEnabledChanging(value); this.SendPropertyChanging(); this._isEnabled = value; this.SendPropertyChanged("isEnabled"); this.OnisEnabledChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_imageurl", DbType="NVarChar(255)")] public string imageurl { get { return this._imageurl; } set { if ((this._imageurl != value)) { this.OnimageurlChanging(value); this.SendPropertyChanging(); this._imageurl = value; this.SendPropertyChanged("imageurl"); this.OnimageurlChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_link", DbType="NVarChar(255)")] public string link { get { return this._link; } set { if ((this._link != value)) { this.OnlinkChanging(value); this.SendPropertyChanging(); this._link = value; this.SendPropertyChanged("link"); this.OnlinkChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_description", DbType="NVarChar(512)")] public string description { get { return this._description; } set { if ((this._description != value)) { this.OndescriptionChanging(value); this.SendPropertyChanging(); this._description = value; this.SendPropertyChanged("description"); this.OndescriptionChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_gender", DbType="VarChar(2)")] public string gender { get { return this._gender; } set { if ((this._gender != value)) { this.OngenderChanging(value); this.SendPropertyChanging(); this._gender = value; this.SendPropertyChanged("gender"); this.OngenderChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_birthday", DbType="DateTime")] public System.Nullable<System.DateTime> birthday { get { return this._birthday; } set { if ((this._birthday != value)) { this.OnbirthdayChanging(value); this.SendPropertyChanging(); this._birthday = value; this.SendPropertyChanged("birthday"); this.OnbirthdayChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_tel", DbType="VarChar(50)")] public string tel { get { return this._tel; } set { if ((this._tel != value)) { this.OntelChanging(value); this.SendPropertyChanging(); this._tel = value; this.SendPropertyChanged("tel"); this.OntelChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_tel2", DbType="VarChar(50)")] public string tel2 { get { return this._tel2; } set { if ((this._tel2 != value)) { this.Ontel2Changing(value); this.SendPropertyChanging(); this._tel2 = value; this.SendPropertyChanged("tel2"); this.Ontel2Changed(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_address", DbType="NVarChar(255)")] public string address { get { return this._address; } set { if ((this._address != value)) { this.OnaddressChanging(value); this.SendPropertyChanging(); this._address = value; this.SendPropertyChanged("address"); this.OnaddressChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_fax", DbType="VarChar(50)")] public string fax { get { return this._fax; } set { if ((this._fax != value)) { this.OnfaxChanging(value); this.SendPropertyChanging(); this._fax = value; this.SendPropertyChanged("fax"); this.OnfaxChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_city", DbType="NVarChar(50)")] public string city { get { return this._city; } set { if ((this._city != value)) { this.OncityChanging(value); this.SendPropertyChanging(); this._city = value; this.SendPropertyChanged("city"); this.OncityChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_state", DbType="NVarChar(50)")] public string state { get { return this._state; } set { if ((this._state != value)) { this.OnstateChanging(value); this.SendPropertyChanging(); this._state = value; this.SendPropertyChanged("state"); this.OnstateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_postalcode", DbType="NVarChar(20)")] public string postalcode { get { return this._postalcode; } set { if ((this._postalcode != value)) { this.OnpostalcodeChanging(value); this.SendPropertyChanging(); this._postalcode = value; this.SendPropertyChanged("postalcode"); this.OnpostalcodeChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_country", DbType="NVarChar(50)")] public string country { get { return this._country; } set { if ((this._country != value)) { this.OncountryChanging(value); this.SendPropertyChanging(); this._country = value; this.SendPropertyChanged("country"); this.OncountryChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_lastBuildDate", DbType="DateTime")] public System.Nullable<System.DateTime> lastBuildDate { get { return this._lastBuildDate; } set { if ((this._lastBuildDate != value)) { this.OnlastBuildDateChanging(value); this.SendPropertyChanging(); this._lastBuildDate = value; this.SendPropertyChanged("lastBuildDate"); this.OnlastBuildDateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_createDate", DbType="DateTime NOT NULL")] public System.DateTime createDate { get { return this._createDate; } set { if ((this._createDate != value)) { this.OncreateDateChanging(value); this.SendPropertyChanging(); this._createDate = value; this.SendPropertyChanged("createDate"); this.OncreateDateChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awUser_awSiteDomainSecurity", Storage="_awSiteDomainSecurities", ThisKey="userId", OtherKey="userId")] public EntitySet<awSiteDomainSecurity> awSiteDomainSecurities { get { return this._awSiteDomainSecurities; } set { this._awSiteDomainSecurities.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awUser_awRoleMember", Storage="_awRoleMembers", ThisKey="userId", OtherKey="userId")] public EntitySet<awRoleMember> awRoleMembers { get { return this._awRoleMembers; } set { this._awRoleMembers.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awUser_awSiteUser", Storage="_awSiteUsers", ThisKey="userId", OtherKey="userId")] public EntitySet<awSiteUser> awSiteUsers { get { return this._awSiteUsers; } set { this._awSiteUsers.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awUser_awSite", Storage="_awSites", ThisKey="userId", OtherKey="userId")] public EntitySet<awSite> awSites { get { return this._awSites; } set { this._awSites.Assign(value); } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } private void attach_awSiteDomainSecurities(awSiteDomainSecurity entity) { this.SendPropertyChanging(); entity.awUser = this; } private void detach_awSiteDomainSecurities(awSiteDomainSecurity entity) { this.SendPropertyChanging(); entity.awUser = null; } private void attach_awRoleMembers(awRoleMember entity) { this.SendPropertyChanging(); entity.awUser = this; } private void detach_awRoleMembers(awRoleMember entity) { this.SendPropertyChanging(); entity.awUser = null; } private void attach_awSiteUsers(awSiteUser entity) { this.SendPropertyChanging(); entity.awUser = this; } private void detach_awSiteUsers(awSiteUser entity) { this.SendPropertyChanging(); entity.awUser = null; } private void attach_awSites(awSite entity) { this.SendPropertyChanging(); entity.awUser = this; } private void detach_awSites(awSite entity) { this.SendPropertyChanging(); entity.awUser = null; } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awCultureValue")] public partial class awCultureValue : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _cultureValueId; private string _cultureCode; private long _resourceRowId; private string _resourceTable; private string _resourceField; private string _resourceValue; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OncultureValueIdChanging(long value); partial void OncultureValueIdChanged(); partial void OncultureCodeChanging(string value); partial void OncultureCodeChanged(); partial void OnresourceRowIdChanging(long value); partial void OnresourceRowIdChanged(); partial void OnresourceTableChanging(string value); partial void OnresourceTableChanged(); partial void OnresourceFieldChanging(string value); partial void OnresourceFieldChanged(); partial void OnresourceValueChanging(string value); partial void OnresourceValueChanged(); #endregion public awCultureValue() { OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_cultureValueId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long cultureValueId { get { return this._cultureValueId; } set { if ((this._cultureValueId != value)) { this.OncultureValueIdChanging(value); this.SendPropertyChanging(); this._cultureValueId = value; this.SendPropertyChanged("cultureValueId"); this.OncultureValueIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_cultureCode", DbType="NVarChar(2) NOT NULL", CanBeNull=false)] public string cultureCode { get { return this._cultureCode; } set { if ((this._cultureCode != value)) { this.OncultureCodeChanging(value); this.SendPropertyChanging(); this._cultureCode = value; this.SendPropertyChanged("cultureCode"); this.OncultureCodeChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_resourceRowId", DbType="BigInt NOT NULL")] public long resourceRowId { get { return this._resourceRowId; } set { if ((this._resourceRowId != value)) { this.OnresourceRowIdChanging(value); this.SendPropertyChanging(); this._resourceRowId = value; this.SendPropertyChanged("resourceRowId"); this.OnresourceRowIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_resourceTable", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] public string resourceTable { get { return this._resourceTable; } set { if ((this._resourceTable != value)) { this.OnresourceTableChanging(value); this.SendPropertyChanging(); this._resourceTable = value; this.SendPropertyChanged("resourceTable"); this.OnresourceTableChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_resourceField", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] public string resourceField { get { return this._resourceField; } set { if ((this._resourceField != value)) { this.OnresourceFieldChanging(value); this.SendPropertyChanging(); this._resourceField = value; this.SendPropertyChanged("resourceField"); this.OnresourceFieldChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_resourceValue", DbType="NVarChar(1024) NOT NULL", CanBeNull=false)] public string resourceValue { get { return this._resourceValue; } set { if ((this._resourceValue != value)) { this.OnresourceValueChanging(value); this.SendPropertyChanging(); this._resourceValue = value; this.SendPropertyChanged("resourceValue"); this.OnresourceValueChanged(); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awEnvironment")] public partial class awEnvironment : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _environmentId; private long _siteId; private string _title; private string _description; private string _publicKey; private string _serviceUrl; private long _userId; private System.DateTime _lastBuildDate; private System.DateTime _createDate; private EntityRef<awSite> _awSite; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnenvironmentIdChanging(long value); partial void OnenvironmentIdChanged(); partial void OnsiteIdChanging(long value); partial void OnsiteIdChanged(); partial void OntitleChanging(string value); partial void OntitleChanged(); partial void OndescriptionChanging(string value); partial void OndescriptionChanged(); partial void OnpublicKeyChanging(string value); partial void OnpublicKeyChanged(); partial void OnserviceUrlChanging(string value); partial void OnserviceUrlChanged(); partial void OnuserIdChanging(long value); partial void OnuserIdChanged(); partial void OnlastBuildDateChanging(System.DateTime value); partial void OnlastBuildDateChanged(); partial void OncreateDateChanging(System.DateTime value); partial void OncreateDateChanged(); #endregion public awEnvironment() { this._awSite = default(EntityRef<awSite>); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_environmentId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long environmentId { get { return this._environmentId; } set { if ((this._environmentId != value)) { this.OnenvironmentIdChanging(value); this.SendPropertyChanging(); this._environmentId = value; this.SendPropertyChanged("environmentId"); this.OnenvironmentIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteId", DbType="BigInt NOT NULL")] public long siteId { get { return this._siteId; } set { if ((this._siteId != value)) { if (this._awSite.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnsiteIdChanging(value); this.SendPropertyChanging(); this._siteId = value; this.SendPropertyChanged("siteId"); this.OnsiteIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_title", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] public string title { get { return this._title; } set { if ((this._title != value)) { this.OntitleChanging(value); this.SendPropertyChanging(); this._title = value; this.SendPropertyChanged("title"); this.OntitleChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_description", DbType="NVarChar(512)")] public string description { get { return this._description; } set { if ((this._description != value)) { this.OndescriptionChanging(value); this.SendPropertyChanging(); this._description = value; this.SendPropertyChanged("description"); this.OndescriptionChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_publicKey", DbType="NVarChar(512)")] public string publicKey { get { return this._publicKey; } set { if ((this._publicKey != value)) { this.OnpublicKeyChanging(value); this.SendPropertyChanging(); this._publicKey = value; this.SendPropertyChanged("publicKey"); this.OnpublicKeyChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_serviceUrl", DbType="NVarChar(512)")] public string serviceUrl { get { return this._serviceUrl; } set { if ((this._serviceUrl != value)) { this.OnserviceUrlChanging(value); this.SendPropertyChanging(); this._serviceUrl = value; this.SendPropertyChanged("serviceUrl"); this.OnserviceUrlChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userId", DbType="BigInt NOT NULL")] public long userId { get { return this._userId; } set { if ((this._userId != value)) { this.OnuserIdChanging(value); this.SendPropertyChanging(); this._userId = value; this.SendPropertyChanged("userId"); this.OnuserIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_lastBuildDate", DbType="DateTime NOT NULL")] public System.DateTime lastBuildDate { get { return this._lastBuildDate; } set { if ((this._lastBuildDate != value)) { this.OnlastBuildDateChanging(value); this.SendPropertyChanging(); this._lastBuildDate = value; this.SendPropertyChanged("lastBuildDate"); this.OnlastBuildDateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_createDate", DbType="DateTime NOT NULL")] public System.DateTime createDate { get { return this._createDate; } set { if ((this._createDate != value)) { this.OncreateDateChanging(value); this.SendPropertyChanging(); this._createDate = value; this.SendPropertyChanged("createDate"); this.OncreateDateChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awEnvironment", Storage="_awSite", ThisKey="siteId", OtherKey="siteId", IsForeignKey=true)] public awSite awSite { get { return this._awSite.Entity; } set { awSite previousValue = this._awSite.Entity; if (((previousValue != value) || (this._awSite.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awSite.Entity = null; previousValue.awEnvironments.Remove(this); } this._awSite.Entity = value; if ((value != null)) { value.awEnvironments.Add(this); this._siteId = value.siteId; } else { this._siteId = default(long); } this.SendPropertyChanged("awSite"); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awAutomatedTask")] public partial class awAutomatedTask : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _automatedTaskId; private long _siteId; private long _automatedTaskGroupId; private System.Guid _guidToRun; private string _title; private string _description; private bool _isCompleted; private bool _deleteAfterComplete; private string _completedMessage; private string _errorMessage; private string _namespaceAndClass; private string _methodName; private string _methodParameters; private string _resultRedirectUrl; private System.DateTime _lastBuildDate; private System.DateTime _createDate; private EntityRef<awSite> _awSite; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnautomatedTaskIdChanging(long value); partial void OnautomatedTaskIdChanged(); partial void OnsiteIdChanging(long value); partial void OnsiteIdChanged(); partial void OnautomatedTaskGroupIdChanging(long value); partial void OnautomatedTaskGroupIdChanged(); partial void OnguidToRunChanging(System.Guid value); partial void OnguidToRunChanged(); partial void OntitleChanging(string value); partial void OntitleChanged(); partial void OndescriptionChanging(string value); partial void OndescriptionChanged(); partial void OnisCompletedChanging(bool value); partial void OnisCompletedChanged(); partial void OndeleteAfterCompleteChanging(bool value); partial void OndeleteAfterCompleteChanged(); partial void OncompletedMessageChanging(string value); partial void OncompletedMessageChanged(); partial void OnerrorMessageChanging(string value); partial void OnerrorMessageChanged(); partial void OnnamespaceAndClassChanging(string value); partial void OnnamespaceAndClassChanged(); partial void OnmethodNameChanging(string value); partial void OnmethodNameChanged(); partial void OnmethodParametersChanging(string value); partial void OnmethodParametersChanged(); partial void OnresultRedirectUrlChanging(string value); partial void OnresultRedirectUrlChanged(); partial void OnlastBuildDateChanging(System.DateTime value); partial void OnlastBuildDateChanged(); partial void OncreateDateChanging(System.DateTime value); partial void OncreateDateChanged(); #endregion public awAutomatedTask() { this._awSite = default(EntityRef<awSite>); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_automatedTaskId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long automatedTaskId { get { return this._automatedTaskId; } set { if ((this._automatedTaskId != value)) { this.OnautomatedTaskIdChanging(value); this.SendPropertyChanging(); this._automatedTaskId = value; this.SendPropertyChanged("automatedTaskId"); this.OnautomatedTaskIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteId", DbType="BigInt NOT NULL")] public long siteId { get { return this._siteId; } set { if ((this._siteId != value)) { if (this._awSite.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnsiteIdChanging(value); this.SendPropertyChanging(); this._siteId = value; this.SendPropertyChanged("siteId"); this.OnsiteIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_automatedTaskGroupId", DbType="BigInt NOT NULL")] public long automatedTaskGroupId { get { return this._automatedTaskGroupId; } set { if ((this._automatedTaskGroupId != value)) { this.OnautomatedTaskGroupIdChanging(value); this.SendPropertyChanging(); this._automatedTaskGroupId = value; this.SendPropertyChanged("automatedTaskGroupId"); this.OnautomatedTaskGroupIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_guidToRun", DbType="UniqueIdentifier NOT NULL")] public System.Guid guidToRun { get { return this._guidToRun; } set { if ((this._guidToRun != value)) { this.OnguidToRunChanging(value); this.SendPropertyChanging(); this._guidToRun = value; this.SendPropertyChanged("guidToRun"); this.OnguidToRunChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_title", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] public string title { get { return this._title; } set { if ((this._title != value)) { this.OntitleChanging(value); this.SendPropertyChanging(); this._title = value; this.SendPropertyChanged("title"); this.OntitleChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_description", DbType="NVarChar(512)")] public string description { get { return this._description; } set { if ((this._description != value)) { this.OndescriptionChanging(value); this.SendPropertyChanging(); this._description = value; this.SendPropertyChanged("description"); this.OndescriptionChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_isCompleted", DbType="Bit NOT NULL")] public bool isCompleted { get { return this._isCompleted; } set { if ((this._isCompleted != value)) { this.OnisCompletedChanging(value); this.SendPropertyChanging(); this._isCompleted = value; this.SendPropertyChanged("isCompleted"); this.OnisCompletedChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_deleteAfterComplete", DbType="Bit NOT NULL")] public bool deleteAfterComplete { get { return this._deleteAfterComplete; } set { if ((this._deleteAfterComplete != value)) { this.OndeleteAfterCompleteChanging(value); this.SendPropertyChanging(); this._deleteAfterComplete = value; this.SendPropertyChanged("deleteAfterComplete"); this.OndeleteAfterCompleteChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_completedMessage", DbType="NVarChar(512)")] public string completedMessage { get { return this._completedMessage; } set { if ((this._completedMessage != value)) { this.OncompletedMessageChanging(value); this.SendPropertyChanging(); this._completedMessage = value; this.SendPropertyChanged("completedMessage"); this.OncompletedMessageChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_errorMessage", DbType="NVarChar(512)")] public string errorMessage { get { return this._errorMessage; } set { if ((this._errorMessage != value)) { this.OnerrorMessageChanging(value); this.SendPropertyChanging(); this._errorMessage = value; this.SendPropertyChanged("errorMessage"); this.OnerrorMessageChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_namespaceAndClass", DbType="VarChar(100) NOT NULL", CanBeNull=false)] public string namespaceAndClass { get { return this._namespaceAndClass; } set { if ((this._namespaceAndClass != value)) { this.OnnamespaceAndClassChanging(value); this.SendPropertyChanging(); this._namespaceAndClass = value; this.SendPropertyChanged("namespaceAndClass"); this.OnnamespaceAndClassChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_methodName", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] public string methodName { get { return this._methodName; } set { if ((this._methodName != value)) { this.OnmethodNameChanging(value); this.SendPropertyChanging(); this._methodName = value; this.SendPropertyChanged("methodName"); this.OnmethodNameChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_methodParameters", DbType="NVarChar(1024)")] public string methodParameters { get { return this._methodParameters; } set { if ((this._methodParameters != value)) { this.OnmethodParametersChanging(value); this.SendPropertyChanging(); this._methodParameters = value; this.SendPropertyChanged("methodParameters"); this.OnmethodParametersChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_resultRedirectUrl", DbType="VarChar(512)")] public string resultRedirectUrl { get { return this._resultRedirectUrl; } set { if ((this._resultRedirectUrl != value)) { this.OnresultRedirectUrlChanging(value); this.SendPropertyChanging(); this._resultRedirectUrl = value; this.SendPropertyChanged("resultRedirectUrl"); this.OnresultRedirectUrlChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_lastBuildDate", DbType="DateTime NOT NULL")] public System.DateTime lastBuildDate { get { return this._lastBuildDate; } set { if ((this._lastBuildDate != value)) { this.OnlastBuildDateChanging(value); this.SendPropertyChanging(); this._lastBuildDate = value; this.SendPropertyChanged("lastBuildDate"); this.OnlastBuildDateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_createDate", DbType="DateTime NOT NULL")] public System.DateTime createDate { get { return this._createDate; } set { if ((this._createDate != value)) { this.OncreateDateChanging(value); this.SendPropertyChanging(); this._createDate = value; this.SendPropertyChanged("createDate"); this.OncreateDateChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awAutomatedTask", Storage="_awSite", ThisKey="siteId", OtherKey="siteId", IsForeignKey=true)] public awSite awSite { get { return this._awSite.Entity; } set { awSite previousValue = this._awSite.Entity; if (((previousValue != value) || (this._awSite.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awSite.Entity = null; previousValue.awAutomatedTasks.Remove(this); } this._awSite.Entity = value; if ((value != null)) { value.awAutomatedTasks.Add(this); this._siteId = value.siteId; } else { this._siteId = default(long); } this.SendPropertyChanged("awSite"); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.awSite")] public partial class awSite : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _siteId; private string _alias; private string _title; private string _description; private bool _isEnabled; private string _cultureCode; private string _link; private string _imageurl; private System.Nullable<System.DateTime> _pubDate; private int _maxBlogs; private int _maxUsers; private int _maxContents; private string _accessKey; private string _grantedDomains; private string _bannedDomains; private string _twitterUsername; private string _twitterPassword; private string _fileAmazonS3BucketName; private System.Nullable<long> _userConfirmationEmailTemplateId; private System.Nullable<long> _userResetPasswordEmailTemplateId; private System.Nullable<long> _userId; private System.Nullable<System.DateTime> _lastBuildDate; private System.Nullable<System.DateTime> _createDate; private EntitySet<awSiteDomainSecurity> _awSiteDomainSecurities; private EntitySet<awRoleMember> _awRoleMembers; private EntitySet<awSiteCulture> _awSiteCultures; private EntitySet<awSiteUser> _awSiteUsers; private EntitySet<awEnvironment> _awEnvironments; private EntitySet<awAutomatedTask> _awAutomatedTasks; private EntityRef<awUser> _awUser; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnsiteIdChanging(long value); partial void OnsiteIdChanged(); partial void OnaliasChanging(string value); partial void OnaliasChanged(); partial void OntitleChanging(string value); partial void OntitleChanged(); partial void OndescriptionChanging(string value); partial void OndescriptionChanged(); partial void OnisEnabledChanging(bool value); partial void OnisEnabledChanged(); partial void OncultureCodeChanging(string value); partial void OncultureCodeChanged(); partial void OnlinkChanging(string value); partial void OnlinkChanged(); partial void OnimageurlChanging(string value); partial void OnimageurlChanged(); partial void OnpubDateChanging(System.Nullable<System.DateTime> value); partial void OnpubDateChanged(); partial void OnmaxBlogsChanging(int value); partial void OnmaxBlogsChanged(); partial void OnmaxUsersChanging(int value); partial void OnmaxUsersChanged(); partial void OnmaxContentsChanging(int value); partial void OnmaxContentsChanged(); partial void OnaccessKeyChanging(string value); partial void OnaccessKeyChanged(); partial void OngrantedDomainsChanging(string value); partial void OngrantedDomainsChanged(); partial void OnbannedDomainsChanging(string value); partial void OnbannedDomainsChanged(); partial void OntwitterUsernameChanging(string value); partial void OntwitterUsernameChanged(); partial void OntwitterPasswordChanging(string value); partial void OntwitterPasswordChanged(); partial void OnfileAmazonS3BucketNameChanging(string value); partial void OnfileAmazonS3BucketNameChanged(); partial void OnuserConfirmationEmailTemplateIdChanging(System.Nullable<long> value); partial void OnuserConfirmationEmailTemplateIdChanged(); partial void OnuserResetPasswordEmailTemplateIdChanging(System.Nullable<long> value); partial void OnuserResetPasswordEmailTemplateIdChanged(); partial void OnuserIdChanging(System.Nullable<long> value); partial void OnuserIdChanged(); partial void OnlastBuildDateChanging(System.Nullable<System.DateTime> value); partial void OnlastBuildDateChanged(); partial void OncreateDateChanging(System.Nullable<System.DateTime> value); partial void OncreateDateChanged(); #endregion public awSite() { this._awSiteDomainSecurities = new EntitySet<awSiteDomainSecurity>(new Action<awSiteDomainSecurity>(this.attach_awSiteDomainSecurities), new Action<awSiteDomainSecurity>(this.detach_awSiteDomainSecurities)); this._awRoleMembers = new EntitySet<awRoleMember>(new Action<awRoleMember>(this.attach_awRoleMembers), new Action<awRoleMember>(this.detach_awRoleMembers)); this._awSiteCultures = new EntitySet<awSiteCulture>(new Action<awSiteCulture>(this.attach_awSiteCultures), new Action<awSiteCulture>(this.detach_awSiteCultures)); this._awSiteUsers = new EntitySet<awSiteUser>(new Action<awSiteUser>(this.attach_awSiteUsers), new Action<awSiteUser>(this.detach_awSiteUsers)); this._awEnvironments = new EntitySet<awEnvironment>(new Action<awEnvironment>(this.attach_awEnvironments), new Action<awEnvironment>(this.detach_awEnvironments)); this._awAutomatedTasks = new EntitySet<awAutomatedTask>(new Action<awAutomatedTask>(this.attach_awAutomatedTasks), new Action<awAutomatedTask>(this.detach_awAutomatedTasks)); this._awUser = default(EntityRef<awUser>); OnCreated(); } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_siteId", DbType="BigInt NOT NULL", IsPrimaryKey=true)] public long siteId { get { return this._siteId; } set { if ((this._siteId != value)) { this.OnsiteIdChanging(value); this.SendPropertyChanging(); this._siteId = value; this.SendPropertyChanged("siteId"); this.OnsiteIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_alias", DbType="VarChar(100) NOT NULL", CanBeNull=false)] public string alias { get { return this._alias; } set { if ((this._alias != value)) { this.OnaliasChanging(value); this.SendPropertyChanging(); this._alias = value; this.SendPropertyChanged("alias"); this.OnaliasChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_title", DbType="NVarChar(255)")] public string title { get { return this._title; } set { if ((this._title != value)) { this.OntitleChanging(value); this.SendPropertyChanging(); this._title = value; this.SendPropertyChanged("title"); this.OntitleChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_description", DbType="NVarChar(512)")] public string description { get { return this._description; } set { if ((this._description != value)) { this.OndescriptionChanging(value); this.SendPropertyChanging(); this._description = value; this.SendPropertyChanged("description"); this.OndescriptionChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_isEnabled", DbType="Bit NOT NULL")] public bool isEnabled { get { return this._isEnabled; } set { if ((this._isEnabled != value)) { this.OnisEnabledChanging(value); this.SendPropertyChanging(); this._isEnabled = value; this.SendPropertyChanged("isEnabled"); this.OnisEnabledChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_cultureCode", DbType="VarChar(50)")] public string cultureCode { get { return this._cultureCode; } set { if ((this._cultureCode != value)) { this.OncultureCodeChanging(value); this.SendPropertyChanging(); this._cultureCode = value; this.SendPropertyChanged("cultureCode"); this.OncultureCodeChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_link", DbType="VarChar(255)")] public string link { get { return this._link; } set { if ((this._link != value)) { this.OnlinkChanging(value); this.SendPropertyChanging(); this._link = value; this.SendPropertyChanged("link"); this.OnlinkChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_imageurl", DbType="VarChar(255)")] public string imageurl { get { return this._imageurl; } set { if ((this._imageurl != value)) { this.OnimageurlChanging(value); this.SendPropertyChanging(); this._imageurl = value; this.SendPropertyChanged("imageurl"); this.OnimageurlChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_pubDate", DbType="DateTime")] public System.Nullable<System.DateTime> pubDate { get { return this._pubDate; } set { if ((this._pubDate != value)) { this.OnpubDateChanging(value); this.SendPropertyChanging(); this._pubDate = value; this.SendPropertyChanged("pubDate"); this.OnpubDateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_maxBlogs", DbType="Int NOT NULL")] public int maxBlogs { get { return this._maxBlogs; } set { if ((this._maxBlogs != value)) { this.OnmaxBlogsChanging(value); this.SendPropertyChanging(); this._maxBlogs = value; this.SendPropertyChanged("maxBlogs"); this.OnmaxBlogsChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_maxUsers", DbType="Int NOT NULL")] public int maxUsers { get { return this._maxUsers; } set { if ((this._maxUsers != value)) { this.OnmaxUsersChanging(value); this.SendPropertyChanging(); this._maxUsers = value; this.SendPropertyChanged("maxUsers"); this.OnmaxUsersChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_maxContents", DbType="Int NOT NULL")] public int maxContents { get { return this._maxContents; } set { if ((this._maxContents != value)) { this.OnmaxContentsChanging(value); this.SendPropertyChanging(); this._maxContents = value; this.SendPropertyChanged("maxContents"); this.OnmaxContentsChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_accessKey", DbType="VarChar(50)")] public string accessKey { get { return this._accessKey; } set { if ((this._accessKey != value)) { this.OnaccessKeyChanging(value); this.SendPropertyChanging(); this._accessKey = value; this.SendPropertyChanged("accessKey"); this.OnaccessKeyChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_grantedDomains", DbType="VarChar(512)")] public string grantedDomains { get { return this._grantedDomains; } set { if ((this._grantedDomains != value)) { this.OngrantedDomainsChanging(value); this.SendPropertyChanging(); this._grantedDomains = value; this.SendPropertyChanged("grantedDomains"); this.OngrantedDomainsChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_bannedDomains", DbType="VarChar(512)")] public string bannedDomains { get { return this._bannedDomains; } set { if ((this._bannedDomains != value)) { this.OnbannedDomainsChanging(value); this.SendPropertyChanging(); this._bannedDomains = value; this.SendPropertyChanged("bannedDomains"); this.OnbannedDomainsChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_twitterUsername", DbType="VarChar(50)")] public string twitterUsername { get { return this._twitterUsername; } set { if ((this._twitterUsername != value)) { this.OntwitterUsernameChanging(value); this.SendPropertyChanging(); this._twitterUsername = value; this.SendPropertyChanged("twitterUsername"); this.OntwitterUsernameChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_twitterPassword", DbType="VarChar(50)")] public string twitterPassword { get { return this._twitterPassword; } set { if ((this._twitterPassword != value)) { this.OntwitterPasswordChanging(value); this.SendPropertyChanging(); this._twitterPassword = value; this.SendPropertyChanged("twitterPassword"); this.OntwitterPasswordChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_fileAmazonS3BucketName", DbType="VarChar(50)")] public string fileAmazonS3BucketName { get { return this._fileAmazonS3BucketName; } set { if ((this._fileAmazonS3BucketName != value)) { this.OnfileAmazonS3BucketNameChanging(value); this.SendPropertyChanging(); this._fileAmazonS3BucketName = value; this.SendPropertyChanged("fileAmazonS3BucketName"); this.OnfileAmazonS3BucketNameChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userConfirmationEmailTemplateId", DbType="BigInt")] public System.Nullable<long> userConfirmationEmailTemplateId { get { return this._userConfirmationEmailTemplateId; } set { if ((this._userConfirmationEmailTemplateId != value)) { this.OnuserConfirmationEmailTemplateIdChanging(value); this.SendPropertyChanging(); this._userConfirmationEmailTemplateId = value; this.SendPropertyChanged("userConfirmationEmailTemplateId"); this.OnuserConfirmationEmailTemplateIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userResetPasswordEmailTemplateId", DbType="BigInt")] public System.Nullable<long> userResetPasswordEmailTemplateId { get { return this._userResetPasswordEmailTemplateId; } set { if ((this._userResetPasswordEmailTemplateId != value)) { this.OnuserResetPasswordEmailTemplateIdChanging(value); this.SendPropertyChanging(); this._userResetPasswordEmailTemplateId = value; this.SendPropertyChanged("userResetPasswordEmailTemplateId"); this.OnuserResetPasswordEmailTemplateIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_userId", DbType="BigInt")] public System.Nullable<long> userId { get { return this._userId; } set { if ((this._userId != value)) { if (this._awUser.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnuserIdChanging(value); this.SendPropertyChanging(); this._userId = value; this.SendPropertyChanged("userId"); this.OnuserIdChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_lastBuildDate", DbType="DateTime")] public System.Nullable<System.DateTime> lastBuildDate { get { return this._lastBuildDate; } set { if ((this._lastBuildDate != value)) { this.OnlastBuildDateChanging(value); this.SendPropertyChanging(); this._lastBuildDate = value; this.SendPropertyChanged("lastBuildDate"); this.OnlastBuildDateChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_createDate", DbType="DateTime")] public System.Nullable<System.DateTime> createDate { get { return this._createDate; } set { if ((this._createDate != value)) { this.OncreateDateChanging(value); this.SendPropertyChanging(); this._createDate = value; this.SendPropertyChanged("createDate"); this.OncreateDateChanged(); } } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awSiteDomainSecurity", Storage="_awSiteDomainSecurities", ThisKey="siteId", OtherKey="siteId")] public EntitySet<awSiteDomainSecurity> awSiteDomainSecurities { get { return this._awSiteDomainSecurities; } set { this._awSiteDomainSecurities.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awRoleMember", Storage="_awRoleMembers", ThisKey="siteId", OtherKey="siteId")] public EntitySet<awRoleMember> awRoleMembers { get { return this._awRoleMembers; } set { this._awRoleMembers.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awSiteCulture", Storage="_awSiteCultures", ThisKey="siteId", OtherKey="siteId")] public EntitySet<awSiteCulture> awSiteCultures { get { return this._awSiteCultures; } set { this._awSiteCultures.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awSiteUser", Storage="_awSiteUsers", ThisKey="siteId", OtherKey="siteId")] public EntitySet<awSiteUser> awSiteUsers { get { return this._awSiteUsers; } set { this._awSiteUsers.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awEnvironment", Storage="_awEnvironments", ThisKey="siteId", OtherKey="siteId")] public EntitySet<awEnvironment> awEnvironments { get { return this._awEnvironments; } set { this._awEnvironments.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awSite_awAutomatedTask", Storage="_awAutomatedTasks", ThisKey="siteId", OtherKey="siteId")] public EntitySet<awAutomatedTask> awAutomatedTasks { get { return this._awAutomatedTasks; } set { this._awAutomatedTasks.Assign(value); } } [global::System.Data.Linq.Mapping.AssociationAttribute(Name="awUser_awSite", Storage="_awUser", ThisKey="userId", OtherKey="userId", IsForeignKey=true)] public awUser awUser { get { return this._awUser.Entity; } set { awUser previousValue = this._awUser.Entity; if (((previousValue != value) || (this._awUser.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._awUser.Entity = null; previousValue.awSites.Remove(this); } this._awUser.Entity = value; if ((value != null)) { value.awSites.Add(this); this._userId = value.userId; } else { this._userId = default(Nullable<long>); } this.SendPropertyChanged("awUser"); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } private void attach_awSiteDomainSecurities(awSiteDomainSecurity entity) { this.SendPropertyChanging(); entity.awSite = this; } private void detach_awSiteDomainSecurities(awSiteDomainSecurity entity) { this.SendPropertyChanging(); entity.awSite = null; } private void attach_awRoleMembers(awRoleMember entity) { this.SendPropertyChanging(); entity.awSite = this; } private void detach_awRoleMembers(awRoleMember entity) { this.SendPropertyChanging(); entity.awSite = null; } private void attach_awSiteCultures(awSiteCulture entity) { this.SendPropertyChanging(); entity.awSite = this; } private void detach_awSiteCultures(awSiteCulture entity) { this.SendPropertyChanging(); entity.awSite = null; } private void attach_awSiteUsers(awSiteUser entity) { this.SendPropertyChanging(); entity.awSite = this; } private void detach_awSiteUsers(awSiteUser entity) { this.SendPropertyChanging(); entity.awSite = null; } private void attach_awEnvironments(awEnvironment entity) { this.SendPropertyChanging(); entity.awSite = this; } private void detach_awEnvironments(awEnvironment entity) { this.SendPropertyChanging(); entity.awSite = null; } private void attach_awAutomatedTasks(awAutomatedTask entity) { this.SendPropertyChanging(); entity.awSite = this; } private void detach_awAutomatedTasks(awAutomatedTask entity) { this.SendPropertyChanging(); entity.awSite = null; } } } #pragma warning restore 1591
24.944604
210
0.684413
[ "Apache-2.0" ]
omeryesil/awapicms
AWAPI_Data/data/SiteContext.designer.cs
104,021
C#
// ************************************************************************ // // * Copyright 2018 OSIsoft, LLC // * Licensed under the Apache License, Version 2.0 (the "License"); // * you may not use this file except in compliance with the License. // * You may obtain a copy of the License at // * // * <http://www.apache.org/licenses/LICENSE-2.0> // * // * Unless required by applicable law or agreed to in writing, software // * distributed under the License is distributed on an "AS IS" BASIS, // * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // * See the License for the specific language governing permissions and // * limitations under the License. // ************************************************************************ using System; using System.Linq; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using OSIsoft.PIDevClub.PIWebApiClient.Client; using System.Runtime.InteropServices; namespace OSIsoft.PIDevClub.PIWebApiClient.Model { /// <summary> /// PIItemsDataServer /// </summary> [DataContract] public class PIItemsDataServer { public PIItemsDataServer(List<PIDataServer> Items = null, PIPaginationLinks Links = null) { this.Items = Items; this.Links = Links; } /// <summary> /// Gets or Sets PIItemsDataServer /// </summary> [DataMember(Name = "Items", EmitDefaultValue = false)] public List<PIDataServer> Items { get; set; } /// <summary> /// Gets or Sets PIItemsDataServer /// </summary> [DataMember(Name = "Links", EmitDefaultValue = false)] public PIPaginationLinks Links { get; set; } } }
29.721311
91
0.666851
[ "Apache-2.0" ]
lydonchandra/PI-Web-API-Client-DotNet-Standard
src/OSIsoft.PIDevClub.PIWebApiClient/OSIsoft.PIDevClub.PIWebApiClient/Model/PIItemsDataServer.cs
1,813
C#
namespace PyriteCloudAdmin.Areas.HelpPage.ModelDescriptions { public class SimpleTypeModelDescription : ModelDescription { } }
23
62
0.782609
[ "MIT" ]
PyriteServer/PyriteCli
PyriteCloudAdmin/Areas/HelpPage/ModelDescriptions/SimpleTypeModelDescription.cs
138
C#
using System.Collections.Generic; using Fp.ObjectModels.Disposing; using UniRx; namespace Fp.DataBinding.Binds.Collections { public sealed class DictionaryBind<TKey, TValue> : DisposableObject, IDictionaryRestrictedBind<TKey, TValue> { private readonly DictionaryBindScope<TKey, TValue> _scope; private readonly IReactiveDictionary<TKey, TValue> _boundDictionary; private readonly CompositeDisposable _relativeResources = new CompositeDisposable(); private int _scopeIdx; private readonly Stack<DictionaryAddEvent<TKey, TValue>> _addingStack = new Stack<DictionaryAddEvent<TKey, TValue>>(1); private readonly Stack<DictionaryRemoveEvent<TKey, TValue>> _removingStack = new Stack<DictionaryRemoveEvent<TKey, TValue>>(1); private readonly Stack<DictionaryReplaceEvent<TKey, TValue>> _replacingStack = new Stack<DictionaryReplaceEvent<TKey, TValue>>(1); private int _resetting; public DictionaryBind( DictionaryBindScope<TKey, TValue> scope, IReactiveDictionary<TKey, TValue> boundDictionary, CollectionMargeOption margeOption = CollectionMargeOption.ReplaceCollection) { _scope = scope; _boundDictionary = boundDictionary; Init(margeOption); } private IDictionary<TKey, TValue> BoundDictionary => _boundDictionary; #region ICollectionBind Implementation public bool IsWriting => _scope.IsDictionaryWriting(_scopeIdx); public bool IsReading => _scope.IsDictionaryReading(_scopeIdx); public bool IsActive => !_scope.IsDictionaryIdle(_scopeIdx); public int ActiveDepth => _scope.GetDictionaryWriteDepth(_scopeIdx); public bool IsLastInitiator => _scope.LastInitiatorDictionaryIdx == _scopeIdx; public bool IsLastInteractor => _scope.LastInteractorDictionaryIdx == _scopeIdx; #endregion #region IDictionaryRestrictedBind<TKey,TValue> Implementation void IDictionaryRestrictedBind<TKey, TValue>.ScopeReset() { _resetting++; _boundDictionary.Clear(); } void IDictionaryRestrictedBind<TKey, TValue>.ScopeAdd(DictionaryAddEvent<TKey, TValue> dictionaryAddEvent) { _addingStack.Push(dictionaryAddEvent); _boundDictionary.Add(dictionaryAddEvent.Key, dictionaryAddEvent.Value); } void IDictionaryRestrictedBind<TKey, TValue>.ScopeRemove( DictionaryRemoveEvent<TKey, TValue> dictionaryRemoveEvent) { _removingStack.Push(dictionaryRemoveEvent); _boundDictionary.Remove(dictionaryRemoveEvent.Key); } void IDictionaryRestrictedBind<TKey, TValue>.ScopeReplace( DictionaryReplaceEvent<TKey, TValue> dictionaryReplaceEvent) { _replacingStack.Push(dictionaryReplaceEvent); BoundDictionary[dictionaryReplaceEvent.Key] = dictionaryReplaceEvent.NewValue; } #endregion protected override void OnDispose() { _scope.Unregister(_scopeIdx); _relativeResources.Dispose(); } private void Init(CollectionMargeOption margeOption) { _scopeIdx = _scope.Register(this); int scopeCount = _scope.Count; if (scopeCount > 0 || scopeCount > 0) { switch (margeOption) { case CollectionMargeOption.ReplaceCollection: { _boundDictionary.Clear(); foreach (KeyValuePair<TKey, TValue> kvp in _scope) { _boundDictionary.Add(kvp.Key, kvp.Value); } break; } case CollectionMargeOption.ReplaceScope: { _scope.Clear(_scopeIdx); foreach (KeyValuePair<TKey, TValue> kvp in _boundDictionary) { _scope.Add(_scopeIdx, new DictionaryAddEvent<TKey, TValue>(kvp.Key, kvp.Value)); } break; } case CollectionMargeOption.Merge: { if (BoundDictionary.Count == 0) { break; } foreach (KeyValuePair<TKey, TValue> kvp in _boundDictionary) { if (_scope.ContainsKey(kvp.Key)) { continue; } _scope.Add(_scopeIdx, new DictionaryAddEvent<TKey, TValue>(kvp.Key, kvp.Value)); } _boundDictionary.Clear(); foreach (KeyValuePair<TKey, TValue> kvp in _scope) { _boundDictionary.Add(kvp.Key, kvp.Value); } break; } } } //Source collection to bind collection _boundDictionary.ObserveAdd().Subscribe(OnBoundAdd).AddTo(_relativeResources); _boundDictionary.ObserveReset().Subscribe(OnBoundReset).AddTo(_relativeResources); _boundDictionary.ObserveRemove().Subscribe(OnBoundRemove).AddTo(_relativeResources); _boundDictionary.ObserveReplace().Subscribe(OnBoundReplace).AddTo(_relativeResources); } private void OnBoundAdd(DictionaryAddEvent<TKey, TValue> e) { if (_addingStack.Count > 0 && _addingStack.Peek().Equals(e)) { _addingStack.Pop(); } else { _scope.Add(_scopeIdx, e); } } private void OnBoundReplace(DictionaryReplaceEvent<TKey, TValue> e) { if (_replacingStack.Count > 0 && _replacingStack.Peek().Equals(e)) { _replacingStack.Pop(); } else { _scope.Replace(_scopeIdx, e); } } private void OnBoundRemove(DictionaryRemoveEvent<TKey, TValue> e) { if (_removingStack.Count > 0 && _removingStack.Peek().Equals(e)) { _removingStack.Pop(); } else { _scope.Remove(_scopeIdx, e); } } private void OnBoundReset(Unit obj) { if (_resetting > 0) { _resetting--; } else { _scope.Clear(_scopeIdx); } } } }
34.112745
114
0.547205
[ "MIT" ]
FrameProjectTeam/Fp.DataBinding
Assets/Runtime/Binds/Collections/DictionaryBind.cs
6,959
C#
using Meraki.Api; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Threading.Tasks; using System.Xml.Serialization; using Newtonsoft.Json; using Meraki.Api.Data; using System.Net; using System.Text; namespace Meraki_Auto_Block_Utility { class Program { static Root L7FirewallRules; static List<string> Subnets; static string json; static Settings settings; static void Main(string[] args) { // As the Meraki API uses async, we do an async main method MainAsync().GetAwaiter().GetResult(); } static async Task MainAsync() { string configFile = Directory.GetCurrentDirectory() + "\\config.xml"; if (!File.Exists(configFile)) { //TODO: Add method to generate settings file here Console.WriteLine("Config file not found, exiting!!!!"); } else { L7FirewallRules = new Root(); Subnets = new List<string>(); settings = new Settings(); XmlSerializer mySerializer = new XmlSerializer(typeof(Settings)); using (StreamReader streamReader = new StreamReader(configFile)) { settings = (Settings)mySerializer.Deserialize(streamReader); } string[] subnets = settings.SubnetsToIgnore.Split(','); foreach (var subnet in subnets) { Subnets.Add(subnet); } await GetL7FirewallRules(settings.MerakiAPIKey, settings.Organization, settings.NetworkId); //await GetDevices(settings.MerakiAPIKey); EventLog[] eventLogs; if (settings.Remote) { eventLogs = EventLog.GetEventLogs(settings.RemoteComputer); } else { eventLogs = EventLog.GetEventLogs(); } long count = 1; List<string> ips = new List<string>(); Console.WriteLine("Number of logs on computer: " + eventLogs.Length); foreach (EventLog log in eventLogs) { if (log.Log == "Application") { Console.WriteLine("Log: " + log.Log); var eventLogEntries = new EventLogEntry[log.Entries.Count + 1000]; int amount = log.Entries.Count; log.Entries.CopyTo(eventLogEntries, 0); foreach (EventLogEntry entry in eventLogEntries) { Console.WriteLine("Checking entry " + count.ToString() + " of " + amount.ToString()); count++; if (entry != null) { if (entry.Source == "MSExchangeFrontEndTransport" && entry.InstanceId == 2147746827) { string[] temp = entry.Message.Split('['); string[] temp2 = temp[1].Split(']'); bool add = false; IPAddress iPAddress = IPAddress.Parse(temp2[0]); foreach (var subnet in Subnets) { if (SubnetCheck.IsInSubnet(iPAddress, subnet)) { add = true; break; } } if (!ips.Contains(temp2[0]) && !add) { ips.Add(temp2[0]); } } } } } } List<Layer7FirewallRule> rules = new List<Layer7FirewallRule>(); foreach(var rule in L7FirewallRules.rules) { Layer7FirewallRule temp = new Layer7FirewallRule(); temp.Policy = Layer7FirewallRulePolicy.Deny; temp.Type = Layer7FirewallRuleType.IpRange; temp.Value = rule.value.ToString(); rules.Add(temp); } foreach (var ip in ips) { Rules temp = new Rules("deny", "ipRange", ip + "/32"); if (!L7FirewallRules.rules.Contains(temp)) { L7FirewallRules.rules.Add(temp); Layer7FirewallRule temp2 = new Layer7FirewallRule(); temp2.Policy = Layer7FirewallRulePolicy.Deny; temp2.Type = Layer7FirewallRuleType.IpRange; temp2.Value = ip; rules.Add(temp2); } } if (rules.Count > int.Parse(settings.MaxRules)) { rules = new List<Layer7FirewallRule>(); } json = JsonConvert.SerializeObject(L7FirewallRules.rules); json = json.Replace('"', '\''); string workingFile = Directory.GetCurrentDirectory() + "\\update.py"; if (File.Exists(workingFile)) { File.Delete(workingFile); } using (StreamWriter sw = new StreamWriter(workingFile)) { sw.WriteLine("import meraki"); sw.WriteLine("dashboard = meraki.DashboardAPI(\"" + settings.MerakiAPIKey + "\")"); sw.WriteLine("response = dashboard.appliance.updateNetworkApplianceFirewallL7FirewallRules(\"" + settings.NetworkId + "\", rules=" + json + ")"); sw.WriteLine("print(response)"); } /*ProcessStartInfo start = new ProcessStartInfo(); start.FileName = settings.PythonPath; start.Arguments = workingFile; start.UseShellExecute = true;// Do not use OS shell start.CreateNoWindow = false; // We don't need new window start.LoadUserProfile = true; Process.Start(start); //Console.ReadLine(); if (File.Exists(workingFile)) { File.Delete(workingFile); }*/ } } static async Task GetL7FirewallRules(string apiKey, string organization = "", string networkId = "") { var merakiClient = new MerakiClient(new MerakiClientOptions { ApiKey = apiKey }); if (string.IsNullOrEmpty(organization)) { var organizations = await merakiClient .Organizations .GetAllAsync() .ConfigureAwait(false); var firstOrganization = organizations[0]; organization = firstOrganization.Id.ToString(); } if (string.IsNullOrEmpty(networkId)) { var networks = await merakiClient .Networks .GetAllAsync(organization) .ConfigureAwait(false); networkId = networks[0].Id.ToString(); } var l7FirewallRules = await merakiClient .MxLayer7FirewallRules .GetNetworkL7FirewallRules(networkId) .ConfigureAwait(false); L7FirewallRules = JsonConvert.DeserializeObject<Root>(l7FirewallRules.ToString()); } } }
41.392857
165
0.457907
[ "Apache-2.0" ]
smccloud/Meraki-Auto-Block-Utility
Meraki-Auto-Block-Utility/Program.cs
8,115
C#
using System; using ZyGames.Doudizhu.Bll; using ZyGames.Doudizhu.Model; using ZyGames.Framework.Common; using ZyGames.Framework.Game.Cache; using ZyGames.Framework.Game.Contract; using ZyGames.Framework.Game.Contract.Action; using ZyGames.Framework.Game.Lang; using ZyGames.Framework.Game.Service; using ZyGames.Framework.Net; namespace ZyGames.Doudizhu.Script.CsScript.Action { /// <summary> /// 1004_用户登录 /// </summary> public class Action1004 : LoginExtendAction { public Action1004(HttpGet httpGet) : base(ActionIDDefine.Cst_Action1004, httpGet) { } protected override bool DoSuccess(int userId) { var cacheSet = new GameDataCacheSet<GameUser>(); GameUser gameUser = cacheSet.FindKey(Uid); if (gameUser == null || string.IsNullOrEmpty(gameUser.SessionID) || !gameUser.IsInlining) { gameUser = cacheSet.FindKey(Uid); } if (gameUser != null) { //原因:还在加载中时,返回 if (gameUser.Property.IsRefreshing) { Uid = string.Empty; ErrorCode = Language.Instance.ErrorCode; ErrorInfo = Language.Instance.ServerLoading; return false; } } var nowTime = DateTime.Now; if (gameUser == null) { this.ErrorCode = 1005; return true; } else { if (gameUser.UserStatus == UserStatus.FengJin) { ErrorCode = Language.Instance.TimeoutCode; ErrorInfo = Language.Instance.AcountIsLocked; return false; } gameUser.SessionID = Sid; gameUser.OnlineDate = nowTime; gameUser.LoginDate = nowTime; gameUser.Property.GameId = this.GameType; gameUser.Property.ServerId = this.ServerID; gameUser.Property.ChatVesion = 0; //gameUser.OnLine = true; //gameUser.Logoff = true; } System.Threading.Tasks.Task.Factory.StartNew(() => { //登录日志 UserLoginLog userLoginLog = new UserLoginLog(); userLoginLog.UserId = gameUser.UserId.ToString(); userLoginLog.SessionID = Sid; userLoginLog.MobileType = this.MobileType.ToShort(); userLoginLog.ScreenX = this.ScreenX; userLoginLog.ScreenY = this.ScreenY; userLoginLog.RetailId = this.RetailID; userLoginLog.AddTime = nowTime; userLoginLog.State = LoginStatus.Logined.ToInt(); userLoginLog.DeviceID = this.DeviceID; userLoginLog.Ip = this.GetRealIP(); userLoginLog.Pid = gameUser.Pid; userLoginLog.UserLv = gameUser.UserLv; var sender = DataSyncManager.GetDataSender(); sender.Send(userLoginLog); }); return true; } } }
34.010101
69
0.51292
[ "Unlicense" ]
simon96523/Scut
Sample/Doudizhu/Server/release/Script/CsScript/Action/Action1004.cs
3,409
C#
using System; using NetRuntimeSystem = System; using System.Runtime.InteropServices; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Reflection; using System.Collections.Generic; using NetOffice; namespace NetOffice.OWC10Api { ///<summary> /// Interface DesignAdviseSink /// SupportByVersion OWC10, 1 ///</summary> [SupportByVersionAttribute("OWC10", 1)] [EntityTypeAttribute(EntityType.IsInterface)] public class DesignAdviseSink : COMObject { #pragma warning disable #region Type Information private static Type _type; [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public static Type LateBindingApiWrapperType { get { if (null == _type) _type = typeof(DesignAdviseSink); return _type; } } #endregion #region Construction ///<param name="factory">current used factory core</param> ///<param name="parentObject">object there has created the proxy</param> ///<param name="comProxy">inner wrapped COM proxy</param> public DesignAdviseSink(Core factory, COMObject parentObject, object comProxy) : base(factory, parentObject, comProxy) { } ///<param name="parentObject">object there has created the proxy</param> ///<param name="comProxy">inner wrapped COM proxy</param> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public DesignAdviseSink(COMObject parentObject, object comProxy) : base(parentObject, comProxy) { } ///<param name="factory">current used factory core</param> ///<param name="parentObject">object there has created the proxy</param> ///<param name="comProxy">inner wrapped COM proxy</param> ///<param name="comProxyType">Type of inner wrapped COM proxy"</param> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public DesignAdviseSink(Core factory, COMObject parentObject, object comProxy, NetRuntimeSystem.Type comProxyType) : base(factory, parentObject, comProxy, comProxyType) { } ///<param name="parentObject">object there has created the proxy</param> ///<param name="comProxy">inner wrapped COM proxy</param> ///<param name="comProxyType">Type of inner wrapped COM proxy"</param> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public DesignAdviseSink(COMObject parentObject, object comProxy, NetRuntimeSystem.Type comProxyType) : base(parentObject, comProxy, comProxyType) { } ///<param name="replacedObject">object to replaced. replacedObject are not usable after this action</param> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public DesignAdviseSink(COMObject replacedObject) : base(replacedObject) { } [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public DesignAdviseSink() : base() { } /// <param name="progId">registered ProgID</param> [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] public DesignAdviseSink(string progId) : base(progId) { } #endregion #region Properties #endregion #region Methods /// <summary> /// SupportByVersion OWC10 1 /// /// </summary> /// <param name="dscobjtyp">NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp</param> /// <param name="varObject">object varObject</param> /// <param name="fGrid">Int32 fGrid</param> [SupportByVersionAttribute("OWC10", 1)] public Int32 ObjectAdded(NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp, object varObject, Int32 fGrid) { object[] paramsArray = Invoker.ValidateParamsArray(dscobjtyp, varObject, fGrid); object returnItem = Invoker.MethodReturn(this, "ObjectAdded", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); } /// <summary> /// SupportByVersion OWC10 1 /// /// </summary> /// <param name="dscobjtyp">NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp</param> /// <param name="varObject">object varObject</param> [SupportByVersionAttribute("OWC10", 1)] public Int32 ObjectDeleted(NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp, object varObject) { object[] paramsArray = Invoker.ValidateParamsArray(dscobjtyp, varObject); object returnItem = Invoker.MethodReturn(this, "ObjectDeleted", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); } /// <summary> /// SupportByVersion OWC10 1 /// /// </summary> /// <param name="dscobjtyp">NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp</param> /// <param name="varObject">object varObject</param> /// <param name="bstrRsd">string bstrRsd</param> [SupportByVersionAttribute("OWC10", 1)] public Int32 ObjectMoved(NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp, object varObject, string bstrRsd) { object[] paramsArray = Invoker.ValidateParamsArray(dscobjtyp, varObject, bstrRsd); object returnItem = Invoker.MethodReturn(this, "ObjectMoved", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); } /// <summary> /// SupportByVersion OWC10 1 /// /// </summary> [SupportByVersionAttribute("OWC10", 1)] public Int32 DataModelLoad() { object[] paramsArray = null; object returnItem = Invoker.MethodReturn(this, "DataModelLoad", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); } /// <summary> /// SupportByVersion OWC10 1 /// /// </summary> /// <param name="dscobjtyp">NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp</param> /// <param name="varObject">object varObject</param> [SupportByVersionAttribute("OWC10", 1)] public Int32 ObjectChanged(NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp, object varObject) { object[] paramsArray = Invoker.ValidateParamsArray(dscobjtyp, varObject); object returnItem = Invoker.MethodReturn(this, "ObjectChanged", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); } /// <summary> /// SupportByVersion OWC10 1 /// /// </summary> /// <param name="dscobjtyp">NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp</param> [SupportByVersionAttribute("OWC10", 1)] public Int32 ObjectDeleteComplete(NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp) { object[] paramsArray = Invoker.ValidateParamsArray(dscobjtyp); object returnItem = Invoker.MethodReturn(this, "ObjectDeleteComplete", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); } /// <summary> /// SupportByVersion OWC10 1 /// /// </summary> /// <param name="dscobjtyp">NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp</param> /// <param name="varObject">object varObject</param> /// <param name="bstrPreviousName">string bstrPreviousName</param> [SupportByVersionAttribute("OWC10", 1)] public Int32 ObjectRenamed(NetOffice.OWC10Api.Enums.DscObjectTypeEnum dscobjtyp, object varObject, string bstrPreviousName) { object[] paramsArray = Invoker.ValidateParamsArray(dscobjtyp, varObject, bstrPreviousName); object returnItem = Invoker.MethodReturn(this, "ObjectRenamed", paramsArray); return NetRuntimeSystem.Convert.ToInt32(returnItem); } #endregion #pragma warning restore } }
36.562814
170
0.722375
[ "MIT" ]
Engineerumair/NetOffice
Source/OWC10/Interfaces/DesignAdviseSink.cs
7,276
C#
using System.Collections.Generic; using System.Threading.Tasks; using EPlast.BLL.DTO.AboutBase; using EPlast.DataAccess.Entities; namespace EPlast.BLL.Interfaces.AboutBase { public interface IAboutBaseSectionService { Task<IEnumerable<SectionDTO>> GetAllSectionAsync(); Task<SectionDTO> GetSection(int id); Task AddSection(SectionDTO sectionDTO, User user); Task ChangeSection(SectionDTO sectionDTO, User user); Task DeleteSection(int id, User user); } }
22.391304
61
0.726214
[ "MIT" ]
ita-social-projects/EPlas
EPlast/EPlast.BLL/Interfaces/AboutBase/IAboutBaseSectionService.cs
517
C#
using System; using Aop.Api.Domain; using System.Collections.Generic; using Aop.Api.Response; namespace Aop.Api.Request { /// <summary> /// AOP API: alipay.marketing.cdp.advertise.modify /// </summary> public class AlipayMarketingCdpAdvertiseModifyRequest : IAopRequest<AlipayMarketingCdpAdvertiseModifyResponse> { /// <summary> /// 提供给ISV、开发者修改广告的接口,修改广告后投放渠道包括钱包APP,聚牛APP等,投放支持的APP应用 /// </summary> public string BizContent { get; set; } #region IAopRequest Members private bool needEncrypt=false; private string apiVersion = "1.0"; private string terminalType; private string terminalInfo; private string prodCode; private string notifyUrl; private string returnUrl; private AopObject bizModel; private Dictionary<string, string> udfParams; //add user-defined text parameters public void SetNeedEncrypt(bool needEncrypt){ this.needEncrypt=needEncrypt; } public bool GetNeedEncrypt(){ return this.needEncrypt; } public void SetNotifyUrl(string notifyUrl){ this.notifyUrl = notifyUrl; } public string GetNotifyUrl(){ return this.notifyUrl; } public void SetReturnUrl(string returnUrl){ this.returnUrl = returnUrl; } public string GetReturnUrl(){ return this.returnUrl; } public void SetTerminalType(String terminalType){ this.terminalType=terminalType; } public string GetTerminalType(){ return this.terminalType; } public void SetTerminalInfo(String terminalInfo){ this.terminalInfo=terminalInfo; } public string GetTerminalInfo(){ return this.terminalInfo; } public void SetProdCode(String prodCode){ this.prodCode=prodCode; } public string GetProdCode(){ return this.prodCode; } public string GetApiName() { return "alipay.marketing.cdp.advertise.modify"; } public void SetApiVersion(string apiVersion){ this.apiVersion=apiVersion; } public string GetApiVersion(){ return this.apiVersion; } public void PutOtherTextParam(string key, string value) { if(this.udfParams == null) { this.udfParams = new Dictionary<string, string>(); } this.udfParams.Add(key, value); } public IDictionary<string, string> GetParameters() { AopDictionary parameters = new AopDictionary(); parameters.Add("biz_content", this.BizContent); if(udfParams != null) { parameters.AddAll(this.udfParams); } return parameters; } public AopObject GetBizModel() { return this.bizModel; } public void SetBizModel(AopObject bizModel) { this.bizModel = bizModel; } #endregion } }
26.290323
115
0.571166
[ "Apache-2.0" ]
554393109/alipay-sdk-net-all
AlipaySDKNet.Standard/Request/AlipayMarketingCdpAdvertiseModifyRequest.cs
3,340
C#
using CleanBrowsingClient.Config; using CleanBrowsingClient.Models; using Nett; using Serilog; using System; using System.IO; namespace CleanBrowsingClient.Helper { /// <summary> /// Class to load and save the dnscrypt configuration (TOML format). /// </summary> public static class DnscryptProxyConfigurationManager { private static readonly ILogger Logger = Log.ForContext(typeof(DnscryptProxyConfigurationManager)); /// <summary> /// The global dnscrypt configuration. /// </summary> public static DnscryptProxyConfiguration DnscryptProxyConfiguration { get; set; } /// <summary> /// Loads the configuration from a .toml file. /// </summary> /// <returns><c>true</c> on success, otherwise <c>false</c></returns> public static bool LoadConfiguration() { try { var configFile = Path.Combine(Directory.GetCurrentDirectory(), Global.DnsCryptProxyFolder, Global.DnsCryptConfigurationFile); if (!File.Exists(configFile)) return false; var settings = TomlSettings.Create(s => s.ConfigurePropertyMapping(m => m.UseTargetPropertySelector(standardSelectors => standardSelectors.IgnoreCase))); DnscryptProxyConfiguration = Toml.ReadFile<DnscryptProxyConfiguration>(configFile, settings); return true; } catch (Exception exception) { Logger.Error(exception, "LoadConfiguration"); return false; } } /// <summary> /// Saves the configuration to a .toml file. /// </summary> /// <returns><c>true</c> on success, otherwise <c>false</c></returns> public static bool SaveConfiguration() { try { var configFile = Path.Combine(Directory.GetCurrentDirectory(), Global.DnsCryptProxyFolder, Global.DnsCryptConfigurationFile); var settings = TomlSettings.Create(s => s.ConfigurePropertyMapping(m => m.UseKeyGenerator(standardGenerators => standardGenerators.LowerCase))); Toml.WriteFile(DnscryptProxyConfiguration, configFile, settings); return true; } catch (Exception exception) { Logger.Error(exception, "SaveConfiguration"); return false; } } } }
38.34375
169
0.612877
[ "MIT" ]
Barnabas2/CleanBrowsingClient
src/CleanBrowsingClient/Helper/DnscryptProxyConfigurationManager.cs
2,456
C#
using System.Threading.Tasks; using AlphaDev.Core; using AlphaDev.Web.Core.TagHelpers; using FluentAssertions; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using NSubstitute; using Xunit; namespace AlphaDev.Web.Core.Tests.Unit.TagHelpers { public class SimpleEditorTagHelperTests { [Fact] public void ConstructorShouldInitializeSimpleEditorTagHelperWithTheCorrectEditorElementName() { var tagHelperOutput = new TagHelperOutput(default, new TagHelperAttributeList(), (_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); var htmlHelper = Substitute.For<IHtmlHelper, IViewContextAware>(); htmlHelper.Id(Arg.Any<string>()).Returns(info => info[0].ToString()); var helper = new SimpleEditorTagHelper(htmlHelper, Substitute.For<IUrlHelperFactory>(), Substitute.For<IPrefixGenerator>()) { Context = new ViewContext() }; helper.Process(default, tagHelperOutput); helper.Context.ViewData .Should() .ContainKey("InlineScripts") .WhichValue.Should() .BeEquivalentTo(@"<script type=""text/javascript""> $('#Value').markdown({ savable: true, onChange: function() { Prism.highlightAll(); }, onSave: function() { $('#editForm').submit(); } }) </script>"); } [Fact] public void ConstructorShouldInitializeSimpleEditorTagHelperWithTheCorrectViewName() { var tagHelperOutput = new TagHelperOutput(default, new TagHelperAttributeList(), (_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); var htmlHelper = Substitute.For<IHtmlHelper, IViewContextAware>(); var helper = new SimpleEditorTagHelper(htmlHelper, Substitute.For<IUrlHelperFactory>(), Substitute.For<IPrefixGenerator>()) { Context = new ViewContext() }; helper.Process(default, tagHelperOutput); // ReSharper disable once Mvc.PartialViewNotResolved - no need for a valid view in unit test // ReSharper disable once MustUseReturnValue - don't care about return value htmlHelper.Received(1).PartialAsync("_simpleEditor", Arg.Any<object>(), helper.Context.ViewData); } [Fact] public void ConstructorShouldInitializeSimpleEditorTagHelperWithTheHtmlHelperArgument() { var tagHelperOutput = new TagHelperOutput(default, new TagHelperAttributeList(), (_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); var htmlHelper = Substitute.For<IHtmlHelper, IViewContextAware>(); var helper = new SimpleEditorTagHelper(htmlHelper, Substitute.For<IUrlHelperFactory>(), Substitute.For<IPrefixGenerator>()) { Context = new ViewContext() }; helper.Process(default, tagHelperOutput); // ReSharper disable once Mvc.PartialViewNotResolved - no need for a valid view in unit test // ReSharper disable once MustUseReturnValue - don't care about return value htmlHelper.Received(1).PartialAsync(Arg.Any<string>(), Arg.Any<object>(), helper.Context.ViewData); } [Fact] public void ConstructorShouldInitializeSimpleEditorTagHelperWithThePrefixGeneratorResult() { var tagHelperOutput = new TagHelperOutput(default, new TagHelperAttributeList(), (_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); var prefixGenerator = Substitute.For<IPrefixGenerator>(); const string prefix = "test"; prefixGenerator.Generate().Returns(prefix); var helper = new SimpleEditorTagHelper(Substitute.For<IHtmlHelper, IViewContextAware>(), Substitute.For<IUrlHelperFactory>(), prefixGenerator) { Context = new ViewContext() }; helper.Process(default, tagHelperOutput); helper.Context.ViewData.TemplateInfo.HtmlFieldPrefix.Should().BeEquivalentTo(prefix); } [Fact] public void ConstructorShouldInitializeSimpleEditorTagHelperWithTheUrlHelperFactoryArgument() { var tagHelperOutput = new TagHelperOutput(default, new TagHelperAttributeList(), (_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); var urlHelperFactory = Substitute.For<IUrlHelperFactory>(); var urlHelper = Substitute.For<IUrlHelper>(); var helper = new SimpleEditorTagHelper(Substitute.For<IHtmlHelper, IViewContextAware>(), urlHelperFactory, Substitute.For<IPrefixGenerator>()) { Context = new ViewContext() }; urlHelperFactory.GetUrlHelper(helper.Context).Returns(urlHelper); helper.Process(default, tagHelperOutput); urlHelper.Received().Content(Arg.Any<string>()); } } }
51.205357
118
0.604185
[ "Unlicense" ]
OlegKleyman/AlphaDev
tests/unit/AlphaDev.Web.Core.Tests.Unit/TagHelpers/SimpleEditorTagHelperTests.cs
5,737
C#
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; namespace SqlSugar { public partial interface IInsertable<T> { InsertBuilder InsertBuilder { get; set; } int ExecuteCommand(); Task<int> ExecuteCommandAsync(); int ExecuteReturnIdentity(); Task<int> ExecuteReturnIdentityAsync(); T ExecuteReturnEntity(); Task<T> ExecuteReturnEntityAsync(); bool ExecuteCommandIdentityIntoEntity(); Task<bool> ExecuteCommandIdentityIntoEntityAsync(); long ExecuteReturnBigIdentity(); Task<long> ExecuteReturnBigIdentityAsync(); IInsertable<T> AS(string tableName); IInsertable<T> With(string lockString); IInsertable<T> InsertColumns(Expression<Func<T, object>> columns); IInsertable<T> InsertColumns(params string[] columns); IInsertable<T> IgnoreColumns(Expression<Func<T, object>> columns); IInsertable<T> IgnoreColumns(params string[]columns); IInsertable<T> IgnoreColumns(bool ignoreNullColumn, bool isOffIdentity = false); ISubInsertable<T> AddSubList(Expression<Func<T, object>> subForeignKey); ISubInsertable<T> AddSubList(Expression<Func<T, SubInsertTree>> tree); IInsertable<T> EnableDiffLogEvent(object businessData = null); IInsertable<T> RemoveDataCache(); KeyValuePair<string, List<SugarParameter>> ToSql(); SqlServerBlueCopy UseSqlServer(); MySqlBlueCopy<T> UseMySql(); void AddQueue(); } }
36.613636
88
0.69522
[ "Apache-2.0" ]
libingxin01/SqlSugar
Src/Asp.Net/SqlSugar/Interface/Insertable.cs
1,613
C#
using System; using System.Reflection; using Microsoft.Extensions.Logging; using Stl.Fusion.Internal; using Stl.Generators; using Stl.Reflection; namespace Stl.Fusion.Interception { public class ComputeMethodInterceptor : ComputeMethodInterceptorBase { public new class Options : ComputeMethodInterceptorBase.Options { public Generator<LTag> VersionGenerator { get; set; } = ConcurrentLTagGenerator.Default; } protected readonly Generator<LTag> VersionGenerator; public ComputeMethodInterceptor( Options? options, IServiceProvider services, ILoggerFactory? loggerFactory = null) : base(options ??= new(), services, loggerFactory) => VersionGenerator = options.VersionGenerator; protected override ComputeFunctionBase<T> CreateFunction<T>(ComputeMethodDef method) { var log = LoggerFactory.CreateLogger<ComputeMethodFunction<T>>(); if (method.Options.IsAsyncComputed) return new AsyncComputeMethodFunction<T>(method, VersionGenerator, Services, log); return new ComputeMethodFunction<T>(method, VersionGenerator, Services, log); } protected override void ValidateTypeInternal(Type type) { var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy; foreach (var method in type.GetMethods(bindingFlags)) { var attr = ComputedOptionsProvider.GetComputeMethodAttribute(method); var options = ComputedOptionsProvider.GetComputedOptions(method); if (attr == null || options == null) continue; if (method.IsStatic) throw Errors.ComputeServiceMethodAttributeOnStaticMethod(method); if (!method.IsVirtual) throw Errors.ComputeServiceMethodAttributeOnNonVirtualMethod(method); if (method.IsFinal) // All implemented interface members are marked as "virtual final" // unless they are truly virtual throw Errors.ComputeServiceMethodAttributeOnNonVirtualMethod(method); var returnType = method.ReturnType; if (!returnType.IsTaskOrValueTask()) throw Errors.ComputeServiceMethodAttributeOnNonAsyncMethod(method); if (returnType.GetTaskOrValueTaskArgument() == null) throw Errors.ComputeServiceMethodAttributeOnAsyncMethodReturningNonGenericTask(method); var attributeName = nameof(ComputeMethodAttribute).Replace(nameof(Attribute), ""); if (!attr.IsEnabled) Log.Log(ValidationLogLevel, "- {Method}: has [{Attribute}(false)]", method.ToString(), attributeName); else Log.Log(ValidationLogLevel, "+ {Method}: [{Attribute}(" + "KeepAliveTime = {KeepAliveTime}, " + "AutoInvalidateTime = {AutoInvalidateTime}" + ")]", method.ToString(), attributeName, attr.KeepAliveTime, attr.AutoInvalidateTime); } } } }
46.944444
109
0.619527
[ "MIT" ]
Tyrrrz-Contributions/Stl.Fusion
src/Stl.Fusion/Interception/ComputeMethodInterceptor.cs
3,380
C#
// <auto-generated /> using BackEnd.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace BackEnd.Migrations { [DbContext(typeof(ApplicationDbContext))] [Migration("20190128054119_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "2.2.1-servicing-10028") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("BackEnd.Models.Speaker", b => { b.Property<int>("ID") .ValueGeneratedOnAdd() .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property<string>("Bio") .HasMaxLength(4000); b.Property<string>("Name") .IsRequired() .HasMaxLength(200); b.Property<string>("WebSite") .HasMaxLength(1000); b.HasKey("ID"); b.ToTable("Speakers"); }); #pragma warning restore 612, 618 } } }
34.297872
125
0.600496
[ "MIT" ]
3arlN3t/aspnetcore-app-workshop
save-points/2a-Refactor-to-ConferenceDTO/ConferencePlanner/BackEnd/Migrations/20190128054119_Initial.Designer.cs
1,614
C#
using System.Diagnostics.CodeAnalysis; namespace QSP.Compiler { [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")] [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")] public class Options { public string[]? Sources { get; set; } public string? OutputPath { get; set; } public string? ModuleName { get; set; } public string[]? References { get; set; } } }
36.083333
71
0.667436
[ "MIT" ]
p1x/QSPNet
QSP.Compiler/Options.cs
435
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class JefeFuegoBullet : MonoBehaviour { public float speed; public int bossDamage; private Transform player; private Vector2 target; public GameObject impactEffect; // Start is called before the first frame update void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; target = new Vector2(player.position.x, player.position.y); } // Update is called once per frame void Update() { transform.position = Vector2.MoveTowards(transform.position, target, speed * Time.deltaTime); if (transform.position.x == target.x && transform.position.y == target.y) Destroy(gameObject); } void OnTriggerEnter2D(Collider2D collisionInfo) { if (collisionInfo.gameObject.CompareTag("Player")) { Instantiate(impactEffect, transform.position, transform.rotation); PlayerMovement myPlayer = collisionInfo.GetComponent<PlayerMovement>(); myPlayer.RecibirDaño(bossDamage); Destroy(gameObject); } } }
26.704545
101
0.668085
[ "MIT" ]
SergioPucela/Nano-Doctor
Nano Doctor/Assets/Scripts/JefeFuegoBullet.cs
1,178
C#
using UnityEngine; using System.Collections; public class ActivateScript : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public void Activate() { ParticleSystem[] systems = GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem ps in systems) { ps.Play(true); } } public void DeActivate() { gameObject.SetActive (false); } }
15.275862
71
0.693002
[ "MIT" ]
uareurapid/balloonquest
Assets/scripts/ActivateScript.cs
445
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Thrift.Transport; namespace Thrifty.Nifty.Duplex { /// <summary> /// Represents a pair of transports: one for input and one for output. /// </summary> public class TTransportPair { protected TTransportPair(TTransport inputTransport, TTransport outputTransport) { this.InputTransport = inputTransport; this.OutputTransport = outputTransport; } public TTransport InputTransport { get; private set; } public TTransport OutputTransport { get; private set; } public static TTransportPair FromSeparateTransports(TTransport inputTransport, TTransport outputTransport) { return new TTransportPair(inputTransport, outputTransport); } public static TTransportPair FromSingleTransport(TTransport transport) { return new TTransportPair(transport, transport); } public void Release() { this.InputTransport = null; this.OutputTransport = null; } } }
28.146341
114
0.658579
[ "Apache-2.0" ]
DavidAlphaFox/Thrifty
src/Thrifty.Nifty/Duplex/TTransportPair.cs
1,156
C#
using Acr.UserDialogs; using AdelaideFuel.Api; using AdelaideFuel.Services; using AdelaideFuel.ViewModels; using Newtonsoft.Json; using Plugin.StoreReview; using Plugin.StoreReview.Abstractions; using Refit; using SimpleInjector; using System; using System.Collections.Generic; using System.Linq; using Xamarin.Essentials.Interfaces; [assembly: AdelaideFuel.Attributes.Preserve] namespace AdelaideFuel { public static class IoC { private static readonly Container Container = new Container(); static IoC() { Container.Options.EnableAutoVerification = false; var refitSettings = new RefitSettings(new NewtonsoftJsonContentSerializer(new JsonSerializerSettings() { DateTimeZoneHandling = DateTimeZoneHandling.Utc })); Container.RegisterSingleton(typeof(IAdelaideFuelApi), () => { return RestService.For<IAdelaideFuelApi>(Constants.ApiUrlBase, refitSettings); }); Container.RegisterSingleton(typeof(IUserDialogs), () => UserDialogs.Instance); Container.RegisterSingleton(typeof(IStoreReview), () => CrossStoreReview.Current); Container.Register<ILogger, Logger>(Lifestyle.Singleton); Container.Register<ICacheService, CacheService>(Lifestyle.Singleton); Container.Register<IStoreFactory, StoreFactory>(Lifestyle.Singleton); Container.Register<IFuelService, FuelService>(Lifestyle.Singleton); Container.Register<IAppPreferences, AppPreferences>(Lifestyle.Singleton); Container.Register<IRetryPolicyFactory, RetryPolicyFactory>(Lifestyle.Singleton); Container.Register<IBvmConstructor, BvmConstructor>(Lifestyle.Singleton); foreach (var e in GetEssentialInterfaceAndImplementations()) { Container.Register(e.Key, e.Value, Lifestyle.Singleton); } foreach (var vmType in GetViewModelTypes()) { Container.Register(vmType, vmType, Lifestyle.Transient); } } public static IDictionary<Type, Type> GetEssentialInterfaceAndImplementations() { var result = new Dictionary<Type, Type>(); var essentialImpls = typeof(IEssentialsImplementation) .Assembly .GetTypes() .Where(t => t.IsClass && t.Namespace.EndsWith(nameof(Xamarin.Essentials.Implementation))); foreach (var impl in essentialImpls) { var implInterface = impl.GetInterfaces().First(i => i != typeof(IEssentialsImplementation)); result.Add(implInterface, impl); } return result; } public static IEnumerable<Type> GetViewModelTypes() { return typeof(BaseViewModel) .Assembly .GetTypes() .Where(t => t.IsClass && !t.IsAbstract && t.GetInterfaces().Contains(typeof(IViewModel))); } public static void Verify() => Container.Verify(); public static T Resolve<T>() where T : class { return Container.GetInstance<T>(); } public static TViewModel ResolveViewModel<TViewModel>() where TViewModel : class, IViewModel { return Container.GetInstance<TViewModel>(); } public static void RegisterSingleton<TService, TImplementation>() where TService : class where TImplementation : class, TService { Container.Register<TService, TImplementation>(Lifestyle.Singleton); } public static void RegisterSingleton(Type serviceType, Type implementationType) { Container.Register(serviceType, implementationType, Lifestyle.Singleton); } public static void RegisterSingleton(Type serviceType, Func<object> instanceCreator) { Container.RegisterSingleton(serviceType, instanceCreator); } public static void RegisterTransient<TService, TImplementation>() where TService : class where TImplementation : class, TService { Container.Register<TService, TImplementation>(Lifestyle.Transient); } public static void RegisterTransient(Type serviceType, Type implementationType) { Container.Register(serviceType, implementationType, Lifestyle.Transient); } public static void RegisterTransient(Type serviceType, Func<object> instanceCreator) { Container.Register(serviceType, instanceCreator, Lifestyle.Transient); } } }
36.992188
136
0.641183
[ "MIT" ]
dmariogatto/adelaidefuel
src/App/AdelaideFuel/IoC.cs
4,737
C#
// Copyright 2004-2010 Castle Project - http://www.castleproject.org/ // // 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. namespace Castle.Core.Tests { using System; using System.Collections; using System.Reflection; using Castle.Core; using NUnit.Framework; [TestFixture] public class ReflectionBasedDictionaryAdapterTestCase { public class Customer { private bool writeOnly; public Customer(int id, string name) : this(id, name, false) { } public Customer(int id, string name, bool writeOnly) { this.Id = id; this.Name = name; this.writeOnly = writeOnly; } public int Id { get; set; } public string Name { get; set; } public bool WriteOnly { set { writeOnly = value; } } public bool IsWriteOnly { get { return writeOnly; } } public string this[int id] { get { return "abcdef"; } } } [Test] public void CanAccessExistingPropertiesInACaseInsensitiveFashion() { var dict = new ReflectionBasedDictionaryAdapter(new Customer(1, "name")); Assert.IsTrue(dict.Contains("id")); Assert.IsTrue(dict.Contains("ID")); Assert.IsTrue(dict.Contains("Id")); Assert.IsTrue(dict.Contains("name")); Assert.IsTrue(dict.Contains("Name")); Assert.IsTrue(dict.Contains("NAME")); } [Test] public void CanAccessPropertiesValues() { var dict = new ReflectionBasedDictionaryAdapter(new Customer(1, "name")); Assert.AreEqual(1, dict["id"]); Assert.AreEqual("name", dict["name"]); } [Test] public void CannotCreateWithNullArgument() { Assert.Throws<ArgumentNullException>(() => new ReflectionBasedDictionaryAdapter(null) ); } [Test] public void EnumeratorIteration() { var dict = new ReflectionBasedDictionaryAdapter(new {foo = 1, name = "jonh", age = 25}); Assert.AreEqual(3, dict.Count); var enumerator = (IDictionaryEnumerator) dict.GetEnumerator(); while (enumerator.MoveNext()) { Assert.IsNotNull(enumerator.Key); Assert.IsNotNull(enumerator.Value); } } [Test] public void Using_anonymous_types_works_without_exception() { var target = new { foo = 1, name = "john", age = 25 }; Assert.IsFalse(target.GetType().GetTypeInfo().IsPublic); var dict = new ReflectionBasedDictionaryAdapter(target); Assert.AreEqual(3, dict.Count); Assert.AreEqual(1, dict["foo"]); Assert.AreEqual("john", dict["name"]); Assert.AreEqual(25, dict["age"]); } [Test] public void InexistingPropertiesReturnsNull() { var dict = new ReflectionBasedDictionaryAdapter(new Customer(1, "name")); Assert.IsNull(dict["age"]); } [Test] public void ShouldNotAccessInexistingProperties() { var dict = new ReflectionBasedDictionaryAdapter(new Customer(1, "name")); Assert.IsFalse(dict.Contains("Age"), "Age property found when it should not be"); Assert.IsFalse(dict.Contains("Address"), "Address property found when it should not be"); } [Test /*(Description = "Test case for patch supplied on the mailing list by Jan Limpens")*/] public void ShouldNotAccessWriteOnlyProperties() { try { var dict = new ReflectionBasedDictionaryAdapter(new Customer(1, "name", true)); Assert.IsTrue((bool) dict["IsWriteOnly"]); } catch (ArgumentException) { Assert.Fail("Attempted to read a write-only property"); } } } }
25.980645
95
0.661038
[ "Apache-2.0" ]
balefrost/CastleProject.Core
src/Castle.Core.Tests/ReflectionBasedDictionaryAdapterTestCase.cs
4,027
C#
namespace Orchard.Caching { public interface IVolatileToken { bool IsCurrent { get; } } }
21
37
0.647619
[ "BSD-3-Clause" ]
1996dylanriley/Orchard
src/Orchard/Caching/IVolatileToken.cs
105
C#
using System; using System.Collections; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Activizr.Logic.Structure; using Telerik.Web.UI; public partial class Controls_v4_GeographyTree : System.Web.UI.UserControl { protected void Page_Load (object sender, EventArgs e) { if (!Page.IsPostBack) { if (Tree.Nodes.Count == 0) { Populate(); } if (!String.IsNullOrEmpty(this.onClientNodeClicking)) { Tree.OnClientNodeClicking = this.onClientNodeClicking; } } } public void Tree_NodeClick (object sender, RadTreeNodeEventArgs e) { if (SelectedNodeChanged != null) { SelectedNodeChanged(this, new EventArgs()); } } public event EventHandler SelectedNodeChanged; public Geography SelectedGeography { get { string selectedIdentity = Tree.SelectedValue; if (String.IsNullOrEmpty(selectedIdentity)) { return null; } return Geography.FromIdentity(Int32.Parse(selectedIdentity)); } set { if (value != null) { RadTreeNode node = Tree.FindNodeByValue(value.Identity.ToString()); if (node != null) { node.Selected = true; } } else if (Tree.SelectedNode != null) { while (Tree.SelectedNode != null) { Tree.SelectedNode.Selected = false; } } } } private void Populate () { Geography wasSelectedGeo = this.SelectedGeography; Tree.Nodes.Clear(); if (roots == null) { roots = Geographies.FromSingle(Geography.Root); } RadTreeNode topNode = new RadTreeNode("", ""); foreach (Geography root in roots) { Geographies geos = root.GetTree(); // We need a real fucking tree structure. Dictionary<int, Geographies> lookup = new Dictionary<int, Geographies>(); foreach (Geography geo in geos) { if (!lookup.ContainsKey(geo.ParentIdentity)) { lookup[geo.ParentIdentity] = new Geographies(); } lookup[geo.ParentIdentity].Add(geo); } topNode.Nodes.Add(RecursiveAdd(lookup, geos[0].ParentIdentity)[0]); } //Re-added selection of first node to avoid crash in alert activists /JL 2010-12-21 if (roots.Count > 1) { //need the dummy root Tree.Nodes.Add(topNode); topNode.Enabled = false; topNode.Expanded = true; topNode.Nodes[0].Selected = true; } else { Tree.Nodes.Add(topNode.Nodes[0]); Tree.Nodes[0].Selected = true; } if (wasSelectedGeo != null) SelectedGeography = wasSelectedGeo; Tree.Nodes[0].Expanded = true; } private RadTreeNodeCollection RecursiveAdd (Dictionary<int, Geographies> lookup, int parentIdentity) { RadTreeNodeCollection result = new RadTreeNodeCollection(this.Tree); foreach (Geography geo in lookup[parentIdentity]) { RadTreeNode node = new RadTreeNode(geo.Name, geo.Identity.ToString()); if (lookup.ContainsKey(geo.Identity)) { RadTreeNodeCollection collection = RecursiveAdd(lookup, geo.Identity); foreach (RadTreeNode subnode in collection) { node.Nodes.Add(subnode); } } result.Add(node); } return result; } public Geographies Roots { set { this.roots = value; Populate(); } } public Geography Root { set { Roots = Geographies.FromSingle(value); } } public string OnClientNodeClicking { set { this.onClientNodeClicking = value; } get { return this.onClientNodeClicking; } } public string ParentClientID { set { this.parentClientID = value; } get { return this.parentClientID; } } private string parentClientID; private string onClientNodeClicking; private Geographies roots; }
24.551724
105
0.519663
[ "Unlicense" ]
Swarmops/Swarmops
Boneyard/Site4/Controls/v4/GeographyTree.ascx.cs
4,984
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNative.Network.V20181201.Inputs { /// <summary> /// Identity for the resource. /// </summary> public sealed class ManagedServiceIdentityArgs : Pulumi.ResourceArgs { /// <summary> /// The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine. /// </summary> [Input("type")] public Input<Pulumi.AzureNative.Network.V20181201.ResourceIdentityType>? Type { get; set; } [Input("userAssignedIdentities")] private InputMap<object>? _userAssignedIdentities; /// <summary> /// The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. /// </summary> public InputMap<object> UserAssignedIdentities { get => _userAssignedIdentities ?? (_userAssignedIdentities = new InputMap<object>()); set => _userAssignedIdentities = value; } public ManagedServiceIdentityArgs() { } } }
40.560976
291
0.693325
[ "Apache-2.0" ]
polivbr/pulumi-azure-native
sdk/dotnet/Network/V20181201/Inputs/ManagedServiceIdentityArgs.cs
1,663
C#
//////////////////////////////////////////////////////////////////////////////// //NUnit tests for "EF Core Provider for LCPI OLE DB" // IBProvider and Contributors. 11.12.2020. using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Microsoft.EntityFrameworkCore; using NUnit.Framework; using xdb=lcpi.data.oledb; namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D1.Query.Operators.SET_001.Or.Complete.NullableInt64.NullableInt32{ //////////////////////////////////////////////////////////////////////////////// using T_DATA1=System.Nullable<System.Int64>; using T_DATA2=System.Nullable<System.Int32>; //////////////////////////////////////////////////////////////////////////////// //class TestSet_001__fields public static class TestSet_001__fields { private const string c_NameOf__TABLE ="TEST_MODIFY_ROW2"; private const string c_NameOf__COL_DATA1 ="COL_BIGINT"; private const string c_NameOf__COL_DATA2 ="COL2_INTEGER"; private sealed class MyContext:TestBaseDbContext { [Table(c_NameOf__TABLE)] public sealed class TEST_RECORD { [Key] [Column("TEST_ID")] public System.Int64? TEST_ID { get; set; } [Column(c_NameOf__COL_DATA1)] public T_DATA1 COL_DATA1 { get; set; } [Column(c_NameOf__COL_DATA2)] public T_DATA2 COL_DATA2 { get; set; } };//class TEST_RECORD //---------------------------------------------------------------------- public DbSet<TEST_RECORD> testTable { get; set; } //---------------------------------------------------------------------- public MyContext(xdb.OleDbTransaction tr) :base(tr) { }//MyContext };//class MyContext //----------------------------------------------------------------------- [Test] public static void Test_00a01() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=2+4; T_DATA2 c_value2=1+2; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); #pragma warning disable CS0675 Assert.AreEqual (7, c_value1|c_value2); #pragma warning restore CS0675 #pragma warning disable CS0675 var recs=db.testTable.Where(r => (r.COL_DATA1|r.COL_DATA2)==7 && r.TEST_ID==testID); #pragma warning restore CS0675 int nRecs=0; foreach(var r in recs) { Assert.AreEqual (0, nRecs); ++nRecs; Assert.IsTrue (r.TEST_ID.HasValue); Assert.AreEqual (testID, r.TEST_ID.Value); Assert.AreEqual (c_value1, r.COL_DATA1); Assert.AreEqual (c_value2, r.COL_DATA2); }//foreach r var sqlt =new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE (BIN_OR(").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).T(") = 7) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"); db.CheckTextOfLastExecutedCommand (sqlt); Assert.AreEqual (1, nRecs); }//using db tr.Rollback(); }//using tr }//using cn }//Test_00a01 //----------------------------------------------------------------------- [Test] public static void Test_00x01() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=2; T_DATA2 c_value2=1; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); #pragma warning disable CS0675 Assert.AreEqual (3, c_value1|c_value2|c_value2); #pragma warning restore CS0675 #pragma warning disable CS0675 var recs=db.testTable.Where(r => (r.COL_DATA1|r.COL_DATA2|r.COL_DATA2)==3 && r.TEST_ID==testID); #pragma warning restore CS0675 int nRecs=0; foreach(var r in recs) { Assert.AreEqual (0, nRecs); ++nRecs; Assert.IsTrue (r.TEST_ID.HasValue); Assert.AreEqual (testID, r.TEST_ID.Value); Assert.AreEqual (c_value1, r.COL_DATA1); Assert.AreEqual (c_value2, r.COL_DATA2); }//foreach r var sqlt =new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE (BIN_OR(BIN_OR(").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).T("), ").N("t",c_NameOf__COL_DATA2).T(") = 3) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"); db.CheckTextOfLastExecutedCommand (sqlt); Assert.AreEqual (1, nRecs); }//using db tr.Rollback(); }//using tr }//using cn }//Test_00x01 //----------------------------------------------------------------------- [Test] public static void Test_00x02() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=2; T_DATA2 c_value2=1; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); #pragma warning disable CS0675 Assert.AreEqual (2, c_value1|(c_value2+c_value2)); #pragma warning restore CS0675 #pragma warning disable CS0675 var recs=db.testTable.Where(r => (r.COL_DATA1|(r.COL_DATA2+r.COL_DATA2))==2 && r.TEST_ID==testID); #pragma warning restore CS0675 try { foreach(var r in recs) { TestServices.ThrowSelectedRow(); } TestServices.ThrowWeWaitError(); } catch(lcpi.lib.structure.exceptions.t_invalid_operation_exception e) { CheckErrors.PrintException_OK(e); Assert.AreEqual (1, TestUtils.GetRecordCount(e)); CheckErrors.CheckErrorRecord__sql_translator_err__unsupported_binary_operator_type_3 (TestUtils.GetRecord(e,0), CheckErrors.c_src__EFCoreDataProvider__FB_Common__BinaryOperatorTranslatorProvider, Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb.LcpiOleDb__ExpressionType.Or, typeof(System.Int64), typeof(System.Double)); }//catch }//using db tr.Rollback(); }//using tr }//using cn }//Test_00x02 //----------------------------------------------------------------------- [Test] public static void Test_01a01__nullV2() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=3; T_DATA2 c_value2=null; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); #pragma warning disable CS0675 var recs=db.testTable.Where(r => (r.COL_DATA1|r.COL_DATA2)==null && r.TEST_ID==testID); #pragma warning restore CS0675 int nRecs=0; foreach(var r in recs) { Assert.AreEqual (0, nRecs); ++nRecs; Assert.IsTrue (r.TEST_ID.HasValue); Assert.AreEqual (testID, r.TEST_ID.Value); Assert.AreEqual (c_value1, r.COL_DATA1); Assert.AreEqual (c_value2, r.COL_DATA2); }//foreach r var sqlt =new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE ((").N("t",c_NameOf__COL_DATA1).IS_NULL().T(") OR (").N("t",c_NameOf__COL_DATA2).IS_NULL().T(")) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"); db.CheckTextOfLastExecutedCommand (sqlt); Assert.AreEqual (1, nRecs); }//using db tr.Rollback(); }//using tr }//using cn }//Test_01a01__nullV2 //----------------------------------------------------------------------- [Test] public static void Test_01a02__nullV2__eq__value() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=3; T_DATA2 c_value2=null; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); #pragma warning disable CS0675 var recs=db.testTable.Where(r => (r.COL_DATA1|r.COL_DATA2)==3 && r.TEST_ID==testID); #pragma warning restore CS0675 foreach(var r in recs) { TestServices.ThrowSelectedRow(); }//foreach r var sqlt =new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE (BIN_OR(").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).T(") = 3) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"); db.CheckTextOfLastExecutedCommand (sqlt); }//using db tr.Rollback(); }//using tr }//using cn }//Test_01a02__nullV2__eq__value //----------------------------------------------------------------------- [Test] public static void Test_10a01__nullV1() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=null; T_DATA2 c_value2=1; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); #pragma warning disable CS0675 var recs=db.testTable.Where(r => (r.COL_DATA1|r.COL_DATA2)==null && r.TEST_ID==testID); #pragma warning restore CS0675 int nRecs=0; foreach(var r in recs) { Assert.AreEqual (0, nRecs); ++nRecs; Assert.IsTrue (r.TEST_ID.HasValue); Assert.AreEqual (testID, r.TEST_ID.Value); Assert.AreEqual (c_value1, r.COL_DATA1); Assert.AreEqual (c_value2, r.COL_DATA2); }//foreach r var sqlt =new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE ((").N("t",c_NameOf__COL_DATA1).IS_NULL().T(") OR (").N("t",c_NameOf__COL_DATA2).IS_NULL().T(")) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"); db.CheckTextOfLastExecutedCommand (sqlt); Assert.AreEqual (1, nRecs); }//using db tr.Rollback(); }//using tr }//using cn }//Test_10a01__nullV1 //----------------------------------------------------------------------- [Test] public static void Test_10a02__nullV1__eq__value() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=null; T_DATA2 c_value2=1; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); #pragma warning disable CS0675 var recs=db.testTable.Where(r => (r.COL_DATA1|r.COL_DATA2)==1 && r.TEST_ID==testID); #pragma warning restore CS0675 foreach(var r in recs) { TestServices.ThrowSelectedRow(); }//foreach r var sqlt =new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE (BIN_OR(").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).T(") = 1) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"); db.CheckTextOfLastExecutedCommand (sqlt); }//using db tr.Rollback(); }//using tr }//using cn }//Test_10a02__nullV1__eq__value //----------------------------------------------------------------------- [Test] public static void Test_11a01__nullV1__nullV2() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=null; T_DATA2 c_value2=null; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); #pragma warning disable CS0675 var recs=db.testTable.Where(r => (r.COL_DATA1|r.COL_DATA2)==null && r.TEST_ID==testID); #pragma warning restore CS0675 int nRecs=0; foreach(var r in recs) { Assert.AreEqual (0, nRecs); ++nRecs; Assert.IsTrue (r.TEST_ID.HasValue); Assert.AreEqual (testID, r.TEST_ID.Value); Assert.AreEqual (c_value1, r.COL_DATA1); Assert.AreEqual (c_value2, r.COL_DATA2); }//foreach r var sqlt =new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE ((").N("t",c_NameOf__COL_DATA1).IS_NULL().T(") OR (").N("t",c_NameOf__COL_DATA2).IS_NULL().T(")) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"); db.CheckTextOfLastExecutedCommand (sqlt); Assert.AreEqual (1, nRecs); }//using db tr.Rollback(); }//using tr }//using cn }//Test_11a01__nullV1__nullV2 //----------------------------------------------------------------------- [Test] public static void Test_11a02__nullV1__nullV2__eq__value() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=null; T_DATA2 c_value2=null; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); #pragma warning disable CS0675 var recs=db.testTable.Where(r => (r.COL_DATA1|r.COL_DATA2)==1 && r.TEST_ID==testID); #pragma warning restore CS0675 foreach(var r in recs) { TestServices.ThrowSelectedRow(); }//foreach r var sqlt =new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE (BIN_OR(").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).T(") = 1) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"); db.CheckTextOfLastExecutedCommand (sqlt); }//using db tr.Rollback(); }//using tr }//using cn }//Test_11a02__nullV1__nullV2__eq__value //----------------------------------------------------------------------- private static System.Int64 Helper__InsertRow(MyContext db, T_DATA1 valueForColData1, T_DATA2 valueForColData2) { var newRecord=new MyContext.TEST_RECORD(); newRecord.COL_DATA1 =valueForColData1; newRecord.COL_DATA2 =valueForColData2; db.testTable.Add(newRecord); db.SaveChanges(); db.CheckTextOfLastExecutedCommand (new TestSqlTemplate() .T("INSERT INTO ").N(c_NameOf__TABLE).T(" (").N(c_NameOf__COL_DATA1).T(", ").N(c_NameOf__COL_DATA2).T(")").EOL() .T("VALUES (").P("p0").T(", ").P("p1").T(")").EOL() .T("RETURNING ").N("TEST_ID").EOL() .T("INTO ").P("p2").T(";")); Assert.IsTrue (newRecord.TEST_ID.HasValue); Console.WriteLine("TEST_ID: {0}",newRecord.TEST_ID.Value); return newRecord.TEST_ID.Value; }//Helper__InsertRow };//class TestSet_001__fields //////////////////////////////////////////////////////////////////////////////// }//namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D1.Query.Operators.SET_001.Or.Complete.NullableInt64.NullableInt32
26.527508
203
0.571307
[ "MIT" ]
ibprovider/Lcpi.EFCore.LcpiOleDb
Tests/General/Source/Work/DBMS/Firebird/V03_0_0/D1/Query/Operators/SET_001/Or/Complete/NullableInt64/NullableInt32/TestSet_001__fields.cs
16,396
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 robomaker-2018-06-29.normal.json service model. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; using System.Xml.Serialization; using Amazon.RoboMaker.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.RoboMaker.Model.Internal.MarshallTransformations { /// <summary> /// ListSimulationApplications Request Marshaller /// </summary> public class ListSimulationApplicationsRequestMarshaller : IMarshaller<IRequest, ListSimulationApplicationsRequest> , IMarshaller<IRequest,AmazonWebServiceRequest> { /// <summary> /// Marshaller the request object to the HTTP request. /// </summary> /// <param name="input"></param> /// <returns></returns> public IRequest Marshall(AmazonWebServiceRequest input) { return this.Marshall((ListSimulationApplicationsRequest)input); } /// <summary> /// Marshaller the request object to the HTTP request. /// </summary> /// <param name="publicRequest"></param> /// <returns></returns> public IRequest Marshall(ListSimulationApplicationsRequest publicRequest) { IRequest request = new DefaultRequest(publicRequest, "Amazon.RoboMaker"); request.Headers["Content-Type"] = "application/x-amz-json-1.1"; request.HttpMethod = "POST"; string uriResourcePath = "/listSimulationApplications"; request.ResourcePath = uriResourcePath; using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture)) { JsonWriter writer = new JsonWriter(stringWriter); writer.WriteObjectStart(); var context = new JsonMarshallerContext(request, writer); if(publicRequest.IsSetFilters()) { context.Writer.WritePropertyName("filters"); context.Writer.WriteArrayStart(); foreach(var publicRequestFiltersListValue in publicRequest.Filters) { context.Writer.WriteObjectStart(); var marshaller = FilterMarshaller.Instance; marshaller.Marshall(publicRequestFiltersListValue, context); context.Writer.WriteObjectEnd(); } context.Writer.WriteArrayEnd(); } if(publicRequest.IsSetMaxResults()) { context.Writer.WritePropertyName("maxResults"); context.Writer.Write(publicRequest.MaxResults); } if(publicRequest.IsSetNextToken()) { context.Writer.WritePropertyName("nextToken"); context.Writer.Write(publicRequest.NextToken); } if(publicRequest.IsSetVersionQualifier()) { context.Writer.WritePropertyName("versionQualifier"); context.Writer.Write(publicRequest.VersionQualifier); } writer.WriteObjectEnd(); string snippet = stringWriter.ToString(); request.Content = System.Text.Encoding.UTF8.GetBytes(snippet); } return request; } private static ListSimulationApplicationsRequestMarshaller _instance = new ListSimulationApplicationsRequestMarshaller(); internal static ListSimulationApplicationsRequestMarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static ListSimulationApplicationsRequestMarshaller Instance { get { return _instance; } } } }
36.515385
167
0.611333
[ "Apache-2.0" ]
DalavanCloud/aws-sdk-net
sdk/src/Services/RoboMaker/Generated/Model/Internal/MarshallTransformations/ListSimulationApplicationsRequestMarshaller.cs
4,747
C#
using Net.Qks.MultiTenancy.Accounting.Dto; namespace Net.Qks.Web.Areas.Admin.Models.Accounting { public class InvoiceViewModel { public InvoiceDto Invoice { get; set; } } }
19.5
51
0.697436
[ "MIT" ]
RocChing/Net.Qks
src/Net.Qks.Web.Mvc/Areas/Admin/Models/Accounting/InvoiceViewModel.cs
197
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace Blackmagic.DeckLink { /// <summary> /// Memory allocator for video frames /// </summary> [ComImport] [Guid("B36EB6E7-9D29-4AA8-92EF-843B87A289E8")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IDeckLinkMemoryAllocator { int AllocateBuffer([In] uint bufferSize, [Out] IntPtr allocatedBuffer); int ReleaseBuffer([In] IntPtr buffer); int Commit(); int Decommit(); } }
22.708333
73
0.755963
[ "MIT" ]
simongh/DeckLink.net
library/IDeckLinkMemoryAllocator.cs
547
C#
using System.Windows; using VMS.TPS.Common.Model.API; namespace EsapiEssentials.Plugin { /// <summary> /// Provides the Execute method that the PluginRunner needs to call. /// Any script that will use the PluginRunner should derive from this class. /// Derive from this class if you want to use the Window that Eclipse provides. /// </summary> public abstract class ScriptBaseWithWindow { /// <summary> /// The method that Eclipse calls when the plugin script is started from there. /// This method is called automatically, you should never need to deal with it. /// </summary> public void Execute(ScriptContext context, Window window) { Execute(new PluginScriptContext(context), window); } /// <summary> /// The method you need to implement for your script to do anything. /// </summary> /// <param name="context">A copy of the script context of the Eclipse session.</param> /// <param name="window">The Window for your script that Eclipse will display.</param> public abstract void Execute(PluginScriptContext context, Window window); } }
40.7
95
0.642916
[ "MIT" ]
redcurry/EsapiEssentials
src/EsapiEssentials/Plugin/PluginRunner/ScriptBaseWithWindow.cs
1,223
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. namespace System.Windows.Forms { using System.Windows.Forms.VisualStyles; using System.Drawing; using System.Windows.Forms.Internal; using System.Drawing.Imaging; using System.ComponentModel; using System.Windows.Forms.Layout; public class ToolStripSystemRenderer : ToolStripRenderer { [ThreadStatic()] private static VisualStyleRenderer renderer = null; private ToolStripRenderer toolStripHighContrastRenderer; public ToolStripSystemRenderer() { } internal ToolStripSystemRenderer(bool isDefault) : base(isDefault) { } internal override ToolStripRenderer RendererOverride { get { if (DisplayInformation.HighContrast) { return HighContrastRenderer; } return null; } } internal ToolStripRenderer HighContrastRenderer { get { if (toolStripHighContrastRenderer == null) { toolStripHighContrastRenderer = new ToolStripHighContrastRenderer(/*renderLikeSystem*/true); } return toolStripHighContrastRenderer; } } /// <summary> /// Draw the background color /// </summary> private static VisualStyleRenderer VisualStyleRenderer { get { if (Application.RenderWithVisualStyles) { if (renderer == null && VisualStyleRenderer.IsElementDefined(VisualStyleElement.ToolBar.Button.Normal)) { renderer = new VisualStyleRenderer(VisualStyleElement.ToolBar.Button.Normal); } } else { renderer = null; } return renderer; } } /// <summary> /// Fill the item's background as bounded by the rectangle /// </summary> private static void FillBackground(Graphics g, Rectangle bounds, Color backColor) { // Fill the background with the item's back color if (backColor.IsSystemColor) { g.FillRectangle(SystemBrushes.FromSystemColor(backColor), bounds); } else { using (Brush backBrush = new SolidBrush(backColor)) { g.FillRectangle(backBrush, bounds); } } } /// <summary> /// returns true if you are required to dispose the pen /// </summary> private static bool GetPen(Color color, ref Pen pen) { if (color.IsSystemColor) { pen = SystemPens.FromSystemColor(color); return false; } else { pen = new Pen(color); return true; } } /// <summary> /// translates the ToolStrip item state into a toolbar state, which is something the renderer understands /// </summary> private static int GetItemState(ToolStripItem item) { return (int)GetToolBarState(item); } /// <summary> /// translates the ToolStrip item state into a toolbar state, which is something the renderer understands /// </summary> private static int GetSplitButtonDropDownItemState(ToolStripSplitButton item) { return (int)GetSplitButtonToolBarState(item, true); } /// <summary> /// translates the ToolStrip item state into a toolbar state, which is something the renderer understands /// </summary> private static int GetSplitButtonItemState(ToolStripSplitButton item) { return (int)GetSplitButtonToolBarState(item, false); } /// <summary> /// translates the ToolStrip item state into a toolbar state, which is something the renderer understands /// </summary> private static ToolBarState GetSplitButtonToolBarState(ToolStripSplitButton button, bool dropDownButton) { ToolBarState state = ToolBarState.Normal; if (button != null) { if (!button.Enabled) { state = ToolBarState.Disabled; } else if (dropDownButton) { if (button.DropDownButtonPressed || button.ButtonPressed) { state = ToolBarState.Pressed; } else if (button.DropDownButtonSelected || button.ButtonSelected) { state = ToolBarState.Hot; } } else { if (button.ButtonPressed) { state = ToolBarState.Pressed; } else if (button.ButtonSelected) { state = ToolBarState.Hot; } } } return state; } /// <summary> /// translates the ToolStrip item state into a toolbar state, which is something the renderer understands /// </summary> private static ToolBarState GetToolBarState(ToolStripItem item) { ToolBarState state = ToolBarState.Normal; if (item != null) { if (!item.Enabled) { state = ToolBarState.Disabled; } if (item is ToolStripButton && ((ToolStripButton)item).Checked) { if (((ToolStripButton)item).Selected) { state = ToolBarState.Hot; // we'd prefer HotChecked here, but Color Theme uses the same color as Checked } else { state = ToolBarState.Checked; } } else if (item.Pressed) { state = ToolBarState.Pressed; } else if (item.Selected) { state = ToolBarState.Hot; } } return state; } /// <summary> /// Draw the ToolStrip background. ToolStrip users should override this if they want to draw differently. /// </summary> protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e) { ToolStrip toolStrip = e.ToolStrip; Graphics g = e.Graphics; Rectangle bounds = e.AffectedBounds; if (!ShouldPaintBackground(toolStrip)) { return; } if (toolStrip is StatusStrip) { RenderStatusStripBackground(e); } else { if (DisplayInformation.HighContrast) { FillBackground(g, bounds, SystemColors.ButtonFace); } else if (DisplayInformation.LowResolution) { FillBackground(g, bounds, (toolStrip is ToolStripDropDown) ? SystemColors.ControlLight : e.BackColor); } else if (toolStrip.IsDropDown) { FillBackground(g, bounds, (!ToolStripManager.VisualStylesEnabled) ? e.BackColor : SystemColors.Menu); } else if (toolStrip is MenuStrip) { FillBackground(g, bounds, (!ToolStripManager.VisualStylesEnabled) ? e.BackColor : SystemColors.MenuBar); } else if (ToolStripManager.VisualStylesEnabled && VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.Band.Normal)) { VisualStyleRenderer vsRenderer = VisualStyleRenderer; vsRenderer.SetParameters(VisualStyleElement.ToolBar.Bar.Normal); vsRenderer.DrawBackground(g, bounds); } else { FillBackground(g, bounds, (!ToolStripManager.VisualStylesEnabled) ? e.BackColor : SystemColors.MenuBar); } } } /// <summary> /// Draw the border around the ToolStrip. This should be done as the last step. /// </summary> protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { ToolStrip toolStrip = e.ToolStrip; Graphics g = e.Graphics; Rectangle bounds = e.ToolStrip.ClientRectangle; if (toolStrip is StatusStrip) { RenderStatusStripBorder(e); } else if (toolStrip is ToolStripDropDown) { ToolStripDropDown toolStripDropDown = toolStrip as ToolStripDropDown; // Paint the border for the window depending on whether or not we have a drop shadow effect. if (toolStripDropDown.DropShadowEnabled && ToolStripManager.VisualStylesEnabled) { bounds.Width -= 1; bounds.Height -= 1; e.Graphics.DrawRectangle(new Pen(SystemColors.ControlDark), bounds); } else { ControlPaint.DrawBorder3D(e.Graphics, bounds, Border3DStyle.Raised); } } else { if (ToolStripManager.VisualStylesEnabled) { e.Graphics.DrawLine(SystemPens.ButtonHighlight, 0, bounds.Bottom - 1, bounds.Width, bounds.Bottom - 1); e.Graphics.DrawLine(SystemPens.InactiveBorder, 0, bounds.Bottom - 2, bounds.Width, bounds.Bottom - 2); } else { e.Graphics.DrawLine(SystemPens.ButtonHighlight, 0, bounds.Bottom - 1, bounds.Width, bounds.Bottom - 1); e.Graphics.DrawLine(SystemPens.ButtonShadow, 0, bounds.Bottom - 2, bounds.Width, bounds.Bottom - 2); } } } /// <summary> /// Draw the grip. ToolStrip users should override this if they want to draw differently. /// </summary> protected override void OnRenderGrip(ToolStripGripRenderEventArgs e) { Graphics g = e.Graphics; Rectangle bounds = new Rectangle(Point.Empty, e.GripBounds.Size); bool verticalGrip = e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical; if (ToolStripManager.VisualStylesEnabled && VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.Gripper.Normal)) { VisualStyleRenderer vsRenderer = VisualStyleRenderer; if (verticalGrip) { vsRenderer.SetParameters(VisualStyleElement.Rebar.Gripper.Normal); bounds.Height = ((bounds.Height - 2/*number of pixels for border*/) / 4) * 4; // make sure height is an even interval of 4. bounds.Y = Math.Max(0, (e.GripBounds.Height - bounds.Height - 2/*number of pixels for border*/) / 2); } else { vsRenderer.SetParameters(VisualStyleElement.Rebar.GripperVertical.Normal); } vsRenderer.DrawBackground(g, bounds); } else { // do some fixup so that we dont paint from end to end. Color backColor = e.ToolStrip.BackColor; FillBackground(g, bounds, backColor); if (verticalGrip) { if (bounds.Height >= 4) { bounds.Inflate(0, -2); // scoot down 2PX and start drawing } bounds.Width = 3; } else { if (bounds.Width >= 4) { bounds.Inflate(-2, 0); // scoot over 2PX and start drawing } bounds.Height = 3; } RenderSmall3DBorderInternal(g, bounds, ToolBarState.Hot, (e.ToolStrip.RightToLeft == RightToLeft.Yes)); } } /// <summary> /// Draw the items background /// </summary> protected override void OnRenderItemBackground(ToolStripItemRenderEventArgs e) { } /// <summary> /// Draw the items background /// </summary> protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) { } /// <summary> /// Draw the button background /// </summary> protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e) { RenderItemInternal(e); } /// <summary> /// Draw the button background /// </summary> protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e) { RenderItemInternal(e); } /// <summary> /// Draw the button background /// </summary> protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e) { ToolStripItem item = e.Item; Graphics g = e.Graphics; if (ToolStripManager.VisualStylesEnabled && VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.Chevron.Normal)) { VisualStyleElement chevronElement = VisualStyleElement.Rebar.Chevron.Normal; VisualStyleRenderer vsRenderer = VisualStyleRenderer; vsRenderer.SetParameters(chevronElement.ClassName, chevronElement.Part, GetItemState(item)); vsRenderer.DrawBackground(g, new Rectangle(Point.Empty, item.Size)); } else { RenderItemInternal(e); Color arrowColor = item.Enabled ? SystemColors.ControlText : SystemColors.ControlDark; DrawArrow(new ToolStripArrowRenderEventArgs(g, item, new Rectangle(Point.Empty, item.Size), arrowColor, ArrowDirection.Down)); } } /// <summary> /// Draw the button background /// </summary> protected override void OnRenderLabelBackground(ToolStripItemRenderEventArgs e) { RenderLabelInternal(e); } /// <summary> /// Draw the items background /// </summary> protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e) { ToolStripMenuItem item = e.Item as ToolStripMenuItem; Graphics g = e.Graphics; if (item is MdiControlStrip.SystemMenuItem) { return; // no highlights are painted behind a system menu item } // if (item != null) { Rectangle bounds = new Rectangle(Point.Empty, item.Size); if (item.IsTopLevel && !ToolStripManager.VisualStylesEnabled) { // Classic Mode (3D edges) // Draw box highlight for toplevel items in downlevel platforms if (item.BackgroundImage != null) { ControlPaint.DrawBackgroundImage(g, item.BackgroundImage, item.BackColor, item.BackgroundImageLayout, item.ContentRectangle, item.ContentRectangle); } else if (item.RawBackColor != Color.Empty) { FillBackground(g, item.ContentRectangle, item.BackColor); } // Toplevel menu items do 3D borders. ToolBarState state = GetToolBarState(item); RenderSmall3DBorderInternal(g, bounds, state, (item.RightToLeft == RightToLeft.Yes)); } else { // Modern MODE (no 3D edges) // Draw blue filled highlight for toplevel items in themed platforms // or items parented to a drop down Rectangle fillRect = new Rectangle(Point.Empty, item.Size); if (item.IsOnDropDown) { // Scoot in by 2 pixels when selected fillRect.X += 2; fillRect.Width -= 3; //its already 1 away from the right edge } if (item.Selected || item.Pressed) { // Legacy behavior is to always paint the menu item background. // The correct behavior is to only paint the background if the menu item is // enabled. if (item.Enabled) { g.FillRectangle(SystemBrushes.Highlight, fillRect); } Color borderColor = ToolStripManager.VisualStylesEnabled ? SystemColors.Highlight : ProfessionalColors.MenuItemBorder; // draw selection border - always drawn regardless of Enabled. using (Pen p = new Pen(borderColor)) { g.DrawRectangle(p, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); } } else { if (item.BackgroundImage != null) { ControlPaint.DrawBackgroundImage(g, item.BackgroundImage, item.BackColor, item.BackgroundImageLayout, item.ContentRectangle, fillRect); } else if (!ToolStripManager.VisualStylesEnabled && (item.RawBackColor != Color.Empty)) { FillBackground(g, fillRect, item.BackColor); } } } } } /// <summary> /// Draws a toolbar separator. ToolStrip users should override this function to change the /// drawing of all separators. /// </summary> protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e) { RenderSeparatorInternal(e.Graphics, e.Item, new Rectangle(Point.Empty, e.Item.Size), e.Vertical); } protected override void OnRenderToolStripStatusLabelBackground(ToolStripItemRenderEventArgs e) { RenderLabelInternal(e); ToolStripStatusLabel item = e.Item as ToolStripStatusLabel; ControlPaint.DrawBorder3D(e.Graphics, new Rectangle(0, 0, item.Width - 1, item.Height - 1), item.BorderStyle, (Border3DSide)item.BorderSides); } /// <summary> /// Draw the item's background. /// </summary> protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e) { ToolStripSplitButton splitButton = e.Item as ToolStripSplitButton; Graphics g = e.Graphics; bool rightToLeft = (splitButton.RightToLeft == RightToLeft.Yes); Color arrowColor = splitButton.Enabled ? SystemColors.ControlText : SystemColors.ControlDark; // in right to left - we need to swap the parts so we dont draw v][ toolStripSplitButton VisualStyleElement splitButtonDropDownPart = (rightToLeft) ? VisualStyleElement.ToolBar.SplitButton.Normal : VisualStyleElement.ToolBar.SplitButtonDropDown.Normal; VisualStyleElement splitButtonPart = (rightToLeft) ? VisualStyleElement.ToolBar.DropDownButton.Normal : VisualStyleElement.ToolBar.SplitButton.Normal; Rectangle bounds = new Rectangle(Point.Empty, splitButton.Size); if (ToolStripManager.VisualStylesEnabled && VisualStyleRenderer.IsElementDefined(splitButtonDropDownPart) && VisualStyleRenderer.IsElementDefined(splitButtonPart)) { VisualStyleRenderer vsRenderer = VisualStyleRenderer; // Draw the SplitButton Button portion of it. vsRenderer.SetParameters(splitButtonPart.ClassName, splitButtonPart.Part, GetSplitButtonItemState(splitButton)); // the lovely Windows theming for split button comes in three pieces: // SplitButtonDropDown: [ v | // Separator: | // SplitButton: | ] // this is great except if you want to swap the button in RTL. In this case we need // to use the DropDownButton instead of the SplitButtonDropDown and paint the arrow ourselves. Rectangle splitButtonBounds = splitButton.ButtonBounds; if (rightToLeft) { // scoot to the left so we dont draw double shadow like so: ][ splitButtonBounds.Inflate(2, 0); } // Draw the button portion of it. vsRenderer.DrawBackground(g, splitButtonBounds); // Draw the SplitButton DropDownButton portion of it. vsRenderer.SetParameters(splitButtonDropDownPart.ClassName, splitButtonDropDownPart.Part, GetSplitButtonDropDownItemState(splitButton)); // Draw the drop down button portion vsRenderer.DrawBackground(g, splitButton.DropDownButtonBounds); // fill in the background image Rectangle fillRect = splitButton.ContentRectangle; if (splitButton.BackgroundImage != null) { ControlPaint.DrawBackgroundImage(g, splitButton.BackgroundImage, splitButton.BackColor, splitButton.BackgroundImageLayout, fillRect, fillRect); } // draw the separator over it. RenderSeparatorInternal(g, splitButton, splitButton.SplitterBounds, true); // and of course, now if we're in RTL we now need to paint the arrow // because we're no longer using a part that has it built in. if (rightToLeft || splitButton.BackgroundImage != null) { DrawArrow(new ToolStripArrowRenderEventArgs(g, splitButton, splitButton.DropDownButtonBounds, arrowColor, ArrowDirection.Down)); } } else { // Draw the split button button Rectangle splitButtonButtonRect = splitButton.ButtonBounds; if (splitButton.BackgroundImage != null) { // fill in the background image Rectangle fillRect = (splitButton.Selected) ? splitButton.ContentRectangle : bounds; if (splitButton.BackgroundImage != null) { ControlPaint.DrawBackgroundImage(g, splitButton.BackgroundImage, splitButton.BackColor, splitButton.BackgroundImageLayout, bounds, fillRect); } } else { FillBackground(g, splitButtonButtonRect, splitButton.BackColor); } ToolBarState state = GetSplitButtonToolBarState(splitButton, false); RenderSmall3DBorderInternal(g, splitButtonButtonRect, state, rightToLeft); // draw the split button drop down Rectangle dropDownRect = splitButton.DropDownButtonBounds; // fill the color in the dropdown button if (splitButton.BackgroundImage == null) { FillBackground(g, dropDownRect, splitButton.BackColor); } state = GetSplitButtonToolBarState(splitButton, true); if ((state == ToolBarState.Pressed) || (state == ToolBarState.Hot)) { RenderSmall3DBorderInternal(g, dropDownRect, state, rightToLeft); } DrawArrow(new ToolStripArrowRenderEventArgs(g, splitButton, dropDownRect, arrowColor, ArrowDirection.Down)); } } /// <summary> /// This exists mainly so that buttons, labels and items, etc can share the same implementation. /// If OnRenderButton called OnRenderItem we would never be able to change the implementation /// as it would be a breaking change. If in v1, the user overrode OnRenderItem to draw green triangles /// and in v2 we decided to add a feature to button that would require us to no longer call OnRenderItem - /// the user's version of OnRenderItem would not get called when he upgraded his framework. Hence /// everyone should just call this private shared method. Users need to override each item they want /// to change the look and feel of. /// </summary> private void RenderItemInternal(ToolStripItemRenderEventArgs e) { ToolStripItem item = e.Item; Graphics g = e.Graphics; ToolBarState state = GetToolBarState(item); VisualStyleElement toolBarElement = VisualStyleElement.ToolBar.Button.Normal; if (ToolStripManager.VisualStylesEnabled && (VisualStyleRenderer.IsElementDefined(toolBarElement))) { VisualStyleRenderer vsRenderer = VisualStyleRenderer; vsRenderer.SetParameters(toolBarElement.ClassName, toolBarElement.Part, (int)state); vsRenderer.DrawBackground(g, new Rectangle(Point.Empty, item.Size)); } else { RenderSmall3DBorderInternal(g, new Rectangle(Point.Empty, item.Size), state, (item.RightToLeft == RightToLeft.Yes)); } Rectangle fillRect = item.ContentRectangle; if (item.BackgroundImage != null) { ControlPaint.DrawBackgroundImage(g, item.BackgroundImage, item.BackColor, item.BackgroundImageLayout, fillRect, fillRect); } else { ToolStrip parent = item.GetCurrentParent(); if ((parent != null) && (state != ToolBarState.Checked) && (item.BackColor != parent.BackColor)) { FillBackground(g, fillRect, item.BackColor); } } } /// <summary> /// </summary> private void RenderSeparatorInternal(Graphics g, ToolStripItem item, Rectangle bounds, bool vertical) { VisualStyleElement separator = (vertical) ? VisualStyleElement.ToolBar.SeparatorHorizontal.Normal : VisualStyleElement.ToolBar.SeparatorVertical.Normal; if (ToolStripManager.VisualStylesEnabled && (VisualStyleRenderer.IsElementDefined(separator))) { VisualStyleRenderer vsRenderer = VisualStyleRenderer; vsRenderer.SetParameters(separator.ClassName, separator.Part, GetItemState(item)); vsRenderer.DrawBackground(g, bounds); } else { Color foreColor = item.ForeColor; Color backColor = item.BackColor; Pen foreColorPen = SystemPens.ControlDark; bool disposeForeColorPen = GetPen(foreColor, ref foreColorPen); try { if (vertical) { if (bounds.Height >= 4) { bounds.Inflate(0, -2); // scoot down 2PX and start drawing } bool rightToLeft = (item.RightToLeft == RightToLeft.Yes); Pen leftPen = (rightToLeft) ? SystemPens.ButtonHighlight : foreColorPen; Pen rightPen = (rightToLeft) ? foreColorPen : SystemPens.ButtonHighlight; // Draw dark line int startX = bounds.Width / 2; g.DrawLine(leftPen, startX, bounds.Top, startX, bounds.Bottom); // Draw highlight one pixel to the right startX++; g.DrawLine(rightPen, startX, bounds.Top, startX, bounds.Bottom); } else { // // horizontal separator if (bounds.Width >= 4) { bounds.Inflate(-2, 0); // scoot over 2PX and start drawing } // Draw dark line int startY = bounds.Height / 2; g.DrawLine(foreColorPen, bounds.Left, startY, bounds.Right, startY); // Draw highlight one pixel to the right startY++; g.DrawLine(SystemPens.ButtonHighlight, bounds.Left, startY, bounds.Right, startY); } } finally { if (disposeForeColorPen && foreColorPen != null) { foreColorPen.Dispose(); } } } } private void RenderSmall3DBorderInternal(Graphics g, Rectangle bounds, ToolBarState state, bool rightToLeft) { if ((state == ToolBarState.Hot) || (state == ToolBarState.Pressed) || (state == ToolBarState.Checked)) { Pen leftPen, topPen, rightPen, bottomPen; topPen = (state == ToolBarState.Hot) ? SystemPens.ButtonHighlight : SystemPens.ButtonShadow; bottomPen = (state == ToolBarState.Hot) ? SystemPens.ButtonShadow : SystemPens.ButtonHighlight; leftPen = (rightToLeft) ? bottomPen : topPen; rightPen = (rightToLeft) ? topPen : bottomPen; g.DrawLine(topPen, bounds.Left, bounds.Top, bounds.Right - 1, bounds.Top); g.DrawLine(leftPen, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 1); g.DrawLine(rightPen, bounds.Right - 1, bounds.Top, bounds.Right - 1, bounds.Bottom - 1); g.DrawLine(bottomPen, bounds.Left, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1); } } private void RenderStatusStripBorder(ToolStripRenderEventArgs e) { if (!Application.RenderWithVisualStyles) { e.Graphics.DrawLine(SystemPens.ButtonHighlight, 0, 0, e.ToolStrip.Width, 0); } } private static void RenderStatusStripBackground(ToolStripRenderEventArgs e) { if (Application.RenderWithVisualStyles) { VisualStyleRenderer vsRenderer = VisualStyleRenderer; vsRenderer.SetParameters(VisualStyleElement.Status.Bar.Normal); vsRenderer.DrawBackground(e.Graphics, new Rectangle(0, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1)); } else { if (!SystemInformation.InLockedTerminalSession()) { e.Graphics.Clear(e.BackColor); } } } private static void RenderLabelInternal(ToolStripItemRenderEventArgs e) { // dont call RenderItemInternal, as we NEVER want to paint hot. ToolStripItem item = e.Item; Graphics g = e.Graphics; Rectangle fillRect = item.ContentRectangle; if (item.BackgroundImage != null) { ControlPaint.DrawBackgroundImage(g, item.BackgroundImage, item.BackColor, item.BackgroundImageLayout, fillRect, fillRect); } else { VisualStyleRenderer vsRenderer = VisualStyleRenderer; if (vsRenderer == null || (item.BackColor != SystemColors.Control)) { FillBackground(g, fillRect, item.BackColor); } } } } }
40.109507
175
0.534277
[ "MIT" ]
Bhaskers-Blu-Org2/winforms
src/System.Windows.Forms/src/System/Windows/Forms/ToolStripSystemRenderer.cs
33,333
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Utilities; namespace Microsoft.EntityFrameworkCore.Metadata.Internal { /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public class Key : ConventionAnnotatable, IMutableKey, IConventionKey { private ConfigurationSource _configurationSource; // Warning: Never access these fields directly as access needs to be thread-safe private Func<bool, IIdentityMap> _identityMapFactory; private object _principalKeyValueFactory; /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public Key([NotNull] IReadOnlyList<Property> properties, ConfigurationSource configurationSource) { Check.NotEmpty(properties, nameof(properties)); Check.HasNoNulls(properties, nameof(properties)); Properties = properties; _configurationSource = configurationSource; Builder = new InternalKeyBuilder(this, DeclaringEntityType.Model.Builder); } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual IReadOnlyList<Property> Properties { [DebuggerStepThrough] get; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual EntityType DeclaringEntityType { [DebuggerStepThrough] get => Properties[0].DeclaringEntityType; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual InternalKeyBuilder Builder { [DebuggerStepThrough] get; [DebuggerStepThrough] [param: CanBeNull] set; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> [DebuggerStepThrough] public virtual ConfigurationSource GetConfigurationSource() => _configurationSource; /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual void UpdateConfigurationSource(ConfigurationSource configurationSource) { _configurationSource = configurationSource.Max(_configurationSource); foreach (var property in Properties) { property.UpdateConfigurationSource(configurationSource); } } /// <summary> /// Runs the conventions when an annotation was set or removed. /// </summary> /// <param name="name"> The key of the set annotation. </param> /// <param name="annotation"> The annotation set. </param> /// <param name="oldAnnotation"> The old annotation. </param> /// <returns> The annotation that was set. </returns> protected override IConventionAnnotation OnAnnotationSet( string name, IConventionAnnotation annotation, IConventionAnnotation oldAnnotation) => Builder.ModelBuilder.Metadata.ConventionDispatcher.OnKeyAnnotationChanged(Builder, name, annotation, oldAnnotation); /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual IEnumerable<ForeignKey> GetReferencingForeignKeys() => ReferencingForeignKeys ?? Enumerable.Empty<ForeignKey>(); /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual Func<bool, IIdentityMap> IdentityMapFactory => NonCapturingLazyInitializer.EnsureInitialized( ref _identityMapFactory, this, k => new IdentityMapFactoryFactory().Create(k)); /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual IPrincipalKeyValueFactory<TKey> GetPrincipalKeyValueFactory<TKey>() => (IPrincipalKeyValueFactory<TKey>)NonCapturingLazyInitializer.EnsureInitialized( ref _principalKeyValueFactory, this, k => new KeyValueFactoryFactory().Create<TKey>(k)); /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual ISet<ForeignKey> ReferencingForeignKeys { get; [param: CanBeNull] set; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public override string ToString() => this.ToDebugString(MetadataDebugStringOptions.SingleLineDefault); /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual DebugView DebugView => new DebugView( () => this.ToDebugString(MetadataDebugStringOptions.ShortDefault), () => this.ToDebugString(MetadataDebugStringOptions.LongDefault)); /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> IReadOnlyList<IProperty> IKey.Properties { [DebuggerStepThrough] get => Properties; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> IEntityType IKey.DeclaringEntityType { [DebuggerStepThrough] get => DeclaringEntityType; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> IReadOnlyList<IMutableProperty> IMutableKey.Properties { [DebuggerStepThrough] get => Properties; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> IMutableEntityType IMutableKey.DeclaringEntityType { [DebuggerStepThrough] get => DeclaringEntityType; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> IConventionKeyBuilder IConventionKey.Builder { [DebuggerStepThrough] get => Builder; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> IConventionAnnotatableBuilder IConventionAnnotatable.Builder { [DebuggerStepThrough] get => Builder; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> IReadOnlyList<IConventionProperty> IConventionKey.Properties { [DebuggerStepThrough] get => Properties; } /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> IConventionEntityType IConventionKey.DeclaringEntityType { [DebuggerStepThrough] get => DeclaringEntityType; } } }
59.353612
131
0.6754
[ "Apache-2.0" ]
SashaBeluj/efcore
src/EFCore/Metadata/Internal/Key.cs
15,610
C#
using Emf.Core; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Text; namespace Emf.Data { public class EmfDbContext : DbContext { public DbSet<Department> Departments { get; set; } public DbSet<Employee> Employees { get; set; } public EmfDbContext(DbContextOptions<EmfDbContext> options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Department>().HasData( new Department { Id = 1, Name = "IT Web Internal", Description = "Internal Web App Division", DepartmentType = DepartmentType.IT }, new Department { Id = 2, Name = "Sitecore Web Dev", Description = "Sitecore Web Development Division", DepartmentType = DepartmentType.IT }, new Department { Id = 3, Name = "News", Description = "News division", DepartmentType = DepartmentType.Business } ); modelBuilder.Entity<Employee>().HasData( new Employee {Id = 1, FirstName = "Mateo", LastName = "Alcala", Address1 = "1000 Main Street", Address2 = "", City = "Lincoln", State = "CA", Zipcode = "95648", DepartmentId = 1, Email = "mattalcala@gmail.com", Phone = "1234567890", }, new Employee {Id = 2, FirstName = "Johnny", LastName = "Cash", Address1 = "1000 Blues St", Address2 = "", City = "Folsom", State = "CA", Zipcode = "95887", DepartmentId = 2, Email = "jc@gmail.com", Phone = "1234567890" }, new Employee {Id = 3, FirstName = "George", LastName = "Lucas", Address1 = "1000 Blues St", Address2 = "", City = "Folsom", State = "CA", Zipcode = "95887", DepartmentId = 2, Email = "jc@gmail.com", Phone = "1234567890" }, new Employee { Id = 4, FirstName = "John", LastName = "Rapid", Address1 = "1000 Main Street", Address2 = "", City = "Lincoln", State = "CA", Zipcode = "95648", DepartmentId = 1, Email = "mattalcala@gmail.com", Phone = "1234567890", }, new Employee { Id = 5, FirstName = "Max", LastName = "Power", Address1 = "1000 Blues St", Address2 = "", City = "Folsom", State = "CA", Zipcode = "95887", DepartmentId = 2, Email = "jc@gmail.com", Phone = "1234567890" }, new Employee { Id = 6, FirstName = "Kid", LastName = "Man", Address1 = "1000 Blues St", Address2 = "", City = "Folsom", State = "CA", Zipcode = "95887", DepartmentId = 2, Email = "jc@gmail.com", Phone = "1234567890" }, new Employee { Id = 7, FirstName = "Bob", LastName = "Bee", Address1 = "1000 Main Street", Address2 = "", City = "Lincoln", State = "CA", Zipcode = "95648", DepartmentId = 1, Email = "mattalcala@gmail.com", Phone = "1234567890", }, new Employee { Id = 8, FirstName = "Koda", LastName = "Tuko", Address1 = "1000 Blues St", Address2 = "", City = "Folsom", State = "CA", Zipcode = "95887", DepartmentId = 2, Email = "jc@gmail.com", Phone = "1234567890" }, new Employee { Id = 9, FirstName = "Luke", LastName = "Skywalker", Address1 = "1000 Blues St", Address2 = "", City = "Folsom", State = "CA", Zipcode = "95887", DepartmentId = 2, Email = "jc@gmail.com", Phone = "1234567890" } , new Employee { Id = 10, FirstName = "Steve", LastName = "Gates", Address1 = "1000 Main Street", Address2 = "", City = "Lincoln", State = "CA", Zipcode = "95648", DepartmentId = 1, Email = "mattalcala@gmail.com", Phone = "1234567890", }, new Employee { Id = 11, FirstName = "Billy", LastName = "Jobs", Address1 = "1000 Blues St", Address2 = "", City = "Folsom", State = "CA", Zipcode = "95887", DepartmentId = 2, Email = "jc@gmail.com", Phone = "1234567890" }, new Employee { Id = 12, FirstName = "Outa", LastName = "Names", Address1 = "1000 Blues St", Address2 = "", City = "Folsom", State = "CA", Zipcode = "95887", DepartmentId = 2, Email = "jc@gmail.com", Phone = "1234567890" } ); } } }
36.020408
156
0.342351
[ "MIT" ]
matthewalcala/emf-exercise
Emf.Data/EmfDbContext.cs
7,062
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the sagemaker-a2i-runtime-2019-11-07.normal.json service model. */ using System; using Amazon.Runtime; using Amazon.Util.Internal; namespace Amazon.AugmentedAIRuntime { /// <summary> /// Configuration for accessing Amazon AugmentedAIRuntime service /// </summary> public partial class AmazonAugmentedAIRuntimeConfig : ClientConfig { private static readonly string UserAgentString = InternalSDKUtils.BuildUserAgentString("3.7.0.117"); private string _userAgent = UserAgentString; /// <summary> /// Default constructor /// </summary> public AmazonAugmentedAIRuntimeConfig() { this.AuthenticationServiceName = "sagemaker"; } /// <summary> /// The constant used to lookup in the region hash the endpoint. /// </summary> public override string RegionEndpointServiceName { get { return "a2i-runtime.sagemaker"; } } /// <summary> /// Gets the ServiceVersion property. /// </summary> public override string ServiceVersion { get { return "2019-11-07"; } } /// <summary> /// Gets the value of UserAgent property. /// </summary> public override string UserAgent { get { return _userAgent; } } } }
26.825
119
0.596925
[ "Apache-2.0" ]
raz2017/aws-sdk-net
sdk/src/Services/AugmentedAIRuntime/Generated/AmazonAugmentedAIRuntimeConfig.cs
2,146
C#
//------------------------------------------------------------------------------ // <license file="InterpretedFunction.cs"> // // The use and distribution terms for this software are contained in the file // named 'LICENSE', which can be found in the resources directory of this // distribution. // // By using this software in any fashion, you are agreeing to be bound by the // terms of this license. // // </license> //------------------------------------------------------------------------------ using System; using EcmaScript.NET.Debugging; using EcmaScript.NET.Types; namespace EcmaScript.NET { sealed class InterpretedFunction : BuiltinFunction, IScript { override public string FunctionName { get { return (idata.itsName == null) ? "" : idata.itsName; } } override public string EncodedSource { get { return Interpreter.GetEncodedSource (idata); } } override public DebuggableScript DebuggableView { get { return idata; } } override protected internal Context.Versions LanguageVersion { get { return idata.languageVersion; } } override protected internal int ParamCount { get { return idata.argCount; } } override protected internal int ParamAndVarCount { get { return idata.argNames.Length; } } internal InterpreterData idata; internal SecurityController securityController; internal object securityDomain; internal IScriptable [] functionRegExps; private InterpretedFunction (InterpreterData idata, object staticSecurityDomain) { this.idata = idata; // Always get Context from the current thread to // avoid security breaches via passing mangled Context instances // with bogus SecurityController Context cx = Context.CurrentContext; SecurityController sc = cx.SecurityController; object dynamicDomain; if (sc != null) { dynamicDomain = sc.getDynamicSecurityDomain (staticSecurityDomain); } else { if (staticSecurityDomain != null) { throw new ArgumentException (); } dynamicDomain = null; } this.securityController = sc; this.securityDomain = dynamicDomain; } private InterpretedFunction (InterpretedFunction parent, int index) { this.idata = parent.idata.itsNestedFunctions [index]; this.securityController = parent.securityController; this.securityDomain = parent.securityDomain; } /// <summary> Create script from compiled bytecode.</summary> internal static InterpretedFunction createScript (InterpreterData idata, object staticSecurityDomain) { InterpretedFunction f; f = new InterpretedFunction (idata, staticSecurityDomain); return f; } /// <summary> Create function compiled from Function(...) constructor.</summary> internal static InterpretedFunction createFunction (Context cx, IScriptable scope, InterpreterData idata, object staticSecurityDomain) { InterpretedFunction f; f = new InterpretedFunction (idata, staticSecurityDomain); f.initInterpretedFunction (cx, scope); return f; } /// <summary> Create function embedded in script or another function.</summary> internal static InterpretedFunction createFunction (Context cx, IScriptable scope, InterpretedFunction parent, int index) { InterpretedFunction f = new InterpretedFunction (parent, index); f.initInterpretedFunction (cx, scope); return f; } internal IScriptable [] createRegExpWraps (Context cx, IScriptable scope) { if (idata.itsRegExpLiterals == null) Context.CodeBug (); RegExpProxy rep = cx.RegExpProxy; int N = idata.itsRegExpLiterals.Length; IScriptable [] array = new IScriptable [N]; for (int i = 0; i != N; ++i) { array [i] = rep.Wrap (cx, scope, idata.itsRegExpLiterals [i]); } return array; } private void initInterpretedFunction (Context cx, IScriptable scope) { initScriptFunction (cx, scope); if (idata.itsRegExpLiterals != null) { functionRegExps = createRegExpWraps (cx, scope); } } public override object Call (Context cx, IScriptable scope, IScriptable thisObj, object [] args) { if (!ScriptRuntime.hasTopCall (cx)) { return ScriptRuntime.DoTopCall (this, cx, scope, thisObj, args); } return Interpreter.Interpret (this, cx, scope, thisObj, args); } public object Exec (Context cx, IScriptable scope) { if (idata.itsFunctionType != 0) { // Can only be applied to scripts throw new ApplicationException (); } if (!ScriptRuntime.hasTopCall (cx)) { // It will go through "call" path. but they are equivalent return ScriptRuntime.DoTopCall (this, cx, scope, scope, ScriptRuntime.EmptyArgs); } return Interpreter.Interpret (this, cx, scope, scope, ScriptRuntime.EmptyArgs); } protected internal override string getParamOrVarName (int index) { return idata.argNames [index]; } } }
33.88172
143
0.534116
[ "MIT" ]
jongha/winuglifier
src/WinUglifier.Plugin.YUI.css/EcmaScript.NET/InterpretedFunction.cs
6,302
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics; using System.Xml.XPath; namespace System.Xml { // Represents the text content of an element or attribute. public class XmlSignificantWhitespace : XmlCharacterData { protected internal XmlSignificantWhitespace(string strData, XmlDocument doc) : base(strData, doc) { if (!doc.IsLoading && !base.CheckOnData(strData)) throw new ArgumentException(SR.Xdom_WS_Char); } // Gets the name of the node. public override string Name { get { return OwnerDocument.strSignificantWhitespaceName; } } // Gets the name of the current node without the namespace prefix. public override string LocalName { get { return OwnerDocument.strSignificantWhitespaceName; } } // Gets the type of the current node. public override XmlNodeType NodeType { get { return XmlNodeType.SignificantWhitespace; } } public override XmlNode ParentNode { get { switch (parentNode.NodeType) { case XmlNodeType.Document: return base.ParentNode; case XmlNodeType.Text: case XmlNodeType.CDATA: case XmlNodeType.Whitespace: case XmlNodeType.SignificantWhitespace: XmlNode parent = parentNode.parentNode; while (parent.IsText) { parent = parent.parentNode; } return parent; default: return parentNode; } } } // Creates a duplicate of this node. public override XmlNode CloneNode(bool deep) { Debug.Assert(OwnerDocument != null); return OwnerDocument.CreateSignificantWhitespace(Data); } public override string Value { get { return Data; } set { if (CheckOnData(value)) Data = value; else throw new ArgumentException(SR.Xdom_WS_Char); } } // Saves the node to the specified XmlWriter. public override void WriteTo(XmlWriter w) { w.WriteString(Data); } // Saves all the children of the node to the specified XmlWriter. public override void WriteContentTo(XmlWriter w) { // Intentionally do nothing } internal override XPathNodeType XPNodeType { get { XPathNodeType xnt = XPathNodeType.SignificantWhitespace; DecideXPNodeTypeForTextNodes(this, ref xnt); return xnt; } } internal override bool IsText { get { return true; } } public override XmlNode PreviousText { get { if (parentNode.IsText) { return parentNode; } return null; } } } }
27.419118
105
0.486994
[ "MIT" ]
06needhamt/runtime
src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlSignificantWhiteSpace.cs
3,729
C#
using FDK; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; namespace TJAPlayer3 { class TextureLoader { public const string BASE = @"Graphics\"; const string GLOBAL = @"Global\"; // Global assets const string PUCHICHARA = @"PuchiChara\"; const string CHARACTERS = @"Characters\"; // Stage const string TITLE = @"1_Title\"; const string CONFIG = @"2_Config\"; const string SONGSELECT = @"3_SongSelect\"; const string DANISELECT = @"3_DaniSelect\"; const string SONGLOADING = @"4_SongLoading\"; public const string GAME = @"5_Game\"; const string RESULT = @"6_Result\"; const string EXIT = @"7_Exit\"; const string DANRESULT = @"7_DanResult\"; const string TOWERRESULT = @"8_TowerResult\"; const string HEYA = @"10_Heya\"; const string MODALS = @"11_Modals\"; const string ONLINELOUNGE = @"12_OnlineLounge\"; const string TOWERSELECT = @"13_TowerSelect\"; // InGame const string DANCER = @"2_Dancer\"; const string MOB = @"3_Mob\"; const string COURSESYMBOL = @"4_CourseSymbol\"; public const string BACKGROUND = @"5_Background\"; const string TAIKO = @"6_Taiko\"; const string GAUGE = @"7_Gauge\"; public const string FOOTER = @"8_Footer\"; const string END = @"9_End\"; const string EFFECTS = @"10_Effects\"; const string BALLOON = @"11_Balloon\"; const string LANE = @"12_Lane\"; const string GENRE = @"13_Genre\"; const string GAMEMODE = @"14_GameMode\"; const string FAILED = @"15_Failed\"; const string RUNNER = @"16_Runner\"; const string TRAINING = @"19_Training\"; const string DANC = @"17_DanC\"; const string TOWER = @"20_Tower\"; const string MODICONS = @"21_ModIcons\"; // Tower infos const string TOWERDON = @"Tower_Don\"; const string TOWERFLOOR = @"Tower_Floors\"; // InGame_Effects const string FIRE = @"Fire\"; const string HIT = @"Hit\"; const string ROLL = @"Roll\"; const string SPLASH = @"Splash\"; public TextureLoader() { // コンストラクタ } internal CTexture TxC(string FileName) { var tex = TJAPlayer3.tテクスチャの生成(CSkin.Path(BASE + FileName)); listTexture.Add(tex); return tex; } internal CTexture TxCGlobal(string FileName) { var tex = TJAPlayer3.tテクスチャの生成(TJAPlayer3.strEXEのあるフォルダ + GLOBAL + FileName); listTexture.Add(tex); return tex; } internal CTexture TxCAbsolute(string FileName) { var tex = TJAPlayer3.tテクスチャの生成(FileName); listTexture.Add(tex); return tex; } internal CTextureAf TxCAf(string FileName) { var tex = TJAPlayer3.tテクスチャの生成Af(CSkin.Path(BASE + FileName)); listTexture.Add(tex); return tex; } internal CTexture TxCGen(string FileName) { return TJAPlayer3.tテクスチャの生成(CSkin.Path(BASE + GAME + GENRE + FileName + ".png")); } public void LoadTexture() { #region 共通 Tile_Black = TxC(@"Tile_Black.png"); Menu_Title = TxC(@"Menu_Title.png"); Menu_Highlight = TxC(@"Menu_Highlight.png"); Enum_Song = TxC(@"Enum_Song.png"); Scanning_Loudness = TxC(@"Scanning_Loudness.png"); Overlay = TxC(@"Overlay.png"); Network_Connection = TxC(@"Network_Connection.png"); Readme = TxC(@"Readme.png"); NamePlate = new CTexture[2]; NamePlateBase = TxC(@"NamePlate.png"); NamePlate[0] = TxC(@"1P_NamePlate.png"); NamePlate[1] = TxC(@"2P_NamePlate.png"); NamePlate_Effect[0] = TxC(@"9_NamePlateEffect\GoldMStar.png"); NamePlate_Effect[1] = TxC(@"9_NamePlateEffect\PurpleMStar.png"); NamePlate_Effect[2] = TxC(@"9_NamePlateEffect\GoldBStar.png"); NamePlate_Effect[3] = TxC(@"9_NamePlateEffect\PurpleBStar.png"); NamePlate_Effect[4] = TxC(@"9_NamePlateEffect\Slash.png"); TJAPlayer3.Skin.Config_NamePlate_Ptn_Title = System.IO.Directory.GetDirectories(CSkin.Path(BASE + @"9_NamePlateEffect\Title\")).Length; TJAPlayer3.Skin.Config_NamePlate_Ptn_Title_Boxes = new int[TJAPlayer3.Skin.Config_NamePlate_Ptn_Title]; NamePlate_Title = new CTexture[TJAPlayer3.Skin.Config_NamePlate_Ptn_Title][]; NamePlate_Title_Big = new CTexture[TJAPlayer3.Skin.Config_NamePlate_Ptn_Title]; NamePlate_Title_Small = new CTexture[TJAPlayer3.Skin.Config_NamePlate_Ptn_Title]; for (int i = 0; i < TJAPlayer3.Skin.Config_NamePlate_Ptn_Title; i++) { TJAPlayer3.Skin.Config_NamePlate_Ptn_Title_Boxes[i] = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + @"9_NamePlateEffect\Title\" + i.ToString() + @"\")); NamePlate_Title[i] = new CTexture[TJAPlayer3.Skin.Config_NamePlate_Ptn_Title_Boxes[i]]; for (int j = 0; j < TJAPlayer3.Skin.Config_NamePlate_Ptn_Title_Boxes[i]; j++) { NamePlate_Title[i][j] = TxC(@"9_NamePlateEffect\Title\" + i.ToString() + @"\" + j.ToString() + @".png"); } NamePlate_Title_Big[i] = TxC(@"9_NamePlateEffect\Title\" + i.ToString() + @"\Big.png"); NamePlate_Title_Small[i] = TxC(@"9_NamePlateEffect\Title\" + i.ToString() + @"\Small.png"); } #endregion #region 1_タイトル画面 Title_Background = TxC(TITLE + @"Background.png"); Entry_Bar = TxC(TITLE + @"Entry_Bar.png"); Entry_Bar_Text = TxC(TITLE + @"Entry_Bar_Text.png"); Banapas_Load[0] = TxC(TITLE + @"Banapas_Load.png"); Banapas_Load[1] = TxC(TITLE + @"Banapas_Load_Text.png"); Banapas_Load[2] = TxC(TITLE + @"Banapas_Load_Anime.png"); Banapas_Load_Clear[0] = TxC(TITLE + @"Banapas_Load_Clear.png"); Banapas_Load_Clear[1] = TxC(TITLE + @"Banapas_Load_Clear_Anime.png"); Banapas_Load_Failure[0] = TxC(TITLE + @"Banapas_Load_Failure.png"); Banapas_Load_Failure[1] = TxC(TITLE + @"Banapas_Load_Clear_Anime.png"); Entry_Player[0] = TxC(TITLE + @"Entry_Player.png"); Entry_Player[1] = TxC(TITLE + @"Entry_Player_Select_Bar.png"); Entry_Player[2] = TxC(TITLE + @"Entry_Player_Select.png"); ModeSelect_Bar = new CTexture[CMainMenuTab.__MenuCount + 1]; ModeSelect_Bar_Chara = new CTexture[CMainMenuTab.__MenuCount]; for (int i = 0; i < CMainMenuTab.__MenuCount; i++) { ModeSelect_Bar[i] = TxC(TITLE + @"ModeSelect_Bar_" + i.ToString() + ".png"); } for(int i = 0; i < CMainMenuTab.__MenuCount; i++) { ModeSelect_Bar_Chara[i] = TxC(TITLE + @"ModeSelect_Bar_Chara_" + i.ToString() + ".png"); } ModeSelect_Bar[CMainMenuTab.__MenuCount] = TxC(TITLE + @"ModeSelect_Bar_Overlay.png"); #endregion #region 2_コンフィグ画面 Config_Background = TxC(CONFIG + @"Background.png"); Config_Header = TxC(CONFIG + @"Header.png"); Config_Cursor = TxC(CONFIG + @"Cursor.png"); Config_ItemBox = TxC(CONFIG + @"ItemBox.png"); Config_Arrow = TxC(CONFIG + @"Arrow.png"); Config_KeyAssign = TxC(CONFIG + @"KeyAssign.png"); Config_Font = TxC(CONFIG + @"Font.png"); Config_Font_Bold = TxC(CONFIG + @"Font_Bold.png"); Config_Enum_Song = TxC(CONFIG + @"Enum_Song.png"); #endregion #region 3_選曲画面 SongSelect_Background = TxC(SONGSELECT + @"Background.png"); SongSelect_Header = TxC(SONGSELECT + @"Header.png"); SongSelect_Coin_Slot = TxC(SONGSELECT + @"Coin_Slot.png"); SongSelect_Auto = TxC(SONGSELECT + @"Auto.png"); SongSelect_Level = TxC(SONGSELECT + @"Level.png"); SongSelect_Branch = TxC(SONGSELECT + @"Branch.png"); SongSelect_Branch_Text = TxC(SONGSELECT + @"Branch_Text.png"); SongSelect_Bar_Center = TxC(SONGSELECT + @"Bar_Center.png"); SongSelect_Frame_Score[0] = TxC(SONGSELECT + @"Frame_Score.png"); SongSelect_Frame_Score[1] = TxC(SONGSELECT + @"Frame_Score_Tower.png"); SongSelect_Frame_Box = TxC(SONGSELECT + @"Frame_Box.png"); SongSelect_Frame_BackBox = TxC(SONGSELECT + @"Frame_BackBox.png"); SongSelect_Frame_Random = TxC(SONGSELECT + @"Frame_Random.png"); SongSelect_Bar_Genre_Back = TxC(SONGSELECT + @"Bar_Genre_Back.png"); SongSelect_Bar_Genre_Random = TxC(SONGSELECT + @"Bar_Genre_Random.png"); SongSelect_Bar_Genre_RecentryPlaySong = TxC(SONGSELECT + @"Bar_Genre_RecentryPlaySong.png"); SongSelect_Bar_Select = TxC(SONGSELECT + @"Bar_Select.png"); SongSelect_Level_Number = TxC(SONGSELECT + @"Level_Number.png"); SongSelect_Credit = TxC(SONGSELECT + @"Credit.png"); SongSelect_Timer = TxC(SONGSELECT + @"Timer.png"); SongSelect_Song_Number = TxC(SONGSELECT + @"Song_Number.png"); SongSelect_Bar_Genre_Overlay = TxC(SONGSELECT + @"Bar_Genre_Overlay.png"); SongSelect_Crown = TxC(SONGSELECT + @"SongSelect_Crown.png"); SongSelect_ScoreRank = TxC(SONGSELECT + @"ScoreRank.png"); SongSelect_BoardNumber = TxC(SONGSELECT + @"BoardNumber.png"); SongSelect_Favorite = TxC(SONGSELECT + @"Favorite.png"); SongSelect_High_Score = TxC(SONGSELECT + @"High_Score.png"); SongSelect_Level_Icons = TxC(SONGSELECT + @"Level_Icons.png"); SongSelect_Search_Arrow = TxC(SONGSELECT + @"Search\Search_Arrow.png"); SongSelect_Search_Arrow_Glow = TxC(SONGSELECT + @"Search\Search_Arrow_Glow.png"); SongSelect_Search_Window = TxC(SONGSELECT + @"Search\Search_Window.png"); for (int i = 0; i < (int)Difficulty.Total; i++) { SongSelect_ScoreWindow[i] = TxC(SONGSELECT + @"ScoreWindow_" + i.ToString() + ".png"); } SongSelect_ScoreWindow_Text = TxC(SONGSELECT + @"ScoreWindow_Text.png"); TJAPlayer3.Skin.SongSelect_Bar_Genre_Count = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + SONGSELECT + @"Bar_Genre\"), "Bar_Genre_"); if (TJAPlayer3.Skin.SongSelect_Bar_Genre_Count != 0) { SongSelect_Bar_Genre = new CTexture[TJAPlayer3.Skin.SongSelect_Bar_Genre_Count]; for (int i = 0; i < SongSelect_Bar_Genre.Length; i++) { SongSelect_Bar_Genre[i] = TxC(SONGSELECT + @"Bar_Genre\Bar_Genre_" + i.ToString() + ".png"); } } TJAPlayer3.Skin.SongSelect_Genre_Background_Count = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + SONGSELECT + @"Genre_Background\"), "GenreBackground_"); if (TJAPlayer3.Skin.SongSelect_Genre_Background_Count != 0) { SongSelect_GenreBack = new CTexture[TJAPlayer3.Skin.SongSelect_Genre_Background_Count]; for (int i = 0; i < SongSelect_GenreBack.Length; i++) { SongSelect_GenreBack[i] = TxC(SONGSELECT + @"Genre_Background\GenreBackground_" + i.ToString() + ".png"); } } TJAPlayer3.Skin.SongSelect_Box_Chara_Count = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + SONGSELECT + @"Box_Chara\"), "Box_Chara_"); if (TJAPlayer3.Skin.SongSelect_Box_Chara_Count != 0) { SongSelect_Box_Chara = new CTexture[TJAPlayer3.Skin.SongSelect_Box_Chara_Count]; for (int i = 0; i < SongSelect_Box_Chara.Length; i++) { SongSelect_Box_Chara[i] = TxC(SONGSELECT + @"Box_Chara\Box_Chara_" + i.ToString() + ".png"); } } for (int i = 0; i < SongSelect_Table.Length; i++) { SongSelect_Table[i] = TxC(SONGSELECT + @"Table\" + i.ToString() + ".png"); } #region [ 難易度選択画面 ] Difficulty_Bar = TxC(SONGSELECT + @"Difficulty_Select\Difficulty_Bar.png"); Difficulty_Number = TxC(SONGSELECT + @"Difficulty_Select\Difficulty_Number.png"); Difficulty_Star = TxC(SONGSELECT + @"Difficulty_Select\Difficulty_Star.png"); Difficulty_Crown = TxC(SONGSELECT + @"Difficulty_Select\Difficulty_Crown.png"); Difficulty_Option = TxC($"{SONGSELECT}Difficulty_Select/Difficulty_Option.png"); Difficulty_Option_Select = TxC($"{SONGSELECT}Difficulty_Select/Difficulty_Option_Select.png"); Difficulty_Select_Bar[0] = TxC(SONGSELECT + @"Difficulty_Select\Difficulty_Select_Bar.png"); Difficulty_Select_Bar[1] = TxC(SONGSELECT + @"Difficulty_Select\Difficulty_Select_Bar2.png"); TJAPlayer3.Skin.SongSelect_Difficulty_Background_Count = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + SONGSELECT + @"Difficulty_Select\Difficulty_Back\"), "Difficulty_Back_"); if (TJAPlayer3.Skin.SongSelect_Difficulty_Background_Count != 0) { Difficulty_Back = new CTexture[TJAPlayer3.Skin.SongSelect_Difficulty_Background_Count]; for (int i = 0; i < Difficulty_Back.Length; i++) { Difficulty_Back[i] = TxC(SONGSELECT + @"Difficulty_Select\Difficulty_Back\Difficulty_Back_" + i.ToString() + ".png"); } } #endregion #endregion #region 3_段位選択画面 Dani_Background = TxC(DANISELECT + "Background.png"); Dani_Difficulty_Cymbol = TxC(DANISELECT + "Difficulty_Cymbol.png"); Dani_Level_Number = TxC(DANISELECT + "Level_Number.png"); Dani_Soul_Number = TxC(DANISELECT + "SoulNumber.png"); Dani_Exam_Number = TxC(DANISELECT + "ExamNumber.png"); Dani_Bar_Center = TxC(DANISELECT + "Bar_Center.png"); Dani_Plate = TxC(DANISELECT + "Plate.png"); for (int i = 0; i < Challenge_Select.Length; i++) Challenge_Select[i] = TxC(DANISELECT + "Challenge_Select_" + i.ToString() + ".png"); Dani_Dan_In = TxC(DANISELECT + "Dan_In.png"); Dani_Dan_Text = TxC(DANISELECT + "Dan_Text.png"); Dani_DanPlates = TxC(DANISELECT + "DanPlates.png"); Dani_DanSides = TxC(DANISELECT + "DanSides.png"); for (int i = 0; i < Dani_Bloc.Length; i++) Dani_Bloc[i] = TxC(DANISELECT + "Bloc" + i.ToString() + ".png"); #endregion #region 4_読み込み画面 SongLoading_Plate = TxC(SONGLOADING + @"Plate.png"); SongLoading_Bg = TxC(SONGLOADING + @"Bg.png"); SongLoading_BgWait = TxC(SONGLOADING + @"Bg_Wait.png"); SongLoading_Chara = TxC(SONGLOADING + @"Chara.png"); SongLoading_Fade = TxC(SONGLOADING + @"Fade.png"); SongLoading_Bg_Dan = TxC(SONGLOADING + @"Bg_Dan.png"); #endregion #region 5_演奏画面 #region General Notes = new CTexture[2]; Notes[0] = TxC(GAME + @"Notes.png"); Notes[1] = TxC(GAME + @"Notes_Konga.png"); Note_Mine = TxC(GAME + @"Mine.png"); Note_Swap = TxC(GAME + @"Swap.png"); Judge_Frame = TxC(GAME + @"Notes.png"); SENotes = new CTexture[2]; SENotes[0] = TxC(GAME + @"SENotes.png"); SENotes[1] = TxC(GAME + @"SENotes_Konga.png"); SENotesExtension = TxC(GAME + @"SENotes_Extension.png"); Notes_Arm = TxC(GAME + @"Notes_Arm.png"); Judge = TxC(GAME + @"Judge.png"); ChipEffect = TxC(GAME + @"ChipEffect.png"); ScoreRank = TxC(GAME + @"ScoreRank.png"); Judge_Meter = TxC(GAME + @"Judge_Meter.png"); Bar = TxC(GAME + @"Bar.png"); Bar_Branch = TxC(GAME + @"Bar_Branch.png"); #endregion #region Dancer TJAPlayer3.Skin.Game_Dancer_Ptn = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + DANCER + @"1\")); if (TJAPlayer3.Skin.Game_Dancer_Ptn != 0) { Dancer = new CTexture[5][]; for (int i = 0; i < 5; i++) { Dancer[i] = new CTexture[TJAPlayer3.Skin.Game_Dancer_Ptn]; for (int p = 0; p < TJAPlayer3.Skin.Game_Dancer_Ptn; p++) { Dancer[i][p] = TxC(GAME + DANCER + (i + 1) + @"\" + p.ToString() + ".png"); } } } #endregion #region Mob TJAPlayer3.Skin.Game_Mob_Ptn = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + MOB)); Mob = new CTexture[TJAPlayer3.Skin.Game_Mob_Ptn]; for (int i = 0; i < TJAPlayer3.Skin.Game_Mob_Ptn; i++) { Mob[i] = TxC(GAME + MOB + i.ToString() + ".png"); } #endregion #region Taiko Taiko_Background = new CTexture[11]; Taiko_Background[0] = TxC(GAME + TAIKO + @"1P_Background.png"); Taiko_Background[1] = TxC(GAME + TAIKO + @"2P_Background.png"); Taiko_Background[2] = TxC(GAME + TAIKO + @"Dan_Background.png"); Taiko_Background[3] = TxC(GAME + TAIKO + @"Tower_Background.png"); Taiko_Background[4] = TxC(GAME + TAIKO + @"1P_Background_Right.png"); Taiko_Background[5] = TxC(GAME + TAIKO + @"1P_Background_Tokkun.png"); Taiko_Background[6] = TxC(GAME + TAIKO + @"2P_Background_Tokkun.png"); Taiko_Background[7] = TxC(GAME + TAIKO + @"3P_Background.png"); Taiko_Background[8] = TxC(GAME + TAIKO + @"4P_Background.png"); Taiko_Background[9] = TxC(GAME + TAIKO + @"AI_Background.png"); Taiko_Background[10] = TxC(GAME + TAIKO + @"Boss_Background.png"); Taiko_Frame = new CTexture[4]; Taiko_Frame[0] = TxC(GAME + TAIKO + @"1P_Frame.png"); Taiko_Frame[1] = TxC(GAME + TAIKO + @"2P_Frame.png"); Taiko_Frame[2] = TxC(GAME + TAIKO + @"Tower_Frame.png"); Taiko_Frame[3] = TxC(GAME + TAIKO + @"Tokkun_Frame.png"); Taiko_PlayerNumber = new CTexture[2]; Taiko_PlayerNumber[0] = TxC(GAME + TAIKO + @"1P_PlayerNumber.png"); Taiko_PlayerNumber[1] = TxC(GAME + TAIKO + @"2P_PlayerNumber.png"); Taiko_Base = new CTexture[2]; Taiko_Base[0] = TxC(GAME + TAIKO + @"Base.png"); Taiko_Base[1] = TxC(GAME + TAIKO + @"Base_Konga.png"); Taiko_Don_Left = TxC(GAME + TAIKO + @"Don.png"); Taiko_Don_Right = TxC(GAME + TAIKO + @"Don.png"); Taiko_Ka_Left = TxC(GAME + TAIKO + @"Ka.png"); Taiko_Ka_Right = TxC(GAME + TAIKO + @"Ka.png"); Taiko_Konga_Don = TxC(GAME + TAIKO + @"Don_Konga.png"); Taiko_Konga_Ka = TxC(GAME + TAIKO + @"Ka_Konga.png"); Taiko_Konga_Clap = TxC(GAME + TAIKO + @"Clap.png"); Taiko_LevelUp = TxC(GAME + TAIKO + @"LevelUp.png"); Taiko_LevelDown = TxC(GAME + TAIKO + @"LevelDown.png"); Couse_Symbol = new CTexture[(int)Difficulty.Total + 1]; // +1は真打ちモードの分 string[] Couse_Symbols = new string[(int)Difficulty.Total + 1] { "Easy", "Normal", "Hard", "Oni", "Edit", "Tower", "Dan", "Shin" }; for (int i = 0; i < (int)Difficulty.Total + 1; i++) { Couse_Symbol[i] = TxC(GAME + COURSESYMBOL + Couse_Symbols[i] + ".png"); } Taiko_Score = new CTexture[3]; Taiko_Score[0] = TxC(GAME + TAIKO + @"Score.png"); Taiko_Score[1] = TxC(GAME + TAIKO + @"Score_1P.png"); Taiko_Score[2] = TxC(GAME + TAIKO + @"Score_2P.png"); Taiko_Combo = new CTexture[4]; Taiko_Combo[0] = TxC(GAME + TAIKO + @"Combo.png"); Taiko_Combo[1] = TxC(GAME + TAIKO + @"Combo_Big.png"); Taiko_Combo[2] = TxC(GAME + TAIKO + @"Combo_Midium.png"); Taiko_Combo[3] = TxC(GAME + TAIKO + @"Combo_Huge.png"); Taiko_Combo_Effect = TxC(GAME + TAIKO + @"Combo_Effect.png"); Taiko_Combo_Text = TxC(GAME + TAIKO + @"Combo_Text.png"); Taiko_Combo_Guide = new CTexture[3]; for (int i = 0; i < Taiko_Combo_Guide.Length; i++) { Taiko_Combo_Guide[i] = TxC(GAME + TAIKO + @"Combo_Guide" + i.ToString() + ".png"); } #endregion #region Gauge Gauge = new CTexture[3]; Gauge[0] = TxC(GAME + GAUGE + @"1P.png"); Gauge[1] = TxC(GAME + GAUGE + @"2P.png"); Gauge[2] = TxC(GAME + GAUGE + @"1P_Right.png"); Gauge_Base = new CTexture[3]; Gauge_Base[0] = TxC(GAME + GAUGE + @"1P_Base.png"); Gauge_Base[1] = TxC(GAME + GAUGE + @"2P_Base.png"); Gauge_Base[2] = TxC(GAME + GAUGE + @"1P_Base_Right.png"); Gauge_Line = new CTexture[2]; Gauge_Line[0] = TxC(GAME + GAUGE + @"1P_Line.png"); Gauge_Line[1] = TxC(GAME + GAUGE + @"2P_Line.png"); TJAPlayer3.Skin.Game_Gauge_Rainbow_Ptn = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + GAUGE + @"Rainbow\")); if (TJAPlayer3.Skin.Game_Gauge_Rainbow_Ptn != 0) { Gauge_Rainbow = new CTexture[TJAPlayer3.Skin.Game_Gauge_Rainbow_Ptn]; for (int i = 0; i < TJAPlayer3.Skin.Game_Gauge_Rainbow_Ptn; i++) { Gauge_Rainbow[i] = TxC(GAME + GAUGE + @"Rainbow\" + i.ToString() + ".png"); } } TJAPlayer3.Skin.Game_Gauge_Dan_Rainbow_Ptn = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + DANC + @"Rainbow\")); if (TJAPlayer3.Skin.Game_Gauge_Dan_Rainbow_Ptn != 0) { Gauge_Dan_Rainbow = new CTexture[TJAPlayer3.Skin.Game_Gauge_Dan_Rainbow_Ptn]; for (int i = 0; i < TJAPlayer3.Skin.Game_Gauge_Dan_Rainbow_Ptn; i++) { Gauge_Dan_Rainbow[i] = TxC(GAME + DANC + @"Rainbow\" + i.ToString() + ".png"); } } Gauge_Dan = new CTexture[6]; Gauge_Dan[0] = TxC(GAME + GAUGE + @"1P_Dan_Base.png"); Gauge_Dan[1] = TxC(GAME + GAUGE + @"1P_Dan.png"); Gauge_Dan[2] = TxC(GAME + GAUGE + @"1P_Dan_Clear_Base.png"); Gauge_Dan[3] = TxC(GAME + GAUGE + @"1P_Dan_Clear.png"); Gauge_Dan[4] = TxC(GAME + GAUGE + @"1P_Dan_Base_Right.png"); Gauge_Dan[5] = TxC(GAME + GAUGE + @"1P_Dan_Right.png"); Gauge_Soul = TxC(GAME + GAUGE + @"Soul.png"); Gauge_Flash = TxC(GAME + GAUGE + @"Flash.png"); Gauge_Soul_Fire = TxC(GAME + GAUGE + @"Fire.png"); Gauge_Soul_Explosion = new CTexture[2]; Gauge_Soul_Explosion[0] = TxC(GAME + GAUGE + @"1P_Explosion.png"); Gauge_Soul_Explosion[1] = TxC(GAME + GAUGE + @"2P_Explosion.png"); #endregion #region Balloon Balloon_Combo = new CTexture[2]; Balloon_Combo[0] = TxC(GAME + BALLOON + @"Combo_1P.png"); Balloon_Combo[1] = TxC(GAME + BALLOON + @"Combo_2P.png"); Balloon_Roll = TxC(GAME + BALLOON + @"Roll.png"); Balloon_Balloon = TxC(GAME + BALLOON + @"Balloon.png"); Balloon_Number_Roll = TxC(GAME + BALLOON + @"Number_Roll.png"); Balloon_Number_Combo = TxC(GAME + BALLOON + @"Number_Combo.png"); Balloon_Breaking = new CTexture[6]; for (int i = 0; i < 6; i++) { Balloon_Breaking[i] = TxC(GAME + BALLOON + @"Breaking_" + i.ToString() + ".png"); } #endregion #region Effects Effects_Hit_Explosion = TxCAf(GAME + EFFECTS + @"Hit\Explosion.png"); if (Effects_Hit_Explosion != null) Effects_Hit_Explosion.b加算合成 = TJAPlayer3.Skin.Game_Effect_HitExplosion_AddBlend; Effects_Hit_Explosion_Big = TxC(GAME + EFFECTS + @"Hit\Explosion_Big.png"); if (Effects_Hit_Explosion_Big != null) Effects_Hit_Explosion_Big.b加算合成 = TJAPlayer3.Skin.Game_Effect_HitExplosionBig_AddBlend; Effects_Hit_FireWorks = TxC(GAME + EFFECTS + @"Hit\FireWorks.png"); if (Effects_Hit_FireWorks != null) Effects_Hit_FireWorks.b加算合成 = TJAPlayer3.Skin.Game_Effect_FireWorks_AddBlend; Effects_Hit_Bomb = TxCAf(GAME + EFFECTS + @"Hit\Bomb.png"); Effects_Fire = TxC(GAME + EFFECTS + @"Fire.png"); if (Effects_Fire != null) Effects_Fire.b加算合成 = TJAPlayer3.Skin.Game_Effect_Fire_AddBlend; Effects_Rainbow = TxC(GAME + EFFECTS + @"Rainbow.png"); Effects_GoGoSplash = TxC(GAME + EFFECTS + @"GoGoSplash.png"); if (Effects_GoGoSplash != null) Effects_GoGoSplash.b加算合成 = TJAPlayer3.Skin.Game_Effect_GoGoSplash_AddBlend; Effects_Hit_Great = new CTexture[15]; Effects_Hit_Great_Big = new CTexture[15]; Effects_Hit_Good = new CTexture[15]; Effects_Hit_Good_Big = new CTexture[15]; for (int i = 0; i < 15; i++) { Effects_Hit_Great[i] = TxC(GAME + EFFECTS + @"Hit\" + @"Great\" + i.ToString() + ".png"); Effects_Hit_Great_Big[i] = TxC(GAME + EFFECTS + @"Hit\" + @"Great_Big\" + i.ToString() + ".png"); Effects_Hit_Good[i] = TxC(GAME + EFFECTS + @"Hit\" + @"Good\" + i.ToString() + ".png"); Effects_Hit_Good_Big[i] = TxC(GAME + EFFECTS + @"Hit\" + @"Good_Big\" + i.ToString() + ".png"); } TJAPlayer3.Skin.Game_Effect_Roll_Ptn = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + EFFECTS + @"Roll\")); Effects_Roll = new CTexture[TJAPlayer3.Skin.Game_Effect_Roll_Ptn]; for (int i = 0; i < TJAPlayer3.Skin.Game_Effect_Roll_Ptn; i++) { Effects_Roll[i] = TxC(GAME + EFFECTS + @"Roll\" + i.ToString() + ".png"); } #endregion #region Lane Lane_Base = new CTexture[3]; Lane_Text = new CTexture[3]; string[] Lanes = new string[3] { "Normal", "Expert", "Master" }; for (int i = 0; i < 3; i++) { Lane_Base[i] = TxC(GAME + LANE + "Base_" + Lanes[i] + ".png"); Lane_Text[i] = TxC(GAME + LANE + "Text_" + Lanes[i] + ".png"); } Lane_Red = new CTexture[2]; Lane_Blue = new CTexture[2]; Lane_Clap = new CTexture[2]; var _suffixes = new string[] { "", "_Konga" }; for (int i = 0; i < Lane_Red.Length; i++) { Lane_Red[i] = TxC(GAME + LANE + @"Red" + _suffixes[i] + @".png"); Lane_Blue[i] = TxC(GAME + LANE + @"Blue" + _suffixes[i] + @".png"); Lane_Clap[i] = TxC(GAME + LANE + @"Clap" + _suffixes[i] + @".png"); } Lane_Yellow = TxC(GAME + LANE + @"Yellow.png"); Lane_Background_Main = TxC(GAME + LANE + @"Background_Main.png"); Lane_Background_AI = TxC(GAME + LANE + @"Background_AI.png"); Lane_Background_Sub = TxC(GAME + LANE + @"Background_Sub.png"); Lane_Background_GoGo = TxC(GAME + LANE + @"Background_GoGo.png"); #endregion #region 終了演出 End_Clear_Chara = TxC(GAME + END + @"Clear_Chara.png"); End_Star = TxC(GAME + END + @"Star.png"); End_Clear_Text = new CTexture[2]; End_Clear_Text[0] = TxC(GAME + END + @"Clear_Text.png"); End_Clear_Text[1] = TxC(GAME + END + @"Clear_Text_End.png"); End_Clear_L = new CTexture[5]; End_Clear_R = new CTexture[5]; for (int i = 0; i < 5; i++) { End_Clear_L[i] = TxC(GAME + END + @"Clear\" + @"Clear_L_" + i.ToString() + ".png"); End_Clear_R[i] = TxC(GAME + END + @"Clear\" + @"Clear_R_" + i.ToString() + ".png"); } End_Clear_Text_ = TxC(GAME + END + @"Clear\" + @"Clear_Text.png"); End_Clear_Text_Effect = TxC(GAME + END + @"Clear\" + @"Clear_Text_Effect.png"); if (End_Clear_Text_Effect != null) End_Clear_Text_Effect.b加算合成 = true; ClearFailed = TxC(GAME + END + @"ClearFailed\" + "Clear_Failed.png"); ClearFailed1 = TxC(GAME + END + @"ClearFailed\" + "Clear_Failed1.png"); ClearFailed2 = TxC(GAME + END + @"ClearFailed\" + "Clear_Failed2.png"); End_ClearFailed = new CTexture[26]; for (int i = 0; i < 26; i++) End_ClearFailed[i] = TxC(GAME + END + @"ClearFailed\" + i.ToString() + ".png"); End_FullCombo = new CTexture[67]; for (int i = 0; i < 67; i++) End_FullCombo[i] = TxC(GAME + END + @"FullCombo\" + i.ToString() + ".png"); End_FullComboLoop = new CTexture[3]; for (int i = 0; i < 3; i++) End_FullComboLoop[i] = TxC(GAME + END + @"FullCombo\" + "loop_" + i.ToString() + ".png"); End_DondaFullComboBg = TxC(GAME + END + @"DondaFullCombo\" + "bg.png"); End_DondaFullCombo = new CTexture[62]; for (int i = 0; i < 62; i++) End_DondaFullCombo[i] = TxC(GAME + END + @"DondaFullCombo\" + i.ToString() + ".png"); End_DondaFullComboLoop = new CTexture[3]; for (int i = 0; i < 3; i++) End_DondaFullComboLoop[i] = TxC(GAME + END + @"DondaFullCombo\" + "loop_" + i.ToString() + ".png"); End_Goukaku = new CTexture[3]; for (int i = 0; i < End_Goukaku.Length; i++) { End_Goukaku[i] = TxC(GAME + END + @"Dan" + i.ToString() + ".png"); } #endregion #region GameMode GameMode_Timer_Tick = TxC(GAME + GAMEMODE + @"Timer_Tick.png"); GameMode_Timer_Frame = TxC(GAME + GAMEMODE + @"Timer_Frame.png"); #endregion #region ClearFailed Failed_Game = TxC(GAME + FAILED + @"Game.png"); Failed_Stage = TxC(GAME + FAILED + @"Stage.png"); #endregion #region Runner Runner = TxC(GAME + RUNNER + @"0.png"); #endregion #region DanC DanC_Background = TxC(GAME + DANC + @"Background.png"); DanC_Gauge = new CTexture[4]; var type = new string[] { "Normal", "Reach", "Clear", "Flush" }; for (int i = 0; i < 4; i++) { DanC_Gauge[i] = TxC(GAME + DANC + @"Gauge_" + type[i] + ".png"); } DanC_Base = TxC(GAME + DANC + @"Base.png"); DanC_Base_Small = TxC(GAME + DANC + @"Base_Small.png"); DanC_Gauge_Base = TxC(GAME + DANC + @"Gauge_Base.png"); DanC_Failed = TxC(GAME + DANC + @"Failed.png"); DanC_Number = TxC(GAME + DANC + @"Number.png"); DanC_Small_Number = TxC(GAME + DANC + @"Small_Number.png"); DanC_ExamType = TxC(GAME + DANC + @"ExamType.png"); DanC_ExamRange = TxC(GAME + DANC + @"ExamRange.png"); DanC_ExamUnit = TxC(GAME + DANC + @"ExamUnit.png"); DanC_Screen = TxC(GAME + DANC + @"Screen.png"); DanC_SmallBase = TxC(GAME + DANC + @"SmallBase.png"); DanC_Small_ExamCymbol = TxC(GAME + DANC + @"Small_ExamCymbol.png"); DanC_ExamCymbol = TxC(GAME + DANC + @"ExamCymbol.png"); DanC_MiniNumber = TxC(GAME + DANC + @"MiniNumber.png"); #endregion #region PuchiChara PuchiChara = TxCGlobal(PUCHICHARA + @"0.png"); TJAPlayer3.Skin.Puchichara_Ptn = 5 * Math.Max(1, (PuchiChara.szテクスチャサイズ.Height / 256)); #endregion #region Training Tokkun_DownBG = TxC(GAME + TRAINING + @"Down.png"); Tokkun_BigTaiko = TxC(GAME + TRAINING + @"BigTaiko.png"); Tokkun_ProgressBar = TxC(GAME + TRAINING + @"ProgressBar_Red.png"); Tokkun_ProgressBarWhite = TxC(GAME + TRAINING + @"ProgressBar_White.png"); Tokkun_GoGoPoint = TxC(GAME + TRAINING + @"GoGoPoint.png"); Tokkun_JumpPoint = TxC(GAME + TRAINING + @"JumpPoint.png"); Tokkun_Background_Up = TxC(GAME + TRAINING + @"Background_Up.png"); Tokkun_BigNumber = TxC(GAME + TRAINING + @"BigNumber.png"); Tokkun_SmallNumber = TxC(GAME + TRAINING + @"SmallNumber.png"); Tokkun_Speed_Measure = TxC(GAME + TRAINING + @"Speed_Measure.png"); #endregion #region [20_Tower] Tower_Sky_Gradient = TxC(GAME + TOWER + @"Sky_Gradient.png"); Tower_Miss = TxC(GAME + TOWER + @"Miss.png"); // Tower elements TJAPlayer3.Skin.Game_Tower_Ptn = System.IO.Directory.GetDirectories(CSkin.Path(BASE + GAME + TOWER + TOWERFLOOR)).Length; Tower_Top = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn]; Tower_Base = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn][]; Tower_Deco = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn][]; TJAPlayer3.Skin.Game_Tower_Ptn_Base = new int[TJAPlayer3.Skin.Game_Tower_Ptn]; TJAPlayer3.Skin.Game_Tower_Ptn_Deco = new int[TJAPlayer3.Skin.Game_Tower_Ptn]; for (int i = 0; i < TJAPlayer3.Skin.Game_Tower_Ptn; i++) { TJAPlayer3.Skin.Game_Tower_Ptn_Base[i] = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + TOWER + TOWERFLOOR + i.ToString() + @"\Base\"), "Base"); TJAPlayer3.Skin.Game_Tower_Ptn_Deco[i] = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + TOWER + TOWERFLOOR + i.ToString() + @"\Deco\"), "Deco"); Tower_Top[i] = TxC(GAME + TOWER + TOWERFLOOR + i.ToString() + @"\Top.png"); Tower_Base[i] = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Base[i]]; Tower_Deco[i] = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Deco[i]]; for (int j = 0; j < TJAPlayer3.Skin.Game_Tower_Ptn_Base[i]; j++) { Tower_Base[i][j] = TxC(GAME + TOWER + TOWERFLOOR + i.ToString() + @"\Base\Base" + j.ToString() + ".png"); } for (int j = 0; j < TJAPlayer3.Skin.Game_Tower_Ptn_Deco[i]; j++) { Tower_Deco[i][j] = TxC(GAME + TOWER + TOWERFLOOR + i.ToString() + @"\Deco\Deco" + j.ToString() + ".png"); } } // Tower climbing Don TJAPlayer3.Skin.Game_Tower_Ptn_Don = System.IO.Directory.GetDirectories(CSkin.Path(BASE + GAME + TOWER + TOWERDON)).Length; Tower_Don_Climbing = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Don][]; Tower_Don_Jump = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Don][]; Tower_Don_Running = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Don][]; Tower_Don_Standing = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Don][]; TJAPlayer3.Skin.Game_Tower_Ptn_Don_Climbing = new int[TJAPlayer3.Skin.Game_Tower_Ptn_Don]; TJAPlayer3.Skin.Game_Tower_Ptn_Don_Jump = new int[TJAPlayer3.Skin.Game_Tower_Ptn_Don]; TJAPlayer3.Skin.Game_Tower_Ptn_Don_Running = new int[TJAPlayer3.Skin.Game_Tower_Ptn_Don]; TJAPlayer3.Skin.Game_Tower_Ptn_Don_Standing = new int[TJAPlayer3.Skin.Game_Tower_Ptn_Don]; for (int i = 0; i < TJAPlayer3.Skin.Game_Tower_Ptn_Don; i++) { TJAPlayer3.Skin.Game_Tower_Ptn_Don_Climbing[i] = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + TOWER + TOWERDON + i.ToString() + @"\Climbing\"), "Climbing"); TJAPlayer3.Skin.Game_Tower_Ptn_Don_Running[i] = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + TOWER + TOWERDON + i.ToString() + @"\Running\"), "Running"); TJAPlayer3.Skin.Game_Tower_Ptn_Don_Standing[i] = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + TOWER + TOWERDON + i.ToString() + @"\Standing\"), "Standing"); TJAPlayer3.Skin.Game_Tower_Ptn_Don_Jump[i] = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + TOWER + TOWERDON + i.ToString() + @"\Jump\"), "Jump"); Tower_Don_Climbing[i] = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Don_Climbing[i]]; Tower_Don_Running[i] = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Don_Running[i]]; Tower_Don_Standing[i] = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Don_Standing[i]]; Tower_Don_Jump[i] = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Don_Jump[i]]; for (int j = 0; j < TJAPlayer3.Skin.Game_Tower_Ptn_Don_Climbing[i]; j++) { Tower_Don_Climbing[i][j] = TxC(GAME + TOWER + TOWERDON + i.ToString() + @"\Climbing\Climbing" + j.ToString() + ".png"); } for (int j = 0; j < TJAPlayer3.Skin.Game_Tower_Ptn_Don_Running[i]; j++) { Tower_Don_Running[i][j] = TxC(GAME + TOWER + TOWERDON + i.ToString() + @"\Running\Running" + j.ToString() + ".png"); } for (int j = 0; j < TJAPlayer3.Skin.Game_Tower_Ptn_Don_Standing[i]; j++) { Tower_Don_Standing[i][j] = TxC(GAME + TOWER + TOWERDON + i.ToString() + @"\Standing\Standing" + j.ToString() + ".png"); } for (int j = 0; j < TJAPlayer3.Skin.Game_Tower_Ptn_Don_Jump[i]; j++) { Tower_Don_Jump[i][j] = TxC(GAME + TOWER + TOWERDON + i.ToString() + @"\Jump\Jump" + j.ToString() + ".png"); } } #endregion #region [21_ModIcons] HiSp = new CTexture[14]; for (int i = 0; i < HiSp.Length; i++) { HiSp[i] = TxC(GAME + MODICONS + @"HS\" + i.ToString() + @".png"); } Mod_Timing = new CTexture[5]; for (int i = 0; i < Mod_Timing.Length; i++) { Mod_Timing[i] = TxC(GAME + MODICONS + @"Timing\" + i.ToString() + @".png"); } Mod_SongSpeed = new CTexture[2]; for (int i = 0; i < Mod_SongSpeed.Length; i++) { Mod_SongSpeed[i] = TxC(GAME + MODICONS + @"SongSpeed\" + i.ToString() + @".png"); } Mod_Fun = new CTexture[3]; for (int i = 0; i < Mod_Fun.Length; i++) { Mod_Fun[i] = TxC(GAME + MODICONS + @"Fun\" + i.ToString() + @".png"); } Mod_Doron = TxC(GAME + MODICONS + @"Doron.png"); Mod_Stealth = TxC(GAME + MODICONS + @"Stealth.png"); Mod_Mirror = TxC(GAME + MODICONS + @"Mirror.png"); Mod_Super = TxC(GAME + MODICONS + @"Super.png"); Mod_Hyper = TxC(GAME + MODICONS + @"Hyper.png"); Mod_Random = TxC(GAME + MODICONS + @"Random.png"); Mod_Auto = TxC(GAME + MODICONS + @"Auto.png"); Mod_Just = TxC(GAME + MODICONS + @"Just.png"); Mod_Safe = TxC(GAME + MODICONS + @"Safe.png"); Mod_None = TxC(GAME + MODICONS + @"None.png"); #endregion #endregion #region 6_結果発表 Result_FadeIn = TxC(RESULT + @"FadeIn.png"); Result_Gauge[0] = TxC(RESULT + @"Gauge.png"); Result_Gauge_Base[0] = TxC(RESULT + @"Gauge_Base.png"); Result_Gauge[1] = TxC(RESULT + @"Gauge_2.png"); Result_Gauge_Base[1] = TxC(RESULT + @"Gauge_Base_2.png"); Result_Header = TxC(RESULT + @"Header.png"); Result_Number = TxC(RESULT + @"Number.png"); Result_Panel = TxC(RESULT + @"Panel.png"); Result_Panel_2P = TxC(RESULT + @"Panel_2.png"); Result_Soul_Text = TxC(RESULT + @"Soul_Text.png"); Result_Soul_Fire = TxC(RESULT + @"Result_Soul_Fire.png"); Result_Diff_Bar = TxC(RESULT + @"DifficultyBar.png"); Result_Score_Number = TxC(RESULT + @"Score_Number.png"); Result_Dan = TxC(RESULT + @"Dan.png"); Result_CrownEffect = TxC(RESULT + @"CrownEffect.png"); Result_ScoreRankEffect = TxC(RESULT + @"ScoreRankEffect.png"); Result_Cloud = TxC(RESULT + @"Cloud.png"); Result_Shine = TxC(RESULT + @"Shine.png"); Result_Speech_Bubble[0] = TxC(RESULT + @"Speech_Bubble.png"); Result_Speech_Bubble[1] = TxC(RESULT + @"Speech_Bubble_2.png"); Result_Flower = TxC(RESULT + @"Flower\Flower.png"); for (int i = 1; i <= 5; i++) Result_Flower_Rotate[i - 1] = TxC(RESULT + @"Flower\Rotate_" + i.ToString() + ".png"); for (int i = 0; i < 3; i++) Result_Work[i] = TxC(RESULT + @"Work\" + i.ToString() + ".png"); for (int i = 0; i < 41; i++) Result_Rainbow[i] = TxC(RESULT + @"Rainbow\" + i.ToString() + ".png"); for (int i = 0; i < 3; i++) Result_Background[i] = TxC(RESULT + @"Background_" + i.ToString() + ".png"); for (int i = 0; i < 4; i++) Result_Mountain[i] = TxC(RESULT + @"Background_Mountain_" + i.ToString() + ".png"); for (int i = 0; i < 3; i++) Result_Crown[i] = TxC(RESULT + @"Crown\Crown_" + i.ToString() + ".png"); #endregion #region 7_終了画面 Exit_Background = TxC(EXIT + @"Background.png"); #endregion #region [7_DanResults] DanResult_Background = TxC(DANRESULT + @"Background.png"); DanResult_Rank = TxC(DANRESULT + @"Rank.png"); DanResult_SongPanel_Base = TxC(DANRESULT + @"SongPanel_Base.png"); DanResult_StatePanel_Base = TxC(DANRESULT + @"StatePanel_Base.png"); DanResult_SongPanel_Main = TxC(DANRESULT + @"SongPanel_Main.png"); DanResult_StatePanel_Main = TxC(DANRESULT + @"StatePanel_Main.png"); #endregion #region [8_TowerResults] TJAPlayer3.Skin.Game_Tower_Ptn_Result = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + TOWERRESULT + @"Tower\")); TowerResult_Tower = new CTexture[TJAPlayer3.Skin.Game_Tower_Ptn_Result]; TowerResult_Background = TxC(TOWERRESULT + @"Background.png"); TowerResult_Panel = TxC(TOWERRESULT + @"Panel.png"); TowerResult_ScoreRankEffect = TxC(TOWERRESULT + @"ScoreRankEffect.png"); for (int i = 0; i < TJAPlayer3.Skin.Game_Tower_Ptn_Result; i++) { TowerResult_Tower[i] = TxC(TOWERRESULT + @"Tower\" + i.ToString() + ".png"); } #endregion #region [10_Heya] Heya_Background = TxC(HEYA + @"Background.png"); Heya_Center_Menu_Bar = TxC(HEYA + @"Center_Menu_Bar.png"); Heya_Center_Menu_Box = TxC(HEYA + @"Center_Menu_Box.png"); Heya_Center_Menu_Box_Slot = TxC(HEYA + @"Center_Menu_Box_Slot.png"); Heya_Side_Menu = TxC(HEYA + @"Side_Menu.png"); Heya_Box = TxC(HEYA + @"Box.png"); Heya_Lock = TxC(HEYA + @"Lock.png"); #endregion #region [11_Characters] #region [Character count initialisations] TJAPlayer3.Skin.Characters_Ptn = System.IO.Directory.GetDirectories(TJAPlayer3.strEXEのあるフォルダ + GLOBAL + CHARACTERS).Length; Characters_Heya_Preview = new CTexture[TJAPlayer3.Skin.Characters_Ptn]; Characters_Normal = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Normal_Cleared = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Normal_Maxed = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_GoGoTime = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_GoGoTime_Maxed = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_10Combo = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_10Combo_Maxed = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_GoGoStart = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_GoGoStart_Maxed = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Become_Cleared = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Become_Maxed = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Balloon_Breaking = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Balloon_Broke = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Balloon_Miss = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Title_Entry = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Title_Normal = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Result_Clear = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Result_Failed = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Result_Failed_In = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Result_Normal = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Menu_Loop = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Menu_Start = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; Characters_Menu_Select = new CTexture[TJAPlayer3.Skin.Characters_Ptn][]; TJAPlayer3.Skin.Characters_Normal_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Normal_Cleared_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Normal_Maxed_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_GoGoTime_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_GoGoTime_Maxed_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_10Combo_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_10Combo_Maxed_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_GoGoStart_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_GoGoStart_Maxed_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Become_Cleared_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Become_Maxed_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Balloon_Breaking_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Balloon_Broke_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Balloon_Miss_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Title_Entry_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Title_Normal_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Result_Clear_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Result_Failed_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Result_Failed_In_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Result_Normal_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Menu_Loop_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Menu_Start_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Menu_Select_Ptn = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_X = new int[TJAPlayer3.Skin.Characters_Ptn][]; TJAPlayer3.Skin.Characters_Y = new int[TJAPlayer3.Skin.Characters_Ptn][]; TJAPlayer3.Skin.Characters_Balloon_X = new int[TJAPlayer3.Skin.Characters_Ptn][]; TJAPlayer3.Skin.Characters_Balloon_Y = new int[TJAPlayer3.Skin.Characters_Ptn][]; TJAPlayer3.Skin.Characters_Motion_Normal = new string[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Motion_Clear = new string[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Motion_GoGo = new string[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Beat_Normal = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Beat_Clear = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Beat_GoGo = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Balloon_Timer = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Balloon_Delay = new int[TJAPlayer3.Skin.Characters_Ptn]; TJAPlayer3.Skin.Characters_Balloon_FadeOut = new int[TJAPlayer3.Skin.Characters_Ptn]; #endregion for (int i = 0; i < 2; i++) this.ReloadCharacter(-1, TJAPlayer3.NamePlateConfig.data.Character[i], i, i == 0); for (int i = 0; i < TJAPlayer3.Skin.Characters_Ptn; i++) Characters_Heya_Preview[i] = TxCGlobal(CHARACTERS + i.ToString() + @"\Normal\0.png"); #endregion #region [11_Modals] Modal_Full = new CTexture[6]; Modal_Half = new CTexture[6]; for (int i = 0; i < 5; i++) { Modal_Full[i] = TxC(MODALS + i.ToString() + @"_full.png"); Modal_Half[i] = TxC(MODALS + i.ToString() + @"_half.png"); } Modal_Full[Modal_Full.Length - 1] = TxC(MODALS + @"Coin_full.png"); Modal_Half[Modal_Full.Length - 1] = TxC(MODALS + @"Coin_half.png"); #endregion #region [12_OnlineLounge] OnlineLounge_Background = TxC(ONLINELOUNGE + @"Background.png"); OnlineLounge_Box = TxC(ONLINELOUNGE + @"Box.png"); OnlineLounge_Center_Menu_Bar = TxC(ONLINELOUNGE + @"Center_Menu_Bar.png"); OnlineLounge_Center_Menu_Box_Slot = TxC(ONLINELOUNGE + @"Center_Menu_Box_Slot.png"); OnlineLounge_Side_Menu = TxC(ONLINELOUNGE + @"Side_Menu.png"); OnlineLounge_Context = TxC(ONLINELOUNGE + @"Context.png"); OnlineLounge_Song_Box = TxC(ONLINELOUNGE + @"Song_Box.png"); #endregion #region [13_TowerSelect] #endregion } public void ReloadCharacter(int old, int newC, int player, bool primary = false) { if (old == newC) return; int other = (player == 0) ? 1 : 0; if (old >= 0 && TJAPlayer3.NamePlateConfig.data.Character[other] != old) { int i = old; #region [Dispose the previous character] for (int j = 0; j < TJAPlayer3.Skin.Characters_Menu_Loop_Ptn[i]; j++) Characters_Menu_Loop[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Menu_Start_Ptn[i]; j++) Characters_Menu_Start[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Menu_Select_Ptn[i]; j++) Characters_Menu_Select[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Result_Normal_Ptn[i]; j++) Characters_Result_Normal[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Result_Failed_In_Ptn[i]; j++) Characters_Result_Failed_In[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Result_Failed_Ptn[i]; j++) Characters_Result_Failed[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Result_Clear_Ptn[i]; j++) Characters_Result_Clear[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Title_Normal_Ptn[i]; j++) Characters_Title_Normal[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Title_Entry_Ptn[i]; j++) Characters_Title_Entry[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Normal_Ptn[i]; j++) Characters_Normal[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Normal_Cleared_Ptn[i]; j++) Characters_Normal_Cleared[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Normal_Maxed_Ptn[i]; j++) Characters_Normal_Maxed[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_GoGoTime_Ptn[i]; j++) Characters_GoGoTime[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_GoGoTime_Maxed_Ptn[i]; j++) Characters_GoGoTime_Maxed[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_GoGoStart_Ptn[i]; j++) Characters_GoGoStart[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_GoGoStart_Maxed_Ptn[i]; j++) Characters_GoGoStart_Maxed[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_10Combo_Ptn[i]; j++) Characters_10Combo[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_10Combo_Maxed_Ptn[i]; j++) Characters_10Combo_Maxed[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Become_Cleared_Ptn[i]; j++) Characters_Become_Cleared[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Become_Maxed_Ptn[i]; j++) Characters_Become_Maxed[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Balloon_Breaking_Ptn[i]; j++) Characters_Balloon_Breaking[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Balloon_Broke_Ptn[i]; j++) Characters_Balloon_Broke[i][j]?.Dispose(); for (int j = 0; j < TJAPlayer3.Skin.Characters_Balloon_Miss_Ptn[i]; j++) Characters_Balloon_Miss[i][j]?.Dispose(); #endregion } if ((newC >= 0 && TJAPlayer3.NamePlateConfig.data.Character[other] != newC) || primary) { int i = newC; #region [Allocate the new character] #region [Character individual values count initialisation] string charaPath = TJAPlayer3.strEXEのあるフォルダ + GLOBAL + CHARACTERS + i.ToString(); TJAPlayer3.Skin.Characters_Normal_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Normal\"); TJAPlayer3.Skin.Characters_Normal_Cleared_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Clear\"); TJAPlayer3.Skin.Characters_Normal_Maxed_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Clear_Max\"); TJAPlayer3.Skin.Characters_GoGoTime_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\GoGo\"); TJAPlayer3.Skin.Characters_GoGoTime_Maxed_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\GoGo_Max\"); TJAPlayer3.Skin.Characters_10Combo_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\10combo\"); TJAPlayer3.Skin.Characters_10Combo_Maxed_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\10combo_Max\"); TJAPlayer3.Skin.Characters_GoGoStart_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\GoGoStart\"); TJAPlayer3.Skin.Characters_GoGoStart_Maxed_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\GoGoStart_Max\"); TJAPlayer3.Skin.Characters_Become_Cleared_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Clearin\"); TJAPlayer3.Skin.Characters_Become_Maxed_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Soulin\"); TJAPlayer3.Skin.Characters_Balloon_Breaking_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Balloon_Breaking\"); TJAPlayer3.Skin.Characters_Balloon_Broke_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Balloon_Broke\"); TJAPlayer3.Skin.Characters_Balloon_Miss_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Balloon_Miss\"); TJAPlayer3.Skin.Characters_Title_Entry_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Title_Entry\"); TJAPlayer3.Skin.Characters_Title_Normal_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Title_Normal\"); TJAPlayer3.Skin.Characters_Menu_Loop_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Menu_Loop\"); TJAPlayer3.Skin.Characters_Menu_Select_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Menu_Select\"); TJAPlayer3.Skin.Characters_Menu_Start_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Menu_Start\"); TJAPlayer3.Skin.Characters_Result_Clear_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Result_Clear\"); TJAPlayer3.Skin.Characters_Result_Failed_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Result_Failed\"); TJAPlayer3.Skin.Characters_Result_Failed_In_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Result_Failed_In\"); TJAPlayer3.Skin.Characters_Result_Normal_Ptn[i] = TJAPlayer3.t連番画像の枚数を数える(charaPath + @"\Result_Normal\"); Characters_Normal[i] = new CTexture[TJAPlayer3.Skin.Characters_Normal_Ptn[i]]; Characters_Normal_Cleared[i] = new CTexture[TJAPlayer3.Skin.Characters_Normal_Cleared_Ptn[i]]; Characters_Normal_Maxed[i] = new CTexture[TJAPlayer3.Skin.Characters_Normal_Maxed_Ptn[i]]; Characters_GoGoTime[i] = new CTexture[TJAPlayer3.Skin.Characters_GoGoTime_Ptn[i]]; Characters_GoGoTime_Maxed[i] = new CTexture[TJAPlayer3.Skin.Characters_GoGoTime_Maxed_Ptn[i]]; Characters_10Combo[i] = new CTexture[TJAPlayer3.Skin.Characters_10Combo_Ptn[i]]; Characters_10Combo_Maxed[i] = new CTexture[TJAPlayer3.Skin.Characters_10Combo_Maxed_Ptn[i]]; Characters_GoGoStart[i] = new CTexture[TJAPlayer3.Skin.Characters_GoGoStart_Ptn[i]]; Characters_GoGoStart_Maxed[i] = new CTexture[TJAPlayer3.Skin.Characters_GoGoStart_Maxed_Ptn[i]]; Characters_Become_Cleared[i] = new CTexture[TJAPlayer3.Skin.Characters_Become_Cleared_Ptn[i]]; Characters_Become_Maxed[i] = new CTexture[TJAPlayer3.Skin.Characters_Become_Maxed_Ptn[i]]; Characters_Balloon_Breaking[i] = new CTexture[TJAPlayer3.Skin.Characters_Balloon_Breaking_Ptn[i]]; Characters_Balloon_Broke[i] = new CTexture[TJAPlayer3.Skin.Characters_Balloon_Broke_Ptn[i]]; Characters_Balloon_Miss[i] = new CTexture[TJAPlayer3.Skin.Characters_Balloon_Miss_Ptn[i]]; Characters_Title_Entry[i] = new CTexture[TJAPlayer3.Skin.Characters_Title_Entry_Ptn[i]]; Characters_Title_Normal[i] = new CTexture[TJAPlayer3.Skin.Characters_Title_Normal_Ptn[i]]; Characters_Result_Clear[i] = new CTexture[TJAPlayer3.Skin.Characters_Result_Clear_Ptn[i]]; Characters_Result_Failed[i] = new CTexture[TJAPlayer3.Skin.Characters_Result_Failed_Ptn[i]]; Characters_Result_Failed_In[i] = new CTexture[TJAPlayer3.Skin.Characters_Result_Failed_In_Ptn[i]]; Characters_Result_Normal[i] = new CTexture[TJAPlayer3.Skin.Characters_Result_Normal_Ptn[i]]; Characters_Menu_Loop[i] = new CTexture[TJAPlayer3.Skin.Characters_Menu_Loop_Ptn[i]]; Characters_Menu_Start[i] = new CTexture[TJAPlayer3.Skin.Characters_Menu_Start_Ptn[i]]; Characters_Menu_Select[i] = new CTexture[TJAPlayer3.Skin.Characters_Menu_Select_Ptn[i]]; #endregion #region [Characters asset loading] for (int j = 0; j < TJAPlayer3.Skin.Characters_Menu_Loop_Ptn[i]; j++) Characters_Menu_Loop[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Menu_Loop\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Menu_Select_Ptn[i]; j++) Characters_Menu_Select[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Menu_Select\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Menu_Start_Ptn[i]; j++) Characters_Menu_Start[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Menu_Start\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Result_Normal_Ptn[i]; j++) Characters_Result_Normal[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Result_Normal\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Result_Failed_In_Ptn[i]; j++) Characters_Result_Failed_In[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Result_Failed_In\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Result_Failed_Ptn[i]; j++) Characters_Result_Failed[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Result_Failed\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Result_Clear_Ptn[i]; j++) Characters_Result_Clear[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Result_Clear\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Title_Normal_Ptn[i]; j++) Characters_Title_Normal[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Title_Normal\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Title_Entry_Ptn[i]; j++) Characters_Title_Entry[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Title_Entry\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Normal_Ptn[i]; j++) Characters_Normal[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Normal\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Normal_Cleared_Ptn[i]; j++) Characters_Normal_Cleared[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Clear\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Normal_Maxed_Ptn[i]; j++) Characters_Normal_Maxed[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Clear_Max\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_GoGoTime_Ptn[i]; j++) Characters_GoGoTime[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\GoGo\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_GoGoTime_Maxed_Ptn[i]; j++) Characters_GoGoTime_Maxed[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\GoGo_Max\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_GoGoStart_Ptn[i]; j++) Characters_GoGoStart[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\GoGoStart\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_GoGoStart_Maxed_Ptn[i]; j++) Characters_GoGoStart_Maxed[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\GoGoStart_Max\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_10Combo_Ptn[i]; j++) Characters_10Combo[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\10combo\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_10Combo_Maxed_Ptn[i]; j++) Characters_10Combo_Maxed[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\10combo_Max\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Become_Cleared_Ptn[i]; j++) Characters_Become_Cleared[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Clearin\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Become_Maxed_Ptn[i]; j++) Characters_Become_Maxed[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Soulin\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Balloon_Breaking_Ptn[i]; j++) Characters_Balloon_Breaking[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Balloon_Breaking\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Balloon_Broke_Ptn[i]; j++) Characters_Balloon_Broke[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Balloon_Broke\" + j.ToString() + @".png"); for (int j = 0; j < TJAPlayer3.Skin.Characters_Balloon_Miss_Ptn[i]; j++) Characters_Balloon_Miss[i][j] = TxCGlobal(CHARACTERS + i.ToString() + @"\Balloon_Miss\" + j.ToString() + @".png"); #endregion #region [Parse individual character parameters] #region [Default values] TJAPlayer3.Skin.Characters_X[i] = new int[] { 0, 0 }; TJAPlayer3.Skin.Characters_Y[i] = new int[] { 0, 537 }; TJAPlayer3.Skin.Characters_Balloon_X[i] = new int[] { 240, 240, 0, 0 }; TJAPlayer3.Skin.Characters_Balloon_Y[i] = new int[] { 0, 297, 0, 0 }; TJAPlayer3.Skin.Characters_Motion_Normal[i] = "0"; TJAPlayer3.Skin.Characters_Motion_Clear[i] = "0"; TJAPlayer3.Skin.Characters_Motion_GoGo[i] = "0"; TJAPlayer3.Skin.Characters_Beat_Normal[i] = 1; TJAPlayer3.Skin.Characters_Beat_Clear[i] = 2; TJAPlayer3.Skin.Characters_Beat_GoGo[i] = 2; TJAPlayer3.Skin.Characters_Balloon_Timer[i] = 28; TJAPlayer3.Skin.Characters_Balloon_Delay[i] = 500; TJAPlayer3.Skin.Characters_Balloon_FadeOut[i] = 84; #endregion var _str = ""; TJAPlayer3.Skin.LoadSkinConfigFromFile(charaPath + @"\CharaConfig.txt", ref _str); string[] delimiter = { "\n" }; string[] strSingleLine = _str.Split(delimiter, StringSplitOptions.RemoveEmptyEntries); foreach (string s in strSingleLine) { string str = s.Replace('\t', ' ').TrimStart(new char[] { '\t', ' ' }); if ((str.Length != 0) && (str[0] != ';')) { try { string strCommand; string strParam; string[] strArray = str.Split(new char[] { '=' }); if (strArray.Length == 2) { strCommand = strArray[0].Trim(); strParam = strArray[1].Trim(); if (strCommand == "Game_Chara_X") { string[] strSplit = strParam.Split(','); for (int k = 0; k < 2; k++) { TJAPlayer3.Skin.Characters_X[i][k] = int.Parse(strSplit[k]); } } else if (strCommand == "Game_Chara_Y") { string[] strSplit = strParam.Split(','); for (int k = 0; k < 2; k++) { TJAPlayer3.Skin.Characters_Y[i][k] = int.Parse(strSplit[k]); } } else if (strCommand == "Game_Chara_Balloon_X") { string[] strSplit = strParam.Split(','); for (int k = 0; k < 2; k++) { TJAPlayer3.Skin.Characters_Balloon_X[i][k] = int.Parse(strSplit[k]); } } else if (strCommand == "Game_Chara_Balloon_Y") { string[] strSplit = strParam.Split(','); for (int k = 0; k < 2; k++) { TJAPlayer3.Skin.Characters_Balloon_Y[i][k] = int.Parse(strSplit[k]); } } else if (strCommand == "Game_Chara_Balloon_Timer") { if (int.Parse(strParam) > 0) TJAPlayer3.Skin.Characters_Balloon_Timer[i] = int.Parse(strParam); } else if (strCommand == "Game_Chara_Balloon_Delay") { if (int.Parse(strParam) > 0) TJAPlayer3.Skin.Characters_Balloon_Delay[i] = int.Parse(strParam); } else if (strCommand == "Game_Chara_Balloon_FadeOut") { if (int.Parse(strParam) > 0) TJAPlayer3.Skin.Characters_Balloon_FadeOut[i] = int.Parse(strParam); } // パターン数の設定はTextureLoader.csで反映されます。 else if (strCommand == "Game_Chara_Motion_Normal") { TJAPlayer3.Skin.Characters_Motion_Normal[i] = strParam; } else if (strCommand == "Game_Chara_Motion_Clear") { TJAPlayer3.Skin.Characters_Motion_Clear[i] = strParam; } else if (strCommand == "Game_Chara_Motion_GoGo") { TJAPlayer3.Skin.Characters_Motion_GoGo[i] = strParam; } else if (strCommand == "Game_Chara_Beat_Normal") { TJAPlayer3.Skin.Characters_Beat_Normal[i] = int.Parse(strParam); } else if (strCommand == "Game_Chara_Beat_Clear") { TJAPlayer3.Skin.Characters_Beat_Clear[i] = int.Parse(strParam); } else if (strCommand == "Game_Chara_Beat_GoGo") { TJAPlayer3.Skin.Characters_Beat_GoGo[i] = int.Parse(strParam); } } continue; } catch (Exception exception) { Trace.TraceError(exception.ToString()); Trace.TraceError("例外が発生しましたが処理を継続します。 (6a32cc37-1527-412e-968a-512c1f0135cd)"); continue; } } } #endregion #endregion } } public void DisposeTexture() { foreach (var tex in listTexture) { var texture = tex; TJAPlayer3.tテクスチャの解放(ref texture); texture?.Dispose(); texture = null; } listTexture.Clear(); } #region 共通 public CTexture Tile_Black, Menu_Title, Menu_Highlight, Enum_Song, Scanning_Loudness, NamePlateBase, Overlay, Readme, Network_Connection; public CTexture[] NamePlate; public CTexture[] NamePlate_Effect = new CTexture[5]; public CTexture[][] NamePlate_Title; public CTexture[] NamePlate_Title_Big; public CTexture[] NamePlate_Title_Small; #endregion #region 1_タイトル画面 public CTexture Title_Background, Entry_Bar, Entry_Bar_Text; public CTexture[] Banapas_Load = new CTexture[3]; public CTexture[] Banapas_Load_Clear = new CTexture[2]; public CTexture[] Banapas_Load_Failure = new CTexture[2]; public CTexture[] Entry_Player = new CTexture[3]; public CTexture[] ModeSelect_Bar; public CTexture[] ModeSelect_Bar_Chara; #endregion #region 2_コンフィグ画面 public CTexture Config_Background, Config_Header, Config_Cursor, Config_ItemBox, Config_Arrow, Config_KeyAssign, Config_Font, Config_Font_Bold, Config_Enum_Song; #endregion #region 3_選曲画面 public CTexture SongSelect_Background, SongSelect_Header, SongSelect_Coin_Slot, SongSelect_Auto, SongSelect_Level, SongSelect_Branch, SongSelect_Branch_Text, SongSelect_Frame_Box, SongSelect_Frame_BackBox, SongSelect_Frame_Random, SongSelect_Bar_Center, SongSelect_Bar_Genre_Back, SongSelect_Bar_Genre_Random, SongSelect_Bar_Genre_RecentryPlaySong, SongSelect_Level_Number, SongSelect_Bar_Select, SongSelect_Bar_Genre_Overlay, SongSelect_Credit, SongSelect_Timer, SongSelect_Crown, SongSelect_ScoreRank, SongSelect_Song_Number, SongSelect_BoardNumber, SongSelect_Favorite, SongSelect_High_Score, SongSelect_Level_Icons, SongSelect_Search_Arrow, SongSelect_Search_Arrow_Glow, SongSelect_Search_Window, SongSelect_ScoreWindow_Text; public CTexture[] SongSelect_GenreBack, SongSelect_Bar_Genre, SongSelect_Box_Chara, SongSelect_ScoreWindow = new CTexture[(int)Difficulty.Total], SongSelect_Frame_Score = new CTexture[2], SongSelect_NamePlate = new CTexture[1], SongSelect_Table = new CTexture[6]; #region [ 難易度選択画面 ] public CTexture Difficulty_Bar; public CTexture Difficulty_Number; public CTexture Difficulty_Star; public CTexture Difficulty_Crown; public CTexture Difficulty_Option; public CTexture Difficulty_Option_Select; public CTexture[] Difficulty_Select_Bar = new CTexture[2]; public CTexture[] Difficulty_Back; #endregion #endregion #region 3_段位選択画面 public CTexture Dani_Background; public CTexture Dani_Difficulty_Cymbol; public CTexture Dani_Level_Number; public CTexture Dani_Soul_Number; public CTexture Dani_Exam_Number; public CTexture Dani_Bar_Center; public CTexture Dani_Plate; public CTexture[] Challenge_Select = new CTexture[3]; public CTexture Dani_Dan_In; public CTexture Dani_Dan_Text; public CTexture Dani_DanPlates; public CTexture Dani_DanSides; public CTexture[] Dani_Bloc = new CTexture[3]; #endregion #region 4_読み込み画面 public CTexture SongLoading_Plate, SongLoading_Bg, SongLoading_BgWait, SongLoading_Chara, SongLoading_Bg_Dan, SongLoading_Fade; #endregion #region 5_演奏画面 #region 共通 public CTexture Judge_Frame, Note_Mine, Note_Swap, SENotesExtension, Notes_Arm, ChipEffect, ScoreRank, Judge; public CTexture Judge_Meter, Bar, Bar_Branch; public CTexture[] Notes, SENotes; #endregion #region 踊り子 public CTexture[][] Dancer; #endregion #region モブ public CTexture[] Mob; #endregion #region 太鼓 public CTexture[] Taiko_Base, Taiko_Frame, // MTaiko下敷き Taiko_Background; public CTexture Taiko_Don_Left, Taiko_Don_Right, Taiko_Ka_Left, Taiko_Ka_Right, Taiko_Konga_Don, Taiko_Konga_Ka, Taiko_Konga_Clap, Taiko_LevelUp, Taiko_LevelDown, Taiko_Combo_Effect, Taiko_Combo_Text; public CTexture[] Couse_Symbol, // コースシンボル Taiko_PlayerNumber, Taiko_NamePlate; // ネームプレート public CTexture[] Taiko_Score, Taiko_Combo, Taiko_Combo_Guide; #endregion #region ゲージ public CTexture[] Gauge, Gauge_Base, Gauge_Line, Gauge_Rainbow, Gauge_Soul_Explosion; public CTexture Gauge_Soul, Gauge_Flash, Gauge_Soul_Fire; public CTexture[] Gauge_Dan; public CTexture[] Gauge_Dan_Rainbow; #endregion #region 吹き出し public CTexture[] Balloon_Combo; public CTexture Balloon_Roll, Balloon_Balloon, Balloon_Number_Roll, Balloon_Number_Combo/*,*/ /*Balloon_Broken*/; public CTexture[] Balloon_Breaking; #endregion #region エフェクト public CTexture Effects_Hit_Explosion, Effects_Hit_Bomb, Effects_Hit_Explosion_Big, Effects_Fire, Effects_Rainbow, Effects_GoGoSplash, Effects_Hit_FireWorks; public CTexture[] Effects_Hit_Great, Effects_Hit_Good, Effects_Hit_Great_Big, Effects_Hit_Good_Big; public CTexture[] Effects_Roll; #endregion #region レーン public CTexture[] Lane_Red, Lane_Blue, Lane_Clap, Lane_Base, Lane_Text; public CTexture Lane_Yellow; public CTexture Lane_Background_Main, Lane_Background_AI, Lane_Background_Sub, Lane_Background_GoGo; #endregion #region 終了演出 public CTexture End_Clear_Chara; public CTexture[] End_Clear_Text; public CTexture End_Star; public CTexture[] End_Clear_L, End_Clear_R, End_ClearFailed, End_FullCombo, End_FullComboLoop, End_DondaFullCombo, End_DondaFullComboLoop, End_Goukaku; public CTexture End_Clear_Text_, End_Clear_Text_Effect, ClearFailed, ClearFailed1, ClearFailed2, End_DondaFullComboBg; #endregion #region ゲームモード public CTexture GameMode_Timer_Frame, GameMode_Timer_Tick; #endregion #region ステージ失敗 public CTexture Failed_Game, Failed_Stage; #endregion #region ランナー public CTexture Runner; #endregion #region DanC public CTexture DanC_Background; public CTexture[] DanC_Gauge; public CTexture DanC_Base; public CTexture DanC_Base_Small; public CTexture DanC_Gauge_Base; public CTexture DanC_Failed; public CTexture DanC_Number, DanC_Small_Number, DanC_SmallBase, DanC_ExamType, DanC_ExamRange, DanC_Small_ExamCymbol, DanC_ExamCymbol, DanC_MiniNumber, DanC_ExamUnit; public CTexture DanC_Screen; #endregion #region PuchiChara public CTexture PuchiChara; #endregion #region Training public CTexture Tokkun_DownBG, Tokkun_BigTaiko, Tokkun_ProgressBar, Tokkun_ProgressBarWhite, Tokkun_GoGoPoint, Tokkun_JumpPoint, Tokkun_Background_Up, Tokkun_BigNumber, Tokkun_SmallNumber, Tokkun_Speed_Measure; #endregion #region [20_Tower] public CTexture Tower_Sky_Gradient, Tower_Miss; public CTexture[] Tower_Top; public CTexture[][] Tower_Base, Tower_Deco, Tower_Don_Running, Tower_Don_Standing, Tower_Don_Climbing, Tower_Don_Jump; #endregion #region [21_ModIcons] public CTexture[] Mod_Timing, Mod_SongSpeed, Mod_Fun, HiSp; public CTexture Mod_None, Mod_Doron, Mod_Stealth, Mod_Mirror, Mod_Random, Mod_Super, Mod_Hyper, Mod_Just, Mod_Safe, Mod_Auto; #endregion #endregion #region 6_結果発表 public CTexture Result_FadeIn, Result_Header, Result_Number, Result_Panel, Result_Panel_2P, Result_Soul_Text, Result_Soul_Fire, Result_Diff_Bar, Result_Score_Number, Result_CrownEffect, Result_ScoreRankEffect, Result_Cloud, Result_Flower, Result_Shine, Result_Dan; public CTexture[] Result_Rainbow = new CTexture[41], Result_Background = new CTexture[3], Result_Crown = new CTexture[3], Result_Flower_Rotate = new CTexture[5], Result_Work = new CTexture[3], Result_Gauge = new CTexture[2], Result_Gauge_Base = new CTexture[2], Result_Speech_Bubble = new CTexture[2], Result_Mountain = new CTexture[4]; #endregion #region 7_終了画面 public CTexture Exit_Background/* , */ /*Exit_Text */; #endregion #region [7_DanResults] public CTexture DanResult_Background, DanResult_Rank, DanResult_SongPanel_Base, DanResult_StatePanel_Base, DanResult_SongPanel_Main, DanResult_StatePanel_Main; #endregion #region [8_TowerResults] public CTexture TowerResult_Background, TowerResult_ScoreRankEffect, TowerResult_Panel; public CTexture[] TowerResult_Tower; #endregion #region [10_Heya] public CTexture Heya_Background, Heya_Center_Menu_Bar, Heya_Center_Menu_Box, Heya_Center_Menu_Box_Slot, Heya_Side_Menu, Heya_Box, Heya_Lock; #endregion #region [11_Characters] public CTexture[][] Characters_Normal, Characters_Normal_Cleared, Characters_Normal_Maxed, Characters_GoGoTime, Characters_GoGoTime_Maxed, Characters_10Combo, Characters_10Combo_Maxed, Characters_GoGoStart, Characters_GoGoStart_Maxed, Characters_Become_Cleared, Characters_Become_Maxed, Characters_Balloon_Breaking, Characters_Balloon_Broke, Characters_Balloon_Miss, Characters_Title_Entry, Characters_Title_Normal, Characters_Menu_Loop, Characters_Menu_Select, Characters_Menu_Start, Characters_Result_Clear, Characters_Result_Failed, Characters_Result_Failed_In, Characters_Result_Normal; public CTexture[] Characters_Heya_Preview; #endregion #region [11_Modals] public CTexture[] Modal_Full, Modal_Half; #endregion #region [12_OnlineLounge] public CTexture OnlineLounge_Background, OnlineLounge_Box, OnlineLounge_Center_Menu_Bar, OnlineLounge_Center_Menu_Box_Slot, OnlineLounge_Side_Menu, OnlineLounge_Context, OnlineLounge_Song_Box; #endregion #region [13_TowerSelect] #endregion #region [ 解放用 ] public List<CTexture> listTexture = new List<CTexture>(); #endregion } }
46.393908
185
0.554147
[ "MIT" ]
funnym0th/OpenTaiko
TJAPlayer3/Stages/01.StartUp/TextureLoader.cs
89,858
C#
using System; using NetRuntimeSystem = System; using System.ComponentModel; using NetOffice.Attributes; namespace NetOffice.OfficeApi { #region Delegates #pragma warning disable public delegate void CustomXMLPart_NodeAfterInsertEventHandler(NetOffice.OfficeApi.CustomXMLNode newNode, bool InUndoRedo); public delegate void CustomXMLPart_NodeAfterDeleteEventHandler(NetOffice.OfficeApi.CustomXMLNode oldNode, NetOffice.OfficeApi.CustomXMLNode oldParentNode, NetOffice.OfficeApi.CustomXMLNode oldNextSibling, bool inUndoRedo); public delegate void CustomXMLPart_NodeAfterReplaceEventHandler(NetOffice.OfficeApi.CustomXMLNode oldNode, NetOffice.OfficeApi.CustomXMLNode newNode, bool inUndoRedo); #pragma warning restore #endregion /// <summary> /// CoClass CustomXMLPart /// SupportByVersion Office 12, 14, 15, 16 /// </summary> /// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff863497.aspx </remarks> [SupportByVersion("Office", 12, 14, 15, 16)] [EntityType(EntityType.IsCoClass)] [ComEventContract(typeof(NetOffice.OfficeApi.EventContracts._CustomXMLPartEvents))] [TypeId("000CDB08-0000-0000-C000-000000000046")] public interface CustomXMLPart : _CustomXMLPart, IEventBinding { #region Events /// <summary> /// SupportByVersion Office 12, 14, 15, 16 /// </summary> ///<remarks> MSDN Online Documentation: http://msdn.microsoft.com/en-us/en-us/library/office/ff861395.aspx </remarks> [SupportByVersion("Office", 12, 14, 15, 16)] event CustomXMLPart_NodeAfterInsertEventHandler NodeAfterInsertEvent; /// <summary> /// SupportByVersion Office 12, 14, 15, 16 /// </summary> ///<remarks> MSDN Online Documentation: http://msdn.microsoft.com/en-us/en-us/library/office/ff861395.aspx </remarks> [SupportByVersion("Office", 12, 14, 15, 16)] event CustomXMLPart_NodeAfterDeleteEventHandler NodeAfterDeleteEvent; /// <summary> /// SupportByVersion Office 12, 14, 15, 16 /// </summary> ///<remarks> MSDN Online Documentation: http://msdn.microsoft.com/en-us/en-us/library/office/ff863732.aspx </remarks> [SupportByVersion("Office", 12, 14, 15, 16)] event CustomXMLPart_NodeAfterReplaceEventHandler NodeAfterReplaceEvent; #endregion } }
42.454545
223
0.736188
[ "MIT" ]
igoreksiz/NetOffice
Source/Office/Classes/CustomXMLPart.cs
2,337
C#
namespace Noppes.Fluffle.Api.AccessControl { public static class AccessControlErrors { private const string AuthenticationPrefix = "AUTHENTICATION_"; public static V1Error InvalidApiKey() => new V1Error(AuthenticationPrefix + "INVALID_API_KEY", "Whoa, you forged yourself a fake API key huh? " + "To the dungeons with you! - The API key you provided doesn't exist."); public static V1Error HeaderWithoutValue() => new V1Error(AuthenticationPrefix + "HEADER_NO_VALUE", "You added the API key header and thought it was a good idea to not add the API key itself. " + "Interesting choice I must say."); public static V1Error HeaderNotSet() => new V1Error(AuthenticationPrefix + "HEADER_NOT_SET", "Halt! Identity thyself! - You tried accessing a resource which requires you to be authenticated. " + "Please provide an API key."); private const string AuthorizationPrefix = "AUTHORIZATION_"; public static V1Error Forbidden() => new V1Error(AuthorizationPrefix + "FORBIDDEN", "Halt! Thou are not allowed to touch the merchandise! - " + "You don't have the permission(s) to access this resource."); } }
44.6
117
0.63154
[ "MIT" ]
NoppesTheFolf/Fluffle
Fluffle.Api/AccessControl/AccessControlErrors.cs
1,340
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using YifyLib.Data.Base; namespace YifyLib.Data { /// <summary> /// Represent a user in YTS /// </summary> public class User : AbstractYifyUser { /// <summary> /// Instantiate this default user object /// </summary> public User() { Downloads = new List<UserDownloadedMovie>(); } /// <summary> /// Get or set a list of downloaded movies. /// </summary> public List<UserDownloadedMovie> Downloads { get; set; } /// <summary> /// Get or set the about text of the user /// </summary> public string AboutText { get; set; } /// <summary> /// Get or set the data joined /// </summary> public DateTime DateJoined { get; set; } /// <summary> /// Get or set the data joined in unix format /// </summary> public long DateJoinedUnix { get; set; } /// <summary> /// Get or set the data last seen /// </summary> public DateTime DateLastSeen { get; set; } /// <summary> /// Get or set the data last seen unix format /// </summary> public long DateLastSeenUnix { get; set; } } }
27.666667
64
0.537651
[ "MIT" ]
Lokukarawita/YifyLib
src/YifyLib/Data/User.cs
1,330
C#
using HtmlTags; using HtmlTags.Conventions; using HtmlTags.Conventions.Elements; namespace Miru.Html { public class FormBuilder : IElementBuilder { public HtmlTag Build(ElementRequest request) { var naming = request.Get<ElementNaming>(); var formTag = new FormTag(); if (request.Model != null) { formTag .Id(naming.Form(request.Model)) .Attr("data-form-summary", naming.FormSummaryId(request.Model)); } return formTag .NoClosingTag() .Attr("data-controller", "form"); } } }
25.518519
84
0.522496
[ "MIT" ]
MiruFx/Miru
src/Miru/Html/FormBuilder.cs
689
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/wincrypt.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; namespace TerraFX.Interop.UnitTests { /// <summary>Provides validation of the <see cref="CERT_SERVER_OCSP_RESPONSE_OPEN_PARA" /> struct.</summary> public static unsafe partial class CERT_SERVER_OCSP_RESPONSE_OPEN_PARATests { /// <summary>Validates that the <see cref="CERT_SERVER_OCSP_RESPONSE_OPEN_PARA" /> struct is blittable.</summary> [Test] public static void IsBlittableTest() { Assert.That(Marshal.SizeOf<CERT_SERVER_OCSP_RESPONSE_OPEN_PARA>(), Is.EqualTo(sizeof(CERT_SERVER_OCSP_RESPONSE_OPEN_PARA))); } /// <summary>Validates that the <see cref="CERT_SERVER_OCSP_RESPONSE_OPEN_PARA" /> struct has the right <see cref="LayoutKind" />.</summary> [Test] public static void IsLayoutSequentialTest() { Assert.That(typeof(CERT_SERVER_OCSP_RESPONSE_OPEN_PARA).IsLayoutSequential, Is.True); } /// <summary>Validates that the <see cref="CERT_SERVER_OCSP_RESPONSE_OPEN_PARA" /> struct has the correct size.</summary> [Test] public static void SizeOfTest() { if (Environment.Is64BitProcess) { Assert.That(sizeof(CERT_SERVER_OCSP_RESPONSE_OPEN_PARA), Is.EqualTo(40)); } else { Assert.That(sizeof(CERT_SERVER_OCSP_RESPONSE_OPEN_PARA), Is.EqualTo(24)); } } } }
40.568182
148
0.67563
[ "MIT" ]
DaZombieKiller/terrafx.interop.windows
tests/Interop/Windows/um/wincrypt/CERT_SERVER_OCSP_RESPONSE_OPEN_PARATests.cs
1,787
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNative.Security { /// <summary> /// Describes the server vulnerability assessment details on a resource /// API Version: 2020-01-01. /// </summary> [AzureNativeResourceType("azure-native:security:ServerVulnerabilityAssessment")] public partial class ServerVulnerabilityAssessment : Pulumi.CustomResource { /// <summary> /// Resource name /// </summary> [Output("name")] public Output<string> Name { get; private set; } = null!; /// <summary> /// The provisioningState of the vulnerability assessment capability on the VM /// </summary> [Output("provisioningState")] public Output<string> ProvisioningState { get; private set; } = null!; /// <summary> /// Resource type /// </summary> [Output("type")] public Output<string> Type { get; private set; } = null!; /// <summary> /// Create a ServerVulnerabilityAssessment resource with the given unique name, arguments, and options. /// </summary> /// /// <param name="name">The unique name of the resource</param> /// <param name="args">The arguments used to populate this resource's properties</param> /// <param name="options">A bag of options that control this resource's behavior</param> public ServerVulnerabilityAssessment(string name, ServerVulnerabilityAssessmentArgs args, CustomResourceOptions? options = null) : base("azure-native:security:ServerVulnerabilityAssessment", name, args ?? new ServerVulnerabilityAssessmentArgs(), MakeResourceOptions(options, "")) { } private ServerVulnerabilityAssessment(string name, Input<string> id, CustomResourceOptions? options = null) : base("azure-native:security:ServerVulnerabilityAssessment", name, null, MakeResourceOptions(options, id)) { } private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id) { var defaultOptions = new CustomResourceOptions { Version = Utilities.Version, Aliases = { new Pulumi.Alias { Type = "azure-nextgen:security:ServerVulnerabilityAssessment"}, new Pulumi.Alias { Type = "azure-native:security/v20200101:ServerVulnerabilityAssessment"}, new Pulumi.Alias { Type = "azure-nextgen:security/v20200101:ServerVulnerabilityAssessment"}, }, }; var merged = CustomResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. merged.Id = id ?? merged.Id; return merged; } /// <summary> /// Get an existing ServerVulnerabilityAssessment resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// </summary> /// /// <param name="name">The unique name of the resulting resource.</param> /// <param name="id">The unique provider ID of the resource to lookup.</param> /// <param name="options">A bag of options that control this resource's behavior</param> public static ServerVulnerabilityAssessment Get(string name, Input<string> id, CustomResourceOptions? options = null) { return new ServerVulnerabilityAssessment(name, id, options); } } public sealed class ServerVulnerabilityAssessmentArgs : Pulumi.ResourceArgs { /// <summary> /// The name of the resource group within the user's subscription. The name is case insensitive. /// </summary> [Input("resourceGroupName", required: true)] public Input<string> ResourceGroupName { get; set; } = null!; /// <summary> /// Name of the resource. /// </summary> [Input("resourceName", required: true)] public Input<string> ResourceName { get; set; } = null!; /// <summary> /// The Namespace of the resource. /// </summary> [Input("resourceNamespace", required: true)] public Input<string> ResourceNamespace { get; set; } = null!; /// <summary> /// The type of the resource. /// </summary> [Input("resourceType", required: true)] public Input<string> ResourceType { get; set; } = null!; /// <summary> /// ServerVulnerabilityAssessment status. only a 'default' value is supported. /// </summary> [Input("serverVulnerabilityAssessment")] public Input<string>? ServerVulnerabilityAssessment { get; set; } public ServerVulnerabilityAssessmentArgs() { } } }
41.95935
162
0.626429
[ "Apache-2.0" ]
polivbr/pulumi-azure-native
sdk/dotnet/Security/ServerVulnerabilityAssessment.cs
5,161
C#
// ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by SpecFlow (https://www.specflow.org/). // SpecFlow Version:3.7.0.0 // SpecFlow Generator Version:3.7.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ #region Designer generated code #pragma warning disable namespace SimpleIdServer.OpenBankingApi.Host.Acceptance.Tests.Features { using TechTalk.SpecFlow; using System; using System.Linq; [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.7.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public partial class AccountsFeature : object, Xunit.IClassFixture<AccountsFeature.FixtureData>, System.IDisposable { private static TechTalk.SpecFlow.ITestRunner testRunner; private string[] _featureTags = ((string[])(null)); private Xunit.Abstractions.ITestOutputHelper _testOutputHelper; #line 1 "Accounts.feature" #line hidden public AccountsFeature(AccountsFeature.FixtureData fixtureData, SimpleIdServer_OpenBankingApi_Host_Acceptance_Tests_XUnitAssemblyFixture assemblyFixture, Xunit.Abstractions.ITestOutputHelper testOutputHelper) { this._testOutputHelper = testOutputHelper; this.TestInitialize(); } public static void FeatureSetup() { testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "Accounts", "\tCheck /accounts endpoint", ProgrammingLanguage.CSharp, ((string[])(null))); testRunner.OnFeatureStart(featureInfo); } public static void FeatureTearDown() { testRunner.OnFeatureEnd(); testRunner = null; } public virtual void TestInitialize() { } public virtual void TestTearDown() { testRunner.OnScenarioEnd(); } public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) { testRunner.OnScenarioInitialize(scenarioInfo); testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs<Xunit.Abstractions.ITestOutputHelper>(_testOutputHelper); } public virtual void ScenarioStart() { testRunner.OnScenarioStart(); } public virtual void ScenarioCleanup() { testRunner.CollectScenarioErrors(); } void System.IDisposable.Dispose() { this.TestTearDown(); } [Xunit.SkippableFactAttribute(DisplayName="Get accounts (Basic)")] [Xunit.TraitAttribute("FeatureTitle", "Accounts")] [Xunit.TraitAttribute("Description", "Get accounts (Basic)")] public virtual void GetAccountsBasic() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Get accounts (Basic)", null, tagsOfScenario, argumentsOfScenario, this._featureTags); #line 4 this.ScenarioInitialize(scenarioInfo); #line hidden bool isScenarioIgnored = default(bool); bool isFeatureIgnored = default(bool); if ((tagsOfScenario != null)) { isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((this._featureTags != null)) { isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((isScenarioIgnored || isFeatureIgnored)) { testRunner.SkipScenario(); } else { this.ScenarioStart(); TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] { "Type", "Kid", "AlgName"}); table4.AddRow(new string[] { "SIG", "1", "RS256"}); #line 5 testRunner.When("build JSON Web Keys, store JWKS into \'jwks\' and store the public keys into \'jwks_" + "json\'", ((string)(null)), table4, "When "); #line hidden TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table5.AddRow(new string[] { "token_endpoint_auth_method", "tls_client_auth"}); table5.AddRow(new string[] { "response_types", "[token,code,id_token]"}); table5.AddRow(new string[] { "grant_types", "[client_credentials,authorization_code,implicit]"}); table5.AddRow(new string[] { "scope", "accounts"}); table5.AddRow(new string[] { "redirect_uris", "[https://localhost:8080/callback]"}); table5.AddRow(new string[] { "tls_client_auth_san_dns", "firstMtlsClient"}); table5.AddRow(new string[] { "id_token_signed_response_alg", "PS256"}); table5.AddRow(new string[] { "token_signed_response_alg", "PS256"}); table5.AddRow(new string[] { "request_object_signing_alg", "RS256"}); table5.AddRow(new string[] { "jwks", "$jwks_json$"}); #line 9 testRunner.And("execute HTTP POST JSON request \'https://localhost:8080/register\'", ((string)(null)), table5, "And "); #line hidden #line 22 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 23 testRunner.And("extract parameter \'client_id\' from JSON body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table6.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); table6.AddRow(new string[] { "client_id", "$client_id$"}); table6.AddRow(new string[] { "scope", "accounts"}); table6.AddRow(new string[] { "grant_type", "client_credentials"}); #line 25 testRunner.And("execute HTTP POST request \'https://localhost:8080/mtls/token\'", ((string)(null)), table6, "And "); #line hidden #line 32 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 33 testRunner.And("extract parameter \'access_token\' from JSON body into \'accessToken\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table7.AddRow(new string[] { "Authorization", "Bearer $accessToken$"}); table7.AddRow(new string[] { "x-fapi-interaction-id", "guid"}); table7.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); table7.AddRow(new string[] { "data", "{ \"permissions\" : [ \"ReadAccountsBasic\" ] }"}); #line 35 testRunner.And("execute HTTP POST JSON request \'https://localhost:8080/v3.1/account-access-consen" + "ts\'", ((string)(null)), table7, "And "); #line hidden #line 42 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 43 testRunner.And("extract parameter \'Data.ConsentId\' from JSON body into \'consentId\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 45 testRunner.And("\'administrator\' confirm consent \'$consentId$\' for accounts \'22289\', with scopes \'" + "accounts\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table8.AddRow(new string[] { "response_type", "id_token code"}); table8.AddRow(new string[] { "client_id", "$client_id$"}); table8.AddRow(new string[] { "state", "MTkCNSYlem"}); table8.AddRow(new string[] { "response_mode", "fragment"}); table8.AddRow(new string[] { "scope", "accounts"}); table8.AddRow(new string[] { "redirect_uri", "https://localhost:8080/callback"}); table8.AddRow(new string[] { "nonce", "nonce"}); table8.AddRow(new string[] { "claims", "{ id_token: { openbanking_intent_id : { value: \"$consentId$\", essential: true } }" + " }"}); table8.AddRow(new string[] { "exp", "$tomorrow$"}); table8.AddRow(new string[] { "aud", "https://localhost:8080"}); #line 47 testRunner.And("use \'1\' JWK from \'jwks\' to build JWS and store into \'request\'", ((string)(null)), table8, "And "); #line hidden TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table9.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); table9.AddRow(new string[] { "response_type", "id_token code"}); table9.AddRow(new string[] { "scope", "accounts"}); table9.AddRow(new string[] { "client_id", "$client_id$"}); table9.AddRow(new string[] { "request", "$request$"}); #line 60 testRunner.And("execute HTTP GET request \'https://localhost:8080/authorization\'", ((string)(null)), table9, "And "); #line hidden #line 68 testRunner.And("extract \'code\' from callback", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table10.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); table10.AddRow(new string[] { "client_id", "$client_id$"}); table10.AddRow(new string[] { "scope", "accounts"}); table10.AddRow(new string[] { "grant_type", "authorization_code"}); table10.AddRow(new string[] { "code", "$code$"}); table10.AddRow(new string[] { "redirect_uri", "https://localhost:8080/callback"}); #line 70 testRunner.And("execute HTTP POST request \'https://localhost:8080/mtls/token\'", ((string)(null)), table10, "And "); #line hidden #line 79 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 80 testRunner.And("extract parameter \'access_token\' from JSON body into \'accessToken\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table11.AddRow(new string[] { "Authorization", "Bearer $accessToken$"}); table11.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); #line 82 testRunner.And("execute HTTP GET request \'https://localhost:8080/v3.1/accounts\'", ((string)(null)), table11, "And "); #line hidden #line 87 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 89 testRunner.Then("HTTP status code equals to \'200\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden #line 90 testRunner.Then("JSON \'Data.Account[0].AccountId\'=\'22289\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden #line 91 testRunner.Then("JSON \'Data.Account[0].AccountSubType\'=\'CurrentAccount\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden #line 92 testRunner.Then("JSON doesn\'t exist \'Data.Account[0].Accounts[0].Identification\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden #line 93 testRunner.Then("JSON doesn\'t exist \'Data.Account[0].Accounts[0].SecondaryIdentification\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } this.ScenarioCleanup(); } [Xunit.SkippableFactAttribute(DisplayName="Get accounts (Detail)")] [Xunit.TraitAttribute("FeatureTitle", "Accounts")] [Xunit.TraitAttribute("Description", "Get accounts (Detail)")] public virtual void GetAccountsDetail() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Get accounts (Detail)", null, tagsOfScenario, argumentsOfScenario, this._featureTags); #line 95 this.ScenarioInitialize(scenarioInfo); #line hidden bool isScenarioIgnored = default(bool); bool isFeatureIgnored = default(bool); if ((tagsOfScenario != null)) { isScenarioIgnored = tagsOfScenario.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((this._featureTags != null)) { isFeatureIgnored = this._featureTags.Where(__entry => __entry != null).Where(__entry => String.Equals(__entry, "ignore", StringComparison.CurrentCultureIgnoreCase)).Any(); } if ((isScenarioIgnored || isFeatureIgnored)) { testRunner.SkipScenario(); } else { this.ScenarioStart(); TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] { "Type", "Kid", "AlgName"}); table12.AddRow(new string[] { "SIG", "1", "RS256"}); #line 96 testRunner.When("build JSON Web Keys, store JWKS into \'jwks\' and store the public keys into \'jwks_" + "json\'", ((string)(null)), table12, "When "); #line hidden TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table13.AddRow(new string[] { "token_endpoint_auth_method", "tls_client_auth"}); table13.AddRow(new string[] { "response_types", "[token,code,id_token]"}); table13.AddRow(new string[] { "grant_types", "[client_credentials,authorization_code,implicit]"}); table13.AddRow(new string[] { "scope", "accounts"}); table13.AddRow(new string[] { "redirect_uris", "[https://localhost:8080/callback]"}); table13.AddRow(new string[] { "tls_client_auth_san_dns", "firstMtlsClient"}); table13.AddRow(new string[] { "id_token_signed_response_alg", "PS256"}); table13.AddRow(new string[] { "token_signed_response_alg", "PS256"}); table13.AddRow(new string[] { "request_object_signing_alg", "RS256"}); table13.AddRow(new string[] { "jwks", "$jwks_json$"}); #line 100 testRunner.And("execute HTTP POST JSON request \'https://localhost:8080/register\'", ((string)(null)), table13, "And "); #line hidden #line 113 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 114 testRunner.And("extract parameter \'client_id\' from JSON body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table14.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); table14.AddRow(new string[] { "client_id", "$client_id$"}); table14.AddRow(new string[] { "scope", "accounts"}); table14.AddRow(new string[] { "grant_type", "client_credentials"}); #line 116 testRunner.And("execute HTTP POST request \'https://localhost:8080/mtls/token\'", ((string)(null)), table14, "And "); #line hidden #line 123 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 124 testRunner.And("extract parameter \'access_token\' from JSON body into \'accessToken\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table15.AddRow(new string[] { "Authorization", "Bearer $accessToken$"}); table15.AddRow(new string[] { "x-fapi-interaction-id", "guid"}); table15.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); table15.AddRow(new string[] { "data", "{ \"permissions\" : [ \"ReadAccountsDetail\" ] }"}); #line 126 testRunner.And("execute HTTP POST JSON request \'https://localhost:8080/v3.1/account-access-consen" + "ts\'", ((string)(null)), table15, "And "); #line hidden #line 133 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 134 testRunner.And("extract parameter \'Data.ConsentId\' from JSON body into \'consentId\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 136 testRunner.And("\'administrator\' confirm consent \'$consentId$\' for accounts \'22289\', with scopes \'" + "accounts\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table16.AddRow(new string[] { "response_type", "id_token code"}); table16.AddRow(new string[] { "client_id", "$client_id$"}); table16.AddRow(new string[] { "state", "MTkCNSYlem"}); table16.AddRow(new string[] { "response_mode", "fragment"}); table16.AddRow(new string[] { "scope", "accounts"}); table16.AddRow(new string[] { "redirect_uri", "https://localhost:8080/callback"}); table16.AddRow(new string[] { "nonce", "nonce"}); table16.AddRow(new string[] { "claims", "{ id_token: { openbanking_intent_id : { value: \"$consentId$\", essential: true } }" + " }"}); table16.AddRow(new string[] { "exp", "$tomorrow$"}); table16.AddRow(new string[] { "aud", "https://localhost:8080"}); #line 138 testRunner.And("use \'1\' JWK from \'jwks\' to build JWS and store into \'request\'", ((string)(null)), table16, "And "); #line hidden TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table17.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); table17.AddRow(new string[] { "response_type", "id_token code"}); table17.AddRow(new string[] { "scope", "accounts"}); table17.AddRow(new string[] { "client_id", "$client_id$"}); table17.AddRow(new string[] { "request", "$request$"}); #line 151 testRunner.And("execute HTTP GET request \'https://localhost:8080/authorization\'", ((string)(null)), table17, "And "); #line hidden #line 159 testRunner.And("extract \'code\' from callback", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table18.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); table18.AddRow(new string[] { "client_id", "$client_id$"}); table18.AddRow(new string[] { "scope", "accounts"}); table18.AddRow(new string[] { "grant_type", "authorization_code"}); table18.AddRow(new string[] { "code", "$code$"}); table18.AddRow(new string[] { "redirect_uri", "https://localhost:8080/callback"}); #line 161 testRunner.And("execute HTTP POST request \'https://localhost:8080/mtls/token\'", ((string)(null)), table18, "And "); #line hidden #line 170 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 171 testRunner.And("extract parameter \'access_token\' from JSON body into \'accessToken\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] { "Key", "Value"}); table19.AddRow(new string[] { "Authorization", "Bearer $accessToken$"}); table19.AddRow(new string[] { "X-Testing-ClientCert", "mtlsClient.crt"}); #line 173 testRunner.And("execute HTTP GET request \'https://localhost:8080/v3.1/accounts\'", ((string)(null)), table19, "And "); #line hidden #line 178 testRunner.And("extract JSON from body", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden #line 180 testRunner.Then("HTTP status code equals to \'200\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden #line 181 testRunner.Then("JSON \'Data.Account[0].AccountId\'=\'22289\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden #line 182 testRunner.Then("JSON \'Data.Account[0].AccountSubType\'=\'CurrentAccount\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden #line 183 testRunner.Then("JSON \'Data.Account[0].Accounts[0].Identification\'=\'80200110203345\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden #line 184 testRunner.Then("JSON \'Data.Account[0].Accounts[0].SecondaryIdentification\'=\'00021\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } this.ScenarioCleanup(); } [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.7.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class FixtureData : System.IDisposable { public FixtureData() { AccountsFeature.FeatureSetup(); } void System.IDisposable.Dispose() { AccountsFeature.FeatureTearDown(); } } } } #pragma warning restore #endregion
46.313505
239
0.491582
[ "Apache-2.0" ]
LaTranche31/SimpleIdServer
tests/SimpleIdServer.OpenBankingApi.Host.Acceptance.Tests/Features/Accounts.feature.cs
28,809
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using BluffinMuffin.Logger.Monitor.DataTypes; using BluffinMuffin.Logger.Monitor.DataTypes.Enums; using BluffinMuffin.Logger.Monitor.ViewModels.Entities.DataElements; using BluffinMuffin.Logger.Monitor.ViewModels.Entities.GlobalElements; using Com.Ericmas001.AppMonitor.DataTypes.DataElements; using Com.Ericmas001.AppMonitor.DataTypes.GlobalElements; using Com.Ericmas001.AppMonitor.DataTypes.TreeElements; using Com.Ericmas001.Portable.Util.Entities; using Com.Ericmas001.Wpf.ViewModels.Trees; namespace BluffinMuffin.Logger.Monitor.ViewModels.Entities.TreeElements { public class ExecutedCommandBranch : BaseCategoryBranchTreeElement<LogCategoryEnum, CriteriaEnum> { protected override string BranchName { get { //if (SearchCriteria == CriteriaEnum.SessionId) //{ // ExecutedCommandLeaf leaf = FirstLeafInTime(); // return String.Format(leaf.DataItem.ObtainDateTime(UsedCriterias.Except(new[] { SearchCriteria })) + leaf.DataItem.ObtainRealName(UsedCriterias.Except(new[] { SearchCriteria })) + leaf.DataItem.ObtainUserAgent(50)); //} return base.BranchName; } } private ExecutedCommandLeaf FirstLeafInTime() { return TreeLeaves.OfType<ExecutedCommandLeaf>().OrderBy(x => x.DataItem.DateAndTime).First(); } public ExecutedCommandBranch(TreeElementViewModel parent, IEnumerable<CriteriaEnum> usedCriterias, CriteriaEnum searchCriteria, LogCategoryEnum category) : base(parent, usedCriterias, searchCriteria, category) { } protected override IEnumerable<BaseGlobalElement> SetTabs() { var list = new List<BaseGlobalElement>(); list.Add(new ExecutedCommandsGridOfLeaves(this)); list.AddRange(base.SetTabs()); return list; } } }
39.769231
236
0.695358
[ "MIT" ]
BluffinMuffin/BluffinMuffin.Logger
C#/BluffinMuffin.Logger.Monitor/ViewModels/Entities/TreeElements/ExecutedCommandBranch.cs
2,070
C#
using Core.Misc; using System.Collections.Generic; using System.Linq; using System.Text; namespace CentralServer.User { public class CSUserMgr { public enum Channel { Web, WXMini } public enum Browser { Chrome = 0, Firefox = 1, Safair = 2, Edge = 3, IE = 4 } public enum Platform { PC = 0, Android = 1, IOS = 2, WP = 3 } /// <summary> /// ukey到玩家的映射 /// </summary> private readonly Dictionary<uint, CSUser> _ukeyToUser = new Dictionary<uint, CSUser>(); /// <summary> /// 网络ID到玩家的映射 /// </summary> private readonly Dictionary<ulong, CSUser> _gcNIDToUser = new Dictionary<ulong, CSUser>(); /// <summary> /// 认证玩家列表 /// 由LS提交的登陆凭证,用于验证客户端登陆CS /// </summary> private readonly List<CSUser> _authUsers = new List<CSUser>(); /// <summary> /// 玩家数量 /// </summary> public int count { get { System.Diagnostics.Debug.Assert( this._ukeyToUser.Count == this._gcNIDToUser.Count, $"k:{this._ukeyToUser.Count}, g:{this._gcNIDToUser.Count}" ); return this._ukeyToUser.Count; } } public bool HasUser( ulong gcNID ) => this._gcNIDToUser.ContainsKey( gcNID ); public bool HasUser( uint ukey ) => this._ukeyToUser.ContainsKey( ukey ); /// <summary> /// 获取指定网络ID的玩家 /// </summary> public CSUser GetUser( ulong gcNID ) { this._gcNIDToUser.TryGetValue( gcNID, out CSUser user ); return user; } /// <summary> /// 获取指定ukey的玩家 /// </summary> public CSUser GetUser( uint ukey ) { this._ukeyToUser.TryGetValue( ukey, out CSUser user ); return user; } /// <summary> /// 获取指定ukey的玩家 /// </summary> public CSUser GetUserByUKey( uint ukey ) => this.GetUser( ukey ); /// <summary> /// 获取指定网络ID的玩家 /// </summary> public CSUser GetUserByGcNID( ulong gcNID ) => this.GetUser( gcNID ); /// <summary> /// 创建玩家登陆凭证 /// </summary> internal CSUser CreateUser( Protos.LS2CS_GCLogin gcLogin ) { CSUser user = this.GetUser( gcLogin.Ukey ); if ( user == null ) { user = new CSUser(); this._ukeyToUser[gcLogin.Ukey] = user; this._authUsers.Add( user ); } else { //处理顶号 if ( user.isConnected ) this.KickUser( user, ( int )Protos.CS2GS_KickGC.Types.EReason.DuplicateLogin ); this._gcNIDToUser.Remove( user.gcNID ); } user.OnCreate( gcLogin, TimeUtils.utcTime ); this._gcNIDToUser[gcLogin.GcNID] = user; Logger.Info( $"user:{user.gcNID} was created" ); return user; } /// <summary> /// 注销玩家 /// </summary> internal void DestroyUser( CSUser user ) { System.Diagnostics.Debug.Assert( !user.isConnected, $"user:{user.gcNID} still online" ); //如果玩家在战场则不销毁,留待战场结束再判断是否在线,不在线再行销毁 if ( user.isInBattle ) return; this._gcNIDToUser.Remove( user.gcNID ); this._ukeyToUser.Remove( user.ukey ); Logger.Log( $"destroy user:{user.gcNID}" ); } /// <summary> /// 玩家上线 /// </summary> internal CSUser Online( ulong gcNID, uint sid, uint lid ) { //先验证是否合法登陆 CSUser user = this.GetUser( gcNID ); if ( user == null ) return null; user.Online( sid, lid ); this._authUsers.Remove( user ); Logger.Info( $"user:{gcNID}({lid}) online" ); return user; } /// <summary> /// 玩家下线 /// </summary> internal void Offline( CSUser user ) { Logger.Info( $"user:{user.gcNID}({user.gsLID}) offline" ); //从匹配系统中移除 CS.instance.matchMgr.Leave( user ); CS.instance.roomMgr.Leave( user ); //玩家下线 user.Offline(); } /// <summary> /// 玩家下线 /// </summary> internal bool Offline( ulong gcNID ) { CSUser user = this.GetUser( gcNID ); if ( user == null ) { Logger.Warn( $"can not find user:{gcNID}" ); return false; } this.Offline( user ); return true; } /// <summary> /// 断开指定玩家连接,由Session在连接关闭时调用 /// </summary> internal bool KickUser( ulong gcNID, Protos.CS2GS_KickGC.Types.EReason reason ) { CSUser user = this.GetUser( gcNID ); if ( user == null ) { Logger.Warn( $"can not find user:{gcNID}" ); return false; } this.KickUser( user, reason ); return true; } internal void KickUser( CSUser user, Protos.CS2GS_KickGC.Types.EReason reason ) { //通知gs玩家被踢下线 Protos.CS2GS_KickGC kickGc = ProtoCreator.Q_CS2GS_KickGC(); kickGc.GcNID = user.gcNID; kickGc.Reason = reason; CS.instance.netSessionMgr.Send( user.gsSID, kickGc ); this.Offline( user ); } /// <summary> /// 踢走连接到指定逻辑ID的GS的所有玩家 /// 当GS丢失连接时调用 /// </summary> internal void OnGSDisconnect( uint gsLID ) { CSUser[] users = this._gcNIDToUser.Values.ToArray(); int count = users.Length; for ( int i = 0; i < count; i++ ) { CSUser user = users[i]; if ( user.gsLID != gsLID ) continue; //下线玩家 this.Offline( user ); //注销玩家 this.DestroyUser( user ); } } /// <summary> /// 心跳回调 /// </summary> internal void OnHeartBeat( long dt ) { long currTime = TimeUtils.utcTime; long expTime = CS.instance.config.sessionExpTime; int count = this._authUsers.Count; for ( int i = 0; i < count; i++ ) { CSUser user = this._authUsers[i]; if ( currTime < user.loginTime + expTime ) continue; //销毁玩家,DestroyUser逻辑一致 this._gcNIDToUser.Remove( user.gcNID ); this._ukeyToUser.Remove( user.ukey ); this._authUsers.RemoveAt( i ); --i; --count; Logger.Log( $"user:{user.gcNID} expired" ); } } /// <summary> /// 以字符串的形式返回玩家信息 /// </summary> public string LS() { SortedDictionary<ulong, CSUser> map = new SortedDictionary<ulong, CSUser>( this._gcNIDToUser ); StringBuilder sb = new StringBuilder(); foreach ( KeyValuePair<ulong, CSUser> kv in map ) sb.AppendLine( kv.Key.ToString() ); sb.AppendLine( $"count:{this.count}" ); return sb.ToString(); } } }
22.893281
149
0.62241
[ "MIT" ]
niuniuzhu/KOW
Server/CentralServer/User/CSUserMgr.cs
6,262
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: AssemblyCulture("")] [assembly: InternalsVisibleTo("Snowflake.Support.StoreProviders")] [assembly: InternalsVisibleTo("Snowflake.Support.StoneProvider")] [assembly: InternalsVisibleTo("Snowflake.Support.PluginManager")] [assembly: InternalsVisibleTo("Snowflake.Support.InputEnumerators.Windows")] [assembly: InternalsVisibleTo("Snowflake.Support.InputEnumerators.Linux")] [assembly: InternalsVisibleTo("Snowflake.Support.GraphQL.FrameworkQueries")] [assembly: InternalsVisibleTo("Snowflake.Framework.Services")] [assembly: InternalsVisibleTo("Snowflake.Framework.Tests")] // 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("8495544d-eebb-42e8-9c16-cb4f18dc39ed")]
48.384615
84
0.806041
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
SnowflakePowered/snowflake
src/Snowflake.Framework/AssemblyInfo.cs
1,260
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft; using Microsoft.VisualStudio.ComponentModelHost; using NuGet.Commands; using NuGet.Common; using NuGet.Frameworks; using NuGet.LibraryModel; using NuGet.ProjectManagement; using NuGet.ProjectModel; using NuGet.Versioning; using NuGet.VisualStudio; using VSLangProj150; using Task = System.Threading.Tasks.Task; namespace NuGet.PackageManagement.VisualStudio { /// <summary> /// Contains the information specific to a Visual Basic or C# project. /// </summary> internal class VsManagedLanguagesProjectSystemServices : GlobalProjectServiceProvider , INuGetProjectServices , IProjectSystemCapabilities , IProjectSystemReferencesReader , IProjectSystemReferencesService { private static readonly Array ReferenceMetadata; private readonly IVsProjectAdapter _vsProjectAdapter; private readonly IVsProjectThreadingService _threadingService; private readonly Lazy<VSProject4> _asVSProject4; private VSProject4 AsVSProject4 => _asVSProject4.Value; public bool SupportsPackageReferences => true; public bool NominatesOnSolutionLoad { get; private set; } = false; #region INuGetProjectServices public IProjectBuildProperties BuildProperties => _vsProjectAdapter.BuildProperties; public IProjectSystemCapabilities Capabilities => this; public IProjectSystemReferencesReader ReferencesReader => this; public IProjectSystemReferencesService References => this; public IProjectSystemService ProjectSystem => throw new NotSupportedException(); public IProjectScriptHostService ScriptService { get; } #endregion INuGetProjectServices static VsManagedLanguagesProjectSystemServices() { ReferenceMetadata = Array.CreateInstance(typeof(string), 6); ReferenceMetadata.SetValue(ProjectItemProperties.IncludeAssets, 0); ReferenceMetadata.SetValue(ProjectItemProperties.ExcludeAssets, 1); ReferenceMetadata.SetValue(ProjectItemProperties.PrivateAssets, 2); ReferenceMetadata.SetValue(ProjectItemProperties.NoWarn, 3); ReferenceMetadata.SetValue(ProjectItemProperties.GeneratePathProperty, 4); ReferenceMetadata.SetValue(ProjectItemProperties.Aliases, 5); } [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD010:Invoke single-threaded types on Main thread", Justification = "https://github.com/NuGet/Home/issues/10933")] public VsManagedLanguagesProjectSystemServices( IVsProjectAdapter vsProjectAdapter, IComponentModel componentModel, bool nominatesOnSolutionLoad) : base(componentModel) { Assumes.Present(vsProjectAdapter); _vsProjectAdapter = vsProjectAdapter; _threadingService = GetGlobalService<IVsProjectThreadingService>(); Assumes.Present(_threadingService); _asVSProject4 = new Lazy<VSProject4>(() => vsProjectAdapter.Project.Object as VSProject4); ScriptService = new VsProjectScriptHostService(vsProjectAdapter, this); NominatesOnSolutionLoad = nominatesOnSolutionLoad; } public async Task<IEnumerable<LibraryDependency>> GetPackageReferencesAsync( NuGetFramework targetFramework, CancellationToken _) { Assumes.Present(targetFramework); await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); var installedPackages = AsVSProject4.PackageReferences?.InstalledPackages; if (installedPackages == null) { return Array.Empty<LibraryDependency>(); } bool isCpvmEnabled = await IsCentralPackageManagementVersionsEnabledAsync(); var references = installedPackages .Cast<string>() .Where(r => !string.IsNullOrEmpty(r)) .Select(installedPackage => { if (AsVSProject4.PackageReferences.TryGetReference( installedPackage, ReferenceMetadata, out var version, out var metadataElements, out var metadataValues)) { return new PackageReference( name: installedPackage, version: version, metadataElements: metadataElements, metadataValues: metadataValues, targetNuGetFramework: targetFramework); } return null; }) .Where(p => p != null) .Select(p => ToPackageLibraryDependency(p, isCpvmEnabled)); return references.ToList(); } public async Task<IEnumerable<ProjectRestoreReference>> GetProjectReferencesAsync( ILogger _, CancellationToken __) { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); if (AsVSProject4.References == null) { return Array.Empty<ProjectRestoreReference>(); } var references = new List<ProjectRestoreReference>(); foreach (Reference6 r in AsVSProject4.References.Cast<Reference6>()) { if (r.SourceProject != null && await EnvDTEProjectUtility.IsSupportedAsync(r.SourceProject)) { Array metadataElements; Array metadataValues; r.GetMetadata(ReferenceMetadata, out metadataElements, out metadataValues); references.Add(ToProjectRestoreReference(new ProjectReference( uniqueName: r.SourceProject.FullName, metadataElements: metadataElements, metadataValues: metadataValues))); } } return references; } private static ProjectRestoreReference ToProjectRestoreReference(ProjectReference item) { var reference = new ProjectRestoreReference { ProjectUniqueName = item.UniqueName, ProjectPath = item.UniqueName }; MSBuildRestoreUtility.ApplyIncludeFlags( reference, GetReferenceMetadataValue(item, ProjectItemProperties.IncludeAssets), GetReferenceMetadataValue(item, ProjectItemProperties.ExcludeAssets), GetReferenceMetadataValue(item, ProjectItemProperties.PrivateAssets)); return reference; } private static string GetReferenceMetadataValue(ProjectReference reference, string metadataElement) { Assumes.Present(reference); Assumes.NotNullOrEmpty(metadataElement); if (reference.MetadataElements == null || reference.MetadataValues == null) { return string.Empty; // no metadata for package } var index = Array.IndexOf(reference.MetadataElements, metadataElement); if (index >= 0) { return reference.MetadataValues.GetValue(index) as string; } return string.Empty; } private static LibraryDependency ToPackageLibraryDependency(PackageReference reference, bool isCpvmEnabled) { var dependency = new LibraryDependency { AutoReferenced = MSBuildStringUtility.IsTrue(GetReferenceMetadataValue(reference, ProjectItemProperties.IsImplicitlyDefined)), GeneratePathProperty = MSBuildStringUtility.IsTrue(GetReferenceMetadataValue(reference, ProjectItemProperties.GeneratePathProperty)), Aliases = GetReferenceMetadataValue(reference, ProjectItemProperties.Aliases, defaultValue: null), LibraryRange = new LibraryRange( name: reference.Name, versionRange: ToVersionRange(reference.Version, isCpvmEnabled), typeConstraint: LibraryDependencyTarget.Package) }; MSBuildRestoreUtility.ApplyIncludeFlags( dependency, GetReferenceMetadataValue(reference, ProjectItemProperties.IncludeAssets), GetReferenceMetadataValue(reference, ProjectItemProperties.ExcludeAssets), GetReferenceMetadataValue(reference, ProjectItemProperties.PrivateAssets)); // Add warning suppressions foreach (var code in MSBuildStringUtility.GetNuGetLogCodes(GetReferenceMetadataValue(reference, ProjectItemProperties.NoWarn))) { dependency.NoWarn.Add(code); } return dependency; } private static VersionRange ToVersionRange(string version, bool isCpvmEnabled) { if (string.IsNullOrEmpty(version)) { if (isCpvmEnabled) { // Projects that have their packages managed centrally will not have Version metadata on PackageReference items. return null; } else { return VersionRange.All; } } return VersionRange.Parse(version); } private static string GetReferenceMetadataValue(PackageReference reference, string metadataElement, string defaultValue = "") { Assumes.Present(reference); Assumes.NotNullOrEmpty(metadataElement); if (reference.MetadataElements == null || reference.MetadataValues == null) { return defaultValue; // no metadata for package } var index = Array.IndexOf(reference.MetadataElements, metadataElement); if (index >= 0) { return reference.MetadataValues.GetValue(index) as string; } return defaultValue; } public async Task AddOrUpdatePackageReferenceAsync(LibraryDependency packageReference, CancellationToken _) { Assumes.Present(packageReference); await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); var includeFlags = packageReference.IncludeType; var privateAssetsFlag = packageReference.SuppressParent; var metadataElements = new List<string>(); var metadataValues = new List<string>(); if (includeFlags != LibraryIncludeFlags.All) { metadataElements.Add(ProjectItemProperties.IncludeAssets); metadataValues.Add(LibraryIncludeFlagUtils.GetFlagString(includeFlags).Replace(',', ';')); } if (privateAssetsFlag != LibraryIncludeFlagUtils.DefaultSuppressParent) { metadataElements.Add(ProjectItemProperties.PrivateAssets); metadataValues.Add(LibraryIncludeFlagUtils.GetFlagString(privateAssetsFlag).Replace(',', ';')); } AddOrUpdatePackageReference( packageReference.Name, packageReference.LibraryRange.VersionRange, metadataElements.ToArray(), metadataValues.ToArray()); } private void AddOrUpdatePackageReference(string packageName, VersionRange packageVersion, string[] metadataElements, string[] metadataValues) { _threadingService.ThrowIfNotOnUIThread(); // Note that API behavior is: // - specify a metadata element name with a value => add/replace that metadata item on the package reference // - specify a metadata element name with no value => remove that metadata item from the project reference // - don't specify a particular metadata name => if it exists on the package reference, don't change it (e.g. for user defined metadata) AsVSProject4.PackageReferences.AddOrUpdate( packageName, packageVersion.OriginalString ?? packageVersion.ToShortString(), metadataElements, metadataValues); } public async Task RemovePackageReferenceAsync(string packageName) { Assumes.NotNullOrEmpty(packageName); await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); AsVSProject4.PackageReferences.Remove(packageName); } private async Task<bool> IsCentralPackageManagementVersionsEnabledAsync() { return MSBuildStringUtility.IsTrue(await _vsProjectAdapter.GetPropertyValueAsync(ProjectBuildProperties.ManagePackageVersionsCentrally)); } private class ProjectReference { public ProjectReference(string uniqueName, Array metadataElements, Array metadataValues) { UniqueName = uniqueName; MetadataElements = metadataElements; MetadataValues = metadataValues; } public string UniqueName { get; } public Array MetadataElements { get; } public Array MetadataValues { get; } } private class PackageReference { public PackageReference( string name, string version, Array metadataElements, Array metadataValues, NuGetFramework targetNuGetFramework) { Name = name; Version = version; MetadataElements = metadataElements; MetadataValues = metadataValues; TargetNuGetFramework = targetNuGetFramework; } public string Name { get; } public string Version { get; } public Array MetadataElements { get; } public Array MetadataValues { get; } public NuGetFramework TargetNuGetFramework { get; } } } }
39.821918
185
0.628483
[ "Apache-2.0" ]
BlackGad/NuGet.Client
src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/ProjectServices/VsManagedLanguagesProjectSystemServices.cs
14,535
C#
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("UnShape")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UnShape")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] //若要开始生成可本地化的应用程序,请设置 //.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture> //例如,如果您在源文件中使用的是美国英语, //使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消 //对以下 NeutralResourceLanguage 特性的注释。 更新 //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //主题特定资源词典所处位置 //(未在页面中找到资源时使用, //或应用程序资源字典中找到时使用) ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 //(未在页面中找到资源时使用, //、应用程序或任何主题专用资源字典中找到时使用) )] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
28.464286
91
0.664366
[ "Apache-2.0" ]
BenDerPan/UnShapes
UnShape/UnShape/Properties/AssemblyInfo.cs
2,253
C#
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Project1.WebUI.Models; namespace Project1.WebUI.Controllers { public class HomeController : Controller { /// <summary> /// Default Controller and initial entry point of the program. /// The Index resets the error cookies and displays the front page. /// </summary> /// <returns>Index View</returns> public IActionResult Index() { HttpContext.Response.Cookies.Append("error", ""); return View(); } /// <summary> /// Default MVC Privacy Page. /// </summary> /// <returns></returns> public IActionResult Privacy() { return View(); } /// <summary> /// Default MVC Error Action Method. /// </summary> /// <returns></returns> [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } } }
29.906977
112
0.598756
[ "MIT" ]
2002-feb24-net/jacob-project1
Project1.WebUI/Controllers/HomeController.cs
1,288
C#
using System; using System.Collections; using System.Data; using System.Data.SqlClient; namespace Wid.Data { public class LineupPhotoLink : Core.DataClass { #region constructor public LineupPhotoLink() : base() {} #endregion #region Create public int Create(int LineupId, int PhotoId) { SqlParameter[] parameters = { new SqlParameter("@LineupId", LineupId), new SqlParameter("@PhotoId", PhotoId)}; LineupPhotoLink x = new LineupPhotoLink(); return (int)x.ExecNonQuery("a_LineupPhotoLink_Create", parameters); } #endregion #region CreateAllByLineup public int CreateAllByLineup(int LineupId) { SqlParameter[] parameters = {new SqlParameter("@LineupId", LineupId)}; LineupPhotoLink x = new LineupPhotoLink(); return (int)x.ExecNonQuery("a_LineupPhotoLink_CreateAllByLineup", parameters); } #endregion #region CreateAllByPhoto public int CreateAllByPhoto(int PhotoId) { SqlParameter[] parameters = {new SqlParameter("@PhotoId", PhotoId)}; LineupPhotoLink x = new LineupPhotoLink(); return (int)x.ExecNonQuery("a_LineupPhotoLink_CreateAllByPhoto", parameters); } #endregion #region UpdateByLineup public void UpdateByLineup(int LineupId, ArrayList toDelete, ArrayList toAdd) { for (int i=0; i<toDelete.Count; i++) Delete(LineupId, Convert.ToInt32(toDelete[i])); for (int i=0; i<toAdd.Count; i++) Create(LineupId, Convert.ToInt32(toAdd[i])); } #endregion #region UpdateByPhoto public void UpdateByPhoto(int PhotoId, ArrayList toDelete, ArrayList toAdd) { for (int i=0; i<toDelete.Count; i++) Delete(Convert.ToInt32(toDelete[i]), PhotoId); for (int i=0; i<toAdd.Count; i++) Create(Convert.ToInt32(toAdd[i]), PhotoId); } #endregion #region Delete public int Delete(int LineupId, int PhotoId) { SqlParameter[] parameters = { new SqlParameter("@LineupId", LineupId), new SqlParameter("@PhotoId", PhotoId)}; LineupPhotoLink x = new LineupPhotoLink(); return (int)x.ExecNonQuery("a_LineupPhotoLink_Delete", parameters); } #endregion #region DeleteAllByLineup public int DeleteAllByLineup(int LineupId) { SqlParameter[] parameters = {new SqlParameter("@LineupId", LineupId)}; LineupPhotoLink x = new LineupPhotoLink(); return (int)x.ExecNonQuery("a_LineupPhotoLink_DeleteAllByLineup", parameters); } #endregion #region DeleteAllByPhoto public int DeleteAllByPhoto(int PhotoId) { SqlParameter[] parameters = {new SqlParameter("@PhotoId", PhotoId)}; LineupPhotoLink x = new LineupPhotoLink(); return (int)x.ExecNonQuery("a_LineupPhotoLink_DeleteAllByPhoto", parameters); } #endregion } }
27.670103
81
0.718703
[ "MIT" ]
ic4f/codegenerator
demo/generated_code/witness_id.cs/LineupPhotoLink.cs
2,684
C#
using System; using System.Collections.Generic; using System.Linq; using VXDesign.Store.DevTools.Common.Core.Extensions; using VXDesign.Store.DevTools.Common.Core.HTTP; namespace VXDesign.Store.DevTools.Common.Clients.Camunda.Endpoints { public class CamundaEndpoint { public int ActionCode { get; } public string CategoryName { get; } public string ActionName { get; } public HttpMethod Method { get; } public string Path { get; } private CamundaEndpoint(CamundaAction camundaAction, CamundaCategoryAttribute camundaCategoryAttribute, CamundaActionAttribute camundaActionAttribute) { ActionCode = (int) camundaAction; CategoryName = camundaCategoryAttribute.Name; ActionName = camundaActionAttribute.Description; Method = camundaActionAttribute.Method; Path = $"/{camundaCategoryAttribute.Root}{(!string.IsNullOrWhiteSpace(camundaActionAttribute.Path) ? '/' + camundaActionAttribute.Path : "")}"; } private static IEnumerable<CamundaEndpoint> GetEndpoints(Func<CamundaAction, bool> predicate = null) { return from category in EnumExtensions.GetValues<CamundaCategory>() let allActions = EnumExtensions.GetValues<CamundaAction>().Where(predicate ?? (action => true)) let allActionsAndAttributes = allActions.Select(action => ( action, attributes: action.GetAttributesOfType<CamundaActionAttribute>() )) from actionAndAttributes in allActionsAndAttributes from actionAttribute in actionAndAttributes.attributes where actionAttribute.CamundaCategory == category let categoryAttribute = actionAttribute.CamundaCategory.GetAttributeOfType<CamundaCategoryAttribute>() select new CamundaEndpoint(actionAndAttributes.action, categoryAttribute, actionAttribute); } public static IEnumerable<CamundaEndpoint> GetAll() => GetEndpoints().ToList(); public static CamundaEndpoint GetEndpoint(CamundaAction camundaAction) => GetEndpoints(action => action == camundaAction).FirstOrDefault(); } }
48.361702
158
0.683238
[ "MIT" ]
GUSAR1T0/VXDS-DEV-TOOLS
DevTools/Common/Clients/Camunda/Endpoints/CamundaEndpoint.cs
2,273
C#
using System; namespace OwinFramework.Pages.Core.Exceptions { /// <summary> /// Thrown by the name manager when there are naming /// conflicts or name resolution failures /// </summary> public class NameManagerException: Exception { /// <summary> /// Constructs a NameManagerException /// </summary> public NameManagerException() : base() { } /// <summary> /// Constructs a NameManagerException /// </summary> public NameManagerException(string message) : base(message) { } /// <summary> /// Constructs a NameManagerException /// </summary> public NameManagerException(string message, Exception innerException) : base(message, innerException) { } } }
27.266667
77
0.58802
[ "Apache-2.0" ]
forki/OwinFramework.Pages
OwinFramework.Pages.Core/Exceptions/NameManagerException.cs
820
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; [assembly: SkipOnMono("System.Net.Ping is not supported on Browser", TestPlatforms.Browser)]
35
92
0.771429
[ "MIT" ]
2m0nd/runtime
src/libraries/System.Net.Ping/tests/FunctionalTests/AssemblyInfo.cs
245
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Runtime.InteropServices; using System.Collections; using System.DirectoryServices.Interop; using System.Globalization; namespace System.DirectoryServices { /// <devdoc> /// Contains the properties on a <see cref='System.DirectoryServices.DirectoryEntry'/>. /// </devdoc> public class PropertyCollection : IDictionary { private readonly DirectoryEntry _entry; internal readonly Hashtable valueTable = null; internal PropertyCollection(DirectoryEntry entry) { _entry = entry; Hashtable tempTable = new Hashtable(); valueTable = Hashtable.Synchronized(tempTable); } /// <devdoc> /// Gets the property with the given name. /// </devdoc> public PropertyValueCollection this[string propertyName] { get { if (propertyName == null) throw new ArgumentNullException(nameof(propertyName)); string name = propertyName.ToLower(CultureInfo.InvariantCulture); if (valueTable.Contains(name)) return (PropertyValueCollection)valueTable[name]; else { PropertyValueCollection value = new PropertyValueCollection(_entry, propertyName); valueTable.Add(name, value); return value; } } } /// <devdoc> /// Gets the number of properties available on this entry. /// </devdoc> public int Count { get { if (!(_entry.AdsObject is UnsafeNativeMethods.IAdsPropertyList)) throw new NotSupportedException(SR.DSCannotCount); _entry.FillCache(""); UnsafeNativeMethods.IAdsPropertyList propList = (UnsafeNativeMethods.IAdsPropertyList)_entry.AdsObject; return propList.PropertyCount; } } /// </devdoc> public ICollection PropertyNames => new KeysCollection(this); public ICollection Values => new ValuesCollection(this); public bool Contains(string propertyName) { object var; int unmanagedResult = _entry.AdsObject.GetEx(propertyName, out var); if (unmanagedResult != 0) { // property not found (IIS provider returns 0x80005006, other provides return 0x8000500D). if ((unmanagedResult == unchecked((int)0x8000500D)) || (unmanagedResult == unchecked((int)0x80005006))) { return false; } else { throw COMExceptionHelper.CreateFormattedComException(unmanagedResult); } } return true; } /// <devdoc> /// Copies the elements of this instance into an <see cref='System.Array'/>, starting at a particular index into the array. /// </devdoc> public void CopyTo(PropertyValueCollection[] array, int index) { ((ICollection)this).CopyTo((Array)array, index); } /// <devdoc> /// Returns an enumerator, which can be used to iterate through the collection. /// </devdoc> public IDictionaryEnumerator GetEnumerator() { if (!(_entry.AdsObject is UnsafeNativeMethods.IAdsPropertyList)) throw new NotSupportedException(SR.DSCannotEmunerate); // Once an object has been used for an enumerator once, it can't be used again, because it only // maintains a single cursor. Re-bind to the ADSI object to get a new instance. // That's why we must clone entry here. It will be automatically disposed inside Enumerator. DirectoryEntry entryToUse = _entry.CloneBrowsable(); entryToUse.FillCache(""); UnsafeNativeMethods.IAdsPropertyList propList = (UnsafeNativeMethods.IAdsPropertyList)entryToUse.AdsObject; entryToUse.propertiesAlreadyEnumerated = true; return new PropertyEnumerator(_entry, entryToUse); } object IDictionary.this[object key] { get => this[(string)key]; set => throw new NotSupportedException(SR.DSPropertySetSupported); } bool IDictionary.IsFixedSize => true; bool IDictionary.IsReadOnly => true; ICollection IDictionary.Keys => new KeysCollection(this); void IDictionary.Add(object key, object value) { throw new NotSupportedException(SR.DSAddNotSupported); } void IDictionary.Clear() { throw new NotSupportedException(SR.DSClearNotSupported); } bool IDictionary.Contains(object value) => Contains((string)value); void IDictionary.Remove(object key) { throw new NotSupportedException(SR.DSRemoveNotSupported); } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; void ICollection.CopyTo(Array array, Int32 index) { if (array == null) throw new ArgumentNullException(nameof(array)); if (array.Rank != 1) throw new ArgumentException(SR.OnlyAllowSingleDimension, nameof(array)); if (index < 0) throw new ArgumentOutOfRangeException(SR.LessThanZero, nameof(index)); if (((index + Count) > array.Length) || ((index + Count) < index)) throw new ArgumentException(SR.DestinationArrayNotLargeEnough); foreach (PropertyValueCollection value in this) { array.SetValue(value, index); index++; } } private class PropertyEnumerator : IDictionaryEnumerator, IDisposable { private DirectoryEntry _entry; // clone (to be disposed) private DirectoryEntry _parentEntry; // original entry to pass to PropertyValueCollection private string _currentPropName = null; public PropertyEnumerator(DirectoryEntry parent, DirectoryEntry clone) { _entry = clone; _parentEntry = parent; } ~PropertyEnumerator() => Dispose(true); public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { _entry.Dispose(); } } public object Current => Entry.Value; public DictionaryEntry Entry { get { if (_currentPropName == null) throw new InvalidOperationException(SR.DSNoCurrentProperty); return new DictionaryEntry(_currentPropName, new PropertyValueCollection(_parentEntry, _currentPropName)); } } public object Key => Entry.Key; public object Value => Entry.Value; public bool MoveNext() { object prop; int hr = 0; try { hr = ((UnsafeNativeMethods.IAdsPropertyList)_entry.AdsObject).Next(out prop); } catch (COMException e) { hr = e.ErrorCode; prop = null; } if (hr == 0) { if (prop != null) _currentPropName = ((UnsafeNativeMethods.IAdsPropertyEntry)prop).Name; else _currentPropName = null; return true; } else { _currentPropName = null; return false; } } public void Reset() { ((UnsafeNativeMethods.IAdsPropertyList)_entry.AdsObject).Reset(); _currentPropName = null; } } private class ValuesCollection : ICollection { protected PropertyCollection props; public ValuesCollection(PropertyCollection props) { this.props = props; } public int Count => props.Count; public bool IsReadOnly => true; public bool IsSynchronized => false; public object SyncRoot => ((ICollection)props).SyncRoot; public void CopyTo(Array array, int index) { foreach (object value in this) array.SetValue(value, index++); } public virtual IEnumerator GetEnumerator() => new ValuesEnumerator(props); } private class KeysCollection : ValuesCollection { public KeysCollection(PropertyCollection props) : base(props) { } public override IEnumerator GetEnumerator() { props._entry.FillCache(""); return new KeysEnumerator(props); } } private class ValuesEnumerator : IEnumerator { private int _currentIndex = -1; protected PropertyCollection propCollection; public ValuesEnumerator(PropertyCollection propCollection) { this.propCollection = propCollection; } protected int CurrentIndex { get { if (_currentIndex == -1) throw new InvalidOperationException(SR.DSNoCurrentValue); return _currentIndex; } } public virtual object Current { get { UnsafeNativeMethods.IAdsPropertyList propList = (UnsafeNativeMethods.IAdsPropertyList)propCollection._entry.AdsObject; return propCollection[((UnsafeNativeMethods.IAdsPropertyEntry)propList.Item(CurrentIndex)).Name]; } } public bool MoveNext() { _currentIndex++; if (_currentIndex >= propCollection.Count) { _currentIndex = -1; return false; } else return true; } public void Reset() => _currentIndex = -1; } private class KeysEnumerator : ValuesEnumerator { public KeysEnumerator(PropertyCollection collection) : base(collection) { } public override object Current { get { UnsafeNativeMethods.IAdsPropertyList propList = (UnsafeNativeMethods.IAdsPropertyList)propCollection._entry.AdsObject; return ((UnsafeNativeMethods.IAdsPropertyEntry)propList.Item(CurrentIndex)).Name; } } } } }
32.614525
138
0.538712
[ "MIT" ]
lukas-lansky/corefx
src/System.DirectoryServices/src/System/DirectoryServices/PropertyCollection.cs
11,676
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 // 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 // 이러한 특성 값을 변경하세요. [assembly: AssemblyTitle("Memory_Policy_Simulator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Memory_Policy_Simulator")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 // 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. [assembly: ComVisible(false)] // 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. [assembly: Guid("23fadfbc-2e9f-47c3-8215-89ba0264fde7")] // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. // // 주 버전 // 부 버전 // 빌드 번호 // 수정 버전 // // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로 // 지정되도록 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
30.189189
57
0.68308
[ "MIT" ]
ImMoa/Memory-Policy-Simulator
Properties/AssemblyInfo.cs
1,558
C#
namespace BCKFreightTMS.Web.ViewModels.Settings { using BCKFreightTMS.Services.Mapping; public class CargoTypeViewModel<T> : IMapFrom<T> { public int Id { get; set; } public string Name { get; set; } public string AdminId { get; set; } } }
20.285714
52
0.630282
[ "MIT" ]
MMSlavov/BCKFreight
src/Web/BCKFreightTMS.Web.ViewModels/Settings/CargoTypeViewModel.cs
286
C#
using Chinook.Application; using Chinook.Data; using EasyLOB; using System; using System.IO; using System.Reflection; namespace Chinook.Service { public partial class ChinookServiceHelper { #region Methods public static string ExportGenreTXT() { LogManager.Trace(GetLog("Export Genre TXT", "Start")); string filePath = ""; try { string exePath = Assembly.GetExecutingAssembly().Location; FileSystemInfo exeFileInfo = new FileInfo(exePath); string fileDirectory = Path.Combine(Path.GetDirectoryName(exePath), ConfigurationHelper.AppSettings<string>("DirectoryExport")); ZOperationResult operationResult = new ZOperationResult(); IChinookApplication application = DIHelper.GetService<IChinookApplication>(); IChinookGenericApplication<Genre> genreApplication = DIHelper.GetService<IChinookGenericApplication<Genre>>(); // Clean Z-Export application.Clean(operationResult, fileDirectory); // Text File LogManager.Trace(GetLog("Export Genre", "Text File")); if (!application.ExportGenreTXT(operationResult, fileDirectory, genreApplication, out filePath)) { LogManager.OperationResult(new ZOperationResultLog("", "", "", operationResult)); } } catch (Exception exception) { LogManager.Exception(exception, ""); } LogManager.Trace(GetLog("Export Genre", "Stop")); return filePath; } #endregion Methods } }
32.214286
145
0.574834
[ "MIT" ]
EasyLOB/EasyLOB-Chinook-2
Chinook.Service/ChinookServiceHelper.TXT.cs
1,806
C#
/* *************************************************************************** * This file is part of SharpNEAT - Evolution of Neural Networks. * * Copyright 2004-2006, 2009-2010 Colin Green (sharpneat@gmail.com) * * SharpNEAT is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * SharpNEAT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with SharpNEAT. If not, see <http://www.gnu.org/licenses/>. */ using System.Collections.Generic; using System.Threading.Tasks; using System.Xml; using log4net; using SharpNeat.Core; using SharpNeat.Decoders; using SharpNeat.Decoders.Neat; using SharpNeat.DistanceMetrics; using SharpNeat.EvolutionAlgorithms; using SharpNeat.EvolutionAlgorithms.ComplexityRegulation; using SharpNeat.Genomes.Neat; using SharpNeat.Phenomes; using SharpNeat.SpeciationStrategies; using SharpNeat.Genomes.RbfNeat; using SharpNeat.Network; namespace SharpNeat.Domains.BinarySixMultiplexer { /// <summary> /// Binary 6-multiplexer task. /// </summary> public class RbfBinarySixMultiplexerExperiment : IGuiNeatExperiment { private static readonly ILog __log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); NeatEvolutionAlgorithmParameters _eaParams; NeatGenomeParameters _neatGenomeParams; string _name; int _populationSize; int _specieCount; NetworkActivationScheme _activationScheme; string _complexityRegulationStr; int? _complexityThreshold; string _description; ParallelOptions _parallelOptions; double _rbfMutationSigmaCenter; double _rbfMutationSigmaRadius; #region Constructor /// <summary> /// Default constructor. /// </summary> public RbfBinarySixMultiplexerExperiment() { } #endregion #region INeatExperiment /// <summary> /// Gets the name of the experiment. /// </summary> public string Name { get { return _name; } } /// <summary> /// Gets human readable explanatory text for the experiment. /// </summary> public string Description { get { return _description; } } /// <summary> /// Gets the number of inputs required by the network/black-box that the underlying problem domain is based on. /// </summary> public int InputCount { get { return 6; } } /// <summary> /// Gets the number of outputs required by the network/black-box that the underlying problem domain is based on. /// </summary> public int OutputCount { get { return 1; } } /// <summary> /// Gets the default population size to use for the experiment. /// </summary> public int DefaultPopulationSize { get { return _populationSize; } } /// <summary> /// Gets the NeatEvolutionAlgorithmParameters to be used for the experiment. Parameters on this object can be /// modified. Calls to CreateEvolutionAlgorithm() make a copy of and use this object in whatever state it is in /// at the time of the call. /// </summary> public NeatEvolutionAlgorithmParameters NeatEvolutionAlgorithmParameters { get { return _eaParams; } } /// <summary> /// Gets the NeatGenomeParameters to be used for the experiment. Parameters on this object can be modified. Calls /// to CreateEvolutionAlgorithm() make a copy of and use this object in whatever state it is in at the time of the call. /// </summary> public NeatGenomeParameters NeatGenomeParameters { get { return _neatGenomeParams; } } /// <summary> /// Initialize the experiment with some optional XML configutation data. /// </summary> public void Initialize(string name, XmlElement xmlConfig) { _name = name; _populationSize = XmlUtils.GetValueAsInt(xmlConfig, "PopulationSize"); _specieCount = XmlUtils.GetValueAsInt(xmlConfig, "SpecieCount"); _activationScheme = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation"); _complexityRegulationStr = XmlUtils.TryGetValueAsString(xmlConfig, "ComplexityRegulationStrategy"); _complexityThreshold = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold"); _description = XmlUtils.TryGetValueAsString(xmlConfig, "Description"); _parallelOptions = ExperimentUtils.ReadParallelOptions(xmlConfig); ExperimentUtils.ReadRbfAuxArgMutationConfig(xmlConfig, out _rbfMutationSigmaCenter, out _rbfMutationSigmaRadius); _eaParams = new NeatEvolutionAlgorithmParameters(); _eaParams.SpecieCount = _specieCount; _neatGenomeParams = new NeatGenomeParameters(); _neatGenomeParams.ConnectionWeightMutationProbability = 0.788; _neatGenomeParams.AddConnectionMutationProbability = 0.001; _neatGenomeParams.AddConnectionMutationProbability = 0.01; _neatGenomeParams.NodeAuxStateMutationProbability = 0.2; _neatGenomeParams.DeleteConnectionMutationProbability = 0.001; _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork; } /// <summary> /// Load a population of genomes from an XmlReader and returns the genomes in a new list. /// The genome factory for the genomes can be obtained from any one of the genomes. /// </summary> public List<NeatGenome> LoadPopulation(XmlReader xr) { NeatGenomeFactory genomeFactory = (NeatGenomeFactory)CreateGenomeFactory(); return NeatGenomeXmlIO.ReadCompleteGenomeList(xr, true, genomeFactory); } /// <summary> /// Save a population of genomes to an XmlWriter. /// </summary> public void SavePopulation(XmlWriter xw, IList<NeatGenome> genomeList) { // Writing node IDs is not necessary for NEAT. NeatGenomeXmlIO.WriteComplete(xw, genomeList, true); } /// <summary> /// Create a genome decoder for the experiment. /// </summary> public IGenomeDecoder<NeatGenome,IBlackBox> CreateGenomeDecoder() { return new NeatGenomeDecoder(_activationScheme); } /// <summary> /// Create a genome factory for the experiment. /// Create a genome factory with our neat genome parameters object and the appropriate number of input and output neuron genes. /// </summary> public IGenomeFactory<NeatGenome> CreateGenomeFactory() { IActivationFunctionLibrary activationFnLibrary = DefaultActivationFunctionLibrary.CreateLibraryRbf(_neatGenomeParams.ActivationFn, _rbfMutationSigmaCenter, _rbfMutationSigmaRadius); return new RbfGenomeFactory(InputCount, OutputCount, activationFnLibrary, _neatGenomeParams); } /// <summary> /// Create and return a NeatEvolutionAlgorithm object ready for running the NEAT algorithm/search. Various sub-parts /// of the algorithm are also constructed and connected up. /// Uses the experiments default population size defined in the experiment's config XML. /// </summary> public NeatEvolutionAlgorithm<NeatGenome> CreateEvolutionAlgorithm() { return CreateEvolutionAlgorithm(_populationSize); } /// <summary> /// Create and return a NeatEvolutionAlgorithm object ready for running the NEAT algorithm/search. Various sub-parts /// of the algorithm are also constructed and connected up. /// This overload accepts a population size parameter that specifies how many genomes to create in an initial randomly /// generated population. /// </summary> public NeatEvolutionAlgorithm<NeatGenome> CreateEvolutionAlgorithm(int populationSize) { // Create a genome factory with our neat genome parameters object and the appropriate number of input and output neuron genes. IGenomeFactory<NeatGenome> genomeFactory = CreateGenomeFactory(); // Create an initial population of randomly generated genomes. List<NeatGenome> genomeList = genomeFactory.CreateGenomeList(populationSize, 0); // Create evolution algorithm. return CreateEvolutionAlgorithm(genomeFactory, genomeList); } /// <summary> /// Create and return a NeatEvolutionAlgorithm object ready for running the NEAT algorithm/search. Various sub-parts /// of the algorithm are also constructed and connected up. /// This overload accepts a pre-built genome population and their associated/parent genome factory. /// </summary> public NeatEvolutionAlgorithm<NeatGenome> CreateEvolutionAlgorithm(IGenomeFactory<NeatGenome> genomeFactory, List<NeatGenome> genomeList) { // Create distance metric. Mismatched genes have a fixed distance of 10; for matched genes the distance is their weigth difference. IDistanceMetric distanceMetric = new ManhattanDistanceMetric(1.0, 0.0, 10.0); ISpeciationStrategy<NeatGenome> speciationStrategy = new ParallelKMeansClusteringStrategy<NeatGenome>(distanceMetric, _parallelOptions); // Create complexity regulation strategy. IComplexityRegulationStrategy complexityRegulationStrategy = ExperimentUtils.CreateComplexityRegulationStrategy(_complexityRegulationStr, _complexityThreshold); // Create the evolution algorithm. NeatEvolutionAlgorithm<NeatGenome> ea = new NeatEvolutionAlgorithm<NeatGenome>(_eaParams, speciationStrategy, complexityRegulationStrategy); // Create IBlackBox evaluator. BinarySixMultiplexerEvaluator evaluator = new BinarySixMultiplexerEvaluator(); // Create genome decoder. IGenomeDecoder<NeatGenome, IBlackBox> genomeDecoder = CreateGenomeDecoder(); // Create a genome list evaluator. This packages up the genome decoder with the genome evaluator. IGenomeListEvaluator<NeatGenome> innerEvaluator = new ParallelGenomeListEvaluator<NeatGenome, IBlackBox>(genomeDecoder, evaluator, _parallelOptions); // Wrap the list evaluator in a 'selective' evaulator that will only evaluate new genomes. That is, we skip re-evaluating any genomes // that were in the population in previous generations (elite genomes). This is determined by examining each genome's evaluation info object. IGenomeListEvaluator<NeatGenome> selectiveEvaluator = new SelectiveGenomeListEvaluator<NeatGenome>( innerEvaluator, SelectiveGenomeListEvaluator<NeatGenome>.CreatePredicate_OnceOnly()); // Initialize the evolution algorithm. ea.Initialize(selectiveEvaluator, genomeFactory, genomeList); // Finished. Return the evolution algorithm return ea; } /// <summary> /// Create a System.Windows.Forms derived object for displaying genomes. /// </summary> public AbstractGenomeView CreateGenomeView() { return new NeatGenomeView(); } /// <summary> /// Create a System.Windows.Forms derived object for displaying output for a domain (e.g. show best genome's output/performance/behaviour in the domain). /// </summary> public AbstractDomainView CreateDomainView() { return null; } #endregion } }
44.837545
193
0.667552
[ "MIT" ]
devluz/SharpNeatForUnity
src/SharpNeatDomains/BinarySixMultiplexer/RbfBinarySixMultiplexerExperiment.cs
12,422
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Bot.Builder; using Microsoft.Bot.Schema; namespace Microsoft.BotBuilderSamples.Translation { /// <summary> /// Middleware for translating text between the user and bot. /// Uses the Microsoft Translator Text API. /// </summary> public class TranslationMiddleware : IMiddleware { private readonly MicrosoftTranslator _translator; private readonly IStatePropertyAccessor<string> _languageStateProperty; /// <summary> /// Initializes a new instance of the <see cref="TranslationMiddleware"/> class. /// </summary> /// <param name="translator">Translator implementation to be used for text translation.</param> /// <param name="languageStateProperty">State property for current language.</param> public TranslationMiddleware(MicrosoftTranslator translator, IStatePropertyAccessor<string> languageStateProperty) { _translator = translator ?? throw new ArgumentNullException(nameof(translator)); _languageStateProperty = languageStateProperty ?? throw new ArgumentNullException(nameof(languageStateProperty)); } /// <summary> /// Processess an incoming activity. /// </summary> /// <param name="turnContext">Context object containing information for a single turn of conversation with a user.</param> /// <param name="next">The delegate to call to continue the bot middleware pipeline.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public async Task OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken = default(CancellationToken)) { if (turnContext == null) { throw new ArgumentNullException(nameof(turnContext)); } var translate = await ShouldTranslateAsync(turnContext, cancellationToken); if (translate) { if (turnContext.Activity.Type == ActivityTypes.Message) { turnContext.Activity.Text = await _translator.TranslateAsync(turnContext.Activity.Text, TranslationSettings.DefaultLanguage, cancellationToken); } } turnContext.OnSendActivities(async (newContext, activities, nextSend) => { string userLanguage = await _languageStateProperty.GetAsync(turnContext, () => TranslationSettings.DefaultLanguage) ?? TranslationSettings.DefaultLanguage; bool shouldTranslate = userLanguage != TranslationSettings.DefaultLanguage; // Translate messages sent to the user to user language if (shouldTranslate) { List<Task> tasks = new List<Task>(); foreach (Activity currentActivity in activities.Where(a => a.Type == ActivityTypes.Message)) { tasks.Add(TranslateMessageActivityAsync(currentActivity.AsMessageActivity(), userLanguage)); } if (tasks.Any()) { await Task.WhenAll(tasks).ConfigureAwait(false); } } return await nextSend(); }); turnContext.OnUpdateActivity(async (newContext, activity, nextUpdate) => { string userLanguage = await _languageStateProperty.GetAsync(turnContext, () => TranslationSettings.DefaultLanguage) ?? TranslationSettings.DefaultLanguage; bool shouldTranslate = userLanguage != TranslationSettings.DefaultLanguage; // Translate messages sent to the user to user language if (activity.Type == ActivityTypes.Message) { if (shouldTranslate) { await TranslateMessageActivityAsync(activity.AsMessageActivity(), userLanguage); } } return await nextUpdate(); }); await next(cancellationToken).ConfigureAwait(false); } private async Task TranslateMessageActivityAsync(IMessageActivity activity, string targetLocale, CancellationToken cancellationToken = default(CancellationToken)) { if (activity.Type == ActivityTypes.Message) { activity.Text = await _translator.TranslateAsync(activity.Text, targetLocale); } } private async Task<bool> ShouldTranslateAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken)) { string userLanguage = await _languageStateProperty.GetAsync(turnContext, () => TranslationSettings.DefaultLanguage, cancellationToken) ?? TranslationSettings.DefaultLanguage; return userLanguage != TranslationSettings.DefaultLanguage; } } }
46.293103
186
0.640037
[ "MIT" ]
AhmedMagdyG/BotBuilder-Samples
samples/csharp_dotnetcore/17.multilingual-bot/Translation/TranslationMiddleware.cs
5,372
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Models.Common { public class Entity : BaseObject { public System.Guid EntityUid { get; set; } public int EntityTypeId { get; set; } public string EntityType { get; set; } public int EntityBaseId { get; set; } public string EntityBaseName { get; set; } } // public class EntityReference : BaseObject { public System.Guid EntityUid { get; set; } private int _entityTypeId { get; set; } public int EntityTypeId { get { return _entityTypeId; } set { _entityTypeId = value; if ( _entityTypeId == 1 ) EntityType = "Credential"; else if ( _entityTypeId == 2 ) EntityType = "Organization"; else if ( _entityTypeId == 3 ) EntityType = "Assessment"; else if ( _entityTypeId == 7 ) EntityType = "LearningOpportunity"; else if ( _entityTypeId == 19 ) EntityType = "Condition Manifest"; else if ( _entityTypeId == 20 ) EntityType = "Cost Manifest"; else EntityType = string.Format( "Unexpected EntityTypeId of {0}", _entityTypeId ); } } public string EntityType { get; set; } public int EntityBaseId { get; set; } public string EntityBaseName { get; set; } public string CTID { get; set; } public bool IsValid { get; set; } } /// <summary> /// note: Entity_Approval is instanciated in BaseObject, so can't inherit from here! /// </summary> public class Entity_Approval { public Entity_Approval() { //redundent, but explicit IsActive = false; } public int Id { get; set; } public int EntityId { get; set; } public bool IsActive { get; set; } public System.DateTime Created { get; set; } public int CreatedById { get; set; } public string CreatedBy { get; set; } } }
25.875
88
0.650564
[ "Apache-2.0" ]
CredentialEngine/CredentialFinderEditor
Models/Common/Entity.cs
1,865
C#
using System.Collections; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class LevelLoader : MonoBehaviour { static LevelLoader _loader; private Slider slider; private Animator loadingAnimator; bool _loading; const string LoadTrigger = "Start"; const string EndLoadTrigger = "End"; private void Awake() { if (_loader) { DestroyImmediate(gameObject); } else { _loader = this; DontDestroyOnLoad(this); slider = GetComponentInChildren<Slider>(); loadingAnimator = GetComponentInChildren<Animator>(); } } public void LoadLevel(int index) { StartCoroutine(LoadAsync(index)); } IEnumerator LoadAsync(int index) { if (!_loading) { _loading = true; loadingAnimator.SetTrigger(LoadTrigger); yield return new WaitForSeconds(2f); loadingAnimator.ResetTrigger(LoadTrigger); AsyncOperation op = SceneManager.LoadSceneAsync(index); while (!op.isDone) { float progress = Mathf.Clamp01(op.progress / .9f); slider.value = progress; Debug.Log(progress); yield return null; } loadingAnimator.SetTrigger(EndLoadTrigger); yield return new WaitForSeconds(2f); slider.value = 0f; loadingAnimator.ResetTrigger(EndLoadTrigger); _loading = false; } } }
24.507692
67
0.577527
[ "Apache-2.0" ]
hal-9001-v/Holobots
Assets/Scripts/Loading/LevelLoader.cs
1,593
C#
using System; using System.Collections.Generic; using System.Text; using System.Xml.Linq; using MHUrho.Logic; using MHUrho.Storage; using MHUrho.WorldMap; namespace MHUrho.Plugins { /// <summary> /// Base class for player AI instance plugins. /// </summary> public abstract class PlayerAIInstancePlugin : InstancePlugin { /// <summary> /// The player this plugin is controlling. /// </summary> public IPlayer Player { get; private set; } protected PlayerAIInstancePlugin(ILevelManager level, IPlayer player) :base(level) { this.Player = player; } /// <summary> /// Initializes the player AI plugin on it's first loading into the level. /// During this call, all units, buildings and projectiles of this player should already be loaded and connected to this player. /// State of other players cannot is undefined. /// /// If there is a saved state of the player with the same plugin type, <see cref="InstancePlugin.LoadState(PluginDataWrapper)"/> /// will be called instead. /// </summary> /// <param name="level">Current level into which this player is being loaded.</param> public abstract void Init(ILevelManager level); /// <summary> /// Invoked when building owned by the <see cref="Player"/> is destroyed. /// </summary> /// <param name="building">The destroyed building.</param> public virtual void BuildingDestroyed(IBuilding building) { } /// <summary> /// Invoked when unit owned by the <see cref="Player"/> is killed. /// </summary> /// <param name="unit">The killed unit.</param> public virtual void UnitKilled(IUnit unit) { } /// <summary> /// Invoked when new unit is added to the ownership of the <see cref="Player"/>. /// </summary> /// <param name="unit">The newly added unit.</param> public virtual void UnitAdded(IUnit unit) { } /// <summary> /// Invoked when new building is added to the ownership of the <see cref="Player"/>. /// </summary> /// <param name="building">The newly added building.</param> public virtual void BuildingAdded(IBuilding building) { } /// <summary> /// Message sent when an amount of resource that player owns changes. This method should check if this /// change is possible and return the wanted new value. /// </summary> /// <param name="resourceType">Type of the resource the amount changed for.</param> /// <param name="currentAmount">Current amount of the resource.</param> /// <param name="requestedNewAmount">The requested new amount of the resource.</param> /// <returns>New amount of the resource.</returns> public virtual double ResourceAmountChanged(ResourceType resourceType, double currentAmount, double requestedNewAmount) { return requestedNewAmount; } } }
31.05618
130
0.696454
[ "MIT" ]
MK4H/MHUrho
MHUrho/MHUrho/Plugins/PlayerAIInstancePlugin.cs
2,766
C#
using Composite.Models; using System; namespace Composite { public class Program { static void Main(string[] args) { Boxs complexOrder = new Boxs(); Products receipt = new Products("Receipt"); complexOrder.Add(receipt); Boxs phoneBox = new Boxs(); phoneBox.Add(new Products("Phone")); phoneBox.Add(new Products("HeadPhones")); Boxs chargerBox = new Boxs(); chargerBox.Add(new Products("Charger")); complexOrder.Add(phoneBox); complexOrder.Add(chargerBox); Console.WriteLine($"RESULT: {complexOrder.Operation()}\n"); } } }
23.266667
71
0.560172
[ "MIT" ]
RezaJenabi/DesignPatternsCSharp
Src/Structural/Composite/Program.cs
700
C#
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.Aws.Ec2.Inputs { public sealed class GetAmiIdsFilterArgs : Pulumi.InvokeArgs { [Input("name", required: true)] public string Name { get; set; } = null!; [Input("values", required: true)] private List<string>? _values; public List<string> Values { get => _values ?? (_values = new List<string>()); set => _values = value; } public GetAmiIdsFilterArgs() { } } }
26.16129
88
0.618989
[ "ECL-2.0", "Apache-2.0" ]
RafalSumislawski/pulumi-aws
sdk/dotnet/Ec2/Inputs/GetAmiIdsFilter.cs
811
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.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.UnitTests { internal class MockAssemblySymbol : NonMissingAssemblySymbol { private readonly string name; public MockAssemblySymbol(string name) { this.name = name; } public override AssemblyIdentity Identity { get { return new AssemblyIdentity(name); } } internal override ImmutableArray<byte> PublicKey { get { throw new NotImplementedException(); } } public override ImmutableArray<ModuleSymbol> Modules { get { return ImmutableArray.Create<ModuleSymbol>(); } } public override ImmutableArray<Location> Locations { get { return ImmutableArray.Create<Location>(); } } internal override NamedTypeSymbol GetDeclaredSpecialType(SpecialType type) { throw new NotImplementedException(); } internal override ImmutableArray<AssemblySymbol> GetNoPiaResolutionAssemblies() { return default(ImmutableArray<AssemblySymbol>); } internal override ImmutableArray<AssemblySymbol> GetLinkedReferencedAssemblies() { return default(ImmutableArray<AssemblySymbol>); } internal override bool IsLinked { get { return false; } } internal override void SetLinkedReferencedAssemblies(ImmutableArray<AssemblySymbol> assemblies) { throw new NotImplementedException(); } internal override void SetNoPiaResolutionAssemblies(ImmutableArray<AssemblySymbol> assemblies) { throw new NotImplementedException(); } internal override bool AreInternalsVisibleToThisAssembly(AssemblySymbol other) { throw new NotImplementedException(); } internal override IEnumerable<ImmutableArray<byte>> GetInternalsVisibleToPublicKeys(string simpleName) { throw new NotImplementedException(); } public override ICollection<string> TypeNames { get { throw new NotImplementedException(); } } public override ICollection<string> NamespaceNames { get { throw new NotImplementedException(); } } public override bool MightContainExtensionMethods { get { return true; } } internal override NamedTypeSymbol TryLookupForwardedMetadataTypeWithCycleDetection(ref MetadataTypeName emittedName, ConsList<AssemblySymbol> visitedAssemblies) { return null; } } }
29.220183
184
0.636735
[ "Apache-2.0" ]
codemonkey85/roslyn
Src/Compilers/CSharp/Test/Symbol/Symbols/MockAssemblySymbol.cs
3,187
C#
/* * Copyright 2014 Dominick Baier, Brock Allen * * 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 Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Specialized; using Thinktecture.IdentityServer.Core; using Thinktecture.IdentityServer.Core.Validation; using Thinktecture.IdentityServer.Tests.Connect.Setup; namespace Thinktecture.IdentityServer.Tests.Connect.Validation.AuthorizeRequest { [TestClass] public class Authorize_ProtocolValidation_Invalid { [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] [ExpectedException(typeof(ArgumentNullException))] public void Null_Parameter() { var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(null); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Empty_Parameters() { var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(new NameValueCollection()); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.User, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } // fails because openid scope is requested, but no response type that indicates an identity token [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void OpenId_Token_Only_Request() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, Constants.StandardScopes.OpenId); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Token); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Resource_Only_IdToken_Request() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "resource"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.IdToken); parameters.Add(Constants.AuthorizeRequest.Nonce, "abc"); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Mixed_Token_Only_Request() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid resource"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Token); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void OpenId_IdToken_Request_Nonce_Missing() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.IdToken); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Missing_ClientId() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Code); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.User, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Missing_Scope() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Code); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Missing_RedirectUri() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Code); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.User, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Malformed_RedirectUri() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "malformed"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Code); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.User, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Malformed_RedirectUri_Triple_Slash() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https:///attacker.com"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Code); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.User, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Missing_ResponseType() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.UnsupportedResponseType, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Unknown_ResponseType() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, "unknown"); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.UnsupportedResponseType, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Invalid_ResponseMode_For_Code_ResponseType() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Code); parameters.Add(Constants.AuthorizeRequest.ResponseMode, Constants.ResponseModes.Fragment); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.UnsupportedResponseType, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Invalid_ResponseMode_For_IdToken_ResponseType() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.IdToken); parameters.Add(Constants.AuthorizeRequest.ResponseMode, Constants.ResponseModes.Query); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.UnsupportedResponseType, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Invalid_ResponseMode_For_IdTokenToken_ResponseType() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.IdTokenToken); parameters.Add(Constants.AuthorizeRequest.ResponseMode, Constants.ResponseModes.Query); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.UnsupportedResponseType, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Invalid_ResponseMode_For_CodeToken_ResponseType() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.CodeToken); parameters.Add(Constants.AuthorizeRequest.ResponseMode, Constants.ResponseModes.Query); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.UnsupportedResponseType, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Invalid_ResponseMode_For_CodeIdToken_ResponseType() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.CodeIdToken); parameters.Add(Constants.AuthorizeRequest.ResponseMode, Constants.ResponseModes.Query); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.UnsupportedResponseType, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Invalid_ResponseMode_For_CodeIdTokenToken_ResponseType() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.CodeIdTokenToken); parameters.Add(Constants.AuthorizeRequest.ResponseMode, Constants.ResponseModes.Query); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.UnsupportedResponseType, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Malformed_MaxAge() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Code); parameters.Add(Constants.AuthorizeRequest.MaxAge, "malformed"); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } [TestMethod] [TestCategory("AuthorizeRequest Protocol Validation")] public void Negative_MaxAge() { var parameters = new NameValueCollection(); parameters.Add(Constants.AuthorizeRequest.ClientId, "client"); parameters.Add(Constants.AuthorizeRequest.Scope, "openid"); parameters.Add(Constants.AuthorizeRequest.RedirectUri, "https://server/callback"); parameters.Add(Constants.AuthorizeRequest.ResponseType, Constants.ResponseTypes.Code); parameters.Add(Constants.AuthorizeRequest.MaxAge, "-1"); var validator = Factory.CreateAuthorizeRequestValidator(); var result = validator.ValidateProtocol(parameters); Assert.IsTrue(result.IsError); Assert.AreEqual(ErrorTypes.Client, result.ErrorType); Assert.AreEqual(Constants.AuthorizeErrors.InvalidRequest, result.Error); } } }
48.4825
110
0.688032
[ "Apache-2.0" ]
CaptiveLogix/Thinktecture.IdentityServer.v3
source/Tests/UnitTests/Connect/Validation/AuthorizeRequest Validation/Authorize_ProtocolValidation_Invalid.cs
19,395
C#
using BlueBoard.Contract.Common; using BlueBoard.Contract.Identity.Commands; using FluentValidation; namespace BlueBoard.Module.Identity.Validators { public class SignUpValidator : AbstractValidator<SignUp> { public SignUpValidator() { this.RuleFor(i => i.Email) .NotEmpty().WithErrorCode(ErrorCodes.EmptyEmail) .EmailAddress().WithErrorCode(ErrorCodes.InvalidEmail); } } }
26.764706
71
0.67033
[ "MIT" ]
stenvix/blueboard-api
src/BlueBoard.Module.Identity/Validators/SignUpValidator.cs
455
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Cofoundry.Domain { /// <summary> /// The basic component of an IPermission, the type represents /// the type of action to be permitted. Some common permission types /// like 'Read', 'Update' etc can be re-used when applied to an IEntityPermission /// </summary> public class PermissionType { /// <summary> /// Creates a new PermissionType instance /// </summary> public PermissionType() { } /// <summary> /// Creates a new PermissionType instance with the specified settings /// </summary> /// <param name="code">The unique 6 charachter key of the permission type</param> /// <param name="name">A user friendly name for the permission</param> /// <param name="description">A description to display against the permission in the user interface</param> public PermissionType(string code, string name, string description) { Code = code; Name = name; Description = description; } /// <summary> /// The unique 6 charachter key of the permission type /// </summary> public string Code { get; set; } /// <summary> /// A user friendly name for the permission /// </summary> public string Name { get; set; } /// <summary> /// A description to display against the permission in the user interface /// </summary> public string Description { get; set; } } }
31.961538
115
0.59988
[ "MIT" ]
BOBO41/cofoundry
src/Cofoundry.Domain/Domain/Roles/Models/PermissionType.cs
1,664
C#
using UnityEngine; using UnityEngine.Assertions; using UnityEngine.UI; using System; using System.Linq; using System.Collections; using System.Collections.Generic; namespace EcoBuilder { [Serializable] public class LevelDetails { // metadata [SerializeField] int idx; [SerializeField] string title; [SerializeField] string introduction; [SerializeField] string hintMessage; [SerializeField] string completedMessage; [SerializeField] string threeStarsMessage; // constraints [SerializeField] int numProducers; [SerializeField] int numConsumers; [SerializeField] int minEdges; [SerializeField] int minChain; [SerializeField] int minLoop; // score public enum ScoreMetric { None, Standard, Producers, Consumers, Chain, Loop } [SerializeField] ScoreMetric metric; [SerializeField] bool researchMode; [SerializeField] double mainMultiplier; [SerializeField] double altMultiplier; [SerializeField] long twoStarScore; [SerializeField] long threeStarScore; // gameplay [SerializeField] bool sizeSliderHidden; [SerializeField] bool greedSliderHidden; [SerializeField] bool conflictsAllowed; [SerializeField] bool superfocusAllowed; // vertices and edges public enum SpeciesType { Producer=0, Consumer, Apex, Specialist }; public enum SpeciesEdit { General=0, None, SizeOnly, GreedOnly }; [SerializeField] int numInitSpecies; [SerializeField] List<SpeciesEdit> edits; [SerializeField] List<SpeciesType> types; [SerializeField] List<int> sizes; [SerializeField] List<int> greeds; [SerializeField] int numInitInteractions; [SerializeField] List<int> sources; [SerializeField] List<int> targets; public int Idx { get { return idx; } } public string Title { get { return title; } } public string Introduction { get { return introduction; } } public string HintMessage { get { return hintMessage; } } public string CompletedMessage { get { return completedMessage; } } public string ThreeStarsMessage { get { return threeStarsMessage; } } public int NumProducers { get { return numProducers; } } public int NumConsumers { get { return numConsumers; } } public int MinEdges { get { return minEdges; } } public int MinChain { get { return minChain; } } public int MinLoop { get { return minLoop; } } public ScoreMetric Metric { get { return metric; } } public bool ResearchMode { get { return researchMode; } } public double MainMultiplier { get { return mainMultiplier; } } public double AltMultiplier { get { return altMultiplier; } } public long TwoStarScore { get { return twoStarScore; } } public long ThreeStarScore { get { return threeStarScore; } } public bool SizeSliderHidden { get { return sizeSliderHidden; } } public bool GreedSliderHidden { get { return greedSliderHidden; } } public bool ConflictsAllowed { get { return conflictsAllowed; } } public bool SuperfocusAllowed { get { return superfocusAllowed; } } public int NumInitSpecies { get { return numInitSpecies; } } public IReadOnlyList<SpeciesEdit> Edits { get { return edits; } } public IReadOnlyList<SpeciesType> Types { get { return types; } } public IReadOnlyList<int> Sizes { get { return sizes; } } public IReadOnlyList<int> Greeds { get { return greeds; } } public int NumInitInteractions { get { return numInitInteractions; } } public IReadOnlyList<int> Sources { get { return sources; } } public IReadOnlyList<int> Targets { get { return targets; } } public void SetEcosystem(List<int> randomSeeds, List<bool> plants, List<int> sizes, List<int> greeds, List<int> sources, List<int> targets) { numInitSpecies = plants.Count; this.edits = new List<SpeciesEdit>(Enumerable.Repeat(SpeciesEdit.General, numInitSpecies)); this.types = new List<SpeciesType>(plants.Select(b=> b? SpeciesType.Producer : SpeciesType.Consumer)); // this.sizes = sizes; this.greeds = greeds; numInitInteractions = sources.Count; this.sources = sources; this.targets = targets; } } public class Level : MonoBehaviour { [SerializeField] LevelDetails details; public LevelDetails Details { get { return details; } } [SerializeField] Level nextLevelPrefab; public Level NextLevelPrefab { get { return nextLevelPrefab; } } [SerializeField] GameObject tutorialPrefab; public event Action OnThumbnailed, OnCarded, OnFinished; // thumbnail [SerializeField] TMPro.TextMeshProUGUI indexText; [SerializeField] Image starsImage; [SerializeField] Sprite[] starSprites; // card [SerializeField] TMPro.TextMeshProUGUI titleText; [SerializeField] TMPro.TextMeshProUGUI target1; [SerializeField] TMPro.TextMeshProUGUI target2; [SerializeField] TMPro.TextMeshProUGUI highScore; [SerializeField] Button playButton; [SerializeField] Button quitButton; [SerializeField] Button replayButton; [SerializeField] Effect fireworksPrefab; void Awake() { int n = details.NumInitSpecies; int m = details.NumInitInteractions; Assert.IsFalse(n!=details.Sizes.Count || n!=details.Greeds.Count || n!=details.Types.Count || n!=details.Edits.Count, $"num species and sizes or greeds do not match in {name}"); Assert.IsFalse(m!=details.Sources.Count || m!=details.Targets.Count, $"num edge sources and targets do not match in {name}"); titleText.text = details.Title; indexText.text = ((details.Idx) % 100).ToString(); // a little smelly and probably unecessary target1.text = details.TwoStarScore.ToString("N0"); target2.text = details.ThreeStarScore.ToString("N0"); SetLocalHighScore(); } public void SetLocalHighScore() { long? score = GameManager.Instance.GetHighScoreLocal(details.Idx); highScore.text = (score??0).ToString("N0"); int numStars = 0; if (score > 0) { numStars += 1; } if (score >= details.TwoStarScore) { numStars += 1; target1.color = new Color(1,1,1,.3f); } if (score >= details.ThreeStarScore) { numStars += 1; target2.color = new Color(1,1,1,.3f); } starsImage.sprite = starSprites[numStars]; } ////////////////////////////// // animations states // enum State { Thumbnail=0, Card=1, FinishFlag=2, Leave=3 } [SerializeField] Image padlock; public void Unlock() { // TODO: nice animation? padlock.enabled = false; indexText.enabled = true; thumbnailGroup.interactable = true; if (Details.Metric != LevelDetails.ScoreMetric.None && !Details.ResearchMode) { starsImage.enabled = true; } } public void ShowCard(float duration=.5f) { Assert.IsFalse(GameManager.Instance.CardAnchor.childCount > 0, "card already on cardparent?"); thumbnailedParent = transform.parent.GetComponent<RectTransform>(); TweenToZeroPos(duration, GameManager.Instance.CardAnchor); TweenToCard(.5f); OnCarded?.Invoke(); } Transform thumbnailedParent; private void HideCard(float duration=.5f) { TweenToZeroPos(duration, thumbnailedParent); TweenFromCard(.5f); OnThumbnailed?.Invoke(); } public void ShowFinishFlag(float period=3f) { Instantiate(fireworksPrefab, transform); thumbnailedParent = transform.parent.GetComponent<RectTransform>(); TweenToFlag(period); } public void HideFinishFlag(float duration=.5f) // called on finish flag pressed { if (teacher != null) { Destroy(teacher); } TweenFromFlag(duration); OnFinished?.Invoke(); } ///////////////// // ANIMATION bool tweeningPos; void TweenToZeroPos(float duration, Transform newParent) { IEnumerator Tween() { while (tweeningPos) { yield return null; } tweeningPos = true; transform.SetParent(newParent, true); transform.localScale = Vector3.one; Vector2 startPos = transform.localPosition; float startTime = Time.time; while (Time.time < startTime+duration) { float t = Tweens.QuadraticInOut((Time.time-startTime)/duration); transform.localPosition = Vector2.Lerp(startPos, Vector2.zero, t); yield return null; } transform.localPosition = Vector2.zero; tweeningPos = false; } StartCoroutine(Tween()); } ////////////////////////// // animation [SerializeField] Canvas cardCanvas; [SerializeField] CanvasGroup thumbnailGroup, cardGroup; [SerializeField] Image shade, back; bool tweeningCard; // a hack to keep the card on top of the other thumbnails Canvas extraCanvas; GraphicRaycaster extraRaycaster; void TweenToCard(float duration) { StartCoroutine(Tween()); IEnumerator Tween() { while (tweeningCard == true) { yield return null; } RenderOnTop(5); tweeningCard = true; var rt = GetComponent<RectTransform>(); var startSize = rt.sizeDelta; var endSize = new Vector2(400,400); float aShade = shade.color.a; float aThumb = thumbnailGroup.alpha; float aCard = cardGroup.alpha; cardCanvas.enabled = true; cardGroup.interactable = true; cardGroup.blocksRaycasts = true; thumbnailGroup.interactable = false; thumbnailGroup.blocksRaycasts = false; shade.enabled = true; shade.raycastTarget = true; float startTime = Time.time; while (Time.time < startTime+duration) { float t = Tweens.QuadraticInOut((Time.time-startTime)/duration); rt.sizeDelta = Vector2.Lerp(startSize, endSize, t); shade.color = new Color(0,0,0, Mathf.Lerp(aShade,.3f,t)); thumbnailGroup.alpha = Mathf.Lerp(aThumb,0,t); cardGroup.alpha = Mathf.Lerp(aCard,1,t); yield return null; } rt.sizeDelta = endSize; shade.color = new Color(0,0,0,.3f); thumbnailGroup.alpha = 0; cardGroup.alpha = 1; tweeningCard = false; } void RenderOnTop(int sortOrder) { extraCanvas = gameObject.AddComponent<Canvas>(); extraRaycaster = gameObject.AddComponent<GraphicRaycaster>(); extraCanvas.overrideSorting = true; extraCanvas.sortingOrder = sortOrder; } } void TweenFromCard(float duration) { StartCoroutine(Tween()); IEnumerator Tween() { while (tweeningCard == true) { yield return null; } tweeningCard = true; var rt = GetComponent<RectTransform>(); var startSize = rt.sizeDelta; var endSize = new Vector2(100,100); float aShade = shade.color.a; float aThumb = thumbnailGroup.alpha; float aCard = cardGroup.alpha; cardGroup.interactable = false; cardGroup.blocksRaycasts = false; thumbnailGroup.interactable = true; thumbnailGroup.blocksRaycasts = true; shade.raycastTarget = false; float startTime = Time.time; while (Time.time < startTime+duration) { float t = Tweens.QuadraticInOut((Time.time-startTime)/duration); rt.sizeDelta = Vector2.Lerp(startSize, endSize, t); shade.color = new Color(0,0,0, Mathf.Lerp(aShade,0,t)); thumbnailGroup.alpha = Mathf.Lerp(aThumb,1,t); cardGroup.alpha = Mathf.Lerp(aCard,0,t); yield return null; } rt.sizeDelta = endSize; shade.enabled = false; shade.color = new Color(0,0,0,0); thumbnailGroup.alpha = 1; cardGroup.alpha = 0; cardCanvas.enabled = false; tweeningCard = false; RenderBelow(); } void RenderBelow() { #if UNITY_EDITOR // for play mode opened from the start // so card was never displayed in the first place if (extraCanvas == null) { return; } #endif extraCanvas.overrideSorting = false; // RectMask2D breaks otherwise Destroy(extraRaycaster); Destroy(extraCanvas); } } [SerializeField] Image flagBack, flagIcon; bool flagging; void TweenToFlag(float period) { IEnumerator Oscillate() { flagBack.enabled = flagIcon.enabled = true; var rt = GetComponent<RectTransform>(); float startTime = Time.time; flagging = true; while (flagging) { float t = (Time.time - startTime) / period; // float size = 105 + 5*Mathf.Sin(2*Mathf.PI*t); float size = 1.05f + .05f*Mathf.Sin(2*Mathf.PI*t); rt.localScale = new Vector2(size, size); yield return null; } } StartCoroutine(Oscillate()); } void TweenFromFlag(float duration) { flagging = false; StartCoroutine(Spin()); IEnumerator Spin() { var rt = GetComponent<RectTransform>(); float startTime = Time.time; while (Time.time < startTime + duration) { float t = Tweens.QuadraticInOut((Time.time-startTime) / duration); float size = Mathf.Lerp(1, 0, t); float rot = Mathf.Lerp(0,720, t); rt.localScale = new Vector3(size, size, 1); rt.localRotation = Quaternion.Euler(0,0,rot); yield return null; } rt.localScale = Vector3.zero; rt.localRotation = Quaternion.identity; flagBack.enabled = flagIcon.enabled = false; playButton.interactable = true; playButton.gameObject.SetActive(true); quitButton.gameObject.SetActive(false); replayButton.gameObject.SetActive(false); yield return null; GameManager.Instance.ShowReportCard(); rt.localScale = Vector3.one; } } /////////////////////// // Scene changing public void Play() // attached to 'GO' button { GameManager.Instance.LoadLevelScene(this); } public void Replay() // for button { if (teacher != null) { Destroy(teacher.gameObject); } GameManager.Instance.ReloadLevelScene(this); } GameObject teacher; public void BeginPlay() { Assert.IsTrue(GameManager.Instance.PlayedLevelDetails == details, "wrong level being started"); // wait one frame to avoid lag spike StartCoroutine(WaitOneFrameThenBeginPlay()); IEnumerator WaitOneFrameThenBeginPlay() { yield return null; thumbnailedParent = GameManager.Instance.PlayAnchor; // detach from possibly the menu HideCard(1.5f); if (tutorialPrefab != null) { teacher = Instantiate(tutorialPrefab, GameManager.Instance.TutCanvas.transform); } GameManager.Instance.HelpText.ResetLevelPosition(); GameManager.Instance.HelpText.DelayThenShow(2, details.Introduction); if (details.HintMessage != "") { StartCoroutine(WaitThenShowHint()); } IEnumerator WaitThenShowHint(float delay=120f) { float tStart = Time.time; while (Time.time < tStart+delay) { if (flagging) { // do not show hint if level becomes finishable yield break; } yield return null; } GameManager.Instance.HelpText.Message = details.HintMessage; GameManager.Instance.HelpText.Showing = true; } playButton.interactable = false; yield return new WaitForSeconds(1f); playButton.gameObject.SetActive(false); quitButton.gameObject.SetActive(true); replayButton.gameObject.SetActive(true); } } private void Quit() { GameManager.Instance.ReturnToMenu(ClearLeaks, ()=> StartCoroutine(LeaveThenDestroyFromNextFrame(-1000, 1))); void ClearLeaks() { if (teacher != null) { Destroy(teacher.gameObject); } StopAllCoroutines(); gameObject.AddComponent<CanvasGroup>().interactable = false; // make sure not interactable } IEnumerator LeaveThenDestroyFromNextFrame(float targetY, float duration) { // wait one frame to avoid lag spike yield return null; shade.enabled = false; float startY = back.transform.localPosition.y; float startTime = Time.time; while (Time.time < startTime+duration) { float t = Tweens.QuadraticInOut((Time.time-startTime)/duration); float y = Mathf.Lerp(startY, targetY, t); back.transform.localPosition = new Vector2(transform.localPosition.x, y); yield return null; } Destroy(gameObject); } } void OnDestroy() { if (teacher != null) { Destroy(teacher.gameObject); } } #if UNITY_EDITOR public static bool SaveAsNewPrefab(List<int> seeds, List<bool> plants, List<int> sizes, List<int> greeds, List<int> sources, List<int> targets, string name) { Assert.IsTrue(seeds.Count==plants.Count && plants.Count==sizes.Count && sizes.Count==greeds.Count); Assert.IsTrue(sources.Count==targets.Count); var basePrefab = UnityEditor.AssetDatabase.LoadAssetAtPath<Level>($"Assets/Prefabs/Levels/Base Level.prefab"); var newPrefab = (Level)UnityEditor.PrefabUtility.InstantiatePrefab(basePrefab); newPrefab.details.SetEcosystem(seeds, plants, sizes, greeds, sources, targets); bool success; UnityEditor.PrefabUtility.SaveAsPrefabAsset(newPrefab.gameObject, $"Assets/Prefabs/Levels/{name}.prefab", out success); Destroy(newPrefab.gameObject); return success; } #endif } }
39.405303
189
0.551812
[ "MIT" ]
jxz12/EcoBuilder
Assets/Scripts/Misc/Level.cs
20,808
C#
using System; using Android.Content; using Android.Runtime; using Android.Util; using Android.Views; namespace Xamarin.Forms.Platform.Android { public class ContainerView : ViewGroup { IVisualElementRenderer _renderer; View _view; public ContainerView(Context context, View view) : base(context) { View = view; } public ContainerView(Context context, IAttributeSet attribs) : base(context, attribs) { } public ContainerView(Context context, IAttributeSet attribs, int defStyleAttr) : base(context, attribs, defStyleAttr) { } protected ContainerView(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer) { } public bool MatchHeight { get; set; } public bool MatchWidth { get; set; } public View View { get { return _view; } set { _view = value; OnViewSet(value); } } protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { _renderer?.Dispose(); _renderer = null; _view = null; } } protected override void OnLayout(bool changed, int l, int t, int r, int b) { if (_renderer == null) return; var width = Context.FromPixels(r - l); var height = Context.FromPixels(b - t); LayoutView(0, 0, width, height); _renderer.UpdateLayout(); } protected virtual void LayoutView(double x, double y, double width, double height) { View?.Layout(new Rectangle(x, y, width, height)); } protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (View == null) { SetMeasuredDimension(0, 0); return; } // chain on down _renderer.View.Measure(widthMeasureSpec, heightMeasureSpec); var width = MeasureSpecFactory.GetSize(widthMeasureSpec); var height = MeasureSpecFactory.GetSize(heightMeasureSpec); var measureWidth = width > 0 ? Context.FromPixels(width) : double.PositiveInfinity; var measureHeight = height > 0 ? Context.FromPixels(height) : double.PositiveInfinity; var sizeReq = View.Measure(measureWidth, measureHeight); SetMeasuredDimension((MatchWidth && width != 0) ? width : (int)Context.ToPixels(sizeReq.Request.Width), (MatchHeight && height != 0) ? height : (int)Context.ToPixels(sizeReq.Request.Height)); } protected virtual void OnViewSet(View view) { if (_renderer != null) { _renderer.View.RemoveFromParent(); _renderer.Dispose(); _renderer = null; } if (view != null) { _renderer = Platform.CreateRenderer(view, Context); Platform.SetRenderer(view, _renderer); AddView(_renderer.View); } } } }
22.895652
119
0.688188
[ "MIT" ]
Axemasta/Xamarin.Forms
Xamarin.Forms.Platform.Android/Renderers/ContainerView.cs
2,635
C#
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace CampusApp.Evaluation.DTO { [DataContract] class RequestDTO { [DataMember] internal string deviceID; } }
17.647059
35
0.72
[ "Apache-2.0" ]
M-a-x-G/University-Evaluation-Windows-Phone
CampusAppEvalWP/Evaluation/DTO/RequestDTO .cs
302
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using KiepCommunication.Model; namespace KiepCommunication.GUI { public partial class frmSettings : CustomForm { private CustomKeyboard _Keyboard; private CustomLayout _SettingsLayout = new SettingsLayout(); private CustomBeheaviour _SimpleBeheaviour = new SimpleBeheaviour(); public frmSettings() { InitializeComponent(); _Keyboard = new CustomKeyboard(pnlControls.Controls, _SettingsLayout, _SimpleBeheaviour); _Keyboard.CustomKeyPressed += new CustomKeyPressedEventHandler(OnKeyPressed); CustomButtonDown += new CustomButtonEventHandler(OnButtonDown); Core.Instance.SpeedChanged += new EventHandler(OnSpeedChanged); } void OnSpeedChanged(object sender, EventArgs e) { _SimpleBeheaviour.Timer = Core.Instance.GetScanSpeed(); } void OnButtonDown(object sender, CustomButtonEventArgs e) { _Keyboard.OnButtonPressed(e); if (e.Button == ButtonType.YesButton || e.Button == ButtonType.NoButton) { Core.Instance.MainForm.OnButtonDown(sender, e); } } void OnKeyPressed(object sender, CustomKeyPressedEventArgs e) { if (InvokeRequired) { this.BeginInvoke(new CustomKeyPressedEventHandler(OnKeyPressed), new Object[] { sender, e }); } else { Core.Instance.Interpreter.ProcessCommand(e.Keys); } } private void frmSettings_FormClosing(object sender, FormClosingEventArgs e) { Core.Instance.SpeedChanged -= OnSpeedChanged; _SimpleBeheaviour.StopSelection(); } public void UpdateSettingsDisplay() { btnScanTime.Text = String.Format("{0:0.0}", (float)Core.Instance.ScanSpeed * 0.1); if (Core.Instance.AutoWordCompeltionOn) btnAutoComplete.Text = "AAN"; else btnAutoComplete.Text = "UIT"; if (Core.Instance.NextWordSuggestionOn) btnNextWord.Text = "AAN"; else btnNextWord.Text = "UIT"; if (Core.Instance.UnderscoreSpace) btnUnderscoreSpace.Text = "AAN"; else btnUnderscoreSpace.Text = "UIT"; btnYesNoDisplayTime.Text = String.Format("{0:0.0}", (float)Core.Instance.YesNoDisplayTime * 0.001); } private void frmSettings_VisibleChanged(object sender, EventArgs e) { if (Visible) OnButtonDown(this, new CustomButtonEventArgs(ButtonType.ScanButton)); _SimpleBeheaviour.StopSelection(); } } }
27.541667
105
0.686082
[ "MIT" ]
Joozt/KiepCommunicationSoftware
KiepCommunication/GUI/frmSettings.cs
2,646
C#
#region License // Distributed under the MIT License // ============================================================ // Copyright (c) 2016 Hotcakes Commerce, LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software // and associated documentation files (the "Software"), to deal in the Software without restriction, // including without limitation the rights to use, copy, modify, merge, publish, distribute, // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #endregion namespace Hotcakes.Commerce.Accounts { public interface IAccountService { //IUserAccountRepository AdminUsers { get; } } }
43.90625
101
0.717438
[ "MIT" ]
ketangarala/core
Libraries/Hotcakes.Commerce/Accounts/IAccountService.cs
1,407
C#
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Screens.Select.Filter; namespace osu.Game.Screens.Select.Carousel { public class CarouselBeatmap : CarouselItem { public readonly BeatmapInfo Beatmap; public CarouselBeatmap(BeatmapInfo beatmap) { Beatmap = beatmap; State.Value = CarouselItemState.Collapsed; } protected override DrawableCarouselItem CreateDrawableRepresentation() => new DrawableCarouselBeatmap(this); public override void Filter(FilterCriteria criteria) { base.Filter(criteria); bool match = criteria.Ruleset == null || Beatmap.RulesetID == criteria.Ruleset.ID || (Beatmap.RulesetID == 0 && criteria.Ruleset.ID > 0 && criteria.AllowConvertedBeatmaps); foreach (var criteriaTerm in criteria.SearchTerms) match &= Beatmap.Metadata.SearchableTerms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0) || Beatmap.Version.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0; Filtered.Value = !match; } public override int CompareTo(FilterCriteria criteria, CarouselItem other) { if (!(other is CarouselBeatmap otherBeatmap)) return base.CompareTo(criteria, other); switch (criteria.Sort) { default: case SortMode.Difficulty: var ruleset = Beatmap.RulesetID.CompareTo(otherBeatmap.Beatmap.RulesetID); if (ruleset != 0) return ruleset; return Beatmap.StarDifficulty.CompareTo(otherBeatmap.Beatmap.StarDifficulty); } } public override string ToString() => Beatmap.ToString(); } }
37.142857
185
0.621635
[ "MIT" ]
Dragicafit/osu
osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs
2,025
C#
using MediatR; using TaxonomyService.Data; using TaxonomyService.Data.Model; using TaxonomyService.Features.Core; using System.Collections.Generic; using System.Threading.Tasks; using System.Linq; using System.Data.Entity; namespace TaxonomyService.Features.Users { public class RemoveUserCommand { public class RemoveUserRequest : IRequest<RemoveUserResponse> { public int Id { get; set; } public int? TenantId { get; set; } } public class RemoveUserResponse { } public class RemoveUserHandler : IAsyncRequestHandler<RemoveUserRequest, RemoveUserResponse> { public RemoveUserHandler(TaxonomyServiceContext context, ICache cache) { _context = context; _cache = cache; } public async Task<RemoveUserResponse> Handle(RemoveUserRequest request) { var user = await _context.Users.SingleAsync(x=>x.Id == request.Id && x.TenantId == request.TenantId); user.IsDeleted = true; await _context.SaveChangesAsync(); return new RemoveUserResponse(); } private readonly TaxonomyServiceContext _context; private readonly ICache _cache; } } }
30.604651
117
0.629179
[ "MIT" ]
QuinntyneBrown/TaxonomyService
src/TaxonomyService/Features/Users/RemoveUserCommand.cs
1,316
C#
/******************************************************************************* * Copyright 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. * ***************************************************************************** * __ _ _ ___ * ( )( \/\/ )/ __) * /__\ \ / \__ \ * (_)(_) \/\/ (___/ * * AWS SDK for .NET */ using System; using System.IO; using System.Collections.Generic; using System.Text; using System.Threading; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; using System.Globalization; namespace Amazon.Runtime.Internal.Settings { public class PersistenceManager { #region Private members static readonly PersistenceManager INSTANCE = new PersistenceManager(); readonly HashSet<string> _encryptedKeys; readonly Dictionary<string, SettingsWatcher> _watchers = new Dictionary<string, SettingsWatcher>(); #endregion #region Constructor private PersistenceManager() { this._encryptedKeys = new HashSet<string> { SettingsConstants.AccessKeyField, SettingsConstants.SecretKeyField, SettingsConstants.SecretKeyRepository, SettingsConstants.SecretKeyRepository, SettingsConstants.EC2InstanceUserName, SettingsConstants.EC2InstancePassword, SettingsConstants.ProxyUsernameEncrypted, SettingsConstants.ProxyPasswordEncrypted, SettingsConstants.UserIdentityField, SettingsConstants.RoleSession }; } #endregion #region Public methods public static PersistenceManager Instance { get { return INSTANCE; } } public SettingsCollection GetSettings(string type) { return loadSettingsType(type); } public void SaveSettings(string type, SettingsCollection settings) { saveSettingsType(type, settings); } public string GetSetting(string key) { var sc = GetSettings(SettingsConstants.MiscSettings); var oc = sc[SettingsConstants.MiscSettings]; var value = oc[key]; return value; } public void SetSetting(string key, string value) { var sc = GetSettings(SettingsConstants.MiscSettings); var oc = sc[SettingsConstants.MiscSettings]; oc[key] = value; SaveSettings(SettingsConstants.MiscSettings, sc); } public static string GetSettingsStoreFolder() { #if BCL string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + "/AWSToolkit"; #else string folder = System.Environment.GetEnvironmentVariable("HOME"); if (string.IsNullOrEmpty(folder)) folder = System.Environment.GetEnvironmentVariable("USERPROFILE"); folder = Path.Combine(folder, "AppData/Local/AWSToolkit"); #endif if (!Directory.Exists(folder)) Directory.CreateDirectory(folder); return folder; } public SettingsWatcher Watch(string type) { SettingsWatcher sw = new SettingsWatcher(getFileFromType(type), type); this._watchers[type] = sw; return sw; } void enableWatcher(string type) { SettingsWatcher sw = null; if (this._watchers.TryGetValue(type, out sw)) { sw.Enable = true; } } void disableWatcher(string type) { SettingsWatcher sw = null; if (this._watchers.TryGetValue(type, out sw)) { sw.Enable = false; } } internal bool IsEncrypted(string key) { return this._encryptedKeys.Contains(key); } #endregion #region Private methods void saveSettingsType(string type, SettingsCollection settings) { this.disableWatcher(type); try { var filePath = getFileFromType(type); if (settings == null || settings.Count == 0) { if (File.Exists(filePath)) { File.Delete(filePath); } return; } // Cover the case where the file still has a lock on it from a previous IO access and needs time to let go. var retryAttempt = 0; while(true) { try { using (var stream = File.OpenWrite(filePath)) using (var writer = new StreamWriter(stream)) { settings.Persist(writer); break; } } catch (Exception) { if (retryAttempt < 5) { Thread.Sleep(1000); retryAttempt++; } else throw; } } } finally { this.enableWatcher(type); } } SettingsCollection loadSettingsType(string type) { var filePath = getFileFromType(type); if(!File.Exists(filePath)) { return new SettingsCollection(); } // cover case where SDK in another process might be writing to settings file, // yielding IO contention exceptons var retryAttempt = 0; while (true) { try { string content; using (var stream = File.OpenRead(filePath)) using (var reader = new StreamReader(stream)) { content = reader.ReadToEnd(); } var settings = JsonMapper.ToObject<Dictionary<string, Dictionary<string, object>>>(content); if (settings == null) settings = new Dictionary<string, Dictionary<string, object>>(); decryptAnyEncryptedValues(settings); return new SettingsCollection(settings); } catch { if (retryAttempt < 5) { Thread.Sleep(1000); retryAttempt++; } else return new SettingsCollection(); // give up } } } void decryptAnyEncryptedValues(Dictionary<string, Dictionary<string, object>> settings) { foreach (var kvp in settings) { string settingsKey = kvp.Key; var objectCollection = kvp.Value; foreach (string key in new List<string>(objectCollection.Keys)) { if (IsEncrypted(key) || IsEncrypted(settingsKey)) { string value = objectCollection[key] as string; if (value != null) { try { objectCollection[key] = UserCrypto.Decrypt(value); } catch (Exception e) { objectCollection.Remove(key); var logger = Logger.GetLogger(typeof(PersistenceManager)); logger.Error(e, "Exception decrypting value for key {0}/{1}", settingsKey, key); } } } } } } private static string getFileFromType(string type) { return string.Format(CultureInfo.InvariantCulture, @"{0}\{1}.json", GetSettingsStoreFolder(), type); } #endregion } public class SettingsWatcher : IDisposable { #region Private members #if BCL private static ICollection<FileSystemWatcher> watchers = new List<FileSystemWatcher>(); private FileSystemWatcher watcher; #endif private string type; #endregion #region Constructors private SettingsWatcher() { throw new NotSupportedException(); } internal SettingsWatcher(string filePath, string type) { string dirPath = Path.GetDirectoryName(filePath); string fileName = Path.GetFileName(filePath); this.type = type; #if BCL this.watcher = new FileSystemWatcher(dirPath, fileName) { EnableRaisingEvents = true }; this.watcher.Changed += new FileSystemEventHandler(SettingsFileChanged); this.watcher.Created += new FileSystemEventHandler(SettingsFileChanged); watchers.Add(watcher); #endif } #endregion #region Public methods public SettingsCollection GetSettings() { return PersistenceManager.Instance.GetSettings(this.type); } public bool Enable { #if BCL get { return this.watcher.EnableRaisingEvents; } set { this.watcher.EnableRaisingEvents = value; } #else get; set; #endif } #endregion #region Events public event EventHandler SettingsChanged; #endregion #region IDisposable Members public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { #if BCL if (watcher != null) { watchers.Remove(watcher); watcher = null; } #endif } } #endregion #region Private methods #if BCL private void SettingsFileChanged(object sender, FileSystemEventArgs e) { if (SettingsChanged != null) SettingsChanged(this, null); } #endif #endregion } }
28.768041
132
0.50654
[ "Apache-2.0" ]
brainmurphy/aws-sdk-net
sdk/src/Core/Amazon.Runtime/Internal/Settings/_bcl+coreclr/PersistenceManager.cs
11,164
C#
// Copyright 2019 DeepMind Technologies Limited // // 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.Xml; using UnityEngine; namespace Mujoco { public class MjMocapBody : MjBaseBody { protected override void OnParseMjcf(XmlElement mjcf) { throw new Exception("parsing mocap bodies isn't supported."); } protected override unsafe void OnBindToRuntime(MujocoLib.mjModel_* model, MujocoLib.mjData_* data) { var bodyId = MujocoLib.mj_name2id(model, (int)ObjectType, MujocoName); MujocoId = model->body_mocapid[bodyId]; } protected override XmlElement OnGenerateMjcf(XmlDocument doc) { var mjcf = doc.CreateElement("body"); MjEngineTool.PositionRotationToMjcf(mjcf, this); mjcf.SetAttribute("mocap", "true"); return mjcf; } public override unsafe void OnSyncState(MujocoLib.mjData_* data) { MjEngineTool.SetMjVector3(data->mocap_pos, transform.position, MujocoId); MjEngineTool.SetMjQuaternion(data->mocap_quat, transform.rotation, MujocoId); } } }
36.55814
104
0.732188
[ "Apache-2.0" ]
Garfield-kh/mujoco
unity/Runtime/Components/Bodies/MjMocapBody.cs
1,572
C#
version https://git-lfs.github.com/spec/v1 oid sha256:de14052fc10ee28d70bdde0951f39c7f208c10e9155e054632ecd02ce9fd66a0 size 414
32
75
0.882813
[ "MIT" ]
kenx00x/ahhhhhhhhhhhh
ahhhhhhhhhh/Library/PackageCache/com.unity.render-pipelines.high-definition@7.1.8/Editor/Material/Unlit/ShaderGraph/CreateHDUnlitShaderGraph.cs
128
C#