content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
using System; using System.Linq; using Microsoft.Maui.Controls.Internals; namespace Microsoft.Maui.Controls.ControlGallery.GalleryPages.PerformanceGallery.Scenarios { [Preserve(AllMembers = true)] internal class TimePickerScenario1 : PerformanceScenario { public TimePickerScenario1() : base("[TimePicker] Empty") { View = new TimePicker(); } } }
21.411765
90
0.763736
[ "MIT" ]
jongalloway/maui
src/ControlGallery/src/Xamarin.Forms.Controls.Issues.Shared/PerformanceGallery/Scenarios/TimePickerScenarios.cs
366
C#
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ using System.Collections.Generic; using Aliyun.Acs.Core; using Aliyun.Acs.Core.Http; using Aliyun.Acs.Core.Transform; using Aliyun.Acs.Core.Utils; using Aliyun.Acs.reid.Transform; using Aliyun.Acs.reid.Transform.V20190928; namespace Aliyun.Acs.reid.Model.V20190928 { public class ListLocationRequest : RpcAcsRequest<ListLocationResponse> { public ListLocationRequest() : base("reid", "2019-09-28", "ListLocation", "1.1.2", "openAPI") { if (this.GetType().GetProperty("ProductEndpointMap") != null && this.GetType().GetProperty("ProductEndpointType") != null) { this.GetType().GetProperty("ProductEndpointMap").SetValue(this, Endpoint.endpointMap, null); this.GetType().GetProperty("ProductEndpointType").SetValue(this, Endpoint.endpointRegionalType, null); } } private long? storeId; public long? StoreId { get { return storeId; } set { storeId = value; DictionaryUtil.Add(BodyParameters, "StoreId", value.ToString()); } } public override ListLocationResponse GetResponse(UnmarshallerContext unmarshallerContext) { return ListLocationResponseUnmarshaller.Unmarshall(unmarshallerContext); } } }
33.571429
134
0.694563
[ "Apache-2.0" ]
bbs168/aliyun-openapi-net-sdk
aliyun-net-sdk-reid/Reid/Model/V20190928/ListLocationRequest.cs
2,115
C#
// Copyright 2021 Automate The Planet Ltd. // Author: Anton Angelov // 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 OpenQA.Selenium; namespace TestsMaintainabilityDemos.Sixth { public class CartPageElements { private readonly Driver _driver; public CartPageElements(Driver driver) => _driver = driver; public Element CouponCodeTextField => _driver.FindElement(By.Id("coupon_code")); public Element ApplyCouponButton => _driver.FindElement(By.CssSelector("[value*='Apply coupon']")); public Element QuantityBox => _driver.FindElement(By.CssSelector("[class*='input-text qty text']")); public Element UpdateCart => _driver.FindElement(By.CssSelector("[value*='Update cart']")); public Element MessageAlert => _driver.FindElement(By.CssSelector("[class*='woocommerce-message']")); public Element TotalSpan => _driver.FindElement(By.XPath("//*[@class='order-total']//span")); public Element ProceedToCheckout => _driver.FindElement(By.CssSelector("[class*='checkout-button button alt wc-forward']")); } }
52.966667
132
0.728131
[ "Apache-2.0" ]
AutomateThePlanet/Design-Patterns-for-High-Quality-Automated-Tests-CSharp-Edition
Chapter 5- Tests Maintainability/TestsMaintainabilityDemos/Pages/6. Multi-File Page Objects with NavigatableBasePage and Sections/CartPage/CartPageElements.cs
1,591
C#
// // The Open Toolkit Library License // // Copyright (c) 2006 - 2009 the Open Toolkit library. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Diagnostics; using OpenTK.Graphics; namespace OpenTK.Platform { // Provides the foundation for all desktop IGraphicsContext implementations. internal abstract class EmbeddedGraphicsContext : GraphicsContextBase { public override void LoadAll() { Stopwatch time = Stopwatch.StartNew(); #if OPENGLES new OpenTK.Graphics.ES11.GL().LoadEntryPoints(); new OpenTK.Graphics.ES20.GL().LoadEntryPoints(); new OpenTK.Graphics.ES30.GL().LoadEntryPoints(); #endif Debug.Print("Bindings loaded in {0} ms.", time.Elapsed.TotalMilliseconds); } } }
39.354167
86
0.707782
[ "BSD-3-Clause" ]
mbadry1/opentk
src/OpenTK/Platform/EmbeddedGraphicsContext.cs
1,889
C#
using Markdig.Wpf; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Navigation; namespace TranscriptionService { /// <summary> /// Google Cloud Vision API 初期設定ページ3 /// 機能:サービスアカウントの設定の変更 /// (Google_Cloud_Vision_API_InitialSetting_Page3.xaml の相互作用ロジック) /// </summary> public partial class Google_Cloud_Vision_API_InitialSetting_Page3 : Page { public Google_Cloud_Vision_API_InitialSetting_Page3(bool initial_setting, string service_account_key) { InitializeComponent(); initialization = initial_setting; service_account_key_data = service_account_key; if (initialization == false) { // 初期設定でない場合、オプション設定ボタンを非表示にする option_setting_button.Visibility = Visibility.Hidden; } // リッチテキストボックスにコメントを表示する FlowDocument instruction_comment = Markdown.ToFlowDocument((string)FindResource("google_cloud_vision_api/initial_setting_3/instruction_comment")); instruction_comment.FontSize = 20.0; instruction_comment_rich_text_box.Document = instruction_comment; // リッチテキストボックスにキーのエクスポート設定の説明文を表示する FlowDocument key_export_setting_description = Markdown.ToFlowDocument((string)FindResource("google_cloud_vision_api/initial_setting_3/key_export_setting_description")); key_export_setting_description.FontSize = 20.0; key_export_setting_description_rich_text_box.Document = key_export_setting_description; } private bool initialization; // 初期設定かどうかのフラグ private string service_account_key_data; // サービスアカウントキー /// <summary> /// 閉じるボタンがクリックされた際の処理 /// </summary> private void Close_button_Click(object sender, RoutedEventArgs e) { if (key_export_setting_checkbox.IsChecked == true) { // エクスポートが許可された場合、その設定でサービスアカウントキーを再度保存する Functions.SetTranscriptionServiceCredential(service_account_key_data, true); } Unloaded -= Page_Unloaded; service_account_key_data = string.Empty; Window parent_window = Window.GetWindow(this); parent_window.Close(); } /// <summary> /// オプション設定ボタンがクリックされた際の処理 /// </summary> private void Option_setting_button_Click(object sender, RoutedEventArgs e) { if (key_export_setting_checkbox.IsChecked == true) { // エクスポートが許可された場合、その設定でサービスアカウントキーを再度保存する Functions.SetTranscriptionServiceCredential(service_account_key_data, true); } Unloaded -= Page_Unloaded; service_account_key_data = string.Empty; // 次のページ(オプション設定)に進む NavigationService.Navigate(new Google_Cloud_Vision_API_InitialSetting_Page4(initialization)); } /// <summary> /// ページの読み込みが解除された(=ウィンドウが閉じられた)際の処理 /// </summary> private void Page_Unloaded(object sender, RoutedEventArgs e) { if (key_export_setting_checkbox.IsChecked == true) { // エクスポートが許可された場合、その設定でサービスアカウントキーを再度保存する Functions.SetTranscriptionServiceCredential(service_account_key_data, true); // 保存された設定を通知する MessageBox.Show((string)FindResource("google_cloud_vision_api/initial_setting_3/key_export_setting_notification_message_allow"), (string)FindResource("google_cloud_vision_api/initial_setting_3/key_export_setting_notification_title_allow")); } else { // 保存された設定を通知する MessageBox.Show((string)FindResource("google_cloud_vision_api/initial_setting_3/key_export_setting_notification_message_disallow"), (string)FindResource("google_cloud_vision_api/initial_setting_3/key_export_setting_notification_title_disallow")); } service_account_key_data = string.Empty; } } }
44.468085
263
0.656459
[ "MIT" ]
bigbamboo-jp/cloud-ocr-snip
Cloud OCR Snip/Cloud OCR Snip/TranscriptionServices/Google Cloud Vision API/InitialSetting/Google_Cloud_Vision_API_InitialSetting_Page3.xaml.cs
4,914
C#
using UnityEngine; using System.Collections; [RequireComponent(typeof(Camera))] public class RTSCamera : MonoBehaviour { [SerializeField] bool scrollEnabled = false; void Update() { if (Input.GetKeyDown(KeyCode.S)) { scrollEnabled = !scrollEnabled; } if (!scrollEnabled) { return; } float s = Time.deltaTime * 8f; Vector3 mpos = Input.mousePosition; mpos.y = Screen.height - mpos.y; if (mpos.y < 15) { transform.position += Vector3.forward * s; } else if (mpos.y > Screen.height - 15) { transform.position += Vector3.back * s; } if (mpos.x < 15) { transform.position += Vector3.left * s; } else if (mpos.x > Screen.width - 15) { transform.position += Vector3.right * s; } } }
20.977778
54
0.504237
[ "Unlicense", "MIT" ]
Amitkapadi/unityassets
FogOfWarDesktop/Assets/FogOfWarDesktop/Demo/Scripts/RTSCamera.cs
944
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Ejercicio8 : MonoBehaviour { // Start is called before the first frame update public int dia = 0; void Start() { switch (dia) { case 1: Debug.Log("Domingo"); break; case 2: Debug.Log("lunes"); break; case 3: Debug.Log("martes"); break; case 4: Debug.Log("miercoles"); break; case 5: Debug.Log("jueves"); break; case 6: Debug.Log("viernes"); break; case 7: Debug.Log("sabado"); break; default: Debug.Log("Su dia no corresponde"); break; } } // Update is called once per frame void Update() { } }
24.921053
56
0.439282
[ "MIT" ]
Lautaro2210/Guia-De-Programaci-n-1
Assets/Scenes/Ejercicio8.cs
949
C#
using DAL.Models; using Entities; using HousingBillPaymentAPI.Helper; namespace HousingBillPaymentAPI.Services { public class DebtTypeService { private HousingBillPaymentContext _context = new HousingBillPaymentContext(); /// <summary> /// Veri tabanına yeni bir borç tipi ekler. /// </summary> /// <param name="_debtType"></param> /// <returns>Borç tipi ekleme işleminin cevabını döner</returns> public BaseResponse AddDebtType(DebtType _debtType) { var response = new BaseResponse(); try { _context.DebtType.Add(_debtType); //Content içerisine yeni bir borç eklenir. _context.SaveChanges(); //Ekleme işlemi veri tabanında değişikliklere neden olduğu için değişiklikler kaydedilir. response.Success = true; response.Message = "Borç tipi kaydedilmiştir."; response.Data = GetDebtTypes(); } catch (Exception ex) { Console.WriteLine(ex.Message); response.Success = false; response.Message = "Borç tipi kaydetme işlemi sırasında hata meydana geldi."; } return response; } /// <summary> /// Veritabanında bulunan borç tiplerini getirir. /// </summary> /// <returns>Borç tipi listesi döner</returns> public List<DebtType> GetDebtTypes() { return _context.DebtType.OrderBy(d => d.Id).ToList(); //Id bilgisinie göre borç tipleri sıralanır ve getirilir. } /// <summary> /// Parametre olarak verilen id değerine sahip borç tipini getirir. /// </summary> /// <param name="_id"></param> /// <returns>Borç tipi döner</returns> public DebtType GetDebtType(int _id) { return _context.DebtType.FirstOrDefault(d => d.Id == _id); } /// <summary> /// Veritabanında kayıtlı olan borç tipi bilgilerini, parametre olarak verilen borç tipi bilgileri ile günceller. /// <param name="_debtType"></param> /// </summary> /// <returns>Güncelleme işleminin cevabını döner/returns> public BaseResponse UpdateDebtType(DebtType _debtType) { var response = new BaseResponse(); DebtType exist = _context.DebtType.Find(_debtType.Id);//Borç tipinin veritabanında bulunma durumu kontrol edilir. if (exist != null) { try { _context.Entry(exist).CurrentValues.SetValues(_debtType); //Bulunan borç tipi bilgileri yenileri ile güncellenir. _context.SaveChanges();// Güncelleme işlemi veri tabanında değişikliklere neden olduğu için değişiklikler kaydedilir. response.Success = true; response.Message = "Borç tipi güncellendi"; response.Data = GetDebtTypes(); } catch (Exception ex) { Console.WriteLine(ex.Message); response.Success = false; response.Message = "Borç tipi güncelleme işlemi sırasında hata meydana geldi"; } } else { response.Success = false; response.Message = "Borç tipi bulunamadı"; } return response; } /// <summary> /// Veri tabanından verilen id'ye sahip borç tipini siler. /// <param name=_id"></param> /// </summary> /// <returns>Borç tipi silme işleminin cevabını döner/returns> public BaseResponse DeleteDebtType(int _id) { var response = new BaseResponse(); try { _context.DebtType.Remove(GetDebtType(_id)); //GetDebt metodu ile getirilen ilgili id'ye sahip borç tipini siler. _context.SaveChanges();// Silme işlemi veri tabanında değişikliklere neden olduğu için değişiklikler kaydedilir. response.Success = true; response.Message = "Borç tipi silindi"; response.Data = GetDebtTypes(); } catch (Exception ex) { Console.WriteLine(ex.Message); response.Success = false; response.Message = "Borç tipi silme işlemi sırasında hata meydana geldi"; } return response; } /// <summary> /// Veri tabanındaki borç tipi listesini sayfalanabilir yapıda döner. /// <param name=pagingParameters"></param> /// </summary> /// <returns>Borç tipi listesinin sayfalama işlemi cevabını döner./returns> public BaseResponse PaingDebtTypes(PagingParameters pagingParameters) { var response = new BaseResponse(); try { List<DebtType> pageableData = GetDebtTypes() //Veri tabanındaki borç tiplerinin listesi .OrderBy(d => d.Type) //Borç tipi ismine göre sıralar .Skip((pagingParameters.PageNumber - 1) * pagingParameters.PageSize) //Yeni sayfadaki verilerin listedeki hangi indexdeki veriden itibaren devam edeceğini belirtir. .Take(pagingParameters.PageSize) //Sayfada listelenecek veri miktarını belirtir. .ToList(); response.Success = true; response.Data = pageableData; } catch (Exception ex) { response.Success = false; response.Message = "Borç tiplerini sayfalama işlemi sırasında hata meydana geldi"; } return response; } } }
40.193103
179
0.56606
[ "MIT" ]
AKBANK-Patika-FullStack-Bootcamp/EdaCam_GraduationProject
HousingBillPaymentAPI/HousingBillPaymentAPI/Services/DebtTypeService.cs
5,940
C#
using System.Diagnostics.CodeAnalysis; using System.Net.Http; using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; using JetBrains.Annotations; namespace dotAPNS.AspNetCore { public interface IApnsClientFactory { IApnsClient CreateUsingCert([NotNull] X509Certificate2 cert, bool useSandbox = false, bool disableServerCertValidation = false); IApnsClient CreateUsingCert([NotNull] string pathToCert, bool useSandbox = false, bool disableServerCertValidation = false); IApnsClient CreateUsingJwt([NotNull] ApnsJwtOptions options, bool useSandbox = false, bool disableServerCertValidation = false); } public class ApnsClientFactory : IApnsClientFactory { readonly IHttpClientFactory _httpClientFactory; public ApnsClientFactory(IHttpClientFactory httpClientFactory) { _httpClientFactory = httpClientFactory; } public IApnsClient CreateUsingCert(X509Certificate2 cert, bool useSandbox, bool disableServerCertValidation = false) { var client = disableServerCertValidation ? CreateUsingCertWithNoServerCertValidation(cert) : ApnsClient.CreateUsingCert(cert); if (useSandbox) client.UseSandbox(); return client; } public IApnsClient CreateUsingCert(string pathToCert, bool useSandbox = false, bool disableServerCertValidation = false) { var cert = new X509Certificate2(pathToCert); return CreateUsingCert(cert, useSandbox, disableServerCertValidation); } public IApnsClient CreateUsingJwt(ApnsJwtOptions options, bool useSandbox = false, bool disableServerCertValidation = false) { var httpClient = _httpClientFactory.CreateClient(disableServerCertValidation ? "dotAPNS_DisableCerverCertValidation" : "dotAPNS"); var client = ApnsClient.CreateUsingJwt(httpClient, options); if (useSandbox) client.UseSandbox(); return client; } ApnsClient CreateUsingCertWithNoServerCertValidation(X509Certificate2 cert) { var handler = new HttpClientHandler { ClientCertificateOptions = ClientCertificateOption.Manual, ServerCertificateCustomValidationCallback = (a, b, c, d) => true }; handler.ClientCertificates.Add(cert); var httpClient = new HttpClient(handler); var client = ApnsClient.CreateUsingCustomHttpClient(httpClient, cert); return client; } } }
40.907692
142
0.684844
[ "Apache-2.0" ]
alexalok/dotAPNS
dotAPNS.AspNetCore/ApnsClientFactory.cs
2,661
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("WebApp_Storage_DotNet")] [assembly: AssemblyDescription("Azure Blob Storage Photo Gallery")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WebApp_Storage_DotNet")] [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("d7795000-51a3-479c-9819-72922b73d442")] // 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 Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
38.944444
84
0.757489
[ "MIT" ]
Tarak-Chandra-Sarkar/WebApp-Blob-Storage-DotNet
WebApp-Storage-DotNet/Properties/AssemblyInfo.cs
1,405
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class Restart : MonoBehaviour { public void RestartGame() { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } }
20.642857
67
0.757785
[ "Unlicense" ]
AceofGrades/BombermanGame
Assets/Scripts/Restart.cs
291
C#
using System.Collections.Generic; using UnityEngine; using System.IO; using System.Linq; #if UNITY_EDITOR using UnityEditor; #endif /** * Welcome to Unity Machine Learning Agents (ML-Agents). * * The ML-Agents toolkit contains five entities: Academy, Brain, Agent, Communicator and * Python API. The academy, and all its brains and connected agents live within * a learning environment (herin called Environment), while the communicator * manages the communication between the learning environment and the Python * API. For more information on each of these entities, in addition to how to * set-up a learning environment and train the behavior of characters in a * Unity scene, please browse our documentation pages on GitHub: * https://github.com/Unity-Technologies/ml-agents/blob/master/docs/ */ namespace MLAgents { /// <summary> /// Wraps the environment-level parameters that are provided within the /// Editor. These parameters can be provided for training and inference /// modes separately and represent screen resolution, rendering quality and /// frame rate. /// </summary> [System.Serializable] public class EnvironmentConfiguration { [Tooltip("Width of the environment window in pixels.")] public int width; [Tooltip("Height of the environment window in pixels.")] public int height; [Tooltip("Rendering quality of environment. (Higher is better quality.)")] [Range(0, 5)] public int qualityLevel; [Tooltip("Speed at which environment is run. (Higher is faster.)")] [Range(1f, 100f)] public float timeScale; [Tooltip("Frames per second (FPS) engine attempts to maintain.")] public int targetFrameRate; /// Initializes a new instance of the /// <see cref="EnvironmentConfiguration"/> class. /// <param name="width">Width of environment window (pixels).</param> /// <param name="height">Height of environment window (pixels).</param> /// <param name="qualityLevel"> /// Rendering quality of environment. Ranges from 0 to 5, with higher. /// </param> /// <param name="timeScale"> /// Speed at which environment is run. Ranges from 1 to 100, with higher /// values representing faster speed. /// </param> /// <param name="targetFrameRate"> /// Target frame rate (per second) that the engine tries to maintain. /// </param> public EnvironmentConfiguration( int width, int height, int qualityLevel, float timeScale, int targetFrameRate) { this.width = width; this.height = height; this.qualityLevel = qualityLevel; this.timeScale = timeScale; this.targetFrameRate = targetFrameRate; } } /// <summary> /// An Academy is where Agent objects go to train their behaviors. More /// specifically, an academy is a collection of Brain objects and each agent /// in a scene is attached to one brain (a single brain may be attached to /// multiple agents). Currently, this class is expected to be extended to /// implement the desired academy behavior. /// </summary> /// <remarks> /// When an academy is run, it can either be in inference or training mode. /// The mode is determined by the presence or absence of a Communicator. In /// the presence of a communicator, the academy is run in training mode where /// the states and observations of each agent are sent through the /// communicator. In the absence of a communciator, the academy is run in /// inference mode where the agent behavior is determined by the brain /// attached to it (which may be internal, heuristic or player). /// </remarks> [HelpURL("https://github.com/Unity-Technologies/ml-agents/blob/master/" + "docs/Learning-Environment-Design-Academy.md")] public abstract class Academy : MonoBehaviour { [SerializeField] public BroadcastHub broadcastHub = new BroadcastHub(); private const string kApiVersion = "API-7"; /// Temporary storage for global gravity value /// Used to restore oringal value when deriving Academy modifies it private Vector3 originalGravity; /// Temporary storage for global fixedDeltaTime value /// Used to restore oringal value when deriving Academy modifies it private float originalFixedDeltaTime; /// Temporary storage for global maximumDeltaTime value /// Used to restore oringal value when deriving Academy modifies it private float originalMaximumDeltaTime; // Fields provided in the Inspector [SerializeField] [Tooltip("Total number of steps per global episode.\nNon-positive " + "values correspond to episodes without a maximum number of \n" + "steps. Once the step counter reaches this maximum value, the " + "environment will reset.")] int maxSteps; [SerializeField] [Tooltip("The engine-level settings which correspond to rendering " + "quality and engine speed during Training.")] EnvironmentConfiguration trainingConfiguration = new EnvironmentConfiguration(80, 80, 1, 100.0f, -1); [SerializeField] [Tooltip("The engine-level settings which correspond to rendering " + "quality and engine speed during Inference.")] EnvironmentConfiguration inferenceConfiguration = new EnvironmentConfiguration(1280, 720, 5, 1.0f, 60); /// <summary> /// Contains a mapping from parameter names to float values. They are /// used in <see cref="AcademyReset"/> and <see cref="AcademyStep"/> /// to modify elements in the environment at reset time. /// <summary/> /// <remarks> /// Default reset parameters are specified in the academy Editor, and can /// be modified when training with an external Brain by passinga config /// dictionary at reset. /// </remarks> [SerializeField] [Tooltip("List of custom parameters that can be changed in the " + "environment when it resets.")] public ResetParameters resetParameters; // Fields not provided in the Inspector. /// Boolean flag indicating whether a communicator is accessible by the /// environment. This also specifies whether the environment is in /// Training or Inference mode. bool isCommunicatorOn; /// Keeps track of the id of the last communicator message received. /// Remains 0 if there are no communicators. Is used to ensure that /// the same message is not used multiple times. private ulong lastCommunicatorMessageNumber; /// If true, the Academy will use inference settings. This field is /// initialized in <see cref="Awake"/> depending on the presence /// or absence of a communicator. Furthermore, it can be modified by an /// external Brain during reset via <see cref="SetIsInference"/>. bool isInference = true; /// The done flag of the academy. When set to true, the academy will /// call <see cref="AcademyReset"/> instead of <see cref="AcademyStep"/> /// at step time. If true, all agents done flags will be set to true. bool done; /// Whether the academy has reached the maximum number of steps for the /// current episode. bool maxStepReached; /// The number of episodes completed by the environment. Incremented /// each time the environment is reset. int episodeCount; /// The number of steps completed within the current episide. Incremented /// each time a step is taken in the environment. Is reset to 0 during /// <see cref="AcademyReset"/>. int stepCount; /// Flag that indicates whether the inference/training mode of the /// environment was switched by the external Brain. This impacts the /// engine settings at the next environment step. bool modeSwitched; /// Pointer to the batcher currently in use by the Academy. MLAgents.Batcher brainBatcher; /// Used to write error messages. StreamWriter logWriter; /// The path to where the log should be written. string logPath; // Flag used to keep track of the first time the Academy is reset. bool firstAcademyReset; // The Academy uses a series of events to communicate with agents and // brains to facilitate synchronization. More specifically, it ensure // that all the agents performs their steps in a consistent order (i.e. no // agent can act based on a decision before another agent has had a chance // to request a decision). // Signals to all the Brains at each environment step so they can decide // actions for their agents. public event System.Action BrainDecideAction; // Signals to all the agents at each environment step along with the // Academy's maxStepReached, done and stepCount values. The agents rely // on this event to update their own values of max step reached and done // in addition to aligning on the step count of the global episode. public event System.Action<bool, bool, int> AgentSetStatus; // Signals to all the agents at each environment step so they can reset // if their flag has been set to done (assuming the agent has requested a // decision). public event System.Action AgentResetIfDone; // Signals to all the agents at each environment step so they can send // their state to their Brain if they have requested a decision. public event System.Action AgentSendState; // Signals to all the agents at each environment step so they can act if // they have requested a decision. public event System.Action AgentAct; // Sigals to all the agents each time the Academy force resets. public event System.Action AgentForceReset; /// <summary> /// Monobehavior function called at the very beginning of environment /// creation. Academy uses this time to initialize internal data /// structures, initialize the environment and check for the existence /// of a communicator. /// </summary> void Awake() { InitializeEnvironment(); } // Used to read Python-provided environment parameters private int ReadArgs() { var args = System.Environment.GetCommandLineArgs(); var inputPort = ""; for (var i = 0; i < args.Length; i++) { if (args[i] == "--port") { inputPort = args[i + 1]; } } return int.Parse(inputPort); } /// <summary> /// Initializes the environment, configures it and initialized the Academy. /// </summary> private void InitializeEnvironment() { originalGravity = Physics.gravity; originalFixedDeltaTime = Time.fixedDeltaTime; originalMaximumDeltaTime = Time.maximumDeltaTime; InitializeAcademy(); Communicator communicator = null; var exposedBrains = broadcastHub.broadcastingBrains.Where(x => x != null).ToList();; var controlledBrains = broadcastHub.broadcastingBrains.Where( x => x != null && x is LearningBrain && broadcastHub.IsControlled(x)); foreach (LearningBrain brain in controlledBrains) { brain.SetToControlledExternally(); } // Try to launch the communicator by usig the arguments passed at launch try { communicator = new RPCCommunicator( new CommunicatorParameters { port = ReadArgs() }); } // If it fails, we check if there are any external brains in the scene // If there are : Launch the communicator on the default port // If there arn't, there is no need for a communicator and it is set // to null catch { communicator = null; if (controlledBrains.ToList().Count > 0) { communicator = new RPCCommunicator( new CommunicatorParameters { port = 5005 }); } } brainBatcher = new Batcher(communicator); foreach (var trainingBrain in exposedBrains) { trainingBrain.SetBatcher(brainBatcher); } if (communicator != null) { isCommunicatorOn = true; var academyParameters = new CommunicatorObjects.UnityRLInitializationOutput(); academyParameters.Name = gameObject.name; academyParameters.Version = kApiVersion; foreach (var brain in exposedBrains) { var bp = brain.brainParameters; academyParameters.BrainParameters.Add( bp.ToProto(brain.name, broadcastHub.IsControlled(brain))); } academyParameters.EnvironmentParameters = new CommunicatorObjects.EnvironmentParametersProto(); foreach (var key in resetParameters.Keys) { academyParameters.EnvironmentParameters.FloatParameters.Add( key, resetParameters[key] ); } var pythonParameters = brainBatcher.SendAcademyParameters(academyParameters); Random.InitState(pythonParameters.Seed); Application.logMessageReceived += HandleLog; logPath = Path.GetFullPath(".") + "/UnitySDK.log"; logWriter = new StreamWriter(logPath, false); logWriter.WriteLine(System.DateTime.Now.ToString()); logWriter.WriteLine(" "); logWriter.Close(); } // If a communicator is enabled/provided, then we assume we are in // training mode. In the absence of a communicator, we assume we are // in inference mode. isInference = !isCommunicatorOn; BrainDecideAction += () => { }; AgentSetStatus += (m, d, i) => { }; AgentResetIfDone += () => { }; AgentSendState += () => { }; AgentAct += () => { }; AgentForceReset += () => { }; // Configure the environment using the configurations provided by // the developer in the Editor. SetIsInference(!brainBatcher.GetIsTraining()); ConfigureEnvironment(); } private void UpdateResetParameters() { var newResetParameters = brainBatcher.GetEnvironmentParameters(); if (newResetParameters != null) { foreach (var kv in newResetParameters.FloatParameters) { resetParameters[kv.Key] = kv.Value; } } } void HandleLog(string logString, string stackTrace, LogType type) { logWriter = new StreamWriter(logPath, true); logWriter.WriteLine(type.ToString()); logWriter.WriteLine(logString); logWriter.WriteLine(stackTrace); logWriter.Close(); } /// <summary> /// Configures the environment settings depending on the training/inference /// mode and the corresponding parameters passed in the Editor. /// </summary> void ConfigureEnvironment() { if (isInference) { ConfigureEnvironmentHelper(inferenceConfiguration); Monitor.SetActive(true); } else { ConfigureEnvironmentHelper(trainingConfiguration); Monitor.SetActive(false); } } /// <summary> /// Helper method for initializing the environment based on the provided /// configuration. /// </summary> /// <param name="config"> /// Environment configuration (specified in the Editor). /// </param> static void ConfigureEnvironmentHelper(EnvironmentConfiguration config) { Screen.SetResolution(config.width, config.height, false); QualitySettings.SetQualityLevel(config.qualityLevel, true); Time.timeScale = config.timeScale; Time.captureFramerate = 60; Application.targetFrameRate = config.targetFrameRate; } /// <summary> /// Initializes the academy and environment. Called during the waking-up /// phase of the environment before any of the scene objects/agents have /// been initialized. /// </summary> public virtual void InitializeAcademy() { } /// <summary> /// Specifies the academy behavior at every step of the environment. /// </summary> public virtual void AcademyStep() { } /// <summary> /// Specifies the academy behavior when being reset (i.e. at the completion /// of a global episode). /// </summary> public virtual void AcademyReset() { } /// <summary> /// Returns the <see cref="isInference"/> flag. /// </summary> /// <returns> /// <c>true</c>, if current mode is inference, <c>false</c> if training. /// </returns> public bool GetIsInference() { return isInference; } /// <summary> /// Sets the <see cref="isInference"/> flag to the provided value. If /// the new flag differs from the current flag value, this signals that /// the environment configuration needs to be updated. /// </summary> /// <param name="isInference"> /// Environment mode, if true then inference, otherwise training. /// </param> public void SetIsInference(bool isInference) { if (this.isInference != isInference) { this.isInference = isInference; // This signals to the academy that at the next environment step // the engine configurations need updating to the respective mode // (i.e. training vs inference) configuraiton. modeSwitched = true; } } /// <summary> /// Returns the current episode counter. /// </summary> /// <returns> /// Current episode number. /// </returns> public int GetEpisodeCount() { return episodeCount; } /// <summary> /// Returns the current step counter (within the current epside). /// </summary> /// <returns> /// Current episode number. /// </returns> public int GetStepCount() { return stepCount; } /// <summary> /// Sets the done flag to true. /// </summary> public void Done() { done = true; } /// <summary> /// Returns whether or not the academy is done. /// </summary> /// <returns> /// <c>true</c>, if academy is done, <c>false</c> otherwise. /// </returns> public bool IsDone() { return done; } /// <summary> /// Returns whether or not the communicator is on. /// </summary> /// <returns> /// <c>true</c>, if communicator is on, <c>false</c> otherwise. /// </returns> public bool IsCommunicatorOn() { return isCommunicatorOn; } /// <summary> /// Forces the full reset. The done flags are not affected. Is either /// called the first reset at inference and every external reset /// at training. /// </summary> void ForcedFullReset() { EnvironmentReset(); AgentForceReset(); firstAcademyReset = true; } /// <summary> /// Performs a single environment update to the Academy, Brain and Agent /// objects within the environment. /// </summary> void EnvironmentStep() { if (modeSwitched) { ConfigureEnvironment(); modeSwitched = false; } if ((isCommunicatorOn) && (lastCommunicatorMessageNumber != brainBatcher.GetNumberMessageReceived())) { lastCommunicatorMessageNumber = brainBatcher.GetNumberMessageReceived(); if (brainBatcher.GetCommand() == CommunicatorObjects.CommandProto.Reset) { UpdateResetParameters(); SetIsInference(!brainBatcher.GetIsTraining()); ForcedFullReset(); } if (brainBatcher.GetCommand() == CommunicatorObjects.CommandProto.Quit) { #if UNITY_EDITOR EditorApplication.isPlaying = false; #endif Application.Quit(); return; } } else if (!firstAcademyReset) { UpdateResetParameters(); ForcedFullReset(); } if ((stepCount >= maxSteps) && maxSteps > 0) { maxStepReached = true; Done(); } AgentSetStatus(maxStepReached, done, stepCount); brainBatcher.RegisterAcademyDoneFlag(done); if (done) { EnvironmentReset(); } AgentResetIfDone(); AgentSendState(); BrainDecideAction(); AcademyStep(); AgentAct(); stepCount += 1; } /// <summary> /// Resets the environment, including the Academy. /// </summary> void EnvironmentReset() { stepCount = 0; episodeCount++; done = false; maxStepReached = false; AcademyReset(); } /// <summary> /// Monobehavior function that dictates each environment step. /// </summary> void FixedUpdate() { EnvironmentStep(); } /// <summary> /// Cleanup function /// </summary> protected virtual void OnDestroy() { Physics.gravity = originalGravity; Time.fixedDeltaTime = originalFixedDeltaTime; Time.maximumDeltaTime = originalMaximumDeltaTime; } } }
36.879688
96
0.574588
[ "Apache-2.0" ]
Aranclanos/ml-agents
UnitySDK/Assets/ML-Agents/Scripts/Academy.cs
23,605
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.Diagnostics.ContractsLight; using System.IO; using System.Linq; using System.Text; using System.Text.Json.Serialization; using BuildXL.Cache.ContentStore.Interfaces.FileSystem; using BuildXL.Cache.ContentStore.Interfaces.Utils; namespace BuildXL.Cache.ContentStore.Distributed { /// <summary> /// Location information for a machine usually represented as UNC path with machine name and a root path. /// </summary> public readonly struct MachineLocation : IEquatable<MachineLocation> { public const string GrpcUriSchemePrefix = "grpc://"; /// <summary> /// Binary representation of a machine location. /// </summary> public byte[] Data { get; init; } /// <summary> /// Gets whether the current machine location represents valid data /// </summary> [JsonIgnore] public bool IsValid => Data != null; /// <summary> /// Gets the path representation of the machine location /// </summary> public string Path { get; init; } /// <nodoc /> public MachineLocation(byte[] data) { Contract.Requires(data != null); Data = data; Path = Encoding.UTF8.GetString(data); } /// <nodoc /> public MachineLocation(string data) { Contract.Requires(data != null); Data = Encoding.UTF8.GetBytes(data); Path = data; } /// <inheritdoc /> public override string ToString() => Path; /// <inheritdoc /> public bool Equals(MachineLocation other) => ByteArrayComparer.ArraysEqual(Data, other.Data); /// <inheritdoc /> public override bool Equals(object obj) { if (obj is null) { return false; } return obj is MachineLocation location && Equals(location); } /// <inheritdoc /> public override int GetHashCode() { // GetHashCode is null-safe return ByteArrayComparer.Instance.GetHashCode(Data); } public static MachineLocation Create(string machineName, int port) { return new MachineLocation($"{MachineLocation.GrpcUriSchemePrefix}{machineName}:{port}/"); } public (string host, int? port) ExtractHostInfo() { if (Path.StartsWith(GrpcUriSchemePrefix)) { // This is a uri format machine location var uri = new Uri(Path); return (uri.Host, uri.Port); } var sourcePath = new AbsolutePath(Path); // TODO: Keep the segments in the AbsolutePath object? // TODO: Indexable structure? var segments = sourcePath.GetSegments(); Contract.Assert(segments.Count >= 4); string host = GetHostName(sourcePath.IsLocal, segments); return (host, null); } /// <summary> /// Extract the host name from an AbsolutePath's segments. /// </summary> public static string GetHostName(bool isLocal, IReadOnlyList<string> segments) { if (OperatingSystemHelper.IsWindowsOS) { return isLocal ? "localhost" : segments.First(); } else { // Linux always uses the first segment as the host name. return segments.First(); } } } }
30.58871
110
0.54996
[ "MIT" ]
DamGouz/BuildXL
Public/Src/Cache/ContentStore/Distributed/ContentLocations/MachineLocation.cs
3,793
C#
/* * Intersight REST API * * This is Intersight REST API * * OpenAPI spec version: 1.0.9-262 * * Generated by: https://github.com/swagger-api/swagger-codegen.git */ 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 System.ComponentModel.DataAnnotations; using SwaggerDateConverter = intersight.Client.SwaggerDateConverter; namespace intersight.Model { /// <summary> /// HyperflexInstallerImageRef /// </summary> [DataContract] public partial class HyperflexInstallerImageRef : IEquatable<HyperflexInstallerImageRef>, IValidatableObject { /// <summary> /// Initializes a new instance of the <see cref="HyperflexInstallerImageRef" /> class. /// </summary> [JsonConstructorAttribute] public HyperflexInstallerImageRef() { } /// <summary> /// Gets or Sets Moid /// </summary> [DataMember(Name="Moid", EmitDefaultValue=false)] public string Moid { get; private set; } /// <summary> /// Gets or Sets ObjectType /// </summary> [DataMember(Name="ObjectType", EmitDefaultValue=false)] public string ObjectType { get; private set; } /// <summary> /// Returns the string presentation of the object /// </summary> /// <returns>String presentation of the object</returns> public override string ToString() { var sb = new StringBuilder(); sb.Append("class HyperflexInstallerImageRef {\n"); sb.Append(" Moid: ").Append(Moid).Append("\n"); sb.Append(" ObjectType: ").Append(ObjectType).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns the JSON string presentation of the object /// </summary> /// <returns>JSON string presentation of the object</returns> public string ToJson() { return JsonConvert.SerializeObject(this, Formatting.Indented); } /// <summary> /// Returns true if objects are equal /// </summary> /// <param name="obj">Object to be compared</param> /// <returns>Boolean</returns> public override bool Equals(object obj) { // credit: http://stackoverflow.com/a/10454552/677735 return this.Equals(obj as HyperflexInstallerImageRef); } /// <summary> /// Returns true if HyperflexInstallerImageRef instances are equal /// </summary> /// <param name="other">Instance of HyperflexInstallerImageRef to be compared</param> /// <returns>Boolean</returns> public bool Equals(HyperflexInstallerImageRef other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) return false; return ( this.Moid == other.Moid || this.Moid != null && this.Moid.Equals(other.Moid) ) && ( this.ObjectType == other.ObjectType || this.ObjectType != null && this.ObjectType.Equals(other.ObjectType) ); } /// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks etc, of course :) if (this.Moid != null) hash = hash * 59 + this.Moid.GetHashCode(); if (this.ObjectType != null) hash = hash * 59 + this.ObjectType.GetHashCode(); return hash; } } /// <summary> /// To validate all properties of the instance /// </summary> /// <param name="validationContext">Validation context</param> /// <returns>Validation Result</returns> IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) { yield break; } } }
32.661972
140
0.566624
[ "Apache-2.0" ]
ategaw-cisco/intersight-powershell
csharp/swaggerClient/src/intersight/Model/HyperflexInstallerImageRef.cs
4,638
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AsteroidsBL { /// <summary> /// Verwaltet eine Menge von Asteroiden /// </summary> public interface IAsteroidsRepository { /// <summary> /// Liefert den Asteroiden mit dem gegebenen Namen aus. /// Wirft eine Ausnahme, falls zum Namen kein Asteroid existiert. /// </summary> /// <param name="NameOfAsteroid"></param> /// <returns></returns> IAsteroid GetAsteroid(string NameOfAsteroid); /// <summary> /// Liefert true, falls ein Asteroid mit dem Namen enthalten ist /// </summary> /// <param name="NameOfAsteroid"></param> /// <returns></returns> bool Exists(string NameOfAsteroid); /// <summary> /// Fügt einen neuen Asteroiden dem Repository hinzu /// </summary> /// <param name=""></param> void Add(IAsteroid a); /// <summary> /// Liefert alle Asteroiden aus /// </summary> IEnumerable<IAsteroid> All {get;} /// <summary> /// Eine Untermeng der Asteroiden ausliefern /// </summary> /// <param name="Skip"></param> /// <param name="Take"></param> /// <param name="minDiameter"></param> /// <param name="maxDiameter"></param> /// <returns></returns> IEnumerable<IAsteroid> Query(int Skip, int Take, double minDiameter, double maxDiameter); /// <summary> /// Erzeugt einen neuen Querybuilder, mit dem eine neue Abfrage formuliert /// und ausgeführt werden kann /// </summary> /// <returns></returns> IQueryBuilder GetNewQueryBuilder(); } }
30.05
97
0.575153
[ "MIT" ]
mk-prg-net/FunWithAsteroids
AsteroidsBL/IAsteroidsRepository.cs
1,807
C#
#region Apache License // // 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. // #endregion using System; using System.Net; namespace log4net.Util.TypeConverters { /// <summary> /// Supports conversion from string to <see cref="IPAddress"/> type. /// </summary> /// <remarks> /// <para> /// Supports conversion from string to <see cref="IPAddress"/> type. /// </para> /// </remarks> /// <seealso cref="ConverterRegistry"/> /// <seealso cref="IConvertFrom"/> /// <author>Nicko Cadell</author> internal class IPAddressConverter : IConvertFrom { #region Implementation of IConvertFrom /// <summary> /// Can the source type be converted to the type supported by this object /// </summary> /// <param name="sourceType">the type to convert</param> /// <returns>true if the conversion is possible</returns> /// <remarks> /// <para> /// Returns <c>true</c> if the <paramref name="sourceType"/> is /// the <see cref="String"/> type. /// </para> /// </remarks> public bool CanConvertFrom(Type sourceType) { return (sourceType == typeof(string)); } /// <summary> /// Overrides the ConvertFrom method of IConvertFrom. /// </summary> /// <param name="source">the object to convert to an IPAddress</param> /// <returns>the IPAddress</returns> /// <remarks> /// <para> /// Uses the <see cref="IPAddress.Parse"/> method to convert the /// <see cref="String"/> argument to an <see cref="IPAddress"/>. /// If that fails then the string is resolved as a DNS hostname. /// </para> /// </remarks> /// <exception cref="ConversionNotSupportedException"> /// The <paramref name="source"/> object cannot be converted to the /// target type. To check for this condition use the <see cref="CanConvertFrom"/> /// method. /// </exception> public object ConvertFrom(object source) { string str = source as string; if (str != null && str.Length > 0) { try { #if NET_2_0 || NETCF_2_0 || NET_4_0 || NET_3_5 #if !NETCF_2_0 // Try an explicit parse of string representation of an IPAddress (v4 or v6) IPAddress result; if (IPAddress.TryParse(str, out result)) { return result; } #endif // Try to resolve via DNS. This is a blocking call. // GetHostEntry works with either an IPAddress string or a host name IPHostEntry host = Dns.GetHostEntry(str); if (host != null && host.AddressList != null && host.AddressList.Length > 0 && host.AddressList[0] != null) { return host.AddressList[0]; } #else // Before .NET 2 we need to try to parse the IPAddress from the string first // Check if the string only contains IP address valid chars if (str.Trim(validIpAddressChars).Length == 0) { try { // try to parse the string as an IP address return IPAddress.Parse(str); } catch(FormatException) { // Ignore a FormatException, try to resolve via DNS } } // Try to resolve via DNS. This is a blocking call. IPHostEntry host = Dns.GetHostByName(str); if (host != null && host.AddressList != null && host.AddressList.Length > 0 && host.AddressList[0] != null) { return host.AddressList[0]; } #endif } catch(Exception ex) { throw ConversionNotSupportedException.Create(typeof(IPAddress), source, ex); } } throw ConversionNotSupportedException.Create(typeof(IPAddress), source); } #endregion /// <summary> /// Valid characters in an IPv4 or IPv6 address string. (Does not support subnets) /// </summary> private static readonly char[] validIpAddressChars = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','A','B','C','D','E','F','x','X','.',':','%'}; } }
32.282759
166
0.627216
[ "BSD-3-Clause" ]
BillyWarrhol/Aurora-Sim
Dependencies/log4net/Util/TypeConverters/IPAddressConverter.cs
4,681
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using System.Collections.Generic; using System.Text.Json; using Azure.Core; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppService.Models { public partial class StaticSitePatchResource : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (Optional.IsDefined(Kind)) { writer.WritePropertyName("kind"); writer.WriteStringValue(Kind); } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(RepositoryUrl)) { writer.WritePropertyName("repositoryUrl"); writer.WriteStringValue(RepositoryUrl); } if (Optional.IsDefined(Branch)) { writer.WritePropertyName("branch"); writer.WriteStringValue(Branch); } if (Optional.IsDefined(RepositoryToken)) { writer.WritePropertyName("repositoryToken"); writer.WriteStringValue(RepositoryToken); } if (Optional.IsDefined(BuildProperties)) { writer.WritePropertyName("buildProperties"); writer.WriteObjectValue(BuildProperties); } if (Optional.IsDefined(StagingEnvironmentPolicy)) { writer.WritePropertyName("stagingEnvironmentPolicy"); writer.WriteStringValue(StagingEnvironmentPolicy.Value.ToSerialString()); } if (Optional.IsDefined(AllowConfigFileUpdates)) { writer.WritePropertyName("allowConfigFileUpdates"); writer.WriteBooleanValue(AllowConfigFileUpdates.Value); } if (Optional.IsDefined(TemplateProperties)) { writer.WritePropertyName("templateProperties"); writer.WriteObjectValue(TemplateProperties); } writer.WriteEndObject(); writer.WriteEndObject(); } internal static StaticSitePatchResource DeserializeStaticSitePatchResource(JsonElement element) { Optional<string> kind = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional<string> defaultHostname = default; Optional<string> repositoryUrl = default; Optional<string> branch = default; Optional<IReadOnlyList<string>> customDomains = default; Optional<string> repositoryToken = default; Optional<StaticSiteBuildProperties> buildProperties = default; Optional<IReadOnlyList<ResponseMessageEnvelopeRemotePrivateEndpointConnection>> privateEndpointConnections = default; Optional<StagingEnvironmentPolicy> stagingEnvironmentPolicy = default; Optional<bool> allowConfigFileUpdates = default; Optional<StaticSiteTemplateOptions> templateProperties = default; Optional<string> contentDistributionEndpoint = default; Optional<string> keyVaultReferenceIdentity = default; Optional<IReadOnlyList<StaticSiteUserProvidedFunctionApp>> userProvidedFunctionApps = default; Optional<string> provider = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("kind")) { kind = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize<SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("defaultHostname")) { defaultHostname = property0.Value.GetString(); continue; } if (property0.NameEquals("repositoryUrl")) { repositoryUrl = property0.Value.GetString(); continue; } if (property0.NameEquals("branch")) { branch = property0.Value.GetString(); continue; } if (property0.NameEquals("customDomains")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List<string> array = new List<string>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(item.GetString()); } customDomains = array; continue; } if (property0.NameEquals("repositoryToken")) { repositoryToken = property0.Value.GetString(); continue; } if (property0.NameEquals("buildProperties")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } buildProperties = StaticSiteBuildProperties.DeserializeStaticSiteBuildProperties(property0.Value); continue; } if (property0.NameEquals("privateEndpointConnections")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List<ResponseMessageEnvelopeRemotePrivateEndpointConnection> array = new List<ResponseMessageEnvelopeRemotePrivateEndpointConnection>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ResponseMessageEnvelopeRemotePrivateEndpointConnection.DeserializeResponseMessageEnvelopeRemotePrivateEndpointConnection(item)); } privateEndpointConnections = array; continue; } if (property0.NameEquals("stagingEnvironmentPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } stagingEnvironmentPolicy = property0.Value.GetString().ToStagingEnvironmentPolicy(); continue; } if (property0.NameEquals("allowConfigFileUpdates")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } allowConfigFileUpdates = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("templateProperties")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } templateProperties = StaticSiteTemplateOptions.DeserializeStaticSiteTemplateOptions(property0.Value); continue; } if (property0.NameEquals("contentDistributionEndpoint")) { contentDistributionEndpoint = property0.Value.GetString(); continue; } if (property0.NameEquals("keyVaultReferenceIdentity")) { keyVaultReferenceIdentity = property0.Value.GetString(); continue; } if (property0.NameEquals("userProvidedFunctionApps")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List<StaticSiteUserProvidedFunctionApp> array = new List<StaticSiteUserProvidedFunctionApp>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(StaticSiteUserProvidedFunctionApp.DeserializeStaticSiteUserProvidedFunctionApp(item)); } userProvidedFunctionApps = array; continue; } if (property0.NameEquals("provider")) { provider = property0.Value.GetString(); continue; } } continue; } } return new StaticSitePatchResource(id, name, type, systemData, kind.Value, defaultHostname.Value, repositoryUrl.Value, branch.Value, Optional.ToList(customDomains), repositoryToken.Value, buildProperties.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(stagingEnvironmentPolicy), Optional.ToNullable(allowConfigFileUpdates), templateProperties.Value, contentDistributionEndpoint.Value, keyVaultReferenceIdentity.Value, Optional.ToList(userProvidedFunctionApps), provider.Value); } } }
47.844622
513
0.48447
[ "MIT" ]
LeszekKalibrate/azure-sdk-for-net
sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSitePatchResource.Serialization.cs
12,009
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Xunit; namespace System.Net.Quic.Tests { public abstract class QuicStreamTests<T> : QuicTestBase<T> where T : IQuicImplProviderFactory, new() { private static ReadOnlyMemory<byte> s_data = Encoding.UTF8.GetBytes("Hello world!"); [ActiveIssue("https://github.com/dotnet/runtime/issues/49157")] [Fact] public async Task BasicTest() { using QuicListener listener = CreateQuicListener(); for (int i = 0; i < 100; i++) { Task listenTask = Task.Run(async () => { using QuicConnection connection = await listener.AcceptConnectionAsync(); await using QuicStream stream = await connection.AcceptStreamAsync(); byte[] buffer = new byte[s_data.Length]; int bytesRead = await stream.ReadAsync(buffer); Assert.Equal(s_data.Length, bytesRead); Assert.True(s_data.Span.SequenceEqual(buffer)); await stream.WriteAsync(s_data, endStream: true); await stream.ShutdownWriteCompleted(); await connection.CloseAsync(errorCode: 0); }); Task clientTask = Task.Run(async () => { using QuicConnection connection = CreateQuicConnection(listener.ListenEndPoint); await connection.ConnectAsync(); await using QuicStream stream = connection.OpenBidirectionalStream(); await stream.WriteAsync(s_data, endStream: true); byte[] memory = new byte[12]; int bytesRead = await stream.ReadAsync(memory); Assert.Equal(s_data.Length, bytesRead); // TODO this failed once... Assert.True(s_data.Span.SequenceEqual(memory)); await stream.ShutdownWriteCompleted(); await connection.CloseAsync(errorCode: 0); }); await (new[] { listenTask, clientTask }).WhenAllOrAnyFailed(millisecondsTimeout: 10000); } } [ActiveIssue("https://github.com/dotnet/runtime/issues/49157")] [Fact] public async Task MultipleReadsAndWrites() { using QuicListener listener = CreateQuicListener(); for (int j = 0; j < 100; j++) { Task listenTask = Task.Run(async () => { // Connection isn't being accepted, interesting. using QuicConnection connection = await listener.AcceptConnectionAsync(); await using QuicStream stream = await connection.AcceptStreamAsync(); byte[] buffer = new byte[s_data.Length]; while (true) { int bytesRead = await stream.ReadAsync(buffer); if (bytesRead == 0) { break; } Assert.Equal(s_data.Length, bytesRead); Assert.True(s_data.Span.SequenceEqual(buffer)); } for (int i = 0; i < 5; i++) { await stream.WriteAsync(s_data); } await stream.WriteAsync(Memory<byte>.Empty, endStream: true); await stream.ShutdownWriteCompleted(); await connection.CloseAsync(errorCode: 0); }); Task clientTask = Task.Run(async () => { using QuicConnection connection = CreateQuicConnection(listener.ListenEndPoint); await connection.ConnectAsync(); await using QuicStream stream = connection.OpenBidirectionalStream(); for (int i = 0; i < 5; i++) { await stream.WriteAsync(s_data); } await stream.WriteAsync(Memory<byte>.Empty, endStream: true); byte[] memory = new byte[12]; while (true) { int res = await stream.ReadAsync(memory); if (res == 0) { break; } Assert.True(s_data.Span.SequenceEqual(memory)); } await stream.ShutdownWriteCompleted(); await connection.CloseAsync(errorCode: 0); }); await (new[] { listenTask, clientTask }).WhenAllOrAnyFailed(millisecondsTimeout: 1000000); } } [Fact] public async Task MultipleStreamsOnSingleConnection() { using QuicListener listener = CreateQuicListener(); Task listenTask = Task.Run(async () => { { using QuicConnection connection = await listener.AcceptConnectionAsync(); await using QuicStream stream = await connection.AcceptStreamAsync(); await using QuicStream stream2 = await connection.AcceptStreamAsync(); byte[] buffer = new byte[s_data.Length]; while (true) { int bytesRead = await stream.ReadAsync(buffer); if (bytesRead == 0) { break; } Assert.Equal(s_data.Length, bytesRead); Assert.True(s_data.Span.SequenceEqual(buffer)); } while (true) { int bytesRead = await stream2.ReadAsync(buffer); if (bytesRead == 0) { break; } Assert.True(s_data.Span.SequenceEqual(buffer)); } await stream.WriteAsync(s_data, endStream: true); await stream.ShutdownWriteCompleted(); await stream2.WriteAsync(s_data, endStream: true); await stream2.ShutdownWriteCompleted(); await connection.CloseAsync(errorCode: 0); } }); Task clientTask = Task.Run(async () => { using QuicConnection connection = CreateQuicConnection(listener.ListenEndPoint); await connection.ConnectAsync(); await using QuicStream stream = connection.OpenBidirectionalStream(); await using QuicStream stream2 = connection.OpenBidirectionalStream(); await stream.WriteAsync(s_data, endStream: true); await stream.ShutdownWriteCompleted(); await stream2.WriteAsync(s_data, endStream: true); await stream2.ShutdownWriteCompleted(); byte[] memory = new byte[12]; while (true) { int res = await stream.ReadAsync(memory); if (res == 0) { break; } Assert.True(s_data.Span.SequenceEqual(memory)); } while (true) { int res = await stream2.ReadAsync(memory); if (res == 0) { break; } Assert.True(s_data.Span.SequenceEqual(memory)); } await connection.CloseAsync(errorCode: 0); }); await (new[] { listenTask, clientTask }).WhenAllOrAnyFailed(millisecondsTimeout: 60000); } [Fact] public async Task GetStreamIdWithoutStartWorks() { using QuicListener listener = CreateQuicListener(); using QuicConnection clientConnection = CreateQuicConnection(listener.ListenEndPoint); ValueTask clientTask = clientConnection.ConnectAsync(); using QuicConnection serverConnection = await listener.AcceptConnectionAsync(); await clientTask; using QuicStream clientStream = clientConnection.OpenBidirectionalStream(); Assert.Equal(0, clientStream.StreamId); } [ActiveIssue("https://github.com/dotnet/runtime/issues/49157")] [Fact] public async Task LargeDataSentAndReceived() { byte[] data = Enumerable.Range(0, 64 * 1024).Select(x => (byte)x).ToArray(); const int NumberOfWrites = 256; // total sent = 16M using QuicListener listener = CreateQuicListener(); for (int j = 0; j < 100; j++) { Task listenTask = Task.Run(async () => { using QuicConnection connection = await listener.AcceptConnectionAsync(); await using QuicStream stream = await connection.AcceptStreamAsync(); byte[] buffer = new byte[data.Length]; for (int i = 0; i < NumberOfWrites; i++) { int totalBytesRead = 0; while (totalBytesRead < data.Length) { int bytesRead = await stream.ReadAsync(buffer.AsMemory(totalBytesRead)); Assert.NotEqual(0, bytesRead); totalBytesRead += bytesRead; } Assert.Equal(data.Length, totalBytesRead); Assert.True(data.AsSpan().SequenceEqual(buffer)); } for (int i = 0; i < NumberOfWrites; i++) { await stream.WriteAsync(data); } await stream.WriteAsync(Memory<byte>.Empty, endStream: true); await stream.ShutdownWriteCompleted(); await connection.CloseAsync(errorCode: 0); }); Task clientTask = Task.Run(async () => { using QuicConnection connection = CreateQuicConnection(listener.ListenEndPoint); await connection.ConnectAsync(); await using QuicStream stream = connection.OpenBidirectionalStream(); byte[] buffer = new byte[data.Length]; for (int i = 0; i < NumberOfWrites; i++) { await stream.WriteAsync(data); } await stream.WriteAsync(Memory<byte>.Empty, endStream: true); for (int i = 0; i < NumberOfWrites; i++) { int totalBytesRead = 0; while (totalBytesRead < data.Length) { int bytesRead = await stream.ReadAsync(buffer.AsMemory(totalBytesRead)); Assert.NotEqual(0, bytesRead); totalBytesRead += bytesRead; } Assert.Equal(data.Length, totalBytesRead); Assert.True(data.AsSpan().SequenceEqual(buffer)); } await stream.ShutdownWriteCompleted(); await connection.CloseAsync(errorCode: 0); }); await (new[] { listenTask, clientTask }).WhenAllOrAnyFailed(millisecondsTimeout: 1000000); } } [Fact] public async Task TestStreams() { using QuicListener listener = CreateQuicListener(); IPEndPoint listenEndPoint = listener.ListenEndPoint; using QuicConnection clientConnection = CreateQuicConnection(listenEndPoint); Assert.False(clientConnection.Connected); Assert.Equal(listenEndPoint, clientConnection.RemoteEndPoint); ValueTask connectTask = clientConnection.ConnectAsync(); QuicConnection serverConnection = await listener.AcceptConnectionAsync(); await connectTask; Assert.True(clientConnection.Connected); Assert.True(serverConnection.Connected); Assert.Equal(listenEndPoint, serverConnection.LocalEndPoint); Assert.Equal(listenEndPoint, clientConnection.RemoteEndPoint); Assert.Equal(clientConnection.LocalEndPoint, serverConnection.RemoteEndPoint); await CreateAndTestBidirectionalStream(clientConnection, serverConnection); await CreateAndTestBidirectionalStream(serverConnection, clientConnection); await CreateAndTestUnidirectionalStream(serverConnection, clientConnection); await CreateAndTestUnidirectionalStream(clientConnection, serverConnection); await clientConnection.CloseAsync(errorCode: 0); } private static async Task CreateAndTestBidirectionalStream(QuicConnection c1, QuicConnection c2) { using QuicStream s1 = c1.OpenBidirectionalStream(); Assert.True(s1.CanRead); Assert.True(s1.CanWrite); ValueTask writeTask = s1.WriteAsync(s_data); using QuicStream s2 = await c2.AcceptStreamAsync(); await ReceiveDataAsync(s_data, s2); await writeTask; await TestBidirectionalStream(s1, s2); } private static async Task CreateAndTestUnidirectionalStream(QuicConnection c1, QuicConnection c2) { using QuicStream s1 = c1.OpenUnidirectionalStream(); Assert.False(s1.CanRead); Assert.True(s1.CanWrite); ValueTask writeTask = s1.WriteAsync(s_data); using QuicStream s2 = await c2.AcceptStreamAsync(); await ReceiveDataAsync(s_data, s2); await writeTask; await TestUnidirectionalStream(s1, s2); } private static async Task TestBidirectionalStream(QuicStream s1, QuicStream s2) { Assert.True(s1.CanRead); Assert.True(s1.CanWrite); Assert.True(s2.CanRead); Assert.True(s2.CanWrite); Assert.Equal(s1.StreamId, s2.StreamId); await SendAndReceiveDataAsync(s_data, s1, s2); await SendAndReceiveDataAsync(s_data, s2, s1); await SendAndReceiveDataAsync(s_data, s2, s1); await SendAndReceiveDataAsync(s_data, s1, s2); await SendAndReceiveEOFAsync(s1, s2); await SendAndReceiveEOFAsync(s2, s1); } private static async Task TestUnidirectionalStream(QuicStream s1, QuicStream s2) { Assert.False(s1.CanRead); Assert.True(s1.CanWrite); Assert.True(s2.CanRead); Assert.False(s2.CanWrite); Assert.Equal(s1.StreamId, s2.StreamId); await SendAndReceiveDataAsync(s_data, s1, s2); await SendAndReceiveDataAsync(s_data, s1, s2); await SendAndReceiveEOFAsync(s1, s2); } private static async Task SendAndReceiveDataAsync(ReadOnlyMemory<byte> data, QuicStream s1, QuicStream s2) { await s1.WriteAsync(data); await ReceiveDataAsync(data, s2); } private static async Task ReceiveDataAsync(ReadOnlyMemory<byte> data, QuicStream s) { Memory<byte> readBuffer = new byte[data.Length]; int bytesRead = 0; while (bytesRead < data.Length) { bytesRead += await s.ReadAsync(readBuffer.Slice(bytesRead)); } Assert.True(data.Span.SequenceEqual(readBuffer.Span)); } private static async Task SendAndReceiveEOFAsync(QuicStream s1, QuicStream s2) { byte[] readBuffer = new byte[1]; await s1.WriteAsync(Memory<byte>.Empty, endStream: true); await s1.ShutdownWriteCompleted(); int bytesRead = await s2.ReadAsync(readBuffer); Assert.Equal(0, bytesRead); // Another read should still give EOF bytesRead = await s2.ReadAsync(readBuffer); Assert.Equal(0, bytesRead); } [Theory] [MemberData(nameof(ReadWrite_Random_Success_Data))] public async Task ReadWrite_Random_Success(int readSize, int writeSize) { byte[] testBuffer = new byte[8192]; Random.Shared.NextBytes(testBuffer); await RunClientServer( async clientConnection => { await using QuicStream clientStream = clientConnection.OpenUnidirectionalStream(); ReadOnlyMemory<byte> sendBuffer = testBuffer; while (sendBuffer.Length != 0) { ReadOnlyMemory<byte> chunk = sendBuffer.Slice(0, Math.Min(sendBuffer.Length, writeSize)); await clientStream.WriteAsync(chunk); sendBuffer = sendBuffer.Slice(chunk.Length); } clientStream.Shutdown(); await clientStream.ShutdownWriteCompleted(); }, async serverConnection => { await using QuicStream serverStream = await serverConnection.AcceptStreamAsync(); byte[] receiveBuffer = new byte[testBuffer.Length]; int totalBytesRead = 0; while (totalBytesRead != receiveBuffer.Length) { int bytesRead = await serverStream.ReadAsync(receiveBuffer.AsMemory(totalBytesRead, Math.Min(receiveBuffer.Length - totalBytesRead, readSize))); if (bytesRead == 0) { break; } totalBytesRead += bytesRead; } Assert.Equal(testBuffer.Length, receiveBuffer.Length); Assert.Equal(testBuffer, receiveBuffer); }); } public static IEnumerable<object[]> ReadWrite_Random_Success_Data() { IEnumerable<int> sizes = Enumerable.Range(1, 8).Append(2048).Append(8192); return from readSize in sizes from writeSize in sizes select new object[] { readSize, writeSize }; } [Fact] public async Task Read_StreamAborted_Throws() { const int ExpectedErrorCode = 0xfffffff; await Task.Run(async () => { using QuicListener listener = CreateQuicListener(); ValueTask<QuicConnection> serverConnectionTask = listener.AcceptConnectionAsync(); using QuicConnection clientConnection = CreateQuicConnection(listener.ListenEndPoint); await clientConnection.ConnectAsync(); using QuicConnection serverConnection = await serverConnectionTask; await using QuicStream clientStream = clientConnection.OpenBidirectionalStream(); await clientStream.WriteAsync(new byte[1]); await using QuicStream serverStream = await serverConnection.AcceptStreamAsync(); await serverStream.ReadAsync(new byte[1]); clientStream.AbortWrite(ExpectedErrorCode); byte[] buffer = new byte[100]; QuicStreamAbortedException ex = await Assert.ThrowsAsync<QuicStreamAbortedException>(() => serverStream.ReadAsync(buffer).AsTask()); Assert.Equal(ExpectedErrorCode, ex.ErrorCode); }).WaitAsync(TimeSpan.FromSeconds(5)); } [ActiveIssue("https://github.com/dotnet/runtime/issues/32050")] [Fact] public async Task Read_ConnectionAborted_Throws() { const int ExpectedErrorCode = 1234; await Task.Run(async () => { using QuicListener listener = CreateQuicListener(); ValueTask<QuicConnection> serverConnectionTask = listener.AcceptConnectionAsync(); using QuicConnection clientConnection = CreateQuicConnection(listener.ListenEndPoint); await clientConnection.ConnectAsync(); using QuicConnection serverConnection = await serverConnectionTask; await using QuicStream clientStream = clientConnection.OpenBidirectionalStream(); await clientStream.WriteAsync(new byte[1]); await using QuicStream serverStream = await serverConnection.AcceptStreamAsync(); await serverStream.ReadAsync(new byte[1]); await clientConnection.CloseAsync(ExpectedErrorCode); byte[] buffer = new byte[100]; QuicConnectionAbortedException ex = await Assert.ThrowsAsync<QuicConnectionAbortedException>(() => serverStream.ReadAsync(buffer).AsTask()); Assert.Equal(ExpectedErrorCode, ex.ErrorCode); }).WaitAsync(TimeSpan.FromSeconds(5)); } } public sealed class QuicStreamTests_MockProvider : QuicStreamTests<MockProviderFactory> { } [ConditionalClass(typeof(QuicTestBase<MsQuicProviderFactory>), nameof(QuicTestBase<MsQuicProviderFactory>.IsSupported))] public sealed class QuicStreamTests_MsQuicProvider : QuicStreamTests<MsQuicProviderFactory> { } }
40.037906
168
0.545737
[ "MIT" ]
LakshanF/runtime
src/libraries/System.Net.Quic/tests/FunctionalTests/QuicStreamTests.cs
22,183
C#
namespace Application.Common.Interfaces { using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Domain.Entities; public interface IApplicationDbContext { DbSet<City> Cities { get; set; } DbSet<District> Districts { get; set; } DbSet<Village> Villages { get; set; } Task<int> SaveChangesAsync(CancellationToken cancellationToken); } }
21.333333
72
0.671875
[ "MIT" ]
ahmetsaiderdem/CleanArchitecture
src/Common/Application/Common/Interfaces/IApplicationDbContext.cs
450
C#
using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using AutoMapper; using CloudConsult.Common.Builders; using CloudConsult.Common.CQRS; using CloudConsult.Consultation.Domain.Commands; using CloudConsult.Consultation.Domain.Entities; using CloudConsult.Consultation.Domain.Services; using Microsoft.AspNetCore.Http; namespace CloudConsult.Consultation.Infrastructure.Handlers { public class AddTimeSlotsHandler : ICommandHandler<AddTimeSlots, object> { private readonly IApiResponseBuilder<object> builder; private readonly IMapper mapper; private readonly ITimeSlotService timeSlotService; public AddTimeSlotsHandler(IApiResponseBuilder<object> builder, IMapper mapper, ITimeSlotService timeSlotService) { this.builder = builder; this.mapper = mapper; this.timeSlotService = timeSlotService; } public async Task<IApiResponse<object>> Handle(AddTimeSlots request, CancellationToken cancellationToken) { var availabilities = mapper.Map<List<DoctorTimeSlot>>(request); await timeSlotService.AddDoctorTimeSlots(availabilities, cancellationToken); return builder.CreateSuccessResponse(null, x => { x.WithSuccessCode(StatusCodes.Status202Accepted); x.WithMessages("Doctor availability saved successfully"); }); } } }
37.794872
121
0.715739
[ "MIT" ]
devntofficial/CloudConsultRC
NET Microservices/consultation-service/CloudConsult.Consultation.Infrastructure/Handlers/AddTimeSlotsHandler.cs
1,476
C#
// <auto-generated /> using HelloWorld.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using System; namespace HelloWorld.Data.Migrations { [DbContext(typeof(ApplicationDbContext))] [Migration("00000000000000_CreateIdentitySchema")] partial class CreateIdentitySchema { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property<string>("Id") .HasColumnType("nvarchar(450)"); b.Property<string>("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnType("nvarchar(max)"); b.Property<string>("Name") .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property<string>("NormalizedName") .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); b.HasIndex("NormalizedName") .IsUnique() .HasName("RoleNameIndex") .HasFilter("[NormalizedName] IS NOT NULL"); b.ToTable("AspNetRoles"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property<string>("ClaimType") .HasColumnType("nvarchar(max)"); b.Property<string>("ClaimValue") .HasColumnType("nvarchar(max)"); b.Property<string>("RoleId") .IsRequired() .HasColumnType("nvarchar(450)"); b.HasKey("Id"); b.HasIndex("RoleId"); b.ToTable("AspNetRoleClaims"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => { b.Property<string>("Id") .HasColumnType("nvarchar(450)"); b.Property<int>("AccessFailedCount") .HasColumnType("int"); b.Property<string>("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnType("nvarchar(max)"); b.Property<string>("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property<bool>("EmailConfirmed") .HasColumnType("bit"); b.Property<bool>("LockoutEnabled") .HasColumnType("bit"); b.Property<DateTimeOffset?>("LockoutEnd") .HasColumnType("datetimeoffset"); b.Property<string>("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property<string>("NormalizedUserName") .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property<string>("PasswordHash") .HasColumnType("nvarchar(max)"); b.Property<string>("PhoneNumber") .HasColumnType("nvarchar(max)"); b.Property<bool>("PhoneNumberConfirmed") .HasColumnType("bit"); b.Property<string>("SecurityStamp") .HasColumnType("nvarchar(max)"); b.Property<bool>("TwoFactorEnabled") .HasColumnType("bit"); b.Property<string>("UserName") .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); b.HasIndex("NormalizedEmail") .HasName("EmailIndex"); b.HasIndex("NormalizedUserName") .IsUnique() .HasName("UserNameIndex") .HasFilter("[NormalizedUserName] IS NOT NULL"); b.ToTable("AspNetUsers"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); b.Property<string>("ClaimType") .HasColumnType("nvarchar(max)"); b.Property<string>("ClaimValue") .HasColumnType("nvarchar(max)"); b.Property<string>("UserId") .IsRequired() .HasColumnType("nvarchar(450)"); b.HasKey("Id"); b.HasIndex("UserId"); b.ToTable("AspNetUserClaims"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => { b.Property<string>("LoginProvider") .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property<string>("ProviderKey") .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property<string>("ProviderDisplayName") .HasColumnType("nvarchar(max)"); b.Property<string>("UserId") .IsRequired() .HasColumnType("nvarchar(450)"); b.HasKey("LoginProvider", "ProviderKey"); b.HasIndex("UserId"); b.ToTable("AspNetUserLogins"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => { b.Property<string>("UserId") .HasColumnType("nvarchar(450)"); b.Property<string>("RoleId") .HasColumnType("nvarchar(450)"); b.HasKey("UserId", "RoleId"); b.HasIndex("RoleId"); b.ToTable("AspNetUserRoles"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => { b.Property<string>("UserId") .HasColumnType("nvarchar(450)"); b.Property<string>("LoginProvider") .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property<string>("Name") .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property<string>("Value") .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); b.ToTable("AspNetUserTokens"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); #pragma warning restore 612, 618 } } }
37.669065
125
0.47097
[ "MIT" ]
BhupeshGuptha/Enterprise-Application-Development-with-C-Sharp-9-and-.NET-5
Chapter17/Pipelines/HelloWorld/HelloWorld/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs
10,472
C#
using System.Web.Mvc; using WebForLink.Application.Interfaces.WebForLink; using WebForLink.Areas.WebForLink.ViewModels.MinhaFicha; using WebForLink.Domain.Entities.WebForLink; using WebForLink.Web.Controllers.Extensoes; namespace WebForLink.Areas.WebForLink.Controllers { public class MinhaFichaController : ControllerPadrao { private readonly IFichaCadastralWebForLinkAppService _bpFichaCadastral; public MinhaFichaController(IFichaCadastralWebForLinkAppService bpFichaCadastral) { _bpFichaCadastral = bpFichaCadastral; } // GET: WebForLink/MinhaFicha public ActionResult Index() { int contratanteId = 1; Fornecedor contratante = _bpFichaCadastral.BuscarFichaCadastralMeuContratante(contratanteId); MinhaFichaCadastralVM modelo = new MinhaFichaCadastralVM(); return View(); } } }
32.892857
105
0.725299
[ "MIT" ]
nelson1987/ProjetoPadraoTDD
Code/1_Presentation/WebForLink.Web/Areas/WebForLink/Controllers/MinhaFichaController.cs
923
C#
using System; using NetOffice; namespace NetOffice.WordApi.Enums { /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// </summary> ///<remarks> MSDN Online Documentation: http://msdn.microsoft.com/en-us/en-us/library/office/ff838551.aspx </remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)] [EntityTypeAttribute(EntityType.IsEnum)] public enum WdPhoneticGuideAlignmentType { /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// </summary> /// <remarks>0</remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)] wdPhoneticGuideAlignmentCenter = 0, /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// </summary> /// <remarks>1</remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)] wdPhoneticGuideAlignmentZeroOneZero = 1, /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// </summary> /// <remarks>2</remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)] wdPhoneticGuideAlignmentOneTwoOne = 2, /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// </summary> /// <remarks>3</remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)] wdPhoneticGuideAlignmentLeft = 3, /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16 /// </summary> /// <remarks>4</remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)] wdPhoneticGuideAlignmentRight = 4, /// <summary> /// SupportByVersion Word 10, 11, 12, 14, 15, 16 /// </summary> /// <remarks>5</remarks> [SupportByVersionAttribute("Word", 10,11,12,14,15,16)] wdPhoneticGuideAlignmentRightVertical = 5 } }
31.563636
119
0.649194
[ "MIT" ]
Engineerumair/NetOffice
Source/Word/Enums/WdPhoneticGuideAlignmentType.cs
1,736
C#
using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Security.Claims; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using planificadorWeb.Models; using planificadorWeb.Services; using planning.ViewModels; namespace planificadorWeb.Controllers { [Authorize] [Route("/")] [ApiController] public class AuthController : ControllerBase { private IAuthService _authService; public AuthController(IAuthService authService) { _authService = authService; } // POST: Metodo que devuelve el TOKEN. [AllowAnonymous] [Produces("application/json")] [HttpPost("acceder")] public ActionResult Login([FromBody] LoginViewModel data) { var username = data.username; var password = data.password; var user = _authService.Login(username, password); if (user != null) { var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.ASCII.GetBytes("w2xTvrL7syDLqwMBCuje"); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, user.Nombre), new Claim(ClaimTypes.Role, user.Rango), new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()) }), Expires = DateTime.UtcNow.AddDays(7), SigningCredentials = new SigningCredentials( new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) }; var token = tokenHandler.CreateToken(tokenDescriptor); var tokens = tokenHandler.WriteToken(token); return Ok(new { token = tokens }); } else { return BadRequest(new { message = "Usuario o contraseña incorrectos" }); } } } }
31.392405
88
0.583468
[ "MIT" ]
n0ss4/Plan-X
planning/Controllers/AuthController.cs
2,483
C#
using System; using System.Collections.Generic; using System.Linq; using Blish_HUD.Controls; using Blish_HUD.Graphics.UI; using Blish_HUD.Graphics.UI.Exceptions; using Blish_HUD.Input; using Blish_HUD.Modules.Pkgs; using Blish_HUD.Modules.UI.Presenters; using Microsoft.Scripting.Utils; using Microsoft.Xna.Framework; using Version = SemVer.Version; namespace Blish_HUD.Modules.UI.Views { public class ManagePkgView : View { public enum PkgVersionRelationship { NotInstalled, CanUpdate, CurrentVersion } public event EventHandler<ValueEventArgs<Version>> VersionSelected; public event EventHandler<EventArgs> ActionClicked; public string PackageActionText { get => _actionButton?.Text ?? throw new ViewNotBuiltException(); set => (_actionButton ?? throw new ViewNotBuiltException()).Text = value; } public bool PackageActionEnabled { get => _actionButton?.Enabled ?? throw new ViewNotBuiltException(); set => (_actionButton ?? throw new ViewNotBuiltException()).Enabled = value; } public string ModuleName { get => _nameLabel?.Text ?? throw new ViewNotBuiltException(); set { (_nameLabel ?? throw new ViewNotBuiltException()).Text = value; _nameLabel.Visible = true; //_authLabel.Left = _nameLabel.Right + 10; _previewLabel.Left = _nameLabel.Right + 10; _previewLabel.Top = _nameLabel.Top + 2; } } public bool IsPreviewVersion { get => _previewLabel?.Visible ?? throw new ViewNotBuiltException(); set => (_previewLabel ?? throw new ViewNotBuiltException()).Visible = value; } public string ModuleNamespace { get => _nameLabel?.BasicTooltipText ?? throw new ViewNotBuiltException(); set => (_nameLabel ?? throw new ViewNotBuiltException()).BasicTooltipText = value; } private ModuleContributor _moduleContributor; public ModuleContributor ModuleContributor { get => _authLabel != null ? _moduleContributor : throw new ViewNotBuiltException(); set { if (_authLabel == null) throw new ViewNotBuiltException(); _moduleContributor = value; _authLabel.Text = $"{Strings.GameServices.ModulesService.ModuleManagement_AuthoredBy} {_moduleContributor.Name}"; _authLabel.BasicTooltipText = _moduleContributor.Username; } } public string ModuleDescription { get => _descLabel?.Text ?? throw new ViewNotBuiltException(); set { if (_descLabel == null) throw new ViewNotBuiltException(); _descLabel.Text = value; } } private IEnumerable<Version> _moduleVersions; public IEnumerable<Version> ModuleVersions { get => _versionDropdown != null ? _moduleVersions : throw new ViewNotBuiltException(); set { if (_versionDropdown == null) throw new ViewNotBuiltException(); _moduleVersions = value; _versionDropdown.Items.Clear(); _versionDropdown.Items.AddRange(CollectionUtils.Select(_moduleVersions, v => v.ToString())); } } private Version _selectedVersion; public Version SelectedVersion { get => _versionDropdown != null ? _selectedVersion : throw new ViewNotBuiltException(); set { if (_versionDropdown == null) throw new ViewNotBuiltException(); _selectedVersion = value; _versionDropdown.SelectedItem = _selectedVersion.ToString(); } } private void SetRelationIcon(PkgVersionRelationship pkgVersionRelationship) { switch (pkgVersionRelationship) { case PkgVersionRelationship.NotInstalled: _statusImage.Visible = false; break; case PkgVersionRelationship.CanUpdate: _statusImage.Texture = GameService.Content.GetTexture("common/157397"); _statusImage.BasicTooltipText = Strings.GameServices.Modules.RepoAndPkgManagement.PkgRepo_PackageRelationship_CanUpdate; _statusImage.Visible = true; break; case PkgVersionRelationship.CurrentVersion: _statusImage.Texture = GameService.Content.GetTexture("common/157330"); _statusImage.BasicTooltipText = Strings.GameServices.Modules.RepoAndPkgManagement.PkgRepo_PackageRelationship_CurrentVersion; _statusImage.Visible = true; break; } } private PkgVersionRelationship _versionRelationship = PkgVersionRelationship.NotInstalled; public PkgVersionRelationship VersionRelationship { get => _versionRelationship; set { if (_statusImage == null) throw new ViewNotBuiltException(); _versionRelationship = value; SetRelationIcon(value); } } private Label _nameLabel; private Label _previewLabel; private Label _authLabel; private Label _descLabel; private Image _statusImage; private Dropdown _versionDropdown; private StandardButton _actionButton; public ManagePkgView() { /* NOOP */ } public ManagePkgView(IGrouping<string, PkgManifest> model) { this.WithPresenter(new ManagePkgPresenter(this, model)); } protected override void Build(Container buildPanel) { _nameLabel = new Label() { Text = "W", AutoSizeWidth = true, AutoSizeHeight = true, Font = GameService.Content.DefaultFont18, Location = new Point(5, 5), Visible = false, Parent = buildPanel }; _previewLabel = new Label() { Text = Strings.GameServices.ModulesService.PkgManagement_IsPreview, TextColor = Color.Orange, AutoSizeWidth = true, AutoSizeHeight = true, Font = GameService.Content.DefaultFont14, Location = new Point(_nameLabel.Right + 4, 8), Visible = false, Parent = buildPanel }; _authLabel = new Label() { Visible = false, AutoSizeWidth = true, AutoSizeHeight = false, Height = _nameLabel.Height, VerticalAlignment = VerticalAlignment.Bottom, Left = _nameLabel.Right + 10, Top = _nameLabel.Top, Parent = buildPanel }; _versionDropdown = new Dropdown() { Width = 128, Right = buildPanel.Width - 5, Top = 5, Parent = buildPanel }; _statusImage = new Image(GameService.Content.GetTexture("common/157397")) { Visible = false, Size = new Point(16, 16), Top = _versionDropdown.Height / 2 - 8 + _versionDropdown.Top, Right = _versionDropdown.Left - 8, Parent = buildPanel }; _actionButton = new StandardButton() { Width = 132, Right = buildPanel.Width - 3, Top = _versionDropdown.Bottom + 3, Parent = buildPanel }; _descLabel = new Label() { WrapText = true, Font = GameService.Content.GetFont(ContentService.FontFace.Menomonia, ContentService.FontSize.Size12, ContentService.FontStyle.Regular), Location = new Point(_nameLabel.Left, _nameLabel.Bottom + 4), AutoSizeHeight = true, Width = 548, Parent = buildPanel, VerticalAlignment = VerticalAlignment.Top, }; _statusImage.Click += StatusImageOnClick; _actionButton.Click += OnActionClicked; _versionDropdown.ValueChanged += OnVersionSelected; } private void StatusImageOnClick(object sender, MouseEventArgs e) { this.SelectedVersion = _moduleVersions.Max(); } private void OnActionClicked(object sender, MouseEventArgs e) { this.ActionClicked?.Invoke(sender, e); } private void OnVersionSelected(object sender, ValueChangedEventArgs e) { this.VersionSelected?.Invoke(sender, new ValueEventArgs<Version>(new Version(e.CurrentValue))); } } }
38.506073
165
0.550205
[ "MIT" ]
eksime/Blish-HUD
Blish HUD/GameServices/Modules/UI/Views/ManagePkgView.cs
9,513
C#
namespace AdjustSdk.Pcl { public class UnknowResponseData : ResponseData { } }
14.666667
50
0.704545
[ "MIT" ]
adjust/windows_sdk
WindowsPcl/UnknowResponseData.cs
90
C#
namespace ArgentPonyWarcraftClient; /// <summary> /// An index of azerite essences. /// </summary> public record AzeriteEssencesIndex { /// <summary> /// Gets links for the index of azerite essences. /// </summary> [JsonPropertyName("_links")] public Links Links { get; init; } /// <summary> /// Gets references to the azerite essences. /// </summary> [JsonPropertyName("azerite_essences")] public AzeriteEssenceReference[] AzeriteEssences { get; init; } }
25
67
0.66
[ "MIT" ]
blizzard-net/warcraft
src/ArgentPonyWarcraftClient/Models/GameDataApi/AzeriteEssence/AzeriteEssencesIndex.cs
502
C#
namespace CHIP8 { public class CPU { public CPU() { } } }
9.4
20
0.393617
[ "MIT" ]
PJohannessen/CHIP-8
src/CPU.cs
94
C#
using System; using Arnible.Xunit; using Xunit; using Xunit.Abstractions; namespace Arnible.Logger.Test { public class XunitLoggerTests : IDisposable { private readonly XunitLogger _logger; public XunitLoggerTests(ITestOutputHelper output) { _logger = new(output); } [Fact] public void InitialValues() { _logger.Write("something to write"); Assert.True(_logger.IsLoggerEnabled); Assert.False(_logger.IsSavingLogsToFileEnabled); } [Fact] public void TestDisableLogging() { _logger.EnableLogging(false); _logger.SaveLogsToFile(false); _logger.Write("something to write"); Assert.False(_logger.IsLoggerEnabled); Assert.False(_logger.IsSavingLogsToFileEnabled); } public void Dispose() { _logger.Dispose(); } } }
20.690476
54
0.651323
[ "Apache-2.0" ]
tomaszbiegacz/Arnible.MathModeling
Arnible.Test/Logger/XunitLoggerTests.cs
869
C#
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System.Collections.Generic; using IdentityServer4; using IdentityServer4.Models; namespace IdentityServerDemo { public static class Config { public static IEnumerable<IdentityResource> Ids => new IdentityResource[] { new IdentityResources.OpenId(), new IdentityResources.Profile(), }; public static IEnumerable<ApiResource> Apis => new ApiResource[] { }; public static IEnumerable<Client> Clients => new Client[] { new Client { ClientId = "projectManagementTool", ClientName = "Project Management Tool", AllowedGrantTypes = GrantTypes.CodeAndClientCredentials, RequirePkce = true, ClientSecrets = { new Secret("montyburns".Sha256()) }, RedirectUris = { "http://localhost:5001/oidc-signin" }, PostLogoutRedirectUris = { "http://localhost:5001/oidc-signout" }, AllowOfflineAccess = true, AllowedScopes = { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Profile } } }; } }
31.235294
107
0.536723
[ "BSD-3-Clause" ]
agentS/AspNetCoreAuthenticationAuthorizationDemo
src/IdentityServerDemo/Config.cs
1,595
C#
namespace Bet.Extensions.Walmart.Models.Orders; public class Charge { /// <summary> /// The charge type for line items can be one of the following: PRODUCT or SHIPPING For details, refer to 'Charge Types'. /// </summary> [JsonPropertyName("chargeType")] public string? ChargeType { get; set; } /// <summary> /// If chargeType is PRODUCT, chargeName is Item Price. If chargeType is SHIPPING, chargeName is Shipping. /// </summary> [JsonPropertyName("chargeName")] public string? ChargeName { get; set; } /// <summary> /// The details for the amount of the tax charge. /// </summary> [JsonPropertyName("chargeAmount")] public ChargeAmount? ChargeAmount { get; set; } /// <summary> /// Tax information for the charge, including taxName and taxAmount. /// </summary> [JsonPropertyName("tax")] public Tax? Tax { get; set; } }
31.241379
125
0.65011
[ "Apache-2.0" ]
kdcllc/Bet.Extensions.Walmart
src/Bet.Extensions.Walmart.Models/Orders/Charge.cs
908
C#
using System.Collections.Generic; namespace GreatWall.Service.Dtos.NgAlain { /// <summary> /// NgAlain应用程序数据 /// </summary> public class AppData { /// <summary> /// 初始化NgAlain应用程序数据 /// </summary> public AppData() { App = new AppInfo(); User = new UserInfo(); Menu = new List<MenuInfo>(); } /// <summary> /// 应用程序信息 /// </summary> public AppInfo App { get; set; } /// <summary> /// 用户信息 /// </summary> public UserInfo User { get; set; } /// <summary> /// 菜单信息 /// </summary> public List<MenuInfo> Menu { get; set; } } }
23.064516
48
0.461538
[ "MIT" ]
UtilCore/GreatWall
src/GreatWall.Service/Dtos/NgAlain/AppData.cs
775
C#
using LINGYUN.Abp.LocalizationManagement.Localization; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.Validation; using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.LocalizationManagement { [DependsOn( typeof(AbpValidationModule), typeof(AbpLocalizationModule))] public class AbpLocalizationManagementDomainSharedModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { Configure<AbpVirtualFileSystemOptions>(options => { options.FileSets.AddEmbedded<AbpLocalizationManagementDomainSharedModule>(); }); Configure<AbpLocalizationOptions>(options => { options.Resources .Add<LocalizationManagementResource>("en") .AddVirtualJson("/LINGYUN/Abp/LocalizationManagement/Localization/Resources"); }); } } }
32.466667
98
0.665298
[ "MIT" ]
ZhaoYis/abp-next-admin
aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.Domain.Shared/LINGYUN/Abp/LocalizationManagement/AbpLocalizationManagementDomainSharedModule.cs
976
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 kinesisanalytics-2015-08-14.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.KinesisAnalytics.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.KinesisAnalytics.Model.Internal.MarshallTransformations { /// <summary> /// DeleteApplication Request Marshaller /// </summary> public class DeleteApplicationRequestMarshaller : IMarshaller<IRequest, DeleteApplicationRequest> , 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((DeleteApplicationRequest)input); } /// <summary> /// Marshaller the request object to the HTTP request. /// </summary> /// <param name="publicRequest"></param> /// <returns></returns> public IRequest Marshall(DeleteApplicationRequest publicRequest) { IRequest request = new DefaultRequest(publicRequest, "Amazon.KinesisAnalytics"); string target = "KinesisAnalytics_20150814.DeleteApplication"; request.Headers["X-Amz-Target"] = target; request.Headers["Content-Type"] = "application/x-amz-json-1.1"; request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2015-08-14"; request.HttpMethod = "POST"; request.ResourcePath = "/"; request.MarshallerVersion = 2; using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture)) { JsonWriter writer = new JsonWriter(stringWriter); writer.WriteObjectStart(); var context = new JsonMarshallerContext(request, writer); if(publicRequest.IsSetApplicationName()) { context.Writer.WritePropertyName("ApplicationName"); context.Writer.Write(publicRequest.ApplicationName); } if(publicRequest.IsSetCreateTimestamp()) { context.Writer.WritePropertyName("CreateTimestamp"); context.Writer.Write(publicRequest.CreateTimestamp); } writer.WriteObjectEnd(); string snippet = stringWriter.ToString(); request.Content = System.Text.Encoding.UTF8.GetBytes(snippet); } return request; } private static DeleteApplicationRequestMarshaller _instance = new DeleteApplicationRequestMarshaller(); internal static DeleteApplicationRequestMarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static DeleteApplicationRequestMarshaller Instance { get { return _instance; } } } }
36.045045
149
0.630342
[ "Apache-2.0" ]
PureKrome/aws-sdk-net
sdk/src/Services/KinesisAnalytics/Generated/Model/Internal/MarshallTransformations/DeleteApplicationRequestMarshaller.cs
4,001
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Tarea.Arbol { class Program { static void Main(string[] args) { int opcion = 0; String x = ""; Arbol a = new Arbol(); while (opcion != 4) { Console.Clear(); Console.WriteLine("1. Insertar"); Console.WriteLine("2. Eliminar"); Console.WriteLine("3. Mostrar preoden"); Console.WriteLine("4. Salir"); opcion = int.Parse(Console.ReadLine()); switch (opcion) { case 1: Console.WriteLine("introduzca un elemento"); x = Console.ReadLine(); a.insertar(x); break; case 2: Console.WriteLine("que elemnto quiere eliminar"); x = Console.ReadLine(); // l.Eliminar(x); Console.ReadKey(); break; case 3: a.mostrarPreOrden(); Console.ReadKey(); break; } } } } }
27.54
73
0.400145
[ "Apache-2.0" ]
choquejhoselin/programacionIIICAJ
Tareas/Tarea.Arbol/Tarea.Arbol/Program.cs
1,379
C#
using System; using System.Linq; using SignalGo.Shared.DataTypes; using SignalGo.ServerManager.Models; namespace SignalGo.ServerManager.Services { [ServiceContract("ServerManager", ServiceType.OneWayService, InstanceType.SingleInstance)] public class ServerManagerService { public bool StopServer(Guid serverKey, string name) { if (serverKey != SettingInfo.Current.ServerKey) return false; var find = SettingInfo.Current.ServerInfoes.FirstOrDefault(x => x.Name == name); if (find == null) return false; find.Stop(); return true; } public bool StartServer(Guid serverKey, string name) { if (serverKey != SettingInfo.Current.ServerKey) return false; var find = SettingInfo.Current.ServerInfoes.FirstOrDefault(x => x.Name == name); if (find == null) return false; find.Start(); return true; } } }
30.764706
94
0.591778
[ "MIT" ]
JTOne123/SignalGo-full-net
SignalGo.ServerManager/Services/ServerManagerService.cs
1,048
C#
using HDF.PInvoke; using HDF5CSharp.DataTypes; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; namespace HDF5CSharp { public class ChunkedCompound<T> : IDisposable where T : struct { ulong[] _currentDims; readonly ulong[] _maxDims = { H5S.UNLIMITED, H5S.UNLIMITED }; long _status, _spaceId, _datasetId, _propId; readonly long _typeId, _datatype; public string GroupName { get; private set; } public int Rank { get; private set; } public long GroupId { get; private set; } /// <summary> /// Constructor to create a chuncked Compound object /// </summary> /// <param name="name"></param> /// <param name="groupId"></param> public ChunkedCompound(string name, long groupId) { GroupName = name; GroupId = groupId; _datatype = Hdf5.CreateType(typeof(T)); _typeId = H5T.copy(_datatype); } /// <summary> /// Constructor to create a chuncked Compound object with an initial Compound. /// </summary> /// <param name="name"></param> /// <param name="groupId"></param> /// <param name="items"></param> public ChunkedCompound(string name, long groupId, IEnumerable<T> items) : this(name, groupId) { FirstCompound(items); } private void FirstCompound(IEnumerable<T> items) { if (GroupId <= 0) { throw new Hdf5Exception("cannot call FirstDataset because group or file couldn't be created"); } if (Hdf5Utils.GetRealName(GroupId, GroupName, string.Empty).valid) { throw new Hdf5Exception("cannot call FirstDataset because dataset already exists"); } if (items == null || !items.Any()) { throw new Hdf5Exception("empty items"); } Type type = typeof(T); var count = (ulong)items.LongCount(); var typeId = Hdf5.CreateType(type); var log10 = (int)Math.Log10(count); ulong pow = (ulong)Math.Pow(10, log10); ulong c_s = Math.Min(1000, pow); ulong[] chunk_size = { c_s }; ulong[] dims = { count }; long dcpl = 0; dcpl = Hdf5.CreateProperty(chunk_size); // Create dataspace. Setting maximum size to NULL sets the maximum // size to be the current size. _spaceId = H5S.create_simple(dims.Length, dims, _maxDims); // Create the dataset and write the compound data to it. _datasetId = Hdf5Utils.GetDatasetId(GroupId, Hdf5Utils.NormalizedName(GroupName), typeId, _spaceId, dcpl); var ms = new MemoryStream(); BinaryWriter writer = new BinaryWriter(ms); foreach (var strct in items) { writer.Write(Hdf5.GetBytes(strct)); } var bytes = ms.ToArray(); GCHandle hnd = GCHandle.Alloc(bytes, GCHandleType.Pinned); var statusId = H5D.write(_datasetId, typeId, _spaceId, H5S.ALL, H5P.DEFAULT, hnd.AddrOfPinnedObject()); _currentDims = new[] { (ulong)items.LongCount(),(ulong) 1 }; if (statusId < 0) { Hdf5Utils.LogError("Error creating compound"); } /* * Close and release resources. */ hnd.Free(); H5S.close(_spaceId); _spaceId = -1; } public void AppendOrCreateCompound(IEnumerable<T> items) { if (_currentDims == null) { if (items.LongCount() < 1) { string msg = "Empty array was passed. Ignoring."; Hdf5Utils.LogError?.Invoke(msg); return; } FirstCompound(items); } else { AppendCompound(items); } } public void AppendCompound(IEnumerable<T> list) { if (!Hdf5Utils.GetRealName(GroupId, GroupName, string.Empty).valid) { string msg = $"call constructor or {nameof(FirstCompound)} first before appending."; Hdf5Utils.LogError?.Invoke(msg); throw new Hdf5Exception(msg); } var _oldDims = this._currentDims.ToArray(); var _currentDims = new ulong[] { (ulong)list.LongCount(), 1 }; ulong[] zeros = Enumerable.Range(0, 2).Select(z => (ulong)0).ToArray(); /* Extend the dataset. Dataset becomes 10 x 3 */ var size = new ulong[] { _oldDims[0] + _currentDims[0], 1 }; var _status = H5D.set_extent(_datasetId, size); ulong[] offset = new[] { _oldDims[0] }.Concat(zeros.Skip(1)).ToArray(); /* Select a hyperslab in extended portion of dataset */ var filespaceId = H5D.get_space(_datasetId); if (filespaceId < 0) { string msg = $"error creating file space."; Hdf5Utils.LogError?.Invoke(msg); throw new Hdf5Exception(msg); } _status = H5S.select_hyperslab(filespaceId, H5S.seloper_t.SET, offset, null, _currentDims, null); if (_status < 0) { string msg = $"error creating hyperslab."; Hdf5Utils.LogError?.Invoke(msg); throw new Hdf5Exception(msg); } /* Define memory space */ var memId = H5S.create_simple(2, _currentDims, null); var ms = new MemoryStream(); BinaryWriter writer = new BinaryWriter(ms); foreach (var strct in list) { writer.Write(Hdf5.GetBytes(strct)); } var bytes = ms.ToArray(); /* Write the data to the extended portion of dataset */ GCHandle hnd = GCHandle.Alloc(bytes, GCHandleType.Pinned); _status = H5D.write(_datasetId, _datatype, memId, filespaceId, H5P.DEFAULT, hnd.AddrOfPinnedObject()); hnd.Free(); H5S.close(memId); H5S.close(filespaceId); } public void Flush() { try { H5D.flush(_datasetId); } catch (Exception e) { Hdf5Utils.LogError($"Unable to flash dataset: {e}"); } } /// <summary> /// Finalizer of object /// </summary> ~ChunkedCompound() { Dispose(false); } /// <summary> /// Dispose function as suggested in the stackoverflow discussion below /// See: http://stackoverflow.com/questions/538060/proper-use-of-the-idisposable-interface/538238#538238 /// </summary> /// <param name="itIsSafeToAlsoFreeManagedObjects"></param> protected virtual void Dispose(bool itIsSafeToAlsoFreeManagedObjects) { if (!Hdf5Utils.GetRealName(GroupId, GroupName, string.Empty).valid) { Hdf5Utils.LogInfo?.Invoke("Dataset does not exist."); return; } if (_datasetId >= 0) { H5D.close(_datasetId); } if (_propId >= 0) { H5P.close(_propId); } if (_spaceId >= 0) { H5S.close(_spaceId); } if (itIsSafeToAlsoFreeManagedObjects) { } } private ulong[] GetDims(Array dset) { return Enumerable.Range(0, dset.Rank).Select(i => (ulong)dset.GetLength(i)).ToArray(); } /// <summary> /// Dispose function as suggested in the stackoverflow discussion below /// See: http://stackoverflow.com/questions/538060/proper-use-of-the-idisposable-interface/538238#538238 /// </summary> public void Dispose() { Dispose(true); //I am calling you from Dispose, it's safe GC.SuppressFinalize(this); //Hey, GC: don't bother calling finalize later } } }
33.876
118
0.523911
[ "MIT" ]
DavidSabbah/HDF5-CSharp
HDF5-CSharp/ChunkedCompound.cs
8,471
C#
using System; using System.Runtime.Serialization; using System.Security.Permissions; using XCode.DataAccessLayer; namespace XCode.Exceptions { /// <summary>数据访问层SQL异常</summary> [Serializable] public class XSqlException : XDbSessionException { #region 属性 /// <summary>SQL语句</summary> public String Sql { get; } #endregion #region 构造 /// <summary>初始化</summary> /// <param name="sql"></param> /// <param name="session"></param> public XSqlException(String sql, IDbSession session) : base(session) { Sql = sql; } /// <summary>初始化</summary> /// <param name="sql"></param> /// <param name="session"></param> /// <param name="message"></param> public XSqlException(String sql, IDbSession session, String message) : base(session, message + "[SQL:" + FormatSql(sql) + "]") { Sql = sql; } /// <summary>初始化</summary> /// <param name="sql"></param> /// <param name="session"></param> /// <param name="message"></param> /// <param name="innerException"></param> public XSqlException(String sql, IDbSession session, String message, Exception innerException) : base(session, message + "[SQL:" + FormatSql(sql) + "]", innerException) { Sql = sql; } /// <summary>初始化</summary> /// <param name="sql"></param> /// <param name="session"></param> /// <param name="innerException"></param> public XSqlException(String sql, IDbSession session, Exception innerException) : base(session, (innerException != null ? innerException.Message : "") + "[SQL:" + FormatSql(sql) + "]", innerException) { Sql = sql; } #endregion #region 方法 static String FormatSql(String sql) { if (String.IsNullOrEmpty(sql)) return sql; sql = sql.Trim(); if (String.IsNullOrEmpty(sql)) return sql; if (sql.Contains(Environment.NewLine)) return Environment.NewLine + sql + Environment.NewLine; else return sql; } /// <summary>从序列化信息中读取Sql</summary> /// <param name="info"></param> /// <param name="context"></param> [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); //info.AddValue("sql", Sql); // 必须明确指定类型,否则可能因为Sql==null,而导致内部当作Object写入 info.AddValue("sql", Sql, typeof(String)); } #endregion } }
36.025974
149
0.57318
[ "MIT" ]
EnhWeb/DC.Framework
src/Ding.XCode/Exceptions/XSqlException.cs
2,898
C#
using UnityEngine; using System; using System.Collections.Generic; using MissionControl.Rules; using MissionControl.Trigger; namespace MissionControl.Logic { public class AddEmployerLanceBatch { public AddEmployerLanceBatch(EncounterRules encounterRules, string orientationTargetKey, SpawnLogic.LookDirection lookDirection, float minDistance, float maxDistance) { int numberOfUnitsInLance = 4; string lanceGuid = Guid.NewGuid().ToString(); List<string> unitGuids = encounterRules.GenerateGuids(numberOfUnitsInLance); string employerTeamGuid = EncounterRules.EMPLOYER_TEAM_ID; string spawnerName = $"Lance_Ally_SupportingForce_{lanceGuid}"; encounterRules.EncounterLogic.Add(new AddLanceToAllyTeam(lanceGuid, unitGuids)); encounterRules.EncounterLogic.Add(new AddLanceSpawnChunk(employerTeamGuid, lanceGuid, unitGuids, spawnerName, "Spawns a non-objective related ally supporting lance")); encounterRules.EncounterLogic.Add(new SpawnLanceMembersAroundTarget(encounterRules, spawnerName, orientationTargetKey, lookDirection, minDistance, maxDistance)); if (Main.Settings.AdditionalLanceSettings.UseDialogue && !MissionControl.Instance.ContractStats.ContainsKey(ContractStats.DIALOGUE_ADDITIONAL_LANCE_ALLY_START)) { MissionControl.Instance.ContractStats.Add(ContractStats.DIALOGUE_ADDITIONAL_LANCE_ALLY_START, true); encounterRules.EncounterLogic.Add(new AddDialogueChunk( ChunkLogic.DIALOGUE_ADDITIONAL_LANCE_ALLY_START_GUID, "AdditionalLanceAllyStart", "Start Conversation For Additional Lance Ally", lanceGuid // "DialogBucketDef_Universal_KillConfirmed" )); encounterRules.EncounterLogic.Add(new DialogTrigger(MessageCenterMessageType.OnEncounterIntroComplete, ChunkLogic.DIALOGUE_ADDITIONAL_LANCE_ALLY_START_GUID)); } encounterRules.ObjectReferenceQueue.Add(spawnerName); } } }
50.3
170
0.764911
[ "MIT" ]
Inveracity/MissionControl
src/Core/EncounterLogic/BatchedLogic/AddEmployerLanceBatch.cs
2,012
C#
namespace FlashBAx { partial class Form1 { /// <summary> /// Variável de designer necessária. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Limpar os recursos que estão sendo usados. /// </summary> /// <param name="disposing">true se for necessário descartar os recursos gerenciados; caso contrário, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Código gerado pelo Windows Form Designer /// <summary> /// Método necessário para suporte ao Designer - não modifique /// o conteúdo deste método com o editor de código. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.guna2Elipse1 = new Guna.UI2.WinForms.Guna2Elipse(this.components); this.guna2Panel1 = new Guna.UI2.WinForms.Guna2Panel(); this.guna2Panel2 = new Guna.UI2.WinForms.Guna2Panel(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.guna2PictureBox5 = new Guna.UI2.WinForms.Guna2PictureBox(); this.guna2PictureBox4 = new Guna.UI2.WinForms.Guna2PictureBox(); this.guna2PictureBox3 = new Guna.UI2.WinForms.Guna2PictureBox(); this.guna2PictureBox2 = new Guna.UI2.WinForms.Guna2PictureBox(); this.guna2PictureBox1 = new Guna.UI2.WinForms.Guna2PictureBox(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.guna2TextBox1 = new Guna.UI2.WinForms.Guna2TextBox(); this.guna2CirclePictureBox1 = new Guna.UI2.WinForms.Guna2CirclePictureBox(); this.guna2Panel1.SuspendLayout(); this.guna2Panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2CirclePictureBox1)).BeginInit(); this.SuspendLayout(); // // guna2Elipse1 // this.guna2Elipse1.BorderRadius = 40; this.guna2Elipse1.TargetControl = this; // // guna2Panel1 // this.guna2Panel1.BackColor = System.Drawing.Color.Transparent; this.guna2Panel1.Controls.Add(this.guna2CirclePictureBox1); this.guna2Panel1.Controls.Add(this.guna2TextBox1); this.guna2Panel1.Controls.Add(this.label13); this.guna2Panel1.Controls.Add(this.guna2PictureBox1); this.guna2Panel1.Dock = System.Windows.Forms.DockStyle.Left; this.guna2Panel1.Location = new System.Drawing.Point(0, 0); this.guna2Panel1.Name = "guna2Panel1"; this.guna2Panel1.ShadowDecoration.Parent = this.guna2Panel1; this.guna2Panel1.Size = new System.Drawing.Size(167, 527); this.guna2Panel1.TabIndex = 0; // // guna2Panel2 // this.guna2Panel2.Controls.Add(this.label11); this.guna2Panel2.Controls.Add(this.label10); this.guna2Panel2.Controls.Add(this.label9); this.guna2Panel2.Controls.Add(this.label8); this.guna2Panel2.Controls.Add(this.label7); this.guna2Panel2.Controls.Add(this.label6); this.guna2Panel2.Controls.Add(this.guna2PictureBox5); this.guna2Panel2.Controls.Add(this.label5); this.guna2Panel2.Controls.Add(this.guna2PictureBox4); this.guna2Panel2.Controls.Add(this.label4); this.guna2Panel2.Controls.Add(this.guna2PictureBox3); this.guna2Panel2.Controls.Add(this.label3); this.guna2Panel2.Controls.Add(this.label2); this.guna2Panel2.Controls.Add(this.label1); this.guna2Panel2.Controls.Add(this.guna2PictureBox2); this.guna2Panel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.guna2Panel2.Font = new System.Drawing.Font("MingLiU-ExtB", 11.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.guna2Panel2.Location = new System.Drawing.Point(167, 45); this.guna2Panel2.Name = "guna2Panel2"; this.guna2Panel2.ShadowDecoration.Parent = this.guna2Panel2; this.guna2Panel2.Size = new System.Drawing.Size(838, 482); this.guna2Panel2.TabIndex = 1; this.guna2Panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.guna2Panel2_Paint); // // label1 // this.label1.AutoSize = true; this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label1.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.SystemColors.Desktop; this.label1.Location = new System.Drawing.Point(74, 114); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(97, 19); this.label1.TabIndex = 1; this.label1.Text = "Ice Cube"; // // label2 // this.label2.AutoSize = true; this.label2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label2.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.SystemColors.ControlText; this.label2.Location = new System.Drawing.Point(6, 12); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(97, 19); this.label2.TabIndex = 2; this.label2.Text = "Artista:"; // // label3 // this.label3.AutoSize = true; this.label3.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label3.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing.SystemColors.Desktop; this.label3.Location = new System.Drawing.Point(6, 150); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(75, 19); this.label3.TabIndex = 3; this.label3.Text = "Ábuns:"; // // label4 // this.label4.AutoSize = true; this.label4.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label4.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.ForeColor = System.Drawing.SystemColors.Desktop; this.label4.Location = new System.Drawing.Point(6, 354); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(262, 19); this.label4.TabIndex = 5; this.label4.Text = "AmeriKKKa\'s Most Wanted"; // // label5 // this.label5.AutoSize = true; this.label5.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label5.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.ForeColor = System.Drawing.SystemColors.Desktop; this.label5.Location = new System.Drawing.Point(320, 354); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(196, 19); this.label5.TabIndex = 7; this.label5.Text = "Death Certificate"; // // label6 // this.label6.AutoSize = true; this.label6.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label6.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label6.ForeColor = System.Drawing.SystemColors.Desktop; this.label6.Location = new System.Drawing.Point(589, 354); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(141, 19); this.label6.TabIndex = 9; this.label6.Text = "The Predator"; // // guna2PictureBox5 // this.guna2PictureBox5.BackColor = System.Drawing.Color.Transparent; this.guna2PictureBox5.Image = global::FlashBAx.Properties.Resources.Ice_Cube___The_Predator; this.guna2PictureBox5.Location = new System.Drawing.Point(577, 183); this.guna2PictureBox5.Name = "guna2PictureBox5"; this.guna2PictureBox5.ShadowDecoration.Parent = this.guna2PictureBox5; this.guna2PictureBox5.Size = new System.Drawing.Size(180, 158); this.guna2PictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.guna2PictureBox5.TabIndex = 8; this.guna2PictureBox5.TabStop = false; this.guna2PictureBox5.UseTransparentBackground = true; // // guna2PictureBox4 // this.guna2PictureBox4.BackColor = System.Drawing.Color.Transparent; this.guna2PictureBox4.Image = global::FlashBAx.Properties.Resources.th__3_; this.guna2PictureBox4.Location = new System.Drawing.Point(319, 183); this.guna2PictureBox4.Name = "guna2PictureBox4"; this.guna2PictureBox4.ShadowDecoration.Parent = this.guna2PictureBox4; this.guna2PictureBox4.Size = new System.Drawing.Size(180, 158); this.guna2PictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.guna2PictureBox4.TabIndex = 6; this.guna2PictureBox4.TabStop = false; this.guna2PictureBox4.UseTransparentBackground = true; // // guna2PictureBox3 // this.guna2PictureBox3.BackColor = System.Drawing.Color.Transparent; this.guna2PictureBox3.Image = global::FlashBAx.Properties.Resources.th__1_; this.guna2PictureBox3.Location = new System.Drawing.Point(24, 183); this.guna2PictureBox3.Name = "guna2PictureBox3"; this.guna2PictureBox3.ShadowDecoration.Parent = this.guna2PictureBox3; this.guna2PictureBox3.Size = new System.Drawing.Size(180, 158); this.guna2PictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.guna2PictureBox3.TabIndex = 4; this.guna2PictureBox3.TabStop = false; this.guna2PictureBox3.UseTransparentBackground = true; // // guna2PictureBox2 // this.guna2PictureBox2.BackColor = System.Drawing.Color.Transparent; this.guna2PictureBox2.Image = global::FlashBAx.Properties.Resources.OIP; this.guna2PictureBox2.Location = new System.Drawing.Point(65, 42); this.guna2PictureBox2.Name = "guna2PictureBox2"; this.guna2PictureBox2.ShadowDecoration.Parent = this.guna2PictureBox2; this.guna2PictureBox2.Size = new System.Drawing.Size(123, 84); this.guna2PictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.guna2PictureBox2.TabIndex = 0; this.guna2PictureBox2.TabStop = false; this.guna2PictureBox2.UseTransparentBackground = true; this.guna2PictureBox2.Click += new System.EventHandler(this.guna2PictureBox2_Click); // // guna2PictureBox1 // this.guna2PictureBox1.FillColor = System.Drawing.Color.Transparent; this.guna2PictureBox1.Image = global::FlashBAx.Properties.Resources.Skull_Tattoo_PNG_Picture; this.guna2PictureBox1.Location = new System.Drawing.Point(31, 12); this.guna2PictureBox1.Name = "guna2PictureBox1"; this.guna2PictureBox1.ShadowDecoration.Parent = this.guna2PictureBox1; this.guna2PictureBox1.Size = new System.Drawing.Size(90, 75); this.guna2PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.guna2PictureBox1.TabIndex = 0; this.guna2PictureBox1.TabStop = false; this.guna2PictureBox1.UseTransparentBackground = true; // // label7 // this.label7.AutoSize = true; this.label7.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label7.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label7.ForeColor = System.Drawing.SystemColors.Desktop; this.label7.Location = new System.Drawing.Point(84, 386); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(53, 19); this.label7.TabIndex = 10; this.label7.Text = "1990\r\n"; // // label8 // this.label8.AutoSize = true; this.label8.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label8.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label8.ForeColor = System.Drawing.SystemColors.Desktop; this.label8.Location = new System.Drawing.Point(389, 386); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(53, 19); this.label8.TabIndex = 11; this.label8.Text = "1991"; // // label9 // this.label9.AutoSize = true; this.label9.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label9.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label9.ForeColor = System.Drawing.SystemColors.Desktop; this.label9.Location = new System.Drawing.Point(637, 386); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(53, 19); this.label9.TabIndex = 12; this.label9.Text = "1992"; // // label10 // this.label10.AutoSize = true; this.label10.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label10.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label10.ForeColor = System.Drawing.SystemColors.Desktop; this.label10.Location = new System.Drawing.Point(717, 436); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(75, 19); this.label10.TabIndex = 13; this.label10.Text = "Next >"; // // label11 // this.label11.AutoSize = true; this.label11.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label11.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label11.ForeColor = System.Drawing.SystemColors.Desktop; this.label11.Location = new System.Drawing.Point(583, 436); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(119, 19); this.label11.TabIndex = 14; this.label11.Text = "< Previous"; // // label12 // this.label12.AutoSize = true; this.label12.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label12.Font = new System.Drawing.Font("MingLiU-ExtB", 15.75F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label12.ForeColor = System.Drawing.SystemColors.Desktop; this.label12.Location = new System.Drawing.Point(972, 9); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(21, 21); this.label12.TabIndex = 15; this.label12.Text = "X"; this.label12.Click += new System.EventHandler(this.label12_Click); // // label13 // this.label13.AutoSize = true; this.label13.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.label13.Font = new System.Drawing.Font("MingLiU-ExtB", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label13.ForeColor = System.Drawing.SystemColors.Desktop; this.label13.Location = new System.Drawing.Point(32, 114); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(97, 19); this.label13.TabIndex = 16; this.label13.Text = "FlashBax"; // // guna2TextBox1 // this.guna2TextBox1.BackColor = System.Drawing.Color.Transparent; this.guna2TextBox1.Cursor = System.Windows.Forms.Cursors.IBeam; this.guna2TextBox1.DefaultText = "Search"; this.guna2TextBox1.DisabledState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(208))))); this.guna2TextBox1.DisabledState.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); this.guna2TextBox1.DisabledState.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); this.guna2TextBox1.DisabledState.Parent = this.guna2TextBox1; this.guna2TextBox1.DisabledState.PlaceholderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(138)))), ((int)(((byte)(138)))), ((int)(((byte)(138))))); this.guna2TextBox1.FillColor = System.Drawing.SystemColors.ControlDarkDark; this.guna2TextBox1.FocusedState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); this.guna2TextBox1.FocusedState.Parent = this.guna2TextBox1; this.guna2TextBox1.Font = new System.Drawing.Font("Script MT Bold", 9F); this.guna2TextBox1.ForeColor = System.Drawing.Color.Black; this.guna2TextBox1.HoverState.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(94)))), ((int)(((byte)(148)))), ((int)(((byte)(255))))); this.guna2TextBox1.HoverState.Parent = this.guna2TextBox1; this.guna2TextBox1.Location = new System.Drawing.Point(4, 173); this.guna2TextBox1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.guna2TextBox1.Name = "guna2TextBox1"; this.guna2TextBox1.PasswordChar = '\0'; this.guna2TextBox1.PlaceholderText = ""; this.guna2TextBox1.SelectedText = ""; this.guna2TextBox1.SelectionStart = 6; this.guna2TextBox1.ShadowDecoration.Parent = this.guna2TextBox1; this.guna2TextBox1.Size = new System.Drawing.Size(117, 19); this.guna2TextBox1.Style = Guna.UI2.WinForms.Enums.TextBoxStyle.Material; this.guna2TextBox1.TabIndex = 17; // // guna2CirclePictureBox1 // this.guna2CirclePictureBox1.FillColor = System.Drawing.Color.Black; this.guna2CirclePictureBox1.Location = new System.Drawing.Point(129, 173); this.guna2CirclePictureBox1.Name = "guna2CirclePictureBox1"; this.guna2CirclePictureBox1.ShadowDecoration.Mode = Guna.UI2.WinForms.Enums.ShadowMode.Circle; this.guna2CirclePictureBox1.ShadowDecoration.Parent = this.guna2CirclePictureBox1; this.guna2CirclePictureBox1.Size = new System.Drawing.Size(32, 19); this.guna2CirclePictureBox1.TabIndex = 18; this.guna2CirclePictureBox1.TabStop = false; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlDarkDark; this.ClientSize = new System.Drawing.Size(1005, 527); this.Controls.Add(this.label12); this.Controls.Add(this.guna2Panel2); this.Controls.Add(this.guna2Panel1); this.ForeColor = System.Drawing.SystemColors.Desktop; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "Form1"; this.Text = "Form1"; this.guna2Panel1.ResumeLayout(false); this.guna2Panel1.PerformLayout(); this.guna2Panel2.ResumeLayout(false); this.guna2Panel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2PictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.guna2CirclePictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion public Guna.UI2.WinForms.Guna2Elipse guna2Elipse1; private Guna.UI2.WinForms.Guna2Panel guna2Panel2; private Guna.UI2.WinForms.Guna2PictureBox guna2PictureBox2; private Guna.UI2.WinForms.Guna2Panel guna2Panel1; private Guna.UI2.WinForms.Guna2PictureBox guna2PictureBox1; private System.Windows.Forms.Label label1; private Guna.UI2.WinForms.Guna2PictureBox guna2PictureBox3; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label5; private Guna.UI2.WinForms.Guna2PictureBox guna2PictureBox4; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label6; private Guna.UI2.WinForms.Guna2PictureBox guna2PictureBox5; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label7; private Guna.UI2.WinForms.Guna2TextBox guna2TextBox1; private System.Windows.Forms.Label label13; private Guna.UI2.WinForms.Guna2CirclePictureBox guna2CirclePictureBox1; } }
59.067599
225
0.632399
[ "MIT" ]
D3atHpR/FlashBax
FlashBAx/FlashBAx/Form1.Designer.cs
25,355
C#
using ChaseLabs.CLConfiguration.List; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OlegMC.REST_API.Data; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Threading.Tasks; using System.Timers; using TraceLd.MineStatSharp; using static OlegMC.REST_API.Data.Global; namespace OlegMC.REST_API.Model { #region Enumerators public enum ServerStatus { Offline, Online, Restarting, Stopping, Killing, Installing, BackingUp, Saving, Starting, } /// <summary> /// <see cref="Vanilla"/> A basic minecraft server<br /> /// <see cref="Forge"/> A forge based server<br /> /// <see cref="Fabric"/> A fabric based server<br /> /// <see cref="Spigot"/> A Spigot, Craftbukkit, Bukkit, Paper, or Bungiee based server<br /> /// <see cref="Other"/> A custom .jar server /// </summary> public enum ServerType { Vanilla, Forge, Fabric, Spigot, Other, } /// <summary> /// <see cref="Normal"/> Stops the server by typing stop in the console. <br /> /// <see cref="Kill"/> Terminates the process running the server. <br /> /// <see cref="Restart"/> Stops server <seealso cref="Normal"/>, or by <seealso cref="Kill"/> and then restarts it. /// </summary> public enum StopMethod { Normal, Kill, Restart, } #endregion Enumerators /// <summary> /// The outline for a basic server. /// </summary> public class ServerModel { #region Variables #region public public bool HasInstallJar = false; public bool HasStartJar = false; public BackupListModel Backups { get; set; } public ConfigManager Config { get; private set; } public List<string> ConsoleLog { get; private set; } /// <summary> /// Gets the number of players currently on the server /// </summary> public int CurrentPlayerCount { get; private set; } public ServerStatus CurrentStatus { get => current_server_status; set { PreviousStatus = current_server_status; current_server_status = value; } } public bool IsRunning => ServerProcess != null && !ServerProcess.HasExited; public int JavaVersion { get => java_version; set { Config.GetConfigByKey("java").Value = value.ToString(); java_version = value; } } public object JSONObject { get { if (ServerProcess != null && !ServerProcess.HasExited) { ServerProcess.Refresh(); } return new { Status = CurrentStatus.ToString(), PlayersOnline = CurrentPlayerCount, MaxPlayers = MaxPlayerCount, PlanTier = ServerPlan.Name, CPU = cpu_usage, RAM = ServerProcess == null || ServerProcess.HasExited ? 0 : Math.Round(ServerProcess.PrivateMemorySize64 / 1024.0 / 1024 / 1024, 2), MaxRAM = MaxRam, Port = ServerProperties.GetByName("server-port") != null ? ServerProperties.GetByName("server-port").Value : string.Empty, IsModded = Directory.Exists(Path.Combine(ServerPath, "mods")), IsPlugin = Directory.Exists(Path.Combine(ServerPath, "plugins")), ModLoader = ServerType, JavaVersion = JavaVersion, }; } } /// <summary> /// Gets/Sets the max number of players allowed on the server /// </summary> public int MaxPlayerCount { get { if (ServerProperties.GetByName("max-players") != null && int.TryParse(ServerProperties.GetByName("max-players").Value, out int v)) { return v; } return 20; } } public int MaxRam { get => max_ram; set { if (ServerPlan.Name == "BYOS") { Config.GetConfigByKey("ram").Value = value.ToString(); max_ram = value; } } } public ServerStatus PreviousStatus { get; set; } /// <summary> /// Returns the server directory. /// </summary> public string ServerPath { get; private set; } /// <summary> /// Gets the <seealso cref="PlanModel"/> of the server. /// </summary> public PlanModel ServerPlan { get; private set; } /// <summary> /// Returns the process currently holding the servers runtime. /// </summary> public Process ServerProcess { get; private set; } /// <summary> /// Gets the <seealso cref="ServerPropertiesModel"/> <b><i>(server.properties)</i></b> /// </summary> public ServerPropertiesModel ServerProperties { get; private set; } /// <summary> /// Gets the <seealso cref="ServerType"/> of the server. /// </summary> public ServerType ServerType { get; set; } #endregion public #region private private ServerStatus current_server_status = ServerStatus.Offline; private int java_version; private int max_ram; private double cpu_usage { get { if (ServerProcess != null && !ServerProcess.HasExited) { return Task.Run(async () => { try { DateTime startTime = DateTime.UtcNow; TimeSpan startCpuUsage = ServerProcess.TotalProcessorTime; await Task.Delay(500); if (ServerProcess == null || ServerProcess.HasExited || CurrentStatus == ServerStatus.Offline) { return 0; } return Math.Round((ServerProcess.TotalProcessorTime - startCpuUsage).TotalMilliseconds / (Environment.ProcessorCount * (DateTime.UtcNow - startTime).TotalMilliseconds) * 100, 2); } catch { return 0; } }).Result; } return 0; } } private string java_path { get { string path = Path.Combine(Paths.Runtime, JavaVersion.ToString(), "bin", $"java{(OperatingSystem.IsWindows() ? ".exe" : string.Empty)}"); if (!File.Exists(path)) { Functions.GenRuntime(); } return path; } } #endregion private #endregion Variables public ServerModel(PlanModel plan) { ServerPlan = plan; ServerPath = Path.Combine(Paths.ServersPath, plan.Username); Directory.CreateDirectory(ServerPath); ServerProperties = ServerPropertiesModel.Init(ServerPath); string olegIdentifier = Path.Combine(ServerPath, "olegmc.server"); Config = new(olegIdentifier, false); Config.Add("plan", plan.Name); Config.Add("username", plan.Username); Config.Add("ram", plan.RAM); Config.Add("java", 16); Config.Add("backups_enabled", false); Config.Add("backup_intervals", 0); Config.Add("max_backups", 5); Config.Add("theme", "default"); ServerPlan.MaxBackups = Config.GetConfigByKey("max_backups").ParseInt(); java_version = Config.GetConfigByKey("java").ParseInt(); max_ram = Config.GetConfigByKey("ram").ParseInt(); ConsoleLog = new(); AcceptEULA(); ForceScan(); Backups = new(this, true); if (Config.GetConfigByKey("backup_intervals").ParseInt() != 0) { Backups.CreateBackupSchedule(Config.GetConfigByKey("backup_intervals").ParseInt()); } } #region Functions #region public /// <summary> /// Accepts the server eula /// </summary> public void AcceptEULA() { string path = Path.Combine(ServerPath, "eula.txt"); if (!File.Exists(path) || !File.ReadAllText(path).Contains("eula=true")) { File.WriteAllText(path, "eula=true"); } } public void DownloadServer(string version) { if (HasStartJar) { File.Delete(Path.Combine(ServerPath, "start.jar")); } if (HasInstallJar) { File.Delete(Path.Combine(ServerPath, "installer.jar")); } using (System.Net.WebClient client = new System.Net.WebClient()) { switch (ServerType) { case ServerType.Vanilla: JObject manifest = (JObject)JsonConvert.DeserializeObject(client.DownloadString("https://launchermeta.mojang.com/mc/game/version_manifest.json")); foreach (JObject v in (JArray)manifest["versions"]) { if (v["id"].ToString() == version) { JObject versionManifest = (JObject)JsonConvert.DeserializeObject(client.DownloadString(v["url"].ToString())); client.DownloadFile(versionManifest["downloads"]["server"]["url"].ToString(), Path.Combine(ServerPath, "installer.jar")); } } break; } client.Dispose(); } InstallServer(); } /// <summary> /// Scans the server path for a installer.jar and/or a start.jar<br /> /// If one is found it will set the start and/or install jar to it. /// </summary> public void ForceScan() { HasStartJar = Directory.GetFiles(ServerPath, "start.jar", SearchOption.TopDirectoryOnly).Length > 0; HasInstallJar = Directory.GetFiles(ServerPath, "installer.jar", SearchOption.TopDirectoryOnly).Length > 0; } /// <summary> /// Installs server using the <seealso cref="ServerType"/>. /// </summary> /// <returns>if the server was installed correctly.</returns> public bool InstallServer() { ForceScan(); CurrentStatus = ServerStatus.Installing; return ServerType switch { ServerType.Vanilla => InstallVanilla(), ServerType.Forge => InstallForge(), ServerType.Fabric => InstallFabric(), ServerType.Spigot => InstallSpigot(), ServerType.Other => InstallCustomServerType(), _ => InstallVanilla(), }; } /// <summary> /// Starts the server normally. /// </summary> /// <returns>if the server started successfully</returns> public bool StartServer() { ForceScan(); if (HasStartJar) { if (ServerProperties.GetByName("server-port") != null && int.TryParse(ServerProperties.GetByName("server-port").Value, out int port)) { Task.Run(async () => { if (!await Networking.IsPortOpen(port)) { await Networking.OpenPort(port); } }).Wait(); } AcceptEULA(); Logger.Info($"Starting Server for {ServerPlan.Username}"); try { ServerProcess = new() { StartInfo = new() { FileName = java_path, Arguments = $"-Xms128M -Xmx{MaxRam}G -jar start.jar nogui", UseShellExecute = false, CreateNoWindow = false, WorkingDirectory = ServerPath, RedirectStandardInput = true, RedirectStandardOutput = true } }; ServerProcess.Start(); Timer timer = new(60 * 1000) { AutoReset = true, Enabled = true }; timer.Elapsed += (s, e) => UpdatePlayersOnline(); timer.Start(); ServerProcess.Exited += (s, o) => { CurrentPlayerCount = 0; timer.Stop(); MonitorServerOutput(); }; ConsoleLog = new(); ServerProcess.OutputDataReceived += (s, e) => { MonitorServerOutput(e.Data); }; ServerProcess.BeginOutputReadLine(); CurrentStatus = ServerStatus.Starting; } catch { CurrentStatus = ServerStatus.Offline; } } else { CurrentStatus = ServerStatus.Offline; } return CurrentStatus == ServerStatus.Online; } /// <summary> /// Stops the server using the <seealso cref="StopMethod"/>. /// </summary> /// <param name="method">The way in which to handle the server termination.</param> /// <returns>if the server was stopped successfully.</returns> public bool StopServer(StopMethod method) { if (CurrentStatus == ServerStatus.Online) { if (ServerProcess == null) { return true; } CurrentStatus = ServerStatus.Stopping; return method switch { StopMethod.Normal => StopServer(), StopMethod.Kill => KillServer(), StopMethod.Restart => RestartServer(), _ => false, }; } else { return true; } } #endregion public #region private /// <summary> /// Installs custom jar server. /// </summary> /// <returns>if the server was installed correctly.</returns> private bool InstallCustomServerType() { return StartServer(); } /// <summary> /// /// </summary> /// <returns>if the server was installed correctly.</returns> private bool InstallFabric() { ServerProcess = new() { StartInfo = new() { FileName = java_path, Arguments = $"-Xms128M -Xmx{ServerPlan.RAM}G -jar installer.jar server -downloadMinecraft", UseShellExecute = false, CreateNoWindow = false, WorkingDirectory = ServerPath, RedirectStandardInput = true, RedirectStandardOutput = true } }; ServerProcess.Start(); ConsoleLog = new(); ServerProcess.OutputDataReceived += (s, e) => { if (e.Data != null) { string text = e.Data; text = text.Replace(@"\u", "/u"); ConsoleLog.Add($"{text}"); } }; ServerProcess.BeginOutputReadLine(); ServerProcess.Exited += (s, e) => { CurrentStatus = ServerStatus.Offline; File.Move(Path.Combine(ServerPath, "fabric-server-launch.jar"), Path.Combine(ServerPath, "start.jar")); }; return true; } /// <summary> /// Installs a forge server using the start.jar /// </summary> /// <returns>if the server was installed correctly.</returns> private bool InstallForge() { ServerProcess = new() { StartInfo = new() { FileName = java_path, Arguments = $"-Xms128M -Xmx{ServerPlan.RAM}G -jar installer.jar --installServer", UseShellExecute = false, CreateNoWindow = false, WorkingDirectory = ServerPath, RedirectStandardInput = true, RedirectStandardOutput = true } }; ServerProcess.Start(); ConsoleLog = new(); ServerProcess.OutputDataReceived += (s, e) => { if (e.Data != null) { string text = e.Data; text = text.Replace(@"\u", "/u"); ConsoleLog.Add($"{text}"); } }; ServerProcess.BeginOutputReadLine(); string jar = ""; ServerProcess.Exited += (s, e) => { string[] jars = Directory.GetFiles(ServerPath, "forge*.jar", SearchOption.TopDirectoryOnly); if (jars.Length == 1) { jar = jars[0]; } else { jar = "null"; } CurrentStatus = ServerStatus.Offline; }; if (jar.Equals("null")) { return false; } else { File.Move(jar, Path.Combine(ServerPath, "start.jar")); return true; } } /// <summary> /// Installs a spigot based server (<seealso cref="ServerType.Spigot"/>) using start.jar. /// </summary> /// <returns>if the server was installed correctly.</returns> private bool InstallSpigot() { if (!HasStartJar && HasInstallJar) { File.Move(Path.Combine(ServerPath, "installer.jar"), Path.Combine(ServerPath, "start.jar")); } return StartServer(); } /// <summary> /// Installs a vanilla server using the start.jar /// </summary> /// <returns>if the server was installed correctly.</returns> private bool InstallVanilla() { if (!HasStartJar && HasInstallJar) { File.Move(Path.Combine(ServerPath, "installer.jar"), Path.Combine(ServerPath, "start.jar")); } return StartServer(); } /// <summary> /// Kills the server process. /// </summary> /// <returns>if the server process was killed successfully.</returns> private bool KillServer() { try { if (ServerProcess != null) { CurrentStatus = ServerStatus.Killing; ServerProcess.Kill(true); } } catch { return false; } return true; } private void MonitorServerOutput() { string[] search_cmds = { @"Starting minecraft server version", @"Loading for game Minecraft" }; if (ServerProperties.GetByName("server-port") != null && int.TryParse(ServerProperties.GetByName("server-port").Value, out int port)) { Task.Run(async () => { if (await Networking.IsPortOpen(port)) { await Networking.ClosePort(port); } }).Wait(); } CurrentStatus = ServerStatus.Offline; ServerProcess = null; if (ConsoleLog.Contains(@"Error: A JNI error has occurred, please check your installation and try again")) { JavaVersion = 16; StartServer(); } foreach (string cmd in search_cmds) { if (ConsoleLog.Contains(cmd)) { if (int.Parse(ConsoleLog[ConsoleLog.IndexOf(cmd)].Split(cmd)[^1].Split('.')[1].Replace(".", "")) >= 16) { JavaVersion = 16; } else { JavaVersion = 8; } StartServer(); break; } } } private void MonitorServerOutput(string text) { if (!ServerProcess.HasExited) { ConsoleLog.Add($"{text}"); switch (text) { case string a when (a.Contains("joined the game") || a.Contains("left the game")): UpdatePlayersOnline(); break; case string a when (CurrentStatus == ServerStatus.Starting && a.Contains(")! For help, type \"help\"")): CurrentStatus = ServerStatus.Online; break; case string a when a.Contains("Saving the game"): CurrentStatus = ServerStatus.Saving; break; case string a when a.Contains("Saved the game"): CurrentStatus = PreviousStatus; break; } } } /// <summary> /// Stopps the server normally using <seealso cref="StopServer(int)"/> and the starts it normally using <seealso cref="StartServer"/>. /// </summary> /// <returns>returns if the server was restarted successfully.</returns> private bool RestartServer() { CurrentStatus = ServerStatus.Restarting; if (StopServer()) { return StartServer(); } return false; } /// <summary> /// Stops the server normally.<br /> /// if the function runs more than 3x <seealso cref="KillServer"/> will run instead. /// </summary> /// <param name="ittertions">The number of times this function has been run recursivly. if the function runs more than 3x <seealso cref="KillServer"/> will run instead.</param> /// <returns>if the server was stopped successfully.</returns> private bool StopServer(int ittertions = 0) { bool failed = false; bool superFailed = false; ServerProcess.StandardInput.WriteLine("stop"); Timer timer = new(15 * 1000); timer.AutoReset = false; timer.Start(); timer.Elapsed += (s, e) => { if (ServerProcess == null) { return; } if (!ServerProcess.HasExited && ittertions < 2) { superFailed = false; failed = true; } else if (!ServerProcess.HasExited && ittertions > 2) { failed = false; superFailed = true; } }; while (!ServerProcess.HasExited) { if (failed) { return StopServer(ittertions + 1); } if (superFailed) { return StopServer(StopMethod.Kill); } } return true; } private void UpdatePlayersOnline() { if (ushort.TryParse(ServerProperties.GetByName("server-port").Value, out ushort port)) { MineStat mc = new("127.0.0.1", port); if (mc.ServerUp) { if (ushort.TryParse(mc.CurrentPlayers, out ushort players)) { CurrentPlayerCount = players; return; } } } CurrentPlayerCount = 0; } #endregion private #endregion Functions } }
34.35894
207
0.455148
[ "Apache-2.0" ]
DcmanProductions/Minecraft-Server-Manager
API/Model/ServerModel.cs
25,943
C#
/* * Copyright © 2020 EDDiscovery development team * * 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. * * EDDiscovery is not affiliated with Frontier Developments plc. */ using BaseUtils.JSON; using System.Diagnostics; using System.Reflection; namespace EliteDangerousCore.IGAU { public class IGAUClass : BaseUtils.HttpCom { static public string SoftwareName { get; set; } = "EDDiscovery"; private readonly string App_Version; private readonly string igau_address = "https://ddss70885k.execute-api.us-west-1.amazonaws.com/Prod"; public IGAUClass() { httpserveraddress = igau_address; var assemblyFullName = Assembly.GetEntryAssembly().FullName; App_Version = assemblyFullName.Split(',')[1].Split('=')[1]; } public JObject CreateIGAUMessageCodexMessage(string timestamp, string EntryID, string Name, string Name_Localised, string System, string SystemAddress) { var stripped = Name?.ToLowerInvariant()?.Replace("$", "")?.Replace("_name;", ""); JObject detail = new JObject(); detail["timestamp"] = timestamp; detail["EntryID"] = EntryID.ToString(); detail["Name"] = stripped; detail["Name_Localised"] = Name_Localised; detail["System"] = System; detail["SystemAddress"] = SystemAddress.ToString(); detail["App_Name"] = SoftwareName; detail["App_Version"] = App_Version; return detail; } public JObject CreateIGAUMessageScanOrganicMessage(string timestamp, string species, string speciesloc, string System, string SystemAddress) { var strippedspecies = species?.ToLowerInvariant()?.Replace("$", "")?.Replace("_name;", ""); JObject detail = new JObject(); detail["timestamp"] = timestamp; detail["EntryID"] = "-"; detail["Name"] = strippedspecies; detail["Name_Localised"] = speciesloc; detail["System"] = System; detail["SystemAddress"] = SystemAddress.ToString(); detail["App_Name"] = SoftwareName; detail["App_Version"] = App_Version; return detail; } public bool PostMessage(JObject msg) { if (igau_address.IsEmpty()) return false; try { BaseUtils.ResponseData resp = RequestPost(msg.ToString(), ""); var result = JToken.ParseThrowCommaEOL(resp.Body); if (result.Str() == "SUCCESS") { return true; } else { var res = result["response"]; var errmsg = res?.Str("errorMessage"); Trace.WriteLine($"IGAU message post failed: {errmsg}"); return false; } } catch (System.Net.WebException ex) { System.Net.HttpWebResponse response = ex.Response as System.Net.HttpWebResponse; System.Diagnostics.Trace.WriteLine($"IGAU message post failed - status: {response?.StatusCode.ToString() ?? ex.Status.ToString()}\nIGAU Message: {msg.ToString()}"); return false; } catch (System.Exception ex) { System.Diagnostics.Trace.WriteLine($"IGAU exception - status: {ex}"); return false; } } } }
39.037383
181
0.570745
[ "Apache-2.0" ]
EDDiscovery/EliteDangerousCore
EliteDangerous/IGAU/IGAUClass.cs
4,180
C#
using Newtonsoft.Json; using System.Collections.Generic; namespace DaretokuTools { public class UnitDef { private int _Day; private int _Hour; private int _Min; private int _Sec; [JsonProperty("name")] public string Name { get; set; } [JsonProperty("time")] public string Time { set { try { var s = value.Split(':'); _Day = int.Parse(s[0]); _Hour = int.Parse(s[1]); _Min = int.Parse(s[2]); _Sec = int.Parse(s[3]); } catch { _Day = 0; _Hour = 0; _Min = 0; _Sec = 0; } } } [JsonProperty("multiplier")] public int Multiplier { get; set; } public int Day { get { return _Day; } } public int Hour { get { return _Hour; } } public int Min { get { return _Min; } } public int Sec { get { return _Sec; } } } }
17.76087
43
0.571603
[ "MIT" ]
hamache9821/3MarcoConverter
3MarcoConverter/UnitDef.cs
819
C#
using System.Runtime.Serialization; namespace EncompassRest.Loans.Enums { public enum InterestAccrualType { AverageDailyInterestAccrual = 0, DailyInterestAccrual = 1 } }
19.8
40
0.712121
[ "MIT" ]
gashach/EncompassRest
src/EncompassRest/Loans/Enums/InterestAccrualType.cs
198
C#
using Samples.Client; using Samples.Model; using SignalRems.Client.Extensions; using SignalRems.Core.Interfaces; IHost host = Host.CreateDefaultBuilder(args) .ConfigureServices(services => { services.AddHostedService<Worker>(); services.AddSignalRemsClient(); services.AddTransient<ISubscriptionHandler<Person>, PersonManager>(); }) .Build(); await host.RunAsync();
25.5
77
0.723039
[ "MIT" ]
LiPascal/SignalRems
src/Samples/Samples.Client/Program.cs
408
C#
using System; using System.Collections; using System.Collections.Generic; using System.IO; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; namespace MagicStorage.Components { public class TERemoteAccess : TEStorageCenter { private Point16 locator = new Point16(-1, -1); public override bool ValidTile(Tile tile) { return tile.type == mod.TileType("RemoteAccess") && tile.frameX == 0 && tile.frameY == 0; } public override TEStorageHeart GetHeart() { if (locator.X < 0 || locator.Y < 0 || !TileEntity.ByPosition.ContainsKey(locator)) { return null; } return TileEntity.ByPosition[locator] as TEStorageHeart; } public bool TryLocate(Point16 toLocate, out string message) { if (locator.X >= 0 && locator.Y >= 0) { message = "This Access already has a locator, please mine then replace to reset it"; return false; } if (toLocate.X < 0 || toLocate.Y < 0) { message = "The locator has not been set to a destination"; return false; } message = "Success!"; locator = toLocate; NetHelper.ClientSendTEUpdate(ID); return true; } public override void Update() { TEStorageHeart heart = GetHeart(); if (heart != null && !heart.remoteAccesses.Contains(Position)) { heart.remoteAccesses.Add(Position); } } public override TagCompound Save() { TagCompound tag = base.Save(); TagCompound tagLocator = new TagCompound(); tagLocator.Set("X", locator.X); tagLocator.Set("Y", locator.Y); tag.Set("Locator", tagLocator); return tag; } public override void Load(TagCompound tag) { base.Load(tag); TagCompound tagLocator = tag.GetCompound("Locator"); locator = new Point16(tagLocator.GetShort("X"), tagLocator.GetShort("Y")); } public override void NetSend(BinaryWriter writer, bool lightSend) { base.NetSend(writer, lightSend); writer.Write(locator.X); writer.Write(locator.Y); } public override void NetReceive(BinaryReader reader, bool lightReceive) { base.NetReceive(reader, lightReceive); locator = new Point16(reader.ReadInt16(), reader.ReadInt16()); } } }
25.011236
92
0.690925
[ "MIT" ]
AqlaSolutions/MagicStorage
Components/TERemoteAccess.cs
2,226
C#
using Barrage.Bullet; namespace Damage { public interface IDamageApplicable { AttackerType GetAttackerType(); void ApplyDamage(DamageData data); } }
16.272727
42
0.675978
[ "MIT" ]
kotuakoutyan/3DBarrageSample
Assets/Scripts/Damage/IDamageApplicable.cs
181
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 kinesisanalytics-2015-08-14.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.KinesisAnalytics.Model { /// <summary> /// Provides additional mapping information when JSON is the record format on the streaming /// source. /// </summary> public partial class JSONMappingParameters { private string _recordRowPath; /// <summary> /// Gets and sets the property RecordRowPath. /// <para> /// Path to the top-level parent that contains the records. /// </para> /// </summary> [AWSProperty(Required=true, Min=1)] public string RecordRowPath { get { return this._recordRowPath; } set { this._recordRowPath = value; } } // Check to see if RecordRowPath property is set internal bool IsSetRecordRowPath() { return this._recordRowPath != null; } } }
29.745763
114
0.663818
[ "Apache-2.0" ]
ChristopherButtars/aws-sdk-net
sdk/src/Services/KinesisAnalytics/Generated/Model/JSONMappingParameters.cs
1,755
C#
using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using HuaweiCloud.SDK.Core; namespace HuaweiCloud.SDK.Iam.V3.Model { /// <summary> /// Response Object /// </summary> public class KeystoneAssociateGroupWithDomainPermissionResponse : SdkResponse { } }
19.428571
81
0.747549
[ "Apache-2.0" ]
Huaweicloud-SDK/huaweicloud-sdk-net-v3
Services/Iam/V3/Model/KeystoneAssociateGroupWithDomainPermissionResponse.cs
408
C#
[Serializable] public class VideoScriptPlayableAsset : PlayableAsset // TypeDefIndex: 11810 { // Fields public ExposedReference<VideoPlayer> videoPlayer; // 0x18 [SerializeField] // RVA: 0x195300 Offset: 0x195401 VA: 0x195300 [NotKeyableAttribute] // RVA: 0x195300 Offset: 0x195401 VA: 0x195300 public VideoClip videoClip; // 0x28 [SerializeField] // RVA: 0x195340 Offset: 0x195441 VA: 0x195340 [NotKeyableAttribute] // RVA: 0x195340 Offset: 0x195441 VA: 0x195340 public bool mute; // 0x30 [SerializeField] // RVA: 0x195380 Offset: 0x195481 VA: 0x195380 [NotKeyableAttribute] // RVA: 0x195380 Offset: 0x195481 VA: 0x195380 public bool loop; // 0x31 [SerializeField] // RVA: 0x1953C0 Offset: 0x1954C1 VA: 0x1953C0 [NotKeyableAttribute] // RVA: 0x1953C0 Offset: 0x1954C1 VA: 0x1953C0 public double preloadTime; // 0x38 [SerializeField] // RVA: 0x195400 Offset: 0x195501 VA: 0x195400 [NotKeyableAttribute] // RVA: 0x195400 Offset: 0x195501 VA: 0x195400 public double clipInTime; // 0x40 // Methods // RVA: 0x1CFC4D0 Offset: 0x1CFC5D1 VA: 0x1CFC4D0 Slot: 6 public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { } // RVA: 0x1CFC610 Offset: 0x1CFC711 VA: 0x1CFC610 public void .ctor() { } }
39.83871
80
0.753846
[ "MIT" ]
SinsofSloth/RF5-global-metadata
UnityEngine/Timeline/VideoScriptPlayableAsset.cs
1,235
C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using E_commerce.Models; using Dapper; using System.Configuration; using System.Data.SqlClient; namespace E_commerce.Controllers { public class CartController : Controller { private readonly string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; // GET: /Cart/ public ActionResult Index() { List<CartViewModel> product; using (var connection = new SqlConnection(this.connectionString)) { product = connection.Query<CartViewModel>("select * from Cart").ToList(); } return View(product); } public ActionResult AddToCart(int CartId, int ProductId, string ProductTitle, int ProductPrice) { using (var connection = new SqlConnection(this.connectionString)) { var insert = "INSERT INTO Cart (CartId, ProductId, ProductTitle, ProductPrice) VALUES (@CartId, @ProductId, @ProductTitle, @ProductPrice)"; var parameters = new { CartId = CartId, ProductId = ProductId, ProductTitle = ProductTitle, ProductPrice = ProductPrice }; connection.Execute(insert, parameters); } return RedirectToAction("index", "cart"); } } }
31.533333
155
0.64623
[ "MIT" ]
ericaglimsholt/shop
E-commerce/Controllers/CartController.cs
1,421
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; namespace WebAppFront.Controllers { /// <summary> /// SetLanguageController /// </summary> [AllowAnonymous] public class SetLanguageController : Controller { /// <summary> /// /// </summary> /// <returns></returns> public IActionResult Index() { return View(); } /// <summary> /// /// </summary> /// <param name="culture"></param> /// <param name="returnUrl"></param> /// <returns></returns> [HttpPost] //[IgnoreAntiforgeryToken] [ValidateAntiForgeryToken] public IActionResult SetLanguage(string culture, string returnUrl) { Response.Cookies.Append( CookieRequestCultureProvider.DefaultCookieName, CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)), new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1), Secure = true, SameSite = SameSiteMode.None } ); return LocalRedirect(returnUrl); } } }
28.208333
126
0.607829
[ "MIT" ]
mroyon/CoreWebTemplate_V3.1
WebSolutionTemplate/WebAppFront/Controllers/SetLanguageController.cs
1,356
C#
using RarelySimple.AvatarScriptLink.Helpers; using RarelySimple.AvatarScriptLink.Objects.Advanced; using System; using System.Collections.Generic; using System.Text; namespace RarelySimple.AvatarScriptLink.Objects { public class OptionObjectDecorator : IOptionObjectDecorator { private readonly IOptionObject2015 _optionObject; public OptionObjectDecorator(IOptionObject2015 optionObject) { _optionObject = optionObject; } public string EntityID => _optionObject.EntityID; public double EpisodeNumber => _optionObject.EpisodeNumber; public double ErrorCode => _optionObject.ErrorCode; public string ErrorMesg => _optionObject.ErrorMesg; public string Facility => _optionObject.Facility; public List<FormObject> Forms => _optionObject.Forms; public string NamespaceName => _optionObject.NamespaceName; public string OptionId => _optionObject.OptionId; public string OptionStaffId => _optionObject.OptionStaffId; public string OptionUserId => _optionObject.OptionUserId; public string ParentNamespace => _optionObject.ParentNamespace; public string ServerName => _optionObject.ServerName; public string SystemCode => _optionObject.SystemCode; public string SessionToken => _optionObject.SessionToken; /// <summary> /// Adds a <see cref="FormObject"/> to an <see cref="OptionObject2015"/>. /// </summary> /// <param name="formObject"></param> public void AddFormObject(FormObject formObject) => _optionObject.Forms = OptionObjectHelpers.AddFormObject(_optionObject, formObject).Forms; /// <summary> /// Adds a <see cref="FormObject"/> to an <see cref="OptionObject2015"/>. /// </summary> /// <param name="formId"></param> /// <param name="multipleIteration"></param> public void AddFormObject(string formId, bool multipleIteration) => _optionObject.Forms = OptionObjectHelpers.AddFormObject(_optionObject, formId, multipleIteration).Forms; /// <summary> /// Adds a <see cref="RowObject"/> to a <see cref="FormObject"/> in _optionObject <see cref="OptionObject2015"/>. /// </summary> /// <param name="formId"></param> /// <param name="rowObject"></param> public void AddRowObject(string formId, RowObject rowObject) => _optionObject.Forms = OptionObjectHelpers.AddRowObject(_optionObject, formId, rowObject).Forms; /// <summary> /// Clones the <see cref="OptionObjectBase"/>. /// </summary> /// <returns></returns> public OptionObjectBase Clone() { var optionObject = (OptionObjectBase)MemberwiseClone(); optionObject.Forms = new List<FormObject>(); foreach (var form in optionObject.Forms) { optionObject.Forms.Add(form.Clone()); } return optionObject; } /// <summary> /// Marks a <see cref="RowObject"/> for deletion. /// </summary> /// <param name="rowObject"></param> public void DeleteRowObject(RowObject rowObject) => _optionObject.Forms = OptionObjectHelpers.DeleteRowObject(_optionObject, rowObject).Forms; /// <summary> /// Marks a <see cref="RowObject"/> for deletion. /// </summary> /// <param name="rowId"></param> public void DeleteRowObject(string rowId) => _optionObject.Forms = OptionObjectHelpers.DeleteRowObject(_optionObject, rowId).Forms; /// <summary> /// Sets all <see cref="FieldObject"/> as disabled. /// </summary> public void DisableAllFieldObjects() => _optionObject.Forms = OptionObjectHelpers.DisableAllFieldObjects(_optionObject).Forms; /// <summary> /// Sets all <see cref="FieldObject"/> as disabled except for any listed to be excluded. /// </summary> /// <param name="excludedFieldObjects"></param> public void DisableAllFieldObjects(List<string> excludedFieldObjects) => _optionObject.Forms = OptionObjectHelpers.DisableAllFieldObjects(_optionObject, excludedFieldObjects).Forms; /// <summary> /// Returns the CurrentRow RowId of the form matching the FormId. /// </summary> /// <param name="formId"></param> /// <returns></returns> public string GetCurrentRowId(string formId) => OptionObjectHelpers.GetCurrentRowId(_optionObject, formId); /// <summary> /// Returns the first value of the field matching the Field Number. /// </summary> /// <param name="fieldNumber"></param> /// <returns></returns> public string GetFieldValue(string fieldNumber) => OptionObjectHelpers.GetFieldValue(_optionObject, fieldNumber); /// <summary> /// Returns the value of the <see cref="FieldObject"/> matching the Field Number. /// </summary> /// <param name="fieldNumber"></param> /// <returns></returns> public string GetFieldValue(string formId, string rowId, string fieldNumber) => OptionObjectHelpers.GetFieldValue(_optionObject, formId, rowId, fieldNumber); /// <summary> /// Returns the values of the field matching the Field Number. /// </summary> /// <param name="fieldNumber"></param> /// <returns></returns> public List<string> GetFieldValues(string fieldNumber) => OptionObjectHelpers.GetFieldValues(_optionObject, fieldNumber); /// <summary> /// Returns the Multiple Iteration Status of the form matching the FormId. /// </summary> /// <param name="formId"></param> /// <returns></returns> public bool GetMultipleIterationStatus(string formId) => OptionObjectHelpers.GetMultipleIterationStatus(_optionObject, formId); /// <summary> /// Returns the CurrentRow ParentRowId of the form matching the FormId. /// </summary> /// <param name="formId"></param> /// <returns></returns> public string GetParentRowId(string formId) => OptionObjectHelpers.GetParentRowId(_optionObject, formId); /// <summary> /// Returns whether the specified field is enabled. /// </summary> /// <param name="fieldNumber"></param> /// <returns></returns> public bool IsFieldEnabled(string fieldNumber) => OptionObjectHelpers.IsFieldEnabled(_optionObject, fieldNumber); /// <summary> /// Returns whether the specified field is locked. /// </summary> /// <param name="fieldNumber"></param> /// <returns></returns> public bool IsFieldLocked(string fieldNumber) => OptionObjectHelpers.IsFieldLocked(_optionObject, fieldNumber); /// <summary> /// Returns whether the specified field is modified. /// </summary> /// <param name="fieldNumber"></param> /// <returns></returns> public bool IsFieldModified(string fieldNumber) => OptionObjectHelpers.IsFieldModified(_optionObject, fieldNumber); /// <summary> /// Returns whether the specified field is present. /// </summary> /// <param name="fieldNumber"></param> /// <returns></returns> public bool IsFieldPresent(string fieldNumber) => OptionObjectHelpers.IsFieldPresent(_optionObject, fieldNumber); /// <summary> /// Returns whether the specified field is required. /// </summary> /// <param name="fieldNumber"></param> /// <returns></returns> public bool IsFieldRequired(string fieldNumber) => OptionObjectHelpers.IsFieldRequired(_optionObject, fieldNumber); /// <summary> /// Returns whether the specified <see cref="FormObject"/> is present. /// </summary> /// <param name="formId"></param> /// <returns></returns> public bool IsFormPresent(string formId) => OptionObjectHelpers.IsFormPresent(_optionObject, formId); /// <summary> /// Returns whether the specified <see cref="RowObject"/> is marked for deletion. /// </summary> /// <param name="rowId"></param> /// <returns></returns> public bool IsRowMarkedForDeletion(string rowId) => OptionObjectHelpers.IsRowMarkedForDeletion(_optionObject, rowId); /// <summary> /// Returns whether the specified <see cref="RowObject"/> is present. /// </summary> /// <param name="rowId"></param> /// <returns></returns> public bool IsRowPresent(string rowId) => OptionObjectHelpers.IsRowPresent(_optionObject, rowId); /// <summary> /// Sets the specified field as disabled and unrequires if required. /// </summary> /// <param name="fieldNumber"></param> public void SetDisabledField(string fieldNumber) => _optionObject.Forms = OptionObjectHelpers.SetDisabledField(_optionObject, fieldNumber).Forms; /// <summary> /// Sets the specified fields as disabled and unrequires if required. /// </summary> /// <param name="fieldNumbers"></param> public void SetDisabledFields(List<string> fieldNumbers) => _optionObject.Forms = OptionObjectHelpers.SetDisabledFields(_optionObject, fieldNumbers).Forms; /// <summary> /// Set the specified field as enabled and not required. /// <para>_optionObject is the equivalent of <see cref="SetOptionalField(string)"/>.</para> /// </summary> /// <param name="fieldNumber"></param> public void SetEnabledField(string fieldNumber) => _optionObject.Forms = OptionObjectHelpers.SetEnabledField(_optionObject, fieldNumber).Forms; /// <summary> /// Set the specified fields as enabled and not required. /// <para>_optionObject is the equivalent of <see cref="SetOptionalFields(List{string})"/>.</para> /// </summary> /// <param name="fieldNumbers"></param> public void SetEnabledFields(List<string> fieldNumbers) => _optionObject.Forms = OptionObjectHelpers.SetEnabledFields(_optionObject, fieldNumbers).Forms; /// <summary> /// Sets the FieldValue of a <see cref="FieldObject"/> in the <see cref="OptionObject"/> on the first form CurrentRow. /// </summary> /// <param name="fieldNumber"></param> /// <param name="fieldValue"></param> public void SetFieldValue(string fieldNumber, string fieldValue) => _optionObject.Forms = OptionObjectHelpers.SetFieldValue(_optionObject, fieldNumber, fieldValue).Forms; /// <summary> /// Sets the FieldValue of a <see cref="FieldObject"/> in the <see cref="OptionObject2015"/> /// </summary> /// <param name="formId"></param> /// <param name="rowId"></param> /// <param name="fieldNumber"></param> /// <param name="fieldValue"></param> public void SetFieldValue(string formId, string rowId, string fieldNumber, string fieldValue) => _optionObject.Forms = OptionObjectHelpers.SetFieldValue(_optionObject, formId, rowId, fieldNumber, fieldValue).Forms; /// <summary> /// Set the specified field as locked. /// </summary> /// <param name="fieldNumber"></param> public void SetLockedField(string fieldNumber) => _optionObject.Forms = OptionObjectHelpers.SetLockedField(_optionObject, fieldNumber).Forms; /// <summary> /// Set the specified fields as locked. /// </summary> /// <param name="fieldNumbers"></param> public void SetLockedFields(List<string> fieldNumbers) => _optionObject.Forms = OptionObjectHelpers.SetLockedFields(_optionObject, fieldNumbers).Forms; /// <summary> /// Set the specified field as not required and enables if disabled. /// </summary> /// <param name="fieldNumber"></param> public void SetOptionalField(string fieldNumber) => _optionObject.Forms = OptionObjectHelpers.SetOptionalField(_optionObject, fieldNumber).Forms; /// <summary> /// Set the specified fields as not required and enables if disabled. /// </summary> /// <param name="fieldNumbers"></param> public void SetOptionalFields(List<string> fieldNumbers) => _optionObject.Forms = OptionObjectHelpers.SetOptionalFields(_optionObject, fieldNumbers).Forms; /// <summary> /// Sets the specified field as required and enables if disabled. /// </summary> /// <param name="fieldNumber"></param> public void SetRequiredField(string fieldNumber) => _optionObject.Forms = OptionObjectHelpers.SetRequiredField(_optionObject, fieldNumber).Forms; /// <summary> /// Sets the specified fields as required and enables if disabled. /// </summary> /// <param name="fieldNumbers"></param> public void SetRequiredFields(List<string> fieldNumbers) => _optionObject.Forms = OptionObjectHelpers.SetRequiredFields(_optionObject, fieldNumbers).Forms; /// <summary> /// Set the specified field as unlocked. /// </summary> /// <param name="fieldNumber"></param> public void SetUnlockedField(string fieldNumber) => _optionObject.Forms = OptionObjectHelpers.SetUnlockedField(_optionObject, fieldNumber).Forms; /// <summary> /// Set the specified fields as unlocked. /// </summary> /// <param name="fieldNumbers"></param> public void SetUnlockedFields(List<string> fieldNumbers) => _optionObject.Forms = OptionObjectHelpers.SetUnlockedFields(_optionObject, fieldNumbers).Forms; /// <summary> /// Returns a <see cref="string"/> with all of the contents of the <see cref="OptionObject2015"/> formatted in HTML. /// </summary> /// <returns><see cref="string"/> of all of the contents of the <see cref="OptionObject2015"/> formatted in HTML.</returns> public string ToHtmlString() => OptionObjectHelpers.TransformToHtmlString(_optionObject); /// <summary> /// Returns a <see cref="string"/> with all of the contents of the <see cref="OptionObject2015"/> formatted in HTML. /// </summary> /// <param name="includeHtmlHeaders">Determines whether to include the HTML headers in return. False allows for the embedding of the HTML in another HTML document.</param> /// <returns><see cref="string"/> of all of the contents of the <see cref="OptionObject2015"/> formatted in HTML.</returns> public string ToHtmlString(bool includeHtmlHeaders) => OptionObjectHelpers.TransformToHtmlString(_optionObject, includeHtmlHeaders); /// <summary> /// Returns a <see cref="string"/> with all of the contents of the <see cref="OptionObject2015"/> formatted as JSON. /// </summary> /// <returns><see cref="string"/> of all of the contents of the <see cref="OptionObject2015"/> formatted as JSON.</returns> public string ToJson() => OptionObjectHelpers.TransformToJson(_optionObject); /// <summary> /// Transforms the <see cref="OptionObjectBase"/> to an <see cref="OptionObject"/>. /// </summary> /// <returns></returns> public OptionObject ToOptionObject() => (OptionObject)_optionObject; /// <summary> /// Transforms the <see cref="OptionObjectBase"/> to an <see cref="OptionObject2"/>. /// </summary> /// <returns></returns> public OptionObject2 ToOptionObject2() => (OptionObject2)_optionObject; /// <summary> /// Transforms the <see cref="OptionObjectBase"/> to an <see cref="OptionObject2015"/>. /// </summary> /// <returns></returns> public OptionObject2015 ToOptionObject2015() => (OptionObject2015)_optionObject; /// <summary> /// Creates an <see cref="OptionObjectBase"/> with the minimal information required to return. /// </summary> /// <returns></returns> public OptionObjectBase ToReturnOptionObject() => (OptionObjectBase)OptionObjectHelpers.GetReturnOptionObject(_optionObject); /// <summary> /// Creates an <see cref="OptionObjectBase"/> with the minimal information required to return plus the provide Error Code and Message. /// </summary> /// <param name="errorCode"></param> /// <param name="errorMessage"></param> /// <returns></returns> public OptionObjectBase ToReturnOptionObject(double errorCode, string errorMessage) => (OptionObjectBase)OptionObjectHelpers.GetReturnOptionObject(_optionObject, errorCode, errorMessage); /// <summary> /// Returns a <see cref="string"/> with all of the contents of the <see cref="OptionObjectBase"/> formatted as XML. /// </summary> /// <returns><see cref="string"/> of all of the contents of the <see cref="OptionObjectBase"/> formatted as XML.</returns> public string ToXml() => OptionObjectHelpers.TransformToXml(_optionObject); } }
50.724036
222
0.650404
[ "MIT" ]
rarelysimple/RarelySimple.AvatarScriptLink
RarelySimple.AvatarScriptLink/Objects/OptionObjectDecorator.cs
17,096
C#
// Copyright (c) All contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Jmelosegui.DevOpsCLI.Commands { using System.Collections.Generic; using Jmelosegui.DevOps.Client; using McMaster.Extensions.CommandLineUtils; using Microsoft.Extensions.Logging; [Command("list", Description = "Get a list of build definitions.")] public class BuildDefinitionListCommand : CommandBase { public BuildDefinitionListCommand(ILogger<BuildDefinitionListCommand> logger) : base(logger) { } protected override int OnExecute(CommandLineApplication app) { base.OnExecute(app); IEnumerable<BuildDefinition> results = this.DevOpsClient.BuildDefinition.GetAllAsync(this.ProjectName).GetAwaiter().GetResult(); this.PrintOrExport(results); return ExitCodes.Ok; } } }
31.677419
140
0.694501
[ "MIT" ]
jmelosegui/devops-cli
DevOpsCLI/Commands/BuildDefinition/BuildDefinitionListCommand.cs
982
C#
// Generator { Name: SearchAdvancedGenerator, Template: ISearchAdvanced } using System; namespace SuiteTalk { public partial class ContactRoleSearchAdvanced: ISearchAdvanced, ISearchAdvanced<ContactRoleSearch, ContactRoleSearchRow> { SearchRecord ISearchAdvanced.GetCriteria() => this.GetCriteria(); public ContactRoleSearch GetCriteria() => this.criteria; SearchRecord ISearchAdvanced.CreateCriteria() => this.CreateCriteria(); public ContactRoleSearch CreateCriteria() { this.criteria = new ContactRoleSearch(); return this.criteria; } ISearchAdvanced<ContactRoleSearch, ContactRoleSearchRow> ISearchAdvanced<ContactRoleSearch, ContactRoleSearchRow>.CreateCriteria(Action<ContactRoleSearch> initializer) => this.CreateCriteria(initializer); public ContactRoleSearchAdvanced CreateCriteria(Action<ContactRoleSearch> initializer) { var criteria = this.CreateCriteria(); initializer?.Invoke(criteria); return this; } ISearchRow ISearchAdvanced.GetColumns() { return this.columns; } public ContactRoleSearchRow GetColumns() => this.columns; ISearchRow ISearchAdvanced.CreateColumns() => this.CreateColumns(); public ContactRoleSearchRow CreateColumns() { if (this.columns == null) this.columns = new ContactRoleSearchRow(); return this.columns; } ISearchAdvanced<ContactRoleSearch, ContactRoleSearchRow> ISearchAdvanced<ContactRoleSearch, ContactRoleSearchRow>.CreateColumns(Action<ContactRoleSearchRow> initializer) => this.CreateColumns(initializer); public ContactRoleSearchAdvanced CreateColumns(Action<ContactRoleSearchRow> initializer) { var columns = this.CreateColumns(); initializer?.Invoke(columns); return this; } } }
36.351852
160
0.688742
[ "Apache-2.0" ]
cloudextend/contrib-netsuite-servicemgr
Celigo.SuiteTalk/src/SuiteTalk/Generated/ContactRoleSearchAdvanced.gen.cs
1,963
C#
/* * Copyright 2010-2013 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. */ using System; using System.Collections.Generic; using System.Text; using Amazon.Auth.AccessControlPolicy.Internal; namespace Amazon.Auth.AccessControlPolicy { /// <summary> /// An AWS access control policy is a object that acts as a container for one or /// more statements, which specify fine grained rules for allowing or denying /// various types of actions from being performed on your AWS resources. /// <para> /// By default, all requests to use your resource coming from anyone but you are /// denied. Access control polices can override that by allowing different types /// of access to your resources, or by explicitly denying different types of /// access. /// </para> /// <para> /// Each statement in an AWS access control policy takes the form: /// "A has permission to do B to C where D applies". /// <list type="definition"> /// <item> /// <term>A is the prinicpal</term> /// <description>The AWS account that is making a request to /// access or modify one of your AWS resources. /// </description> /// </item> /// <item> /// <term>B is the action</term> /// <description>the way in which your AWS resource is being accessed or modified, such /// as sending a message to an Amazon SQS queue, or storing an object in an Amazon S3 bucket. /// </description> /// </item> /// <item> /// <term>C is the resource</term> /// <description>your AWS entity that the principal wants to access, such /// as an Amazon SQS queue, or an object stored in Amazon S3. /// </description> /// </item> /// <item> /// <term>D is the set of conditions</term> /// <description>optional constraints that specify when to allow or deny /// access for the principal to access your resource. Many expressive conditions are available, /// some specific to each service. For example you can use date conditions to allow access to /// your resources only after or before a specific time. /// </description> /// </item> /// </list> /// </para> /// <para> /// Note that an AWS access control policy should not be confused with the /// similarly named "POST form policy" concept used in Amazon S3. /// </para> /// </summary> public class Policy { /// <summary> /// The default policy version /// </summary> private const string DEFAULT_POLICY_VERSION = "2012-10-17"; private string id; private string version = DEFAULT_POLICY_VERSION; private IList<Statement> statements = new List<Statement>(); /// <summary> /// Constructs an empty AWS access control policy ready to be populated with /// statements. /// </summary> public Policy() { } /// <summary> /// Constructs a new AWS access control policy with the specified policy ID. /// The policy ID is a user specified string that serves to help developers /// keep track of multiple polices. Policy IDs are often used as a human /// readable name for a policy. /// </summary> /// <param name="id">The policy ID for the new policy object. Policy IDs serve to /// help developers keep track of multiple policies, and are often /// used to give the policy a meaningful, human readable name.</param> public Policy(string id) { this.id = id; } /// <summary> /// Constructs a new AWS access control policy with the specified policy ID /// and collection of statements. The policy ID is a user specified string /// that serves to help developers keep track of multiple polices. Policy IDs /// are often used as a human readable name for a policy. /// </summary> /// <param name="id">The policy ID for the new policy object. Policy IDs serve to /// help developers keep track of multiple policies, and are often /// used to give the policy a meaningful, human readable name.</param> /// <param name="statements">The statements to include in the new policy.</param> public Policy(string id, IList<Statement> statements) { this.statements = statements; } /// <summary> /// Gets and Sets the policy ID for this policy. Policy IDs serve to help /// developers keep track of multiple policies, and are often used as human /// readable name for a policy. /// </summary> public string Id { get { return id; } set { this.id = value; } } /// <summary> /// Sets the policy ID for this policy and returns the updated policy so that /// multiple calls can be chained together. /// <para> /// Policy IDs serve to help developers keep track of multiple policies, and /// are often used as human readable name for a policy. /// </para> /// </summary> /// <paraparam name="id">The polich ID for this policy</paraparam> /// <returns>this instance</returns> [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")] public Policy WithId(string id) { Id = id; return this; } /// <summary> /// Gets the version of this AWS policy. /// </summary> public string Version { get { return version; } internal set { this.version = value; } } /// <summary> /// Gets and Sets the collection of statements contained by this policy. Individual /// statements in a policy are what specify the rules that enable or disable /// access to your AWS resources. /// </summary> public IList<Statement> Statements { get { return statements; } set { this.statements = value; } } /// <summary> /// Sets the collection of statements contained by this policy and returns /// this policy object so that additional method calls can be chained /// together. /// <para> /// Individual statements in a policy are what specify the rules that enable /// or disable access to your AWS resources. /// </para> /// </summary> /// <param name="statements">The collection of statements included in this policy.</param> /// <returns>this instance</returns> [Obsolete("The With methods are obsolete and will be removed in version 2 of the AWS SDK for .NET. See http://aws.amazon.com/sdkfornet/#version2 for more information.")] public Policy WithStatements(params Statement[] statements) { if (this.Statements == null) { this.Statements = new List<Statement>(); } foreach (Statement element in statements) { this.Statements.Add(element); } return this; } /// <summary> /// Returns a JSON string representation of this AWS access control policy, /// suitable to be sent to an AWS service as part of a request to set an /// access control policy. /// </summary> /// <returns>A JSON string representation of this AWS access control policy.</returns> public string ToJson() { return ToJson(true); } /// <summary> /// Returns a JSON string representation of this AWS access control policy, /// suitable to be sent to an AWS service as part of a request to set an /// access control policy. /// </summary> /// <param name="prettyPrint">Toggle pretty print for the generated JSON document</param> /// <returns>A JSON string representation of this AWS access control policy.</returns> public string ToJson(bool prettyPrint) { return new JsonPolicyWriter().WritePolicyToString(prettyPrint, this); } /// <summary> /// Parses a JSON document of a policy and creates a Policy object. /// </summary> /// <param name="json">JSON document of a policy.</param> /// <returns></returns> public static Policy FromJson(string json) { JsonPolicyReader reader = new JsonPolicyReader(); return reader.ReadJsonStringToPolicy(json); } } }
39.410569
177
0.58164
[ "Apache-2.0" ]
jdluzen/aws-sdk-net-android
AWSSDK/Amazon.Auth/AccessControlPolicy/Policy.cs
9,695
C#
using Codeable.Foundation.Common; using Stencil.Common; using Stencil.Domain; using Stencil.Primary.Business.Index; using Stencil.Primary.Health; using sdk = Stencil.SDK.Models; using System; using System.Collections.Generic; using System.Linq; using Codeable.Foundation.Core; namespace Stencil.Primary.Synchronization.Implementation { public partial class LineItemSynchronizer : SynchronizerBase<Guid>, ILineItemSynchronizer { public LineItemSynchronizer(IFoundation foundation) : base(foundation, "LineItemSynchronizer") { } public override int Priority { get { return 40; } } public override void PerformSynchronizationForItem(Guid primaryKey) { base.ExecuteMethod("PerformSynchronizationForItem", delegate () { LineItem domainModel = this.API.Direct.LineItems.GetById(primaryKey); if (domainModel != null) { Action<Guid, bool, DateTime, string> synchronizationUpdateMethod = this.API.Direct.LineItems.SynchronizationUpdate; if(this.API.Integration.SettingsResolver.IsHydrate()) { synchronizationUpdateMethod = this.API.Direct.LineItems.SynchronizationHydrateUpdate; } DateTime syncDate = DateTime.UtcNow; if (domainModel.sync_invalid_utc.HasValue) { syncDate = domainModel.sync_invalid_utc.Value; } try { sdk.LineItem sdkModel = domainModel.ToSDKModel(); this.HydrateSDKModelComputed(domainModel, sdkModel); this.HydrateSDKModel(domainModel, sdkModel); if (domainModel.deleted_utc.HasValue) { this.API.Index.LineItems.DeleteDocument(sdkModel); synchronizationUpdateMethod(domainModel.lineitem_id, true, syncDate, null); } else { IndexResult result = this.API.Index.LineItems.UpdateDocument(sdkModel); if (result.success) { synchronizationUpdateMethod(domainModel.lineitem_id, true, syncDate, result.ToString()); } else { throw new Exception(result.ToString()); } } } catch (Exception ex) { this.IFoundation.LogError(ex, "PerformSynchronizationForItem"); HealthReporter.Current.UpdateMetric(HealthTrackType.Each, string.Format(HealthReporter.INDEXER_ERROR_SYNC, this.EntityName), 0, 1); synchronizationUpdateMethod(primaryKey, false, syncDate, CoreUtility.FormatException(ex)); } } }); } public override int PerformSynchronization(string requestedAgentName) { return base.ExecuteFunction("PerformSynchronization", delegate () { string agentName = requestedAgentName; if(string.IsNullOrEmpty(agentName)) { agentName = this.AgentName; } List<Guid?> invalidItems = new List<Guid?>(); if(this.API.Integration.SettingsResolver.IsHydrate()) { invalidItems = this.API.Direct.LineItems.SynchronizationHydrateGetInvalid(CommonAssumptions.INDEX_RETRY_THRESHOLD_SECONDS, agentName); } else { invalidItems = this.API.Direct.LineItems.SynchronizationGetInvalid(CommonAssumptions.INDEX_RETRY_THRESHOLD_SECONDS, agentName); } foreach (Guid? item in invalidItems) { this.PerformSynchronizationForItem(item.GetValueOrDefault()); } return invalidItems.Count; }); } /// <summary> /// Computed and Calculated Aggs, Typically Generated /// </summary> protected void HydrateSDKModelComputed(LineItem domainModel, sdk.LineItem sdkModel) { } partial void HydrateSDKModel(LineItem domainModel, sdk.LineItem sdkModel); } }
40.084034
155
0.529979
[ "MIT" ]
DanMasterson1/stencil
Source/Stencil.Server/Stencil.Primary/Business/Synchronization/Implementation/LineItemSynchronizer_Core.cs
4,770
C#
namespace mvcSearch.Models { public class Product { public int OrderLineId { get; set; } public string Name { get; set; } public double Price { get; set; } public int Quantity { get; set; } } }
23.8
44
0.571429
[ "MIT" ]
JamesRandall/Simple-Paging-Grid
examples/mvcSearch/mvcSearch/Models/Product.cs
240
C#
using System; using System.Collections.Generic; using JetBrains.Annotations; using JsonApiDotNetCore.Configuration; using JsonApiDotNetCore.Queries.Expressions; using JsonApiDotNetCore.Resources.Annotations; namespace JsonApiDotNetCore.Queries.Internal.Parsing { [PublicAPI] public class QueryStringParameterScopeParser : QueryExpressionParser { private readonly FieldChainRequirements _chainRequirements; private readonly Action<ResourceFieldAttribute, ResourceContext, string> _validateSingleFieldCallback; private ResourceContext _resourceContextInScope; public QueryStringParameterScopeParser(IResourceContextProvider resourceContextProvider, FieldChainRequirements chainRequirements, Action<ResourceFieldAttribute, ResourceContext, string> validateSingleFieldCallback = null) : base(resourceContextProvider) { _chainRequirements = chainRequirements; _validateSingleFieldCallback = validateSingleFieldCallback; } public QueryStringParameterScopeExpression Parse(string source, ResourceContext resourceContextInScope) { ArgumentGuard.NotNull(resourceContextInScope, nameof(resourceContextInScope)); _resourceContextInScope = resourceContextInScope; Tokenize(source); QueryStringParameterScopeExpression expression = ParseQueryStringParameterScope(); AssertTokenStackIsEmpty(); return expression; } protected QueryStringParameterScopeExpression ParseQueryStringParameterScope() { if (!TokenStack.TryPop(out Token token) || token.Kind != TokenKind.Text) { throw new QueryParseException("Parameter name expected."); } var name = new LiteralConstantExpression(token.Value); ResourceFieldChainExpression scope = null; if (TokenStack.TryPeek(out Token nextToken) && nextToken.Kind == TokenKind.OpenBracket) { TokenStack.Pop(); scope = ParseFieldChain(_chainRequirements, null); EatSingleCharacterToken(TokenKind.CloseBracket); } return new QueryStringParameterScopeExpression(name, scope); } protected override IReadOnlyCollection<ResourceFieldAttribute> OnResolveFieldChain(string path, FieldChainRequirements chainRequirements) { if (chainRequirements == FieldChainRequirements.EndsInToMany) { // The mismatch here (ends-in-to-many being interpreted as entire-chain-must-be-to-many) is intentional. return ChainResolver.ResolveToManyChain(_resourceContextInScope, path, _validateSingleFieldCallback); } if (chainRequirements == FieldChainRequirements.IsRelationship) { return ChainResolver.ResolveRelationshipChain(_resourceContextInScope, path, _validateSingleFieldCallback); } throw new InvalidOperationException($"Unexpected combination of chain requirement flags '{chainRequirements}'."); } } }
39.7
145
0.701826
[ "MIT" ]
3volutionsAG/JsonApiDotNetCore
src/JsonApiDotNetCore/Queries/Internal/Parsing/QueryStringParameterScopeParser.cs
3,176
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("XsdIncludeResolver")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("McCreary, Veselka, Bragg & Allen, P.C.")] [assembly: AssemblyProduct("XsdIncludeResolver - github.com/mvbalaw/XsdIncludeResolver")] [assembly: AssemblyCopyright("Copyright (c) McCreary, Veselka, Bragg & Allen, P.C. 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e0209e14-b9ae-4e58-a396-13283f78446a")] // 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")]
41.27027
90
0.747872
[ "MIT" ]
mvbalaw/XsdIncludeResolver
src/XsdIncludeResolver/Properties/AssemblyInfo.cs
1,529
C#
using FluentNHibernate.Mapping; using VocaDb.Model.Domain.Artists; namespace VocaDb.Model.Mapping.Artists { public class ArtistPictureFileMap : ClassMap<ArtistPictureFile> { public ArtistPictureFileMap() { Id(m => m.Id); Map(m => m.Created).Not.Nullable(); Map(m => m.Mime).Length(32).Not.Nullable(); Map(m => m.Name).Length(200).Not.Nullable(); References(m => m.Artist).Not.Nullable(); References(m => m.Author).Not.Nullable(); } } }
19.583333
66
0.674468
[ "MIT" ]
cazzar/VocaDbTagger
VocaDbModel/Mapping/Artists/ArtistPictureFileMap.cs
472
C#
// <auto-generated /> using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using TravelAPI.Models; namespace TravelAPI.Migrations { [DbContext(typeof(TravelAPIContext))] [Migration("20210520222611_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("TravelAPI.Models.Location", b => { b.Property<int>("LocationId") .ValueGeneratedOnAdd(); b.Property<string>("City"); b.Property<string>("Country"); b.Property<string>("Name"); b.Property<int>("Rating"); b.Property<string>("Review"); b.HasKey("LocationId"); b.ToTable("Locations"); }); #pragma warning restore 612, 618 } } }
29
75
0.586991
[ "MIT" ]
CommaderDavid/TravelAPI.Solution
TravelAPI/Migrations/20210520222611_Initial.Designer.cs
1,278
C#
#region Copyright notice and license // Copyright 2019 The gRPC Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #endregion using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Google.Protobuf; using Grpc.AspNetCore.FunctionalTests.Infrastructure; using Grpc.Core; using Grpc.Net.Client; using Grpc.Tests.Shared; using Microsoft.Extensions.Logging; using NUnit.Framework; using Race; using Streaming; using Unimplemented; namespace Grpc.AspNetCore.FunctionalTests.Client { [TestFixture] public class StreamingTests : FunctionalTestBase { [Test] public async Task DuplexStream_SendLargeFileBatchedAndRecieveLargeFileBatched_Success() { // Arrange var data = CreateTestData(1024 * 1024 * 1); // 1 MB var client = new StreamService.StreamServiceClient(Channel); // Act var call = client.BufferAllData(); var sent = 0; while (sent < data.Length) { const int BatchSize = 1024 * 64; // 64 KB var writeCount = Math.Min(data.Length - sent, BatchSize); await call.RequestStream.WriteAsync(new DataMessage { Data = ByteString.CopyFrom(data, sent, writeCount) }).DefaultTimeout(); sent += writeCount; Logger.LogInformation($"Sent {sent} bytes"); } await call.RequestStream.CompleteAsync().DefaultTimeout(); var ms = new MemoryStream(); while (await call.ResponseStream.MoveNext(CancellationToken.None).DefaultTimeout()) { ms.Write(call.ResponseStream.Current.Data.Span); Logger.LogInformation($"Received {ms.Length} bytes"); } // Assert CollectionAssert.AreEqual(data, ms.ToArray()); } [Test] public async Task ClientStream_SendLargeFileBatched_Success() { // Arrange var total = 1024 * 1024 * 64; // 64 MB var data = CreateTestData(1024 * 64); // 64 KB var client = new StreamService.StreamServiceClient(Channel); var dataMessage = new DataMessage { Data = ByteString.CopyFrom(data) }; // Act var call = client.ClientStreamedData(); var sent = 0; while (sent < total) { var writeCount = Math.Min(total - sent, data.Length); DataMessage m; if (writeCount == data.Length) { m = dataMessage; } else { m = new DataMessage { Data = ByteString.CopyFrom(data, 0, writeCount) }; } await call.RequestStream.WriteAsync(m).DefaultTimeout(); sent += writeCount; } await call.RequestStream.CompleteAsync().DefaultTimeout(); var response = await call.ResponseAsync.DefaultTimeout(); // Assert Assert.AreEqual(total, response.Size); } [Test] public async Task DuplexStream_SimultaneousSendAndReceive_Success() { var client = new Racer.RacerClient(Channel); TimeSpan raceDuration = TimeSpan.FromSeconds(1); var headers = new Metadata { new Metadata.Entry("race-duration", raceDuration.ToString()) }; using (var call = client.ReadySetGo(new CallOptions(headers))) { // Read incoming messages in a background task RaceMessage? lastMessageReceived = null; var readTask = Task.Run(async () => { while (await call.ResponseStream.MoveNext().DefaultTimeout()) { lastMessageReceived = call.ResponseStream.Current; } }); // Write outgoing messages until timer is complete var sw = Stopwatch.StartNew(); var sent = 0; while (sw.Elapsed < raceDuration) { await call.RequestStream.WriteAsync(new RaceMessage { Count = ++sent }).DefaultTimeout(); } // Finish call and report results await call.RequestStream.CompleteAsync().DefaultTimeout(); await readTask.DefaultTimeout(); Assert.Greater(sent, 0); Assert.Greater(lastMessageReceived?.Count ?? 0, 0); } } [Test] public async Task DuplexStream_SendToUnimplementedMethod_ThrowError() { SetExpectedErrorsFilter(writeContext => { if (writeContext.LoggerName == "Grpc.Net.Client.Internal.GrpcCall" && writeContext.EventId.Name == "ErrorSendingMessage" && writeContext.State.ToString() == "Error sending message.") { return true; } if (writeContext.LoggerName == "Grpc.Net.Client.Internal.HttpContentClientStreamWriter" && writeContext.EventId.Name == "WriteMessageError" && writeContext.Message == "Error writing message.") { return true; } return false; }); // Arrange var client = new UnimplementedService.UnimplementedServiceClient(Channel); // Act var call = client.DuplexData(); await ExceptionAssert.ThrowsAsync<Exception>(async () => { await call.RequestStream.WriteAsync(new UnimplementeDataMessage { Data = ByteString.CopyFrom(CreateTestData(1024 * 64)) }).DefaultTimeout(); await call.RequestStream.WriteAsync(new UnimplementeDataMessage { Data = ByteString.CopyFrom(CreateTestData(1024 * 64)) }).DefaultTimeout(); }); await call.ResponseHeadersAsync.DefaultTimeout(); // Assert Assert.AreEqual(StatusCode.Unimplemented, call.GetStatus().StatusCode); } [Test] public async Task DuplexStream_SendToUnimplementedMethodAfterResponseReceived_MoveNextThrowsError() { // Arrange var client = new UnimplementedService.UnimplementedServiceClient(Channel); // This is in a loop to verify a hang that existed in HttpClient when the request is not read to completion // https://github.com/dotnet/corefx/issues/39586 for (var i = 0; i < 100; i++) { Logger.LogInformation("Iteration " + i); // Act var call = client.DuplexData(); // Response will only be headers so the call is "done" on the server side await call.ResponseHeadersAsync.DefaultTimeout(); await call.RequestStream.CompleteAsync().DefaultTimeout(); var ex = await ExceptionAssert.ThrowsAsync<RpcException>(() => call.ResponseStream.MoveNext()).DefaultTimeout(); var status = call.GetStatus(); // Assert Assert.AreEqual(StatusCode.Unimplemented, ex.StatusCode); Assert.AreEqual(StatusCode.Unimplemented, status.StatusCode); } } const int Size64MB = 1024 * 1024 * 64; const int Size1MB = 1024 * 1024 * 1; const int Size64KB = 1024 * 64; [TestCase(0, 0)] [TestCase(1, 1)] [TestCase(2, 1)] [TestCase(3, 2)] [TestCase(Size64MB, Size64KB)] [TestCase(Size64MB, Size1MB)] public async Task DuplexStreaming_SimultaniousSendAndReceive_Success(int total, int batchSize) { // Arrange var data = CreateTestData(batchSize); var client = new StreamService.StreamServiceClient(Channel); var (sent, received) = await EchoData(total, data, client).DefaultTimeout(); // Assert Assert.AreEqual(sent, total); Assert.AreEqual(received, total); } private async Task<(int sent, int received)> EchoData(int total, byte[] data, StreamService.StreamServiceClient client) { var sent = 0; var received = 0; var call = client.EchoAllData(); var readTask = Task.Run(async () => { await foreach (var message in call.ResponseStream.ReadAllAsync().DefaultTimeout()) { received += message.Data.Length; Logger.LogInformation($"Received {sent} bytes"); } }); while (sent < total) { var writeCount = Math.Min(total - sent, data.Length); await call.RequestStream.WriteAsync(new DataMessage { Data = ByteString.CopyFrom(data, 0, writeCount) }).DefaultTimeout(); sent += writeCount; Logger.LogInformation($"Sent {sent} bytes"); } await call.RequestStream.CompleteAsync().DefaultTimeout(); await readTask.DefaultTimeout(); return (sent, received); } [TestCase(1)] [TestCase(5)] [TestCase(20)] public async Task DuplexStreaming_SimultaniousSendAndReceiveInParallel_Success(int tasks) { // Arrange const int total = 1024 * 1024 * 1; const int batchSize = 1024 * 64; var data = CreateTestData(batchSize); var client = new StreamService.StreamServiceClient(Channel); await TestHelpers.RunParallel(tasks, async taskIndex => { var (sent, received) = await EchoData(total, data, client).DefaultTimeout(); // Assert Assert.AreEqual(sent, total); Assert.AreEqual(received, total); }).DefaultTimeout(); } [Test] public async Task ClientStream_HttpClientWithTimeout_Success() { SetExpectedErrorsFilter(writeContext => { if (writeContext.LoggerName == "Grpc.Net.Client.Internal.GrpcCall" && writeContext.Exception is TaskCanceledException) { return true; } if (writeContext.LoggerName == "Grpc.Net.Client.Internal.GrpcCall" && writeContext.EventId.Name == "WriteMessageError" && writeContext.Exception is InvalidOperationException && writeContext.Exception.Message == "Can't write the message because the call is complete.") { return true; } if (writeContext.LoggerName == TestConstants.ServerCallHandlerTestName) { return true; } return false; }); // Arrange var data = CreateTestData(1024 * 64); // 64 KB var httpClient = Fixture.CreateClient(); httpClient.Timeout = TimeSpan.FromSeconds(0.5); var channel = GrpcChannel.ForAddress(httpClient.BaseAddress!, new GrpcChannelOptions { HttpClient = httpClient, LoggerFactory = LoggerFactory }); var client = new StreamService.StreamServiceClient(channel); var dataMessage = new DataMessage { Data = ByteString.CopyFrom(data) }; // Act var call = client.ClientStreamedData(); var ex = await ExceptionAssert.ThrowsAsync<RpcException>(async () => { while (true) { await call.RequestStream.WriteAsync(dataMessage).DefaultTimeout(); await Task.Delay(100); } }).DefaultTimeout(); // Assert Assert.AreEqual(StatusCode.Cancelled, ex.StatusCode); Assert.AreEqual(StatusCode.Cancelled, call.GetStatus().StatusCode); AssertHasLog(LogLevel.Information, "GrpcStatusError", "Call failed with gRPC error status. Status code: 'Cancelled', Message: ''."); } [Test] public async Task DuplexStreaming_ParallelCallsFromOneChannel_Success() { async Task UnaryDeadlineExceeded(IAsyncStreamReader<DataMessage> requestStream, IServerStreamWriter<DataMessage> responseStream, ServerCallContext context) { await foreach (var message in requestStream.ReadAllAsync()) { await responseStream.WriteAsync(message); } } // Arrange var method = Fixture.DynamicGrpc.AddDuplexStreamingMethod<DataMessage, DataMessage>(UnaryDeadlineExceeded); var channel = CreateChannel(); var client = TestClientFactory.Create(channel, method); // Act var call1 = client.DuplexStreamingCall(); var call2 = client.DuplexStreamingCall(); await call1.RequestStream.WriteAsync(new DataMessage() { Data = ByteString.CopyFrom(new byte[1]) }).DefaultTimeout(); await call2.RequestStream.WriteAsync(new DataMessage() { Data = ByteString.CopyFrom(new byte[2]) }).DefaultTimeout(); // Assert Assert.IsTrue(await call1.ResponseStream.MoveNext().DefaultTimeout()); Assert.IsTrue(await call2.ResponseStream.MoveNext().DefaultTimeout()); Assert.AreEqual(1, call1.ResponseStream.Current.Data.Length); Assert.AreEqual(2, call2.ResponseStream.Current.Data.Length); await call1.RequestStream.CompleteAsync().DefaultTimeout(); await call2.RequestStream.CompleteAsync().DefaultTimeout(); Assert.IsFalse(await call1.ResponseStream.MoveNext().DefaultTimeout()); Assert.IsFalse(await call2.ResponseStream.MoveNext().DefaultTimeout()); } [Test] public async Task ServerStreaming_GetTrailersAndStatus_Success() { async Task ServerStreamingWithTrailers(DataMessage request, IServerStreamWriter<DataMessage> responseStream, ServerCallContext context) { await responseStream.WriteAsync(new DataMessage()); context.ResponseTrailers.Add("my-trailer", "value"); } // Arrange var method = Fixture.DynamicGrpc.AddServerStreamingMethod<DataMessage, DataMessage>(ServerStreamingWithTrailers); var channel = CreateChannel(); var client = TestClientFactory.Create(channel, method); // Act var call = client.ServerStreamingCall(new DataMessage()); // Assert Assert.IsTrue(await call.ResponseStream.MoveNext().DefaultTimeout()); Assert.AreEqual(0, call.ResponseStream.Current.Data.Length); Assert.IsFalse(await call.ResponseStream.MoveNext().DefaultTimeout()); var trailers = call.GetTrailers(); Assert.AreEqual(1, trailers.Count); Assert.AreEqual("value", trailers.GetValue("my-trailer")); Assert.AreEqual(StatusCode.OK, call.GetStatus().StatusCode); } [Test] public async Task ServerStreaming_ThrowErrorWithTrailers_TrailersReturnedToClient() { async Task ServerStreamingWithTrailers(DataMessage request, IServerStreamWriter<DataMessage> responseStream, ServerCallContext context) { await context.WriteResponseHeadersAsync(new Metadata { { "Key", "Value1" }, { "Key", "Value2" }, }); await responseStream.WriteAsync(new DataMessage()); await responseStream.WriteAsync(new DataMessage()); await responseStream.WriteAsync(new DataMessage()); await responseStream.WriteAsync(new DataMessage()); context.ResponseTrailers.Add("Key", "ResponseTrailers"); throw new RpcException(new Status(StatusCode.Aborted, "Message"), new Metadata { { "Key", "RpcException" } }); } // Arrange var method = Fixture.DynamicGrpc.AddServerStreamingMethod<DataMessage, DataMessage>(ServerStreamingWithTrailers); var channel = CreateChannel(); var client = TestClientFactory.Create(channel, method); // Act var call = client.ServerStreamingCall(new DataMessage()); // Assert var headers = await call.ResponseHeadersAsync.DefaultTimeout(); var keyHeaders = headers.GetAll("key").ToList(); Assert.AreEqual("key", keyHeaders[0].Key); Assert.AreEqual("Value1", keyHeaders[0].Value); Assert.AreEqual("key", keyHeaders[1].Key); Assert.AreEqual("Value2", keyHeaders[1].Value); Assert.IsTrue(await call.ResponseStream.MoveNext().DefaultTimeout()); Assert.IsTrue(await call.ResponseStream.MoveNext().DefaultTimeout()); Assert.IsTrue(await call.ResponseStream.MoveNext().DefaultTimeout()); Assert.IsTrue(await call.ResponseStream.MoveNext().DefaultTimeout()); var ex = await ExceptionAssert.ThrowsAsync<RpcException>(() => call.ResponseStream.MoveNext()).DefaultTimeout(); var trailers = call.GetTrailers(); Assert.AreEqual(2, trailers.Count); Assert.AreEqual("key", trailers[0].Key); Assert.AreEqual("ResponseTrailers", trailers[0].Value); Assert.AreEqual("key", trailers[1].Key); Assert.AreEqual("RpcException", trailers[1].Value); Assert.AreEqual(StatusCode.Aborted, call.GetStatus().StatusCode); Assert.AreEqual("Message", call.GetStatus().Detail); } [Test] public async Task DuplexStreaming_CancelResponseMoveNext_CancellationSentToServer() { var tcs = new TaskCompletionSource<object?>(TaskCreationOptions.RunContinuationsAsynchronously); async Task DuplexStreamingWithCancellation(IAsyncStreamReader<DataMessage> requestStream, IServerStreamWriter<DataMessage> responseStream, ServerCallContext context) { try { await foreach (var message in requestStream.ReadAllAsync()) { await responseStream.WriteAsync(message); } } catch (Exception ex) { tcs.TrySetException(ex); } } // Arrange var method = Fixture.DynamicGrpc.AddDuplexStreamingMethod<DataMessage, DataMessage>(DuplexStreamingWithCancellation); var channel = CreateChannel(); var client = TestClientFactory.Create(channel, method); // Act var call = client.DuplexStreamingCall(); await call.RequestStream.WriteAsync(new DataMessage { Data = ByteString.CopyFrom(Encoding.UTF8.GetBytes("Hello world")) }); await call.ResponseStream.MoveNext(); var cts = new CancellationTokenSource(); var task = call.ResponseStream.MoveNext(cts.Token); cts.Cancel(); // Assert var clientEx = await ExceptionAssert.ThrowsAsync<RpcException>(() => task); Assert.AreEqual(StatusCode.Cancelled, clientEx.StatusCode); Assert.AreEqual("Call canceled by the client.", clientEx.Status.Detail); await ExceptionAssert.ThrowsAsync<IOException>(() => tcs.Task); } private static byte[] CreateTestData(int size) { var data = new byte[size]; for (var i = 0; i < data.Length; i++) { data[i] = (byte)i; // Will loop around back to zero } return data; } #if NET5_0 [Test] public Task MaxConcurrentStreams_StartConcurrently_AdditionalConnectionsCreated() { return RunConcurrentStreams(writeResponseHeaders: false); } [Test] public Task MaxConcurrentStreams_StartIndividually_AdditionalConnectionsCreated() { return RunConcurrentStreams(writeResponseHeaders: true); } private async Task RunConcurrentStreams(bool writeResponseHeaders) { var streamCount = 201; var count = 0; var tcs = new TaskCompletionSource<object?>(TaskCreationOptions.RunContinuationsAsynchronously); async Task WaitForAllStreams(IAsyncStreamReader<DataMessage> requestStream, IServerStreamWriter<DataMessage> responseStream, ServerCallContext context) { Interlocked.Increment(ref count); if (writeResponseHeaders) { await context.WriteResponseHeadersAsync(new Metadata()); } if (count >= streamCount) { tcs.TrySetResult(null); } await tcs.Task; } // Arrange var method = Fixture.DynamicGrpc.AddDuplexStreamingMethod<DataMessage, DataMessage>(WaitForAllStreams); var channel = GrpcChannel.ForAddress(Fixture.GetUrl(TestServerEndpointName.Http2)); var client = TestClientFactory.Create(channel, method); var calls = new AsyncDuplexStreamingCall<DataMessage, DataMessage>[streamCount]; try { // Act for (var i = 0; i < calls.Length; i++) { var call = client.DuplexStreamingCall(); calls[i] = call; if (writeResponseHeaders) { await call.ResponseHeadersAsync.DefaultTimeout(); } } // Assert await Task.WhenAll(calls.Select(c => c.ResponseHeadersAsync)).DefaultTimeout(); } catch (Exception ex) { throw new Exception($"Received {count} of {streamCount} on the server.", ex); } finally { for (var i = 0; i < calls.Length; i++) { calls[i].Dispose(); } } } #endif } }
36.424847
177
0.567308
[ "Apache-2.0" ]
MCLCODE/grpc-dotnet
test/FunctionalTests/Client/StreamingTests.cs
23,751
C#
using System; using System.Data.Entity.ModelConfiguration; using Kore.Data; using Kore.Data.EntityFramework; namespace Kore.Web.ContentManagement.Areas.Admin.ContentBlocks.Domain { public class ContentBlock : IEntity { public Guid Id { get; set; } public string BlockName { get; set; } public string BlockType { get; set; } public string Title { get; set; } public Guid ZoneId { get; set; } public int Order { get; set; } public bool IsEnabled { get; set; } public string BlockValues { get; set; } public string CustomTemplatePath { get; set; } public Guid? PageId { get; set; } #region IEntity Members public object[] KeyValues { get { return new object[] { Id }; } } #endregion IEntity Members } public class ContentBlockMap : EntityTypeConfiguration<ContentBlock>, IEntityTypeConfiguration { public ContentBlockMap() { ToTable(CmsConstants.Tables.ContentBlocks); HasKey(x => x.Id); Property(x => x.BlockName).IsRequired().HasMaxLength(255).IsUnicode(true); Property(x => x.BlockType).IsRequired().HasMaxLength(1024).IsUnicode(false); Property(x => x.Title).IsRequired().HasMaxLength(255).IsUnicode(true); Property(x => x.ZoneId).IsRequired(); Property(x => x.Order).IsRequired(); Property(x => x.IsEnabled).IsRequired(); Property(x => x.BlockValues).IsMaxLength().IsUnicode(true); Property(x => x.CustomTemplatePath).HasMaxLength(255).IsUnicode(true); //Property(x => x.CultureCode).HasMaxLength(10).HasColumnType("varchar"); } #region IEntityTypeConfiguration Members public bool IsEnabled { get { return true; } } #endregion IEntityTypeConfiguration Members } }
30.621212
99
0.585849
[ "MIT" ]
artinite21/KoreCMS
Kore.Web.ContentManagement/Areas/Admin/ContentBlocks/Domain/ContentBlock.cs
2,023
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 codeartifact-2018-09-22.normal.json service model. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Net; using System.Text; using System.Xml.Serialization; using Amazon.CodeArtifact.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.CodeArtifact.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for PutDomainPermissionsPolicy operation /// </summary> public class PutDomainPermissionsPolicyResponseUnmarshaller : JsonResponseUnmarshaller { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { PutDomainPermissionsPolicyResponse response = new PutDomainPermissionsPolicyResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("policy", targetDepth)) { var unmarshaller = ResourcePolicyUnmarshaller.Instance; response.Policy = unmarshaller.Unmarshall(context); continue; } } return response; } /// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDeniedException")) { return AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException")) { return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalServerException")) { return InternalServerExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceQuotaExceededException")) { return ServiceQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ThrottlingException")) { return ThrottlingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ValidationException")) { return ValidationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } } return new AmazonCodeArtifactException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode); } private static PutDomainPermissionsPolicyResponseUnmarshaller _instance = new PutDomainPermissionsPolicyResponseUnmarshaller(); internal static PutDomainPermissionsPolicyResponseUnmarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static PutDomainPermissionsPolicyResponseUnmarshaller Instance { get { return _instance; } } } }
42.955224
196
0.628388
[ "Apache-2.0" ]
philasmar/aws-sdk-net
sdk/src/Services/CodeArtifact/Generated/Model/Internal/MarshallTransformations/PutDomainPermissionsPolicyResponseUnmarshaller.cs
5,756
C#
using AngleSharp.Dom; using Microsoft.AspNetCore.Components.Web; namespace KristofferStrube.Blazor.SVGEditor { public class Circle : Shape { public Circle(IElement element, SVG svg) : base(element, svg) { } public override Type Editor => typeof(CircleEditor); public double cx { get { return (Element.GetAttribute("cx") ?? "0").ParseAsDouble(); } set { Element.SetAttribute("cx", value.AsString()); Changed.Invoke(this); } } public double cy { get { return (Element.GetAttribute("cy") ?? "0").ParseAsDouble(); } set { Element.SetAttribute("cy", value.AsString()); Changed.Invoke(this); } } public double r { get { return (Element.GetAttribute("r") ?? "0").ParseAsDouble(); } set { Element.SetAttribute("r", value.AsString()); Changed.Invoke(this); } } public override void HandleMouseMove(MouseEventArgs eventArgs) { var pos = SVG.LocalDetransform((eventArgs.OffsetX, eventArgs.OffsetY)); switch (SVG.EditMode) { case EditMode.Add: r = Math.Sqrt(Math.Pow(cx-pos.x,2) + Math.Pow(cy - pos.y, 2)); break; case EditMode.Move: var diff = (x: pos.x - SVG.MovePanner.x, y: pos.y - SVG.MovePanner.y); cx += diff.x; cy += diff.y; break; case EditMode.MoveAnchor: if (SVG.CurrentAnchor == null) { SVG.CurrentAnchor = 0; } switch (SVG.CurrentAnchor) { case 0: case 1: r = Math.Abs(pos.x - cx); break; case 2: case 3: r = Math.Abs(pos.y - cy); break; } break; } } public override void HandleMouseUp(MouseEventArgs eventArgs) { switch (SVG.EditMode) { case EditMode.Move or EditMode.MoveAnchor or EditMode.Add: SVG.EditMode = EditMode.None; break; } } public override void HandleMouseOut(MouseEventArgs eventArgs) { } public static void AddNew(SVG SVG) { var element = SVG.Document.CreateElement("CIRCLE"); var circle = new Circle(element, SVG); circle.Changed = SVG.UpdateInput; circle.Stroke = "black"; circle.StrokeWidth = "1"; circle.Fill = "lightgrey"; SVG.EditMode = EditMode.Add; var startPos = SVG.LocalDetransform((SVG.LastRightClick.x, SVG.LastRightClick.y)); (circle.cx, circle.cy) = startPos; SVG.SelectedElements.Clear(); SVG.SelectedElements.Add(circle); SVG.AddElement(circle); } public override void Complete() { } } }
33.081633
94
0.475324
[ "MIT" ]
KristofferStrube/Blazor.SVGEditor
src/KristofferStrube.Blazor.SVGEditor/Circle.cs
3,244
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Playnite.SDK.Models; using Microsoft.Win32; using System.IO; using Playnite.Models; namespace Playnite.Providers.Uplay { public class UplayLibrary : IUplayLibrary { public GameTask GetGamePlayTask(string id) { return new GameTask() { Type = GameTaskType.URL, Path = @"uplay://launch/" + id, IsPrimary = true, IsBuiltIn = true }; } public List<Game> GetInstalledGames() { var games = new List<Game>(); var root = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); var installsKey = root.OpenSubKey(@"SOFTWARE\ubisoft\Launcher\Installs\"); if (installsKey == null) { root = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); installsKey = root.OpenSubKey(@"SOFTWARE\ubisoft\Launcher\Installs\"); if (installsKey == null) { return games; } } foreach (var install in installsKey.GetSubKeyNames()) { var gameData = installsKey.OpenSubKey(install); var installDir = (gameData.GetValue("InstallDir") as string).Replace('/', Path.DirectorySeparatorChar); var newGame = new Game() { ProviderId = install, Provider = Provider.Uplay, Source = Enums.GetEnumDescription(Provider.Uplay), InstallDirectory = installDir, PlayTask = GetGamePlayTask(install), Name = Path.GetFileName(installDir.TrimEnd(Path.DirectorySeparatorChar)) }; games.Add(newGame); } return games; } public GameMetadata UpdateGameWithMetadata(Game game) { var metadata = new GameMetadata(); var program = Programs.GetUnistallProgramsList().FirstOrDefault(a => a.RegistryKeyName == "Uplay Install " + game.ProviderId); if (program == null) { return metadata; } if (!string.IsNullOrEmpty(program.DisplayIcon) && File.Exists(program.DisplayIcon)) { var iconPath = program.DisplayIcon; var iconFile = Path.GetFileName(iconPath); var data = File.ReadAllBytes(iconPath); metadata.Icon = new Database.FileDefinition($"images/uplay/{game.ProviderId}/{iconFile}", iconFile, data); } game.Name = StringExtensions.NormalizeGameName(program.DisplayName); return metadata; } } }
35.034884
139
0.539993
[ "MIT" ]
Slippy2k/Playnite
source/Playnite/Providers/Uplay/UplayLibrary.cs
3,015
C#
#region License // Copyright (c) 2009, ClearCanvas Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of ClearCanvas Inc. nor the names of its contributors // may be used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY // OF SUCH DAMAGE. #endregion // This file is auto-generated by the ClearCanvas.Model.SqlServer2005.CodeGenerator project. namespace ClearCanvas.ImageServer.Model.EntityBrokers { using ClearCanvas.ImageServer.Enterprise; using ClearCanvas.ImageServer.Model.EntityBrokers; public interface IRequestAttributesEntityBroker : IEntityBroker<RequestAttributes, RequestAttributesSelectCriteria, RequestAttributesUpdateColumns> { } }
49.5
148
0.756614
[ "Apache-2.0" ]
econmed/ImageServer20
ImageServer/Model/EntityBrokers/IRequestAttributesEntityBroker.gen.cs
2,079
C#
using System; using System.Collections.Generic; using System.Text; namespace STU.Common.Result { public class Result { public bool Success { get; set; } public string Message { get; set; } } public class Result<T> : Result { public T Data { get; set; } } }
17.111111
43
0.600649
[ "Apache-2.0" ]
jaseaman/thinkchangecrew
STU.Shared/Result/Result.cs
310
C#
using System.Collections.Generic; using System.Linq; using BenchmarkDotNetAnalyser.Benchmarks; using FluentAssertions; using FsCheck; using FsCheck.Xunit; using NSubstitute; using Xunit; namespace BenchmarkDotNetAnalyser.Tests.Unit.Benchmarks { public class BenchmarkInfoExtensionsTests { [Property(Verbose = true)] public bool PreservePinned_UnpinnedTrimmed(PositiveInt count) { var benchmarksCount = count.Get * 2; var benchmarks = Enumerable.Range(1, benchmarksCount) .Select(i => new BenchmarkInfo() {BranchName = $"Benchmark{i + 1}", Pinned = false}) .ToList(); var expected = benchmarks.Take(count.Get).ToList(); var result = benchmarks.PreservePinned(count.Get).ToList(); return result.SequenceEqual(expected); } [Property(Verbose = true)] public bool PreservePinned_InterpolatedPins_UnpinnedTrimmed(PositiveInt count) { var benchmarksCount = count.Get * 2; // ensure it's an even number // preserve even indexed var benchmarks = Enumerable.Range(1, benchmarksCount) .Select(i => new BenchmarkInfo() {BranchName = $"Benchmark{i + 1}", Pinned = i % 2 == 0}) .ToList(); var expected = benchmarks.Where(x => x.Pinned).ToList(); var result = benchmarks.PreservePinned(count.Get).ToList(); return result.SequenceEqual(expected); } [Theory] [InlineData(8, new[] { true, true, true, true, true, true, true, true, true, true}, new[] { true, true, true, true, true, true, true, true, true, true})] [InlineData(2, new[] { true, true, true, true, true, true, true, true, true, true}, new[] { true, true, true, true, true, true, true, true, true, true})] [InlineData(8, new[] { false, false, true, false, true, false, true, false, true, true}, new[] { true, true, true, true, true, false, true, false, true, true})] [InlineData(6, new[] { false, false, true, false, true, false, true, false, true, true}, new[] { true, false, true, false, true, false, true, false, true, true})] [InlineData(4, new[] { false, false, true, false, true, false, true, false, true, true}, new[] { false, false, true, false, true, false, true, false, true, true})] [InlineData(2, new[] { false, false, false, false, false, false, false, false, true, true}, new[] { false, false, false, false, false, false, false, false, true, true})] [InlineData(2, new[] { true, true, false, false, false, false, false, false, false, false}, new[] { true, true, false, false, false, false, false, false, false, false})] [InlineData(2, new[] { false, false, false, false, false, false, false, false, false, true}, new[] { true, false, false, false, false, false, false, false, false, true})] public void PreservePinned_InterpolatedPinBitmap_BenchmarksTrimmed(int runs, bool[] pinned, bool[] survivors) { var benchmarks = pinned .Select((p,i) => new BenchmarkInfo() {BranchName = $"Benchmark{i + 1}", Pinned = p}) .ToList(); var result = benchmarks.PreservePinned(runs).ToList(); var actual = benchmarks.Select(b => result.Contains(b)).ToArray(); actual.SequenceEqual(survivors).Should().BeTrue(); } [Fact] public void PinBest_SameValues_AllPinned() { var benchmarkResults = CreateResults("a", 3, (1.0M).Singleton().ToInfinity()).ToList(); var benchmarks = CreateFromResults(benchmarkResults).Reverse().ToList(); var stats = CreateMockStatsProvider(); var _ = benchmarks.PinBest(stats); benchmarks.All(b => b.Pinned).Should().BeTrue(); } [Fact] public void PinBest_DistinctValues_LowestPinned() { var benchmarkResults = CreateResults("a", 3).ToList(); var benchmarks = CreateFromResults(benchmarkResults).Reverse().ToList(); var stats = CreateMockStatsProvider(); var _ = benchmarks.PinBest(stats); var lowestResult = benchmarkResults.MinBy(br => br.MeanTime.GetValueOrDefault()); var lowest = benchmarks.Single(b => b.Runs.Any(r => r.Results.Contains(lowestResult))); var others = benchmarks.Where(b => b != lowest); lowest.Pinned.Should().BeTrue(); others.All(b => !b.Pinned).Should().BeTrue(); } [Fact] public void PinBest_DistinctValues_LowestPinned_MultipleRuns() { var benchmarkResults1 = CreateResults("a", 3).ToList(); var benchmarkResults2 = CreateResults("b", 3).ToList(); var benchmarkResults = benchmarkResults1.Concat(benchmarkResults2); var benchmarks = CreateFromResultGroups(benchmarkResults).Reverse().ToList(); var stats = CreateMockStatsProvider(); var _ = benchmarks.PinBest(stats); var lowestResult = benchmarkResults1.MinBy(br => br.MeanTime.GetValueOrDefault()); var lowest = benchmarks.Single(b => b.Runs.Any(r => r.Results.Contains(lowestResult))); var others = benchmarks.Where(b => b != lowest); lowest.Pinned.Should().BeTrue(); others.All(b => !b.Pinned).Should().BeTrue(); } [Theory] [InlineData("a", 1, "a", "b", "c")] [InlineData("*a*", 1, "a", "b", "c")] [InlineData("*a*", 1, "aaa", "bbb", "ccc")] [InlineData("*a*", 0, "test")] [InlineData("*e*", 3, "test", "set", "tes")] public void TrimRunsByFilter_RunsTrimmed(string filter, int expectedCount, params string[] names) { var bi = new BenchmarkInfo() { Runs = new[] { new BenchmarkRunInfo() { Results = names.Select(n => new BenchmarkResult() { Namespace = n, Type = n, Method = n, }).ToList(), }, } }; var result = bi.TrimRunsByFilter(new[] {filter}); result.Runs.Sum(ri => ri.Results.Count).Should().Be(expectedCount); } [Theory] [InlineData("a", "b", "c", false, "*zzz*")] [InlineData("a", "b", "c", true, "*a*")] [InlineData("a", "b", "c", true, "*b*")] [InlineData("a", "b", "c", true, "*c*")] [InlineData("a", "b", "c", true, "*a*", "z")] [InlineData("a", "b", "c", true, "*b*", "z")] [InlineData("a", "b", "c", true, "*c*", "z")] public void IsIncluded_ResultFiltered(string ns, string t, string m, bool expected, params string[] filters) { var result = new BenchmarkResult() { Namespace = ns, Type = t, Method = m, }; result.IsIncluded(filters).Should().Be(expected); } private IBenchmarkStatisticAccessorProvider CreateMockStatsProvider() { var result = Substitute.For<IBenchmarkStatisticAccessorProvider>(); result.GetNullableAccessor(nameof(BenchmarkResult.MeanTime)) .Returns(br => br.MeanTime); result.GetNullableAccessor(nameof(BenchmarkResult.MaxTime)) .Returns(br => br.MaxTime); result.GetNullableAccessor(nameof(BenchmarkResult.MinTime)) .Returns(br => br.MinTime); result.GetAccessorInfos() .Returns(new[] { nameof(BenchmarkResult.MeanTime), nameof(BenchmarkResult.MaxTime), nameof(BenchmarkResult.MinTime) } .Select(n => new BenchmarkStatisticAccessorInfo(n, false))); return result; } private IEnumerable<BenchmarkResult> CreateResults(string name, int count, IEnumerable<decimal> values = null) { values ??= Enumerable.Range(1, count).Select(i => (decimal)i); var valuePairs = values.Select(i => new decimal[] {i, i * 10}); return Enumerable.Range(1, count) .Zip(valuePairs, (i,xs) => (i,xs)) .Select(t => new BenchmarkResult() { FullName = name, MeanTime = t.xs[0], MaxTime = t.xs[1], }); } private IEnumerable<BenchmarkInfo> CreateFromResults(IEnumerable<BenchmarkResult> results) { return results.Select(br => new BenchmarkRunInfo() {Results = new[] {br}}) .Select((bri, i) => new BenchmarkInfo() { BranchName = $"branch{i + 1}", Runs = new[] {bri} }); } private IEnumerable<BenchmarkInfo> CreateFromResultGroups(IEnumerable<BenchmarkResult> results) { var groups = results.GroupBy(br => br.FullName) .Select(grp => (grp.Key, grp.ToList())) .ToList(); for (var x = 0; x < groups[0].Item2.Count; x++) { var results2 = groups.Select(grp => grp.Item2[x]).ToList(); yield return new BenchmarkInfo() { Runs = new[] { new BenchmarkRunInfo() { Results = results2, } } }; } } } }
40.564
118
0.520757
[ "Apache-2.0" ]
NewDayTechnology/benchmarkdotnet.analyser
test/BenchmarkDotNetAnalyser.Tests.Unit/Benchmarks/BenchmarkInfoExtensionsTests.cs
10,143
C#
using System.ComponentModel.DataAnnotations; namespace Blog.Shared.DTOs { public class CreatePostDTO { [Required] [StringLength(100)] public string Title { get; set; } [Required] [StringLength(100000)] public string Introduction { get; set; } [Required] [StringLength(10000000)] public string Content { get; set; } } }
20.35
48
0.594595
[ "MIT" ]
misiukanis/simple-blog
Blog/Blog/Shared/DTOs/CreatePostDTO.cs
409
C#
using System.ComponentModel; using OrchardCore.ContentManagement.Metadata; using OrchardCore.ContentManagement.Metadata.Settings; using OrchardCore.Data.Migration; using StatCan.OrchardCore.Extensions; namespace StatCan.OrchardCore.OpenAPI { public class Migrations : DataMigration { private readonly IContentDefinitionManager _contentDefinitionManager; public Migrations(IContentDefinitionManager contentDefinitionManager) { _contentDefinitionManager = contentDefinitionManager; } public int Create() { _contentDefinitionManager.AlterTypeDefinition("OpenAPI", type => type .DisplayedAs("OpenAPI") .Stereotype("Widget") .WithPart("TitlePart", part => part .WithSettings(new TitlePartSettings { RenderTitle = false, }) ) .WithPart("OpenAPI") ); _contentDefinitionManager.AlterPartDefinition("OpenAPI", part => part .WithField("Spec", field => field .OfType("TextField") .WithDisplayName("Spec") .WithEditor("CodeMirror") ) ); return 1; } internal class TitlePartSettings { public int Options { get; set; } public string Pattern { get; set; } [DefaultValue(true)] public bool RenderTitle { get; set; } } } }
30.960784
81
0.559215
[ "MIT" ]
StatCan/StatCan.OrchardCore
src/Modules/StatCan.OrchardCore.OpenAPI/Migrations.cs
1,579
C#
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace Strata { public partial class PencilControl : UserControl { public PencilControl() { InitializeComponent(); Settings.Instance.Width = 27; numericUpDownWidth.Value = 27; trackBarPencilSize.Value = 27; SetSelectedButton(27); } private void roundedButtonControl7_Click(object sender, EventArgs e) { var roundedButton = sender as RoundedButtonControl; if (roundedButton != null) { Settings.Instance.Width = roundedButton.Width; numericUpDownWidth.Value = roundedButton.Width; trackBarPencilSize.Value = roundedButton.Width; } } private void numericUpDownWidth_ValueChanged(object sender, EventArgs e) { var control = sender as NumericUpDown; if (control != null) { Settings.Instance.Width = (int) control.Value; trackBarPencilSize.Value = (int) control.Value; SetSelectedButton((int) control.Value); } } private void SetSelectedButton(int width) { IEnumerable<Control> list = flowLayoutPanel1.Controls.Cast<Control>() .Union(flowLayoutPanel4.Controls.Cast<Control>()) .Where(x => (x as RoundedButtonControl) != null); foreach (RoundedButtonControl item in list.Select(x => x as RoundedButtonControl)) item.SetSelected(item.Size.Width == width); } private void trackBarPencilSize_MouseUp(object sender, MouseEventArgs e) { var tb = sender as TrackBar; if (tb != null) { Settings.Instance.Width = tb.Value; numericUpDownWidth.Value = tb.Value; } } } }
33.655738
95
0.555285
[ "MIT", "MIT-0", "Unlicense" ]
syzranov/strata
Strata/Controls/PencilControl.cs
2,055
C#
using System.Threading.Tasks; using NUnit.Framework; namespace ShikimoriSharp.Tests.Information { [TestFixture] public class ForumAndGenresTest : TestBase { [Test] public async Task GetForumsTest() { Assert.IsNotEmpty(await Client.Forums.GetForums()); } [Test] public async Task GetGenres() { Assert.IsNotEmpty(await Client.Genres.GetGenres()); } } }
21.761905
63
0.601751
[ "MIT" ]
ColinFL/ShikimoriSharp
ShikimoriSharp.Tests/Information/ForumAndGenresTest.cs
459
C#
using MusicPickerService.Models; using Owin; namespace MusicPickerService { public partial class Startup { public void ConfigureDbContext(IAppBuilder app) { app.CreatePerOwinContext(ApplicationDbContext.Create); } } }
20.538462
66
0.677903
[ "Apache-2.0" ]
hutopi/MusicPickerService
MusicPickerService/App_Start/Startup.DbContext.cs
269
C#
using UnityEngine; namespace TechnomediaLabs { public static class MyLayers { // Toggle layers lock //Tools.lockedLayers = 1 << LayerMask.NameToLayer("LayerName"); // Replace the whole value of lockedLayers. //Tools.lockedLayers |= 1 << LayerMask.NameToLayer("LayerName"); // Add a value to lockedLayers. //Tools.lockedLayers &= ~(1 << LayerMask.NameToLayer("LayerName")); // Remove a value from lockedLayers. //Tools.lockedLayers ^= 1 << LayerMask.NameToLayer("LayerName")); // Toggle a value in lockedLayers. public static LayerMask ToLayerMask(int layer) { return 1 << layer; } public static bool LayerInMask(this LayerMask mask, int layer) { return ((1 << layer) & mask) != 0; } } }
30.208333
110
0.691034
[ "Apache-2.0" ]
Damagree/selaru-vr
Selaru VR - 3D/Assets/Zetcil/Model/Variable Model/Inspector/Extensions/MyLayers.cs
727
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18047 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace NetSales.BackOffice.Properties { /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if ((resourceMan == null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NetSales.BackOffice.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
38.819444
185
0.604651
[ "Apache-2.0" ]
onselaydin/Alinteri
NetSales.BackOffice/Properties/Resources.Designer.cs
2,797
C#
using System; using System.Collections; using System.Collections.Generic; namespace TauCode.Parsing { public class ResultAccumulator : IResultAccumulator { #region Fields private readonly List<object> _results; #endregion #region Constructor public ResultAccumulator() { _results = new List<object>(); this.Version = 1; } #endregion #region IReadOnlyList<object> Members public IEnumerator<object> GetEnumerator() => _results.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => _results.GetEnumerator(); public int Count => _results.Count; public object this[int index] => _results[index]; #endregion #region IResultAccumulator Members public void Modify() { this.Version++; } public int Version { get; private set; } public void AddResult(object result) { if (result == null) { throw new ArgumentNullException(nameof(result)); } _results.Add(result); } #endregion } }
20.20339
79
0.572148
[ "Apache-2.0" ]
taucode/taucode.parsing
src/TauCode.Parsing/ResultAccumulator.cs
1,194
C#
using System; using System.Collections.Generic; namespace SerializationBenchmark { internal static class TestData { public static readonly UserLicensesResponsePB TestValuePB; static TestData() { var r = new Random(); foreach (var l in TestValue.Licenses) { if (l.ServicePlans != null) { foreach (var sp in l.ServicePlans) { sp.Count = r.Next(); } } } var ulr = new UserLicensesResponsePB(); // convert the test value from below into the protobuf types foreach (var ul in TestValue.Licenses) { var ulpb = new UserLicensePB(); if (ul.ObjectId != null) { ulpb.ObjectId = ul.ObjectId; } if (ul.SkuId != null) { ulpb.SkuId = ul.SkuId; } if (ul.SkuPartNumber != null) { ulpb.SkuPartNumber = ul.SkuPartNumber; } ulr.Licenses.Add(ulpb); if (ul.FruitColors != null) { foreach (var fc in ul.FruitColors) { ulpb.FruitColors.Add(fc.Key, (ColorPB)fc.Value); } } if (ul.ServicePlans != null) { foreach (var sp in ul.ServicePlans) { var sppb = new ServicePlanPB(); if (sp.AppliesTo != null) { sppb.AppliesTo = sp.AppliesTo; } sppb.Count = sp.Count; if (sp.ServicePlanId != null) { sppb.ServicePlanId = sp.ServicePlanId; } if (sp.ServicePlanName != null) { sppb.ServicePlanName = sp.ServicePlanName; } ulpb.SercucePlans.Add(sppb); } } } TestValuePB = ulr; } // This is the data we use to serialize/deserialize in the benchmark public static readonly UserLicensesResponse TestValue = new UserLicensesResponse { Licenses = new[] { new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR2An38eBLPdOtXhbU5K1cd8", SkuId = "c7df2760-2c81-4ef7-b578-5b5392b571df", SkuPartNumber = "JDHDYIIWSDH&WDFD", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "rier8gu9erg8we8uwe8euwe8f", ServicePlanId = "2f442157-a11c-46b9-ae5b-6e39ff4e5849", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "DKDIJFOIJEKMMKI_DJFUE", ServicePlanId = "c4801e8a-cb58-4c35-aca6-f2dcc106f287", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "URMMOOFLLOOOELLD", ServicePlanId = "0898bdbb-73b0-471a-81e5-20f1fe4dd66e", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "KFOKOKEFOKEFKKD", ServicePlanId = "94065c59-bc8e-4e8b-89e5-5138d471eaff", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "PREMIUM_ENCRYPTION", ServicePlanId = "617b097b-4b93-4ede-83de-5f075bb5fb2f", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "KORKOFJJ+FJUURKKKF", ServicePlanId = "4a51bca5-1eff-43f5-878c-177680f191af", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "MIP_S_CLP2", ServicePlanId = "efb0351d-3b08-4503-993d-383af8de41e3", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "MIP_S_CLP1", ServicePlanId = "5136a095-5cf0-4aff-bec3-e84448b38ea5", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "rOFKOPRKOKR", ServicePlanId = "33c4f319-9bdd-48d6-9c4d-410b750a4a5a", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "FK{ORoIMMopOSOF", ServicePlanId = "b1188c4c-1b36-4018-b48b-ee07604f6feb", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "JDOJOIJOINMDCOKE ", ServicePlanId = "3fb82609-8c27-4f7b-bd51-30634711ee67", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "FPOJRMVIONEVOINJI", ServicePlanId = "e212cbc7-0961-4c40-9825-01117710dcb1", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ODKJMLE:OPU(EFMMFM", ServicePlanId = "6c6042f5-6f01-4d67-b8c1-eb99d36eed3e", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "DFPOFKOKEPFPJJFJJJE", ServicePlanId = "8e0c0a52-6a6c-4d40-8370-dd62790dcd70", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "FIUEINNFUUU B DJDJ", ServicePlanId = "8c7d2df8-86f0-4902-b2ed-a0458298f3b3", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "DOJIHOWJNJNJNMJJF", ServicePlanId = "07699545-9485-468e-95b6-2fca3738be01", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "DPOIOIRKLMK:MF", ServicePlanId = "9c0dab89-a30c-4117-86e7-97bda240acd2", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "FOKIOROFJPKRMKMERG", ServicePlanId = "57ff2da0-773e-42df-b2af-ffb7a2317929", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "IOJIOREJNERKNGKNRG", ServicePlanId = "8c098270-9dd4-4350-9b30-ba4703f3b36b", ProvisioningStatus = "PendingInput", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "RiJGIOERJMNERGJERGJ", ServicePlanId = "4de31727-a228-4ec3-a5bf-8e45b5ca48cc", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "RIGJOIERJG ERGUJERNG HRG", ServicePlanId = "9f431833-0334-42de-a7dc-70aa40db46db", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = ":LKLKFJIDINIOJO OI OD FDFO ", ServicePlanId = "34c0d7a0-a70f-4668-9238-47f9fc208882", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "DOKFK", ServicePlanId = "a23b959c-7ce8-4e57-9140-b90eb88a9e97", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "DKJKJDIFJMD OOEDF WEF ", ServicePlanId = "f20fedf3-f3c3-43c3-8267-2bfdd51c0939", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "DOKOIO(F", ServicePlanId = "4828c8ec-dc2e-4779-b502-87ac9ce28ab7", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "FLKFOKOPKLMF", ServicePlanId = "3e26ee1f-8a5f-4d52-aee2-b81ce45c8f40", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "DFOKOEKFOKL<DLV ", ServicePlanId = "70d33638-9c74-4d01-bfd3-562de28bd4ba", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "DOOPDPOFI", ServicePlanId = "882e1d05-acd1-4ccb-8708-6ee03664b117", ProvisioningStatus = "PendingActivation", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "SDKJFPOJFJIEJFWEF", ServicePlanId = "b737dad2-2f6c-4c65-90e3-ca563267e8b9", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "SDL:K:LDSKOKPOKSDPFKOSKDF", ServicePlanId = "bea4c11e-220a-4e6d-8eb8-8ea15d019f90", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "GPKLGPOKOPFKPFP F", ServicePlanId = "7547a3fe-08ee-4ccb-b430-5077c5041653", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "FGLKPRKgpOKERGPOK", ServicePlanId = "43de0ff5-c92c-492b-9116-175376d08c38", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "WE;lfk:LWKF:LKW", ServicePlanId = "0feaeb32-d00e-4d66-bd5a-43b5b83db82c", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "RJIEJOIJGOJER", ServicePlanId = "efb87545-963c-4e0d-99df-69c6916d9eb0", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "GKROPKGPOKERKGPOKERG", ServicePlanId = "5dbe027f-2339-4123-9542-606e4d348a72", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "RIJIERJGOIJERG", ServicePlanId = "e95bec33-7c88-4a70-8e19-b10bd9d0c014", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR_iz2JAucXtPqh5i565svpY", SkuId = "90d8b3f8-712e-4f7b-aa1e-62e7ae6cbe96", SkuPartNumber = "ROKPOKRPOGKR", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "KJOIERJOJERG", ServicePlanId = "39b5c996-467e-4e60-bd62-46066f572726", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ER:LKERKGERGKPOKEROGKERG", ServicePlanId = "199a5c09-e0ca-4e37-8f7c-b05d533e1ea2", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR4EkbAOKqs1Hq0MyTwwVfC0", SkuId = "036c2481-aa8a-47cd-ab43-324f0c157c2d", SkuPartNumber = "OKRPOKPKOER", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "ERKERKPGKERGK", ServicePlanId = "ed8e8769-94c5-4132-a3e7-7543b713d51f", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR59fAQl_NzhFu7X3XOsJNYo", SkuId = "09015f9f-377f-4538-bbb5-f75ceb09358a", SkuPartNumber = "RKEORGKPOERKG", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "ERKPOKERGPKEPRGKPOEKRG", ServicePlanId = "818523f5-016b-4355-9be8-ed6944946ea7", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ERMKKERGOOJojERGJ", ServicePlanId = "fa200448-008c-4acb-abd4-ea106ed2199d", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "RELKGPOEKRGPKEPRGKPER", ServicePlanId = "50554c47-71d9-49fd-bc54-42a2765c555c", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "RGPEKRJGOKEPRMGPERMPGOK", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "WFJOWIJFOIWJFOIJWF", ServicePlanId = "e95bec33-7c88-4a70-8e19-b10bd9d0c014", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "WEFPOKWPEKFPOWKEFPOKWEPOFK", ServicePlanId = "fe71d6c3-a2ea-4499-9778-da042bf08063", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "WOEFKOPWEFKPOWKEFPOK", ServicePlanId = "5dbe027f-2339-4123-9542-606e4d348a72", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "WOEKFOKWEPOFKPOWKEF", ServicePlanId = "fafd7243-e5c1-4a3a-9e40-495efcb1d3c3", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR6xtlLx3eHFCsveZ0tsTzSw", SkuId = "bc946dac-7877-4271-b2f7-99d2db13cd2c", SkuPartNumber = "eererferferg", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "ergergergerg", ServicePlanId = "17efdd9f-c22c-4ad8-b48e-3b1f3ee1dc9a", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ergergergergergergerg", ServicePlanId = "e212cbc7-0961-4c40-9825-01117710dcb1", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ergergergergergerg", ServicePlanId = "57a0746c-87b8-4405-9397-df365a9db793", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "rthrthrthrthrth", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "fghfhfghfghfgh", ServicePlanId = "363430d1-e3f7-43bc-b07b-767b6bb95e4b", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR3C95mHb--tNguqRKELzlDE", SkuId = "61e6bd70-fbdb-4deb-82ea-912842f39431", SkuPartNumber = "fghfgfgh", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "ergergergerg", ServicePlanId = "4ade5aa6-5959-4d2c-bf0a-f4c9e2cc00f2", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR1BacTSSfW9Cmen4FeCuHeU", SkuId = "34715a50-7d92-426f-99e9-f815e0ae1de5", SkuPartNumber = "rthrthrthrth", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "tyjtyjtyjtyj", ServicePlanId = "fe47a034-ab6d-4cb4-bdb4-9551354b177e", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR4-OoSYUTfhGg1rtO6QkqWE", SkuId = "26a18e8f-4d14-46f8-835a-ed3ba424a961", SkuPartNumber = "tyjtyjtyjtyj", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "tyjtyjtyjtyjtyuk", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yrukyukryukryukryuk", ServicePlanId = "018fb91e-cee3-418c-9063-d7562978bdaf", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR6fhLEGZpLNBjrazjyu8XD8", SkuId = "412ce1a7-a499-41b3-8eb6-b38f2bbc5c3f", SkuPartNumber = "ryukyruk", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "fhjkruykyrukyruk", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ryukryukryuk", ServicePlanId = "ca4be917-fbce-4b52-839e-6647467a1668", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbRy2tCBUCWOZEv-hvtl3mPSg", SkuId = "1508ad2d-5802-44e6-bfe8-6fb65de63d28", SkuPartNumber = "yukryukryukyrukryuk", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "yurkryukryukryukryuk", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ryukryukryukryuk", ServicePlanId = "874d6da5-2a67-45c1-8635-96e8b3e300ea", ProvisioningStatus = "PendingInput", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR0qii0ipOXNEjuUZKR5xsAI", SkuId = "488ba24a-39a9-4473-8ee5-19291e71b002", SkuPartNumber = "ryukryukryukyruk", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "yukyukryukryuk", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ryukyukryukryukryuk", ServicePlanId = "871d91ec-ec1a-452b-a83f-bd76c7d770ef", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "hrththetyjetyj", ServicePlanId = "e7c91390-7625-45be-94e0-e16907e03118", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR66jsdw_s4dEhGqmQCYvrfQ", SkuId = "dcb1a3ae-b33f-4487-846a-a640262fadf4", SkuPartNumber = "tyjetyjetyj", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "etyjetyjetyjetyj", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ghdjtjetyjtyj", ServicePlanId = "d20bfa21-e9ae-43fc-93c2-20783f0840c3", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "teyjteyjetyjetyjtyj", ServicePlanId = "17ab22cd-a0b3-4536-910a-cb6eb12696c0", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "etyjetyjetyjteyj", ServicePlanId = "d5368ca3-357e-4acb-9c21-8495fb025d1f", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "teyjetyjteyjetyjetjy", ServicePlanId = "50e68c76-46c6-4674-81f9-75456511b170", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR08SXrDMx6BFpqqM94yUaWg", SkuId = "b05e124f-c7cc-45a0-a6aa-8cf78c946968", SkuPartNumber = "tyejetyjetyjetyj", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "teyjteyjteyj", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "etyjetyj", ServicePlanId = "14ab5db5-e6c4-4b20-b4bc-13e36fd2227f", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tyjetyjetyjetyjetyj", ServicePlanId = "2e2ddb96-6af9-4b1d-a3f0-d6ecfd22edb2", ProvisioningStatus = "PendingInput", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "etyjteyjetyjety", ServicePlanId = "5689bec4-755d-4753-8b61-40975025187c", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tuilutilutiltuil", ServicePlanId = "6c57d4b6-3b23-47a5-9bc9-69f17b4947b3", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tuiltuituiltuil", ServicePlanId = "bea4c11e-220a-4e6d-8eb8-8ea15d019f90", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yejytjetyjteyty", ServicePlanId = "c1ec4a95-1f05-45b3-a911-aa3fa01094f5", ProvisioningStatus = "PendingInput", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tyjetyketuykketyj", ServicePlanId = "eec0eb4f-6444-4f95-aba0-50c24d67f998", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "etyj56jtyjetyj", ServicePlanId = "8a256a2b-b617-496d-b51b-e76466e88db0", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tyjkytukyjhmteyj", ServicePlanId = "41781fb2-bc02-4b7c-bd55-b576c07bb09d", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR8VvEuqeoeJCpzHanUN7_88", SkuId = "ea126fc5-a19e-42e2-a731-da9d437bffcf", SkuPartNumber = "tyjtryjtyj", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "tyjtyjtyj", ServicePlanId = "97f29a83-1a20-44ff-bf48-5e4ad11f3e51", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tyjtyjtyj", ServicePlanId = "1412cdc1-d593-4ad1-9050-40c30ad0b023", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tyjtryjtyj", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tyjtyjtryj", ServicePlanId = "0b03f40b-c404-40c3-8651-2aceb74365fa", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tyrjtryjrytuk", ServicePlanId = "b650d915-9886-424b-a08d-633cede56f57", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "gjf,fhj,hfj,fhj,,fjh,", ServicePlanId = "03acaee3-9492-4f40-aed4-bcb6b32981b6", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ryukyrukyruk", ServicePlanId = "e95bec33-7c88-4a70-8e19-b10bd9d0c014", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yrukyrukyuk", ServicePlanId = "5dbe027f-2339-4123-9542-606e4d348a72", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yrukryukryuk", ServicePlanId = "fe71d6c3-a2ea-4499-9778-da042bf08063", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yrukryukyruk", ServicePlanId = "fafd7243-e5c1-4a3a-9e40-495efcb1d3c3", ProvisioningStatus = "Disabled", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ryukyrukryukuo;l", ServicePlanId = "d56f3deb-50d8-465a-bedb-f079817ccac1", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR8x8brXH1R9CojtcGL2618A", SkuId = "b56e7ccc-d5c7-421f-a23b-5c18bdbad7c0", SkuPartNumber = "ryukryukryukyukryuk", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "ryukyrukryukryukryuk", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yrukryukryukryukryuk", ServicePlanId = "2d925ad8-2479-4bd8-bb76-5b80f1d48935", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ryukryukryukryukryuk", ServicePlanId = "048a552e-c849-4027-b54c-4c7ead26150a", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yrukryuryukryukryukryukryuk", ServicePlanId = "300b8114-8555-4313-b861-0c115d820f50", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR5puJTq2FZJAsNyCmT9N68Y", SkuId = "3a256e9a-15b6-4092-b0dc-82993f4debc6", SkuPartNumber = "yrukryukgfgjmmtyutyukryuk", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "uykryukryukryukr", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ryukryukyuyjmuiyiukdtyj", ServicePlanId = "2d925ad8-2479-4bd8-bb76-5b80f1d48935", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yrukyrukyruyrukryukyurk", ServicePlanId = "7e6d7d78-73de-46ba-83b1-6d25117334ba", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yrukyruryukryukryukyruu", ServicePlanId = "874fc546-6efe-4d22-90b8-5c4e7aa59f4b", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yukryukryukryukryuk", ServicePlanId = "300b8114-8555-4313-b861-0c115d820f50", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "yjtyjtyjtyjtyjyukuiluiktyj", ServicePlanId = "f815ac79-c5dd-4bcc-9b78-d97f7b817d0d", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tytyjejetyjteyjteyjtyj", ServicePlanId = "5ed38b64-c3b7-4d9f-b1cd-0de18c9c4331", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbRygWSmqam01CvtVBGPDt4_0", SkuId = "6a4a1628-9b9a-424d-bed5-4118f0ede3fd", SkuPartNumber = "ghjkghjkghjk", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "jhkryukyutktyj", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "tyjetyjetyjtyjtyetjetyj", ServicePlanId = "3f2afeed-6fb5-4bf9-998f-f2912133aead", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, new UserLicense { ObjectId = "v4j5cvGGr0GRqy180BHbR0mPksW6EvdIraMNdDo2AdU", SkuId = "c5928f49-12ba-48f7-ada3-0d743a3601d5", SkuPartNumber = "tyjtyjtyj", ServicePlans = new[] { new ServicePlan{ ServicePlanName = "hjkghjkghjk", ServicePlanId = "da792a53-cbc0-4184-a10d-e544dd34b3c1", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ghjkghjkghk", ServicePlanId = "2bdbaf8f-738f-4ac7-9234-3c3ee2ce7d0f", ProvisioningStatus = "Success", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ghjkghjkghj", ServicePlanId = "113feb6c-3fe4-4440-bddc-54d774bf0318", ProvisioningStatus = "PendingProvisioning", AppliesTo = "Company" }, new ServicePlan{ ServicePlanName = "ghjkghjkghjkghjghj", ServicePlanId = "663a804f-1c30-4ff0-9915-9db84f0d1cea", ProvisioningStatus = "Success", AppliesTo = "Company" }, }, FruitColors = new Dictionary<string, Color> { { "Banana", Color.Yellow }, { "Orange", Color.Orange }, { "Apple", Color.Red }, { "Lemon", Color.Yellow }, }, }, }, }; } }
72.226531
211
0.551242
[ "MIT" ]
JamesNK/SerializationBenchmark
TestData.cs
35,393
C#
using Unity.Networking.Transport; using Unity.NetCode; using Unity.Mathematics; public struct PilotSnapshotData : ISnapshotData<PilotSnapshotData> { public uint tick; private int PilotDataPlayerId; private int RotationValueX; private int RotationValueY; private int RotationValueZ; private int RotationValueW; private int TranslationValueX; private int TranslationValueY; private int TranslationValueZ; private int Child0RotationValueX; private int Child0RotationValueY; private int Child0RotationValueZ; private int Child0RotationValueW; private int Child0TranslationValueX; private int Child0TranslationValueY; private int Child0TranslationValueZ; private int Child1RotationValueX; private int Child1RotationValueY; private int Child1RotationValueZ; private int Child1RotationValueW; private int Child1TranslationValueX; private int Child1TranslationValueY; private int Child1TranslationValueZ; private int Child2RotationValueX; private int Child2RotationValueY; private int Child2RotationValueZ; private int Child2RotationValueW; private int Child2TranslationValueX; private int Child2TranslationValueY; private int Child2TranslationValueZ; private int Child3RotationValueX; private int Child3RotationValueY; private int Child3RotationValueZ; private int Child3RotationValueW; private int Child3TranslationValueX; private int Child3TranslationValueY; private int Child3TranslationValueZ; private int Child4RotationValueX; private int Child4RotationValueY; private int Child4RotationValueZ; private int Child4RotationValueW; private int Child4TranslationValueX; private int Child4TranslationValueY; private int Child4TranslationValueZ; private int Child5RotationValueX; private int Child5RotationValueY; private int Child5RotationValueZ; private int Child5RotationValueW; private int Child5TranslationValueX; private int Child5TranslationValueY; private int Child5TranslationValueZ; private int Child6RotationValueX; private int Child6RotationValueY; private int Child6RotationValueZ; private int Child6RotationValueW; private int Child6TranslationValueX; private int Child6TranslationValueY; private int Child6TranslationValueZ; uint changeMask0; public uint Tick => tick; public int GetPilotDataPlayerId(GhostDeserializerState deserializerState) { return (int)PilotDataPlayerId; } public int GetPilotDataPlayerId() { return (int)PilotDataPlayerId; } public void SetPilotDataPlayerId(int val, GhostSerializerState serializerState) { PilotDataPlayerId = (int)val; } public void SetPilotDataPlayerId(int val) { PilotDataPlayerId = (int)val; } public quaternion GetRotationValue(GhostDeserializerState deserializerState) { return GetRotationValue(); } public quaternion GetRotationValue() { return new quaternion(RotationValueX * 0.001f, RotationValueY * 0.001f, RotationValueZ * 0.001f, RotationValueW * 0.001f); } public void SetRotationValue(quaternion q, GhostSerializerState serializerState) { SetRotationValue(q); } public void SetRotationValue(quaternion q) { RotationValueX = (int)(q.value.x * 1000); RotationValueY = (int)(q.value.y * 1000); RotationValueZ = (int)(q.value.z * 1000); RotationValueW = (int)(q.value.w * 1000); } public float3 GetTranslationValue(GhostDeserializerState deserializerState) { return GetTranslationValue(); } public float3 GetTranslationValue() { return new float3(TranslationValueX * 0.01f, TranslationValueY * 0.01f, TranslationValueZ * 0.01f); } public void SetTranslationValue(float3 val, GhostSerializerState serializerState) { SetTranslationValue(val); } public void SetTranslationValue(float3 val) { TranslationValueX = (int)(val.x * 100); TranslationValueY = (int)(val.y * 100); TranslationValueZ = (int)(val.z * 100); } public quaternion GetChild0RotationValue(GhostDeserializerState deserializerState) { return GetChild0RotationValue(); } public quaternion GetChild0RotationValue() { return new quaternion(Child0RotationValueX * 0.001f, Child0RotationValueY * 0.001f, Child0RotationValueZ * 0.001f, Child0RotationValueW * 0.001f); } public void SetChild0RotationValue(quaternion q, GhostSerializerState serializerState) { SetChild0RotationValue(q); } public void SetChild0RotationValue(quaternion q) { Child0RotationValueX = (int)(q.value.x * 1000); Child0RotationValueY = (int)(q.value.y * 1000); Child0RotationValueZ = (int)(q.value.z * 1000); Child0RotationValueW = (int)(q.value.w * 1000); } public float3 GetChild0TranslationValue(GhostDeserializerState deserializerState) { return GetChild0TranslationValue(); } public float3 GetChild0TranslationValue() { return new float3(Child0TranslationValueX * 0.01f, Child0TranslationValueY * 0.01f, Child0TranslationValueZ * 0.01f); } public void SetChild0TranslationValue(float3 val, GhostSerializerState serializerState) { SetChild0TranslationValue(val); } public void SetChild0TranslationValue(float3 val) { Child0TranslationValueX = (int)(val.x * 100); Child0TranslationValueY = (int)(val.y * 100); Child0TranslationValueZ = (int)(val.z * 100); } public quaternion GetChild1RotationValue(GhostDeserializerState deserializerState) { return GetChild1RotationValue(); } public quaternion GetChild1RotationValue() { return new quaternion(Child1RotationValueX * 0.001f, Child1RotationValueY * 0.001f, Child1RotationValueZ * 0.001f, Child1RotationValueW * 0.001f); } public void SetChild1RotationValue(quaternion q, GhostSerializerState serializerState) { SetChild1RotationValue(q); } public void SetChild1RotationValue(quaternion q) { Child1RotationValueX = (int)(q.value.x * 1000); Child1RotationValueY = (int)(q.value.y * 1000); Child1RotationValueZ = (int)(q.value.z * 1000); Child1RotationValueW = (int)(q.value.w * 1000); } public float3 GetChild1TranslationValue(GhostDeserializerState deserializerState) { return GetChild1TranslationValue(); } public float3 GetChild1TranslationValue() { return new float3(Child1TranslationValueX * 0.01f, Child1TranslationValueY * 0.01f, Child1TranslationValueZ * 0.01f); } public void SetChild1TranslationValue(float3 val, GhostSerializerState serializerState) { SetChild1TranslationValue(val); } public void SetChild1TranslationValue(float3 val) { Child1TranslationValueX = (int)(val.x * 100); Child1TranslationValueY = (int)(val.y * 100); Child1TranslationValueZ = (int)(val.z * 100); } public quaternion GetChild2RotationValue(GhostDeserializerState deserializerState) { return GetChild2RotationValue(); } public quaternion GetChild2RotationValue() { return new quaternion(Child2RotationValueX * 0.001f, Child2RotationValueY * 0.001f, Child2RotationValueZ * 0.001f, Child2RotationValueW * 0.001f); } public void SetChild2RotationValue(quaternion q, GhostSerializerState serializerState) { SetChild2RotationValue(q); } public void SetChild2RotationValue(quaternion q) { Child2RotationValueX = (int)(q.value.x * 1000); Child2RotationValueY = (int)(q.value.y * 1000); Child2RotationValueZ = (int)(q.value.z * 1000); Child2RotationValueW = (int)(q.value.w * 1000); } public float3 GetChild2TranslationValue(GhostDeserializerState deserializerState) { return GetChild2TranslationValue(); } public float3 GetChild2TranslationValue() { return new float3(Child2TranslationValueX * 0.01f, Child2TranslationValueY * 0.01f, Child2TranslationValueZ * 0.01f); } public void SetChild2TranslationValue(float3 val, GhostSerializerState serializerState) { SetChild2TranslationValue(val); } public void SetChild2TranslationValue(float3 val) { Child2TranslationValueX = (int)(val.x * 100); Child2TranslationValueY = (int)(val.y * 100); Child2TranslationValueZ = (int)(val.z * 100); } public quaternion GetChild3RotationValue(GhostDeserializerState deserializerState) { return GetChild3RotationValue(); } public quaternion GetChild3RotationValue() { return new quaternion(Child3RotationValueX * 0.001f, Child3RotationValueY * 0.001f, Child3RotationValueZ * 0.001f, Child3RotationValueW * 0.001f); } public void SetChild3RotationValue(quaternion q, GhostSerializerState serializerState) { SetChild3RotationValue(q); } public void SetChild3RotationValue(quaternion q) { Child3RotationValueX = (int)(q.value.x * 1000); Child3RotationValueY = (int)(q.value.y * 1000); Child3RotationValueZ = (int)(q.value.z * 1000); Child3RotationValueW = (int)(q.value.w * 1000); } public float3 GetChild3TranslationValue(GhostDeserializerState deserializerState) { return GetChild3TranslationValue(); } public float3 GetChild3TranslationValue() { return new float3(Child3TranslationValueX * 0.01f, Child3TranslationValueY * 0.01f, Child3TranslationValueZ * 0.01f); } public void SetChild3TranslationValue(float3 val, GhostSerializerState serializerState) { SetChild3TranslationValue(val); } public void SetChild3TranslationValue(float3 val) { Child3TranslationValueX = (int)(val.x * 100); Child3TranslationValueY = (int)(val.y * 100); Child3TranslationValueZ = (int)(val.z * 100); } public quaternion GetChild4RotationValue(GhostDeserializerState deserializerState) { return GetChild4RotationValue(); } public quaternion GetChild4RotationValue() { return new quaternion(Child4RotationValueX * 0.001f, Child4RotationValueY * 0.001f, Child4RotationValueZ * 0.001f, Child4RotationValueW * 0.001f); } public void SetChild4RotationValue(quaternion q, GhostSerializerState serializerState) { SetChild4RotationValue(q); } public void SetChild4RotationValue(quaternion q) { Child4RotationValueX = (int)(q.value.x * 1000); Child4RotationValueY = (int)(q.value.y * 1000); Child4RotationValueZ = (int)(q.value.z * 1000); Child4RotationValueW = (int)(q.value.w * 1000); } public float3 GetChild4TranslationValue(GhostDeserializerState deserializerState) { return GetChild4TranslationValue(); } public float3 GetChild4TranslationValue() { return new float3(Child4TranslationValueX * 0.01f, Child4TranslationValueY * 0.01f, Child4TranslationValueZ * 0.01f); } public void SetChild4TranslationValue(float3 val, GhostSerializerState serializerState) { SetChild4TranslationValue(val); } public void SetChild4TranslationValue(float3 val) { Child4TranslationValueX = (int)(val.x * 100); Child4TranslationValueY = (int)(val.y * 100); Child4TranslationValueZ = (int)(val.z * 100); } public quaternion GetChild5RotationValue(GhostDeserializerState deserializerState) { return GetChild5RotationValue(); } public quaternion GetChild5RotationValue() { return new quaternion(Child5RotationValueX * 0.001f, Child5RotationValueY * 0.001f, Child5RotationValueZ * 0.001f, Child5RotationValueW * 0.001f); } public void SetChild5RotationValue(quaternion q, GhostSerializerState serializerState) { SetChild5RotationValue(q); } public void SetChild5RotationValue(quaternion q) { Child5RotationValueX = (int)(q.value.x * 1000); Child5RotationValueY = (int)(q.value.y * 1000); Child5RotationValueZ = (int)(q.value.z * 1000); Child5RotationValueW = (int)(q.value.w * 1000); } public float3 GetChild5TranslationValue(GhostDeserializerState deserializerState) { return GetChild5TranslationValue(); } public float3 GetChild5TranslationValue() { return new float3(Child5TranslationValueX * 0.01f, Child5TranslationValueY * 0.01f, Child5TranslationValueZ * 0.01f); } public void SetChild5TranslationValue(float3 val, GhostSerializerState serializerState) { SetChild5TranslationValue(val); } public void SetChild5TranslationValue(float3 val) { Child5TranslationValueX = (int)(val.x * 100); Child5TranslationValueY = (int)(val.y * 100); Child5TranslationValueZ = (int)(val.z * 100); } public quaternion GetChild6RotationValue(GhostDeserializerState deserializerState) { return GetChild6RotationValue(); } public quaternion GetChild6RotationValue() { return new quaternion(Child6RotationValueX * 0.001f, Child6RotationValueY * 0.001f, Child6RotationValueZ * 0.001f, Child6RotationValueW * 0.001f); } public void SetChild6RotationValue(quaternion q, GhostSerializerState serializerState) { SetChild6RotationValue(q); } public void SetChild6RotationValue(quaternion q) { Child6RotationValueX = (int)(q.value.x * 1000); Child6RotationValueY = (int)(q.value.y * 1000); Child6RotationValueZ = (int)(q.value.z * 1000); Child6RotationValueW = (int)(q.value.w * 1000); } public float3 GetChild6TranslationValue(GhostDeserializerState deserializerState) { return GetChild6TranslationValue(); } public float3 GetChild6TranslationValue() { return new float3(Child6TranslationValueX * 0.01f, Child6TranslationValueY * 0.01f, Child6TranslationValueZ * 0.01f); } public void SetChild6TranslationValue(float3 val, GhostSerializerState serializerState) { SetChild6TranslationValue(val); } public void SetChild6TranslationValue(float3 val) { Child6TranslationValueX = (int)(val.x * 100); Child6TranslationValueY = (int)(val.y * 100); Child6TranslationValueZ = (int)(val.z * 100); } public void PredictDelta(uint tick, ref PilotSnapshotData baseline1, ref PilotSnapshotData baseline2) { var predictor = new GhostDeltaPredictor(tick, this.tick, baseline1.tick, baseline2.tick); PilotDataPlayerId = predictor.PredictInt(PilotDataPlayerId, baseline1.PilotDataPlayerId, baseline2.PilotDataPlayerId); RotationValueX = predictor.PredictInt(RotationValueX, baseline1.RotationValueX, baseline2.RotationValueX); RotationValueY = predictor.PredictInt(RotationValueY, baseline1.RotationValueY, baseline2.RotationValueY); RotationValueZ = predictor.PredictInt(RotationValueZ, baseline1.RotationValueZ, baseline2.RotationValueZ); RotationValueW = predictor.PredictInt(RotationValueW, baseline1.RotationValueW, baseline2.RotationValueW); TranslationValueX = predictor.PredictInt(TranslationValueX, baseline1.TranslationValueX, baseline2.TranslationValueX); TranslationValueY = predictor.PredictInt(TranslationValueY, baseline1.TranslationValueY, baseline2.TranslationValueY); TranslationValueZ = predictor.PredictInt(TranslationValueZ, baseline1.TranslationValueZ, baseline2.TranslationValueZ); Child0RotationValueX = predictor.PredictInt(Child0RotationValueX, baseline1.Child0RotationValueX, baseline2.Child0RotationValueX); Child0RotationValueY = predictor.PredictInt(Child0RotationValueY, baseline1.Child0RotationValueY, baseline2.Child0RotationValueY); Child0RotationValueZ = predictor.PredictInt(Child0RotationValueZ, baseline1.Child0RotationValueZ, baseline2.Child0RotationValueZ); Child0RotationValueW = predictor.PredictInt(Child0RotationValueW, baseline1.Child0RotationValueW, baseline2.Child0RotationValueW); Child0TranslationValueX = predictor.PredictInt(Child0TranslationValueX, baseline1.Child0TranslationValueX, baseline2.Child0TranslationValueX); Child0TranslationValueY = predictor.PredictInt(Child0TranslationValueY, baseline1.Child0TranslationValueY, baseline2.Child0TranslationValueY); Child0TranslationValueZ = predictor.PredictInt(Child0TranslationValueZ, baseline1.Child0TranslationValueZ, baseline2.Child0TranslationValueZ); Child1RotationValueX = predictor.PredictInt(Child1RotationValueX, baseline1.Child1RotationValueX, baseline2.Child1RotationValueX); Child1RotationValueY = predictor.PredictInt(Child1RotationValueY, baseline1.Child1RotationValueY, baseline2.Child1RotationValueY); Child1RotationValueZ = predictor.PredictInt(Child1RotationValueZ, baseline1.Child1RotationValueZ, baseline2.Child1RotationValueZ); Child1RotationValueW = predictor.PredictInt(Child1RotationValueW, baseline1.Child1RotationValueW, baseline2.Child1RotationValueW); Child1TranslationValueX = predictor.PredictInt(Child1TranslationValueX, baseline1.Child1TranslationValueX, baseline2.Child1TranslationValueX); Child1TranslationValueY = predictor.PredictInt(Child1TranslationValueY, baseline1.Child1TranslationValueY, baseline2.Child1TranslationValueY); Child1TranslationValueZ = predictor.PredictInt(Child1TranslationValueZ, baseline1.Child1TranslationValueZ, baseline2.Child1TranslationValueZ); Child2RotationValueX = predictor.PredictInt(Child2RotationValueX, baseline1.Child2RotationValueX, baseline2.Child2RotationValueX); Child2RotationValueY = predictor.PredictInt(Child2RotationValueY, baseline1.Child2RotationValueY, baseline2.Child2RotationValueY); Child2RotationValueZ = predictor.PredictInt(Child2RotationValueZ, baseline1.Child2RotationValueZ, baseline2.Child2RotationValueZ); Child2RotationValueW = predictor.PredictInt(Child2RotationValueW, baseline1.Child2RotationValueW, baseline2.Child2RotationValueW); Child2TranslationValueX = predictor.PredictInt(Child2TranslationValueX, baseline1.Child2TranslationValueX, baseline2.Child2TranslationValueX); Child2TranslationValueY = predictor.PredictInt(Child2TranslationValueY, baseline1.Child2TranslationValueY, baseline2.Child2TranslationValueY); Child2TranslationValueZ = predictor.PredictInt(Child2TranslationValueZ, baseline1.Child2TranslationValueZ, baseline2.Child2TranslationValueZ); Child3RotationValueX = predictor.PredictInt(Child3RotationValueX, baseline1.Child3RotationValueX, baseline2.Child3RotationValueX); Child3RotationValueY = predictor.PredictInt(Child3RotationValueY, baseline1.Child3RotationValueY, baseline2.Child3RotationValueY); Child3RotationValueZ = predictor.PredictInt(Child3RotationValueZ, baseline1.Child3RotationValueZ, baseline2.Child3RotationValueZ); Child3RotationValueW = predictor.PredictInt(Child3RotationValueW, baseline1.Child3RotationValueW, baseline2.Child3RotationValueW); Child3TranslationValueX = predictor.PredictInt(Child3TranslationValueX, baseline1.Child3TranslationValueX, baseline2.Child3TranslationValueX); Child3TranslationValueY = predictor.PredictInt(Child3TranslationValueY, baseline1.Child3TranslationValueY, baseline2.Child3TranslationValueY); Child3TranslationValueZ = predictor.PredictInt(Child3TranslationValueZ, baseline1.Child3TranslationValueZ, baseline2.Child3TranslationValueZ); Child4RotationValueX = predictor.PredictInt(Child4RotationValueX, baseline1.Child4RotationValueX, baseline2.Child4RotationValueX); Child4RotationValueY = predictor.PredictInt(Child4RotationValueY, baseline1.Child4RotationValueY, baseline2.Child4RotationValueY); Child4RotationValueZ = predictor.PredictInt(Child4RotationValueZ, baseline1.Child4RotationValueZ, baseline2.Child4RotationValueZ); Child4RotationValueW = predictor.PredictInt(Child4RotationValueW, baseline1.Child4RotationValueW, baseline2.Child4RotationValueW); Child4TranslationValueX = predictor.PredictInt(Child4TranslationValueX, baseline1.Child4TranslationValueX, baseline2.Child4TranslationValueX); Child4TranslationValueY = predictor.PredictInt(Child4TranslationValueY, baseline1.Child4TranslationValueY, baseline2.Child4TranslationValueY); Child4TranslationValueZ = predictor.PredictInt(Child4TranslationValueZ, baseline1.Child4TranslationValueZ, baseline2.Child4TranslationValueZ); Child5RotationValueX = predictor.PredictInt(Child5RotationValueX, baseline1.Child5RotationValueX, baseline2.Child5RotationValueX); Child5RotationValueY = predictor.PredictInt(Child5RotationValueY, baseline1.Child5RotationValueY, baseline2.Child5RotationValueY); Child5RotationValueZ = predictor.PredictInt(Child5RotationValueZ, baseline1.Child5RotationValueZ, baseline2.Child5RotationValueZ); Child5RotationValueW = predictor.PredictInt(Child5RotationValueW, baseline1.Child5RotationValueW, baseline2.Child5RotationValueW); Child5TranslationValueX = predictor.PredictInt(Child5TranslationValueX, baseline1.Child5TranslationValueX, baseline2.Child5TranslationValueX); Child5TranslationValueY = predictor.PredictInt(Child5TranslationValueY, baseline1.Child5TranslationValueY, baseline2.Child5TranslationValueY); Child5TranslationValueZ = predictor.PredictInt(Child5TranslationValueZ, baseline1.Child5TranslationValueZ, baseline2.Child5TranslationValueZ); Child6RotationValueX = predictor.PredictInt(Child6RotationValueX, baseline1.Child6RotationValueX, baseline2.Child6RotationValueX); Child6RotationValueY = predictor.PredictInt(Child6RotationValueY, baseline1.Child6RotationValueY, baseline2.Child6RotationValueY); Child6RotationValueZ = predictor.PredictInt(Child6RotationValueZ, baseline1.Child6RotationValueZ, baseline2.Child6RotationValueZ); Child6RotationValueW = predictor.PredictInt(Child6RotationValueW, baseline1.Child6RotationValueW, baseline2.Child6RotationValueW); Child6TranslationValueX = predictor.PredictInt(Child6TranslationValueX, baseline1.Child6TranslationValueX, baseline2.Child6TranslationValueX); Child6TranslationValueY = predictor.PredictInt(Child6TranslationValueY, baseline1.Child6TranslationValueY, baseline2.Child6TranslationValueY); Child6TranslationValueZ = predictor.PredictInt(Child6TranslationValueZ, baseline1.Child6TranslationValueZ, baseline2.Child6TranslationValueZ); } public void Serialize(int networkId, ref PilotSnapshotData baseline, ref DataStreamWriter writer, NetworkCompressionModel compressionModel) { changeMask0 = (PilotDataPlayerId != baseline.PilotDataPlayerId) ? 1u : 0; changeMask0 |= (RotationValueX != baseline.RotationValueX || RotationValueY != baseline.RotationValueY || RotationValueZ != baseline.RotationValueZ || RotationValueW != baseline.RotationValueW) ? (1u<<1) : 0; changeMask0 |= (TranslationValueX != baseline.TranslationValueX || TranslationValueY != baseline.TranslationValueY || TranslationValueZ != baseline.TranslationValueZ) ? (1u<<2) : 0; changeMask0 |= (Child0RotationValueX != baseline.Child0RotationValueX || Child0RotationValueY != baseline.Child0RotationValueY || Child0RotationValueZ != baseline.Child0RotationValueZ || Child0RotationValueW != baseline.Child0RotationValueW) ? (1u<<3) : 0; changeMask0 |= (Child0TranslationValueX != baseline.Child0TranslationValueX || Child0TranslationValueY != baseline.Child0TranslationValueY || Child0TranslationValueZ != baseline.Child0TranslationValueZ) ? (1u<<4) : 0; changeMask0 |= (Child1RotationValueX != baseline.Child1RotationValueX || Child1RotationValueY != baseline.Child1RotationValueY || Child1RotationValueZ != baseline.Child1RotationValueZ || Child1RotationValueW != baseline.Child1RotationValueW) ? (1u<<5) : 0; changeMask0 |= (Child1TranslationValueX != baseline.Child1TranslationValueX || Child1TranslationValueY != baseline.Child1TranslationValueY || Child1TranslationValueZ != baseline.Child1TranslationValueZ) ? (1u<<6) : 0; changeMask0 |= (Child2RotationValueX != baseline.Child2RotationValueX || Child2RotationValueY != baseline.Child2RotationValueY || Child2RotationValueZ != baseline.Child2RotationValueZ || Child2RotationValueW != baseline.Child2RotationValueW) ? (1u<<7) : 0; changeMask0 |= (Child2TranslationValueX != baseline.Child2TranslationValueX || Child2TranslationValueY != baseline.Child2TranslationValueY || Child2TranslationValueZ != baseline.Child2TranslationValueZ) ? (1u<<8) : 0; changeMask0 |= (Child3RotationValueX != baseline.Child3RotationValueX || Child3RotationValueY != baseline.Child3RotationValueY || Child3RotationValueZ != baseline.Child3RotationValueZ || Child3RotationValueW != baseline.Child3RotationValueW) ? (1u<<9) : 0; changeMask0 |= (Child3TranslationValueX != baseline.Child3TranslationValueX || Child3TranslationValueY != baseline.Child3TranslationValueY || Child3TranslationValueZ != baseline.Child3TranslationValueZ) ? (1u<<10) : 0; changeMask0 |= (Child4RotationValueX != baseline.Child4RotationValueX || Child4RotationValueY != baseline.Child4RotationValueY || Child4RotationValueZ != baseline.Child4RotationValueZ || Child4RotationValueW != baseline.Child4RotationValueW) ? (1u<<11) : 0; changeMask0 |= (Child4TranslationValueX != baseline.Child4TranslationValueX || Child4TranslationValueY != baseline.Child4TranslationValueY || Child4TranslationValueZ != baseline.Child4TranslationValueZ) ? (1u<<12) : 0; changeMask0 |= (Child5RotationValueX != baseline.Child5RotationValueX || Child5RotationValueY != baseline.Child5RotationValueY || Child5RotationValueZ != baseline.Child5RotationValueZ || Child5RotationValueW != baseline.Child5RotationValueW) ? (1u<<13) : 0; changeMask0 |= (Child5TranslationValueX != baseline.Child5TranslationValueX || Child5TranslationValueY != baseline.Child5TranslationValueY || Child5TranslationValueZ != baseline.Child5TranslationValueZ) ? (1u<<14) : 0; changeMask0 |= (Child6RotationValueX != baseline.Child6RotationValueX || Child6RotationValueY != baseline.Child6RotationValueY || Child6RotationValueZ != baseline.Child6RotationValueZ || Child6RotationValueW != baseline.Child6RotationValueW) ? (1u<<15) : 0; changeMask0 |= (Child6TranslationValueX != baseline.Child6TranslationValueX || Child6TranslationValueY != baseline.Child6TranslationValueY || Child6TranslationValueZ != baseline.Child6TranslationValueZ) ? (1u<<16) : 0; writer.WritePackedUIntDelta(changeMask0, baseline.changeMask0, compressionModel); if ((changeMask0 & (1 << 0)) != 0) writer.WritePackedIntDelta(PilotDataPlayerId, baseline.PilotDataPlayerId, compressionModel); if ((changeMask0 & (1 << 1)) != 0) { writer.WritePackedIntDelta(RotationValueX, baseline.RotationValueX, compressionModel); writer.WritePackedIntDelta(RotationValueY, baseline.RotationValueY, compressionModel); writer.WritePackedIntDelta(RotationValueZ, baseline.RotationValueZ, compressionModel); writer.WritePackedIntDelta(RotationValueW, baseline.RotationValueW, compressionModel); } if ((changeMask0 & (1 << 2)) != 0) { writer.WritePackedIntDelta(TranslationValueX, baseline.TranslationValueX, compressionModel); writer.WritePackedIntDelta(TranslationValueY, baseline.TranslationValueY, compressionModel); writer.WritePackedIntDelta(TranslationValueZ, baseline.TranslationValueZ, compressionModel); } if ((changeMask0 & (1 << 3)) != 0) { writer.WritePackedIntDelta(Child0RotationValueX, baseline.Child0RotationValueX, compressionModel); writer.WritePackedIntDelta(Child0RotationValueY, baseline.Child0RotationValueY, compressionModel); writer.WritePackedIntDelta(Child0RotationValueZ, baseline.Child0RotationValueZ, compressionModel); writer.WritePackedIntDelta(Child0RotationValueW, baseline.Child0RotationValueW, compressionModel); } if ((changeMask0 & (1 << 4)) != 0) { writer.WritePackedIntDelta(Child0TranslationValueX, baseline.Child0TranslationValueX, compressionModel); writer.WritePackedIntDelta(Child0TranslationValueY, baseline.Child0TranslationValueY, compressionModel); writer.WritePackedIntDelta(Child0TranslationValueZ, baseline.Child0TranslationValueZ, compressionModel); } if ((changeMask0 & (1 << 5)) != 0) { writer.WritePackedIntDelta(Child1RotationValueX, baseline.Child1RotationValueX, compressionModel); writer.WritePackedIntDelta(Child1RotationValueY, baseline.Child1RotationValueY, compressionModel); writer.WritePackedIntDelta(Child1RotationValueZ, baseline.Child1RotationValueZ, compressionModel); writer.WritePackedIntDelta(Child1RotationValueW, baseline.Child1RotationValueW, compressionModel); } if ((changeMask0 & (1 << 6)) != 0) { writer.WritePackedIntDelta(Child1TranslationValueX, baseline.Child1TranslationValueX, compressionModel); writer.WritePackedIntDelta(Child1TranslationValueY, baseline.Child1TranslationValueY, compressionModel); writer.WritePackedIntDelta(Child1TranslationValueZ, baseline.Child1TranslationValueZ, compressionModel); } if ((changeMask0 & (1 << 7)) != 0) { writer.WritePackedIntDelta(Child2RotationValueX, baseline.Child2RotationValueX, compressionModel); writer.WritePackedIntDelta(Child2RotationValueY, baseline.Child2RotationValueY, compressionModel); writer.WritePackedIntDelta(Child2RotationValueZ, baseline.Child2RotationValueZ, compressionModel); writer.WritePackedIntDelta(Child2RotationValueW, baseline.Child2RotationValueW, compressionModel); } if ((changeMask0 & (1 << 8)) != 0) { writer.WritePackedIntDelta(Child2TranslationValueX, baseline.Child2TranslationValueX, compressionModel); writer.WritePackedIntDelta(Child2TranslationValueY, baseline.Child2TranslationValueY, compressionModel); writer.WritePackedIntDelta(Child2TranslationValueZ, baseline.Child2TranslationValueZ, compressionModel); } if ((changeMask0 & (1 << 9)) != 0) { writer.WritePackedIntDelta(Child3RotationValueX, baseline.Child3RotationValueX, compressionModel); writer.WritePackedIntDelta(Child3RotationValueY, baseline.Child3RotationValueY, compressionModel); writer.WritePackedIntDelta(Child3RotationValueZ, baseline.Child3RotationValueZ, compressionModel); writer.WritePackedIntDelta(Child3RotationValueW, baseline.Child3RotationValueW, compressionModel); } if ((changeMask0 & (1 << 10)) != 0) { writer.WritePackedIntDelta(Child3TranslationValueX, baseline.Child3TranslationValueX, compressionModel); writer.WritePackedIntDelta(Child3TranslationValueY, baseline.Child3TranslationValueY, compressionModel); writer.WritePackedIntDelta(Child3TranslationValueZ, baseline.Child3TranslationValueZ, compressionModel); } if ((changeMask0 & (1 << 11)) != 0) { writer.WritePackedIntDelta(Child4RotationValueX, baseline.Child4RotationValueX, compressionModel); writer.WritePackedIntDelta(Child4RotationValueY, baseline.Child4RotationValueY, compressionModel); writer.WritePackedIntDelta(Child4RotationValueZ, baseline.Child4RotationValueZ, compressionModel); writer.WritePackedIntDelta(Child4RotationValueW, baseline.Child4RotationValueW, compressionModel); } if ((changeMask0 & (1 << 12)) != 0) { writer.WritePackedIntDelta(Child4TranslationValueX, baseline.Child4TranslationValueX, compressionModel); writer.WritePackedIntDelta(Child4TranslationValueY, baseline.Child4TranslationValueY, compressionModel); writer.WritePackedIntDelta(Child4TranslationValueZ, baseline.Child4TranslationValueZ, compressionModel); } if ((changeMask0 & (1 << 13)) != 0) { writer.WritePackedIntDelta(Child5RotationValueX, baseline.Child5RotationValueX, compressionModel); writer.WritePackedIntDelta(Child5RotationValueY, baseline.Child5RotationValueY, compressionModel); writer.WritePackedIntDelta(Child5RotationValueZ, baseline.Child5RotationValueZ, compressionModel); writer.WritePackedIntDelta(Child5RotationValueW, baseline.Child5RotationValueW, compressionModel); } if ((changeMask0 & (1 << 14)) != 0) { writer.WritePackedIntDelta(Child5TranslationValueX, baseline.Child5TranslationValueX, compressionModel); writer.WritePackedIntDelta(Child5TranslationValueY, baseline.Child5TranslationValueY, compressionModel); writer.WritePackedIntDelta(Child5TranslationValueZ, baseline.Child5TranslationValueZ, compressionModel); } if ((changeMask0 & (1 << 15)) != 0) { writer.WritePackedIntDelta(Child6RotationValueX, baseline.Child6RotationValueX, compressionModel); writer.WritePackedIntDelta(Child6RotationValueY, baseline.Child6RotationValueY, compressionModel); writer.WritePackedIntDelta(Child6RotationValueZ, baseline.Child6RotationValueZ, compressionModel); writer.WritePackedIntDelta(Child6RotationValueW, baseline.Child6RotationValueW, compressionModel); } if ((changeMask0 & (1 << 16)) != 0) { writer.WritePackedIntDelta(Child6TranslationValueX, baseline.Child6TranslationValueX, compressionModel); writer.WritePackedIntDelta(Child6TranslationValueY, baseline.Child6TranslationValueY, compressionModel); writer.WritePackedIntDelta(Child6TranslationValueZ, baseline.Child6TranslationValueZ, compressionModel); } } public void Deserialize(uint tick, ref PilotSnapshotData baseline, ref DataStreamReader reader, NetworkCompressionModel compressionModel) { this.tick = tick; changeMask0 = reader.ReadPackedUIntDelta(baseline.changeMask0, compressionModel); if ((changeMask0 & (1 << 0)) != 0) PilotDataPlayerId = reader.ReadPackedIntDelta(baseline.PilotDataPlayerId, compressionModel); else PilotDataPlayerId = baseline.PilotDataPlayerId; if ((changeMask0 & (1 << 1)) != 0) { RotationValueX = reader.ReadPackedIntDelta(baseline.RotationValueX, compressionModel); RotationValueY = reader.ReadPackedIntDelta(baseline.RotationValueY, compressionModel); RotationValueZ = reader.ReadPackedIntDelta(baseline.RotationValueZ, compressionModel); RotationValueW = reader.ReadPackedIntDelta(baseline.RotationValueW, compressionModel); } else { RotationValueX = baseline.RotationValueX; RotationValueY = baseline.RotationValueY; RotationValueZ = baseline.RotationValueZ; RotationValueW = baseline.RotationValueW; } if ((changeMask0 & (1 << 2)) != 0) { TranslationValueX = reader.ReadPackedIntDelta(baseline.TranslationValueX, compressionModel); TranslationValueY = reader.ReadPackedIntDelta(baseline.TranslationValueY, compressionModel); TranslationValueZ = reader.ReadPackedIntDelta(baseline.TranslationValueZ, compressionModel); } else { TranslationValueX = baseline.TranslationValueX; TranslationValueY = baseline.TranslationValueY; TranslationValueZ = baseline.TranslationValueZ; } if ((changeMask0 & (1 << 3)) != 0) { Child0RotationValueX = reader.ReadPackedIntDelta(baseline.Child0RotationValueX, compressionModel); Child0RotationValueY = reader.ReadPackedIntDelta(baseline.Child0RotationValueY, compressionModel); Child0RotationValueZ = reader.ReadPackedIntDelta(baseline.Child0RotationValueZ, compressionModel); Child0RotationValueW = reader.ReadPackedIntDelta(baseline.Child0RotationValueW, compressionModel); } else { Child0RotationValueX = baseline.Child0RotationValueX; Child0RotationValueY = baseline.Child0RotationValueY; Child0RotationValueZ = baseline.Child0RotationValueZ; Child0RotationValueW = baseline.Child0RotationValueW; } if ((changeMask0 & (1 << 4)) != 0) { Child0TranslationValueX = reader.ReadPackedIntDelta(baseline.Child0TranslationValueX, compressionModel); Child0TranslationValueY = reader.ReadPackedIntDelta(baseline.Child0TranslationValueY, compressionModel); Child0TranslationValueZ = reader.ReadPackedIntDelta(baseline.Child0TranslationValueZ, compressionModel); } else { Child0TranslationValueX = baseline.Child0TranslationValueX; Child0TranslationValueY = baseline.Child0TranslationValueY; Child0TranslationValueZ = baseline.Child0TranslationValueZ; } if ((changeMask0 & (1 << 5)) != 0) { Child1RotationValueX = reader.ReadPackedIntDelta(baseline.Child1RotationValueX, compressionModel); Child1RotationValueY = reader.ReadPackedIntDelta(baseline.Child1RotationValueY, compressionModel); Child1RotationValueZ = reader.ReadPackedIntDelta(baseline.Child1RotationValueZ, compressionModel); Child1RotationValueW = reader.ReadPackedIntDelta(baseline.Child1RotationValueW, compressionModel); } else { Child1RotationValueX = baseline.Child1RotationValueX; Child1RotationValueY = baseline.Child1RotationValueY; Child1RotationValueZ = baseline.Child1RotationValueZ; Child1RotationValueW = baseline.Child1RotationValueW; } if ((changeMask0 & (1 << 6)) != 0) { Child1TranslationValueX = reader.ReadPackedIntDelta(baseline.Child1TranslationValueX, compressionModel); Child1TranslationValueY = reader.ReadPackedIntDelta(baseline.Child1TranslationValueY, compressionModel); Child1TranslationValueZ = reader.ReadPackedIntDelta(baseline.Child1TranslationValueZ, compressionModel); } else { Child1TranslationValueX = baseline.Child1TranslationValueX; Child1TranslationValueY = baseline.Child1TranslationValueY; Child1TranslationValueZ = baseline.Child1TranslationValueZ; } if ((changeMask0 & (1 << 7)) != 0) { Child2RotationValueX = reader.ReadPackedIntDelta(baseline.Child2RotationValueX, compressionModel); Child2RotationValueY = reader.ReadPackedIntDelta(baseline.Child2RotationValueY, compressionModel); Child2RotationValueZ = reader.ReadPackedIntDelta(baseline.Child2RotationValueZ, compressionModel); Child2RotationValueW = reader.ReadPackedIntDelta(baseline.Child2RotationValueW, compressionModel); } else { Child2RotationValueX = baseline.Child2RotationValueX; Child2RotationValueY = baseline.Child2RotationValueY; Child2RotationValueZ = baseline.Child2RotationValueZ; Child2RotationValueW = baseline.Child2RotationValueW; } if ((changeMask0 & (1 << 8)) != 0) { Child2TranslationValueX = reader.ReadPackedIntDelta(baseline.Child2TranslationValueX, compressionModel); Child2TranslationValueY = reader.ReadPackedIntDelta(baseline.Child2TranslationValueY, compressionModel); Child2TranslationValueZ = reader.ReadPackedIntDelta(baseline.Child2TranslationValueZ, compressionModel); } else { Child2TranslationValueX = baseline.Child2TranslationValueX; Child2TranslationValueY = baseline.Child2TranslationValueY; Child2TranslationValueZ = baseline.Child2TranslationValueZ; } if ((changeMask0 & (1 << 9)) != 0) { Child3RotationValueX = reader.ReadPackedIntDelta(baseline.Child3RotationValueX, compressionModel); Child3RotationValueY = reader.ReadPackedIntDelta(baseline.Child3RotationValueY, compressionModel); Child3RotationValueZ = reader.ReadPackedIntDelta(baseline.Child3RotationValueZ, compressionModel); Child3RotationValueW = reader.ReadPackedIntDelta(baseline.Child3RotationValueW, compressionModel); } else { Child3RotationValueX = baseline.Child3RotationValueX; Child3RotationValueY = baseline.Child3RotationValueY; Child3RotationValueZ = baseline.Child3RotationValueZ; Child3RotationValueW = baseline.Child3RotationValueW; } if ((changeMask0 & (1 << 10)) != 0) { Child3TranslationValueX = reader.ReadPackedIntDelta(baseline.Child3TranslationValueX, compressionModel); Child3TranslationValueY = reader.ReadPackedIntDelta(baseline.Child3TranslationValueY, compressionModel); Child3TranslationValueZ = reader.ReadPackedIntDelta(baseline.Child3TranslationValueZ, compressionModel); } else { Child3TranslationValueX = baseline.Child3TranslationValueX; Child3TranslationValueY = baseline.Child3TranslationValueY; Child3TranslationValueZ = baseline.Child3TranslationValueZ; } if ((changeMask0 & (1 << 11)) != 0) { Child4RotationValueX = reader.ReadPackedIntDelta(baseline.Child4RotationValueX, compressionModel); Child4RotationValueY = reader.ReadPackedIntDelta(baseline.Child4RotationValueY, compressionModel); Child4RotationValueZ = reader.ReadPackedIntDelta(baseline.Child4RotationValueZ, compressionModel); Child4RotationValueW = reader.ReadPackedIntDelta(baseline.Child4RotationValueW, compressionModel); } else { Child4RotationValueX = baseline.Child4RotationValueX; Child4RotationValueY = baseline.Child4RotationValueY; Child4RotationValueZ = baseline.Child4RotationValueZ; Child4RotationValueW = baseline.Child4RotationValueW; } if ((changeMask0 & (1 << 12)) != 0) { Child4TranslationValueX = reader.ReadPackedIntDelta(baseline.Child4TranslationValueX, compressionModel); Child4TranslationValueY = reader.ReadPackedIntDelta(baseline.Child4TranslationValueY, compressionModel); Child4TranslationValueZ = reader.ReadPackedIntDelta(baseline.Child4TranslationValueZ, compressionModel); } else { Child4TranslationValueX = baseline.Child4TranslationValueX; Child4TranslationValueY = baseline.Child4TranslationValueY; Child4TranslationValueZ = baseline.Child4TranslationValueZ; } if ((changeMask0 & (1 << 13)) != 0) { Child5RotationValueX = reader.ReadPackedIntDelta(baseline.Child5RotationValueX, compressionModel); Child5RotationValueY = reader.ReadPackedIntDelta(baseline.Child5RotationValueY, compressionModel); Child5RotationValueZ = reader.ReadPackedIntDelta(baseline.Child5RotationValueZ, compressionModel); Child5RotationValueW = reader.ReadPackedIntDelta(baseline.Child5RotationValueW, compressionModel); } else { Child5RotationValueX = baseline.Child5RotationValueX; Child5RotationValueY = baseline.Child5RotationValueY; Child5RotationValueZ = baseline.Child5RotationValueZ; Child5RotationValueW = baseline.Child5RotationValueW; } if ((changeMask0 & (1 << 14)) != 0) { Child5TranslationValueX = reader.ReadPackedIntDelta(baseline.Child5TranslationValueX, compressionModel); Child5TranslationValueY = reader.ReadPackedIntDelta(baseline.Child5TranslationValueY, compressionModel); Child5TranslationValueZ = reader.ReadPackedIntDelta(baseline.Child5TranslationValueZ, compressionModel); } else { Child5TranslationValueX = baseline.Child5TranslationValueX; Child5TranslationValueY = baseline.Child5TranslationValueY; Child5TranslationValueZ = baseline.Child5TranslationValueZ; } if ((changeMask0 & (1 << 15)) != 0) { Child6RotationValueX = reader.ReadPackedIntDelta(baseline.Child6RotationValueX, compressionModel); Child6RotationValueY = reader.ReadPackedIntDelta(baseline.Child6RotationValueY, compressionModel); Child6RotationValueZ = reader.ReadPackedIntDelta(baseline.Child6RotationValueZ, compressionModel); Child6RotationValueW = reader.ReadPackedIntDelta(baseline.Child6RotationValueW, compressionModel); } else { Child6RotationValueX = baseline.Child6RotationValueX; Child6RotationValueY = baseline.Child6RotationValueY; Child6RotationValueZ = baseline.Child6RotationValueZ; Child6RotationValueW = baseline.Child6RotationValueW; } if ((changeMask0 & (1 << 16)) != 0) { Child6TranslationValueX = reader.ReadPackedIntDelta(baseline.Child6TranslationValueX, compressionModel); Child6TranslationValueY = reader.ReadPackedIntDelta(baseline.Child6TranslationValueY, compressionModel); Child6TranslationValueZ = reader.ReadPackedIntDelta(baseline.Child6TranslationValueZ, compressionModel); } else { Child6TranslationValueX = baseline.Child6TranslationValueX; Child6TranslationValueY = baseline.Child6TranslationValueY; Child6TranslationValueZ = baseline.Child6TranslationValueZ; } } public void Interpolate(ref PilotSnapshotData target, float factor) { SetRotationValue(math.slerp(GetRotationValue(), target.GetRotationValue(), factor)); SetTranslationValue(math.lerp(GetTranslationValue(), target.GetTranslationValue(), factor)); SetChild0RotationValue(math.slerp(GetChild0RotationValue(), target.GetChild0RotationValue(), factor)); SetChild0TranslationValue(math.lerp(GetChild0TranslationValue(), target.GetChild0TranslationValue(), factor)); SetChild1RotationValue(math.slerp(GetChild1RotationValue(), target.GetChild1RotationValue(), factor)); SetChild1TranslationValue(math.lerp(GetChild1TranslationValue(), target.GetChild1TranslationValue(), factor)); SetChild2RotationValue(math.slerp(GetChild2RotationValue(), target.GetChild2RotationValue(), factor)); SetChild2TranslationValue(math.lerp(GetChild2TranslationValue(), target.GetChild2TranslationValue(), factor)); SetChild3RotationValue(math.slerp(GetChild3RotationValue(), target.GetChild3RotationValue(), factor)); SetChild3TranslationValue(math.lerp(GetChild3TranslationValue(), target.GetChild3TranslationValue(), factor)); SetChild4RotationValue(math.slerp(GetChild4RotationValue(), target.GetChild4RotationValue(), factor)); SetChild4TranslationValue(math.lerp(GetChild4TranslationValue(), target.GetChild4TranslationValue(), factor)); SetChild5RotationValue(math.slerp(GetChild5RotationValue(), target.GetChild5RotationValue(), factor)); SetChild5TranslationValue(math.lerp(GetChild5TranslationValue(), target.GetChild5TranslationValue(), factor)); SetChild6RotationValue(math.slerp(GetChild6RotationValue(), target.GetChild6RotationValue(), factor)); SetChild6TranslationValue(math.lerp(GetChild6TranslationValue(), target.GetChild6TranslationValue(), factor)); } }
59.003534
154
0.714457
[ "Apache-2.0" ]
WireWhiz/OpenFall
Scripts/Networking/Player/Generated/PlayerSnapshotData.cs
50,094
C#
 namespace CarterSample.Features.Actors { public class FileForm { public File File { get; set; } //[ApiSchemaAttributes(Format = "binary")] public string FileBinary { get; set; } } }
19.333333
51
0.573276
[ "MIT" ]
andrewlock/Carter
samples/CarterSample/Features/Actors/FileForm.cs
234
C#
using System; using System.Collections.Generic; using System.Text; using WebApiClient; using Xunit; using System.Threading; using System.Threading.Tasks; namespace WebApiClient.Test.Internal { public class ConcurrentCacheTest { private int count = 0; [Fact] public void GetOrAddGet() { var key = "WebApiClient"; var cache = new ConcurrentCache<string, int>(); Parallel.For(0, 1000, (i) => { var value = cache.GetOrAdd(key, k => { Interlocked.Increment(ref this.count); return 1; }); Assert.True(value == 1); Assert.True(count == 1); }); } } }
22.285714
59
0.508974
[ "MIT" ]
IvanZheng/WebApiClient
WebApiClient.Test/Internal/ConcurrentCacheTest.cs
782
C#
// Copyright (c) 2020-2021 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Behavior-Tree using Zor.BehaviorTree.Core.Leaves.Actions; using Zor.BehaviorTree.DrawingAttributes; namespace Zor.BehaviorTree.Serialization.SerializedBehaviors.Leaves.Actions { [NameOverride("Source Property Name", 0), NameOverride("Target Property Name", 1), NameOverride("Filter Property Name", 2), NameOverride("Path Property Name", 3)] [SearchGroup("Nav Mesh")] public sealed class SerializedCalculateNavMeshPathFiltered : SerializedAction<CalculateNavMeshPathFiltered, string, string, string, string> { } }
38.4375
105
0.795122
[ "MIT" ]
ZorPastaman/Behavior-Tree
Runtime/Serialization/SerializedBehaviors/Leaves/Actions/SerializedCalculateNavMeshPathFiltered.cs
617
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager.Core; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network { /// <summary> A class representing collection of InboundNatRule and their operations over its parent. </summary> public partial class InboundNatRuleCollection : ArmCollection, IEnumerable<InboundNatRule>, IAsyncEnumerable<InboundNatRule> { private readonly ClientDiagnostics _clientDiagnostics; private readonly InboundNatRulesRestOperations _inboundNatRulesRestClient; /// <summary> Initializes a new instance of the <see cref="InboundNatRuleCollection"/> class for mocking. </summary> protected InboundNatRuleCollection() { } /// <summary> Initializes a new instance of InboundNatRuleCollection class. </summary> /// <param name="parent"> The resource representing the parent resource. </param> internal InboundNatRuleCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); _inboundNatRulesRestClient = new InboundNatRulesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); #if DEBUG ValidateResourceId(Id); #endif } internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != LoadBalancer.ResourceType) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, LoadBalancer.ResourceType), nameof(id)); } // Collection level operations. /// <summary> Creates or updates a load balancer inbound nat rule. </summary> /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> /// <param name="inboundNatRuleParameters"> Parameters supplied to the create or update inbound nat rule operation. </param> /// <param name="waitForCompletion"> Waits for the completion of the long running operations. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="inboundNatRuleName"/> or <paramref name="inboundNatRuleParameters"/> is null. </exception> public virtual InboundNatRuleCreateOrUpdateOperation CreateOrUpdate(string inboundNatRuleName, InboundNatRuleData inboundNatRuleParameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (inboundNatRuleName == null) { throw new ArgumentNullException(nameof(inboundNatRuleName)); } if (inboundNatRuleParameters == null) { throw new ArgumentNullException(nameof(inboundNatRuleParameters)); } using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.CreateOrUpdate"); scope.Start(); try { var response = _inboundNatRulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, inboundNatRuleParameters, cancellationToken); var operation = new InboundNatRuleCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _inboundNatRulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, inboundNatRuleParameters).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) { scope.Failed(e); throw; } } /// <summary> Creates or updates a load balancer inbound nat rule. </summary> /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> /// <param name="inboundNatRuleParameters"> Parameters supplied to the create or update inbound nat rule operation. </param> /// <param name="waitForCompletion"> Waits for the completion of the long running operations. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="inboundNatRuleName"/> or <paramref name="inboundNatRuleParameters"/> is null. </exception> public async virtual Task<InboundNatRuleCreateOrUpdateOperation> CreateOrUpdateAsync(string inboundNatRuleName, InboundNatRuleData inboundNatRuleParameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (inboundNatRuleName == null) { throw new ArgumentNullException(nameof(inboundNatRuleName)); } if (inboundNatRuleParameters == null) { throw new ArgumentNullException(nameof(inboundNatRuleParameters)); } using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.CreateOrUpdate"); scope.Start(); try { var response = await _inboundNatRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, inboundNatRuleParameters, cancellationToken).ConfigureAwait(false); var operation = new InboundNatRuleCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _inboundNatRulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, inboundNatRuleParameters).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) { scope.Failed(e); throw; } } /// <summary> Gets the specified load balancer inbound nat rule. </summary> /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> /// <param name="expand"> Expands referenced resources. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="inboundNatRuleName"/> is null. </exception> public virtual Response<InboundNatRule> Get(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) { if (inboundNatRuleName == null) { throw new ArgumentNullException(nameof(inboundNatRuleName)); } using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.Get"); scope.Start(); try { var response = _inboundNatRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, expand, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new InboundNatRule(Parent, response.Value), response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } /// <summary> Gets the specified load balancer inbound nat rule. </summary> /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> /// <param name="expand"> Expands referenced resources. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="inboundNatRuleName"/> is null. </exception> public async virtual Task<Response<InboundNatRule>> GetAsync(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) { if (inboundNatRuleName == null) { throw new ArgumentNullException(nameof(inboundNatRuleName)); } using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.Get"); scope.Start(); try { var response = await _inboundNatRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new InboundNatRule(Parent, response.Value), response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } /// <summary> Tries to get details for this resource from the service. </summary> /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> /// <param name="expand"> Expands referenced resources. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="inboundNatRuleName"/> is null. </exception> public virtual Response<InboundNatRule> GetIfExists(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) { if (inboundNatRuleName == null) { throw new ArgumentNullException(nameof(inboundNatRuleName)); } using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.GetIfExists"); scope.Start(); try { var response = _inboundNatRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, expand, cancellationToken: cancellationToken); return response.Value == null ? Response.FromValue<InboundNatRule>(null, response.GetRawResponse()) : Response.FromValue(new InboundNatRule(this, response.Value), response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } /// <summary> Tries to get details for this resource from the service. </summary> /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> /// <param name="expand"> Expands referenced resources. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="inboundNatRuleName"/> is null. </exception> public async virtual Task<Response<InboundNatRule>> GetIfExistsAsync(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) { if (inboundNatRuleName == null) { throw new ArgumentNullException(nameof(inboundNatRuleName)); } using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.GetIfExistsAsync"); scope.Start(); try { var response = await _inboundNatRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, inboundNatRuleName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); return response.Value == null ? Response.FromValue<InboundNatRule>(null, response.GetRawResponse()) : Response.FromValue(new InboundNatRule(this, response.Value), response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } /// <summary> Tries to get details for this resource from the service. </summary> /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> /// <param name="expand"> Expands referenced resources. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="inboundNatRuleName"/> is null. </exception> public virtual Response<bool> Exists(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) { if (inboundNatRuleName == null) { throw new ArgumentNullException(nameof(inboundNatRuleName)); } using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.Exists"); scope.Start(); try { var response = GetIfExists(inboundNatRuleName, expand, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } /// <summary> Tries to get details for this resource from the service. </summary> /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> /// <param name="expand"> Expands referenced resources. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <exception cref="ArgumentNullException"> <paramref name="inboundNatRuleName"/> is null. </exception> public async virtual Task<Response<bool>> ExistsAsync(string inboundNatRuleName, string expand = null, CancellationToken cancellationToken = default) { if (inboundNatRuleName == null) { throw new ArgumentNullException(nameof(inboundNatRuleName)); } using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.ExistsAsync"); scope.Start(); try { var response = await GetIfExistsAsync(inboundNatRuleName, expand, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } /// <summary> Gets all the inbound nat rules in a load balancer. </summary> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <returns> A collection of <see cref="InboundNatRule" /> that may take multiple service requests to iterate over. </returns> public virtual Pageable<InboundNatRule> GetAll(CancellationToken cancellationToken = default) { Page<InboundNatRule> FirstPageFunc(int? pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.GetAll"); scope.Start(); try { var response = _inboundNatRulesRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new InboundNatRule(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } Page<InboundNatRule> NextPageFunc(string nextLink, int? pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.GetAll"); scope.Start(); try { var response = _inboundNatRulesRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new InboundNatRule(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// <summary> Gets all the inbound nat rules in a load balancer. </summary> /// <param name="cancellationToken"> The cancellation token to use. </param> /// <returns> An async collection of <see cref="InboundNatRule" /> that may take multiple service requests to iterate over. </returns> public virtual AsyncPageable<InboundNatRule> GetAllAsync(CancellationToken cancellationToken = default) { async Task<Page<InboundNatRule>> FirstPageFunc(int? pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.GetAll"); scope.Start(); try { var response = await _inboundNatRulesRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new InboundNatRule(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } async Task<Page<InboundNatRule>> NextPageFunc(string nextLink, int? pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("InboundNatRuleCollection.GetAll"); scope.Start(); try { var response = await _inboundNatRulesRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new InboundNatRule(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { scope.Failed(e); throw; } } return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } IEnumerator<InboundNatRule> IEnumerable<InboundNatRule>.GetEnumerator() { return GetAll().GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } IAsyncEnumerator<InboundNatRule> IAsyncEnumerable<InboundNatRule>.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } // Builders. // public ArmBuilder<Azure.Core.ResourceIdentifier, InboundNatRule, InboundNatRuleData> Construct() { } } }
52.013158
282
0.635011
[ "MIT" ]
LGDoor/azure-sdk-for-net
sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleCollection.cs
19,765
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 mediapackage-2017-10-12.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.MediaPackage.Model { /// <summary> /// This is the response object from the DescribeOriginEndpoint operation. /// </summary> public partial class DescribeOriginEndpointResponse : AmazonWebServiceResponse { private string _arn; private string _channelId; private CmafPackage _cmafPackage; private DashPackage _dashPackage; private string _description; private HlsPackage _hlsPackage; private string _id; private string _manifestName; private MssPackage _mssPackage; private int? _startoverWindowSeconds; private Dictionary<string, string> _tags = new Dictionary<string, string>(); private int? _timeDelaySeconds; private string _url; private List<string> _whitelist = new List<string>(); /// <summary> /// Gets and sets the property Arn. The Amazon Resource Name (ARN) assigned to the OriginEndpoint. /// </summary> public string Arn { get { return this._arn; } set { this._arn = value; } } // Check to see if Arn property is set internal bool IsSetArn() { return this._arn != null; } /// <summary> /// Gets and sets the property ChannelId. The ID of the Channel the OriginEndpoint is /// associated with. /// </summary> public string ChannelId { get { return this._channelId; } set { this._channelId = value; } } // Check to see if ChannelId property is set internal bool IsSetChannelId() { return this._channelId != null; } /// <summary> /// Gets and sets the property CmafPackage. /// </summary> public CmafPackage CmafPackage { get { return this._cmafPackage; } set { this._cmafPackage = value; } } // Check to see if CmafPackage property is set internal bool IsSetCmafPackage() { return this._cmafPackage != null; } /// <summary> /// Gets and sets the property DashPackage. /// </summary> public DashPackage DashPackage { get { return this._dashPackage; } set { this._dashPackage = value; } } // Check to see if DashPackage property is set internal bool IsSetDashPackage() { return this._dashPackage != null; } /// <summary> /// Gets and sets the property Description. A short text description of the OriginEndpoint. /// </summary> public string Description { get { return this._description; } set { this._description = value; } } // Check to see if Description property is set internal bool IsSetDescription() { return this._description != null; } /// <summary> /// Gets and sets the property HlsPackage. /// </summary> public HlsPackage HlsPackage { get { return this._hlsPackage; } set { this._hlsPackage = value; } } // Check to see if HlsPackage property is set internal bool IsSetHlsPackage() { return this._hlsPackage != null; } /// <summary> /// Gets and sets the property Id. The ID of the OriginEndpoint. /// </summary> public string Id { get { return this._id; } set { this._id = value; } } // Check to see if Id property is set internal bool IsSetId() { return this._id != null; } /// <summary> /// Gets and sets the property ManifestName. A short string appended to the end of the /// OriginEndpoint URL. /// </summary> public string ManifestName { get { return this._manifestName; } set { this._manifestName = value; } } // Check to see if ManifestName property is set internal bool IsSetManifestName() { return this._manifestName != null; } /// <summary> /// Gets and sets the property MssPackage. /// </summary> public MssPackage MssPackage { get { return this._mssPackage; } set { this._mssPackage = value; } } // Check to see if MssPackage property is set internal bool IsSetMssPackage() { return this._mssPackage != null; } /// <summary> /// Gets and sets the property StartoverWindowSeconds. Maximum duration (seconds) of content /// to retain for startover playback.If not specified, startover playback will be disabled /// for the OriginEndpoint. /// </summary> public int StartoverWindowSeconds { get { return this._startoverWindowSeconds.GetValueOrDefault(); } set { this._startoverWindowSeconds = value; } } // Check to see if StartoverWindowSeconds property is set internal bool IsSetStartoverWindowSeconds() { return this._startoverWindowSeconds.HasValue; } /// <summary> /// Gets and sets the property Tags. /// </summary> public Dictionary<string, string> Tags { get { return this._tags; } set { this._tags = value; } } // Check to see if Tags property is set internal bool IsSetTags() { return this._tags != null && this._tags.Count > 0; } /// <summary> /// Gets and sets the property TimeDelaySeconds. Amount of delay (seconds) to enforce /// on the playback of live content.If not specified, there will be no time delay in effect /// for the OriginEndpoint. /// </summary> public int TimeDelaySeconds { get { return this._timeDelaySeconds.GetValueOrDefault(); } set { this._timeDelaySeconds = value; } } // Check to see if TimeDelaySeconds property is set internal bool IsSetTimeDelaySeconds() { return this._timeDelaySeconds.HasValue; } /// <summary> /// Gets and sets the property Url. The URL of the packaged OriginEndpoint for consumption. /// </summary> public string Url { get { return this._url; } set { this._url = value; } } // Check to see if Url property is set internal bool IsSetUrl() { return this._url != null; } /// <summary> /// Gets and sets the property Whitelist. A list of source IP CIDR blocks that will be /// allowed to access the OriginEndpoint. /// </summary> public List<string> Whitelist { get { return this._whitelist; } set { this._whitelist = value; } } // Check to see if Whitelist property is set internal bool IsSetWhitelist() { return this._whitelist != null && this._whitelist.Count > 0; } } }
30.630597
110
0.57169
[ "Apache-2.0" ]
FoxBearBear/aws-sdk-net
sdk/src/Services/MediaPackage/Generated/Model/DescribeOriginEndpointResponse.cs
8,209
C#
using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.Playwright.Testing.Xunit; using Microsoft.Playwright.Tests.BaseTests; using Xunit; using Xunit.Abstractions; namespace Microsoft.Playwright.Tests { [Collection(TestConstants.TestFixtureBrowserCollectionName)] public class ClickNavigationTests : PlaywrightSharpPageBaseTest { /// <inheritdoc/> public ClickNavigationTests(ITestOutputHelper output) : base(output) { } [PlaywrightTest("page-navigation.spec.ts", "should work with _blank target")] [Fact(Timeout = TestConstants.DefaultTestTimeout)] public async Task ShouldWorkWithBblankTarget() { Server.SetRoute("/empty.html", ctx => ctx.Response.WriteAsync($"<a href=\"{TestConstants.EmptyPage}\" target=\"_blank\">Click me</a>")); await Page.GoToAsync(TestConstants.EmptyPage); await Page.ClickAsync("\"Click me\""); } [PlaywrightTest("page-navigation.spec.ts", "should work with cross-process _blank target")] [Fact(Timeout = TestConstants.DefaultTestTimeout)] public async Task ShouldWorkWithCrossProcessBlankTarget() { Server.SetRoute("/empty.html", ctx => ctx.Response.WriteAsync($"<a href=\"{TestConstants.CrossProcessUrl}/empty.html\" target=\"_blank\">Click me</a>")); await Page.GoToAsync(TestConstants.EmptyPage); await Page.ClickAsync("\"Click me\""); } } }
39.076923
127
0.667979
[ "MIT" ]
hardkoded/playwright-sharp
src/Playwright.Tests/PageNavigationTests.cs
1,524
C#
using System; using System.Collections.Generic; using RedOwl.UIX.Engine; using UnityEditor; using UnityEngine; using UnityEngine.UIElements; namespace RedOwl.UIX.Editor { [CustomPropertyDrawer(typeof(ImplementationPicker))] public class ImplementationPickerDrawer : PropertyDrawer { private List<Type> _implementations; private List<GUIContent> _implementationTitles; private int _selectedIndex; public override VisualElement CreatePropertyGUI(SerializedProperty property) { // TODO: Convert to VisualElement return null; } public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (_implementations == null || GUILayout.Button("Refresh")) { _implementations = new List<Type>(TypeExtensions.GetAllTypes(((ImplementationPicker) attribute).type)); _implementationTitles = new List<GUIContent>(_implementations.Count); foreach (var type in _implementations) { _implementationTitles.Add(new GUIContent(type.SafeGetName())); } } EditorGUILayout.LabelField($"Found {_implementations.Count} implementations"); _selectedIndex = EditorGUILayout.Popup(new GUIContent("Implementations"), _selectedIndex, _implementationTitles.ToArray()); if (GUILayout.Button("Create")) { property.managedReferenceValue = Activator.CreateInstance(_implementations[_selectedIndex]); } EditorGUILayout.PropertyField(property, true); } } }
37.297872
136
0.630348
[ "Unlicense" ]
red-owl-games/UIX
Editor/ImplementationPickerDrawer.cs
1,753
C#
#if CS101 && !BizTalk using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.Runtime.InteropServices; using CSLibrary.Barcode; using CSLibrary.Barcode.Constants; using CSLibrary.Barcode.Structures; namespace CSLibrary.Barcode { internal class MessageWindows : MessageWindow { /// <summary> /// BarcodeEventHandler : Capture completed event trigger /// </summary> public event Barcode.BarcodeEventHandler m_captureCompleted; /// <summary> /// BarcodeStateEventHandler : report current operation /// </summary> public event Barcode.BarcodeStateEventHandler m_stateChanged; public MessageWindows() { } /// <summary> /// Override the default WndProc behavior to examine messages. /// </summary> /// <param name="msg"></param> protected override void WndProc(ref Microsoft.WindowsCE.Forms.Message msg) { try { switch ((WM_ID)msg.Msg) { // If message is of interest, invoke the method on the form that // functions as a callback to perform actions in response to the message. case WM_ID.WM_SDK_EVENT_HWND_MSG: Debug.WriteLine("WM_SDK_EVENT_HWND_MSG"); EventType eventType = (EventType)msg.WParam; // Event type string tcErrMsg = ""; // Error message buffer. Result nResult = Result.INITIALIZE; // Return code. try { if (eventType == EventType.BARCODE_EVENT) // Verify the event type is barcode { #region Barcode Message Debug.WriteLine("BARCODE_EVENT"); DecodeMessage decodeInfo = new DecodeMessage(); // Decode message structure. RawDecodeMessage rawInfo = new RawDecodeMessage(); if (Barcode.bCaptureDecoded) { if ((nResult = Barcode.GetAsyncResult(ref eventType, decodeInfo)) != Result.SUCCESS) { Barcode.GetErrorMessage(nResult, ref tcErrMsg); throw new System.Exception(tcErrMsg); } if (m_captureCompleted != null) m_captureCompleted(new BarcodeEventArgs(MessageType.DEC_MSG, decodeInfo)); } else { if ((nResult = Barcode.GetAsyncResult(ref eventType, rawInfo)) != Result.SUCCESS) { Barcode.GetErrorMessage(nResult, ref tcErrMsg); throw new System.Exception(tcErrMsg); } if (m_captureCompleted != null) m_captureCompleted(new BarcodeEventArgs(MessageType.RAW_MSG, decodeInfo)); } if (!Barcode.bStop) { if (Barcode.bCaptureDecoded) { if ((nResult = Barcode.CaptureBarcode(null, 0, false)) != Result.SUCCESS) { Barcode.GetErrorMessage(nResult, ref tcErrMsg); throw new System.Exception(tcErrMsg); } } else { if ((nResult = Barcode.CaptureRawBarcode(null, 0, false)) != Result.SUCCESS) { Barcode.GetErrorMessage(nResult, ref tcErrMsg); throw new System.Exception(tcErrMsg); } } } else { if (m_stateChanged != null) m_stateChanged(new BarcodeStateEventArgs(BarcodeState.IDLE)); Barcode.bStop = false; } #endregion } } catch { if (m_stateChanged != null) m_stateChanged(new BarcodeStateEventArgs(BarcodeState.IDLE)); Barcode.bStop = false; } /*else if (eventType == EVENT_TYPE.IMAGE_EVENT) // Verify the event type is image { #region Image Debug.WriteLine("IMAGE_EVENT"); IMAGER_CAPS imgcap = new IMAGER_CAPS(); if ((nResult = Barcode.ReadImagerCapabilities(imgcap)) != RESULT.SUCCESS) { Barcode.GetErrorMessage(nResult, ref tcErrMsg); //Display error message throw new System.Exception(tcErrMsg); } int imageSize = imgcap.fullImgSize.width * imgcap.fullImgSize.height * 2; IMAGE image = new IMAGE(); //image structure. // Set the IMAGE structure size and allocate a buffer for the data, // set the buffer size and how we want to receive the data in the buffer. image.puchBuffer = Marshal.AllocHGlobal(imageSize); // Allocate a buffer big enough to hold 640x480x8 plus header (if BMP) image.nBufferSize = imageSize; // SDK wants to know how big the buffer is so there's no overflow image.imageFormat = IMG_FORMATS.FF_BMP_GRAY; // 8 bit bmp file format data if ((nResult = Barcode.GetAsyncResult(ref eventType, image)) == RESULT.SUCCESS) { // save image data to a bmp file and/or display it if (m_captureCompleted != null) { m_captureCompleted(new BarcodeEventArgs(MSG_TYPE.IMG_MSG, image)); } } else { Barcode.GetErrorMessage(nResult, ref tcErrMsg); //Display error message throw new System.Exception(tcErrMsg); } //Free allocated memory if (image.puchBuffer != IntPtr.Zero) { Marshal.FreeHGlobal(image.puchBuffer); } #endregion } */ break; case WM_ID.WM_SDK_IMAGER_FLASHING: Debug.WriteLine("WM_SDK_IMAGER_FLASHING"); break; case WM_ID.WM_SDK_POWER_EVENT: Debug.WriteLine("WM_SDK_POWER_EVENT"); break; case WM_ID.WM_SDK_PROGRESS_HWND_MSG: Debug.WriteLine("WM_SDK_PROGRESS_HWND_MSG"); break; case WM_ID.WM_SDK_SEQ_BARCODE_READ: Debug.WriteLine("WM_SDK_SEQ_BARCODE_READ"); break; } } catch (System.Exception ex) { if (m_captureCompleted != null) { m_captureCompleted(new BarcodeEventArgs(MessageType.ERR_MSG, ex.Message)); } if (m_stateChanged != null) { m_stateChanged(new BarcodeStateEventArgs(BarcodeState.IDLE)); } Barcode.bStop = false; CSLibrary.SysLogger.LogError(ex); } // Call the base WndProc method // to process any messages not handled. base.WndProc(ref msg); } } } #endif
48.510417
153
0.409598
[ "MIT" ]
cslrfid/CSL-Callback-Unified-SDK-App
Library Source/CSLibrary.Barcode/CSLibrary.Barcode.MsgWnd.cs
9,314
C#
// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Generated code. DO NOT EDIT! namespace Google.Cloud.Firestore.V1.Snippets { using Google.Cloud.Firestore.V1; public sealed partial class GeneratedFirestoreClientStandaloneSnippets { /// <summary>Snippet for UpdateDocument</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void UpdateDocumentRequestObject() { // Create client FirestoreClient firestoreClient = FirestoreClient.Create(); // Initialize request argument(s) UpdateDocumentRequest request = new UpdateDocumentRequest { Document = new Document(), UpdateMask = new DocumentMask(), Mask = new DocumentMask(), CurrentDocument = new Precondition(), }; // Make the request Document response = firestoreClient.UpdateDocument(request); } } }
37.088889
89
0.65728
[ "Apache-2.0" ]
googleapis/googleapis-gen
google/firestore/v1/google-cloud-firestore-v1-csharp/Google.Cloud.Firestore.V1.StandaloneSnippets/FirestoreClient.UpdateDocumentRequestObjectSnippet.g.cs
1,669
C#
using System; using System.Collections.Generic; using System.Linq; namespace NumberArray { class Program { static void Main(string[] args) { List<int> numbers = Console .ReadLine() .Split() .Select(int.Parse) .ToList(); string input; int index = 0; int value = 0; while ((input = Console.ReadLine()) != "End") { string[] commands = input .Split() .ToArray(); switch (commands[0]) { case "Switch": index = int.Parse(commands[1]); SwitchingNumbers(numbers, index); break; case "Change": index = int.Parse(commands[1]); value = int.Parse(commands[2]); ChangingNumbers(numbers, index, value); break; case "Sum": switch (commands[1]) { case "Negative": Console.WriteLine(SummingNegativesNumbers(numbers)); break; case "Positive": Console.WriteLine(SummingPositivesNumbers(numbers)); break; case "All": Console.WriteLine(SummingAllNumbers(numbers)); break; } break; } } PrintingAllPositives(numbers); } static void SwitchingNumbers(List<int> numbers, int index) { if (index >= 0 && index < numbers.Count) { int value = numbers[index]; numbers[index] = value - (2 * value); } } static void ChangingNumbers(List<int> numbers, int index, int value) { if (index >= 0 && index < numbers.Count) { numbers[index] = value; } } static int SummingNegativesNumbers(List<int> numbers) { int negativesSum = 0; for (int i = 0; i < numbers.Count; i++) { if (numbers[i] < 0) { negativesSum += numbers[i]; } } return negativesSum; } static int SummingPositivesNumbers(List<int> numbers) { int positivesSum = 0; for (int i = 0; i < numbers.Count; i++) { if (numbers[i] >= 0) { positivesSum += numbers[i]; } } return positivesSum; } static int SummingAllNumbers(List<int> numbers) { int allSum = numbers.Sum(); return allSum; } static void PrintingAllPositives(List<int> numbers) { for (int i = 0; i < numbers.Count; i++) { if (numbers[i] >= 0) { Console.Write(numbers[i] + " "); } } } } }
27.031496
84
0.379551
[ "MIT" ]
georgidelchev/C-Fundamentals-Tasks
[Programming Fundamentals - Exams]/[Middle Exams]/04 - [Programming Fundamentals Mid Exam - 30 June 2019 Group 1]/02 - [Number Array]/Program.cs
3,435
C#
namespace P02_DatabaseFirst.Data { using Microsoft.EntityFrameworkCore; using Models; public class SoftUniContext : DbContext { public DbSet<Address> Addresses { get; set; } public DbSet<Department> Departments { get; set; } public DbSet<Employee> Employees { get; set; } public DbSet<EmployeeProject> EmployeesProjects { get; set; } public DbSet<Project> Projects { get; set; } public DbSet<Town> Towns { get; set; } public SoftUniContext() { } public SoftUniContext(DbContextOptions options) : base(options) { } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { optionsBuilder.UseSqlServer(Configuration.ConnectionString); } } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Address>(entity => { entity.HasKey(e => e.AddressId); entity.Property(e => e.AddressId).HasColumnName("AddressID"); entity.Property(e => e.AddressText) .IsRequired() .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.TownId).HasColumnName("TownID"); entity.HasOne(d => d.Town) .WithMany(p => p.Addresses) .HasForeignKey(d => d.TownId) .HasConstraintName("FK_Addresses_Towns"); }); modelBuilder.Entity<Department>(entity => { entity.HasKey(e => e.DepartmentId); entity.Property(e => e.DepartmentId).HasColumnName("DepartmentID"); entity.Property(e => e.ManagerId).HasColumnName("ManagerID"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(50) .IsUnicode(false); entity.HasOne(d => d.Manager) .WithMany(p => p.Departments) .HasForeignKey(d => d.ManagerId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Departments_Employees"); }); modelBuilder.Entity<Employee>(entity => { entity.HasKey(e => e.EmployeeId); entity.Property(e => e.EmployeeId).HasColumnName("EmployeeID"); entity.Property(e => e.AddressId).HasColumnName("AddressID"); entity.Property(e => e.DepartmentId).HasColumnName("DepartmentID"); entity.Property(e => e.FirstName) .IsRequired() .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.HireDate).HasColumnType("smalldatetime"); entity.Property(e => e.JobTitle) .IsRequired() .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.LastName) .IsRequired() .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.ManagerId).HasColumnName("ManagerID"); entity.Property(e => e.MiddleName) .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.Salary).HasColumnType("money"); entity.HasOne(d => d.Address) .WithMany(p => p.Employees) .HasForeignKey(d => d.AddressId) .HasConstraintName("FK_Employees_Addresses"); entity.HasOne(d => d.Department) .WithMany(p => p.Employees) .HasForeignKey(d => d.DepartmentId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Employees_Departments"); entity.HasOne(d => d.Manager) .WithMany(p => p.ManagedEmployees) .HasForeignKey(d => d.ManagerId) .HasConstraintName("FK_Employees_Employees"); }); modelBuilder.Entity<EmployeeProject>(entity => { entity.HasKey(e => new { e.EmployeeId, e.ProjectId }); entity.Property(e => e.EmployeeId).HasColumnName("EmployeeID"); entity.Property(e => e.ProjectId).HasColumnName("ProjectID"); entity.HasOne(d => d.Employee) .WithMany(p => p.EmployeesProjects) .HasForeignKey(d => d.EmployeeId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_EmployeesProjects_Employees"); entity.HasOne(d => d.Project) .WithMany(p => p.EmployeesProjects) .HasForeignKey(d => d.ProjectId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_EmployeesProjects_Projects"); }); modelBuilder.Entity<Project>(entity => { entity.HasKey(e => e.ProjectId); entity.Property(e => e.ProjectId).HasColumnName("ProjectID"); entity.Property(e => e.Description).HasColumnType("ntext"); entity.Property(e => e.EndDate).HasColumnType("smalldatetime"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.StartDate).HasColumnType("smalldatetime"); }); modelBuilder.Entity<Town>(entity => { entity.HasKey(e => e.TownId); entity.Property(e => e.TownId).HasColumnName("TownID"); entity.Property(e => e.Name) .IsRequired() .HasMaxLength(50) .IsUnicode(false); }); } } }
35.431034
85
0.509813
[ "MIT" ]
melikpehlivanov/Databases-Advanced-Entity-Framework-June-2018
Exercises - Introduction to Entity Framework/P02_DatabaseFirst/Data/SoftUniContext.cs
6,167
C#
//------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a CodeSmith Template. // // DO NOT MODIFY contents of this file. Changes to this // file will be lost if the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.Text; namespace Ugly.Data.Entities { public partial class Template { public Template() { LinkTemplateDepends = new HashSet<TemplateDepend>(); DependTemplateDepends = new HashSet<TemplateDepend>(); } public int TemplateID { get; set; } public string TemplateName { get; set; } public virtual ICollection<TemplateDepend> LinkTemplateDepends { get; set; } public virtual ICollection<TemplateDepend> DependTemplateDepends { get; set; } } }
33.275862
86
0.554404
[ "Apache-2.0" ]
loresoft/PLINQO.EntityFrameworkCore
Source/Samples/Ugly.Data/Entities/Template.Generated.cs
967
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("AirConditionerTesterSystem.Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AirConditionerTesterSystem.Core")] [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("f6f0bb9b-0b33-41ab-82ea-6c3e6f844b00")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
39.621622
85
0.734652
[ "MIT" ]
stoyanov7/SoftwareUniversity
C#Development/HighQualityCode/AirConditionerTesterSystem/AirConditionerTesterSystem.Core/Properties/AssemblyInfo.cs
1,469
C#
using CsvHelper; using HtmlAgilityPack; using Newtonsoft.Json; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Web; using WebVella.Erp.Api; using WebVella.Erp.Api.Models; using WebVella.Erp.Web.Models; using WebVella.Erp.Web.Utils; namespace WebVella.Erp.Web.Services { public class RenderService { private static List<IconFontAwesome> fontAwesomeIcons = null; public static List<IconFontAwesome> FontAwesomeIcons { get { if(fontAwesomeIcons == null) fontAwesomeIcons = GetAllFontAwesomeIcons().OrderBy(x=> x.Name).ToList(); return fontAwesomeIcons; } } public string GetPathTypeIcon(string filePath) { var fontAwesomeIconName = "fa-file"; if (filePath.EndsWith(".txt")) { fontAwesomeIconName = "fa-file-alt"; } else if (filePath.EndsWith(".pdf")) { fontAwesomeIconName = "fa-file-pdf"; } else if (filePath.EndsWith(".doc") || filePath.EndsWith(".docx")) { fontAwesomeIconName = "fa-file-word"; } else if (filePath.EndsWith(".xls") || filePath.EndsWith(".xlsx")) { fontAwesomeIconName = "fa-file-excel"; } else if (filePath.EndsWith(".ppt") || filePath.EndsWith(".pptx")) { fontAwesomeIconName = "fa-file-powerpoint"; } else if (filePath.EndsWith(".gif") || filePath.EndsWith(".jpg") || filePath.EndsWith(".jpeg") || filePath.EndsWith(".png") || filePath.EndsWith(".bmp") || filePath.EndsWith(".tif")) { fontAwesomeIconName = "fa-file-image"; } else if (filePath.EndsWith(".zip") || filePath.EndsWith(".zipx") || filePath.EndsWith(".rar") || filePath.EndsWith(".tar") || filePath.EndsWith(".gz") || filePath.EndsWith(".dmg") || filePath.EndsWith(".iso")) { fontAwesomeIconName = "fa-file-archive"; } else if (filePath.EndsWith(".wav") || filePath.EndsWith(".mp3") || filePath.EndsWith(".fla") || filePath.EndsWith(".flac") || filePath.EndsWith(".ra") || filePath.EndsWith(".rma") || filePath.EndsWith(".aif") || filePath.EndsWith(".aiff") || filePath.EndsWith(".aa") || filePath.EndsWith(".aac") || filePath.EndsWith(".aax") || filePath.EndsWith(".ac3") || filePath.EndsWith(".au") || filePath.EndsWith(".ogg") || filePath.EndsWith(".avr") || filePath.EndsWith(".3ga") || filePath.EndsWith(".mid") || filePath.EndsWith(".midi") || filePath.EndsWith(".m4a") || filePath.EndsWith(".mp4a") || filePath.EndsWith(".amz") || filePath.EndsWith(".mka") || filePath.EndsWith(".asx") || filePath.EndsWith(".pcm") || filePath.EndsWith(".m3u") || filePath.EndsWith(".wma") || filePath.EndsWith(".xwma")) { fontAwesomeIconName = "fa-file-audio"; } else if (filePath.EndsWith(".avi") || filePath.EndsWith(".mpg") || filePath.EndsWith(".mp4") || filePath.EndsWith(".mkv") || filePath.EndsWith(".mov") || filePath.EndsWith(".wmv") || filePath.EndsWith(".vp6") || filePath.EndsWith(".264") || filePath.EndsWith(".vid") || filePath.EndsWith(".rv") || filePath.EndsWith(".webm") || filePath.EndsWith(".swf") || filePath.EndsWith(".h264") || filePath.EndsWith(".flv") || filePath.EndsWith(".mk3d") || filePath.EndsWith(".gifv") || filePath.EndsWith(".oggv") || filePath.EndsWith(".3gp") || filePath.EndsWith(".m4v") || filePath.EndsWith(".movie") || filePath.EndsWith(".divx")) { fontAwesomeIconName = "fa-file-video"; } else if (filePath.EndsWith(".c") || filePath.EndsWith(".cpp") || filePath.EndsWith(".css") || filePath.EndsWith(".js") || filePath.EndsWith(".py") || filePath.EndsWith(".git") || filePath.EndsWith(".cs") || filePath.EndsWith(".cshtml") || filePath.EndsWith(".xml") || filePath.EndsWith(".html") || filePath.EndsWith(".ini") || filePath.EndsWith(".config") || filePath.EndsWith(".json") || filePath.EndsWith(".h")) { fontAwesomeIconName = "fa-file-code"; } else if (filePath.EndsWith(".exe") || filePath.EndsWith(".jar") || filePath.EndsWith(".dll") || filePath.EndsWith(".bat") || filePath.EndsWith(".pl") || filePath.EndsWith(".scr") || filePath.EndsWith(".msi") || filePath.EndsWith(".app") || filePath.EndsWith(".deb") || filePath.EndsWith(".apk") || filePath.EndsWith(".jar") || filePath.EndsWith(".vb") || filePath.EndsWith(".prg") || filePath.EndsWith(".sh")) { fontAwesomeIconName = "fa-cogs"; } else if (filePath.EndsWith(".com") || filePath.EndsWith(".net") || filePath.EndsWith(".org") || filePath.EndsWith(".edu") || filePath.EndsWith(".gov") || filePath.EndsWith(".mil") || filePath.EndsWith("/") || filePath.EndsWith(".html") || filePath.EndsWith(".htm") || filePath.EndsWith(".xhtml") || filePath.EndsWith(".jhtml") || filePath.EndsWith(".php") || filePath.EndsWith(".php3") || filePath.EndsWith(".php4") || filePath.EndsWith(".php5") || filePath.EndsWith(".phtml") || filePath.EndsWith(".asp") || filePath.EndsWith(".aspx") || filePath.EndsWith(".aspx") || filePath.EndsWith("?") || filePath.EndsWith("#")) { fontAwesomeIconName = "fa-globe"; } return fontAwesomeIconName; } public string RenderHtmlWithTemplate(string template, EntityRecord record = null, ErpRequestContext requestContext = null, ErpAppContext appContext = null) { var foundTags = Regex.Matches(template, @"(?<=\{\{)[^}]*(?=\}\})").Cast<Match>().Select(match => match.Value).Distinct().ToList(); foreach (var tag in foundTags) { var processedTag = tag.Replace("{{", "").Replace("}}", "").Trim(); var defaultValue = ""; if (processedTag.Contains("??")) { //this is a tag with a default value int questionMarksLocation = processedTag.IndexOf("??"); var tagValue = processedTag.Substring(0, questionMarksLocation).Trim(); var tagDefault = processedTag.Substring(questionMarksLocation + 2).Trim().Replace("\"", "").Replace("'", ""); processedTag = tagValue; defaultValue = tagDefault; } if (processedTag.StartsWith("Record[") && record != null) { //{{Record["fieldName"]}} var fieldName = processedTag.Replace("Record[\"", "").Replace("\"]", "").ToLowerInvariant(); if (record.Properties.ContainsKey(fieldName) && record[fieldName] != null) { template = template.Replace("{{" + tag + "}}", record[fieldName].ToString()); } else { template = template.Replace("{{" + tag + "}}", defaultValue); } } else if (processedTag.StartsWith("ErpRequestContext.") && requestContext != null) { var propertyPath = processedTag.Replace("ErpRequestContext.", ""); var propertyValue = requestContext.GetPropValue(propertyPath); if (propertyValue != null) { template = template.Replace("{{" + tag + "}}", propertyValue.ToString()); } else { template = template.Replace("{{" + tag + "}}", defaultValue); } } else if (processedTag.StartsWith("ErpAppContext.") && requestContext != null) { var propertyPath = processedTag.Replace("ErpAppContext.", ""); var propertyValue = requestContext.GetPropValue(propertyPath); if (propertyValue != null) { template = template.Replace("{{" + tag + "}}", propertyValue.ToString()); } else { template = template.Replace("{{" + tag + "}}", defaultValue); } } else if (processedTag.StartsWith("ListMeta.") && requestContext != null) { var propertyPath = processedTag.Replace("ListMeta.", ""); var propertyValue = requestContext.GetPropValue(propertyPath); if (propertyValue != null) { template = template.Replace("{{" + tag + "}}", propertyValue.ToString()); } else { template = template.Replace("{{" + tag + "}}", defaultValue); } } else if (processedTag.StartsWith("ViewMeta.") && requestContext != null) { var propertyPath = processedTag.Replace("ViewMeta.", ""); var propertyValue = requestContext.GetPropValue(propertyPath); if (propertyValue != null) { template = template.Replace("{{" + tag + "}}", propertyValue.ToString()); } else { template = template.Replace("{{" + tag + "}}", defaultValue); } } else if (processedTag.StartsWith("erp-allow-roles") && processedTag.Contains("=")) { //Check if "erp-authorize" is present var authoriseTag = foundTags.FirstOrDefault(x => x.Contains("erp-authorize")); if (authoriseTag != null) { var tagArray = processedTag.Split('='); var rolesCsv = tagArray[1].Replace("\"", "").Replace("\"", "").ToLowerInvariant(); var rolesList = rolesCsv.Split(',').ToList(); var currentUser = SecurityContext.CurrentUser; if (currentUser == null && !rolesList.Any(x => x == "guest")) { return ""; } var authorized = false; foreach (var askedRole in rolesList) { if (currentUser.Roles.Any(x => x.Name == askedRole)) { authorized = true; break; } } if (!authorized) { return ""; } } } else if (processedTag.StartsWith("erp-block-roles") && processedTag.Contains("=")) { //Check if "erp-authorize" is present var authoriseTag = foundTags.FirstOrDefault(x => x.Contains("erp-authorize")); if (authoriseTag != null) { var tagArray = processedTag.Split('='); var rolesCsv = tagArray[1].Replace("\"", "").Replace("\"", "").ToLowerInvariant(); var rolesList = rolesCsv.Split(',').ToList(); var currentUser = SecurityContext.CurrentUser; if (currentUser == null && rolesList.Any(x => x == "guest")) { return ""; } var authorized = true; foreach (var askedRole in rolesList) { if (currentUser.Roles.Any(x => x.Name == askedRole)) { authorized = false; break; } } if (!authorized) { return ""; } } } else if (processedTag == "CurrentUrlEncoded" && requestContext != null && requestContext.PageContext != null && requestContext.PageContext.HttpContext != null && requestContext.PageContext.HttpContext.Request != null) { var currentUrl = requestContext.PageContext.HttpContext.Request.Path + requestContext.PageContext.HttpContext.Request.QueryString; var propertyValue = HttpUtility.UrlEncode(currentUrl); if (!String.IsNullOrWhiteSpace(propertyValue)) { template = template.Replace("{{" + tag + "}}", propertyValue); } else { template = template.Replace("{{" + tag + "}}", defaultValue); } } } //Tags that depend on others to be already applied foreach (var tag in foundTags) { var processedTag = tag.Replace("{{", "").Replace("}}", "").Trim(); if (processedTag == "erp-active-page-equals") { //erp-active-page-equals var tagComplete = "{{" + processedTag + "}}"; HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument(); htmlDocument.LoadHtml(template); var links = htmlDocument.DocumentNode.SelectNodes("//a[@href]"); foreach (var link in links) { var hrefString = link.GetAttributeValue("href", ""); var erpTag = link.Attributes.FirstOrDefault(x => x.Name == tagComplete); var emptyTag = link.Attributes.FirstOrDefault(x => x.Name == "dasdasd"); if (erpTag != null) { if (!String.IsNullOrWhiteSpace(hrefString) && requestContext != null && requestContext.PageContext != null) { string currentUrl = requestContext.PageContext.HttpContext.Request.Path.ToString().ToLowerInvariant(); if (currentUrl == hrefString) { var classes = link.GetClasses().ToList(); if (classes.FirstOrDefault(x => x == "active") == null) { classes.Add("active"); link.SetAttributeValue("class", String.Join(" ", classes)); } } } link.Attributes.Remove(tagComplete); } } template = htmlDocument.DocumentNode.InnerHtml; } else if (processedTag == "erp-active-page-starts") { //erp-active-page-equals var tagComplete = "{{" + processedTag + "}}"; HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument(); htmlDocument.LoadHtml(template); var links = htmlDocument.DocumentNode.SelectNodes("//a[@href]"); foreach (var link in links) { var hrefString = link.GetAttributeValue("href", ""); var erpTag = link.Attributes.FirstOrDefault(x => x.Name == tagComplete); var emptyTag = link.Attributes.FirstOrDefault(x => x.Name == "dasdasd"); if (erpTag != null) { if (!String.IsNullOrWhiteSpace(hrefString) && requestContext != null && requestContext.PageContext != null) { string currentUrl = requestContext.PageContext.HttpContext.Request.Path.ToString().ToLowerInvariant(); if (currentUrl.StartsWith(hrefString)) { var classes = link.GetClasses().ToList(); if (classes.FirstOrDefault(x => x == "active") == null) { classes.Add("active"); link.SetAttributeValue("class", String.Join(" ", classes)); } } } link.Attributes.Remove(tagComplete); } } template = htmlDocument.DocumentNode.InnerHtml; } } return template; } public string GetSnippetFromHtml(string html, int snippetLength = 150) { var result = ""; if (!String.IsNullOrWhiteSpace(html)) { HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); var root = doc.DocumentNode; var sb = new StringBuilder(); foreach (var node in root.DescendantsAndSelf()) { if (!node.HasChildNodes) { string text = node.InnerText; if (!string.IsNullOrEmpty(text)) sb.AppendLine(text.Trim()); } } result = sb.ToString(); if (result.Length > snippetLength) { result = sb.ToString().Substring(0, 150); result += "..."; } } return result; } private string GetValueFromPropertyPath(dynamic Obj, string[] PropertyPath) { dynamic pathPropertyValue = null; var result = ""; if (Obj == null) { return result; } //If there is property defined if (PropertyPath.Length > 0) { var processedProperty = PropertyPath[0]; //Check if there is an index requested. Like ListMeta.Columns[0].Name -> the property will be "Column[0]" var foundIndexes = Regex.Matches(processedProperty, @"\[(.*)\]").Cast<Match>().Select(match => match.Value).Distinct().ToList(); if (foundIndexes.Count == 0) { //No indexes are requests pathPropertyValue = Obj.GetType().GetProperty(processedProperty).GetValue(Obj, null); return pathPropertyValue.ToString(); } else { //There are indexes. THis supports event the case with more then one index -> "Column[0][2]" int firstBracketLocation = processedProperty.IndexOf('['); var extractedProperty = processedProperty.Substring(0, firstBracketLocation); var listProperty = Obj.GetType().GetProperty(extractedProperty).GetValue(Obj, null) as IList; var processedIndexes = 1; foreach (var currentIndex in foundIndexes) { int outInt = 0; var processedIndex = currentIndex.Replace("[", "").Replace("]", ""); if (Int32.TryParse(processedIndex, out outInt)) { if (processedIndexes == foundIndexes.Count()) { //There are no more indexes, so this should not be a list pathPropertyValue = listProperty[outInt]; } else { //There are indexes so this should be a list and we should continue to itterate listProperty = listProperty[outInt] as IList; } } else { throw new Exception("Index in Action item template is not an int: " + processedIndex); } processedIndexes++; } PropertyPath = PropertyPath.Skip(1).ToArray();//Remove the processed property from the array path result = GetValueFromPropertyPath(pathPropertyValue, PropertyPath); } } return result; } public List<dynamic> GetCsvData(string csvData, bool hasHeader = true, string delimiterName = "") { var records = new List<dynamic>(); using (TextReader reader = new StringReader(csvData)) { using (var csvReader = new CsvReader(reader)) { switch (delimiterName) { case "tab": csvReader.Configuration.Delimiter = "\t"; break; default: break; } csvReader.Configuration.Encoding = Encoding.UTF8; csvReader.Configuration.IgnoreBlankLines = true; csvReader.Configuration.BadDataFound = null; csvReader.Configuration.TrimOptions = CsvHelper.Configuration.TrimOptions.Trim; csvReader.Configuration.HasHeaderRecord = hasHeader; if (hasHeader) { var headerList = GetCsvHeader(csvData, delimiterName); csvReader.Configuration.PrepareHeaderForMatch = (string header, int index) => headerList[index]; } records = csvReader.GetRecords<dynamic>().ToList(); } } return records; } public List<string> GetCsvHeader(string csvData, string delimiterName = "") { var records = new List<dynamic>(); var headerList = new List<string>(); using (TextReader reader = new StringReader(csvData)) { using (var csvReader = new CsvReader(reader)) { switch (delimiterName) { case "tab": csvReader.Configuration.Delimiter = "\t"; break; default: break; } csvReader.Configuration.Encoding = Encoding.UTF8; csvReader.Configuration.IgnoreBlankLines = true; csvReader.Configuration.BadDataFound = null; csvReader.Configuration.TrimOptions = CsvHelper.Configuration.TrimOptions.Trim; csvReader.Configuration.HasHeaderRecord = false; records = csvReader.GetRecords<dynamic>().ToList(); if (records.Count > 0) { //First row is headers -> we are getting them this way to bypass duplicate headers name problem foreach (KeyValuePair<string, object> prop in records[0]) { string header = prop.Value.ToString().Trim(); if (headerList.Contains(header)) { var g = 2; var newHeader = header; while (true) { newHeader = header + g; if (!headerList.Contains(newHeader)) { headerList.Add(newHeader); break; } g++; } } else { headerList.Add(header); } } } } } return headerList; } public string GetCacheKey() { var key = ErpSettings.CacheKey; if (String.IsNullOrWhiteSpace(key)) key = DateTime.Now.ToString("yyyyMMddHHmmss"); return key; } private static List<IconFontAwesome> GetAllFontAwesomeIcons(){ var icons = new List<IconFontAwesome>(); #region << Icon Json >> var json = @" { ""fab fa-buromobelexperte"": ""&#xf37f; B\u00fcrom\u00f6bel-Experte GmbH & Co. KG. brands"", ""fas fa-burn"": ""&#xf46a; Burn solid"", ""fas fa-bullseye"": ""&#xf140; Bullseye solid"", ""fas fa-bullhorn"": ""&#xf0a1; bullhorn solid"", ""fas fa-building"": ""&#xf1ad; Building solid"", ""far fa-building"": ""&#xf1ad; Building regular"", ""fas fa-bug"": ""&#xf188; Bug solid"", ""fab fa-btc"": ""&#xf15a; BTC brands"", ""fas fa-briefcase-medical"": ""&#xf469; Medical Briefcase solid"", ""fas fa-briefcase"": ""&#xf0b1; Briefcase solid"", ""fas fa-braille"": ""&#xf2a1; Braille solid"", ""fas fa-boxes"": ""&#xf468; Boxes solid"", ""fas fa-box-open"": ""&#xf49e; Box Open solid"", ""fas fa-box"": ""&#xf466; Box solid"", ""fas fa-bowling-ball"": ""&#xf436; Bowling Ball solid"", ""fas fa-bookmark"": ""&#xf02e; bookmark solid"", ""far fa-bookmark"": ""&#xf02e; bookmark regular"", ""fas fa-book"": ""&#xf02d; book solid"", ""fas fa-bomb"": ""&#xf1e2; Bomb solid"", ""fas fa-bolt"": ""&#xf0e7; Lightning Bolt solid"", ""fas fa-bold"": ""&#xf032; bold solid"", ""fab fa-bluetooth-b"": ""&#xf294; Bluetooth brands"", ""fab fa-bluetooth"": ""&#xf293; Bluetooth brands"", ""fab fa-blogger-b"": ""&#xf37d; Blogger B brands"", ""fab fa-blogger"": ""&#xf37c; Blogger brands"", ""fas fa-blind"": ""&#xf29d; Blind solid"", ""fab fa-blackberry"": ""&#xf37b; BlackBerry brands"", ""fab fa-black-tie"": ""&#xf27e; Font Awesome Black Tie brands"", ""fab fa-bity"": ""&#xf37a; Bity brands"", ""fab fa-bitcoin"": ""&#xf379; Bitcoin brands"", ""fab fa-bitbucket"": ""&#xf171; Bitbucket brands"", ""fas fa-birthday-cake"": ""&#xf1fd; Birthday Cake solid"", ""fas fa-binoculars"": ""&#xf1e5; Binoculars solid"", ""fab fa-bimobject"": ""&#xf378; BIMobject brands"", ""fas fa-bicycle"": ""&#xf206; Bicycle solid"", ""fas fa-bell-slash"": ""&#xf1f6; Bell Slash solid"", ""far fa-bell-slash"": ""&#xf1f6; Bell Slash regular"", ""fas fa-bell"": ""&#xf0f3; bell solid"", ""far fa-bell"": ""&#xf0f3; bell regular"", ""fab fa-behance-square"": ""&#xf1b5; Behance Square brands"", ""fab fa-behance"": ""&#xf1b4; Behance brands"", ""fas fa-beer"": ""&#xf0fc; beer solid"", ""fas fa-bed"": ""&#xf236; Bed solid"", ""fas fa-battery-three-quarters"": ""&#xf241; Battery 3\/4 Full solid"", ""fas fa-battery-quarter"": ""&#xf243; Battery 1\/4 Full solid"", ""fas fa-battery-half"": ""&#xf242; Battery 1\/2 Full solid"", ""fas fa-battery-full"": ""&#xf240; Battery Full solid"", ""fas fa-battery-empty"": ""&#xf244; Battery Empty solid"", ""fas fa-bath"": ""&#xf2cd; Bath solid"", ""fas fa-basketball-ball"": ""&#xf434; Basketball Ball solid"", ""fas fa-baseball-ball"": ""&#xf433; Baseball Ball solid"", ""fas fa-bars"": ""&#xf0c9; Bars solid"", ""fas fa-barcode"": ""&#xf02a; barcode solid"", ""fab fa-bandcamp"": ""&#xf2d5; Bandcamp brands"", ""fas fa-band-aid"": ""&#xf462; Band-Aid solid"", ""fas fa-ban"": ""&#xf05e; ban solid"", ""fas fa-balance-scale"": ""&#xf24e; Balance Scale solid"", ""fas fa-backward"": ""&#xf04a; backward solid"", ""fab fa-aws"": ""&#xf375; Amazon Web Services (AWS) brands"", ""fab fa-aviato"": ""&#xf421; Aviato brands"", ""fab fa-avianex"": ""&#xf374; avianex brands"", ""fab fa-autoprefixer"": ""&#xf41c; Autoprefixer brands"", ""fas fa-audio-description"": ""&#xf29e; Audio Description solid"", ""fab fa-audible"": ""&#xf373; Audible brands"", ""fas fa-at"": ""&#xf1fa; At solid"", ""fab fa-asymmetrik"": ""&#xf372; Asymmetrik, Ltd. brands"", ""fas fa-asterisk"": ""&#xf069; asterisk solid"", ""fas fa-assistive-listening-systems"": ""&#xf2a2; Assistive Listening Systems solid"", ""fas fa-arrows-alt-v"": ""&#xf338; Alternate Arrows Vertical solid"", ""fas fa-arrows-alt-h"": ""&#xf337; Alternate Arrows Horizontal solid"", ""fas fa-arrows-alt"": ""&#xf0b2; Alternate Arrows solid"", ""fas fa-arrow-up"": ""&#xf062; arrow-up solid"", ""fas fa-arrow-right"": ""&#xf061; arrow-right solid"", ""fas fa-arrow-left"": ""&#xf060; arrow-left solid"", ""fas fa-arrow-down"": ""&#xf063; arrow-down solid"", ""fas fa-arrow-circle-up"": ""&#xf0aa; Arrow Circle Up solid"", ""fas fa-arrow-circle-right"": ""&#xf0a9; Arrow Circle Right solid"", ""fas fa-arrow-circle-left"": ""&#xf0a8; Arrow Circle Left solid"", ""fas fa-arrow-circle-down"": ""&#xf0ab; Arrow Circle Down solid"", ""fas fa-arrow-alt-circle-up"": ""&#xf35b; Alternate Arrow Circle Up solid"", ""far fa-arrow-alt-circle-up"": ""&#xf35b; Alternate Arrow Circle Up regular"", ""fas fa-arrow-alt-circle-right"": ""&#xf35a; Alternate Arrow Circle Right solid"", ""far fa-arrow-alt-circle-right"": ""&#xf35a; Alternate Arrow Circle Right regular"", ""fas fa-arrow-alt-circle-left"": ""&#xf359; Alternate Arrow Circle Left solid"", ""far fa-arrow-alt-circle-left"": ""&#xf359; Alternate Arrow Circle Left regular"", ""fas fa-arrow-alt-circle-down"": ""&#xf358; Alternate Arrow Circle Down solid"", ""far fa-arrow-alt-circle-down"": ""&#xf358; Alternate Arrow Circle Down regular"", ""fas fa-archive"": ""&#xf187; Archive solid"", ""fab fa-apple-pay"": ""&#xf415; Apple Pay brands"", ""fab fa-apple"": ""&#xf179; Apple brands"", ""fab fa-apper"": ""&#xf371; Apper Systems AB brands"", ""fab fa-app-store-ios"": ""&#xf370; iOS App Store brands"", ""fab fa-app-store"": ""&#xf36f; App Store brands"", ""fab fa-angular"": ""&#xf420; Angular brands"", ""fab fa-angrycreative"": ""&#xf36e; Angry Creative brands"", ""fas fa-angle-up"": ""&#xf106; angle-up solid"", ""fas fa-angle-right"": ""&#xf105; angle-right solid"", ""fas fa-angle-left"": ""&#xf104; angle-left solid"", ""fas fa-angle-down"": ""&#xf107; angle-down solid"", ""fas fa-angle-double-up"": ""&#xf102; Angle Double Up solid"", ""fas fa-angle-double-right"": ""&#xf101; Angle Double Right solid"", ""fas fa-angle-double-left"": ""&#xf100; Angle Double Left solid"", ""fas fa-angle-double-down"": ""&#xf103; Angle Double Down solid"", ""fab fa-angellist"": ""&#xf209; AngelList brands"", ""fab fa-android"": ""&#xf17b; Android brands"", ""fas fa-anchor"": ""&#xf13d; Anchor solid"", ""fab fa-amilia"": ""&#xf36d; Amilia brands"", ""fas fa-american-sign-language-interpreting"": ""&#xf2a3; American Sign Language Interpreting solid"", ""fas fa-ambulance"": ""&#xf0f9; ambulance solid"", ""fab fa-amazon-pay"": ""&#xf42c; Amazon Pay brands"", ""fab fa-amazon"": ""&#xf270; Amazon brands"", ""fas fa-allergies"": ""&#xf461; Allergies solid"", ""fas fa-align-right"": ""&#xf038; align-right solid"", ""fas fa-align-left"": ""&#xf036; align-left solid"", ""fas fa-align-justify"": ""&#xf039; align-justify solid"", ""fas fa-align-center"": ""&#xf037; align-center solid"", ""fab fa-algolia"": ""&#xf36c; Algolia brands"", ""fab fa-affiliatetheme"": ""&#xf36b; affiliatetheme brands"", ""fab fa-adversal"": ""&#xf36a; Adversal brands"", ""fab fa-adn"": ""&#xf170; App.net brands"", ""fas fa-adjust"": ""&#xf042; adjust solid"", ""fas fa-address-card"": ""&#xf2bb; Address Card solid"", ""far fa-address-card"": ""&#xf2bb; Address Card regular"", ""fas fa-address-book"": ""&#xf2b9; Address Book solid"", ""far fa-address-book"": ""&#xf2b9; Address Book regular"", ""fab fa-accusoft"": ""&#xf369; Accusoft brands"", ""fab fa-accessible-icon"": ""&#xf368; Accessible Icon brands"", ""fab fa-500px"": ""&#xf26e; 500px brands"", ""fab fa-youtube-square"": ""&#xf431; YouTube Square brands"", ""fab fa-youtube"": ""&#xf167; YouTube brands"", ""fab fa-yoast"": ""&#xf2b1; Yoast brands"", ""fas fa-yen-sign"": ""&#xf157; Yen Sign solid"", ""fab fa-yelp"": ""&#xf1e9; Yelp brands"", ""fab fa-yandex-international"": ""&#xf414; Yandex International brands"", ""fab fa-yandex"": ""&#xf413; Yandex brands"", ""fab fa-yahoo"": ""&#xf19e; Yahoo Logo brands"", ""fab fa-y-combinator"": ""&#xf23b; Y Combinator brands"", ""fab fa-xing-square"": ""&#xf169; Xing Square brands"", ""fab fa-xing"": ""&#xf168; Xing brands"", ""fab fa-xbox"": ""&#xf412; Xbox brands"", ""fas fa-x-ray"": ""&#xf497; X-Ray solid"", ""fas fa-wrench"": ""&#xf0ad; Wrench solid"", ""fab fa-wpforms"": ""&#xf298; WPForms brands"", ""fab fa-wpexplorer"": ""&#xf2de; WPExplorer brands"", ""fab fa-wpbeginner"": ""&#xf297; WPBeginner brands"", ""fab fa-wordpress-simple"": ""&#xf411; Wordpress Simple brands"", ""fab fa-wordpress"": ""&#xf19a; WordPress Logo brands"", ""fas fa-won-sign"": ""&#xf159; Won Sign solid"", ""fab fa-wolf-pack-battalion"": ""&#xf514; Wolf Pack-battalion brands"", ""fas fa-wine-glass"": ""&#xf4e3; Wine Glass solid"", ""fab fa-windows"": ""&#xf17a; Windows brands"", ""fas fa-window-restore"": ""&#xf2d2; Window Restore solid"", ""far fa-window-restore"": ""&#xf2d2; Window Restore regular"", ""fas fa-window-minimize"": ""&#xf2d1; Window Minimize solid"", ""far fa-window-minimize"": ""&#xf2d1; Window Minimize regular"", ""fas fa-window-maximize"": ""&#xf2d0; Window Maximize solid"", ""far fa-window-maximize"": ""&#xf2d0; Window Maximize regular"", ""fas fa-window-close"": ""&#xf410; Window Close solid"", ""far fa-window-close"": ""&#xf410; Window Close regular"", ""fab fa-wikipedia-w"": ""&#xf266; Wikipedia W brands"", ""fas fa-wifi"": ""&#xf1eb; WiFi solid"", ""fab fa-whmcs"": ""&#xf40d; WHMCS brands"", ""fas fa-wheelchair"": ""&#xf193; Wheelchair solid"", ""fab fa-whatsapp-square"": ""&#xf40c; What's App Square brands"", ""fab fa-whatsapp"": ""&#xf232; What's App brands"", ""fab fa-weixin"": ""&#xf1d7; Weixin (WeChat) brands"", ""fas fa-weight"": ""&#xf496; Weight solid"", ""fab fa-weibo"": ""&#xf18a; Weibo brands"", ""fas fa-warehouse"": ""&#xf494; Warehouse solid"", ""fab fa-vuejs"": ""&#xf41f; Vue.js brands"", ""fas fa-volume-up"": ""&#xf028; volume-up solid"", ""fas fa-volume-off"": ""&#xf026; volume-off solid"", ""fas fa-volume-down"": ""&#xf027; volume-down solid"", ""fas fa-volleyball-ball"": ""&#xf45f; Volleyball Ball solid"", ""fab fa-vnv"": ""&#xf40b; VNV brands"", ""fab fa-vk"": ""&#xf189; VK brands"", ""fab fa-vine"": ""&#xf1ca; Vine brands"", ""fab fa-vimeo-v"": ""&#xf27d; Vimeo brands"", ""fab fa-vimeo-square"": ""&#xf194; Vimeo Square brands"", ""fab fa-vimeo"": ""&#xf40a; Vimeo brands"", ""fas fa-video-slash"": ""&#xf4e2; Video Slash solid"", ""fas fa-video"": ""&#xf03d; Video solid"", ""fab fa-viber"": ""&#xf409; Viber brands"", ""fas fa-vials"": ""&#xf493; Vials solid"", ""fas fa-vial"": ""&#xf492; Vial solid"", ""fab fa-viadeo-square"": ""&#xf2aa; Viadeo Square brands"", ""fab fa-viadeo"": ""&#xf2a9; Viadeo brands"", ""fab fa-viacoin"": ""&#xf237; Viacoin brands"", ""fas fa-venus-mars"": ""&#xf228; Venus Mars solid"", ""fas fa-venus-double"": ""&#xf226; Venus Double solid"", ""fas fa-venus"": ""&#xf221; Venus solid"", ""fab fa-vaadin"": ""&#xf408; Vaadin brands"", ""fas fa-utensils"": ""&#xf2e7; Utensils solid"", ""fas fa-utensil-spoon"": ""&#xf2e5; Utensil Spoon solid"", ""fab fa-ussunnah"": ""&#xf407; us-Sunnah Foundation brands"", ""fas fa-users-cog"": ""&#xf509; Users Cog solid"", ""fas fa-users"": ""&#xf0c0; Users solid"", ""fas fa-user-times"": ""&#xf235; Remove User solid"", ""fas fa-user-tie"": ""&#xf508; User Tie solid"", ""fas fa-user-tag"": ""&#xf507; User Tag solid"", ""fas fa-user-slash"": ""&#xf506; User Slash solid"", ""fas fa-user-shield"": ""&#xf505; User Shield solid"", ""fas fa-user-secret"": ""&#xf21b; User Secret solid"", ""fas fa-user-plus"": ""&#xf234; Add User solid"", ""fas fa-user-ninja"": ""&#xf504; User Ninja solid"", ""fas fa-user-minus"": ""&#xf503; User Minus solid"", ""fas fa-user-md"": ""&#xf0f0; user-md solid"", ""fas fa-user-lock"": ""&#xf502; User Lock solid"", ""fas fa-user-graduate"": ""&#xf501; User Graduate solid"", ""fas fa-user-friends"": ""&#xf500; User Friends solid"", ""fas fa-user-edit"": ""&#xf4ff; User Edit solid"", ""fas fa-user-cog"": ""&#xf4fe; User Cog solid"", ""fas fa-user-clock"": ""&#xf4fd; User Clock solid"", ""fas fa-user-circle"": ""&#xf2bd; User Circle solid"", ""far fa-user-circle"": ""&#xf2bd; User Circle regular"", ""fas fa-user-check"": ""&#xf4fc; User Check solid"", ""fas fa-user-astronaut"": ""&#xf4fb; User Astronaut solid"", ""fas fa-user-alt-slash"": ""&#xf4fa; User Alt-slash solid"", ""fas fa-user-alt"": ""&#xf406; Alternate User solid"", ""fas fa-user"": ""&#xf007; User solid"", ""far fa-user"": ""&#xf007; User regular"", ""fab fa-usb"": ""&#xf287; USB brands"", ""fas fa-upload"": ""&#xf093; Upload solid"", ""fab fa-untappd"": ""&#xf405; Untappd brands"", ""fas fa-unlock-alt"": ""&#xf13e; Alternate Unlock solid"", ""fas fa-unlock"": ""&#xf09c; unlock solid"", ""fas fa-unlink"": ""&#xf127; unlink solid"", ""fas fa-university"": ""&#xf19c; University solid"", ""fas fa-universal-access"": ""&#xf29a; Universal Access solid"", ""fab fa-uniregistry"": ""&#xf404; Uniregistry brands"", ""fas fa-undo-alt"": ""&#xf2ea; Alternate Undo solid"", ""fas fa-undo"": ""&#xf0e2; Undo solid"", ""fas fa-underline"": ""&#xf0cd; Underline solid"", ""fas fa-umbrella"": ""&#xf0e9; Umbrella solid"", ""fab fa-uikit"": ""&#xf403; UIkit brands"", ""fab fa-uber"": ""&#xf402; Uber brands"", ""fab fa-typo3"": ""&#xf42b; Typo3 brands"", ""fab fa-twitter-square"": ""&#xf081; Twitter Square brands"", ""fab fa-twitter"": ""&#xf099; Twitter brands"", ""fab fa-twitch"": ""&#xf1e8; Twitch brands"", ""fas fa-tv"": ""&#xf26c; Television solid"", ""fab fa-tumblr-square"": ""&#xf174; Tumblr Square brands"", ""fab fa-tumblr"": ""&#xf173; Tumblr brands"", ""fas fa-tty"": ""&#xf1e4; TTY solid"", ""fas fa-truck-moving"": ""&#xf4df; Truck Moving solid"", ""fas fa-truck-loading"": ""&#xf4de; Truck Loading solid"", ""fas fa-truck"": ""&#xf0d1; truck solid"", ""fas fa-trophy"": ""&#xf091; trophy solid"", ""fab fa-tripadvisor"": ""&#xf262; TripAdvisor brands"", ""fab fa-trello"": ""&#xf181; Trello brands"", ""fas fa-tree"": ""&#xf1bb; Tree solid"", ""fas fa-trash-alt"": ""&#xf2ed; Alternate Trash solid"", ""far fa-trash-alt"": ""&#xf2ed; Alternate Trash regular"", ""fas fa-trash"": ""&#xf1f8; Trash solid"", ""fas fa-transgender-alt"": ""&#xf225; Alternate Transgender solid"", ""fas fa-transgender"": ""&#xf224; Transgender solid"", ""fas fa-train"": ""&#xf238; Train solid"", ""fas fa-trademark"": ""&#xf25c; Trademark solid"", ""fab fa-trade-federation"": ""&#xf513; Trade Federation brands"", ""fas fa-toggle-on"": ""&#xf205; Toggle On solid"", ""fas fa-toggle-off"": ""&#xf204; Toggle Off solid"", ""fas fa-tint"": ""&#xf043; tint solid"", ""fas fa-times-circle"": ""&#xf057; Times Circle solid"", ""far fa-times-circle"": ""&#xf057; Times Circle regular"", ""fas fa-times"": ""&#xf00d; Times solid"", ""fas fa-ticket-alt"": ""&#xf3ff; Alternate Ticket solid"", ""fas fa-thumbtack"": ""&#xf08d; Thumbtack solid"", ""fas fa-thumbs-up"": ""&#xf164; thumbs-up solid"", ""far fa-thumbs-up"": ""&#xf164; thumbs-up regular"", ""fas fa-thumbs-down"": ""&#xf165; thumbs-down solid"", ""far fa-thumbs-down"": ""&#xf165; thumbs-down regular"", ""fas fa-thermometer-three-quarters"": ""&#xf2c8; Thermometer 3\/4 Full solid"", ""fas fa-thermometer-quarter"": ""&#xf2ca; Thermometer 1\/4 Full solid"", ""fas fa-thermometer-half"": ""&#xf2c9; Thermometer 1\/2 Full solid"", ""fas fa-thermometer-full"": ""&#xf2c7; Thermometer Full solid"", ""fas fa-thermometer-empty"": ""&#xf2cb; Thermometer Empty solid"", ""fas fa-thermometer"": ""&#xf491; Thermometer solid"", ""fab fa-themeisle"": ""&#xf2b2; ThemeIsle brands"", ""fas fa-th-list"": ""&#xf00b; th-list solid"", ""fas fa-th-large"": ""&#xf009; th-large solid"", ""fas fa-th"": ""&#xf00a; th solid"", ""fas fa-text-width"": ""&#xf035; text-width solid"", ""fas fa-text-height"": ""&#xf034; text-height solid"", ""fas fa-terminal"": ""&#xf120; Terminal solid"", ""fab fa-tencent-weibo"": ""&#xf1d5; Tencent Weibo brands"", ""fab fa-telegram-plane"": ""&#xf3fe; Telegram Plane brands"", ""fab fa-telegram"": ""&#xf2c6; Telegram brands"", ""fab fa-teamspeak"": ""&#xf4f9; TeamSpeak brands"", ""fas fa-taxi"": ""&#xf1ba; Taxi solid"", ""fas fa-tasks"": ""&#xf0ae; Tasks solid"", ""fas fa-tape"": ""&#xf4db; Tape solid"", ""fas fa-tags"": ""&#xf02c; tags solid"", ""fas fa-tag"": ""&#xf02b; tag solid"", ""fas fa-tachometer-alt"": ""&#xf3fd; Alternate Tachometer solid"", ""fas fa-tablets"": ""&#xf490; Tablets solid"", ""fas fa-tablet-alt"": ""&#xf3fa; Alternate Tablet solid"", ""fas fa-tablet"": ""&#xf10a; tablet solid"", ""fas fa-table-tennis"": ""&#xf45d; Table Tennis solid"", ""fas fa-table"": ""&#xf0ce; table solid"", ""fas fa-syringe"": ""&#xf48e; Syringe solid"", ""fas fa-sync-alt"": ""&#xf2f1; Alternate Sync solid"", ""fas fa-sync"": ""&#xf021; Sync solid"", ""fab fa-supple"": ""&#xf3f9; Supple brands"", ""fas fa-superscript"": ""&#xf12b; superscript solid"", ""fab fa-superpowers"": ""&#xf2dd; Superpowers brands"", ""fas fa-sun"": ""&#xf185; Sun solid"", ""far fa-sun"": ""&#xf185; Sun regular"", ""fas fa-suitcase"": ""&#xf0f2; Suitcase solid"", ""fas fa-subway"": ""&#xf239; Subway solid"", ""fas fa-subscript"": ""&#xf12c; subscript solid"", ""fab fa-stumbleupon-circle"": ""&#xf1a3; StumbleUpon Circle brands"", ""fab fa-stumbleupon"": ""&#xf1a4; StumbleUpon Logo brands"", ""fab fa-studiovinari"": ""&#xf3f8; Studio Vinari brands"", ""fab fa-stripe-s"": ""&#xf42a; Stripe S brands"", ""fab fa-stripe"": ""&#xf429; Stripe brands"", ""fas fa-strikethrough"": ""&#xf0cc; Strikethrough solid"", ""fas fa-street-view"": ""&#xf21d; Street View solid"", ""fab fa-strava"": ""&#xf428; Strava brands"", ""fas fa-stopwatch"": ""&#xf2f2; Stopwatch solid"", ""fas fa-stop-circle"": ""&#xf28d; Stop Circle solid"", ""far fa-stop-circle"": ""&#xf28d; Stop Circle regular"", ""fas fa-stop"": ""&#xf04d; stop solid"", ""fas fa-sticky-note"": ""&#xf249; Sticky Note solid"", ""far fa-sticky-note"": ""&#xf249; Sticky Note regular"", ""fab fa-sticker-mule"": ""&#xf3f7; Sticker Mule brands"", ""fas fa-stethoscope"": ""&#xf0f1; Stethoscope solid"", ""fas fa-step-forward"": ""&#xf051; step-forward solid"", ""fas fa-step-backward"": ""&#xf048; step-backward solid"", ""fab fa-steam-symbol"": ""&#xf3f6; Steam Symbol brands"", ""fab fa-steam-square"": ""&#xf1b7; Steam Square brands"", ""fab fa-steam"": ""&#xf1b6; Steam brands"", ""fab fa-staylinked"": ""&#xf3f5; StayLinked brands"", ""fas fa-star-half"": ""&#xf089; star-half solid"", ""far fa-star-half"": ""&#xf089; star-half regular"", ""fas fa-star"": ""&#xf005; Star solid"", ""far fa-star"": ""&#xf005; Star regular"", ""fab fa-stack-overflow"": ""&#xf16c; Stack Overflow brands"", ""fab fa-stack-exchange"": ""&#xf18d; Stack Exchange brands"", ""fas fa-square-full"": ""&#xf45c; Square Full solid"", ""fas fa-square"": ""&#xf0c8; Square solid"", ""far fa-square"": ""&#xf0c8; Square regular"", ""fab fa-spotify"": ""&#xf1bc; Spotify brands"", ""fas fa-spinner"": ""&#xf110; Spinner solid"", ""fab fa-speakap"": ""&#xf3f3; Speakap brands"", ""fas fa-space-shuttle"": ""&#xf197; Space Shuttle solid"", ""fab fa-soundcloud"": ""&#xf1be; SoundCloud brands"", ""fas fa-sort-up"": ""&#xf0de; Sort Up (Ascending) solid"", ""fas fa-sort-numeric-up"": ""&#xf163; Sort Numeric Up solid"", ""fas fa-sort-numeric-down"": ""&#xf162; Sort Numeric Down solid"", ""fas fa-sort-down"": ""&#xf0dd; Sort Down (Descending) solid"", ""fas fa-sort-amount-up"": ""&#xf161; Sort Amount Up solid"", ""fas fa-sort-amount-down"": ""&#xf160; Sort Amount Down solid"", ""fas fa-sort-alpha-up"": ""&#xf15e; Sort Alpha Up solid"", ""fas fa-sort-alpha-down"": ""&#xf15d; Sort Alpha Down solid"", ""fas fa-sort"": ""&#xf0dc; Sort solid"", ""fas fa-snowflake"": ""&#xf2dc; Snowflake solid"", ""far fa-snowflake"": ""&#xf2dc; Snowflake regular"", ""fab fa-snapchat-square"": ""&#xf2ad; Snapchat Square brands"", ""fab fa-snapchat-ghost"": ""&#xf2ac; Snapchat Ghost brands"", ""fab fa-snapchat"": ""&#xf2ab; Snapchat brands"", ""fas fa-smoking"": ""&#xf48d; Smoking solid"", ""fas fa-smile"": ""&#xf118; Smile solid"", ""far fa-smile"": ""&#xf118; Smile regular"", ""fab fa-slideshare"": ""&#xf1e7; Slideshare brands"", ""fas fa-sliders-h"": ""&#xf1de; Horizontal Sliders solid"", ""fab fa-slack-hash"": ""&#xf3ef; Slack Hashtag brands"", ""fab fa-slack"": ""&#xf198; Slack Logo brands"", ""fab fa-skype"": ""&#xf17e; Skype brands"", ""fab fa-skyatlas"": ""&#xf216; skyatlas brands"", ""fab fa-sith"": ""&#xf512; Sith brands"", ""fas fa-sitemap"": ""&#xf0e8; Sitemap solid"", ""fab fa-sistrix"": ""&#xf3ee; SISTRIX brands"", ""fab fa-simplybuilt"": ""&#xf215; SimplyBuilt brands"", ""fas fa-signal"": ""&#xf012; signal solid"", ""fas fa-sign-out-alt"": ""&#xf2f5; Alternate Sign Out solid"", ""fas fa-sign-language"": ""&#xf2a7; Sign Language solid"", ""fas fa-sign-in-alt"": ""&#xf2f6; Alternate Sign In solid"", ""fas fa-sign"": ""&#xf4d9; Sign solid"", ""fas fa-shower"": ""&#xf2cc; Shower solid"", ""fas fa-shopping-cart"": ""&#xf07a; shopping-cart solid"", ""fas fa-shopping-basket"": ""&#xf291; Shopping Basket solid"", ""fas fa-shopping-bag"": ""&#xf290; Shopping Bag solid"", ""fab fa-shirtsinbulk"": ""&#xf214; Shirts in Bulk brands"", ""fas fa-shipping-fast"": ""&#xf48b; Shipping Fast solid"", ""fas fa-ship"": ""&#xf21a; Ship solid"", ""fas fa-shield-alt"": ""&#xf3ed; Alternate Shield solid"", ""fas fa-shekel-sign"": ""&#xf20b; Shekel Sign solid"", ""fas fa-share-square"": ""&#xf14d; Share Square solid"", ""far fa-share-square"": ""&#xf14d; Share Square regular"", ""fas fa-share-alt-square"": ""&#xf1e1; Alternate Share Square solid"", ""fas fa-share-alt"": ""&#xf1e0; Alternate Share solid"", ""fas fa-share"": ""&#xf064; Share solid"", ""fab fa-servicestack"": ""&#xf3ec; Servicestack brands"", ""fas fa-server"": ""&#xf233; Server solid"", ""fab fa-sellsy"": ""&#xf213; Sellsy brands"", ""fab fa-sellcast"": ""&#xf2da; Sellcast brands"", ""fas fa-seedling"": ""&#xf4d8; Seedling solid"", ""fab fa-searchengin"": ""&#xf3eb; Searchengin brands"", ""fas fa-search-plus"": ""&#xf00e; Search Plus solid"", ""fas fa-search-minus"": ""&#xf010; Search Minus solid"", ""fas fa-search"": ""&#xf002; Search solid"", ""fab fa-scribd"": ""&#xf28a; Scribd brands"", ""fab fa-schlix"": ""&#xf3ea; SCHLIX brands"", ""fas fa-save"": ""&#xf0c7; Save solid"", ""far fa-save"": ""&#xf0c7; Save regular"", ""fab fa-sass"": ""&#xf41e; Sass brands"", ""fab fa-safari"": ""&#xf267; Safari brands"", ""fas fa-rupee-sign"": ""&#xf156; Indian Rupee Sign solid"", ""fas fa-ruble-sign"": ""&#xf158; Ruble Sign solid"", ""fas fa-rss-square"": ""&#xf143; RSS Square solid"", ""fas fa-rss"": ""&#xf09e; rss solid"", ""fab fa-rockrms"": ""&#xf3e9; Rockrms brands"", ""fab fa-rocketchat"": ""&#xf3e8; Rocket.Chat brands"", ""fas fa-rocket"": ""&#xf135; rocket solid"", ""fas fa-road"": ""&#xf018; road solid"", ""fas fa-ribbon"": ""&#xf4d6; Ribbon solid"", ""fas fa-retweet"": ""&#xf079; Retweet solid"", ""fab fa-resolving"": ""&#xf3e7; Resolving brands"", ""fab fa-researchgate"": ""&#xf4f8; Researchgate brands"", ""fab fa-replyd"": ""&#xf3e6; replyd brands"", ""fas fa-reply-all"": ""&#xf122; reply-all solid"", ""fas fa-reply"": ""&#xf3e5; Reply solid"", ""fab fa-renren"": ""&#xf18b; Renren brands"", ""fab fa-rendact"": ""&#xf3e4; Rendact brands"", ""fas fa-registered"": ""&#xf25d; Registered Trademark solid"", ""far fa-registered"": ""&#xf25d; Registered Trademark regular"", ""fas fa-redo-alt"": ""&#xf2f9; Alternate Redo solid"", ""fas fa-redo"": ""&#xf01e; Redo solid"", ""fab fa-reddit-square"": ""&#xf1a2; reddit Square brands"", ""fab fa-reddit-alien"": ""&#xf281; reddit Alien brands"", ""fab fa-reddit"": ""&#xf1a1; reddit Logo brands"", ""fab fa-red-river"": ""&#xf3e3; red river brands"", ""fas fa-recycle"": ""&#xf1b8; Recycle solid"", ""fab fa-rebel"": ""&#xf1d0; Rebel Alliance brands"", ""fab fa-readme"": ""&#xf4d5; ReadMe brands"", ""fab fa-react"": ""&#xf41b; React brands"", ""fab fa-ravelry"": ""&#xf2d9; Ravelry brands"", ""fas fa-random"": ""&#xf074; random solid"", ""fab fa-r-project"": ""&#xf4f7; R Project brands"", ""fas fa-quote-right"": ""&#xf10e; quote-right solid"", ""fas fa-quote-left"": ""&#xf10d; quote-left solid"", ""fab fa-quora"": ""&#xf2c4; Quora brands"", ""fab fa-quinscape"": ""&#xf459; QuinScape brands"", ""fas fa-quidditch"": ""&#xf458; Quidditch solid"", ""fas fa-question-circle"": ""&#xf059; Question Circle solid"", ""far fa-question-circle"": ""&#xf059; Question Circle regular"", ""fas fa-question"": ""&#xf128; Question solid"", ""fas fa-qrcode"": ""&#xf029; qrcode solid"", ""fab fa-qq"": ""&#xf1d6; QQ brands"", ""fab fa-python"": ""&#xf3e2; Python brands"", ""fas fa-puzzle-piece"": ""&#xf12e; Puzzle Piece solid"", ""fab fa-pushed"": ""&#xf3e1; Pushed brands"", ""fab fa-product-hunt"": ""&#xf288; Product Hunt brands"", ""fas fa-procedures"": ""&#xf487; Procedures solid"", ""fas fa-print"": ""&#xf02f; print solid"", ""fas fa-prescription-bottle-alt"": ""&#xf486; Alternate Prescription Bottle solid"", ""fas fa-prescription-bottle"": ""&#xf485; Prescription Bottle solid"", ""fas fa-power-off"": ""&#xf011; Power Off solid"", ""fas fa-pound-sign"": ""&#xf154; Pound Sign solid"", ""fas fa-portrait"": ""&#xf3e0; Portrait solid"", ""fas fa-poo"": ""&#xf2fe; Poo solid"", ""fas fa-podcast"": ""&#xf2ce; Podcast solid"", ""fas fa-plus-square"": ""&#xf0fe; Plus Square solid"", ""far fa-plus-square"": ""&#xf0fe; Plus Square regular"", ""fas fa-plus-circle"": ""&#xf055; Plus Circle solid"", ""fas fa-plus"": ""&#xf067; plus solid"", ""fas fa-plug"": ""&#xf1e6; Plug solid"", ""fab fa-playstation"": ""&#xf3df; PlayStation brands"", ""fas fa-play-circle"": ""&#xf144; Play Circle solid"", ""far fa-play-circle"": ""&#xf144; Play Circle regular"", ""fas fa-play"": ""&#xf04b; play solid"", ""fas fa-plane"": ""&#xf072; plane solid"", ""fab fa-pinterest-square"": ""&#xf0d3; Pinterest Square brands"", ""fab fa-pinterest-p"": ""&#xf231; Pinterest P brands"", ""fab fa-pinterest"": ""&#xf0d2; Pinterest brands"", ""fas fa-pills"": ""&#xf484; Pills solid"", ""fas fa-piggy-bank"": ""&#xf4d3; Piggy Bank solid"", ""fab fa-pied-piper-pp"": ""&#xf1a7; Pied Piper PP Logo (Old) brands"", ""fab fa-pied-piper-hat"": ""&#xf4e5; Pied Piper-hat brands"", ""fab fa-pied-piper-alt"": ""&#xf1a8; Alternate Pied Piper Logo brands"", ""fab fa-pied-piper"": ""&#xf2ae; Pied Piper Logo brands"", ""fab fa-php"": ""&#xf457; PHP brands"", ""fas fa-phone-volume"": ""&#xf2a0; Phone Volume solid"", ""fas fa-phone-square"": ""&#xf098; Phone Square solid"", ""fas fa-phone-slash"": ""&#xf3dd; Phone Slash solid"", ""fas fa-phone"": ""&#xf095; Phone solid"", ""fab fa-phoenix-squadron"": ""&#xf511; Phoenix Squadron brands"", ""fab fa-phoenix-framework"": ""&#xf3dc; Phoenix Framework brands"", ""fab fa-phabricator"": ""&#xf3db; Phabricator brands"", ""fab fa-periscope"": ""&#xf3da; Periscope brands"", ""fas fa-percent"": ""&#xf295; Percent solid"", ""fas fa-people-carry"": ""&#xf4ce; People Carry solid"", ""fas fa-pencil-alt"": ""&#xf303; Alternate Pencil solid"", ""fas fa-pen-square"": ""&#xf14b; Pen Square solid"", ""fab fa-paypal"": ""&#xf1ed; Paypal brands"", ""fas fa-paw"": ""&#xf1b0; Paw solid"", ""fas fa-pause-circle"": ""&#xf28b; Pause Circle solid"", ""far fa-pause-circle"": ""&#xf28b; Pause Circle regular"", ""fas fa-pause"": ""&#xf04c; pause solid"", ""fab fa-patreon"": ""&#xf3d9; Patreon brands"", ""fas fa-paste"": ""&#xf0ea; Paste solid"", ""fas fa-paragraph"": ""&#xf1dd; paragraph solid"", ""fas fa-parachute-box"": ""&#xf4cd; Parachute Box solid"", ""fas fa-paperclip"": ""&#xf0c6; Paperclip solid"", ""fas fa-paper-plane"": ""&#xf1d8; Paper Plane solid"", ""far fa-paper-plane"": ""&#xf1d8; Paper Plane regular"", ""fas fa-pallet"": ""&#xf482; Pallet solid"", ""fab fa-palfed"": ""&#xf3d8; Palfed brands"", ""fas fa-paint-brush"": ""&#xf1fc; Paint Brush solid"", ""fab fa-pagelines"": ""&#xf18c; Pagelines brands"", ""fab fa-page4"": ""&#xf3d7; page4 Corporation brands"", ""fas fa-outdent"": ""&#xf03b; Outdent solid"", ""fab fa-osi"": ""&#xf41a; Open Source Initiative brands"", ""fab fa-optin-monster"": ""&#xf23c; Optin Monster brands"", ""fab fa-opera"": ""&#xf26a; Opera brands"", ""fab fa-openid"": ""&#xf19b; OpenID brands"", ""fab fa-opencart"": ""&#xf23d; OpenCart brands"", ""fab fa-old-republic"": ""&#xf510; Old Republic brands"", ""fab fa-odnoklassniki-square"": ""&#xf264; Odnoklassniki Square brands"", ""fab fa-odnoklassniki"": ""&#xf263; Odnoklassniki brands"", ""fas fa-object-ungroup"": ""&#xf248; Object Ungroup solid"", ""far fa-object-ungroup"": ""&#xf248; Object Ungroup regular"", ""fas fa-object-group"": ""&#xf247; Object Group solid"", ""far fa-object-group"": ""&#xf247; Object Group regular"", ""fab fa-nutritionix"": ""&#xf3d6; Nutritionix brands"", ""fab fa-ns8"": ""&#xf3d5; NS8 brands"", ""fab fa-npm"": ""&#xf3d4; npm brands"", ""fas fa-notes-medical"": ""&#xf481; Medical Notes solid"", ""fab fa-node-js"": ""&#xf3d3; Node.js JS brands"", ""fab fa-node"": ""&#xf419; Node.js brands"", ""fab fa-nintendo-switch"": ""&#xf418; Nintendo Switch brands"", ""fas fa-newspaper"": ""&#xf1ea; Newspaper solid"", ""far fa-newspaper"": ""&#xf1ea; Newspaper regular"", ""fas fa-neuter"": ""&#xf22c; Neuter solid"", ""fab fa-napster"": ""&#xf3d2; Napster brands"", ""fas fa-music"": ""&#xf001; Music solid"", ""fas fa-mouse-pointer"": ""&#xf245; Mouse Pointer solid"", ""fas fa-motorcycle"": ""&#xf21c; Motorcycle solid"", ""fas fa-moon"": ""&#xf186; Moon solid"", ""far fa-moon"": ""&#xf186; Moon regular"", ""fas fa-money-bill-alt"": ""&#xf3d1; Money Bill Alternate solid"", ""far fa-money-bill-alt"": ""&#xf3d1; Money Bill Alternate regular"", ""fab fa-monero"": ""&#xf3d0; Monero brands"", ""fab fa-modx"": ""&#xf285; MODX brands"", ""fas fa-mobile-alt"": ""&#xf3cd; Alternate Mobile solid"", ""fas fa-mobile"": ""&#xf10b; Mobile Phone solid"", ""fab fa-mizuni"": ""&#xf3cc; Mizuni brands"", ""fab fa-mixcloud"": ""&#xf289; Mixcloud brands"", ""fab fa-mix"": ""&#xf3cb; Mix brands"", ""fas fa-minus-square"": ""&#xf146; Minus Square solid"", ""far fa-minus-square"": ""&#xf146; Minus Square regular"", ""fas fa-minus-circle"": ""&#xf056; Minus Circle solid"", ""fas fa-minus"": ""&#xf068; minus solid"", ""fab fa-microsoft"": ""&#xf3ca; Microsoft brands"", ""fas fa-microphone-slash"": ""&#xf131; Microphone Slash solid"", ""fas fa-microphone"": ""&#xf130; microphone solid"", ""fas fa-microchip"": ""&#xf2db; Microchip solid"", ""fas fa-mercury"": ""&#xf223; Mercury solid"", ""fas fa-meh"": ""&#xf11a; Meh solid"", ""far fa-meh"": ""&#xf11a; Meh regular"", ""fab fa-meetup"": ""&#xf2e0; Meetup brands"", ""fab fa-medrt"": ""&#xf3c8; MRT brands"", ""fas fa-medkit"": ""&#xf0fa; medkit solid"", ""fab fa-medium-m"": ""&#xf3c7; Medium M brands"", ""fab fa-medium"": ""&#xf23a; Medium brands"", ""fab fa-medapps"": ""&#xf3c6; MedApps brands"", ""fab fa-maxcdn"": ""&#xf136; MaxCDN brands"", ""fab fa-mastodon"": ""&#xf4f6; Mastodon brands"", ""fas fa-mars-stroke-v"": ""&#xf22a; Mars Stroke Vertical solid"", ""fas fa-mars-stroke-h"": ""&#xf22b; Mars Stroke Horizontal solid"", ""fas fa-mars-stroke"": ""&#xf229; Mars Stroke solid"", ""fas fa-mars-double"": ""&#xf227; Mars Double solid"", ""fas fa-mars"": ""&#xf222; Mars solid"", ""fas fa-map-signs"": ""&#xf277; Map Signs solid"", ""fas fa-map-pin"": ""&#xf276; Map Pin solid"", ""fas fa-map-marker-alt"": ""&#xf3c5; Map Marker Alternate solid"", ""fas fa-map-marker"": ""&#xf041; map-marker solid"", ""fas fa-map"": ""&#xf279; Map solid"", ""far fa-map"": ""&#xf279; Map regular"", ""fab fa-mandalorian"": ""&#xf50f; Mandalorian brands"", ""fas fa-male"": ""&#xf183; Male solid"", ""fas fa-magnet"": ""&#xf076; magnet solid"", ""fas fa-magic"": ""&#xf0d0; magic solid"", ""fab fa-magento"": ""&#xf3c4; Magento brands"", ""fab fa-lyft"": ""&#xf3c3; lyft brands"", ""fas fa-low-vision"": ""&#xf2a8; Low Vision solid"", ""fas fa-long-arrow-alt-up"": ""&#xf30c; Alternate Long Arrow Up solid"", ""fas fa-long-arrow-alt-right"": ""&#xf30b; Alternate Long Arrow Right solid"", ""fas fa-long-arrow-alt-left"": ""&#xf30a; Alternate Long Arrow Left solid"", ""fas fa-long-arrow-alt-down"": ""&#xf309; Alternate Long Arrow Down solid"", ""fas fa-lock-open"": ""&#xf3c1; Lock Open solid"", ""fas fa-lock"": ""&#xf023; lock solid"", ""fas fa-location-arrow"": ""&#xf124; location-arrow solid"", ""fas fa-list-ul"": ""&#xf0ca; list-ul solid"", ""fas fa-list-ol"": ""&#xf0cb; list-ol solid"", ""fas fa-list-alt"": ""&#xf022; List Alternate solid"", ""far fa-list-alt"": ""&#xf022; List Alternate regular"", ""fas fa-list"": ""&#xf03a; List solid"", ""fas fa-lira-sign"": ""&#xf195; Turkish Lira Sign solid"", ""fab fa-linux"": ""&#xf17c; Linux brands"", ""fab fa-linode"": ""&#xf2b8; Linode brands"", ""fab fa-linkedin-in"": ""&#xf0e1; LinkedIn In brands"", ""fab fa-linkedin"": ""&#xf08c; LinkedIn brands"", ""fas fa-link"": ""&#xf0c1; Link solid"", ""fab fa-line"": ""&#xf3c0; Line brands"", ""fas fa-lightbulb"": ""&#xf0eb; Lightbulb solid"", ""far fa-lightbulb"": ""&#xf0eb; Lightbulb regular"", ""fas fa-life-ring"": ""&#xf1cd; Life Ring solid"", ""far fa-life-ring"": ""&#xf1cd; Life Ring regular"", ""fas fa-level-up-alt"": ""&#xf3bf; Level Up Alternate solid"", ""fas fa-level-down-alt"": ""&#xf3be; Level Down Alternate solid"", ""fab fa-less"": ""&#xf41d; Less brands"", ""fas fa-lemon"": ""&#xf094; Lemon solid"", ""far fa-lemon"": ""&#xf094; Lemon regular"", ""fab fa-leanpub"": ""&#xf212; Leanpub brands"", ""fas fa-leaf"": ""&#xf06c; leaf solid"", ""fab fa-lastfm-square"": ""&#xf203; last.fm Square brands"", ""fab fa-lastfm"": ""&#xf202; last.fm brands"", ""fab fa-laravel"": ""&#xf3bd; Laravel brands"", ""fas fa-laptop"": ""&#xf109; Laptop solid"", ""fas fa-language"": ""&#xf1ab; Language solid"", ""fab fa-korvue"": ""&#xf42f; KORVUE brands"", ""fab fa-kickstarter-k"": ""&#xf3bc; Kickstarter K brands"", ""fab fa-kickstarter"": ""&#xf3bb; Kickstarter brands"", ""fab fa-keycdn"": ""&#xf3ba; KeyCDN brands"", ""fas fa-keyboard"": ""&#xf11c; Keyboard solid"", ""far fa-keyboard"": ""&#xf11c; Keyboard regular"", ""fab fa-keybase"": ""&#xf4f5; Keybase brands"", ""fas fa-key"": ""&#xf084; key solid"", ""fab fa-jsfiddle"": ""&#xf1cc; jsFiddle brands"", ""fab fa-js-square"": ""&#xf3b9; JavaScript (JS) Square brands"", ""fab fa-js"": ""&#xf3b8; JavaScript (JS) brands"", ""fab fa-joomla"": ""&#xf1aa; Joomla Logo brands"", ""fab fa-joget"": ""&#xf3b7; Joget brands"", ""fab fa-jenkins"": ""&#xf3b6; Jenkis brands"", ""fab fa-jedi-order"": ""&#xf50e; Jedi Order brands"", ""fab fa-java"": ""&#xf4e4; Java brands"", ""fab fa-itunes-note"": ""&#xf3b5; Itunes Note brands"", ""fab fa-itunes"": ""&#xf3b4; iTunes brands"", ""fas fa-italic"": ""&#xf033; italic solid"", ""fab fa-ioxhost"": ""&#xf208; ioxhost brands"", ""fab fa-internet-explorer"": ""&#xf26b; Internet-explorer brands"", ""fab fa-instagram"": ""&#xf16d; Instagram brands"", ""fas fa-info-circle"": ""&#xf05a; Info Circle solid"", ""fas fa-info"": ""&#xf129; Info solid"", ""fas fa-industry"": ""&#xf275; Industry solid"", ""fas fa-indent"": ""&#xf03c; Indent solid"", ""fas fa-inbox"": ""&#xf01c; inbox solid"", ""fab fa-imdb"": ""&#xf2d8; IMDB brands"", ""fas fa-images"": ""&#xf302; Images solid"", ""far fa-images"": ""&#xf302; Images regular"", ""fas fa-image"": ""&#xf03e; Image solid"", ""far fa-image"": ""&#xf03e; Image regular"", ""fas fa-id-card-alt"": ""&#xf47f; Identification Card Alternate solid"", ""fas fa-id-card"": ""&#xf2c2; Identification Card solid"", ""far fa-id-card"": ""&#xf2c2; Identification Card regular"", ""fas fa-id-badge"": ""&#xf2c1; Identification Badge solid"", ""far fa-id-badge"": ""&#xf2c1; Identification Badge regular"", ""fas fa-i-cursor"": ""&#xf246; I Beam Cursor solid"", ""fab fa-hubspot"": ""&#xf3b2; HubSpot brands"", ""fab fa-html5"": ""&#xf13b; HTML 5 Logo brands"", ""fab fa-houzz"": ""&#xf27c; Houzz brands"", ""fas fa-hourglass-start"": ""&#xf251; Hourglass Start solid"", ""fas fa-hourglass-half"": ""&#xf252; Hourglass Half solid"", ""fas fa-hourglass-end"": ""&#xf253; Hourglass End solid"", ""fas fa-hourglass"": ""&#xf254; Hourglass solid"", ""far fa-hourglass"": ""&#xf254; Hourglass regular"", ""fab fa-hotjar"": ""&#xf3b1; Hotjar brands"", ""fas fa-hospital-symbol"": ""&#xf47e; Hospital Symbol solid"", ""fas fa-hospital-alt"": ""&#xf47d; Hospital Alternate solid"", ""fas fa-hospital"": ""&#xf0f8; hospital solid"", ""far fa-hospital"": ""&#xf0f8; hospital regular"", ""fab fa-hooli"": ""&#xf427; Hooli brands"", ""fas fa-home"": ""&#xf015; home solid"", ""fas fa-hockey-puck"": ""&#xf453; Hockey Puck solid"", ""fas fa-history"": ""&#xf1da; History solid"", ""fab fa-hire-a-helper"": ""&#xf3b0; HireAHelper brands"", ""fab fa-hips"": ""&#xf452; Hips brands"", ""fas fa-heartbeat"": ""&#xf21e; Heartbeat solid"", ""fas fa-heart"": ""&#xf004; Heart solid"", ""far fa-heart"": ""&#xf004; Heart regular"", ""fas fa-headphones"": ""&#xf025; headphones solid"", ""fas fa-heading"": ""&#xf1dc; heading solid"", ""fas fa-hdd"": ""&#xf0a0; HDD solid"", ""far fa-hdd"": ""&#xf0a0; HDD regular"", ""fas fa-hashtag"": ""&#xf292; Hashtag solid"", ""fas fa-handshake"": ""&#xf2b5; Handshake solid"", ""far fa-handshake"": ""&#xf2b5; Handshake regular"", ""fas fa-hands-helping"": ""&#xf4c4; Helping Hands solid"", ""fas fa-hands"": ""&#xf4c2; Hands solid"", ""fas fa-hand-spock"": ""&#xf259; Spock (Hand) solid"", ""far fa-hand-spock"": ""&#xf259; Spock (Hand) regular"", ""fas fa-hand-scissors"": ""&#xf257; Scissors (Hand) solid"", ""far fa-hand-scissors"": ""&#xf257; Scissors (Hand) regular"", ""fas fa-hand-rock"": ""&#xf255; Rock (Hand) solid"", ""far fa-hand-rock"": ""&#xf255; Rock (Hand) regular"", ""fas fa-hand-pointer"": ""&#xf25a; Pointer (Hand) solid"", ""far fa-hand-pointer"": ""&#xf25a; Pointer (Hand) regular"", ""fas fa-hand-point-up"": ""&#xf0a6; Hand Pointing Up solid"", ""far fa-hand-point-up"": ""&#xf0a6; Hand Pointing Up regular"", ""fas fa-hand-point-right"": ""&#xf0a4; Hand Pointing Right solid"", ""far fa-hand-point-right"": ""&#xf0a4; Hand Pointing Right regular"", ""fas fa-hand-point-left"": ""&#xf0a5; Hand Pointing Left solid"", ""far fa-hand-point-left"": ""&#xf0a5; Hand Pointing Left regular"", ""fas fa-hand-point-down"": ""&#xf0a7; Hand Pointing Down solid"", ""far fa-hand-point-down"": ""&#xf0a7; Hand Pointing Down regular"", ""fas fa-hand-peace"": ""&#xf25b; Peace (Hand) solid"", ""far fa-hand-peace"": ""&#xf25b; Peace (Hand) regular"", ""fas fa-hand-paper"": ""&#xf256; Paper (Hand) solid"", ""far fa-hand-paper"": ""&#xf256; Paper (Hand) regular"", ""fas fa-hand-lizard"": ""&#xf258; Lizard (Hand) solid"", ""far fa-hand-lizard"": ""&#xf258; Lizard (Hand) regular"", ""fas fa-hand-holding-usd"": ""&#xf4c0; Hand Holding US Dollar solid"", ""fas fa-hand-holding-heart"": ""&#xf4be; Hand Holding Heart solid"", ""fas fa-hand-holding"": ""&#xf4bd; Hand Holding solid"", ""fab fa-hacker-news-square"": ""&#xf3af; Hacker News Square brands"", ""fab fa-hacker-news"": ""&#xf1d4; Hacker News brands"", ""fas fa-h-square"": ""&#xf0fd; H Square solid"", ""fab fa-gulp"": ""&#xf3ae; Gulp brands"", ""fab fa-grunt"": ""&#xf3ad; Grunt brands"", ""fab fa-gripfire"": ""&#xf3ac; Gripfire, Inc. brands"", ""fab fa-grav"": ""&#xf2d6; Grav brands"", ""fab fa-gratipay"": ""&#xf184; Gratipay (Gittip) brands"", ""fas fa-graduation-cap"": ""&#xf19d; Graduation Cap solid"", ""fab fa-google-wallet"": ""&#xf1ee; Google Wallet brands"", ""fab fa-google-plus-square"": ""&#xf0d4; Google Plus Square brands"", ""fab fa-google-plus-g"": ""&#xf0d5; Google Plus G brands"", ""fab fa-google-plus"": ""&#xf2b3; Google Plus brands"", ""fab fa-google-play"": ""&#xf3ab; Google Play brands"", ""fab fa-google-drive"": ""&#xf3aa; Google Drive brands"", ""fab fa-google"": ""&#xf1a0; Google Logo brands"", ""fab fa-goodreads-g"": ""&#xf3a9; Goodreads G brands"", ""fab fa-goodreads"": ""&#xf3a8; Goodreads brands"", ""fas fa-golf-ball"": ""&#xf450; Golf Ball solid"", ""fab fa-gofore"": ""&#xf3a7; Gofore brands"", ""fas fa-globe"": ""&#xf0ac; Globe solid"", ""fab fa-glide-g"": ""&#xf2a6; Glide G brands"", ""fab fa-glide"": ""&#xf2a5; Glide brands"", ""fas fa-glass-martini"": ""&#xf000; Martini Glass solid"", ""fab fa-gitter"": ""&#xf426; Gitter brands"", ""fab fa-gitlab"": ""&#xf296; GitLab brands"", ""fab fa-gitkraken"": ""&#xf3a6; GitKraken brands"", ""fab fa-github-square"": ""&#xf092; GitHub Square brands"", ""fab fa-github-alt"": ""&#xf113; Alternate GitHub brands"", ""fab fa-github"": ""&#xf09b; GitHub brands"", ""fab fa-git-square"": ""&#xf1d2; Git Square brands"", ""fab fa-git"": ""&#xf1d3; Git brands"", ""fas fa-gift"": ""&#xf06b; gift solid"", ""fab fa-gg-circle"": ""&#xf261; GG Currency Circle brands"", ""fab fa-gg"": ""&#xf260; GG Currency brands"", ""fab fa-get-pocket"": ""&#xf265; Get Pocket brands"", ""fas fa-genderless"": ""&#xf22d; Genderless solid"", ""fas fa-gem"": ""&#xf3a5; Gem solid"", ""far fa-gem"": ""&#xf3a5; Gem regular"", ""fas fa-gavel"": ""&#xf0e3; Gavel solid"", ""fas fa-gamepad"": ""&#xf11b; Gamepad solid"", ""fab fa-galactic-senate"": ""&#xf50d; Galactic Senate brands"", ""fab fa-galactic-republic"": ""&#xf50c; Galactic Republic brands"", ""fas fa-futbol"": ""&#xf1e3; Futbol solid"", ""far fa-futbol"": ""&#xf1e3; Futbol regular"", ""fab fa-fulcrum"": ""&#xf50b; Fulcrum brands"", ""fas fa-frown"": ""&#xf119; Frown solid"", ""far fa-frown"": ""&#xf119; Frown regular"", ""fab fa-freebsd"": ""&#xf3a4; FreeBSD brands"", ""fab fa-free-code-camp"": ""&#xf2c5; Free Code Camp brands"", ""fab fa-foursquare"": ""&#xf180; Foursquare brands"", ""fas fa-forward"": ""&#xf04e; forward solid"", ""fab fa-forumbee"": ""&#xf211; Forumbee brands"", ""fab fa-fort-awesome-alt"": ""&#xf3a3; Alternate Fort Awesome brands"", ""fab fa-fort-awesome"": ""&#xf286; Fort Awesome brands"", ""fas fa-football-ball"": ""&#xf44e; Football Ball solid"", ""fab fa-fonticons-fi"": ""&#xf3a2; Fonticons Fi brands"", ""fab fa-fonticons"": ""&#xf280; Fonticons brands"", ""far fa-font-awesome-logo-full"": ""&#xf4e6; Font Awesome Full Logo regular"", ""fas fa-font-awesome-logo-full"": ""&#xf4e6; Font Awesome Full Logo solid"", ""fab fa-font-awesome-logo-full"": ""&#xf4e6; Font Awesome Full Logo brands"", ""fab fa-font-awesome-flag"": ""&#xf425; Font Awesome Flag brands"", ""fab fa-font-awesome-alt"": ""&#xf35c; Alternate Font Awesome brands"", ""fab fa-font-awesome"": ""&#xf2b4; Font Awesome brands"", ""fas fa-font"": ""&#xf031; font solid"", ""fas fa-folder-open"": ""&#xf07c; Folder Open solid"", ""far fa-folder-open"": ""&#xf07c; Folder Open regular"", ""fas fa-folder"": ""&#xf07b; Folder solid"", ""far fa-folder"": ""&#xf07b; Folder regular"", ""fab fa-fly"": ""&#xf417; Fly brands"", ""fab fa-flipboard"": ""&#xf44d; Flipboard brands"", ""fab fa-flickr"": ""&#xf16e; Flickr brands"", ""fas fa-flask"": ""&#xf0c3; Flask solid"", ""fas fa-flag-checkered"": ""&#xf11e; flag-checkered solid"", ""fas fa-flag"": ""&#xf024; flag solid"", ""far fa-flag"": ""&#xf024; flag regular"", ""fab fa-firstdraft"": ""&#xf3a1; firstdraft brands"", ""fab fa-first-order-alt"": ""&#xf50a; Alternate First Order brands"", ""fab fa-first-order"": ""&#xf2b0; First Order brands"", ""fas fa-first-aid"": ""&#xf479; First Aid solid"", ""fab fa-firefox"": ""&#xf269; Firefox brands"", ""fas fa-fire-extinguisher"": ""&#xf134; fire-extinguisher solid"", ""fas fa-fire"": ""&#xf06d; fire solid"", ""fas fa-filter"": ""&#xf0b0; Filter solid"", ""fas fa-film"": ""&#xf008; Film solid"", ""fas fa-file-word"": ""&#xf1c2; Word File solid"", ""far fa-file-word"": ""&#xf1c2; Word File regular"", ""fas fa-file-video"": ""&#xf1c8; Video File solid"", ""far fa-file-video"": ""&#xf1c8; Video File regular"", ""fas fa-file-powerpoint"": ""&#xf1c4; Powerpoint File solid"", ""far fa-file-powerpoint"": ""&#xf1c4; Powerpoint File regular"", ""fas fa-file-pdf"": ""&#xf1c1; PDF File solid"", ""far fa-file-pdf"": ""&#xf1c1; PDF File regular"", ""fas fa-file-medical-alt"": ""&#xf478; Medical File Alternate solid"", ""fas fa-file-medical"": ""&#xf477; Medical File solid"", ""fas fa-file-image"": ""&#xf1c5; Image File solid"", ""far fa-file-image"": ""&#xf1c5; Image File regular"", ""fas fa-file-excel"": ""&#xf1c3; Excel File solid"", ""far fa-file-excel"": ""&#xf1c3; Excel File regular"", ""fas fa-file-code"": ""&#xf1c9; Code File solid"", ""far fa-file-code"": ""&#xf1c9; Code File regular"", ""fas fa-file-audio"": ""&#xf1c7; Audio File solid"", ""far fa-file-audio"": ""&#xf1c7; Audio File regular"", ""fas fa-file-archive"": ""&#xf1c6; Archive File solid"", ""far fa-file-archive"": ""&#xf1c6; Archive File regular"", ""fas fa-file-alt"": ""&#xf15c; Alternate File solid"", ""far fa-file-alt"": ""&#xf15c; Alternate File regular"", ""fas fa-file"": ""&#xf15b; File solid"", ""far fa-file"": ""&#xf15b; File regular"", ""fas fa-fighter-jet"": ""&#xf0fb; fighter-jet solid"", ""fas fa-female"": ""&#xf182; Female solid"", ""fas fa-fax"": ""&#xf1ac; Fax solid"", ""fas fa-fast-forward"": ""&#xf050; fast-forward solid"", ""fas fa-fast-backward"": ""&#xf049; fast-backward solid"", ""fab fa-facebook-square"": ""&#xf082; Facebook Square brands"", ""fab fa-facebook-messenger"": ""&#xf39f; Facebook Messenger brands"", ""fab fa-facebook-f"": ""&#xf39e; Facebook F brands"", ""fab fa-facebook"": ""&#xf09a; Facebook brands"", ""fas fa-eye-slash"": ""&#xf070; Eye Slash solid"", ""far fa-eye-slash"": ""&#xf070; Eye Slash regular"", ""fas fa-eye-dropper"": ""&#xf1fb; Eye Dropper solid"", ""fas fa-eye"": ""&#xf06e; Eye solid"", ""far fa-eye"": ""&#xf06e; Eye regular"", ""fas fa-external-link-square-alt"": ""&#xf360; Alternate External Link Square solid"", ""fas fa-external-link-alt"": ""&#xf35d; Alternate External Link solid"", ""fab fa-expeditedssl"": ""&#xf23e; ExpeditedSSL brands"", ""fas fa-expand-arrows-alt"": ""&#xf31e; Alternate Expand Arrows solid"", ""fas fa-expand"": ""&#xf065; Expand solid"", ""fas fa-exclamation-triangle"": ""&#xf071; Exclamation Triangle solid"", ""fas fa-exclamation-circle"": ""&#xf06a; Exclamation Circle solid"", ""fas fa-exclamation"": ""&#xf12a; exclamation solid"", ""fas fa-exchange-alt"": ""&#xf362; Alternate Exchange solid"", ""fas fa-euro-sign"": ""&#xf153; Euro Sign solid"", ""fab fa-etsy"": ""&#xf2d7; Etsy brands"", ""fab fa-ethereum"": ""&#xf42e; Ethereum brands"", ""fab fa-erlang"": ""&#xf39d; Erlang brands"", ""fas fa-eraser"": ""&#xf12d; eraser solid"", ""fab fa-envira"": ""&#xf299; Envira Gallery brands"", ""fas fa-envelope-square"": ""&#xf199; Envelope Square solid"", ""fas fa-envelope-open"": ""&#xf2b6; Envelope Open solid"", ""far fa-envelope-open"": ""&#xf2b6; Envelope Open regular"", ""fas fa-envelope"": ""&#xf0e0; Envelope solid"", ""far fa-envelope"": ""&#xf0e0; Envelope regular"", ""fab fa-empire"": ""&#xf1d1; Galactic Empire brands"", ""fab fa-ember"": ""&#xf423; Ember brands"", ""fas fa-ellipsis-v"": ""&#xf142; Vertical Ellipsis solid"", ""fas fa-ellipsis-h"": ""&#xf141; Horizontal Ellipsis solid"", ""fab fa-elementor"": ""&#xf430; Elementor brands"", ""fas fa-eject"": ""&#xf052; eject solid"", ""fas fa-edit"": ""&#xf044; Edit solid"", ""far fa-edit"": ""&#xf044; Edit regular"", ""fab fa-edge"": ""&#xf282; Edge Browser brands"", ""fab fa-ebay"": ""&#xf4f4; eBay brands"", ""fab fa-earlybirds"": ""&#xf39a; Earlybirds brands"", ""fab fa-dyalog"": ""&#xf399; Dyalog brands"", ""fab fa-drupal"": ""&#xf1a9; Drupal Logo brands"", ""fab fa-dropbox"": ""&#xf16b; Dropbox brands"", ""fab fa-dribbble-square"": ""&#xf397; Dribbble Square brands"", ""fab fa-dribbble"": ""&#xf17d; Dribbble brands"", ""fab fa-draft2digital"": ""&#xf396; Draft2digital brands"", ""fas fa-download"": ""&#xf019; Download solid"", ""fas fa-dove"": ""&#xf4ba; Dove solid"", ""fas fa-dot-circle"": ""&#xf192; Dot Circle solid"", ""far fa-dot-circle"": ""&#xf192; Dot Circle regular"", ""fas fa-donate"": ""&#xf4b9; Donate solid"", ""fas fa-dolly-flatbed"": ""&#xf474; Dolly Flatbed solid"", ""fas fa-dolly"": ""&#xf472; Dolly solid"", ""fas fa-dollar-sign"": ""&#xf155; Dollar Sign solid"", ""fab fa-docker"": ""&#xf395; Docker brands"", ""fab fa-dochub"": ""&#xf394; DocHub brands"", ""fas fa-dna"": ""&#xf471; DNA solid"", ""fab fa-discourse"": ""&#xf393; Discourse brands"", ""fab fa-discord"": ""&#xf392; Discord brands"", ""fab fa-digital-ocean"": ""&#xf391; Digital Ocean brands"", ""fab fa-digg"": ""&#xf1a6; Digg Logo brands"", ""fas fa-diagnoses"": ""&#xf470; Diagnoses solid"", ""fab fa-deviantart"": ""&#xf1bd; deviantART brands"", ""fas fa-desktop"": ""&#xf108; Desktop solid"", ""fab fa-deskpro"": ""&#xf38f; Deskpro brands"", ""fab fa-deploydog"": ""&#xf38e; deploy.dog brands"", ""fab fa-delicious"": ""&#xf1a5; Delicious Logo brands"", ""fas fa-deaf"": ""&#xf2a4; Deaf solid"", ""fas fa-database"": ""&#xf1c0; Database solid"", ""fab fa-dashcube"": ""&#xf210; DashCube brands"", ""fab fa-d-and-d"": ""&#xf38d; Dungeons & Dragons brands"", ""fab fa-cuttlefish"": ""&#xf38c; Cuttlefish brands"", ""fas fa-cut"": ""&#xf0c4; Cut solid"", ""fas fa-cubes"": ""&#xf1b3; Cubes solid"", ""fas fa-cube"": ""&#xf1b2; Cube solid"", ""fab fa-css3-alt"": ""&#xf38b; Alternate CSS3 Logo brands"", ""fab fa-css3"": ""&#xf13c; CSS 3 Logo brands"", ""fas fa-crosshairs"": ""&#xf05b; Crosshairs solid"", ""fas fa-crop"": ""&#xf125; crop solid"", ""fas fa-credit-card"": ""&#xf09d; Credit Card solid"", ""far fa-credit-card"": ""&#xf09d; Credit Card regular"", ""fab fa-creative-commons-share"": ""&#xf4f2; Creative Commons Share brands"", ""fab fa-creative-commons-sampling-plus"": ""&#xf4f1; Creative Commons Sampling + brands"", ""fab fa-creative-commons-sampling"": ""&#xf4f0; Creative Commons Sampling brands"", ""fab fa-creative-commons-sa"": ""&#xf4ef; Creative Commons Share Alike brands"", ""fab fa-creative-commons-remix"": ""&#xf4ee; Creative Commons Remix brands"", ""fab fa-creative-commons-pd-alt"": ""&#xf4ed; Creative Commons Public Domain Alternate brands"", ""fab fa-creative-commons-pd"": ""&#xf4ec; Creative Commons Public Domain brands"", ""fab fa-creative-commons-nd"": ""&#xf4eb; Creative Commons No Derivative Works brands"", ""fab fa-creative-commons-nc-jp"": ""&#xf4ea; Creative Commons Noncommercial (Yen Sign) brands"", ""fab fa-creative-commons-nc-eu"": ""&#xf4e9; Creative Commons Noncommercial (Euro Sign) brands"", ""fab fa-creative-commons-nc"": ""&#xf4e8; Creative Commons Noncommercial brands"", ""fab fa-creative-commons-by"": ""&#xf4e7; Creative Commons Attribution brands"", ""fab fa-creative-commons"": ""&#xf25e; Creative Commons brands"", ""fab fa-cpanel"": ""&#xf388; cPanel brands"", ""fas fa-couch"": ""&#xf4b8; Couch solid"", ""fas fa-copyright"": ""&#xf1f9; Copyright solid"", ""far fa-copyright"": ""&#xf1f9; Copyright regular"", ""fas fa-copy"": ""&#xf0c5; Copy solid"", ""far fa-copy"": ""&#xf0c5; Copy regular"", ""fab fa-contao"": ""&#xf26d; Contao brands"", ""fab fa-connectdevelop"": ""&#xf20e; Connect Develop brands"", ""fas fa-compress"": ""&#xf066; Compress solid"", ""fas fa-compass"": ""&#xf14e; Compass solid"", ""far fa-compass"": ""&#xf14e; Compass regular"", ""fas fa-comments"": ""&#xf086; comments solid"", ""far fa-comments"": ""&#xf086; comments regular"", ""fas fa-comment-slash"": ""&#xf4b3; Comment Slash solid"", ""fas fa-comment-dots"": ""&#xf4ad; Comment Dots solid"", ""far fa-comment-dots"": ""&#xf4ad; Comment Dots regular"", ""fas fa-comment-alt"": ""&#xf27a; Alternate Comment solid"", ""far fa-comment-alt"": ""&#xf27a; Alternate Comment regular"", ""fas fa-comment"": ""&#xf075; comment solid"", ""far fa-comment"": ""&#xf075; comment regular"", ""fas fa-columns"": ""&#xf0db; Columns solid"", ""fas fa-cogs"": ""&#xf085; cogs solid"", ""fas fa-cog"": ""&#xf013; cog solid"", ""fas fa-coffee"": ""&#xf0f4; Coffee solid"", ""fab fa-codiepie"": ""&#xf284; Codie Pie brands"", ""fab fa-codepen"": ""&#xf1cb; Codepen brands"", ""fas fa-code-branch"": ""&#xf126; Code Branch solid"", ""fas fa-code"": ""&#xf121; Code solid"", ""fab fa-cloudversify"": ""&#xf385; cloudversify brands"", ""fab fa-cloudsmith"": ""&#xf384; Cloudsmith brands"", ""fab fa-cloudscale"": ""&#xf383; cloudscale.ch brands"", ""fas fa-cloud-upload-alt"": ""&#xf382; Cloud Upload Alternate solid"", ""fas fa-cloud-download-alt"": ""&#xf381; Cloud Download Alternate solid"", ""fas fa-cloud"": ""&#xf0c2; Cloud solid"", ""fas fa-closed-captioning"": ""&#xf20a; Closed Captioning solid"", ""far fa-closed-captioning"": ""&#xf20a; Closed Captioning regular"", ""fas fa-clone"": ""&#xf24d; Clone solid"", ""far fa-clone"": ""&#xf24d; Clone regular"", ""fas fa-clock"": ""&#xf017; Clock solid"", ""far fa-clock"": ""&#xf017; Clock regular"", ""fas fa-clipboard-list"": ""&#xf46d; Clipboard List solid"", ""fas fa-clipboard-check"": ""&#xf46c; Clipboard Check solid"", ""fas fa-clipboard"": ""&#xf328; Clipboard solid"", ""far fa-clipboard"": ""&#xf328; Clipboard regular"", ""fas fa-circle-notch"": ""&#xf1ce; Circle Notched solid"", ""fas fa-circle"": ""&#xf111; Circle solid"", ""far fa-circle"": ""&#xf111; Circle regular"", ""fab fa-chrome"": ""&#xf268; Chrome brands"", ""fas fa-child"": ""&#xf1ae; Child solid"", ""fas fa-chevron-up"": ""&#xf077; chevron-up solid"", ""fas fa-chevron-right"": ""&#xf054; chevron-right solid"", ""fas fa-chevron-left"": ""&#xf053; chevron-left solid"", ""fas fa-chevron-down"": ""&#xf078; chevron-down solid"", ""fas fa-chevron-circle-up"": ""&#xf139; Chevron Circle Up solid"", ""fas fa-chevron-circle-right"": ""&#xf138; Chevron Circle Right solid"", ""fas fa-chevron-circle-left"": ""&#xf137; Chevron Circle Left solid"", ""fas fa-chevron-circle-down"": ""&#xf13a; Chevron Circle Down solid"", ""fas fa-chess-rook"": ""&#xf447; Chess Rook solid"", ""fas fa-chess-queen"": ""&#xf445; Chess Queen solid"", ""fas fa-chess-pawn"": ""&#xf443; Chess Pawn solid"", ""fas fa-chess-knight"": ""&#xf441; Chess Knight solid"", ""fas fa-chess-king"": ""&#xf43f; Chess King solid"", ""fas fa-chess-board"": ""&#xf43c; Chess Board solid"", ""fas fa-chess-bishop"": ""&#xf43a; Chess Bishop solid"", ""fas fa-chess"": ""&#xf439; Chess solid"", ""fas fa-check-square"": ""&#xf14a; Check Square solid"", ""far fa-check-square"": ""&#xf14a; Check Square regular"", ""fas fa-check-circle"": ""&#xf058; Check Circle solid"", ""far fa-check-circle"": ""&#xf058; Check Circle regular"", ""fas fa-check"": ""&#xf00c; Check solid"", ""fas fa-chart-pie"": ""&#xf200; Pie Chart solid"", ""fas fa-chart-line"": ""&#xf201; Line Chart solid"", ""fas fa-chart-bar"": ""&#xf080; Bar Chart solid"", ""far fa-chart-bar"": ""&#xf080; Bar Chart regular"", ""fas fa-chart-area"": ""&#xf1fe; Area Chart solid"", ""fas fa-certificate"": ""&#xf0a3; certificate solid"", ""fab fa-centercode"": ""&#xf380; Centercode brands"", ""fab fa-cc-visa"": ""&#xf1f0; Visa Credit Card brands"", ""fab fa-cc-stripe"": ""&#xf1f5; Stripe Credit Card brands"", ""fab fa-cc-paypal"": ""&#xf1f4; Paypal Credit Card brands"", ""fab fa-cc-mastercard"": ""&#xf1f1; MasterCard Credit Card brands"", ""fab fa-cc-jcb"": ""&#xf24b; JCB Credit Card brands"", ""fab fa-cc-discover"": ""&#xf1f2; Discover Credit Card brands"", ""fab fa-cc-diners-club"": ""&#xf24c; Diner's Club Credit Card brands"", ""fab fa-cc-apple-pay"": ""&#xf416; Apple Pay Credit Card brands"", ""fab fa-cc-amex"": ""&#xf1f3; American Express Credit Card brands"", ""fab fa-cc-amazon-pay"": ""&#xf42d; Amazon Pay Credit Card brands"", ""fas fa-cart-plus"": ""&#xf217; Add to Shopping Cart solid"", ""fas fa-cart-arrow-down"": ""&#xf218; Shopping Cart Arrow Down solid"", ""fas fa-caret-up"": ""&#xf0d8; Caret Up solid"", ""fas fa-caret-square-up"": ""&#xf151; Caret Square Up solid"", ""far fa-caret-square-up"": ""&#xf151; Caret Square Up regular"", ""fas fa-caret-square-right"": ""&#xf152; Caret Square Right solid"", ""far fa-caret-square-right"": ""&#xf152; Caret Square Right regular"", ""fas fa-caret-square-left"": ""&#xf191; Caret Square Left solid"", ""far fa-caret-square-left"": ""&#xf191; Caret Square Left regular"", ""fas fa-caret-square-down"": ""&#xf150; Caret Square Down solid"", ""far fa-caret-square-down"": ""&#xf150; Caret Square Down regular"", ""fas fa-caret-right"": ""&#xf0da; Caret Right solid"", ""fas fa-caret-left"": ""&#xf0d9; Caret Left solid"", ""fas fa-caret-down"": ""&#xf0d7; Caret Down solid"", ""fas fa-car"": ""&#xf1b9; Car solid"", ""fas fa-capsules"": ""&#xf46b; Capsules solid"", ""fas fa-camera-retro"": ""&#xf083; Retro Camera solid"", ""fas fa-camera"": ""&#xf030; camera solid"", ""fas fa-calendar-times"": ""&#xf273; Calendar Times solid"", ""far fa-calendar-times"": ""&#xf273; Calendar Times regular"", ""fas fa-calendar-plus"": ""&#xf271; Calendar Plus solid"", ""far fa-calendar-plus"": ""&#xf271; Calendar Plus regular"", ""fas fa-calendar-minus"": ""&#xf272; Calendar Minus solid"", ""far fa-calendar-minus"": ""&#xf272; Calendar Minus regular"", ""fas fa-calendar-check"": ""&#xf274; Calendar Check solid"", ""far fa-calendar-check"": ""&#xf274; Calendar Check regular"", ""fas fa-calendar-alt"": ""&#xf073; Alternate Calendar solid"", ""far fa-calendar-alt"": ""&#xf073; Alternate Calendar regular"", ""fas fa-calendar"": ""&#xf133; Calendar solid"", ""far fa-calendar"": ""&#xf133; Calendar regular"", ""fas fa-calculator"": ""&#xf1ec; Calculator solid"", ""fab fa-buysellads"": ""&#xf20d; BuySellAds brands"", ""fas fa-bus"": ""&#xf207; Bus solid"" }"; #endregion var iconsObject = JsonConvert.DeserializeObject<EntityRecord>(json); foreach (var prop in iconsObject.Properties) { var valueArray = prop.Value.ToString().Split("; "); var symbol = valueArray[0] + ";"; var name = valueArray[1]; var icon = new IconFontAwesome(){ Class = prop.Key, Symbol = symbol, Name = name }; icons.Add(icon); } return icons; } } }
52.26151
163
0.562208
[ "Apache-2.0" ]
emersonlara/WebVella-ERP
WebVella.Erp.Web/Services/RenderService.cs
85,136
C#
using System.Collections.Generic; namespace Smellyriver.TankInspector.UIComponents { internal interface IConsumableViewModel : IAccessoryViewModel { IEnumerable<string> Tags { get; } IEnumerable<string> IncompatibleTags { get; } } }
23.636364
62
0.730769
[ "MIT" ]
BTreeNewBee/tankinspector
TankInspector/UIComponents/IConsumableViewModel.cs
262
C#
/* Copyright (c) 2017, Lars Brubaker, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Threading; using System.Threading.Tasks; using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.DataConverters3D; using MatterHackers.Localizations; using MatterHackers.MatterControl.DesignTools; using MatterHackers.MatterControl.DesignTools.Operations; using MatterHackers.PolygonMesh; using MatterHackers.PolygonMesh.Csg; using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { [ShowUpdateButton] public class SubtractAndReplaceObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ICustomEditorDraw, IPropertyGridModifier { public SubtractAndReplaceObject3D_2() { Name = "Subtract and Replace"; } public bool DoEditorDraw(bool isSelected) { return isSelected; } [HideFromEditor] public SelectedChildren ComputedChildren { get; set; } = new SelectedChildren(); [DisplayName("Part(s) to Subtract and Replace")] public SelectedChildren SelectedChildren { get; set; } = new SelectedChildren(); #if DEBUG public ProcessingModes Processing { get; set; } = ProcessingModes.Polygons; [EnumDisplay(Mode = EnumDisplayAttribute.PresentationMode.Buttons)] public ProcessingResolution OutputResolution { get; set; } = ProcessingResolution._64; [EnumDisplay(Mode = EnumDisplayAttribute.PresentationMode.Buttons)] public IplicitSurfaceMethod MeshAnalysis { get; set; } [EnumDisplay(Mode = EnumDisplayAttribute.PresentationMode.Buttons)] public ProcessingResolution InputResolution { get; set; } = ProcessingResolution._64; #else private ProcessingModes Processing { get; set; } = ProcessingModes.Polygons; private ProcessingResolution OutputResolution { get; set; } = ProcessingResolution._64; private IplicitSurfaceMethod MeshAnalysis { get; set; } private ProcessingResolution InputResolution { get; set; } = ProcessingResolution._64; #endif public void AddEditorTransparents(Object3DControlsLayer layer, List<Object3DView> transparentMeshes, DrawEventArgs e) { if (layer.Scene.SelectedItem != null && layer.Scene.SelectedItem == this) { var parentOfSubtractTargets = this.SourceContainer.DescendantsAndSelfMultipleChildrenFirstOrSelf(); var removeObjects = parentOfSubtractTargets.Children .Where(i => SelectedChildren.Contains(i.ID)) .SelectMany(c => c.VisibleMeshes()) .ToList(); foreach (var item in removeObjects) { var color = item.WorldColor(checkOutputType: true); transparentMeshes.Add(new Object3DView(item, color.WithAlpha(color.Alpha0To1 * .2))); } } } public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { return; } public AxisAlignedBoundingBox GetEditorWorldspaceAABB(Object3DControlsLayer layer) { return AxisAlignedBoundingBox.Empty(); } public override async void OnInvalidate(InvalidateArgs invalidateType) { if ((invalidateType.InvalidateType.HasFlag(InvalidateType.Children) || invalidateType.InvalidateType.HasFlag(InvalidateType.Matrix) || invalidateType.InvalidateType.HasFlag(InvalidateType.Mesh)) && invalidateType.Source != this && !RebuildLocked) { await Rebuild(); } else if (invalidateType.InvalidateType.HasFlag(InvalidateType.Properties) && invalidateType.Source == this) { await Rebuild(); } else { base.OnInvalidate(invalidateType); } } private CancellationTokenSource cancellationToken; public bool IsBuilding => this.cancellationToken != null; public void CancelBuild() { var threadSafe = this.cancellationToken; if (threadSafe != null) { threadSafe.Cancel(); } } public override Task Rebuild() { var rebuildLocks = this.RebuilLockAll(); // spin up a task to calculate the paint return ApplicationController.Instance.Tasks.Execute("Replacing".Localize(), null, (reporter, cancellationTokenSource) => { this.cancellationToken = cancellationTokenSource as CancellationTokenSource; try { SubtractAndReplace(cancellationTokenSource.Token, reporter); var newComputedChildren = new SelectedChildren(); foreach (var id in SelectedChildren) { newComputedChildren.Add(id); } ComputedChildren = newComputedChildren; } catch { } this.cancellationToken = null; UiThread.RunOnIdle(() => { rebuildLocks.Dispose(); this.CancelAllParentBuilding(); Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children)); }); return Task.CompletedTask; }); } public void SubtractAndReplace() { SubtractAndReplace(CancellationToken.None, null); } private void SubtractAndReplace(CancellationToken cancellationToken, IProgress<ProgressStatus> reporter) { SourceContainer.Visible = true; RemoveAllButSource(); var parentOfPaintTargets = SourceContainer.DescendantsAndSelfMultipleChildrenFirstOrSelf(); if (parentOfPaintTargets.Children.Count() < 2) { if (parentOfPaintTargets.Children.Count() == 1) { this.Children.Add(SourceContainer.Clone()); SourceContainer.Visible = false; } return; } SubtractObject3D_2.CleanUpSelectedChildrenIDs(this); var paintObjects = parentOfPaintTargets.Children .Where((i) => SelectedChildren .Contains(i.ID)) .SelectMany(c => c.VisibleMeshes()) .ToList(); var keepItems = parentOfPaintTargets.Children .Where((i) => !SelectedChildren .Contains(i.ID)); var keepVisibleItems = keepItems.SelectMany(c => c.VisibleMeshes()).ToList(); if (paintObjects.Any() && keepVisibleItems.Any()) { var totalOperations = paintObjects.Count * keepVisibleItems.Count; double amountPerOperation = 1.0 / totalOperations; double ratioCompleted = 0; var progressStatus = new ProgressStatus { Status = "Do CSG" }; foreach (var keep in keepVisibleItems) { var keepResultsMesh = keep.Mesh; var keepWorldMatrix = keep.WorldMatrix(SourceContainer); foreach (var paint in paintObjects) { if (cancellationToken.IsCancellationRequested) { SourceContainer.Visible = true; RemoveAllButSource(); return; } Mesh paintMesh = BooleanProcessing.Do(keepResultsMesh, keepWorldMatrix, // paint data paint.Mesh, paint.WorldMatrix(SourceContainer), // operation type CsgModes.Intersect, Processing, InputResolution, OutputResolution, // reporting data reporter, amountPerOperation, ratioCompleted, progressStatus, cancellationToken); keepResultsMesh = BooleanProcessing.Do(keepResultsMesh, keepWorldMatrix, // point data paint.Mesh, paint.WorldMatrix(SourceContainer), // operation type CsgModes.Subtract, Processing, InputResolution, OutputResolution, // reporting data reporter, amountPerOperation, ratioCompleted, progressStatus, cancellationToken); // after the first time we get a result the results mesh is in the right coordinate space keepWorldMatrix = Matrix4X4.Identity; // store our intersection (paint) results mesh var paintResultsItem = new Object3D() { Mesh = paintMesh, Visible = false, OwnerID = paint.ID }; // copy all the properties but the matrix paintResultsItem.CopyWorldProperties(paint, SourceContainer, Object3DPropertyFlags.All & (~(Object3DPropertyFlags.Matrix | Object3DPropertyFlags.Visible))); // and add it to this this.Children.Add(paintResultsItem); // report our progress ratioCompleted += amountPerOperation; progressStatus.Progress0To1 = ratioCompleted; reporter?.Report(progressStatus); } // store our results mesh var keepResultsItem = new Object3D() { Mesh = keepResultsMesh, Visible = false, OwnerID = keep.ID }; // copy all the properties but the matrix keepResultsItem.CopyWorldProperties(keep, SourceContainer, Object3DPropertyFlags.All & (~(Object3DPropertyFlags.Matrix | Object3DPropertyFlags.Visible))); // and add it to this this.Children.Add(keepResultsItem); } foreach (var child in Children) { child.Visible = true; } SourceContainer.Visible = false; } } public void UpdateControls(PublicPropertyChange change) { change.SetRowVisible(nameof(InputResolution), () => Processing != ProcessingModes.Polygons); change.SetRowVisible(nameof(OutputResolution), () => Processing != ProcessingModes.Polygons); change.SetRowVisible(nameof(MeshAnalysis), () => Processing != ProcessingModes.Polygons); change.SetRowVisible(nameof(InputResolution), () => Processing != ProcessingModes.Polygons && MeshAnalysis == IplicitSurfaceMethod.Grid); } } }
31.395833
162
0.727462
[ "BSD-2-Clause" ]
fortsnek9348/MatterControl
MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D_2.cs
10,551
C#
using System; using System.Collections.Generic; namespace PossumLabs.Specflow.Core.FluidDataCreation { internal class IgnoreCaseEqualityComparer : IEqualityComparer<string> { public bool Equals(string x, string y) => x.Equals(y, StringComparison.InvariantCultureIgnoreCase); public int GetHashCode(string obj) => obj.ToUpper().GetHashCode(); } }
28.571429
73
0.7
[ "MIT" ]
BasHamer/PossumLabs.Specflow.Core
PossumLabs.Specflow.Core/FluidDataCreation/IgnoreCaseEqualityComparer.cs
402
C#
// Copyright (c) Martin Costello, 2021. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. using System.Diagnostics; using MartinCostello.AppleFitnessWorkoutMapper.Data; using Microsoft.EntityFrameworkCore; namespace MartinCostello.AppleFitnessWorkoutMapper.Services; public sealed partial class TrackImporter { private readonly TracksContext _context; private readonly ILogger _logger; private readonly TrackParser _parser; public TrackImporter( TrackParser parser, TracksContext context, ILogger<TrackImporter> logger) { _parser = parser; _context = context; _logger = logger; } public async Task<int> ImportTracksAsync(CancellationToken cancellationToken = default) { var tracks = await _parser.GetTracksAsync(cancellationToken); Log.DeletingDatabase(_logger); await _context.Database.EnsureDeletedAsync(cancellationToken); Log.DeletedDatabase(_logger); Log.CreatingDatabase(_logger); await _context.Database.EnsureCreatedAsync(cancellationToken); await _context.Database.MigrateAsync(cancellationToken); Log.CreatedDatabase(_logger); Log.ImportingTracks(_logger, tracks.Count); var stopwatch = Stopwatch.StartNew(); foreach (var track in tracks) { var trackDB = new Data.Track() { Name = track.Name, Timestamp = track.Timestamp.UtcDateTime, }; trackDB = (await _context.Tracks.AddAsync(trackDB, cancellationToken)).Entity; var points = new List<Data.TrackPoint>(track.Points.Count); foreach (var point in track.Points) { var pointDB = new Data.TrackPoint() { Latitude = point.Latitude, Longitude = point.Longitude, Timestamp = point.Timestamp.UtcDateTime, TrackId = trackDB.Id, }; points.Add(pointDB); } await _context.TrackPoints.AddRangeAsync(points, cancellationToken); } await _context.SaveChangesAsync(cancellationToken); stopwatch.Stop(); Log.ImportedTracks(_logger, tracks.Count, stopwatch.Elapsed); return tracks.Count; } private static partial class Log { [LoggerMessage(8, LogLevel.Information, "Deleting existing database.")] public static partial void DeletingDatabase(ILogger logger); [LoggerMessage(9, LogLevel.Information, "Existing database deleted.")] public static partial void DeletedDatabase(ILogger logger); [LoggerMessage(10, LogLevel.Information, "Creating new database.")] public static partial void CreatingDatabase(ILogger logger); [LoggerMessage(11, LogLevel.Information, "Created new database.")] public static partial void CreatedDatabase(ILogger logger); [LoggerMessage(12, LogLevel.Information, "Importing {Count} track(s) to database.")] public static partial void ImportingTracks(ILogger logger, int count); [LoggerMessage(13, LogLevel.Information, "Imported {Count} track(s) to database in {Elapsed}.")] public static partial void ImportedTracks(ILogger logger, int count, TimeSpan elapsed); } }
33.563107
112
0.66011
[ "Apache-2.0" ]
martincostello/apple-fitness-workout-mapper
src/AppleFitnessWorkoutMapper/Services/TrackImporter.cs
3,459
C#
// <copyright file="UnityContainerFactory.cs" company="Automate The Planet Ltd."> // Copyright 2016 Automate The Planet Ltd. // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> // <author>Anton Angelov</author> // <site>http://automatetheplanet.com/</site> using Microsoft.Practices.Unity; namespace AdvancedBehavioursDesignPattern.Base { public static class UnityContainerFactory { private static IUnityContainer unityContainer; static UnityContainerFactory() { unityContainer = new UnityContainer(); } public static IUnityContainer GetContainer() { return unityContainer; } } }
35.818182
85
0.715736
[ "Apache-2.0" ]
alihassan5/TestAutomation
DesignPatternsInAutomatedTesting-Series/AdvancedBehavioursDesignPattern/Base/UnityContainerFactory.cs
1,184
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("FriendsOfPesho")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FriendsOfPesho")] [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("72104ee2-a7e0-4c37-a47d-5a48738cd1fc")] // 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.864865
84
0.745896
[ "MIT" ]
GAlex7/TA
12. DSA/13. Graph-Algorithms/FriendsOfPesho/Properties/AssemblyInfo.cs
1,404
C#