content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace KeePassTrayIconLockState { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KeePassTrayIconLockState.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; } } /// <summary> /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// </summary> internal static System.Drawing.Icon locked { get { object obj = ResourceManager.GetObject("locked", resourceCulture); return ((System.Drawing.Icon)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap plugin_image { get { object obj = ResourceManager.GetObject("plugin_image", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// </summary> internal static System.Drawing.Icon unlocked { get { object obj = ResourceManager.GetObject("unlocked", resourceCulture); return ((System.Drawing.Icon)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// </summary> internal static System.Drawing.Icon unlocking { get { object obj = ResourceManager.GetObject("unlocking", resourceCulture); return ((System.Drawing.Icon)(obj)); } } } }
42.375
180
0.569548
[ "Apache-2.0" ]
Aldaviva/KeePassTrayIconLockState
KeePassTrayIconLockState/Resources.Designer.cs
4,409
C#
namespace Stripe { using Newtonsoft.Json; public class SourceThreeDSecureCreateOptions : INestedOptions { [JsonProperty("customer")] public string Customer { get; set; } [JsonProperty("card")] public string Card { get; set; } } }
20
65
0.621429
[ "Apache-2.0" ]
GigiAkamala/stripe-dotnet
src/Stripe.net/Services/Sources/SourceThreeDSecureCreateOptions.cs
280
C#
using PFSoftware.TimeClockApi.Constants; using PFSoftware.TimeClockApi.Models.Domain; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace PFSoftware.TimeClockApi.Data { public class DevDbSeeder { private AppDbContext _context; public DevDbSeeder() { } public async Task SeedDatabase(AppDbContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); await SeedUsers(); } private async Task SeedUsers() { _context.Users.AddRange(new List<User> { new User { Id = 1, Username = "Charlie", FirstName = "Charlie", LastName = "Brown", Roles = new List<Role> { new Role { Id = 1, Name = "Payroll Manager", PayRate = 1250m, PayPeriod = PayPeriod.Weekly, PayType = PayType.Salary, UserId = 1 } }, Shifts = new List<Shift> { new Shift { StartTime = DateTimeOffset.Now.Subtract(new TimeSpan(32,0,0)), EndTime = DateTimeOffset.Now.Subtract(new TimeSpan(24,0,0)), UserId=1, RoleId=1, }, new Shift { StartTime = DateTimeOffset.Now.Subtract(new TimeSpan(8,0,0)), EndTime = DateTimeOffset.Now, UserId=1, RoleId=1, } } }, new User { Id = 2, Username = "Doug", FirstName = "Douglas", LastName = "Gaskell", Roles = new List<Role> { new Role { Id = 2, Name = "Software Develoer", PayRate = 1250m, PayPeriod = PayPeriod.Weekly, PayType = PayType.Salary, UserId = 2 } }, Shifts = new List<Shift> { new Shift { StartTime = DateTimeOffset.Now.Subtract(new TimeSpan(32,0,0)), EndTime = DateTimeOffset.Now.Subtract(new TimeSpan(24,0,0)), UserId=2, RoleId=2, }, new Shift { StartTime = DateTimeOffset.Now.Subtract(new TimeSpan(8,0,0)), EndTime = DateTimeOffset.Now, UserId=2, RoleId=2, } } } }); await _context.SaveChangesAsync(); } } }
35.504854
91
0.335521
[ "MIT" ]
PFSoftware/TimeClockApi
PFSoftware.TimeClockApi/Data/DevDbSeeder.cs
3,659
C#
namespace TrafficManager.Patch._VehicleAI._PassengerCarAI { using ColossalFramework; using HarmonyLib; using JetBrains.Annotations; using Manager.Impl; using State; [UsedImplicitly] [HarmonyPatch(typeof(PassengerCarAI), "UpdateParkedVehicle")] public static class UpdateParkedVehiclePatch { [UsedImplicitly] public static bool Prefix(ushort parkedID, ref VehicleParked parkedData) { uint ownerCitizenId = parkedData.m_ownerCitizen; ushort homeId = 0; if (ownerCitizenId != 0u) { homeId = Singleton<CitizenManager>.instance.m_citizens.m_buffer[ownerCitizenId].m_homeBuilding; } // NON-STOCK CODE START if (!AdvancedParkingManager.Instance.TryMoveParkedVehicle( parkedID, ref parkedData, parkedData.m_position, GlobalConfig.Instance.ParkingAI.MaxParkedCarDistanceToBuilding, homeId)) { Singleton<VehicleManager>.instance.ReleaseParkedVehicle(parkedID); } // NON-STOCK CODE STOP return false; } } }
35.264706
111
0.617181
[ "MIT" ]
CitiesSkylinesMods/TMPE
TLM/TLM/Patch/_VehicleAI/_PassengerCarAI/UpdateParkedVehiclePatch.cs
1,199
C#
// Copyright 2022 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.Analytics.Admin.V1Alpha.Snippets { // [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_async_flattened_resourceNames] using Google.Analytics.Admin.V1Alpha; using System.Threading.Tasks; public sealed partial class GeneratedAnalyticsAdminServiceClientSnippets { /// <summary>Snippet for GetDataStreamAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetDataStreamResourceNamesAsync() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = await AnalyticsAdminServiceClient.CreateAsync(); // Initialize request argument(s) DataStreamName name = DataStreamName.FromPropertyDataStream("[PROPERTY]", "[DATA_STREAM]"); // Make the request DataStream response = await analyticsAdminServiceClient.GetDataStreamAsync(name); } } // [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_async_flattened_resourceNames] }
43.785714
118
0.731376
[ "Apache-2.0" ]
AlexandrTrf/google-cloud-dotnet
apis/Google.Analytics.Admin.V1Alpha/Google.Analytics.Admin.V1Alpha.GeneratedSnippets/AnalyticsAdminServiceClient.GetDataStreamResourceNamesAsyncSnippet.g.cs
1,839
C#
using Common.Logger; using StudentClient.ViewModels; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Text; namespace StudentClient.BLL { public class Course : BaseBLL<StudentClient.Models.Cours> { private static readonly Logger mLog = Logger.GetInstance(MethodBase.GetCurrentMethod().DeclaringType); public IndexModel GetCourseByIndex() { try { IndexModel index = new IndexModel(); index.InformationScience = base.Search(d => d.Course_IsDel == false && d.Course_Major == "InformationScience", d => d.Course_Time, 1, 20); index.LanguageHistory = base.Search(d => d.Course_IsDel == false && d.Course_Major == "LanguageHistory", d => d.Course_Time, 1, 20); index.LifeSciences = base.Search(d => d.Course_IsDel == false && d.Course_Major == "LifeSciences", d => d.Course_Time, 1, 20); index.ArtDesign = base.Search(d => d.Course_IsDel == false && d.Course_Major == "ArtDesign", d => d.Course_Time, 1, 20); return index; } catch (Exception e) { mLog.Error("An error has occurred in the get course by index,error:{0}", e.ToString()); throw; } } public SearchModel GetCourseByKey(string type, string key) { try { mLog.Info("Start get course,type:[{0}],key:[{1}]", type, key); SearchModel search = new SearchModel(); List<StudentClient.Models.Cours> courses = base.Search(d => d.Course_Major.Equals(type) && (d.Course_Name.Contains(key) || key.Equals("all")) && !d.Course_IsDel); search.Courses = courses; mLog.Info("Course count:[{0}]", courses.Count.ToString()); return search; } catch (Exception e) { mLog.Error("An error has occurred in the get course by key,error:{0}", e.ToString()); throw; } } public OfflineModel GetCourseByOffline(int pageIndex, int pageSize) { try { List<StudentClient.Models.Cours> videos = base.Search(d => !d.Course_IsDel && d.Course_IsOffline, d => d.Course_Time, pageIndex, pageSize); OfflineModel offline = new OfflineModel(); offline.Videos = videos; return offline; } catch (Exception e) { mLog.Error("An error has occurred in the get course by offline,error:{0}", e.ToString()); throw; } } public OnlineModel GetCourseByOnline(int pageIndex, int pageSize) { try { List<StudentClient.Models.Cours> videos = base.Search(d => !d.Course_IsDel && !d.Course_IsOffline, d => d.Course_Time, pageIndex, pageSize); OnlineModel online = new OnlineModel(); online.Courses = videos; return online; } catch (Exception e) { mLog.Error("An error has occurred in the get course by online,error:{0}", e.ToString()); throw; } } public TearcherCourseModel GetCourseByTearcher(Guid id, int pageIndex, int pageSize) { try { TearcherCourseModel courseModel = new TearcherCourseModel(); List<StudentClient.Models.Cours> courses = base.Search(d => d.Course_Teacher == id && !d.Course_IsDel, d => d.Course_Time, pageIndex, pageSize).ToList(); courseModel.Courses = courses; return courseModel; } catch (Exception e) { mLog.Error("An error has occurred in the get course by tearcher,error:{0}", e.ToString()); throw; } } public TearcherDelCourseModel DelCourseById(string id) { try { TearcherDelCourseModel delCourse = new TearcherDelCourseModel(); Guid guid = Guid.Parse(id); if (base.SearchCount(d => d.Course_Id == guid && !d.Course_IsDel) > 0) { StudentClient.Models.Cours course = base.Search(d => d.Course_Id == guid && !d.Course_IsDel).First(); course.Course_IsDel = true; base.Modify(course, "Course_IsDel"); delCourse.IsDel = true; delCourse.Id = id; return delCourse; } delCourse.IsDel = false; delCourse.Id = id; return delCourse; } catch (Exception e) { mLog.Error("An error has occurred in the remove course by id,error:{0}", e.ToString()); throw; } } public TearcherAddCourseInModel AddCourse(string name, string type, string isOpen, string isOffline, string time, string imgName, StudentClient.Models.Teacher tearcher) { try { StudentClient.Models.Cours course = new Models.Cours(); course.Course_Id = Guid.NewGuid(); course.Course_IsDel = false; course.Course_IsOffline = bool.Parse(isOffline); course.Course_IsOpen = bool.Parse(isOpen); course.Course_Major = type; course.Course_Name = name; course.Course_Password = "123456"; course.Course_College = tearcher.School.School_Name; course.Course_IsGeneral = false; course.Course_Week = time.Split(' ')[0]; course.Course_DayOfWeek = time.Split(' ')[1]; course.Course_Time = new TimeSpan(1, 1, 1); course.Course_Teacher = tearcher.Teacher_Id; base.Add(course); File.Move(imgName, Path.Combine(Path.GetDirectoryName(imgName), String.Format("{0}.png", course.Course_Id))); TearcherAddCourseInModel addCourse = new TearcherAddCourseInModel(); addCourse.IsAdd = true; addCourse.Id = course.Course_Id.ToString(); return addCourse; } catch (Exception e) { mLog.Error("An error has occurred in the add course,error:{0}", e.ToString()); throw; } } public SearchHintModel SearchHint(string key) { try { SearchHintModel searchHint = new SearchHintModel(); if (base.SearchCount(d => d.Course_Name.Contains(key) && !d.Course_IsDel) > 0) { List<StudentClient.Models.Cours> courses = base.Search(d => d.Course_Name.Contains(key) && !d.Course_IsDel, d => d.Course_Name, 1, 10).ToList(); foreach (StudentClient.Models.Cours course in courses) { searchHint.Keys += course.Course_Name + ","; } searchHint.Keys = searchHint.Keys.Substring(0, searchHint.Keys.Length - 1); } return searchHint; } catch (Exception e) { mLog.Error("An error has occurred in the search course key,error:{0}", e.ToString()); throw; } } public SearchModel Search(string key) { try { SearchModel search = new SearchModel(); if (base.SearchCount(d => d.Course_Name.Contains(key) && !d.Course_IsDel) > 0) { List<StudentClient.Models.Cours> courses = base.Search(d => d.Course_Name.Contains(key) && !d.Course_IsDel, d => d.Course_Name, 1, 10).ToList(); search.Courses = courses; } return search; } catch (Exception e) { mLog.Error("An error has occurred in the search course by key,error:{0}", e.ToString()); throw; } } } }
41.460396
178
0.524179
[ "BSD-2-Clause" ]
liguifa/Mooc
Student/Mooc.Student.BLL/Course.cs
8,377
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #if SECURITY_DIALOG [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm.InitializeComponent():System.Void")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_AppBase():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_CodeBase():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_CommandLine():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_CommandLineArgs():System.String[]")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_CommonUserAppDataPath():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_CompanyName():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_ConfigurationFile():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_ExecutablePath():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_LocalUserAppDataPath():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_MyDocuments():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_Name():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_ProductName():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_ProductVersion():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_StartupPath():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_UserAppDataPath():System.String")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm+AppInfo.get_Version():System.Version")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope="member", Target="System.Windows.Forms.SysInfoForm..ctor(System.Boolean)")] namespace System.Windows.Forms { using System; using System.Diagnostics; using System.Drawing; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.IO; using System.Xml; using System.Windows.Forms; using System.Reflection; using System.Security; using System.Security.Permissions; using System.Globalization; using System.Runtime.Versioning; /// <include file='doc\SysInfoForm.uex' path='docs/doc[@for="SysInfoForm"]/*' /> /// <devdoc> /// Summary description for SysInfoForm. /// </devdoc> internal class SysInfoForm : Form { static Switch[] switches; /// <include file='doc\SysInfoForm.uex' path='docs/doc[@for="SysInfoForm.components"]/*' /> /// <devdoc> /// Required by the Win Forms designer /// </devdoc> Container components; ColumnHeader codeBaseColumn; ColumnHeader versionColumn; ColumnHeader fileVersionColumn; ColumnHeader asmNameColumn; ColumnHeader switchNameColumn; ColumnHeader displayNameColumn; ListView loadedAssemblyList; ListView switchesList; Button closeButton; TabPage appInfo; TabPage sysInfo; TabPage secInfo; TabPage switchInfo; TabPage bugReportInfo; TabControl tabControl1; PropertyGrid appProps; Label bugReportLabel; Label securityLabel; Label switchLabel; TextBox bugReportDescription; CheckBox includeSystemInformation; CheckBox includeApplicationInformation; Panel bugReportPanel; Button saveBugReport; Button submitBugReport; bool windowIsRestricted = false; private static Switch[] GetSwitchesFromLoadedAssemblies() { ArrayList list = new ArrayList(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Module[] modules = assembly.GetLoadedModules(); foreach (Module module in modules) { if (module != null) { foreach (Type type in module.GetTypes()) { if (type != null) { MemberInfo[] members = type.FindMembers(MemberTypes.Field, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, new MemberFilter(Filter), null); foreach (MemberInfo member in members) { if (member != null) { FieldInfo field = member as FieldInfo; if (field != null) { object value = field.GetValue(null); if (value != null) list.Add(value); } } } } } } } } return(Switch[]) list.ToArray(typeof(Switch)); } private static bool Filter(MemberInfo member, object criteria) { if (member == null) { return false; } FieldInfo field = (FieldInfo)member; if (field.FieldType == null) { return false; } return(field.FieldType.IsSubclassOf(typeof(Switch))); } public SysInfoForm(bool windowIsRestricted) { this.windowIsRestricted = windowIsRestricted; // Required for Win Form Designer support InitializeComponent(); MinimumSize = Size; if (windowIsRestricted) { securityLabel.Text = SR.SecurityRestrictedText; } else { securityLabel.Text = SR.SecurityUnrestrictedText; } } /// <include file='doc\SysInfoForm.uex' path='docs/doc[@for="SysInfoForm.Dispose"]/*' /> /// <devdoc> /// Clean up any resources being used /// </devdoc> protected override void Dispose(bool disposing) { if (disposing) { components.Dispose(); } base.Dispose(disposing); } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] private void PopulateAssemblyInfo() { foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { AssemblyName name = asm.GetName(); try { string fileVer = "n/a"; if (name.EscapedCodeBase != null && name.EscapedCodeBase.Length > 0) { Uri codeBase = new Uri(name.EscapedCodeBase); if (codeBase.Scheme == "file") { fileVer = FileVersionInfo.GetVersionInfo(NativeMethods.GetLocalPath(name.EscapedCodeBase)).FileVersion; } } ListViewItem item = new ListViewItem(new string[] { name.Name, fileVer, name.Version.ToString(), name.EscapedCodeBase}); loadedAssemblyList.Items.Add(item); } catch { // ignore any exceptions... this dialog should never cause a fault... // loadedAssemblyList.Items.Add(new ListViewItem(new string[] {name.Name, "Exception loading information"})); } } } private void PopulateApplicationInfo() { appProps.SelectedObject = new AppInfo(); } private void WriteBugReport(TextWriter writer) { XmlTextWriter xml = new XmlTextWriter(writer); xml.Formatting = Formatting.Indented; xml.WriteStartElement("bug"); { xml.WriteAttributeString("product", ".NET Frameworks SDK"); xml.WriteStartElement("problem"); { xml.WriteString(bugReportDescription.Text); } xml.WriteEndElement(); if (includeApplicationInformation.Checked) { xml.WriteStartElement("assemblies"); { foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { AssemblyName name = asm.GetName(); xml.WriteStartElement("assembly"); { xml.WriteAttributeString("name", name.Name); xml.WriteAttributeString("codebase", name.CodeBase); xml.WriteAttributeString("version", name.Version.ToString()); string fileVer = "n/a"; if (name.EscapedCodeBase != null && name.EscapedCodeBase.Length > 0) { Uri codeBase = new Uri(name.EscapedCodeBase); if (codeBase.Scheme == "file") { fileVer = FileVersionInfo.GetVersionInfo(NativeMethods.GetLocalPath(name.EscapedCodeBase)).FileVersion; } } xml.WriteAttributeString("win32version", fileVer); } xml.WriteEndElement(); } } xml.WriteEndElement(); } if (includeSystemInformation.Checked) { xml.WriteStartElement("system"); { xml.WriteAttributeString("os", Environment.OSVersion.Platform.ToString("G") + " " + Environment.OSVersion.Version.ToString()); } xml.WriteEndElement(); } } xml.WriteEndElement(); } private void SubmitBugReport(object sender, EventArgs e) { UnsafeNativeMethods.ShellExecute(NativeMethods.NullHandleRef, null, SR.SecuritySubmitBugUrl, null, null, NativeMethods.SW_NORMAL); } private void SaveBugReport(object sender, EventArgs e) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = SR.SecuritySaveFilter; if (dialog.ShowDialog() == DialogResult.OK) { Stream output = dialog.OpenFile(); StreamWriter writer = new StreamWriter(output); try { WriteBugReport(writer); } finally { writer.Flush(); writer.Close(); } } } private void PopulateSwitchesInfo() { // grab it in a local in case assembly load causes static to null out // Until we start listening to assembly load events, we should not cache! Switch[] switchesLocal = null; // switches if (switchesLocal == null) { switchesLocal = GetSwitchesFromLoadedAssemblies(); switches = switchesLocal; Array.Sort(switchesLocal, new SwitchSorter()); } foreach (Switch sw in switchesLocal) { bool value; TraceSwitch tsw = sw as TraceSwitch; if (tsw != null) value = tsw.Level > TraceLevel.Off; else { BooleanSwitch bsw = sw as BooleanSwitch; if (bsw != null) value = bsw.Enabled; else continue; } ListViewItem item = new SwitchItem(sw); item.Checked = value; switchesList.Items.Add(item); } } private void SwitchChecked(object sender, ItemCheckEventArgs e) { SwitchItem item = (SwitchItem)switchesList.Items[e.Index]; Switch sw = item.Value; bool value = e.NewValue == CheckState.Checked; TraceSwitch tsw = sw as TraceSwitch; if (tsw != null) { tsw.Level = (value ? TraceLevel.Verbose : TraceLevel.Off); } else { BooleanSwitch bsw = sw as BooleanSwitch; if (bsw != null) bsw.Enabled = value; } } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] void TabSelectionChanged(object sender, EventArgs e) { if (tabControl1.SelectedTab == switchInfo) { if (switchesList.Items.Count == 0) { try { PopulateSwitchesInfo(); } catch { } } } else if (tabControl1.SelectedTab == sysInfo) { if (loadedAssemblyList.Items.Count == 0) { try { PopulateAssemblyInfo(); } catch { } } } else if (tabControl1.SelectedTab == appInfo) { if (appProps.SelectedObject == null) { try { PopulateApplicationInfo(); } catch { } } } } /// <include file='doc\SysInfoForm.uex' path='docs/doc[@for="SysInfoForm.InitializeComponent"]/*' /> /// <devdoc> /// Required method for Designer support - do not modify /// the contents of this method with an editor /// </devdoc> private void InitializeComponent() { this.components = new Container(); this.sysInfo = new TabPage(); this.versionColumn = new ColumnHeader(); this.fileVersionColumn = new ColumnHeader(); this.loadedAssemblyList = new ListView(); this.switchesList = new ListView(); this.appInfo = new TabPage(); this.tabControl1 = new TabControl(); this.asmNameColumn = new ColumnHeader(); this.codeBaseColumn = new ColumnHeader(); this.switchNameColumn = new ColumnHeader(); this.displayNameColumn = new ColumnHeader(); this.secInfo = new TabPage(); this.bugReportInfo = new TabPage(); this.bugReportLabel = new Label(); this.switchInfo = new TabPage(); this.closeButton = new Button(); this.securityLabel = new Label(); this.bugReportDescription = new TextBox(); this.includeSystemInformation = new CheckBox(); this.includeApplicationInformation = new CheckBox(); this.saveBugReport = new Button(); this.submitBugReport = new Button(); this.switchLabel = new Label(); this.bugReportPanel = new Panel(); this.appProps = new PropertyGrid(); //@design this.TrayLargeIcon = false; //@design this.TrayAutoArrange = true; //@design this.TrayHeight = 0; //@design this.GridSize = new System.Drawing.Size(4, 4); this.Text = SR.SecurityAboutDialog; this.AutoScaleDimensions = new System.Drawing.Size(6, 13); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(442, 273); this.MinimizeBox = false; this.MaximizeBox = false; this.ControlBox = false; this.CancelButton = closeButton; this.Font = new Font("Tahoma", 8); sysInfo.Size = new System.Drawing.Size(428, 210); sysInfo.TabIndex = 1; sysInfo.Text = SR.SecurityAssembliesTab; versionColumn.Text = SR.SecurityVersionColumn; versionColumn.Width = 100; versionColumn.TextAlign = HorizontalAlignment.Left; fileVersionColumn.Text = SR.SecurityFileVersionColumn; fileVersionColumn.Width = 100; fileVersionColumn.TextAlign = HorizontalAlignment.Left; loadedAssemblyList.Size = new System.Drawing.Size(428, 210); loadedAssemblyList.Dock = DockStyle.Fill; loadedAssemblyList.TabIndex = 0; loadedAssemblyList.FullRowSelect = true; loadedAssemblyList.View = View.Details; loadedAssemblyList.Columns.Clear(); loadedAssemblyList.Columns.AddRange(new ColumnHeader[] {asmNameColumn, fileVersionColumn, versionColumn, codeBaseColumn}); switchLabel.Size = new Size(428, 25); switchLabel.Dock = DockStyle.Bottom; switchLabel.Text = SR.SecuritySwitchLabel; switchesList.Size = new System.Drawing.Size(428, 210); switchesList.Dock = DockStyle.Fill; switchesList.ItemCheck += new ItemCheckEventHandler(SwitchChecked); switchesList.TabIndex = 0; switchesList.CheckBoxes = true; switchesList.FullRowSelect = true; switchesList.View = View.Details; switchesList.Columns.Clear(); switchesList.Columns.AddRange(new ColumnHeader[] {switchNameColumn, displayNameColumn}); appInfo.Size = new System.Drawing.Size(428, 210); appInfo.TabIndex = 2; appInfo.Text = SR.SecurityApplication; appInfo.DockPadding.All = 2; switchInfo.Size = new System.Drawing.Size(428, 210); switchInfo.TabIndex = 4; switchInfo.Text = SR.SecuritySwitchesTab; bugReportDescription.Multiline = true; bugReportDescription.Dock = DockStyle.Fill; bugReportDescription.WordWrap = true; bugReportLabel.Dock = DockStyle.Top; bugReportLabel.Size = new System.Drawing.Size(428, 36); bugReportLabel.Text = SR.SecurityBugReportLabel; includeSystemInformation.Checked = true; includeSystemInformation.Dock = DockStyle.Bottom; includeSystemInformation.FlatStyle = FlatStyle.System; includeSystemInformation.Text = SR.SecurityIncludeSysInfo; includeApplicationInformation.Checked = true; includeApplicationInformation.Dock = DockStyle.Bottom; includeApplicationInformation.FlatStyle = FlatStyle.System; includeApplicationInformation.Text = SR.SecurityIncludeAppInfo; saveBugReport.Text = SR.SecuritySaveBug; saveBugReport.Location = new Point(2, 2); saveBugReport.FlatStyle = FlatStyle.System; saveBugReport.Size = new Size(75, 23); saveBugReport.Click += new EventHandler(SaveBugReport); submitBugReport.Text = SR.SecuritySubmitBug; submitBugReport.Location = new Point(79, 2); submitBugReport.FlatStyle = FlatStyle.System; submitBugReport.Size = new Size(75, 23); submitBugReport.Click += new EventHandler(SubmitBugReport); bugReportPanel.Dock = DockStyle.Bottom; bugReportPanel.Size = new Size(428, 27); appProps.Dock = DockStyle.Fill; appProps.ToolbarVisible = false; tabControl1.Location = new System.Drawing.Point(4, 4); tabControl1.Size = new System.Drawing.Size(436, 236); tabControl1.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; tabControl1.SelectedIndex = 0; tabControl1.TabIndex = 0; tabControl1.SelectedIndexChanged += new EventHandler(TabSelectionChanged); asmNameColumn.Text = SR.SecurityAsmNameColumn; asmNameColumn.Width = 150; asmNameColumn.TextAlign = HorizontalAlignment.Left; switchNameColumn.Text = SR.SecuritySwitchNameColumn; switchNameColumn.Width = 150; switchNameColumn.TextAlign = HorizontalAlignment.Left; displayNameColumn.Text = SR.SecuritySwitchDescrColumn; displayNameColumn.Width = 300; displayNameColumn.TextAlign = HorizontalAlignment.Left; codeBaseColumn.Text = SR.SecurityCodeBaseColumn; codeBaseColumn.Width = 400; codeBaseColumn.TextAlign = HorizontalAlignment.Left; secInfo.Size = new System.Drawing.Size(428, 210); secInfo.TabIndex = 0; secInfo.Text = SR.SecurityInfoTab; bugReportInfo.Size = new System.Drawing.Size(428, 210); bugReportInfo.TabIndex = 0; bugReportInfo.Text = SR.SecurityBugReportTab; securityLabel.Dock = DockStyle.Fill; closeButton.Size = new System.Drawing.Size(75, 23); closeButton.FlatStyle = FlatStyle.System; closeButton.TabIndex = 1; closeButton.Location = new System.Drawing.Point(344, 248); closeButton.Text = SR.SecurityClose; closeButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom; closeButton.DialogResult = DialogResult.OK; this.Controls.Add(closeButton); this.Controls.Add(tabControl1); switchInfo.Controls.Add(switchesList); switchInfo.Controls.Add(switchLabel); sysInfo.Controls.Add(loadedAssemblyList); secInfo.Controls.Add(securityLabel); appInfo.Controls.Add(appProps); bugReportPanel.Controls.Add(saveBugReport); bugReportPanel.Controls.Add(submitBugReport); bugReportInfo.Controls.Add(bugReportDescription); bugReportInfo.Controls.Add(bugReportLabel); bugReportInfo.Controls.Add(includeSystemInformation); bugReportInfo.Controls.Add(includeApplicationInformation); bugReportInfo.Controls.Add(bugReportPanel); tabControl1.Controls.Add(secInfo); tabControl1.Controls.Add(appInfo); tabControl1.Controls.Add(sysInfo); tabControl1.Controls.Add(switchInfo); tabControl1.Controls.Add(bugReportInfo); } [DefaultProperty(nameof(CompanyName))] public class AppInfo { AssemblyName assemblyName; public AppInfo() { assemblyName = Assembly.GetEntryAssembly().GetName(); } [Category("Entry Assembly")] public Version Version { get { return assemblyName.Version; } } [Category("Entry Assembly")] public string Name { get { return assemblyName.Name; } } [Category("Entry Assembly")] public string CodeBase { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return assemblyName.CodeBase; } } [Category("Directories")] public string MyDocuments { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return Environment.GetFolderPath(Environment.SpecialFolder.Personal); } } [Category("Directories")] public string UserAppDataPath { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return Application.UserAppDataPath; } } [Category("Directories")] public string CommonUserAppDataPath { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return Application.CommonAppDataPath; } } [Category("Directories")] public string LocalUserAppDataPath { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return Application.LocalUserAppDataPath; } } [Category("Application")] public string CompanyName { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return Application.CompanyName; } } [Category("Directories")] public string AppBase { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return AppDomain.CurrentDomain.SetupInformation.ApplicationBase; } } [Category("Application")] public string ConfigurationFile { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; } } [Category("Application")] public string ProductName { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return Application.ProductName; } } [Category("Application")] public string ProductVersion { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return Application.ProductVersion; } } [Category("Startup")] public string CommandLine { get { return Environment.CommandLine; } } [Category("Startup")] public string[] CommandLineArgs { get { return Environment.GetCommandLineArgs(); } } [Category("Startup")] public string StartupPath { get { return Application.StartupPath; } } [Category("Application")] public string ExecutablePath { [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] get { return Application.ExecutablePath; } } } class SwitchSorter : IComparer { public int Compare(object x, object y) { return String.Compare(((Switch)x).DisplayName, ((Switch)y).DisplayName, false, CultureInfo.InvariantCulture); } } class SwitchItem : ListViewItem { Switch value; internal SwitchItem(Switch value) : base(new string[] {value.DisplayName, value.Description}) { this.value = value; } public Switch Value { get { return value; } } } } } #endif
44.523188
228
0.566713
[ "MIT" ]
0xflotus/winforms
src/System.Windows.Forms/src/System/Windows/Forms/SysInfoForm.cs
30,721
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. using System; using System.Diagnostics; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using AnyPrefix.Microsoft.Scripting.Utils; using AstUtils = AnyPrefix.Microsoft.Scripting.Ast.Utils; using RuntimeHelpers = AnyPrefix.Microsoft.Scripting.Runtime.ScriptingRuntimeHelpers; namespace AnyPrefix.Microsoft.Scripting.Actions.Calls { /// <summary> /// An argument that the user wants to explicitly pass by-reference (with copy-in copy-out semantics). /// The user passes a StrongBox[T] object whose value will get updated when the call returns. /// </summary> internal sealed class ReferenceArgBuilder : SimpleArgBuilder { private readonly Type _elementType; private ParameterExpression _tmp; public ReferenceArgBuilder(ParameterInfo info, Type elementType, Type strongBox, int index) : base(info, strongBox, index, false, false) { _elementType = elementType; } protected override SimpleArgBuilder Copy(int newIndex) { return new ReferenceArgBuilder(ParameterInfo, _elementType, Type, newIndex); } public override ArgBuilder Clone(ParameterInfo newType) { Type elementType = newType.ParameterType.GetElementType(); return new ReferenceArgBuilder(newType, elementType, typeof(StrongBox<>).MakeGenericType(elementType), Index); } public override int Priority => 5; protected internal override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) { if (_tmp == null) { _tmp = resolver.GetTemporary(_elementType, "outParam"); } Debug.Assert(!hasBeenUsed[Index]); hasBeenUsed[Index] = true; Expression arg = args.GetObject(Index).Expression; return Expression.Condition( Expression.TypeIs(arg, Type), Expression.Assign( _tmp, Expression.Field( AstUtils.Convert(arg, Type), Type.GetDeclaredField("Value") ) ), Expression.Throw( Expression.Call( new Func<Type, object, Exception>(RuntimeHelpers.MakeIncorrectBoxTypeError).GetMethodInfo(), AstUtils.Constant(_elementType), AstUtils.Convert(arg, typeof(object)) ), _elementType ) ); } internal override Expression UpdateFromReturn(OverloadResolver resolver, RestrictedArguments args) { return Expression.Assign( Expression.Field( Expression.Convert(args.GetObject(Index).Expression, Type), Type.GetDeclaredField("Value") ), _tmp ); } internal override Expression ByRefArgument => _tmp; } }
39.39759
134
0.621101
[ "MIT" ]
shuice/IronPython_UWP
ironpython2/Src/DLR/Src/Microsoft.Dynamic/Actions/Calls/ReferenceArgBuilder.cs
3,270
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 iotthingsgraph-2018-09-06.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.IoTThingsGraph.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.IoTThingsGraph.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for SystemTemplateDescription Object /// </summary> public class SystemTemplateDescriptionUnmarshaller : IUnmarshaller<SystemTemplateDescription, XmlUnmarshallerContext>, IUnmarshaller<SystemTemplateDescription, JsonUnmarshallerContext> { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> SystemTemplateDescription IUnmarshaller<SystemTemplateDescription, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context) { throw new NotImplementedException(); } /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public SystemTemplateDescription Unmarshall(JsonUnmarshallerContext context) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) return null; SystemTemplateDescription unmarshalledObject = new SystemTemplateDescription(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("definition", targetDepth)) { var unmarshaller = DefinitionDocumentUnmarshaller.Instance; unmarshalledObject.Definition = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("summary", targetDepth)) { var unmarshaller = SystemTemplateSummaryUnmarshaller.Instance; unmarshalledObject.Summary = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("validatedNamespaceVersion", targetDepth)) { var unmarshaller = LongUnmarshaller.Instance; unmarshalledObject.ValidatedNamespaceVersion = unmarshaller.Unmarshall(context); continue; } } return unmarshalledObject; } private static SystemTemplateDescriptionUnmarshaller _instance = new SystemTemplateDescriptionUnmarshaller(); /// <summary> /// Gets the singleton. /// </summary> public static SystemTemplateDescriptionUnmarshaller Instance { get { return _instance; } } } }
38.076923
189
0.623232
[ "Apache-2.0" ]
philasmar/aws-sdk-net
sdk/src/Services/IoTThingsGraph/Generated/Model/Internal/MarshallTransformations/SystemTemplateDescriptionUnmarshaller.cs
3,960
C#
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Runtime.Serialization; using System.Xml.Linq; using TextMining.Core; namespace TonalityMarking { /// <summary> /// /// </summary> [DataContract] [Serializable] public class TonalityMarkingOutputResult : OutputResultBase { public TonalityMarkingOutputResult ( XDocument resultXDocument, InquiryAllocateStatus inquiryAllocateStatus, double? positive, double? negative, List< TonalityMarkingObject > objects, IEnumerable< string > operateRulesNames = null ) : base( operateRulesNames ) { resultXDocument.ThrowIfNull("resultXDocument"); //if ( !resultXDocument.Root.HasElements ) throw (new ArgumentNullException("Tonality output-xml is empty.")); _OutputXDocument = resultXDocument; OutputXml = resultXDocument.ToString(); OutputXmlIsEmpty = !resultXDocument.Root.HasElements; InquiryAllocateStatus = inquiryAllocateStatus; AuthorTonalityMarkingTuple = TonalityMarkingTuple.CreateSubjectAuthor( positive, negative, objects ); TonalityMarkingTuples = (new[] { AuthorTonalityMarkingTuple }).ToList().AsReadOnly(); } public TonalityMarkingOutputResult ( string resultXml, bool resultXmlIsEmpty, InquiryAllocateStatus inquiryAllocateStatus, double? positive, double? negative, List< TonalityMarkingObject > objects, IEnumerable< string > operateRulesNames = null ) : base( operateRulesNames ) { OutputXml = resultXml; OutputXmlIsEmpty = resultXmlIsEmpty; InquiryAllocateStatus = inquiryAllocateStatus; AuthorTonalityMarkingTuple = TonalityMarkingTuple.CreateSubjectAuthor( positive, negative, objects ); TonalityMarkingTuples = (new[] { AuthorTonalityMarkingTuple }).ToList().AsReadOnly(); } [DataMember] public string OutputXml { get; private set; } [NonSerialized] private XDocument _OutputXDocument; public XDocument GetOutputXDocument() { if ( _OutputXDocument == null ) { _OutputXDocument = XDocument.Parse( OutputXml ); } return (_OutputXDocument); } [DataMember] public bool OutputXmlIsEmpty { get; private set; } [DataMember] public InquiryAllocateStatus InquiryAllocateStatus { get; private set; } [DataMember] public ReadOnlyCollection< TonalityMarkingTuple > TonalityMarkingTuples { get; private set; } [DataMember] public TonalityMarkingTuple AuthorTonalityMarkingTuple { get; private set; } } }
32.336449
122
0.544509
[ "MIT" ]
elzin/SentimentAnalysisService
Sources/TextMining/Core/TextMining.Core/TonalityMarking.Interface/DataContracts/TonalityMarkingOutputResult.cs
3,462
C#
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using TMPro; using XNode; using System.Threading.Tasks; #pragma warning disable IDE0051, IDE0060 public class DialogueGraphHandler : MonoBehaviour { public DialogueGraph graph; public DialogueBoxController dialogueBox; [SerializeField] private GameObject[] objects; private string previousName; private ControlState oldState; private Coroutine _parser; public void BeginDialogue() { StopAllCoroutines(); graph.currentNode = graph.startNode; _parser = StartCoroutine(ParseNode()); } IEnumerator ParseNode() { // Get data for the current node BaseNode node = graph.currentNode; string dataRaw = node.GetString(); string[] data = dataRaw.Split('/'); // Performs coroutine based on given data yield return StartCoroutine(data[0], data); } #region Node Handling #region Start and End // Start node private IEnumerator StartNode(string[] data) { // Start node, lock character movement and setup variables oldState = OnScreenControlsUI.state; OnScreenControlsUI.UpdateState(ControlState.Dialogue); previousName = "!@#$%^&#^"; InputMovement.LockPlayer(); NextNode("exit"); yield return null; } // End node private IEnumerator EndNode(string[] data) { // Exit node, go back to beginning node and unlock character dialogueBox.CloseDialogue(); InputMovement.UnlockPlayer(); OnScreenControlsUI.UpdateState(oldState); graph.currentNode = graph.startNode; yield return null; } #endregion #region Conditionals // BranchSwitch node private IEnumerator BranchSwitch(string[] data) { string switchName = data[1]; bool switchValue = false; try { switchValue = GlobalSwitches.INSTANCE[switchName]; } catch (NonExistentSwitchException) { GlobalSwitches.INSTANCE.CreateSwitch(switchName, false); } if (switchValue) NextNode("ifTrue"); else NextNode("ifFalse"); yield return null; } // BranchLocalSwitch node private IEnumerator BranchLocalSwitch(string[] data) { LocalSwitch localSwitch = (LocalSwitch) Enum.Parse(typeof(LocalSwitch), data[1]); yield return null; if (graph.GetLocalSwitch(localSwitch)) NextNode("ifTrue"); else NextNode("ifFalse"); } private IEnumerator BranchVariableAndLiteralNode(string[] data) { string variableName = data[1]; Comparison comparison = (Comparison) Enum.Parse(typeof(Comparison), data[2]); int compareValue = Int32.Parse(data[3]); int variableValue = GlobalVariables.INSTANCE[variableName]; bool isTrue = false; switch (comparison) { case Comparison.IsLessThan: isTrue = variableValue < compareValue; break; case Comparison.IsLessThanOrEqualTo: isTrue = variableValue <= compareValue; break; case Comparison.Equals: isTrue = variableValue == compareValue; break; case Comparison.IsGreaterThan: isTrue = variableValue > compareValue; break; case Comparison.IsGreaterThanOrEqualTo: isTrue = variableValue >= compareValue; break; } yield return null; if (isTrue) NextNode("ifTrue"); else NextNode("ifFalse"); } private IEnumerator BranchVariableAndVariableNode(string[] data) { string variable1str = data[1]; Comparison comparison = (Comparison) Enum.Parse(typeof(Comparison), data[2]); string variable2str = data[3]; int var1 = GlobalVariables.INSTANCE[variable1str]; int var2 = GlobalVariables.INSTANCE[variable2str]; bool isTrue = false; switch (comparison) { case Comparison.IsLessThan: isTrue = var1 < var2; break; case Comparison.IsLessThanOrEqualTo: isTrue = var1 <= var2; break; case Comparison.Equals: isTrue = var1 == var2; break; case Comparison.IsGreaterThan: isTrue = var1 > var2; break; case Comparison.IsGreaterThanOrEqualTo: isTrue = var1 >= var2; break; } yield return null; if (isTrue) NextNode("ifTrue"); else NextNode("ifFalse"); } private IEnumerator BranchDialogueNode(string[] data) { BranchDialogueNode branchNode = graph.currentNode as BranchDialogueNode; string charName = data[1]; string dialogueText = data[2]; bool parseVariables = Boolean.Parse(data[3]); string[] options = branchNode.GetOptions(); Sprite face = branchNode.GetSprite(); if (parseVariables) dialogueText = DialogueBoxController.ParseGlobalVariables(dialogueText); // Display dialogue if (charName == previousName) { // Edit the dialogue if it's the same speaker dialogueBox.EditDialogue(dialogueText, 4); } else { // If not, display a new dialogue box dialogueBox.CloseDialogue(); yield return new WaitForSeconds((float) 1 / 6); dialogueBox.ShowDialouge(dialogueText, 4, charName, face); previousName = charName; } // Wait for user input yield return new WaitForSeconds(0.5f); yield return new WaitUntil(() => (Input.GetButtonDown("Interact") || !dialogueBox.isTyping)); if (dialogueBox.isTyping) { // If dialogue box is still typing, show the rest of the message dialogueBox.ForceFinishText(); } // Display the dialogue options yield return dialogueBox.StartCoroutine(dialogueBox.ShowOptions(options)); yield return new WaitUntil(() => dialogueBox.selectedOption >= 0); // Go to next node based on option NextNode("opt" + dialogueBox.selectedOption); } #endregion #region Setter Fields // Switch Set Node private IEnumerator SetSwitchNode(string[] data) { // Get data string switchName = data[1]; bool switchValue = Boolean.Parse(data[2]); // Set the switch GlobalSwitches.INSTANCE[switchName] = switchValue; NextNode("exit"); yield return null; } // Local Switch Set Node private IEnumerator SetLocalSwitchNode(string[] data) { LocalSwitch switchId = (LocalSwitch) Enum.Parse(typeof(LocalSwitch), data[1]); bool value = Boolean.Parse(data[2]); graph.SetLocalSwitch(switchId, value); NextNode("exit"); yield return null; } // Variable Set Node private IEnumerator SetVariableNode(string[] data) { string variable = data[1]; VariableOperation operation = (VariableOperation) Enum.Parse(typeof(VariableOperation), data[2]); float value = float.Parse(data[3]); int newValue = GlobalVariables.INSTANCE[variable]; switch (operation) { case VariableOperation.ADD: newValue = (int) (newValue + value); break; case VariableOperation.SUBTRACT: newValue = (int) (newValue - value); break; case VariableOperation.MULTIPLY: newValue = (int) (newValue * value); break; case VariableOperation.DIVIDE: newValue = (int) (newValue / value); break; case VariableOperation.REMAINDER: newValue = (int) (newValue % value); break; case VariableOperation.SET: newValue = (int) value; break; } GlobalVariables.INSTANCE[variable] = newValue; NextNode("exit"); yield return null; } #endregion #region Dialogue // Dialogue node private IEnumerator DialogueNode(string[] data) { // Dialogue node DialogueNode dialogueNode = graph.currentNode as DialogueNode; // Get data string characterName = data[1]; string dialogueText = data[2]; bool parseVariables = Boolean.Parse(data[3]); if (parseVariables) dialogueText = DialogueBoxController.ParseGlobalVariables(dialogueText); // Display dialogue if (data[1] == previousName) { // Edit the dialogue if it's the same speaker dialogueBox.EditDialogue(dialogueText, 4); } else { // If not, display a new dialogue box dialogueBox.CloseDialogue(); yield return new WaitForSeconds((float) 1 / 6); dialogueBox.ShowDialouge(dialogueText, 4, characterName, dialogueNode.GetSprite()); previousName = characterName; } // Wait for user input yield return new WaitForSeconds(0.5f); yield return new WaitUntil(() => Input.GetButtonDown("Interact")); if (dialogueBox.isTyping) { // If dialogue box is still typing, show the rest of the message dialogueBox.ForceFinishText(); yield return new WaitForSeconds(0.2f); yield return new WaitUntil(() => Input.GetButtonDown("Interact")); } // Go to next node when done typing NextNode("exit"); } // Dialogue Bubble Node private IEnumerator BubbleNode(string[] data) { BubbleNode node = graph.currentNode as BubbleNode; BalloonAnimation animation = node.animation; Transform target = objects[node.targetObjectIndex].transform; int durationMs = node.durationMs; bool waitForFinish = node.waitForAnimationToFinish; float oX = node.offsetX; float oY = node.offsetY; float oZ = node.offsetZ; BalloonAnimations.INSTANCE.DoAnimationOn(animation, target, durationMs, oX, oY, oZ); if (waitForFinish) yield return new WaitForSeconds((float) durationMs / 1000); else yield return null; NextNode("exit"); } #endregion #region Battle // Battle Node private IEnumerator BattleNode(string[] data) { // Close the dialogue box dialogueBox.CloseDialogue(); OnScreenControlsUI.UpdateState(ControlState.None); previousName = "!@#$%^&#^"; // Get the current node BattleNode node = graph.currentNode as BattleNode; // Get the battle scene and current scene string battleScene = data[1]; string currentScene = SceneManager.GetActiveScene().name; // Get battle parameters List<Unit> enemies = node.enemies; bool allowDeath = node.allowDeath; AudioClip clip = node.battleMusic; // Start the battle and wait for it to end BattleController.StartBattle(enemies, clip, currentScene, node.allowDeath, battleScene); yield return new WaitUntil(() => BattleController.playerWon != null); // Determine if player won bool victory = (bool) BattleController.playerWon; yield return new WaitForSeconds(0.5f); OnScreenControlsUI.UpdateState(ControlState.Dialogue); // Go to the next node if (victory) NextNode("victory"); else NextNode("defeat"); } #endregion #endregion private void NextNode(string name) { if (_parser != null) { StopCoroutine(_parser); _parser = null; } foreach (NodePort port in graph.currentNode.Ports) { if (port.fieldName == name) { graph.currentNode = port.Connection.node as BaseNode; break; } } _parser = StartCoroutine(ParseNode()); } }
26.312821
99
0.718866
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
RyanAnayaMc/rpg-game
Assets/Scripts/World/Interactions/DialogueGraph/DialogueGraphHandler.cs
10,262
C#
using BedeSlots.Infrastructure.Providers.Interfaces; using Microsoft.AspNetCore.Identity; using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; namespace BedeSlots.Infrastructure.Providers { public class UserManagerWrapper<T> : IUserManager<T> where T : class { private UserManager<T> _userManager; public UserManagerWrapper(UserManager<T> userManager) { _userManager = userManager; } public UserManager<T> Instance => _userManager; public IQueryable<T> Users => _userManager.Users; public IList<IPasswordValidator<T>> PasswordValidators => _userManager.PasswordValidators; public async Task<IdentityResult> SetLockoutEndDateAsync(T user, DateTimeOffset? lockoutEnd) { return await _userManager.SetLockoutEndDateAsync(user, lockoutEnd); } public async Task<IdentityResult> SetLockoutEnabledAsync(T user, bool enabled) { return await _userManager.SetLockoutEnabledAsync(user, enabled); } public async Task<IdentityResult> RemovePasswordAsync(T user) { return await _userManager.RemovePasswordAsync(user); } public async Task<IdentityResult> AddPasswordAsync(T user, string password) { return await _userManager.AddPasswordAsync(user, password); } public async Task<string> GetUserIdAsync(T user) { return await _userManager.GetUserIdAsync(user); } public async Task<T> GetUserAsync(ClaimsPrincipal claimsPrincipal) { return await _userManager.GetUserAsync(claimsPrincipal); } public async Task<IdentityResult> AddToRoleAsync(T user, string role) { return await _userManager.AddToRoleAsync(user, role); } public async Task<IdentityResult> RemoveFromRoleAsync(T user, string role) { return await _userManager.RemoveFromRoleAsync(user, role); } public string GetUserId(ClaimsPrincipal principal) { return _userManager.GetUserId(principal); } public async Task<IdentityResult> CreateAsync(T user, string password) { return await _userManager.CreateAsync(user, password); } } }
34.2
100
0.669173
[ "MIT" ]
RapGeneral/BedeSlots
BedeSlots/BedeSlots.Infrastructure/Providers/UserManagerWrapper.cs
2,396
C#
namespace Braco.Services.Abstractions { /// <summary> /// Arguments for the <see cref="IConfigurationService.SettingChanged"/> event. /// </summary> public class SettingChangedEventArgs : System.EventArgs { /// <summary> /// Setting that changed. /// </summary> public string Setting { get; } /// <summary> /// Old value of the setting. /// </summary> public object OldValue { get; } /// <summary> /// New value of the setting. /// </summary> public object NewValue { get; } /// <summary> /// Creates an instance of the arguments. /// </summary> /// <param name="setting">Setting that changed.</param> /// <param name="oldValue">Old value of the setting.</param> /// <param name="newValue">New value of the setting.</param> public SettingChangedEventArgs(string setting, object oldValue, object newValue) { Setting = setting; OldValue = oldValue; NewValue = newValue; } /// <inheritdoc/> public override string ToString() => $"{Setting}: {OldValue} -> {NewValue}"; } }
29.219512
84
0.560935
[ "MIT" ]
HorvatJosip/Braco
src/Braco.Services.Abstractions/EventArgs/SettingChangedEventArgs.cs
1,200
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace FingerDash.Forms { public partial class TimeCardCurrentW : Form { public TimeCardCurrentW() { InitializeComponent(); CheckCurentTime(); } private void CheckCurentTime() { DateTime dateTime = DateTime.Now; string monday = "Monday"; string tuesday = "Tuesday"; string wednesday = "Wednesday"; string thursday = "Thursday"; string friday = "Friday"; string saturday = "Saturday"; string sunday = "Sunday"; if (monday == dateTime.ToString("dddd")) { labelM1.Text = dateTime.ToString("dddd, dd MMM"); labelT1.Text = dateTime.AddDays(1).ToString("dddd, dd MMM"); labelW1.Text = dateTime.AddDays(2).ToString("dddd, dd MMM"); labelTh1.Text = dateTime.AddDays(3).ToString("dddd, dd MMM"); labelF1.Text = dateTime.AddDays(4).ToString("dddd, dd MMM"); labelS1.Text = dateTime.AddDays(5).ToString("dddd, dd MMM"); labelSu1.Text = dateTime.AddDays(6).ToString("dddd, dd MMM"); labelM2.Text = dateTime.AddDays(7).ToString("dddd, dd MMM"); labelT2.Text = dateTime.AddDays(8).ToString("dddd, dd MMM"); labelW2.Text = dateTime.AddDays(9).ToString("dddd, dd MMM"); labelTh2.Text = dateTime.AddDays(10).ToString("dddd, dd MMM"); labelF2.Text = dateTime.AddDays(11).ToString("dddd, dd MMM"); labelS2.Text = dateTime.AddDays(12).ToString("dddd, dd MMM"); labelSu2.Text = dateTime.AddDays(13).ToString("dddd, dd MMM"); labelM3.Text = dateTime.AddDays(14).ToString("dddd, dd MMM"); labelT3.Text = dateTime.AddDays(15).ToString("dddd, dd MMM"); labelW3.Text = dateTime.AddDays(16).ToString("dddd, dd MMM"); labelTh3.Text = dateTime.AddDays(17).ToString("dddd, dd MMM"); labelF3.Text = dateTime.AddDays(18).ToString("dddd, dd MMM"); labelS3.Text = dateTime.AddDays(19).ToString("dddd, dd MMM"); labelSu3.Text = dateTime.AddDays(20).ToString("dddd, dd MMM"); labelM4.Text = dateTime.AddDays(21).ToString("dddd, dd MMM"); labelT4.Text = dateTime.AddDays(22).ToString("dddd, dd MMM"); labelW4.Text = dateTime.AddDays(23).ToString("dddd, dd MMM"); labelTh4.Text = dateTime.AddDays(24).ToString("dddd, dd MMM"); labelF4.Text = dateTime.AddDays(25).ToString("dddd, dd MMM"); labelS4.Text = dateTime.AddDays(26).ToString("dddd, dd MMM"); labelSu4.Text = dateTime.AddDays(27).ToString("dddd, dd MMM"); } if (tuesday == dateTime.ToString("dddd")) { labelM1.Text = dateTime.AddDays(-1).ToString("dddd, dd MMM"); labelT1.Text = dateTime.ToString("dddd, dd MMM"); labelW1.Text = dateTime.AddDays(1).ToString("dddd, dd MMM"); labelTh1.Text = dateTime.AddDays(2).ToString("dddd, dd MMM"); labelF1.Text = dateTime.AddDays(3).ToString("dddd, dd MMM"); labelS1.Text = dateTime.AddDays(4).ToString("dddd, dd MMM"); labelSu1.Text = dateTime.AddDays(5).ToString("dddd, dd MMM"); labelM2.Text = dateTime.AddDays(6).ToString("dddd, dd MMM"); labelT2.Text = dateTime.AddDays(7).ToString("dddd, dd MMM"); labelW2.Text = dateTime.AddDays(8).ToString("dddd, dd MMM"); labelTh2.Text = dateTime.AddDays(9).ToString("dddd, dd MMM"); labelF2.Text = dateTime.AddDays(10).ToString("dddd, dd MMM"); labelS2.Text = dateTime.AddDays(11).ToString("dddd, dd MMM"); labelSu2.Text = dateTime.AddDays(12).ToString("dddd, dd MMM"); labelM3.Text = dateTime.AddDays(13).ToString("dddd, dd MMM"); labelT3.Text = dateTime.AddDays(14).ToString("dddd, dd MMM"); labelW3.Text = dateTime.AddDays(15).ToString("dddd, dd MMM"); labelTh3.Text = dateTime.AddDays(16).ToString("dddd, dd MMM"); labelF3.Text = dateTime.AddDays(17).ToString("dddd, dd MMM"); labelS3.Text = dateTime.AddDays(18).ToString("dddd, dd MMM"); labelSu3.Text = dateTime.AddDays(19).ToString("dddd, dd MMM"); labelM4.Text = dateTime.AddDays(20).ToString("dddd, dd MMM"); labelT4.Text = dateTime.AddDays(21).ToString("dddd, dd MMM"); labelW4.Text = dateTime.AddDays(22).ToString("dddd, dd MMM"); labelTh4.Text = dateTime.AddDays(23).ToString("dddd, dd MMM"); labelF4.Text = dateTime.AddDays(24).ToString("dddd, dd MMM"); labelS4.Text = dateTime.AddDays(25).ToString("dddd, dd MMM"); labelSu4.Text = dateTime.AddDays(26).ToString("dddd, dd MMM"); } if (wednesday == dateTime.ToString("dddd")) { labelM1.Text = dateTime.AddDays(-2).ToString("dddd, dd MMM"); labelT1.Text = dateTime.AddDays(-1).ToString("dddd, dd MMM"); labelW1.Text = dateTime.ToString("dddd, dd MMM"); labelTh1.Text = dateTime.AddDays(1).ToString("dddd, dd MMM"); labelF1.Text = dateTime.AddDays(2).ToString("dddd, dd MMM"); labelS1.Text = dateTime.AddDays(3).ToString("dddd, dd MMM"); labelSu1.Text = dateTime.AddDays(4).ToString("dddd, dd MMM"); labelM2.Text = dateTime.AddDays(5).ToString("dddd, dd MMM"); labelT2.Text = dateTime.AddDays(6).ToString("dddd, dd MMM"); labelW2.Text = dateTime.AddDays(7).ToString("dddd, dd MMM"); labelTh2.Text = dateTime.AddDays(8).ToString("dddd, dd MMM"); labelF2.Text = dateTime.AddDays(9).ToString("dddd, dd MMM"); labelS2.Text = dateTime.AddDays(10).ToString("dddd, dd MMM"); labelSu2.Text = dateTime.AddDays(11).ToString("dddd, dd MMM"); labelM3.Text = dateTime.AddDays(12).ToString("dddd, dd MMM"); labelT3.Text = dateTime.AddDays(13).ToString("dddd, dd MMM"); labelW3.Text = dateTime.AddDays(14).ToString("dddd, dd MMM"); labelTh3.Text = dateTime.AddDays(15).ToString("dddd, dd MMM"); labelF3.Text = dateTime.AddDays(16).ToString("dddd, dd MMM"); labelS3.Text = dateTime.AddDays(17).ToString("dddd, dd MMM"); labelSu3.Text = dateTime.AddDays(18).ToString("dddd, dd MMM"); labelM4.Text = dateTime.AddDays(19).ToString("dddd, dd MMM"); labelT4.Text = dateTime.AddDays(20).ToString("dddd, dd MMM"); labelW4.Text = dateTime.AddDays(21).ToString("dddd, dd MMM"); labelTh4.Text = dateTime.AddDays(22).ToString("dddd, dd MMM"); labelF4.Text = dateTime.AddDays(23).ToString("dddd, dd MMM"); labelS4.Text = dateTime.AddDays(24).ToString("dddd, dd MMM"); labelSu4.Text = dateTime.AddDays(25).ToString("dddd, dd MMM"); } if (thursday == dateTime.ToString("dddd")) { labelM1.Text = dateTime.AddDays(-3).ToString("dddd, dd MMM"); labelT1.Text = dateTime.AddDays(-2).ToString("dddd, dd MMM"); labelW1.Text = dateTime.AddDays(-1).ToString("dddd, dd MMM"); labelTh1.Text = dateTime.ToString("dddd, dd MMM"); labelF1.Text = dateTime.AddDays(1).ToString("dddd, dd MMM"); labelS1.Text = dateTime.AddDays(2).ToString("dddd, dd MMM"); labelSu1.Text = dateTime.AddDays(3).ToString("dddd, dd MMM"); labelM2.Text = dateTime.AddDays(4).ToString("dddd, dd MMM"); labelT2.Text = dateTime.AddDays(5).ToString("dddd, dd MMM"); labelW2.Text = dateTime.AddDays(6).ToString("dddd, dd MMM"); labelTh2.Text = dateTime.AddDays(7).ToString("dddd, dd MMM"); labelF2.Text = dateTime.AddDays(8).ToString("dddd, dd MMM"); labelS2.Text = dateTime.AddDays(9).ToString("dddd, dd MMM"); labelSu2.Text = dateTime.AddDays(10).ToString("dddd, dd MMM"); labelM3.Text = dateTime.AddDays(11).ToString("dddd, dd MMM"); labelT3.Text = dateTime.AddDays(12).ToString("dddd, dd MMM"); labelW3.Text = dateTime.AddDays(13).ToString("dddd, dd MMM"); labelTh3.Text = dateTime.AddDays(14).ToString("dddd, dd MMM"); labelF3.Text = dateTime.AddDays(15).ToString("dddd, dd MMM"); labelS3.Text = dateTime.AddDays(16).ToString("dddd, dd MMM"); labelSu3.Text = dateTime.AddDays(17).ToString("dddd, dd MMM"); labelM4.Text = dateTime.AddDays(18).ToString("dddd, dd MMM"); labelT4.Text = dateTime.AddDays(19).ToString("dddd, dd MMM"); labelW4.Text = dateTime.AddDays(20).ToString("dddd, dd MMM"); labelTh4.Text = dateTime.AddDays(21).ToString("dddd, dd MMM"); labelF4.Text = dateTime.AddDays(22).ToString("dddd, dd MMM"); labelS4.Text = dateTime.AddDays(23).ToString("dddd, dd MMM"); labelSu4.Text = dateTime.AddDays(24).ToString("dddd, dd MMM"); } if (friday == dateTime.ToString("dddd")) { labelM1.Text = dateTime.AddDays(-4).ToString("dddd, dd MMM"); labelT1.Text = dateTime.AddDays(-3).ToString("dddd, dd MMM"); labelW1.Text = dateTime.AddDays(-2).ToString("dddd, dd MMM"); labelTh1.Text = dateTime.AddDays(-1).ToString("dddd, dd MMM"); labelF1.Text = dateTime.ToString("dddd, dd MMM"); labelS1.Text = dateTime.AddDays(1).ToString("dddd, dd MMM"); labelSu1.Text = dateTime.AddDays(2).ToString("dddd, dd MMM"); labelM2.Text = dateTime.AddDays(3).ToString("dddd, dd MMM"); labelT2.Text = dateTime.AddDays(4).ToString("dddd, dd MMM"); labelW2.Text = dateTime.AddDays(5).ToString("dddd, dd MMM"); labelTh2.Text = dateTime.AddDays(6).ToString("dddd, dd MMM"); labelF2.Text = dateTime.AddDays(7).ToString("dddd, dd MMM"); labelS2.Text = dateTime.AddDays(8).ToString("dddd, dd MMM"); labelSu2.Text = dateTime.AddDays(9).ToString("dddd, dd MMM"); labelM3.Text = dateTime.AddDays(10).ToString("dddd, dd MMM"); labelT3.Text = dateTime.AddDays(11).ToString("dddd, dd MMM"); labelW3.Text = dateTime.AddDays(12).ToString("dddd, dd MMM"); labelTh3.Text = dateTime.AddDays(13).ToString("dddd, dd MMM"); labelF3.Text = dateTime.AddDays(14).ToString("dddd, dd MMM"); labelS3.Text = dateTime.AddDays(15).ToString("dddd, dd MMM"); labelSu3.Text = dateTime.AddDays(16).ToString("dddd, dd MMM"); labelM4.Text = dateTime.AddDays(17).ToString("dddd, dd MMM"); labelT4.Text = dateTime.AddDays(18).ToString("dddd, dd MMM"); labelW4.Text = dateTime.AddDays(19).ToString("dddd, dd MMM"); labelTh4.Text = dateTime.AddDays(20).ToString("dddd, dd MMM"); labelF4.Text = dateTime.AddDays(21).ToString("dddd, dd MMM"); labelS4.Text = dateTime.AddDays(22).ToString("dddd, dd MMM"); labelSu4.Text = dateTime.AddDays(23).ToString("dddd, dd MMM"); } if (saturday == dateTime.ToString("dddd")) { labelM1.Text = dateTime.AddDays(-5).ToString("dddd, dd MMM"); labelT1.Text = dateTime.AddDays(-4).ToString("dddd, dd MMM"); labelW1.Text = dateTime.AddDays(-3).ToString("dddd, dd MMM"); labelTh1.Text = dateTime.AddDays(-2).ToString("dddd, dd MMM"); labelF1.Text = dateTime.AddDays(-1).ToString("dddd, dd MMM"); labelS1.Text = dateTime.ToString("dddd, dd MMM"); labelSu1.Text = dateTime.AddDays(1).ToString("dddd, dd MMM"); labelM2.Text = dateTime.AddDays(2).ToString("dddd, dd MMM"); labelT2.Text = dateTime.AddDays(3).ToString("dddd, dd MMM"); labelW2.Text = dateTime.AddDays(4).ToString("dddd, dd MMM"); labelTh2.Text = dateTime.AddDays(5).ToString("dddd, dd MMM"); labelF2.Text = dateTime.AddDays(6).ToString("dddd, dd MMM"); labelS2.Text = dateTime.AddDays(7).ToString("dddd, dd MMM"); labelSu2.Text = dateTime.AddDays(8).ToString("dddd, dd MMM"); labelM3.Text = dateTime.AddDays(9).ToString("dddd, dd MMM"); labelT3.Text = dateTime.AddDays(10).ToString("dddd, dd MMM"); labelW3.Text = dateTime.AddDays(11).ToString("dddd, dd MMM"); labelTh3.Text = dateTime.AddDays(12).ToString("dddd, dd MMM"); labelF3.Text = dateTime.AddDays(13).ToString("dddd, dd MMM"); labelS3.Text = dateTime.AddDays(14).ToString("dddd, dd MMM"); labelSu3.Text = dateTime.AddDays(15).ToString("dddd, dd MMM"); labelM4.Text = dateTime.AddDays(16).ToString("dddd, dd MMM"); labelT4.Text = dateTime.AddDays(17).ToString("dddd, dd MMM"); labelW4.Text = dateTime.AddDays(18).ToString("dddd, dd MMM"); labelTh4.Text = dateTime.AddDays(19).ToString("dddd, dd MMM"); labelF4.Text = dateTime.AddDays(20).ToString("dddd, dd MMM"); labelS4.Text = dateTime.AddDays(21).ToString("dddd, dd MMM"); labelSu4.Text = dateTime.AddDays(22).ToString("dddd, dd MMM"); } if (sunday == dateTime.ToString("dddd")) { labelM1.Text = dateTime.AddDays(-6).ToString("dddd, dd MMM"); labelT1.Text = dateTime.AddDays(-5).ToString("dddd, dd MMM"); labelW1.Text = dateTime.AddDays(-4).ToString("dddd, dd MMM"); labelTh1.Text = dateTime.AddDays(-3).ToString("dddd, dd MMM"); labelF1.Text = dateTime.AddDays(-2).ToString("dddd, dd MMM"); labelS1.Text = dateTime.AddDays(-1).ToString("dddd, dd MMM"); labelSu1.Text = dateTime.ToString("dddd, dd MMM"); labelM2.Text = dateTime.AddDays(1).ToString("dddd, dd MMM"); labelT2.Text = dateTime.AddDays(2).ToString("dddd, dd MMM"); labelW2.Text = dateTime.AddDays(3).ToString("dddd, dd MMM"); labelTh2.Text = dateTime.AddDays(4).ToString("dddd, dd MMM"); labelF2.Text = dateTime.AddDays(5).ToString("dddd, dd MMM"); labelS2.Text = dateTime.AddDays(6).ToString("dddd, dd MMM"); labelSu2.Text = dateTime.AddDays(7).ToString("dddd, dd MMM"); labelM3.Text = dateTime.AddDays(8).ToString("dddd, dd MMM"); labelT3.Text = dateTime.AddDays(9).ToString("dddd, dd MMM"); labelW3.Text = dateTime.AddDays(10).ToString("dddd, dd MMM"); labelTh3.Text = dateTime.AddDays(11).ToString("dddd, dd MMM"); labelF3.Text = dateTime.AddDays(12).ToString("dddd, dd MMM"); labelS3.Text = dateTime.AddDays(13).ToString("dddd, dd MMM"); labelSu3.Text = dateTime.AddDays(14).ToString("dddd, dd MMM"); labelM4.Text = dateTime.AddDays(15).ToString("dddd, dd MMM"); labelT4.Text = dateTime.AddDays(16).ToString("dddd, dd MMM"); labelW4.Text = dateTime.AddDays(17).ToString("dddd, dd MMM"); labelTh4.Text = dateTime.AddDays(18).ToString("dddd, dd MMM"); labelF4.Text = dateTime.AddDays(19).ToString("dddd, dd MMM"); labelS4.Text = dateTime.AddDays(20).ToString("dddd, dd MMM"); labelSu4.Text = dateTime.AddDays(21).ToString("dddd, dd MMM"); } } } }
66.16
78
0.567231
[ "MIT" ]
RobertGheo/FingerDash
FingerDash/Forms/TimeCardCurrentW.cs
16,542
C#
// Generated from https://github.com/nuke-build/nuke/blob/master/build/specifications/DotCover.json using JetBrains.Annotations; using Newtonsoft.Json; using Nuke.Common; using Nuke.Common.Execution; using Nuke.Common.Tooling; using Nuke.Common.Tools; using Nuke.Common.Utilities.Collections; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Text; namespace Nuke.Common.Tools.DotCover { /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DotCoverTasks { /// <summary> /// Path to the DotCover executable. /// </summary> public static string DotCoverPath => ToolPathResolver.TryGetEnvironmentExecutable("DOTCOVER_EXE") ?? GetToolPath(); public static Action<OutputType, string> DotCoverLogger { get; set; } = ProcessTasks.DefaultLogger; /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> public static IReadOnlyCollection<Output> DotCover(string arguments, string workingDirectory = null, IReadOnlyDictionary<string, string> environmentVariables = null, int? timeout = null, bool? logOutput = null, bool? logInvocation = null, Func<string, string> outputFilter = null) { using var process = ProcessTasks.StartProcess(DotCoverPath, arguments, workingDirectory, environmentVariables, timeout, logOutput, logInvocation, DotCoverLogger, outputFilter); process.AssertZeroExitCode(); return process.Output; } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverAnalyseSettings.Configuration"/></li> /// <li><c>--AllowSymbolServerAccess</c> via <see cref="DotCoverAnalyseSettings.AllowSymbolServerAccess"/></li> /// <li><c>--AnalyseTargetArguments</c> via <see cref="DotCoverAnalyseSettings.AnalyseTargetArguments"/></li> /// <li><c>--AttributeFilters</c> via <see cref="DotCoverAnalyseSettings.AttributeFilters"/></li> /// <li><c>--DisableDefaultFilters</c> via <see cref="DotCoverAnalyseSettings.DisableDefaultFilters"/></li> /// <li><c>--Filters</c> via <see cref="DotCoverAnalyseSettings.Filters"/></li> /// <li><c>--HideAutoProperties</c> via <see cref="DotCoverAnalyseSettings.HideAutoProperties"/></li> /// <li><c>--InheritConsole</c> via <see cref="DotCoverAnalyseSettings.InheritConsole"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverAnalyseSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverAnalyseSettings.OutputFile"/></li> /// <li><c>--ProcessFilters</c> via <see cref="DotCoverAnalyseSettings.ProcessFilters"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverAnalyseSettings.ReportType"/></li> /// <li><c>--ReturnTargetExitCode</c> via <see cref="DotCoverAnalyseSettings.ReturnTargetExitCode"/></li> /// <li><c>--Scope</c> via <see cref="DotCoverAnalyseSettings.Scope"/></li> /// <li><c>--SymbolSearchPaths</c> via <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/></li> /// <li><c>--TargetArguments</c> via <see cref="DotCoverAnalyseSettings.TargetArguments"/></li> /// <li><c>--TargetExecutable</c> via <see cref="DotCoverAnalyseSettings.TargetExecutable"/></li> /// <li><c>--TargetWorkingDir</c> via <see cref="DotCoverAnalyseSettings.TargetWorkingDirectory"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverAnalyseSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverAnalyse(DotCoverAnalyseSettings toolSettings = null) { toolSettings = toolSettings ?? new DotCoverAnalyseSettings(); using var process = ProcessTasks.StartProcess(toolSettings); process.AssertZeroExitCode(); return process.Output; } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverAnalyseSettings.Configuration"/></li> /// <li><c>--AllowSymbolServerAccess</c> via <see cref="DotCoverAnalyseSettings.AllowSymbolServerAccess"/></li> /// <li><c>--AnalyseTargetArguments</c> via <see cref="DotCoverAnalyseSettings.AnalyseTargetArguments"/></li> /// <li><c>--AttributeFilters</c> via <see cref="DotCoverAnalyseSettings.AttributeFilters"/></li> /// <li><c>--DisableDefaultFilters</c> via <see cref="DotCoverAnalyseSettings.DisableDefaultFilters"/></li> /// <li><c>--Filters</c> via <see cref="DotCoverAnalyseSettings.Filters"/></li> /// <li><c>--HideAutoProperties</c> via <see cref="DotCoverAnalyseSettings.HideAutoProperties"/></li> /// <li><c>--InheritConsole</c> via <see cref="DotCoverAnalyseSettings.InheritConsole"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverAnalyseSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverAnalyseSettings.OutputFile"/></li> /// <li><c>--ProcessFilters</c> via <see cref="DotCoverAnalyseSettings.ProcessFilters"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverAnalyseSettings.ReportType"/></li> /// <li><c>--ReturnTargetExitCode</c> via <see cref="DotCoverAnalyseSettings.ReturnTargetExitCode"/></li> /// <li><c>--Scope</c> via <see cref="DotCoverAnalyseSettings.Scope"/></li> /// <li><c>--SymbolSearchPaths</c> via <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/></li> /// <li><c>--TargetArguments</c> via <see cref="DotCoverAnalyseSettings.TargetArguments"/></li> /// <li><c>--TargetExecutable</c> via <see cref="DotCoverAnalyseSettings.TargetExecutable"/></li> /// <li><c>--TargetWorkingDir</c> via <see cref="DotCoverAnalyseSettings.TargetWorkingDirectory"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverAnalyseSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverAnalyse(Configure<DotCoverAnalyseSettings> configurator) { return DotCoverAnalyse(configurator(new DotCoverAnalyseSettings())); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverAnalyseSettings.Configuration"/></li> /// <li><c>--AllowSymbolServerAccess</c> via <see cref="DotCoverAnalyseSettings.AllowSymbolServerAccess"/></li> /// <li><c>--AnalyseTargetArguments</c> via <see cref="DotCoverAnalyseSettings.AnalyseTargetArguments"/></li> /// <li><c>--AttributeFilters</c> via <see cref="DotCoverAnalyseSettings.AttributeFilters"/></li> /// <li><c>--DisableDefaultFilters</c> via <see cref="DotCoverAnalyseSettings.DisableDefaultFilters"/></li> /// <li><c>--Filters</c> via <see cref="DotCoverAnalyseSettings.Filters"/></li> /// <li><c>--HideAutoProperties</c> via <see cref="DotCoverAnalyseSettings.HideAutoProperties"/></li> /// <li><c>--InheritConsole</c> via <see cref="DotCoverAnalyseSettings.InheritConsole"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverAnalyseSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverAnalyseSettings.OutputFile"/></li> /// <li><c>--ProcessFilters</c> via <see cref="DotCoverAnalyseSettings.ProcessFilters"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverAnalyseSettings.ReportType"/></li> /// <li><c>--ReturnTargetExitCode</c> via <see cref="DotCoverAnalyseSettings.ReturnTargetExitCode"/></li> /// <li><c>--Scope</c> via <see cref="DotCoverAnalyseSettings.Scope"/></li> /// <li><c>--SymbolSearchPaths</c> via <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/></li> /// <li><c>--TargetArguments</c> via <see cref="DotCoverAnalyseSettings.TargetArguments"/></li> /// <li><c>--TargetExecutable</c> via <see cref="DotCoverAnalyseSettings.TargetExecutable"/></li> /// <li><c>--TargetWorkingDir</c> via <see cref="DotCoverAnalyseSettings.TargetWorkingDirectory"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverAnalyseSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IEnumerable<(DotCoverAnalyseSettings Settings, IReadOnlyCollection<Output> Output)> DotCoverAnalyse(CombinatorialConfigure<DotCoverAnalyseSettings> configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) { return configurator.Invoke(DotCoverAnalyse, DotCoverLogger, degreeOfParallelism, completeOnFailure); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverCoverSettings.Configuration"/></li> /// <li><c>--AllowSymbolServerAccess</c> via <see cref="DotCoverCoverSettings.AllowSymbolServerAccess"/></li> /// <li><c>--AnalyseTargetArguments</c> via <see cref="DotCoverCoverSettings.AnalyseTargetArguments"/></li> /// <li><c>--AttributeFilters</c> via <see cref="DotCoverCoverSettings.AttributeFilters"/></li> /// <li><c>--DisableDefaultFilters</c> via <see cref="DotCoverCoverSettings.DisableDefaultFilters"/></li> /// <li><c>--Filters</c> via <see cref="DotCoverCoverSettings.Filters"/></li> /// <li><c>--InheritConsole</c> via <see cref="DotCoverCoverSettings.InheritConsole"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverCoverSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverCoverSettings.OutputFile"/></li> /// <li><c>--ProcessFilters</c> via <see cref="DotCoverCoverSettings.ProcessFilters"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverCoverSettings.ReportType"/></li> /// <li><c>--ReturnTargetExitCode</c> via <see cref="DotCoverCoverSettings.ReturnTargetExitCode"/></li> /// <li><c>--Scope</c> via <see cref="DotCoverCoverSettings.Scope"/></li> /// <li><c>--SymbolSearchPaths</c> via <see cref="DotCoverCoverSettings.SymbolSearchPaths"/></li> /// <li><c>--TargetArguments</c> via <see cref="DotCoverCoverSettings.TargetArguments"/></li> /// <li><c>--TargetExecutable</c> via <see cref="DotCoverCoverSettings.TargetExecutable"/></li> /// <li><c>--TargetWorkingDir</c> via <see cref="DotCoverCoverSettings.TargetWorkingDirectory"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverCoverSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverCover(DotCoverCoverSettings toolSettings = null) { toolSettings = toolSettings ?? new DotCoverCoverSettings(); using var process = ProcessTasks.StartProcess(toolSettings); process.AssertZeroExitCode(); return process.Output; } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverCoverSettings.Configuration"/></li> /// <li><c>--AllowSymbolServerAccess</c> via <see cref="DotCoverCoverSettings.AllowSymbolServerAccess"/></li> /// <li><c>--AnalyseTargetArguments</c> via <see cref="DotCoverCoverSettings.AnalyseTargetArguments"/></li> /// <li><c>--AttributeFilters</c> via <see cref="DotCoverCoverSettings.AttributeFilters"/></li> /// <li><c>--DisableDefaultFilters</c> via <see cref="DotCoverCoverSettings.DisableDefaultFilters"/></li> /// <li><c>--Filters</c> via <see cref="DotCoverCoverSettings.Filters"/></li> /// <li><c>--InheritConsole</c> via <see cref="DotCoverCoverSettings.InheritConsole"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverCoverSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverCoverSettings.OutputFile"/></li> /// <li><c>--ProcessFilters</c> via <see cref="DotCoverCoverSettings.ProcessFilters"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverCoverSettings.ReportType"/></li> /// <li><c>--ReturnTargetExitCode</c> via <see cref="DotCoverCoverSettings.ReturnTargetExitCode"/></li> /// <li><c>--Scope</c> via <see cref="DotCoverCoverSettings.Scope"/></li> /// <li><c>--SymbolSearchPaths</c> via <see cref="DotCoverCoverSettings.SymbolSearchPaths"/></li> /// <li><c>--TargetArguments</c> via <see cref="DotCoverCoverSettings.TargetArguments"/></li> /// <li><c>--TargetExecutable</c> via <see cref="DotCoverCoverSettings.TargetExecutable"/></li> /// <li><c>--TargetWorkingDir</c> via <see cref="DotCoverCoverSettings.TargetWorkingDirectory"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverCoverSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverCover(Configure<DotCoverCoverSettings> configurator) { return DotCoverCover(configurator(new DotCoverCoverSettings())); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverCoverSettings.Configuration"/></li> /// <li><c>--AllowSymbolServerAccess</c> via <see cref="DotCoverCoverSettings.AllowSymbolServerAccess"/></li> /// <li><c>--AnalyseTargetArguments</c> via <see cref="DotCoverCoverSettings.AnalyseTargetArguments"/></li> /// <li><c>--AttributeFilters</c> via <see cref="DotCoverCoverSettings.AttributeFilters"/></li> /// <li><c>--DisableDefaultFilters</c> via <see cref="DotCoverCoverSettings.DisableDefaultFilters"/></li> /// <li><c>--Filters</c> via <see cref="DotCoverCoverSettings.Filters"/></li> /// <li><c>--InheritConsole</c> via <see cref="DotCoverCoverSettings.InheritConsole"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverCoverSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverCoverSettings.OutputFile"/></li> /// <li><c>--ProcessFilters</c> via <see cref="DotCoverCoverSettings.ProcessFilters"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverCoverSettings.ReportType"/></li> /// <li><c>--ReturnTargetExitCode</c> via <see cref="DotCoverCoverSettings.ReturnTargetExitCode"/></li> /// <li><c>--Scope</c> via <see cref="DotCoverCoverSettings.Scope"/></li> /// <li><c>--SymbolSearchPaths</c> via <see cref="DotCoverCoverSettings.SymbolSearchPaths"/></li> /// <li><c>--TargetArguments</c> via <see cref="DotCoverCoverSettings.TargetArguments"/></li> /// <li><c>--TargetExecutable</c> via <see cref="DotCoverCoverSettings.TargetExecutable"/></li> /// <li><c>--TargetWorkingDir</c> via <see cref="DotCoverCoverSettings.TargetWorkingDirectory"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverCoverSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IEnumerable<(DotCoverCoverSettings Settings, IReadOnlyCollection<Output> Output)> DotCoverCover(CombinatorialConfigure<DotCoverCoverSettings> configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) { return configurator.Invoke(DotCoverCover, DotCoverLogger, degreeOfParallelism, completeOnFailure); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverCoverDotNetSettings.Configuration"/></li> /// <li><c>--AllowSymbolServerAccess</c> via <see cref="DotCoverCoverDotNetSettings.AllowSymbolServerAccess"/></li> /// <li><c>--AnalyseTargetArguments</c> via <see cref="DotCoverCoverDotNetSettings.AnalyseTargetArguments"/></li> /// <li><c>--AttributeFilters</c> via <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/></li> /// <li><c>--DisableDefaultFilters</c> via <see cref="DotCoverCoverDotNetSettings.DisableDefaultFilters"/></li> /// <li><c>--Filters</c> via <see cref="DotCoverCoverDotNetSettings.Filters"/></li> /// <li><c>--InheritConsole</c> via <see cref="DotCoverCoverDotNetSettings.InheritConsole"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverCoverDotNetSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverCoverDotNetSettings.OutputFile"/></li> /// <li><c>--ProcessFilters</c> via <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverCoverDotNetSettings.ReportType"/></li> /// <li><c>--ReturnTargetExitCode</c> via <see cref="DotCoverCoverDotNetSettings.ReturnTargetExitCode"/></li> /// <li><c>--Scope</c> via <see cref="DotCoverCoverDotNetSettings.Scope"/></li> /// <li><c>--SymbolSearchPaths</c> via <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/></li> /// <li><c>--TargetArguments</c> via <see cref="DotCoverCoverDotNetSettings.TargetArguments"/></li> /// <li><c>--TargetWorkingDir</c> via <see cref="DotCoverCoverDotNetSettings.TargetWorkingDirectory"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverCoverDotNetSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverCoverDotNet(DotCoverCoverDotNetSettings toolSettings = null) { toolSettings = toolSettings ?? new DotCoverCoverDotNetSettings(); using var process = ProcessTasks.StartProcess(toolSettings); process.AssertZeroExitCode(); return process.Output; } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverCoverDotNetSettings.Configuration"/></li> /// <li><c>--AllowSymbolServerAccess</c> via <see cref="DotCoverCoverDotNetSettings.AllowSymbolServerAccess"/></li> /// <li><c>--AnalyseTargetArguments</c> via <see cref="DotCoverCoverDotNetSettings.AnalyseTargetArguments"/></li> /// <li><c>--AttributeFilters</c> via <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/></li> /// <li><c>--DisableDefaultFilters</c> via <see cref="DotCoverCoverDotNetSettings.DisableDefaultFilters"/></li> /// <li><c>--Filters</c> via <see cref="DotCoverCoverDotNetSettings.Filters"/></li> /// <li><c>--InheritConsole</c> via <see cref="DotCoverCoverDotNetSettings.InheritConsole"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverCoverDotNetSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverCoverDotNetSettings.OutputFile"/></li> /// <li><c>--ProcessFilters</c> via <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverCoverDotNetSettings.ReportType"/></li> /// <li><c>--ReturnTargetExitCode</c> via <see cref="DotCoverCoverDotNetSettings.ReturnTargetExitCode"/></li> /// <li><c>--Scope</c> via <see cref="DotCoverCoverDotNetSettings.Scope"/></li> /// <li><c>--SymbolSearchPaths</c> via <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/></li> /// <li><c>--TargetArguments</c> via <see cref="DotCoverCoverDotNetSettings.TargetArguments"/></li> /// <li><c>--TargetWorkingDir</c> via <see cref="DotCoverCoverDotNetSettings.TargetWorkingDirectory"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverCoverDotNetSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverCoverDotNet(Configure<DotCoverCoverDotNetSettings> configurator) { return DotCoverCoverDotNet(configurator(new DotCoverCoverDotNetSettings())); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverCoverDotNetSettings.Configuration"/></li> /// <li><c>--AllowSymbolServerAccess</c> via <see cref="DotCoverCoverDotNetSettings.AllowSymbolServerAccess"/></li> /// <li><c>--AnalyseTargetArguments</c> via <see cref="DotCoverCoverDotNetSettings.AnalyseTargetArguments"/></li> /// <li><c>--AttributeFilters</c> via <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/></li> /// <li><c>--DisableDefaultFilters</c> via <see cref="DotCoverCoverDotNetSettings.DisableDefaultFilters"/></li> /// <li><c>--Filters</c> via <see cref="DotCoverCoverDotNetSettings.Filters"/></li> /// <li><c>--InheritConsole</c> via <see cref="DotCoverCoverDotNetSettings.InheritConsole"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverCoverDotNetSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverCoverDotNetSettings.OutputFile"/></li> /// <li><c>--ProcessFilters</c> via <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverCoverDotNetSettings.ReportType"/></li> /// <li><c>--ReturnTargetExitCode</c> via <see cref="DotCoverCoverDotNetSettings.ReturnTargetExitCode"/></li> /// <li><c>--Scope</c> via <see cref="DotCoverCoverDotNetSettings.Scope"/></li> /// <li><c>--SymbolSearchPaths</c> via <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/></li> /// <li><c>--TargetArguments</c> via <see cref="DotCoverCoverDotNetSettings.TargetArguments"/></li> /// <li><c>--TargetWorkingDir</c> via <see cref="DotCoverCoverDotNetSettings.TargetWorkingDirectory"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverCoverDotNetSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IEnumerable<(DotCoverCoverDotNetSettings Settings, IReadOnlyCollection<Output> Output)> DotCoverCoverDotNet(CombinatorialConfigure<DotCoverCoverDotNetSettings> configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) { return configurator.Invoke(DotCoverCoverDotNet, DotCoverLogger, degreeOfParallelism, completeOnFailure); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverDeleteSettings.Configuration"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverDeleteSettings.LogFile"/></li> /// <li><c>--Source</c> via <see cref="DotCoverDeleteSettings.Source"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverDelete(DotCoverDeleteSettings toolSettings = null) { toolSettings = toolSettings ?? new DotCoverDeleteSettings(); using var process = ProcessTasks.StartProcess(toolSettings); process.AssertZeroExitCode(); return process.Output; } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverDeleteSettings.Configuration"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverDeleteSettings.LogFile"/></li> /// <li><c>--Source</c> via <see cref="DotCoverDeleteSettings.Source"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverDelete(Configure<DotCoverDeleteSettings> configurator) { return DotCoverDelete(configurator(new DotCoverDeleteSettings())); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverDeleteSettings.Configuration"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverDeleteSettings.LogFile"/></li> /// <li><c>--Source</c> via <see cref="DotCoverDeleteSettings.Source"/></li> /// </ul> /// </remarks> public static IEnumerable<(DotCoverDeleteSettings Settings, IReadOnlyCollection<Output> Output)> DotCoverDelete(CombinatorialConfigure<DotCoverDeleteSettings> configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) { return configurator.Invoke(DotCoverDelete, DotCoverLogger, degreeOfParallelism, completeOnFailure); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverMergeSettings.Configuration"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverMergeSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverMergeSettings.OutputFile"/></li> /// <li><c>--Source</c> via <see cref="DotCoverMergeSettings.Source"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverMergeSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverMerge(DotCoverMergeSettings toolSettings = null) { toolSettings = toolSettings ?? new DotCoverMergeSettings(); using var process = ProcessTasks.StartProcess(toolSettings); process.AssertZeroExitCode(); return process.Output; } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverMergeSettings.Configuration"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverMergeSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverMergeSettings.OutputFile"/></li> /// <li><c>--Source</c> via <see cref="DotCoverMergeSettings.Source"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverMergeSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverMerge(Configure<DotCoverMergeSettings> configurator) { return DotCoverMerge(configurator(new DotCoverMergeSettings())); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverMergeSettings.Configuration"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverMergeSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverMergeSettings.OutputFile"/></li> /// <li><c>--Source</c> via <see cref="DotCoverMergeSettings.Source"/></li> /// <li><c>--TempDir</c> via <see cref="DotCoverMergeSettings.TempDirectory"/></li> /// </ul> /// </remarks> public static IEnumerable<(DotCoverMergeSettings Settings, IReadOnlyCollection<Output> Output)> DotCoverMerge(CombinatorialConfigure<DotCoverMergeSettings> configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) { return configurator.Invoke(DotCoverMerge, DotCoverLogger, degreeOfParallelism, completeOnFailure); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverReportSettings.Configuration"/></li> /// <li><c>--HideAutoProperties</c> via <see cref="DotCoverReportSettings.HideAutoProperties"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverReportSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverReportSettings.OutputFile"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverReportSettings.ReportType"/></li> /// <li><c>--Source</c> via <see cref="DotCoverReportSettings.Source"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverReport(DotCoverReportSettings toolSettings = null) { toolSettings = toolSettings ?? new DotCoverReportSettings(); using var process = ProcessTasks.StartProcess(toolSettings); process.AssertZeroExitCode(); return process.Output; } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverReportSettings.Configuration"/></li> /// <li><c>--HideAutoProperties</c> via <see cref="DotCoverReportSettings.HideAutoProperties"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverReportSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverReportSettings.OutputFile"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverReportSettings.ReportType"/></li> /// <li><c>--Source</c> via <see cref="DotCoverReportSettings.Source"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverReport(Configure<DotCoverReportSettings> configurator) { return DotCoverReport(configurator(new DotCoverReportSettings())); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverReportSettings.Configuration"/></li> /// <li><c>--HideAutoProperties</c> via <see cref="DotCoverReportSettings.HideAutoProperties"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverReportSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverReportSettings.OutputFile"/></li> /// <li><c>--ReportType</c> via <see cref="DotCoverReportSettings.ReportType"/></li> /// <li><c>--Source</c> via <see cref="DotCoverReportSettings.Source"/></li> /// </ul> /// </remarks> public static IEnumerable<(DotCoverReportSettings Settings, IReadOnlyCollection<Output> Output)> DotCoverReport(CombinatorialConfigure<DotCoverReportSettings> configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) { return configurator.Invoke(DotCoverReport, DotCoverLogger, degreeOfParallelism, completeOnFailure); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverZipSettings.Configuration"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverZipSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverZipSettings.OutputFile"/></li> /// <li><c>--Source</c> via <see cref="DotCoverZipSettings.Source"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverZip(DotCoverZipSettings toolSettings = null) { toolSettings = toolSettings ?? new DotCoverZipSettings(); using var process = ProcessTasks.StartProcess(toolSettings); process.AssertZeroExitCode(); return process.Output; } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverZipSettings.Configuration"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverZipSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverZipSettings.OutputFile"/></li> /// <li><c>--Source</c> via <see cref="DotCoverZipSettings.Source"/></li> /// </ul> /// </remarks> public static IReadOnlyCollection<Output> DotCoverZip(Configure<DotCoverZipSettings> configurator) { return DotCoverZip(configurator(new DotCoverZipSettings())); } /// <summary> /// <p>dotCover is a .NET unit testing and code coverage tool that works right in Visual Studio, helps you know to what extent your code is covered with unit tests, provides great ways to visualize code coverage, and is Continuous Integration ready. dotCover calculates and reports statement-level code coverage in applications targeting .NET Framework, Silverlight, and .NET Core.</p> /// <p>For more details, visit the <a href="https://www.jetbrains.com/dotcover">official website</a>.</p> /// </summary> /// <remarks> /// <p>This is a <a href="http://www.nuke.build/docs/authoring-builds/cli-tools.html#fluent-apis">CLI wrapper with fluent API</a> that allows to modify the following arguments:</p> /// <ul> /// <li><c>&lt;configuration&gt;</c> via <see cref="DotCoverZipSettings.Configuration"/></li> /// <li><c>--LogFile</c> via <see cref="DotCoverZipSettings.LogFile"/></li> /// <li><c>--Output</c> via <see cref="DotCoverZipSettings.OutputFile"/></li> /// <li><c>--Source</c> via <see cref="DotCoverZipSettings.Source"/></li> /// </ul> /// </remarks> public static IEnumerable<(DotCoverZipSettings Settings, IReadOnlyCollection<Output> Output)> DotCoverZip(CombinatorialConfigure<DotCoverZipSettings> configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) { return configurator.Invoke(DotCoverZip, DotCoverLogger, degreeOfParallelism, completeOnFailure); } } #region DotCoverAnalyseSettings /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] [Serializable] public partial class DotCoverAnalyseSettings : ToolSettings { /// <summary> /// Path to the DotCover executable. /// </summary> public override string ProcessToolPath => base.ProcessToolPath ?? DotCoverTasks.DotCoverPath; public override Action<OutputType, string> ProcessCustomLogger => DotCoverTasks.DotCoverLogger; public virtual string Configuration { get; internal set; } /// <summary> /// File name of the program to analyse. /// </summary> public virtual string TargetExecutable { get; internal set; } /// <summary> /// A type of the report. The default value is <c>XML</c>. /// </summary> public virtual DotCoverReportType ReportType { get; internal set; } /// <summary> /// Resulting report file name. /// </summary> public virtual string OutputFile { get; internal set; } /// <summary> /// Remove auto-implemented properties from report. /// </summary> public virtual bool? HideAutoProperties { get; internal set; } /// <summary> /// Program arguments. /// </summary> public virtual string TargetArguments { get; internal set; } /// <summary> /// Program working directory. /// </summary> public virtual string TargetWorkingDirectory { get; internal set; } /// <summary> /// Directory for auxiliary files. Set to the system temp by default. /// </summary> public virtual string TempDirectory { get; internal set; } /// <summary> /// Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited. /// </summary> public virtual bool? InheritConsole { get; internal set; } /// <summary> /// Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>. /// </summary> public virtual bool? AnalyseTargetArguments { get; internal set; } /// <summary> /// Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>). /// </summary> public virtual IReadOnlyList<string> Scope => ScopeInternal.AsReadOnly(); internal List<string> ScopeInternal { get; set; } = new List<string>(); /// <summary> /// Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here. /// </summary> public virtual IReadOnlyList<string> Filters => FiltersInternal.AsReadOnly(); internal List<string> FiltersInternal { get; set; } = new List<string>(); /// <summary> /// Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here. /// </summary> public virtual IReadOnlyList<string> AttributeFilters => AttributeFiltersInternal.AsReadOnly(); internal List<string> AttributeFiltersInternal { get; set; } = new List<string>(); /// <summary> /// Disables default (automatically added) filters. /// </summary> public virtual bool? DisableDefaultFilters { get; internal set; } /// <summary> /// Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here. /// </summary> public virtual IReadOnlyList<string> SymbolSearchPaths => SymbolSearchPathsInternal.AsReadOnly(); internal List<string> SymbolSearchPathsInternal { get; set; } = new List<string>(); /// <summary> /// Allows dotCover to search for PDB files on a symbol server. /// </summary> public virtual bool? AllowSymbolServerAccess { get; internal set; } /// <summary> /// Returns the exit code of the target executable in case coverage analysis succeeded. /// </summary> public virtual bool? ReturnTargetExitCode { get; internal set; } /// <summary> /// Specifies process filters. Syntax: <c>+:process1;-:process2</c>. /// </summary> public virtual IReadOnlyList<string> ProcessFilters => ProcessFiltersInternal.AsReadOnly(); internal List<string> ProcessFiltersInternal { get; set; } = new List<string>(); /// <summary> /// Enables logging and specifies log file name. /// </summary> public virtual string LogFile { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments .Add("analyse") .Add("{value}", Configuration) .Add("--TargetExecutable={value}", TargetExecutable) .Add("--ReportType={value}", ReportType) .Add("--Output={value}", OutputFile) .Add("--HideAutoProperties", HideAutoProperties) .Add("--TargetArguments={value}", TargetArguments) .Add("--TargetWorkingDir={value}", TargetWorkingDirectory) .Add("--TempDir={value}", TempDirectory) .Add("--InheritConsole={value}", InheritConsole) .Add("--AnalyseTargetArguments={value}", AnalyseTargetArguments) .Add("--Scope={value}", Scope, separator: ';') .Add("--Filters={value}", Filters, separator: ';') .Add("--AttributeFilters={value}", AttributeFilters, separator: ';') .Add("--DisableDefaultFilters", DisableDefaultFilters) .Add("--SymbolSearchPaths={value}", SymbolSearchPaths, separator: ';') .Add("--AllowSymbolServerAccess", AllowSymbolServerAccess) .Add("--ReturnTargetExitCode", ReturnTargetExitCode) .Add("--ProcessFilters={value}", ProcessFilters, separator: ';') .Add("--LogFile={value}", LogFile); return base.ConfigureProcessArguments(arguments); } } #endregion #region DotCoverCoverSettings /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] [Serializable] public partial class DotCoverCoverSettings : ToolSettings { /// <summary> /// Path to the DotCover executable. /// </summary> public override string ProcessToolPath => base.ProcessToolPath ?? DotCoverTasks.DotCoverPath; public override Action<OutputType, string> ProcessCustomLogger => DotCoverTasks.DotCoverLogger; public virtual string Configuration { get; internal set; } /// <summary> /// File name of the program to analyse. /// </summary> public virtual string TargetExecutable { get; internal set; } /// <summary> /// Path to the resulting coverage snapshot. /// </summary> public virtual string OutputFile { get; internal set; } /// <summary> /// A type of the report. The default value is <c>XML</c>. /// </summary> public virtual DotCoverReportType ReportType { get; internal set; } /// <summary> /// Program arguments. /// </summary> public virtual string TargetArguments { get; internal set; } /// <summary> /// Program working directory. /// </summary> public virtual string TargetWorkingDirectory { get; internal set; } /// <summary> /// Directory for auxiliary files. Set to the system temp by default. /// </summary> public virtual string TempDirectory { get; internal set; } /// <summary> /// Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited. /// </summary> public virtual bool? InheritConsole { get; internal set; } /// <summary> /// Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>. /// </summary> public virtual bool? AnalyseTargetArguments { get; internal set; } /// <summary> /// Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>). /// </summary> public virtual IReadOnlyList<string> Scope => ScopeInternal.AsReadOnly(); internal List<string> ScopeInternal { get; set; } = new List<string>(); /// <summary> /// Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here. /// </summary> public virtual IReadOnlyList<string> Filters => FiltersInternal.AsReadOnly(); internal List<string> FiltersInternal { get; set; } = new List<string>(); /// <summary> /// Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here. /// </summary> public virtual IReadOnlyList<string> AttributeFilters => AttributeFiltersInternal.AsReadOnly(); internal List<string> AttributeFiltersInternal { get; set; } = new List<string>(); /// <summary> /// Disables default (automatically added) filters. /// </summary> public virtual bool? DisableDefaultFilters { get; internal set; } /// <summary> /// Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here. /// </summary> public virtual IReadOnlyList<string> SymbolSearchPaths => SymbolSearchPathsInternal.AsReadOnly(); internal List<string> SymbolSearchPathsInternal { get; set; } = new List<string>(); /// <summary> /// Allows dotCover to search for PDB files on a symbol server. /// </summary> public virtual bool? AllowSymbolServerAccess { get; internal set; } /// <summary> /// Returns the exit code of the target executable in case coverage analysis succeeded. /// </summary> public virtual bool? ReturnTargetExitCode { get; internal set; } /// <summary> /// Specifies process filters. Syntax: <c>+:process1;-:process2</c>. /// </summary> public virtual IReadOnlyList<string> ProcessFilters => ProcessFiltersInternal.AsReadOnly(); internal List<string> ProcessFiltersInternal { get; set; } = new List<string>(); /// <summary> /// Enables logging and specifies log file name. /// </summary> public virtual string LogFile { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments .Add("cover") .Add("{value}", Configuration) .Add("--TargetExecutable={value}", TargetExecutable) .Add("--Output={value}", OutputFile) .Add("--ReportType={value}", ReportType) .Add("--TargetArguments={value}", TargetArguments) .Add("--TargetWorkingDir={value}", TargetWorkingDirectory) .Add("--TempDir={value}", TempDirectory) .Add("--InheritConsole={value}", InheritConsole) .Add("--AnalyseTargetArguments={value}", AnalyseTargetArguments) .Add("--Scope={value}", Scope, separator: ';') .Add("--Filters={value}", Filters, separator: ';') .Add("--AttributeFilters={value}", AttributeFilters, separator: ';') .Add("--DisableDefaultFilters", DisableDefaultFilters) .Add("--SymbolSearchPaths={value}", SymbolSearchPaths, separator: ';') .Add("--AllowSymbolServerAccess", AllowSymbolServerAccess) .Add("--ReturnTargetExitCode", ReturnTargetExitCode) .Add("--ProcessFilters={value}", ProcessFilters, separator: ';') .Add("--LogFile={value}", LogFile); return base.ConfigureProcessArguments(arguments); } } #endregion #region DotCoverCoverDotNetSettings /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] [Serializable] public partial class DotCoverCoverDotNetSettings : ToolSettings { /// <summary> /// Path to the DotCover executable. /// </summary> public override string ProcessToolPath => base.ProcessToolPath ?? DotCoverTasks.DotCoverPath; public override Action<OutputType, string> ProcessCustomLogger => DotCoverTasks.DotCoverLogger; public virtual string Configuration { get; internal set; } /// <summary> /// Path to the resulting coverage snapshot. /// </summary> public virtual string OutputFile { get; internal set; } /// <summary> /// A type of the report. The default value is <c>XML</c>. /// </summary> public virtual DotCoverReportType ReportType { get; internal set; } /// <summary> /// Program arguments. /// </summary> public virtual string TargetArguments { get; internal set; } /// <summary> /// Program working directory. /// </summary> public virtual string TargetWorkingDirectory { get; internal set; } /// <summary> /// Directory for auxiliary files. Set to the system temp by default. /// </summary> public virtual string TempDirectory { get; internal set; } /// <summary> /// Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited. /// </summary> public virtual bool? InheritConsole { get; internal set; } /// <summary> /// Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>. /// </summary> public virtual bool? AnalyseTargetArguments { get; internal set; } /// <summary> /// Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>). /// </summary> public virtual IReadOnlyList<string> Scope => ScopeInternal.AsReadOnly(); internal List<string> ScopeInternal { get; set; } = new List<string>(); /// <summary> /// Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here. /// </summary> public virtual IReadOnlyList<string> Filters => FiltersInternal.AsReadOnly(); internal List<string> FiltersInternal { get; set; } = new List<string>(); /// <summary> /// Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here. /// </summary> public virtual IReadOnlyList<string> AttributeFilters => AttributeFiltersInternal.AsReadOnly(); internal List<string> AttributeFiltersInternal { get; set; } = new List<string>(); /// <summary> /// Disables default (automatically added) filters. /// </summary> public virtual bool? DisableDefaultFilters { get; internal set; } /// <summary> /// Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here. /// </summary> public virtual IReadOnlyList<string> SymbolSearchPaths => SymbolSearchPathsInternal.AsReadOnly(); internal List<string> SymbolSearchPathsInternal { get; set; } = new List<string>(); /// <summary> /// Allows dotCover to search for PDB files on a symbol server. /// </summary> public virtual bool? AllowSymbolServerAccess { get; internal set; } /// <summary> /// Returns the exit code of the target executable in case coverage analysis succeeded. /// </summary> public virtual bool? ReturnTargetExitCode { get; internal set; } /// <summary> /// Specifies process filters. Syntax: <c>+:process1;-:process2</c>. /// </summary> public virtual IReadOnlyList<string> ProcessFilters => ProcessFiltersInternal.AsReadOnly(); internal List<string> ProcessFiltersInternal { get; set; } = new List<string>(); /// <summary> /// Enables logging and specifies log file name. /// </summary> public virtual string LogFile { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments .Add("dotnet") .Add("{value}", Configuration) .Add("--Output={value}", OutputFile) .Add("--ReportType={value}", ReportType) .Add("--TargetArguments={value}", TargetArguments) .Add("--TargetWorkingDir={value}", TargetWorkingDirectory) .Add("--TempDir={value}", TempDirectory) .Add("--InheritConsole={value}", InheritConsole) .Add("--AnalyseTargetArguments={value}", AnalyseTargetArguments) .Add("--Scope={value}", Scope, separator: ';') .Add("--Filters={value}", Filters, separator: ';') .Add("--AttributeFilters={value}", AttributeFilters, separator: ';') .Add("--DisableDefaultFilters", DisableDefaultFilters) .Add("--SymbolSearchPaths={value}", SymbolSearchPaths, separator: ';') .Add("--AllowSymbolServerAccess", AllowSymbolServerAccess) .Add("--ReturnTargetExitCode", ReturnTargetExitCode) .Add("--ProcessFilters={value}", ProcessFilters, separator: ';') .Add("--LogFile={value}", LogFile); return base.ConfigureProcessArguments(arguments); } } #endregion #region DotCoverDeleteSettings /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] [Serializable] public partial class DotCoverDeleteSettings : ToolSettings { /// <summary> /// Path to the DotCover executable. /// </summary> public override string ProcessToolPath => base.ProcessToolPath ?? DotCoverTasks.DotCoverPath; public override Action<OutputType, string> ProcessCustomLogger => DotCoverTasks.DotCoverLogger; public virtual string Configuration { get; internal set; } /// <summary> /// List of snapshot files. /// </summary> public virtual IReadOnlyList<string> Source => SourceInternal.AsReadOnly(); internal List<string> SourceInternal { get; set; } = new List<string>(); /// <summary> /// Enables logging and specifies log file name. /// </summary> public virtual string LogFile { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments .Add("delete") .Add("{value}", Configuration) .Add("--Source={value}", Source, separator: ';') .Add("--LogFile={value}", LogFile); return base.ConfigureProcessArguments(arguments); } } #endregion #region DotCoverMergeSettings /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] [Serializable] public partial class DotCoverMergeSettings : ToolSettings { /// <summary> /// Path to the DotCover executable. /// </summary> public override string ProcessToolPath => base.ProcessToolPath ?? DotCoverTasks.DotCoverPath; public override Action<OutputType, string> ProcessCustomLogger => DotCoverTasks.DotCoverLogger; public virtual string Configuration { get; internal set; } /// <summary> /// List of snapshot files. /// </summary> public virtual IReadOnlyList<string> Source => SourceInternal.AsReadOnly(); internal List<string> SourceInternal { get; set; } = new List<string>(); /// <summary> /// File name for the merged snapshot. /// </summary> public virtual string OutputFile { get; internal set; } /// <summary> /// Directory for auxiliary files. Set to the system temp by default. /// </summary> public virtual string TempDirectory { get; internal set; } /// <summary> /// Enables logging and specifies log file name. /// </summary> public virtual string LogFile { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments .Add("merge") .Add("{value}", Configuration) .Add("--Source={value}", Source, separator: ';') .Add("--Output={value}", OutputFile) .Add("--TempDir={value}", TempDirectory) .Add("--LogFile={value}", LogFile); return base.ConfigureProcessArguments(arguments); } } #endregion #region DotCoverReportSettings /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] [Serializable] public partial class DotCoverReportSettings : ToolSettings { /// <summary> /// Path to the DotCover executable. /// </summary> public override string ProcessToolPath => base.ProcessToolPath ?? DotCoverTasks.DotCoverPath; public override Action<OutputType, string> ProcessCustomLogger => DotCoverTasks.DotCoverLogger; public virtual string Configuration { get; internal set; } /// <summary> /// List of snapshot files. /// </summary> public virtual IReadOnlyList<string> Source => SourceInternal.AsReadOnly(); internal List<string> SourceInternal { get; set; } = new List<string>(); /// <summary> /// Resulting report file name. /// </summary> public virtual string OutputFile { get; internal set; } /// <summary> /// A type of the report. The default value is <c>XML</c>. /// </summary> public virtual DotCoverReportType ReportType { get; internal set; } /// <summary> /// Remove auto-implemented properties from report. /// </summary> public virtual bool? HideAutoProperties { get; internal set; } /// <summary> /// Enables logging and specifies log file name. /// </summary> public virtual string LogFile { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments .Add("report") .Add("{value}", Configuration) .Add("--Source={value}", Source, separator: ';') .Add("--Output={value}", OutputFile) .Add("--ReportType={value}", ReportType) .Add("--HideAutoProperties", HideAutoProperties) .Add("--LogFile={value}", LogFile); return base.ConfigureProcessArguments(arguments); } } #endregion #region DotCoverZipSettings /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] [Serializable] public partial class DotCoverZipSettings : ToolSettings { /// <summary> /// Path to the DotCover executable. /// </summary> public override string ProcessToolPath => base.ProcessToolPath ?? DotCoverTasks.DotCoverPath; public override Action<OutputType, string> ProcessCustomLogger => DotCoverTasks.DotCoverLogger; public virtual string Configuration { get; internal set; } /// <summary> /// Coverage snapshot file name. /// </summary> public virtual string Source { get; internal set; } /// <summary> /// Zipped snapshot file name. /// </summary> public virtual string OutputFile { get; internal set; } /// <summary> /// Enables logging and specifies log file name. /// </summary> public virtual string LogFile { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments .Add("zip") .Add("{value}", Configuration) .Add("--Source={value}", Source) .Add("--Output={value}", OutputFile) .Add("--LogFile={value}", LogFile); return base.ConfigureProcessArguments(arguments); } } #endregion #region DotCoverAnalyseSettingsExtensions /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DotCoverAnalyseSettingsExtensions { #region Configuration /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.Configuration"/></em></p> /// </summary> [Pure] public static T SetConfiguration<T>(this T toolSettings, string configuration) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = configuration; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.Configuration"/></em></p> /// </summary> [Pure] public static T ResetConfiguration<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = null; return toolSettings; } #endregion #region TargetExecutable /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.TargetExecutable"/></em></p> /// <p>File name of the program to analyse.</p> /// </summary> [Pure] public static T SetTargetExecutable<T>(this T toolSettings, string targetExecutable) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetExecutable = targetExecutable; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.TargetExecutable"/></em></p> /// <p>File name of the program to analyse.</p> /// </summary> [Pure] public static T ResetTargetExecutable<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetExecutable = null; return toolSettings; } #endregion #region ReportType /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.ReportType"/></em></p> /// <p>A type of the report. The default value is <c>XML</c>.</p> /// </summary> [Pure] public static T SetReportType<T>(this T toolSettings, DotCoverReportType reportType) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReportType = reportType; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.ReportType"/></em></p> /// <p>A type of the report. The default value is <c>XML</c>.</p> /// </summary> [Pure] public static T ResetReportType<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReportType = null; return toolSettings; } #endregion #region OutputFile /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.OutputFile"/></em></p> /// <p>Resulting report file name.</p> /// </summary> [Pure] public static T SetOutputFile<T>(this T toolSettings, string outputFile) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = outputFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.OutputFile"/></em></p> /// <p>Resulting report file name.</p> /// </summary> [Pure] public static T ResetOutputFile<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = null; return toolSettings; } #endregion #region HideAutoProperties /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T SetHideAutoProperties<T>(this T toolSettings, bool? hideAutoProperties) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = hideAutoProperties; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T ResetHideAutoProperties<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverAnalyseSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T EnableHideAutoProperties<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverAnalyseSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T DisableHideAutoProperties<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverAnalyseSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T ToggleHideAutoProperties<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = !toolSettings.HideAutoProperties; return toolSettings; } #endregion #region TargetArguments /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.TargetArguments"/></em></p> /// <p>Program arguments.</p> /// </summary> [Pure] public static T SetTargetArguments<T>(this T toolSettings, string targetArguments) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetArguments = targetArguments; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.TargetArguments"/></em></p> /// <p>Program arguments.</p> /// </summary> [Pure] public static T ResetTargetArguments<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetArguments = null; return toolSettings; } #endregion #region TargetWorkingDirectory /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.TargetWorkingDirectory"/></em></p> /// <p>Program working directory.</p> /// </summary> [Pure] public static T SetTargetWorkingDirectory<T>(this T toolSettings, string targetWorkingDirectory) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetWorkingDirectory = targetWorkingDirectory; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.TargetWorkingDirectory"/></em></p> /// <p>Program working directory.</p> /// </summary> [Pure] public static T ResetTargetWorkingDirectory<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetWorkingDirectory = null; return toolSettings; } #endregion #region TempDirectory /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.TempDirectory"/></em></p> /// <p>Directory for auxiliary files. Set to the system temp by default.</p> /// </summary> [Pure] public static T SetTempDirectory<T>(this T toolSettings, string tempDirectory) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TempDirectory = tempDirectory; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.TempDirectory"/></em></p> /// <p>Directory for auxiliary files. Set to the system temp by default.</p> /// </summary> [Pure] public static T ResetTempDirectory<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TempDirectory = null; return toolSettings; } #endregion #region InheritConsole /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T SetInheritConsole<T>(this T toolSettings, bool? inheritConsole) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = inheritConsole; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T ResetInheritConsole<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverAnalyseSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T EnableInheritConsole<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverAnalyseSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T DisableInheritConsole<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverAnalyseSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T ToggleInheritConsole<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = !toolSettings.InheritConsole; return toolSettings; } #endregion #region AnalyseTargetArguments /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T SetAnalyseTargetArguments<T>(this T toolSettings, bool? analyseTargetArguments) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = analyseTargetArguments; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T ResetAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverAnalyseSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T EnableAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverAnalyseSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T DisableAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverAnalyseSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T ToggleAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = !toolSettings.AnalyseTargetArguments; return toolSettings; } #endregion #region Scope /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.Scope"/> to a new list</em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T SetScope<T>(this T toolSettings, params string[] scope) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal = scope.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.Scope"/> to a new list</em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T SetScope<T>(this T toolSettings, IEnumerable<string> scope) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal = scope.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T AddScope<T>(this T toolSettings, params string[] scope) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal.AddRange(scope); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T AddScope<T>(this T toolSettings, IEnumerable<string> scope) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal.AddRange(scope); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverAnalyseSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T ClearScope<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T RemoveScope<T>(this T toolSettings, params string[] scope) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(scope); toolSettings.ScopeInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T RemoveScope<T>(this T toolSettings, IEnumerable<string> scope) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(scope); toolSettings.ScopeInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region Filters /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.Filters"/> to a new list</em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetFilters<T>(this T toolSettings, params string[] filters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal = filters.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.Filters"/> to a new list</em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetFilters<T>(this T toolSettings, IEnumerable<string> filters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal = filters.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddFilters<T>(this T toolSettings, params string[] filters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal.AddRange(filters); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddFilters<T>(this T toolSettings, IEnumerable<string> filters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal.AddRange(filters); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverAnalyseSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T ClearFilters<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveFilters<T>(this T toolSettings, params string[] filters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(filters); toolSettings.FiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveFilters<T>(this T toolSettings, IEnumerable<string> filters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(filters); toolSettings.FiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region AttributeFilters /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.AttributeFilters"/> to a new list</em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetAttributeFilters<T>(this T toolSettings, params string[] attributeFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal = attributeFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.AttributeFilters"/> to a new list</em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetAttributeFilters<T>(this T toolSettings, IEnumerable<string> attributeFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal = attributeFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddAttributeFilters<T>(this T toolSettings, params string[] attributeFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal.AddRange(attributeFilters); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddAttributeFilters<T>(this T toolSettings, IEnumerable<string> attributeFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal.AddRange(attributeFilters); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverAnalyseSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T ClearAttributeFilters<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveAttributeFilters<T>(this T toolSettings, params string[] attributeFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(attributeFilters); toolSettings.AttributeFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveAttributeFilters<T>(this T toolSettings, IEnumerable<string> attributeFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(attributeFilters); toolSettings.AttributeFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region DisableDefaultFilters /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T SetDisableDefaultFilters<T>(this T toolSettings, bool? disableDefaultFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = disableDefaultFilters; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T ResetDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverAnalyseSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T EnableDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverAnalyseSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T DisableDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverAnalyseSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T ToggleDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = !toolSettings.DisableDefaultFilters; return toolSettings; } #endregion #region SymbolSearchPaths /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/> to a new list</em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T SetSymbolSearchPaths<T>(this T toolSettings, params string[] symbolSearchPaths) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal = symbolSearchPaths.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/> to a new list</em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T SetSymbolSearchPaths<T>(this T toolSettings, IEnumerable<string> symbolSearchPaths) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal = symbolSearchPaths.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T AddSymbolSearchPaths<T>(this T toolSettings, params string[] symbolSearchPaths) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal.AddRange(symbolSearchPaths); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T AddSymbolSearchPaths<T>(this T toolSettings, IEnumerable<string> symbolSearchPaths) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal.AddRange(symbolSearchPaths); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T ClearSymbolSearchPaths<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T RemoveSymbolSearchPaths<T>(this T toolSettings, params string[] symbolSearchPaths) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(symbolSearchPaths); toolSettings.SymbolSearchPathsInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T RemoveSymbolSearchPaths<T>(this T toolSettings, IEnumerable<string> symbolSearchPaths) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(symbolSearchPaths); toolSettings.SymbolSearchPathsInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region AllowSymbolServerAccess /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T SetAllowSymbolServerAccess<T>(this T toolSettings, bool? allowSymbolServerAccess) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = allowSymbolServerAccess; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T ResetAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverAnalyseSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T EnableAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverAnalyseSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T DisableAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverAnalyseSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T ToggleAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = !toolSettings.AllowSymbolServerAccess; return toolSettings; } #endregion #region ReturnTargetExitCode /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T SetReturnTargetExitCode<T>(this T toolSettings, bool? returnTargetExitCode) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = returnTargetExitCode; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T ResetReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverAnalyseSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T EnableReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverAnalyseSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T DisableReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverAnalyseSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T ToggleReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = !toolSettings.ReturnTargetExitCode; return toolSettings; } #endregion #region ProcessFilters /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.ProcessFilters"/> to a new list</em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T SetProcessFilters<T>(this T toolSettings, params string[] processFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal = processFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.ProcessFilters"/> to a new list</em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T SetProcessFilters<T>(this T toolSettings, IEnumerable<string> processFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal = processFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T AddProcessFilters<T>(this T toolSettings, params string[] processFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal.AddRange(processFilters); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverAnalyseSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T AddProcessFilters<T>(this T toolSettings, IEnumerable<string> processFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal.AddRange(processFilters); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverAnalyseSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T ClearProcessFilters<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T RemoveProcessFilters<T>(this T toolSettings, params string[] processFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(processFilters); toolSettings.ProcessFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverAnalyseSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T RemoveProcessFilters<T>(this T toolSettings, IEnumerable<string> processFilters) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(processFilters); toolSettings.ProcessFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region LogFile /// <summary> /// <p><em>Sets <see cref="DotCoverAnalyseSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T SetLogFile<T>(this T toolSettings, string logFile) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = logFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverAnalyseSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T ResetLogFile<T>(this T toolSettings) where T : DotCoverAnalyseSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = null; return toolSettings; } #endregion } #endregion #region DotCoverCoverSettingsExtensions /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DotCoverCoverSettingsExtensions { #region Configuration /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.Configuration"/></em></p> /// </summary> [Pure] public static T SetConfiguration<T>(this T toolSettings, string configuration) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = configuration; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.Configuration"/></em></p> /// </summary> [Pure] public static T ResetConfiguration<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = null; return toolSettings; } #endregion #region TargetExecutable /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.TargetExecutable"/></em></p> /// <p>File name of the program to analyse.</p> /// </summary> [Pure] public static T SetTargetExecutable<T>(this T toolSettings, string targetExecutable) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetExecutable = targetExecutable; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.TargetExecutable"/></em></p> /// <p>File name of the program to analyse.</p> /// </summary> [Pure] public static T ResetTargetExecutable<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetExecutable = null; return toolSettings; } #endregion #region OutputFile /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.OutputFile"/></em></p> /// <p>Path to the resulting coverage snapshot.</p> /// </summary> [Pure] public static T SetOutputFile<T>(this T toolSettings, string outputFile) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = outputFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.OutputFile"/></em></p> /// <p>Path to the resulting coverage snapshot.</p> /// </summary> [Pure] public static T ResetOutputFile<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = null; return toolSettings; } #endregion #region ReportType /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.ReportType"/></em></p> /// <p>A type of the report. The default value is <c>XML</c>.</p> /// </summary> [Pure] public static T SetReportType<T>(this T toolSettings, DotCoverReportType reportType) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReportType = reportType; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.ReportType"/></em></p> /// <p>A type of the report. The default value is <c>XML</c>.</p> /// </summary> [Pure] public static T ResetReportType<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReportType = null; return toolSettings; } #endregion #region TargetArguments /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.TargetArguments"/></em></p> /// <p>Program arguments.</p> /// </summary> [Pure] public static T SetTargetArguments<T>(this T toolSettings, string targetArguments) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetArguments = targetArguments; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.TargetArguments"/></em></p> /// <p>Program arguments.</p> /// </summary> [Pure] public static T ResetTargetArguments<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetArguments = null; return toolSettings; } #endregion #region TargetWorkingDirectory /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.TargetWorkingDirectory"/></em></p> /// <p>Program working directory.</p> /// </summary> [Pure] public static T SetTargetWorkingDirectory<T>(this T toolSettings, string targetWorkingDirectory) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetWorkingDirectory = targetWorkingDirectory; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.TargetWorkingDirectory"/></em></p> /// <p>Program working directory.</p> /// </summary> [Pure] public static T ResetTargetWorkingDirectory<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetWorkingDirectory = null; return toolSettings; } #endregion #region TempDirectory /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.TempDirectory"/></em></p> /// <p>Directory for auxiliary files. Set to the system temp by default.</p> /// </summary> [Pure] public static T SetTempDirectory<T>(this T toolSettings, string tempDirectory) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TempDirectory = tempDirectory; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.TempDirectory"/></em></p> /// <p>Directory for auxiliary files. Set to the system temp by default.</p> /// </summary> [Pure] public static T ResetTempDirectory<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TempDirectory = null; return toolSettings; } #endregion #region InheritConsole /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T SetInheritConsole<T>(this T toolSettings, bool? inheritConsole) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = inheritConsole; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T ResetInheritConsole<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T EnableInheritConsole<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T DisableInheritConsole<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T ToggleInheritConsole<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = !toolSettings.InheritConsole; return toolSettings; } #endregion #region AnalyseTargetArguments /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T SetAnalyseTargetArguments<T>(this T toolSettings, bool? analyseTargetArguments) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = analyseTargetArguments; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T ResetAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T EnableAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T DisableAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T ToggleAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = !toolSettings.AnalyseTargetArguments; return toolSettings; } #endregion #region Scope /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.Scope"/> to a new list</em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T SetScope<T>(this T toolSettings, params string[] scope) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal = scope.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.Scope"/> to a new list</em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T SetScope<T>(this T toolSettings, IEnumerable<string> scope) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal = scope.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T AddScope<T>(this T toolSettings, params string[] scope) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal.AddRange(scope); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T AddScope<T>(this T toolSettings, IEnumerable<string> scope) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal.AddRange(scope); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T ClearScope<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T RemoveScope<T>(this T toolSettings, params string[] scope) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(scope); toolSettings.ScopeInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T RemoveScope<T>(this T toolSettings, IEnumerable<string> scope) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(scope); toolSettings.ScopeInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region Filters /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.Filters"/> to a new list</em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetFilters<T>(this T toolSettings, params string[] filters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal = filters.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.Filters"/> to a new list</em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetFilters<T>(this T toolSettings, IEnumerable<string> filters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal = filters.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddFilters<T>(this T toolSettings, params string[] filters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal.AddRange(filters); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddFilters<T>(this T toolSettings, IEnumerable<string> filters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal.AddRange(filters); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T ClearFilters<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveFilters<T>(this T toolSettings, params string[] filters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(filters); toolSettings.FiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveFilters<T>(this T toolSettings, IEnumerable<string> filters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(filters); toolSettings.FiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region AttributeFilters /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.AttributeFilters"/> to a new list</em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetAttributeFilters<T>(this T toolSettings, params string[] attributeFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal = attributeFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.AttributeFilters"/> to a new list</em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetAttributeFilters<T>(this T toolSettings, IEnumerable<string> attributeFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal = attributeFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddAttributeFilters<T>(this T toolSettings, params string[] attributeFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal.AddRange(attributeFilters); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddAttributeFilters<T>(this T toolSettings, IEnumerable<string> attributeFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal.AddRange(attributeFilters); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T ClearAttributeFilters<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveAttributeFilters<T>(this T toolSettings, params string[] attributeFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(attributeFilters); toolSettings.AttributeFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveAttributeFilters<T>(this T toolSettings, IEnumerable<string> attributeFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(attributeFilters); toolSettings.AttributeFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region DisableDefaultFilters /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T SetDisableDefaultFilters<T>(this T toolSettings, bool? disableDefaultFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = disableDefaultFilters; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T ResetDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T EnableDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T DisableDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T ToggleDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = !toolSettings.DisableDefaultFilters; return toolSettings; } #endregion #region SymbolSearchPaths /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.SymbolSearchPaths"/> to a new list</em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T SetSymbolSearchPaths<T>(this T toolSettings, params string[] symbolSearchPaths) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal = symbolSearchPaths.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.SymbolSearchPaths"/> to a new list</em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T SetSymbolSearchPaths<T>(this T toolSettings, IEnumerable<string> symbolSearchPaths) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal = symbolSearchPaths.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T AddSymbolSearchPaths<T>(this T toolSettings, params string[] symbolSearchPaths) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal.AddRange(symbolSearchPaths); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T AddSymbolSearchPaths<T>(this T toolSettings, IEnumerable<string> symbolSearchPaths) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal.AddRange(symbolSearchPaths); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T ClearSymbolSearchPaths<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T RemoveSymbolSearchPaths<T>(this T toolSettings, params string[] symbolSearchPaths) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(symbolSearchPaths); toolSettings.SymbolSearchPathsInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T RemoveSymbolSearchPaths<T>(this T toolSettings, IEnumerable<string> symbolSearchPaths) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(symbolSearchPaths); toolSettings.SymbolSearchPathsInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region AllowSymbolServerAccess /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T SetAllowSymbolServerAccess<T>(this T toolSettings, bool? allowSymbolServerAccess) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = allowSymbolServerAccess; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T ResetAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T EnableAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T DisableAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T ToggleAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = !toolSettings.AllowSymbolServerAccess; return toolSettings; } #endregion #region ReturnTargetExitCode /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T SetReturnTargetExitCode<T>(this T toolSettings, bool? returnTargetExitCode) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = returnTargetExitCode; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T ResetReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T EnableReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T DisableReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T ToggleReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = !toolSettings.ReturnTargetExitCode; return toolSettings; } #endregion #region ProcessFilters /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.ProcessFilters"/> to a new list</em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T SetProcessFilters<T>(this T toolSettings, params string[] processFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal = processFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.ProcessFilters"/> to a new list</em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T SetProcessFilters<T>(this T toolSettings, IEnumerable<string> processFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal = processFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T AddProcessFilters<T>(this T toolSettings, params string[] processFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal.AddRange(processFilters); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T AddProcessFilters<T>(this T toolSettings, IEnumerable<string> processFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal.AddRange(processFilters); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T ClearProcessFilters<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T RemoveProcessFilters<T>(this T toolSettings, params string[] processFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(processFilters); toolSettings.ProcessFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T RemoveProcessFilters<T>(this T toolSettings, IEnumerable<string> processFilters) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(processFilters); toolSettings.ProcessFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region LogFile /// <summary> /// <p><em>Sets <see cref="DotCoverCoverSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T SetLogFile<T>(this T toolSettings, string logFile) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = logFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T ResetLogFile<T>(this T toolSettings) where T : DotCoverCoverSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = null; return toolSettings; } #endregion } #endregion #region DotCoverCoverDotNetSettingsExtensions /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DotCoverCoverDotNetSettingsExtensions { #region Configuration /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.Configuration"/></em></p> /// </summary> [Pure] public static T SetConfiguration<T>(this T toolSettings, string configuration) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = configuration; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.Configuration"/></em></p> /// </summary> [Pure] public static T ResetConfiguration<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = null; return toolSettings; } #endregion #region OutputFile /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.OutputFile"/></em></p> /// <p>Path to the resulting coverage snapshot.</p> /// </summary> [Pure] public static T SetOutputFile<T>(this T toolSettings, string outputFile) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = outputFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.OutputFile"/></em></p> /// <p>Path to the resulting coverage snapshot.</p> /// </summary> [Pure] public static T ResetOutputFile<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = null; return toolSettings; } #endregion #region ReportType /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.ReportType"/></em></p> /// <p>A type of the report. The default value is <c>XML</c>.</p> /// </summary> [Pure] public static T SetReportType<T>(this T toolSettings, DotCoverReportType reportType) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReportType = reportType; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.ReportType"/></em></p> /// <p>A type of the report. The default value is <c>XML</c>.</p> /// </summary> [Pure] public static T ResetReportType<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReportType = null; return toolSettings; } #endregion #region TargetArguments /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.TargetArguments"/></em></p> /// <p>Program arguments.</p> /// </summary> [Pure] public static T SetTargetArguments<T>(this T toolSettings, string targetArguments) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetArguments = targetArguments; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.TargetArguments"/></em></p> /// <p>Program arguments.</p> /// </summary> [Pure] public static T ResetTargetArguments<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetArguments = null; return toolSettings; } #endregion #region TargetWorkingDirectory /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.TargetWorkingDirectory"/></em></p> /// <p>Program working directory.</p> /// </summary> [Pure] public static T SetTargetWorkingDirectory<T>(this T toolSettings, string targetWorkingDirectory) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetWorkingDirectory = targetWorkingDirectory; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.TargetWorkingDirectory"/></em></p> /// <p>Program working directory.</p> /// </summary> [Pure] public static T ResetTargetWorkingDirectory<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TargetWorkingDirectory = null; return toolSettings; } #endregion #region TempDirectory /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.TempDirectory"/></em></p> /// <p>Directory for auxiliary files. Set to the system temp by default.</p> /// </summary> [Pure] public static T SetTempDirectory<T>(this T toolSettings, string tempDirectory) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TempDirectory = tempDirectory; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.TempDirectory"/></em></p> /// <p>Directory for auxiliary files. Set to the system temp by default.</p> /// </summary> [Pure] public static T ResetTempDirectory<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TempDirectory = null; return toolSettings; } #endregion #region InheritConsole /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T SetInheritConsole<T>(this T toolSettings, bool? inheritConsole) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = inheritConsole; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T ResetInheritConsole<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverDotNetSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T EnableInheritConsole<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverDotNetSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T DisableInheritConsole<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverDotNetSettings.InheritConsole"/></em></p> /// <p>Lets the analysed application inherit dotCover console. The default is <c>true</c>. Please note that windows of the analysed GUI application will not be hidden if the console is inherited.</p> /// </summary> [Pure] public static T ToggleInheritConsole<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.InheritConsole = !toolSettings.InheritConsole; return toolSettings; } #endregion #region AnalyseTargetArguments /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T SetAnalyseTargetArguments<T>(this T toolSettings, bool? analyseTargetArguments) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = analyseTargetArguments; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T ResetAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverDotNetSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T EnableAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverDotNetSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T DisableAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverDotNetSettings.AnalyseTargetArguments"/></em></p> /// <p>Specifies whether dotCover should analyse the 'target arguments' string and convert relative paths to absolute ones. The default is <c>true</c>.</p> /// </summary> [Pure] public static T ToggleAnalyseTargetArguments<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AnalyseTargetArguments = !toolSettings.AnalyseTargetArguments; return toolSettings; } #endregion #region Scope /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.Scope"/> to a new list</em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T SetScope<T>(this T toolSettings, params string[] scope) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal = scope.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.Scope"/> to a new list</em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T SetScope<T>(this T toolSettings, IEnumerable<string> scope) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal = scope.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T AddScope<T>(this T toolSettings, params string[] scope) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal.AddRange(scope); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T AddScope<T>(this T toolSettings, IEnumerable<string> scope) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal.AddRange(scope); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverDotNetSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T ClearScope<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ScopeInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T RemoveScope<T>(this T toolSettings, params string[] scope) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(scope); toolSettings.ScopeInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.Scope"/></em></p> /// <p>Allows including assemblies that were not loaded in the specified scope into coverage results. Ant-style patterns are supported here (e.g. <c>ProjectFolder/**/*.dll</c>).</p> /// </summary> [Pure] public static T RemoveScope<T>(this T toolSettings, IEnumerable<string> scope) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(scope); toolSettings.ScopeInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region Filters /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.Filters"/> to a new list</em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetFilters<T>(this T toolSettings, params string[] filters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal = filters.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.Filters"/> to a new list</em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetFilters<T>(this T toolSettings, IEnumerable<string> filters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal = filters.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddFilters<T>(this T toolSettings, params string[] filters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal.AddRange(filters); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddFilters<T>(this T toolSettings, IEnumerable<string> filters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal.AddRange(filters); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverDotNetSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T ClearFilters<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.FiltersInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveFilters<T>(this T toolSettings, params string[] filters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(filters); toolSettings.FiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.Filters"/></em></p> /// <p>Specifies coverage filters using the following syntax: <c>+:module=*;class=*;function=*;</c>. Use <c>-:myassembly</c> to exclude an assembly from code coverage. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveFilters<T>(this T toolSettings, IEnumerable<string> filters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(filters); toolSettings.FiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region AttributeFilters /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/> to a new list</em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetAttributeFilters<T>(this T toolSettings, params string[] attributeFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal = attributeFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/> to a new list</em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T SetAttributeFilters<T>(this T toolSettings, IEnumerable<string> attributeFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal = attributeFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddAttributeFilters<T>(this T toolSettings, params string[] attributeFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal.AddRange(attributeFilters); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T AddAttributeFilters<T>(this T toolSettings, IEnumerable<string> attributeFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal.AddRange(attributeFilters); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T ClearAttributeFilters<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AttributeFiltersInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveAttributeFilters<T>(this T toolSettings, params string[] attributeFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(attributeFilters); toolSettings.AttributeFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.AttributeFilters"/></em></p> /// <p>Specifies attribute filters using the following syntax: <c>filter1;filter2;...</c>. Asterisk wildcard (*) is supported here.</p> /// </summary> [Pure] public static T RemoveAttributeFilters<T>(this T toolSettings, IEnumerable<string> attributeFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(attributeFilters); toolSettings.AttributeFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region DisableDefaultFilters /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T SetDisableDefaultFilters<T>(this T toolSettings, bool? disableDefaultFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = disableDefaultFilters; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T ResetDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverDotNetSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T EnableDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverDotNetSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T DisableDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverDotNetSettings.DisableDefaultFilters"/></em></p> /// <p>Disables default (automatically added) filters.</p> /// </summary> [Pure] public static T ToggleDisableDefaultFilters<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.DisableDefaultFilters = !toolSettings.DisableDefaultFilters; return toolSettings; } #endregion #region SymbolSearchPaths /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/> to a new list</em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T SetSymbolSearchPaths<T>(this T toolSettings, params string[] symbolSearchPaths) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal = symbolSearchPaths.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/> to a new list</em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T SetSymbolSearchPaths<T>(this T toolSettings, IEnumerable<string> symbolSearchPaths) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal = symbolSearchPaths.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T AddSymbolSearchPaths<T>(this T toolSettings, params string[] symbolSearchPaths) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal.AddRange(symbolSearchPaths); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T AddSymbolSearchPaths<T>(this T toolSettings, IEnumerable<string> symbolSearchPaths) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal.AddRange(symbolSearchPaths); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T ClearSymbolSearchPaths<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SymbolSearchPathsInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T RemoveSymbolSearchPaths<T>(this T toolSettings, params string[] symbolSearchPaths) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(symbolSearchPaths); toolSettings.SymbolSearchPathsInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.SymbolSearchPaths"/></em></p> /// <p>Specifies additional symbol search paths. Paths to symbol servers (starting with <em>srv*</em> prefix) are supported here.</p> /// </summary> [Pure] public static T RemoveSymbolSearchPaths<T>(this T toolSettings, IEnumerable<string> symbolSearchPaths) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(symbolSearchPaths); toolSettings.SymbolSearchPathsInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region AllowSymbolServerAccess /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T SetAllowSymbolServerAccess<T>(this T toolSettings, bool? allowSymbolServerAccess) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = allowSymbolServerAccess; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T ResetAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverDotNetSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T EnableAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverDotNetSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T DisableAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverDotNetSettings.AllowSymbolServerAccess"/></em></p> /// <p>Allows dotCover to search for PDB files on a symbol server.</p> /// </summary> [Pure] public static T ToggleAllowSymbolServerAccess<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.AllowSymbolServerAccess = !toolSettings.AllowSymbolServerAccess; return toolSettings; } #endregion #region ReturnTargetExitCode /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T SetReturnTargetExitCode<T>(this T toolSettings, bool? returnTargetExitCode) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = returnTargetExitCode; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T ResetReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverCoverDotNetSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T EnableReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverCoverDotNetSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T DisableReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverCoverDotNetSettings.ReturnTargetExitCode"/></em></p> /// <p>Returns the exit code of the target executable in case coverage analysis succeeded.</p> /// </summary> [Pure] public static T ToggleReturnTargetExitCode<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReturnTargetExitCode = !toolSettings.ReturnTargetExitCode; return toolSettings; } #endregion #region ProcessFilters /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/> to a new list</em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T SetProcessFilters<T>(this T toolSettings, params string[] processFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal = processFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/> to a new list</em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T SetProcessFilters<T>(this T toolSettings, IEnumerable<string> processFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal = processFilters.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T AddProcessFilters<T>(this T toolSettings, params string[] processFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal.AddRange(processFilters); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T AddProcessFilters<T>(this T toolSettings, IEnumerable<string> processFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal.AddRange(processFilters); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T ClearProcessFilters<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ProcessFiltersInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T RemoveProcessFilters<T>(this T toolSettings, params string[] processFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(processFilters); toolSettings.ProcessFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverCoverDotNetSettings.ProcessFilters"/></em></p> /// <p>Specifies process filters. Syntax: <c>+:process1;-:process2</c>.</p> /// </summary> [Pure] public static T RemoveProcessFilters<T>(this T toolSettings, IEnumerable<string> processFilters) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(processFilters); toolSettings.ProcessFiltersInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region LogFile /// <summary> /// <p><em>Sets <see cref="DotCoverCoverDotNetSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T SetLogFile<T>(this T toolSettings, string logFile) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = logFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverCoverDotNetSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T ResetLogFile<T>(this T toolSettings) where T : DotCoverCoverDotNetSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = null; return toolSettings; } #endregion } #endregion #region DotCoverDeleteSettingsExtensions /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DotCoverDeleteSettingsExtensions { #region Configuration /// <summary> /// <p><em>Sets <see cref="DotCoverDeleteSettings.Configuration"/></em></p> /// </summary> [Pure] public static T SetConfiguration<T>(this T toolSettings, string configuration) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = configuration; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverDeleteSettings.Configuration"/></em></p> /// </summary> [Pure] public static T ResetConfiguration<T>(this T toolSettings) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = null; return toolSettings; } #endregion #region Source /// <summary> /// <p><em>Sets <see cref="DotCoverDeleteSettings.Source"/> to a new list</em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T SetSource<T>(this T toolSettings, params string[] source) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal = source.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverDeleteSettings.Source"/> to a new list</em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T SetSource<T>(this T toolSettings, IEnumerable<string> source) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal = source.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverDeleteSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T AddSource<T>(this T toolSettings, params string[] source) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal.AddRange(source); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverDeleteSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T AddSource<T>(this T toolSettings, IEnumerable<string> source) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal.AddRange(source); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverDeleteSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T ClearSource<T>(this T toolSettings) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverDeleteSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T RemoveSource<T>(this T toolSettings, params string[] source) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(source); toolSettings.SourceInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverDeleteSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T RemoveSource<T>(this T toolSettings, IEnumerable<string> source) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(source); toolSettings.SourceInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region LogFile /// <summary> /// <p><em>Sets <see cref="DotCoverDeleteSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T SetLogFile<T>(this T toolSettings, string logFile) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = logFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverDeleteSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T ResetLogFile<T>(this T toolSettings) where T : DotCoverDeleteSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = null; return toolSettings; } #endregion } #endregion #region DotCoverMergeSettingsExtensions /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DotCoverMergeSettingsExtensions { #region Configuration /// <summary> /// <p><em>Sets <see cref="DotCoverMergeSettings.Configuration"/></em></p> /// </summary> [Pure] public static T SetConfiguration<T>(this T toolSettings, string configuration) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = configuration; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverMergeSettings.Configuration"/></em></p> /// </summary> [Pure] public static T ResetConfiguration<T>(this T toolSettings) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = null; return toolSettings; } #endregion #region Source /// <summary> /// <p><em>Sets <see cref="DotCoverMergeSettings.Source"/> to a new list</em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T SetSource<T>(this T toolSettings, params string[] source) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal = source.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverMergeSettings.Source"/> to a new list</em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T SetSource<T>(this T toolSettings, IEnumerable<string> source) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal = source.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverMergeSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T AddSource<T>(this T toolSettings, params string[] source) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal.AddRange(source); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverMergeSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T AddSource<T>(this T toolSettings, IEnumerable<string> source) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal.AddRange(source); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverMergeSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T ClearSource<T>(this T toolSettings) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverMergeSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T RemoveSource<T>(this T toolSettings, params string[] source) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(source); toolSettings.SourceInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverMergeSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T RemoveSource<T>(this T toolSettings, IEnumerable<string> source) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(source); toolSettings.SourceInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region OutputFile /// <summary> /// <p><em>Sets <see cref="DotCoverMergeSettings.OutputFile"/></em></p> /// <p>File name for the merged snapshot.</p> /// </summary> [Pure] public static T SetOutputFile<T>(this T toolSettings, string outputFile) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = outputFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverMergeSettings.OutputFile"/></em></p> /// <p>File name for the merged snapshot.</p> /// </summary> [Pure] public static T ResetOutputFile<T>(this T toolSettings) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = null; return toolSettings; } #endregion #region TempDirectory /// <summary> /// <p><em>Sets <see cref="DotCoverMergeSettings.TempDirectory"/></em></p> /// <p>Directory for auxiliary files. Set to the system temp by default.</p> /// </summary> [Pure] public static T SetTempDirectory<T>(this T toolSettings, string tempDirectory) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TempDirectory = tempDirectory; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverMergeSettings.TempDirectory"/></em></p> /// <p>Directory for auxiliary files. Set to the system temp by default.</p> /// </summary> [Pure] public static T ResetTempDirectory<T>(this T toolSettings) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.TempDirectory = null; return toolSettings; } #endregion #region LogFile /// <summary> /// <p><em>Sets <see cref="DotCoverMergeSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T SetLogFile<T>(this T toolSettings, string logFile) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = logFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverMergeSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T ResetLogFile<T>(this T toolSettings) where T : DotCoverMergeSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = null; return toolSettings; } #endregion } #endregion #region DotCoverReportSettingsExtensions /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DotCoverReportSettingsExtensions { #region Configuration /// <summary> /// <p><em>Sets <see cref="DotCoverReportSettings.Configuration"/></em></p> /// </summary> [Pure] public static T SetConfiguration<T>(this T toolSettings, string configuration) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = configuration; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverReportSettings.Configuration"/></em></p> /// </summary> [Pure] public static T ResetConfiguration<T>(this T toolSettings) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = null; return toolSettings; } #endregion #region Source /// <summary> /// <p><em>Sets <see cref="DotCoverReportSettings.Source"/> to a new list</em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T SetSource<T>(this T toolSettings, params string[] source) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal = source.ToList(); return toolSettings; } /// <summary> /// <p><em>Sets <see cref="DotCoverReportSettings.Source"/> to a new list</em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T SetSource<T>(this T toolSettings, IEnumerable<string> source) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal = source.ToList(); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverReportSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T AddSource<T>(this T toolSettings, params string[] source) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal.AddRange(source); return toolSettings; } /// <summary> /// <p><em>Adds values to <see cref="DotCoverReportSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T AddSource<T>(this T toolSettings, IEnumerable<string> source) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal.AddRange(source); return toolSettings; } /// <summary> /// <p><em>Clears <see cref="DotCoverReportSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T ClearSource<T>(this T toolSettings) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.SourceInternal.Clear(); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverReportSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T RemoveSource<T>(this T toolSettings, params string[] source) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(source); toolSettings.SourceInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } /// <summary> /// <p><em>Removes values from <see cref="DotCoverReportSettings.Source"/></em></p> /// <p>List of snapshot files.</p> /// </summary> [Pure] public static T RemoveSource<T>(this T toolSettings, IEnumerable<string> source) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); var hashSet = new HashSet<string>(source); toolSettings.SourceInternal.RemoveAll(x => hashSet.Contains(x)); return toolSettings; } #endregion #region OutputFile /// <summary> /// <p><em>Sets <see cref="DotCoverReportSettings.OutputFile"/></em></p> /// <p>Resulting report file name.</p> /// </summary> [Pure] public static T SetOutputFile<T>(this T toolSettings, string outputFile) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = outputFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverReportSettings.OutputFile"/></em></p> /// <p>Resulting report file name.</p> /// </summary> [Pure] public static T ResetOutputFile<T>(this T toolSettings) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = null; return toolSettings; } #endregion #region ReportType /// <summary> /// <p><em>Sets <see cref="DotCoverReportSettings.ReportType"/></em></p> /// <p>A type of the report. The default value is <c>XML</c>.</p> /// </summary> [Pure] public static T SetReportType<T>(this T toolSettings, DotCoverReportType reportType) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReportType = reportType; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverReportSettings.ReportType"/></em></p> /// <p>A type of the report. The default value is <c>XML</c>.</p> /// </summary> [Pure] public static T ResetReportType<T>(this T toolSettings) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.ReportType = null; return toolSettings; } #endregion #region HideAutoProperties /// <summary> /// <p><em>Sets <see cref="DotCoverReportSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T SetHideAutoProperties<T>(this T toolSettings, bool? hideAutoProperties) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = hideAutoProperties; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverReportSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T ResetHideAutoProperties<T>(this T toolSettings) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = null; return toolSettings; } /// <summary> /// <p><em>Enables <see cref="DotCoverReportSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T EnableHideAutoProperties<T>(this T toolSettings) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = true; return toolSettings; } /// <summary> /// <p><em>Disables <see cref="DotCoverReportSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T DisableHideAutoProperties<T>(this T toolSettings) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = false; return toolSettings; } /// <summary> /// <p><em>Toggles <see cref="DotCoverReportSettings.HideAutoProperties"/></em></p> /// <p>Remove auto-implemented properties from report.</p> /// </summary> [Pure] public static T ToggleHideAutoProperties<T>(this T toolSettings) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.HideAutoProperties = !toolSettings.HideAutoProperties; return toolSettings; } #endregion #region LogFile /// <summary> /// <p><em>Sets <see cref="DotCoverReportSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T SetLogFile<T>(this T toolSettings, string logFile) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = logFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverReportSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T ResetLogFile<T>(this T toolSettings) where T : DotCoverReportSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = null; return toolSettings; } #endregion } #endregion #region DotCoverZipSettingsExtensions /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [ExcludeFromCodeCoverage] public static partial class DotCoverZipSettingsExtensions { #region Configuration /// <summary> /// <p><em>Sets <see cref="DotCoverZipSettings.Configuration"/></em></p> /// </summary> [Pure] public static T SetConfiguration<T>(this T toolSettings, string configuration) where T : DotCoverZipSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = configuration; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverZipSettings.Configuration"/></em></p> /// </summary> [Pure] public static T ResetConfiguration<T>(this T toolSettings) where T : DotCoverZipSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Configuration = null; return toolSettings; } #endregion #region Source /// <summary> /// <p><em>Sets <see cref="DotCoverZipSettings.Source"/></em></p> /// <p>Coverage snapshot file name.</p> /// </summary> [Pure] public static T SetSource<T>(this T toolSettings, string source) where T : DotCoverZipSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Source = source; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverZipSettings.Source"/></em></p> /// <p>Coverage snapshot file name.</p> /// </summary> [Pure] public static T ResetSource<T>(this T toolSettings) where T : DotCoverZipSettings { toolSettings = toolSettings.NewInstance(); toolSettings.Source = null; return toolSettings; } #endregion #region OutputFile /// <summary> /// <p><em>Sets <see cref="DotCoverZipSettings.OutputFile"/></em></p> /// <p>Zipped snapshot file name.</p> /// </summary> [Pure] public static T SetOutputFile<T>(this T toolSettings, string outputFile) where T : DotCoverZipSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = outputFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverZipSettings.OutputFile"/></em></p> /// <p>Zipped snapshot file name.</p> /// </summary> [Pure] public static T ResetOutputFile<T>(this T toolSettings) where T : DotCoverZipSettings { toolSettings = toolSettings.NewInstance(); toolSettings.OutputFile = null; return toolSettings; } #endregion #region LogFile /// <summary> /// <p><em>Sets <see cref="DotCoverZipSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T SetLogFile<T>(this T toolSettings, string logFile) where T : DotCoverZipSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = logFile; return toolSettings; } /// <summary> /// <p><em>Resets <see cref="DotCoverZipSettings.LogFile"/></em></p> /// <p>Enables logging and specifies log file name.</p> /// </summary> [Pure] public static T ResetLogFile<T>(this T toolSettings) where T : DotCoverZipSettings { toolSettings = toolSettings.NewInstance(); toolSettings.LogFile = null; return toolSettings; } #endregion } #endregion #region DotCoverReportType /// <summary> /// Used within <see cref="DotCoverTasks"/>. /// </summary> [PublicAPI] [Serializable] [ExcludeFromCodeCoverage] [TypeConverter(typeof(TypeConverter<DotCoverReportType>))] public partial class DotCoverReportType : Enumeration { public static DotCoverReportType Html = (DotCoverReportType) "Html"; public static DotCoverReportType Json = (DotCoverReportType) "Json"; public static DotCoverReportType Xml = (DotCoverReportType) "Xml"; public static DotCoverReportType DetailedXml = (DotCoverReportType) "DetailedXml"; public static DotCoverReportType NDependXML = (DotCoverReportType) "NDependXML"; public static implicit operator DotCoverReportType(string value) { return new DotCoverReportType { Value = value }; } } #endregion }
54.075768
395
0.620079
[ "MIT" ]
ChaseFlorell/nuke
source/Nuke.Common/Tools/DotCover/DotCover.Generated.cs
241,232
C#
using NUnit.Framework; using System; using System.Data; using Raptorious.SharpMt940Lib.Mt940Format; namespace Raptorious.SharpMt940Lib.Tests { [TestFixture] public class TransactionTests { [Test, Category("Issue2")] public void EntryMonthAndEntryDayAvailableText() { var transaction = new Transaction("1312231223DR0,95N011NONREF", new Currency("EUR")); Assert.That(transaction.EntryDate.HasValue, Is.True); Assert.That(transaction.EntryDate.Value, Is.EqualTo(new DateTime(2013, 12, 23))); Assert.That(transaction.ValueDate, Is.EqualTo(new DateTime(2013, 12, 23))); } [Test, Category("Issue2")] public void EntryMonthAndEntryDayOptionalText() { var transaction = new Transaction("131223DR0,95N011NONREF", new Currency("EUR")); Assert.That(transaction.EntryDate, Is.Null); Assert.That(transaction.EntryDate.HasValue, Is.False); Assert.That(transaction.ValueDate, Is.EqualTo(new DateTime(2013, 12, 23))); } [Test, Category("Issue2")] public void EntryMonthOptionalText() { Assert.Throws<InvalidExpressionException>(() => new Transaction("13122323DR0,95N011NONREF", new Currency("EUR"))); } [Test, Category("Issue2")] public void EntryDayOptionalText() { Assert.Throws<InvalidExpressionException>(() => new Transaction("13122312DR0,95N011NONREF", new Currency("EUR"))); } [Test] public void CreditDebitIsParsedCorrectly_Debit() { var transaction = new Transaction("1312231223DR0,95N011NONREF", new Currency("EUR")); Assert.AreEqual(transaction.DebitCredit, DebitCredit.Debit); Assert.AreEqual(transaction.FundsCode, "R"); } [Test] public void CreditDebitIsParsedCorrectly_Credit() { var transaction = new Transaction("1407010701C388,15NDIV0597894779", new Currency("EUR")); Assert.AreEqual(transaction.DebitCredit, DebitCredit.Credit); Assert.AreEqual(transaction.FundsCode, ""); } [Test] public void WithSupplementaryDetails_IsParsedCorrectly() { var expectedTransaction = ExpectedSwiftTransaction.CreateExpected(new DateTime(2015, 1, 26), DebitCredit.Credit, "R", "EUR", 18790.00M, "NTRF", "PON0000002534162", null, "Inward Payment", ""); var transaction = new Transaction("1501260126CR18790,00NTRFPON0000002534162\r\nInward Payment", new Currency("EUR"), Mt940Test.NlCultureInfo); ExpectedSwiftTransaction.AssertTransaction(expectedTransaction, transaction); } [Test] public void WithSupplementaryDetailsAndServiceReference_IsParsedCorrectly() { var expectedTransaction = ExpectedSwiftTransaction.CreateExpected(new DateTime(2015, 1, 26), DebitCredit.Credit, "R", "EUR", 18790.00M, "NTRF", "PON0000002534162", null, "Inward Payment", "GBG260150R2ETGXS"); var transaction = new Transaction("1501260126CR18790,00NTRFPON0000002534162//GBG260150R2ETGXS\r\nInward Payment", new Currency("EUR"), Mt940Test.NlCultureInfo); ExpectedSwiftTransaction.AssertTransaction(expectedTransaction, transaction); } [Test] public void WithoutSupplementaryDetailsOrServiceReference_IsParsedCorrectly() { var expectedTransaction = ExpectedSwiftTransaction.CreateExpected(new DateTime(2015, 1, 26), DebitCredit.Credit, "R", "EUR", 18790.00M, "NTRF", "PON0000002534162", null, "", ""); var transaction = new Transaction("1501260126CR18790,00NTRFPON0000002534162", new Currency("EUR"), Mt940Test.NlCultureInfo); ExpectedSwiftTransaction.AssertTransaction(expectedTransaction, transaction); } } }
41.608247
172
0.647423
[ "MIT" ]
Petur06/SharpMt940Lib.Core
Raptorious.SharpMt940Lib.Tests/TransactionTests.cs
4,038
C#
// --------------------------------------------------------------------- // <copyright file="CuckooHashTable.cs" company="Michael Alyn Miller"> // Copyright (c) 2009-2010, Michael Alyn Miller (malyn@strangeGizmo.com). // 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 unmodified, 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. // 3. Neither the name of Michael Alyn Miller nor the names of the // contributors to this software may be used to endorse or promote // products derived from this software without specific prior written // permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. // </copyright> // <summary>Provides a hash table implemented with a Cuckoo Hash.</summary> // --------------------------------------------------------------------- namespace ToolLib { using System.Collections.Generic; /// <summary> /// Hash table implemented using a Cuckoo Hash. /// </summary> /// <typeparam name="TValue">Type of values stored in the hash /// table.</typeparam> public class CuckooHashTable<TValue> { /// <summary> /// First hash function for use by the Cuckoo Hash. /// </summary> private CuckooHashFunction chf1; /// <summary> /// First hash function for use by the Cuckoo Hash. /// </summary> private CuckooHashFunction chf2; /// <summary> /// The hash table. /// </summary> private IDictionary<int, CuckooHashEntry> hashTable = new Dictionary<int, CuckooHashEntry>(); /// <summary> /// Initializes a new instance of the CuckooHashTable class. /// </summary> /// <param name="chf1">First hash function for use by the Cuckoo /// Hash.</param> /// <param name="chf2">Second hash function for use by the /// Cuckoo Hash.</param> public CuckooHashTable(CuckooHashFunction chf1, CuckooHashFunction chf2) { this.chf1 = chf1; this.chf2 = chf2; } /// <summary> /// Delegate which hashes the given value into an integer. /// </summary> /// <param name="value">The value to be hashed.</param> /// <returns>An integer hash value.</returns> public delegate int CuckooHashFunction(TValue value); /// <summary> /// Gets the number of entries in the hash table. /// </summary> public int Count { get { return this.hashTable.Count; } } /// <summary> /// Gets the number of hash values stored at their first hash /// location. /// </summary> public int NumValuesStoredAtFirstHash { get; private set; } /// <summary> /// Gets number of hash values stored at their second hash /// location. /// </summary> public int NumValuesStoredAtSecondHash { get; private set; } /// <summary> /// Try to add a value to the hash table. The hash functions /// must be rebuilt if the add operation fails (and assuming /// that you want to be able to add this value to the table). /// The table must be cleared after rebuilding the hash /// functions if the same CuckooHashTable object will be reused. /// </summary> /// <param name="value">The value to add to the hash /// table.</param> /// <returns>true if the value was added to the table; false if /// trying to add the value caused an infinite loop.</returns> public bool TryAddValue(TValue value) { // Wrap the value in a CuckooHashEntry. var hashEntry = new CuckooHashEntry(this.chf1(value), this.chf2(value), value); // Try to put the value in its first position. if (!this.hashTable.ContainsKey(hashEntry.Hash1)) { this.hashTable[hashEntry.Hash1] = hashEntry; this.NumValuesStoredAtFirstHash++; } else { // We need to kick the entry in our Hash1 position into // its Hash2 position. This could cause other entries // to be kicked out of position, which could be an // infinite loop. As such, we track the seen state of // all of the entries and exit the loop if we try to // kick out an object that has already been seen. The // first step in this process is thus to clear the seen // state for all of the entries. foreach (var entry in this.hashTable.Values) { entry.Seen = false; } // Try to put the entry into its Hash2 location. If // that fails then kick the entry in Hash2 to that // entry's Hash2 location. Repeat until we either find // an empty Hash2 slot or try to kick an entry that is // already in its Hash2 location into its Hash2 location // (which would cause an infinite loop). if (!this.TryAssignAndKickOutIfNeeded(hashEntry)) { return false; } } // We were successful in adding this entry to the hash table. return true; } /// <summary> /// Tries to get the value associated with the specified key. /// </summary> /// <param name="key">The key whose value to get.</param> /// <param name="value">The value associated with the specified /// key.</param> /// <returns>true if the key was found in the hash table; false /// otherwise.</returns> public bool TryGetValue(int key, out TValue value) { CuckooHashEntry hashEntry; bool found = this.hashTable.TryGetValue(key, out hashEntry); value = found ? hashEntry.Value : default(TValue); return found; } /// <summary> /// Clear the hash table. /// </summary> public void Clear() { this.hashTable.Clear(); this.NumValuesStoredAtFirstHash = 0; this.NumValuesStoredAtSecondHash = 0; } /// <summary> /// Try to store the entry into its Hash2 location. If that /// fails then kick the entry in Hash2 to that entry's Hash2 /// location. Recurse until we either find an empty Hash2 slot /// or try to kick an entry that is already in its Hash2 /// location into its Hash2 location (which would cause an /// infinite loop). /// </summary> /// <param name="hashEntry">The hash entry to store.</param> /// <returns>true if the hash entry was stored at its Hash2 /// location; false if storing the hash entry at its Hash2 /// location would cause an infinite loop.</returns> private bool TryAssignAndKickOutIfNeeded(CuckooHashEntry hashEntry) { // Success is immediate if the Hash2 location is unused. if (!this.hashTable.ContainsKey(hashEntry.Hash2)) { this.NumValuesStoredAtSecondHash++; this.hashTable[hashEntry.Hash2] = hashEntry; return true; } // Get the kicked out entry and fail if we have already seen // that entry. var kickedOutEntry = this.hashTable[hashEntry.Hash2]; if (kickedOutEntry.Seen) { return false; } // Put the new word in the kicked out word's spot. this.hashTable[hashEntry.Hash2] = hashEntry; hashEntry.Seen = true; this.NumValuesStoredAtFirstHash--; this.NumValuesStoredAtSecondHash++; // Try to store the kicked out entry in its Hash2 location, // kicking out additional words as necessary. kickedOutEntry.Seen = true; return this.TryAssignAndKickOutIfNeeded(kickedOutEntry); } /// <summary> /// Stores a single entry in a Cuckoo Hash table. /// </summary> private class CuckooHashEntry { /// <summary> /// Initializes a new instance of the CuckooHashEntry class. /// </summary> /// <param name="hash1">First hash value for this /// entry.</param> /// <param name="hash2">Second hash value for this /// entry.</param> /// <param name="value">Value of this entry.</param> public CuckooHashEntry(int hash1, int hash2, TValue value) { this.Hash1 = hash1; this.Hash2 = hash2; this.Value = value; } /// <summary> /// Gets the first hash value of this entry. /// </summary> public int Hash1 { get; private set; } /// <summary> /// Gets the second hash value of this entry. /// </summary> public int Hash2 { get; private set; } /// <summary> /// Gets the value of this entry. /// </summary> public TValue Value { get; private set; } /// <summary> /// Gets or sets a value indicating whether this entry has /// been seen by the "kick out" routine. /// </summary> public bool Seen { get; set; } } } }
40
101
0.571852
[ "BSD-3-Clause" ]
malyn/MFORTH
src/ToolLib/CuckooHashTable.cs
10,802
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class WanderingAI : MonoBehaviour { public float speed = 3.0f; public const float baseSpeed = 3.0f; public float obstacleRange = 5.0f; [SerializeField] private GameObject fireballPrefab; private GameObject _fireball; private bool _alive; private void Awake() { Messenger<float>.AddListener(GameEvent.SPEED_CHANGED, OnSpeedChanged); } private void OnDestroy() { Messenger<float>.RemoveListener(GameEvent.SPEED_CHANGED, OnSpeedChanged); } private void Start() { _alive = true; } // Update is called once per frame void Update() { if (_alive) { transform.Translate(0, 0, speed * Time.deltaTime); Ray ray = new Ray(transform.position, transform.forward); RaycastHit hit; if (Physics.SphereCast(ray, 0.75f, out hit)) { GameObject hitObject = hit.transform.gameObject; if (hitObject.GetComponent<PlayerCharacter>()) { if (_fireball == null) { _fireball = Instantiate(fireballPrefab) as GameObject; _fireball.transform.position = transform.TransformPoint(Vector3.forward * 1.5f); _fireball.transform.rotation = transform.rotation; } } else if (hit.distance < obstacleRange) { float angle = Random.Range(-110, 110); transform.Rotate(0, angle, 0); } } } } public void SetAlive(bool alive) { _alive = alive; } private void OnSpeedChanged(float value) { speed = value * baseSpeed; } }
25.413333
104
0.547219
[ "MIT" ]
icaro56/unity_in_action_book_solutions
UI Tutorial_chapters_chapter_7/Assets/Scripts/WanderingAI.cs
1,908
C#
 using UriJudge.Console.Problem1405.Operating; namespace UriJudge.Console.Problem1405.Commands { /// <summary> /// Implementação do comando MUL /// </summary> public class Multiplication : Command { public Variable OperatingA { get; set; } public IOperating OperatingB { get; set; } public override bool Execute(Program program) { var result = OperatingA.GetValue(program) * OperatingB.GetValue(program); program.WriteVar(OperatingA, result); return true; } } }
25.681818
85
0.628319
[ "MIT" ]
fabio-couto/uri-judge
src/UriJudge.Console/Problem1405/Commands/Multiplication.cs
569
C#
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; /* * TEST skript to simulate the focus point of the user */ public class EyeFocusPointSphereScript : MonoBehaviour { public Transform playerDummy; public Transform playerVR; private Transform _player; public float distance = 0.2f; public float sphereCastRadius = 1.0f; public float sphereCastDistance = 10.0f; public VectortoolAbstractScript VAS; public List<VectortoolAbstractScriptAdvance> VASAList; public bool useAdvancedScript = true; public LayerMask layerMask; // Use this for initialization public bool switchGaze = false; public int maxCollisionsPerFrame = 10; void Start() { if (!playerVR.parent.gameObject.activeSelf) { _player = playerDummy; //player.GetChild(0).tag = "MainCamera"; _player.tag = "MainCamera"; Debug.Log("EyeFocusPointSphereScript use player :'Dummy' "); playerVR.tag = "Untagged"; playerVR.parent.tag = "Untagged"; } else { _player = playerVR; _player.tag = "MainCamera"; Debug.Log("EyeFocusPointSphereScript use player : 'VR' "); } //VAS = GameObject.Find("Vectortool_Abstracthandler").GetComponent<VectortoolAbstractScript>(); PupilData.calculateMovingAverage = false; // necessary? } void OnEnable() { //necessary? if (PupilTools.IsConnected) { //PupilGazeTracker.Instance.StartVisualizingGaze(); PupilGazeTracker.Instance.StartVisualizingGaze(); PupilGazeTracker.Instance.StopVisualizingGaze(); Debug.Log("gaze subscribed"); PupilTools.SubscribeTo("gaze"); } } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.U)) { switchGaze = !switchGaze; Debug.Log("connect:" + PupilTools.IsConnected + ", gaze: " + PupilTools.IsGazing + ", pos :" + PupilData._2D.GazePosition); if (PupilTools.IsConnected && switchGaze) { PupilGazeTracker.Instance.StartVisualizingGaze(); } else if (!switchGaze) { PupilGazeTracker.Instance.StopVisualizingGaze(); } } Ray ray; if (PupilTools.IsConnected) { //transform.position = PupilData._3D.GazePosition; //Debug.Log(PupilData._3D.GazePosition); //Debug.Log(PupilData._2D.GazePosition); Vector2 gazePointCenter = PupilData._2D.GazePosition; Vector3 viewportPoint = new Vector3(gazePointCenter.x, gazePointCenter.y, 1f); transform.position = viewportPoint + transform.forward * distance; ray = Camera.main.ViewportPointToRay(viewportPoint); Debug.DrawRay(ray.origin, ray.direction, Color.red); } else { //Ray ray = Camera.main. postion + ImagePosition. forward ray = new Ray( Camera.main.transform.position, Camera.main.transform.forward); Debug.DrawLine(ray.origin, ray.origin + ray.direction * sphereCastDistance, Color.green); } RaycastHit[] hit = Physics.SphereCastAll(ray, sphereCastRadius, sphereCastDistance, layerMask); if (hit.Length > 0) { for (int i = 0; i < hit.Length && i < maxCollisionsPerFrame; i++) { AlternativOnTriggerStay(hit[i].collider); } } // transform.position = player.position + transform.forward * distance; //transform.localRotation = player.rotation; if (Input.GetKeyDown(KeyCode.R)) { GetComponent<MeshRenderer>().enabled = !GetComponent<MeshRenderer>().enabled; } } private void AlternativOnTriggerStay(Collider other) { //Vector3 center = other.gameObject.transform.position; int id = other.GetComponent<ColliderBoxScript>().Id; if (useAdvancedScript) { var position = _player.position; foreach (var VASA in VASAList) { VASA.UpdateCollision(id, position, other.ClosestPoint(position)); } } else { //sVAS.UpdateCollision(center); } } }
30.557823
135
0.59439
[ "MIT" ]
hanibalv2/Real-time_gaze_mapper_vr
Assets/Scripts/Vectortool_Scritps/EyeFocusPointSphereScript.cs
4,494
C#
using Crass.Structs; using System; using System.Runtime.InteropServices; namespace Crass.Plugin.ARCGameEngine { [StructLayout(LayoutKind.Sequential)] public struct HeaderAB { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] public string Magic; //// "S3AB", "S4AB" public UInt32 Unknown0; public UInt32 Unknown1; public UInt32 ActLength; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string Unknown; public BIN_CompressInfo Info; } }
26.7
60
0.674157
[ "BSD-3-Clause" ]
MaiReo/crass-csharp
src/cui/Crass.Plugin.ARCGameEngine/AB/HeaderAB.cs
536
C#
using System; using Dalamud.Configuration; using Dalamud.Plugin; namespace MonsterLootHunter { public class Configuration : IPluginConfiguration { public int Version { get; set; } = 1; public bool ContextMenuIntegration { get; set; } = false; // the below exist just to make saving less cumbersome [NonSerialized] private DalamudPluginInterface _pluginInterface; public void Initialize(DalamudPluginInterface pluginInterface) { _pluginInterface = pluginInterface; } public void Save() { _pluginInterface!.SavePluginConfig(this); } } }
23.75
70
0.645113
[ "MIT" ]
danielbrenom/MonsterLootHunter
MonsterLootHunter/Configuration.cs
667
C#
// Copyright © .NET Foundation and Contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace PInvoke { /// <content> /// Contains the <see cref="SHGetFolderPathFlags"/> nested type. /// </content> public partial class Shell32 { /// <summary>Flags that specify the path to be returned. Used in cases where the folder associated with a <see cref="KNOWNFOLDERID"/> (or CSIDL) can be moved, renamed, redirected, or roamed across languages by a user or administrator.</summary> public enum SHGetFolderPathFlags { /// <summary>Retrieve the folder's current path.</summary> /// <remarks> /// The known folder system that underlies <see cref="SHGetFolderPath(System.IntPtr, CSIDL, System.IntPtr, SHGetFolderPathFlags, char*)"/> allows users or administrators to redirect a known folder to a location that suits their needs. /// This is achieved by calling IKnownFolderManager::Redirect, which sets the "current" value of the folder associated with the SHGFP_TYPE_CURRENT flag /// </remarks> SHGFP_TYPE_CURRENT = 0, /// <summary>Retrieve the folder's default path.</summary> /// <remarks> /// The default value of the folder, which is the location of the folder if a user or administrator had not redirected it elsewhere, /// is retrieved by specifying the SHGFP_TYPE_DEFAULT flag. This value can be used to implement a "restore defaults" feature for a known folder. /// </remarks> SHGFP_TYPE_DEFAULT = 1, } } }
56.5
252
0.671386
[ "MIT" ]
AArnott/pinvoke
src/Shell32/storebanned/Shell32+SHGetFolderPathFlags.cs
1,698
C#
// ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by SpecFlow (http://www.specflow.org/). // SpecFlow Version:1.9.0.77 // SpecFlow Generator Version:1.9.0.0 // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ #region Designer generated code #pragma warning disable namespace Pickles.TestHarness.xunit2 { using TechTalk.SpecFlow; [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public partial class ScenarioOutlinesFeature : Xunit.IUseFixture<ScenarioOutlinesFeature.FixtureData>, System.IDisposable { private static TechTalk.SpecFlow.ITestRunner testRunner; #line 1 "ScenarioOutlines.feature" #line hidden public ScenarioOutlinesFeature() { this.TestInitialize(); } public static void FeatureSetup() { testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Scenario Outlines", "Here we demonstrate how we deal with scenario outlines", ProgrammingLanguage.CSharp, ((string[])(null))); testRunner.OnFeatureStart(featureInfo); } public static void FeatureTearDown() { testRunner.OnFeatureEnd(); testRunner = null; } public virtual void TestInitialize() { } public virtual void ScenarioTearDown() { testRunner.OnScenarioEnd(); } public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) { testRunner.OnScenarioStart(scenarioInfo); } public virtual void ScenarioCleanup() { testRunner.CollectScenarioErrors(); } public virtual void SetFixture(ScenarioOutlinesFeature.FixtureData fixtureData) { } void System.IDisposable.Dispose() { this.ScenarioTearDown(); } [Xunit.TheoryAttribute()] [Xunit.TraitAttribute("FeatureTitle", "Scenario Outlines")] [Xunit.TraitAttribute("Description", "This is a scenario outline where all scenarios pass")] [Xunit.InlineDataAttribute("pass_1", new string[0])] [Xunit.InlineDataAttribute("pass_2", new string[0])] [Xunit.InlineDataAttribute("pass_3", new string[0])] public virtual void ThisIsAScenarioOutlineWhereAllScenariosPass(string result, string[] exampleTags) { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("This is a scenario outline where all scenarios pass", exampleTags); #line 4 this.ScenarioSetup(scenarioInfo); #line 8 testRunner.Then(string.Format("the scenario will \'{0}\'", result), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); } [Xunit.TheoryAttribute()] [Xunit.TraitAttribute("FeatureTitle", "Scenario Outlines")] [Xunit.TraitAttribute("Description", "This is a scenario outline where one scenario is inconclusive")] [Xunit.InlineDataAttribute("pass_1", new string[0])] [Xunit.InlineDataAttribute("pass_2", new string[0])] [Xunit.InlineDataAttribute("inconclusive_1", new string[0])] public virtual void ThisIsAScenarioOutlineWhereOneScenarioIsInconclusive(string result, string[] exampleTags) { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("This is a scenario outline where one scenario is inconclusive", exampleTags); #line 17 this.ScenarioSetup(scenarioInfo); #line 21 testRunner.Then(string.Format("the scenario will \'{0}\'", result), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); } [Xunit.TheoryAttribute()] [Xunit.TraitAttribute("FeatureTitle", "Scenario Outlines")] [Xunit.TraitAttribute("Description", "This is a scenario outline where one scenario fails")] [Xunit.InlineDataAttribute("pass_1", new string[0])] [Xunit.InlineDataAttribute("pass_2", new string[0])] [Xunit.InlineDataAttribute("fail_1", new string[0])] public virtual void ThisIsAScenarioOutlineWhereOneScenarioFails(string result, string[] exampleTags) { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("This is a scenario outline where one scenario fails", exampleTags); #line 30 this.ScenarioSetup(scenarioInfo); #line 34 testRunner.Then(string.Format("the scenario will \'{0}\'", result), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); } [Xunit.TheoryAttribute()] [Xunit.TraitAttribute("FeatureTitle", "Scenario Outlines")] [Xunit.TraitAttribute("Description", "And we can go totally bonkers with multiple example sections.")] [Xunit.InlineDataAttribute("pass_1", new string[0])] [Xunit.InlineDataAttribute("pass_2", new string[0])] [Xunit.InlineDataAttribute("inconclusive_1", new string[0])] [Xunit.InlineDataAttribute("inconclusive_2", new string[0])] [Xunit.InlineDataAttribute("fail_1", new string[0])] [Xunit.InlineDataAttribute("fail_2", new string[0])] public virtual void AndWeCanGoTotallyBonkersWithMultipleExampleSections_(string result, string[] exampleTags) { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("And we can go totally bonkers with multiple example sections.", exampleTags); #line 43 this.ScenarioSetup(scenarioInfo); #line 45 testRunner.Then(string.Format("the scenario will \'{0}\'", result), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); } [Xunit.TheoryAttribute()] [Xunit.TraitAttribute("FeatureTitle", "Scenario Outlines")] [Xunit.TraitAttribute("Description", "Deal correctly with backslashes in the examples")] [Xunit.InlineDataAttribute("c:\\Temp\\", new string[0])] public virtual void DealCorrectlyWithBackslashesInTheExamples(string filePath, string[] exampleTags) { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Deal correctly with backslashes in the examples", exampleTags); #line 63 this.ScenarioSetup(scenarioInfo); #line 65 testRunner.When(string.Format("I have backslashes in the value, for example a \'{0}\'", filePath), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden this.ScenarioCleanup(); } [Xunit.TheoryAttribute()] [Xunit.TraitAttribute("FeatureTitle", "Scenario Outlines")] [Xunit.TraitAttribute("Description", "Deal correctly with parenthesis in the examples")] [Xunit.InlineDataAttribute("This is a description (and more)", new string[0])] public virtual void DealCorrectlyWithParenthesisInTheExamples(string description, string[] exampleTags) { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Deal correctly with parenthesis in the examples", exampleTags); #line 63 this.ScenarioSetup(scenarioInfo); #line 65 testRunner.When(string.Format("I have parenthesis in the value, for example an \'{0}\'", description), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden this.ScenarioCleanup(); } [Xunit.TheoryAttribute()] [Xunit.TraitAttribute("FeatureTitle", "Scenario Outlines")] [Xunit.TraitAttribute("Description", "Deal correctly with overlong example values")] [Xunit.InlineDataAttribute("Please enter a valid two letter country code (e.g. DE)!", "This is just a very very very veery long error message!", new string[0])] public virtual void DealCorrectlyWithOverlongExampleValues(string value1, string value2, string[] exampleTags) { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Deal correctly with overlong example values", exampleTags); #line 80 this.ScenarioSetup(scenarioInfo); #line 82 testRunner.When(string.Format("I have a field with value \'{0}\'", value1), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line 83 testRunner.And(string.Format("I have a field with value \'{0}\'", value2), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 84 testRunner.Then("the scenario will \'pass_1\'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden this.ScenarioCleanup(); } [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class FixtureData : System.IDisposable { public FixtureData() { ScenarioOutlinesFeature.FeatureSetup(); } void System.IDisposable.Dispose() { ScenarioOutlinesFeature.FeatureTearDown(); } } } } #pragma warning restore #endregion
46.084112
264
0.654127
[ "Apache-2.0" ]
Lordsauron/pickles
test-harness/xunit2/ScenarioOutlines.feature.cs
9,864
C#
namespace SubmissionEvaluation.Contracts.Data { public enum MemberType { Local, LDAP } }
13
45
0.606838
[ "MIT" ]
itdesigners/challenges
src/SubmissionEvaluation.Contracts/Data/MemberType.cs
117
C#
using Common; using Lykke.Job.EthereumCore.Contracts.Events; using Lykke.RabbitMqBroker.Publisher; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Lykke.Job.EthereumCore.Contracts.Events.LykkePay; namespace Lykke.Service.RabbitMQ { public interface IRabbitQueuePublisher { Task PublshEvent(string rabbitEvent); Task PublshEvent<T>(T rabbitEvent); } public class RabbitQueuePublisher : IRabbitQueuePublisher { private IMessageProducer<string> _publisher; private readonly IMessageProducer<TransferEvent> _lykkePayPublisher; private readonly IMessageProducer<HotWalletEvent> _hotWalletPublisher; private readonly Dictionary<Type, MessageProducerWrapper> _messageProducerDictionary = new Dictionary<Type, MessageProducerWrapper>(); public RabbitQueuePublisher(IMessageProducer<string> publisher, IMessageProducer<HotWalletEvent> hotWalletPublisher, IMessageProducer<TransferEvent> lykkePayPublisher) { _publisher = publisher; _hotWalletPublisher = hotWalletPublisher; _lykkePayPublisher = lykkePayPublisher; #region String MessageProducerWrapper strringWrapper = CreateWrapper(typeof(string), _publisher); _messageProducerDictionary.Add(typeof(string), strringWrapper); #endregion #region HotWalletCashoutEvent MessageProducerWrapper hotWalletCashoutEventWrapper = CreateWrapper(typeof(HotWalletEvent), _hotWalletPublisher); _messageProducerDictionary.Add(typeof(HotWalletEvent), hotWalletCashoutEventWrapper); #endregion #region LykkePayEvents MessageProducerWrapper lykkePayEventWrapper = CreateWrapper(typeof(TransferEvent), _lykkePayPublisher); _messageProducerDictionary.Add(typeof(TransferEvent), lykkePayEventWrapper); #endregion } public async Task PublshEvent(string rabbitEvent) { await _publisher.ProduceAsync(rabbitEvent); } public async Task PublshEvent<T>(T rabbitEvent) { _messageProducerDictionary.TryGetValue(typeof(T), out MessageProducerWrapper wrapper); if (wrapper == null) { throw new Exception("Message is of unsupported type"); } await wrapper.SendMessageAsync(rabbitEvent); } private MessageProducerWrapper CreateWrapper(Type type, object messageProducer) { Type producerType = typeof(MessageProducerWrapper<>).MakeGenericType(type); var @interface = messageProducer?.GetType().GetInterfaces().FirstOrDefault(); var constructors = producerType.GetConstructors(); var constructor = constructors.FirstOrDefault(); var wrapper = (MessageProducerWrapper)constructor.Invoke(new object[] { messageProducer }); return wrapper; } } #region Support Types abstract public class MessageProducerWrapper { public abstract Task SendMessageAsync(object message); } public class MessageProducerWrapper<T> : MessageProducerWrapper where T : class { public IMessageProducer<T> _producer { get; private set; } public MessageProducerWrapper(IMessageProducer<T> producer) { _producer = producer; } public async Task SendMessageAsync(T message) { await _producer.ProduceAsync(message); } public override async Task SendMessageAsync(object message) { var castedObject = message as T; if (message == null) { throw new InvalidCastException($"Message should of type {typeof(T)}"); } await SendMessageAsync(castedObject); } } #endregion }
32.024
125
0.668998
[ "MIT" ]
JTOne123/EthereumApiDotNetCore
src/Lykke.Service.EthereumCore.RabbitMQ/RabbitPublisher.cs
4,005
C#
namespace SpeakImageOverlay.Web.Controllers { using System.Web.Mvc; using Glass.Mapper.Sc.Web.Mvc; using Web.Models; public class HomeController : GlassController { public ActionResult Index() { return View(); } public ActionResult ImageOverlay() { return View(ContextItem == null ? null : SitecoreContext.Cast<IPage>(ContextItem)); } } }
23
95
0.599542
[ "MIT" ]
moo2u2/SitecoreImageOverlay
SpeakImageOverlay/Controllers/HomeController.cs
439
C#
using System.Collections.Generic; using System.Text; namespace Ether.Outcomes.Formats { public class MultiLineFormatter { /// <summary> /// Dumps the message list into a string, with a delimiter after each line. /// </summary> public static string ToMultiLine(string delimiter, List<string> messages) { var result = new StringBuilder(); foreach (var message in messages) { if (delimiter == null) HandleNullDelimiter(result, message); else result.AppendFormat("{0}{1}", message, delimiter); } return result.ToString(); } /// <summary> /// If the delimiter is null, we make sure there is at least one space between messages. /// </summary> private static void HandleNullDelimiter(StringBuilder builder, string nextMessage) { //If builder is empty, there's nothing to do. if (builder.Length == 0) { builder.Append(nextMessage); return; } //If builder ends with a space or the message starts with a space, there is already a space, //so we don't have to do anything. if (builder[builder.Length - 1] == ' ' || nextMessage.StartsWith(" ")) { builder.Append(nextMessage); return; } //Otherwise, there is no space, and we need to add one before the message. builder.Append(" "); builder.Append(nextMessage); } } }
31.961538
104
0.534898
[ "MIT" ]
GoodeUser/Ether.Outcomes
Outcomes/Formats/MultiLineFormatter.cs
1,664
C#
using Saar.FFmpeg.CSharp; using Saar.FFmpeg.Structs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FF = Saar.FFmpeg.Internal.FFmpeg; namespace Saar.FFmpeg.CSharp { unsafe public abstract class Decoder : Codec { protected Decoder(AVStream* stream) : base(stream) { codecContext->Codec = FF.avcodec_find_decoder(codecContext->CodecId); int resultCode = FF.avcodec_open2(codecContext, codecContext->Codec, null); if (resultCode != 0) throw new FFmpegException(resultCode); } public abstract bool Decode(Packet packet, Frame outFrame); internal static Decoder Create(AVStream* stream) { switch (stream->Codec->CodecType) { case AVMediaType.Audio: return new AudioDecoder(stream); case AVMediaType.Video: return new VideoDecoder(stream); } return null; } } }
30.068966
78
0.752294
[ "MIT" ]
MikiraSora/SaarFFmpeg
SaarFFmpeg/CSharp/Decoder.cs
874
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("ConceptExtensionMethods")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConceptExtensionMethods")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5bb3763d-50d6-407f-93bb-c15b85c825f8")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
38.216216
84
0.751768
[ "Apache-2.0" ]
ElanHasson/roslyn
concepts/code/ConceptExtensionMethods/Properties/AssemblyInfo.cs
1,417
C#
using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using UnityEngine; public class Player : MonoBehaviour { [Serializable] public struct Stats { public float[] attack; public float attackSpeed; public float flamethrowerSpeed; public float flamethrowerSize; public int jumpAmount; public float jumpHeight; public PlayerHealth health; public Mana mana; public float speed; } public Dictionary<UpgradeCoin.UpgradeType, Upgrade> upgrades = new Dictionary<UpgradeCoin.UpgradeType, Upgrade>(); [SerializeField] Stats baseStats = default; [SerializeField] ItemHUD itemHUD = default; [SerializeField] Weapon[] weapons = default; public static GameObject player = default; PlayerMovement playerMovement; private void Awake() { player = this.gameObject; } void Start() { upgrades.Clear(); AddToDictionary(); playerMovement = GetComponent<PlayerMovement>(); ApplyStats(this.baseStats); itemHUD.UpdateAllText(); } void ApplyStats(Stats stats) { for (int i = 0; i < weapons.Length; i++) { weapons[i].Damage = stats.attack[i]; } weapons[0].AttackRate = stats.attackSpeed; playerMovement.MaxJumpCount = stats.jumpAmount; playerMovement.JumpHeight = stats.jumpHeight; playerMovement.Speed = stats.speed; ParticleSystem.MainModule particleMain = weapons[1].GetComponentInChildren<ParticleSystem>().main; particleMain.startSpeedMultiplier = stats.flamethrowerSpeed; particleMain.startSizeMultiplier = stats.flamethrowerSize; } void AddToDictionary() { upgrades.Add(UpgradeCoin.UpgradeType.Armor, new Upgrade(new Armor())); upgrades.Add(UpgradeCoin.UpgradeType.Attack, new Upgrade(new Attack())); // upgrades.Add(UpgradeCoin.UpgradeType.AttackSpeed, new Upgrade(new AttackSpeed())); upgrades.Add(UpgradeCoin.UpgradeType.FlamethrowerRange, new Upgrade(new FlamethrowerRange())); upgrades.Add(UpgradeCoin.UpgradeType.JumpAmount, new Upgrade(new JumpAmount())); upgrades.Add(UpgradeCoin.UpgradeType.JumpHeight, new Upgrade(new JumpHeight())); upgrades.Add(UpgradeCoin.UpgradeType.ManaRegeneration, new Upgrade(new ManaRegeneration())); upgrades.Add(UpgradeCoin.UpgradeType.MaxHealth, new Upgrade(new MaxHealth())); upgrades.Add(UpgradeCoin.UpgradeType.MaxMana, new Upgrade(new MaxMana())); upgrades.Add(UpgradeCoin.UpgradeType.PercentImmune, new Upgrade(new PercentImmune())); upgrades.Add(UpgradeCoin.UpgradeType.Regeneration, new Upgrade(new Regeneration())); upgrades.Add(UpgradeCoin.UpgradeType.Speed, new Upgrade(new Speed())); } public void IncrementUpgrade(UpgradeCoin.UpgradeType type) { upgrades[type].IncrementCount(); upgrades[type].behavior.ChangeStat(ref baseStats, upgrades[type].Count); ApplyStats(baseStats); itemHUD.UpdateAllText(); } private void OnControllerColliderHit(ControllerColliderHit hit) { if(hit.gameObject.GetComponent<UpgradeCoin>() != null) { hit.gameObject.GetComponent<UpgradeCoin>().OnPlayerGrab(); } } }
36.042553
118
0.68477
[ "MIT" ]
AJ213/Awitu
Assets/Scripts/Player.cs
3,390
C#
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // ------------------------------------------------------------ using System.Collections.Generic; using System.Linq; using Microsoft.OData.Edm; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData.Common; using Microsoft.OpenApi.OData.Generator; using Microsoft.OpenApi.OData.Vocabulary.Capabilities; namespace Microsoft.OpenApi.OData.Operation { /// <summary> /// Retrieve a navigation property from a navigation source. /// The Path Item Object for the entity contains the keyword get with an Operation Object as value /// that describes the capabilities for retrieving a navigation property form a navigation source. /// </summary> internal class NavigationPropertyGetOperationHandler : NavigationPropertyOperationHandler { /// <inheritdoc/> public override OperationType OperationType => OperationType.Get; /// <inheritdoc/> protected override void SetBasicInfo(OpenApiOperation operation) { // Summary operation.Summary = "Get " + NavigationProperty.Name + " from " + NavigationSource.Name; // OperationId if (Context.Settings.EnableOperationId) { string prefix = "Get"; if (!LastSegmentIsKeySegment && NavigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) { prefix = "List"; } operation.OperationId = GetOperationId(prefix); } base.SetBasicInfo(operation); } protected override void SetExtensions(OpenApiOperation operation) { if (Context.Settings.EnablePagination) { if (!LastSegmentIsKeySegment && NavigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) { OpenApiObject extension = new OpenApiObject { { "nextLinkName", new OpenApiString("@odata.nextLink")}, { "operationName", new OpenApiString(Context.Settings.PageableOperationName)} }; operation.Extensions.Add(Constants.xMsPageable, extension); } } base.SetExtensions(operation); } /// <inheritdoc/> protected override void SetResponses(OpenApiOperation operation) { OpenApiSchema schema = null; if (Context.Settings.EnableDerivedTypesReferencesForResponses) { schema = EdmModelHelper.GetDerivedTypesReferenceSchema(NavigationProperty.ToEntityType(), Context.Model); } if (schema == null) { schema = new OpenApiSchema { Reference = new OpenApiReference { Type = ReferenceType.Schema, Id = NavigationProperty.ToEntityType().FullName() } }; } if (!LastSegmentIsKeySegment && NavigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) { var properties = new Dictionary<string, OpenApiSchema> { { "value", new OpenApiSchema { Type = "array", Items = schema } } }; if (Context.Settings.EnablePagination) { properties.Add( "@odata.nextLink", new OpenApiSchema { Type = "string" }); } operation.Responses = new OpenApiResponses { { Constants.StatusCode200, new OpenApiResponse { Description = "Retrieved navigation property", Content = new Dictionary<string, OpenApiMediaType> { { Constants.ApplicationJsonMediaType, new OpenApiMediaType { Schema = new OpenApiSchema { Title = "Collection of " + NavigationProperty.ToEntityType().Name, Type = "object", Properties = properties } } } } } } }; } else { IDictionary<string, OpenApiLink> links = null; if (Context.Settings.ShowLinks) { string operationId = GetOperationId(); links = Context.CreateLinks(entityType: NavigationProperty.ToEntityType(), entityName: NavigationProperty.Name, entityKind: NavigationProperty.PropertyKind.ToString(), parameters: operation.Parameters, navPropOperationId: operationId); } operation.Responses = new OpenApiResponses { { Constants.StatusCode200, new OpenApiResponse { Description = "Retrieved navigation property", Content = new Dictionary<string, OpenApiMediaType> { { Constants.ApplicationJsonMediaType, new OpenApiMediaType { Schema = schema } } }, Links = links } } }; } operation.Responses.Add(Constants.StatusCodeDefault, Constants.StatusCodeDefault.GetResponse()); base.SetResponses(operation); } /// <inheritdoc/> protected override void SetParameters(OpenApiOperation operation) { base.SetParameters(operation); if (!LastSegmentIsKeySegment && NavigationProperty.TargetMultiplicity() == EdmMultiplicity.Many) { // Need to verify that TopSupported or others should be applied to navigation source. // So, how about for the navigation property. OpenApiParameter parameter = Context.CreateTop(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } parameter = Context.CreateSkip(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } parameter = Context.CreateSearch(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } parameter = Context.CreateFilter(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } parameter = Context.CreateCount(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } parameter = Context.CreateOrderBy(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } parameter = Context.CreateSelect(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } parameter = Context.CreateExpand(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } } else { OpenApiParameter parameter = Context.CreateSelect(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } parameter = Context.CreateExpand(NavigationProperty); if (parameter != null) { operation.Parameters.Add(parameter); } } } protected override void SetSecurity(OpenApiOperation operation) { if (Restriction == null || Restriction.ReadRestrictions == null) { return; } ReadRestrictionsBase readBase = Restriction.ReadRestrictions; if (LastSegmentIsKeySegment) { if (Restriction.ReadRestrictions.ReadByKeyRestrictions != null) { readBase = Restriction.ReadRestrictions.ReadByKeyRestrictions; } } operation.Security = Context.CreateSecurityRequirements(readBase.Permissions).ToList(); } protected override void AppendCustomParameters(OpenApiOperation operation) { if (Restriction == null || Restriction.ReadRestrictions == null) { return; } ReadRestrictionsBase readBase = Restriction.ReadRestrictions; if (LastSegmentIsKeySegment) { if (Restriction.ReadRestrictions.ReadByKeyRestrictions != null) { readBase = Restriction.ReadRestrictions.ReadByKeyRestrictions; } } if (readBase.CustomHeaders != null) { AppendCustomParameters(operation, readBase.CustomHeaders, ParameterLocation.Header); } if (readBase.CustomQueryOptions != null) { AppendCustomParameters(operation, readBase.CustomQueryOptions, ParameterLocation.Query); } } } }
36.946488
131
0.47135
[ "MIT" ]
nickmcummins/OpenAPI.NET.OData
src/Microsoft.OpenApi.OData.Reader/Operation/NavigationPropertyGetOperationHandler.cs
11,049
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 amplify-2017-07-25.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.Amplify.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.Amplify.Model.Internal.MarshallTransformations { /// <summary> /// ListBackendEnvironments Request Marshaller /// </summary> public class ListBackendEnvironmentsRequestMarshaller : IMarshaller<IRequest, ListBackendEnvironmentsRequest> , 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((ListBackendEnvironmentsRequest)input); } /// <summary> /// Marshaller the request object to the HTTP request. /// </summary> /// <param name="publicRequest"></param> /// <returns></returns> public IRequest Marshall(ListBackendEnvironmentsRequest publicRequest) { IRequest request = new DefaultRequest(publicRequest, "Amazon.Amplify"); request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2017-07-25"; request.HttpMethod = "GET"; if (!publicRequest.IsSetAppId()) throw new AmazonAmplifyException("Request object does not have required field AppId set"); request.AddPathResource("{appId}", StringUtils.FromString(publicRequest.AppId)); if (publicRequest.IsSetEnvironmentName()) request.Parameters.Add("environmentName", StringUtils.FromString(publicRequest.EnvironmentName)); if (publicRequest.IsSetMaxResults()) request.Parameters.Add("maxResults", StringUtils.FromInt(publicRequest.MaxResults)); if (publicRequest.IsSetNextToken()) request.Parameters.Add("nextToken", StringUtils.FromString(publicRequest.NextToken)); request.ResourcePath = "/apps/{appId}/backendenvironments"; request.MarshallerVersion = 2; request.UseQueryString = true; return request; } private static ListBackendEnvironmentsRequestMarshaller _instance = new ListBackendEnvironmentsRequestMarshaller(); internal static ListBackendEnvironmentsRequestMarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static ListBackendEnvironmentsRequestMarshaller Instance { get { return _instance; } } } }
37.408163
161
0.657938
[ "Apache-2.0" ]
PureKrome/aws-sdk-net
sdk/src/Services/Amplify/Generated/Model/Internal/MarshallTransformations/ListBackendEnvironmentsRequestMarshaller.cs
3,666
C#
using FrameworkLibrary; using System; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; namespace WebApplication.Controls.Lists { public partial class BlogFeedList : System.Web.UI.UserControl { private string feedUrl = ""; private int numberOfItemsToPull = 1; private bool showPostDescription = true; protected void Page_PreRender(object sender, EventArgs e) { Bind(); } public void SetBlogUrl(string feedUrl, int numberOfItemsToPull) { this.feedUrl = feedUrl; this.numberOfItemsToPull = numberOfItemsToPull; } public bool ShowPostDescription { get { return showPostDescription; } set { showPostDescription = value; } } private void Bind() { var webRequestHelper = new WebRequestHelper(); webRequestHelper.EnableCaching = true; webRequestHelper.CacheDurationInSeconds = AppSettings.WebRequestCacheDurationInSeconds; ItemsList.DataSource = RssHelper.GetRssItems(webRequestHelper.MakeWebRequest(feedUrl), numberOfItemsToPull); ItemsList.DataBind(); } protected void ItemsList_OnItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { Literal PublishDate = (Literal)e.Item.FindControl("PublishDate"); HyperLink Link = (HyperLink)e.Item.FindControl("Link"); HyperLink Title = (HyperLink)e.Item.FindControl("Title"); Literal ShortDesc = (Literal)e.Item.FindControl("ShortDesc"); HtmlContainerControl PostDesc = (HtmlContainerControl)e.Item.FindControl("PostDesc"); PostDesc.Visible = this.ShowPostDescription; RssItem item = (RssItem)e.Item.DataItem; PublishDate.Text = item.PubDate; Link.NavigateUrl = item.Link; Title.Text = item.Title; Title.NavigateUrl = item.Link; string shortDesc = item.Description; if (item.Description.Length > 130) shortDesc = item.Description.Substring(0, 120) + "..."; ShortDesc.Text = shortDesc; } } } }
32.626667
120
0.586024
[ "Apache-2.0" ]
MacdonaldRobinson/FlexDotnetCMS
WebApplication/Controls/Lists/BlogFeedList.ascx.cs
2,449
C#
using System; namespace Keeper.SharpMud { public interface IServer { event Action<ISession> NewSession; void Start(); void Stop(); } }
15.333333
43
0.554348
[ "MIT" ]
FacticiusVir/SharpMud
SharpMud/Keeper.SharpMud/IServer.cs
186
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using System; using System.Collections.Generic; using System.Linq; namespace Azure.ResourceManager.Sql.Models { /// <summary> The response to a list database metrics request. </summary> internal partial class MetricListResult { /// <summary> Initializes a new instance of MetricListResult. </summary> /// <param name="value"> The list of metrics for the database. </param> /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception> internal MetricListResult(IEnumerable<Metric> value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } Value = value.ToList(); } /// <summary> Initializes a new instance of MetricListResult. </summary> /// <param name="value"> The list of metrics for the database. </param> internal MetricListResult(IReadOnlyList<Metric> value) { Value = value; } /// <summary> The list of metrics for the database. </summary> public IReadOnlyList<Metric> Value { get; } } }
31.341463
99
0.627237
[ "MIT" ]
AME-Redmond/azure-sdk-for-net
sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/MetricListResult.cs
1,285
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNextGen.Batch.V20181201 { /// <summary> /// Contains information about an application in a Batch account. /// </summary> [AzureNextGenResourceType("azure-nextgen:batch/v20181201:Application")] public partial class Application : Pulumi.CustomResource { /// <summary> /// A value indicating whether packages within the application may be overwritten using the same version string. /// </summary> [Output("allowUpdates")] public Output<bool?> AllowUpdates { get; private set; } = null!; /// <summary> /// The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package. /// </summary> [Output("defaultVersion")] public Output<string?> DefaultVersion { get; private set; } = null!; /// <summary> /// The display name for the application. /// </summary> [Output("displayName")] public Output<string?> DisplayName { get; private set; } = null!; /// <summary> /// The ETag of the resource, used for concurrency statements. /// </summary> [Output("etag")] public Output<string> Etag { get; private set; } = null!; /// <summary> /// The name of the resource. /// </summary> [Output("name")] public Output<string> Name { get; private set; } = null!; /// <summary> /// The type of the resource. /// </summary> [Output("type")] public Output<string> Type { get; private set; } = null!; /// <summary> /// Create a Application resource with the given unique name, arguments, and options. /// </summary> /// /// <param name="name">The unique name of the resource</param> /// <param name="args">The arguments used to populate this resource's properties</param> /// <param name="options">A bag of options that control this resource's behavior</param> public Application(string name, ApplicationArgs args, CustomResourceOptions? options = null) : base("azure-nextgen:batch/v20181201:Application", name, args ?? new ApplicationArgs(), MakeResourceOptions(options, "")) { } private Application(string name, Input<string> id, CustomResourceOptions? options = null) : base("azure-nextgen:batch/v20181201:Application", name, null, MakeResourceOptions(options, id)) { } private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id) { var defaultOptions = new CustomResourceOptions { Version = Utilities.Version, Aliases = { new Pulumi.Alias { Type = "azure-nextgen:batch:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/latest:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20151201:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20170101:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20170501:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20170901:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20190401:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20190801:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20200301:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20200501:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20200901:Application"}, new Pulumi.Alias { Type = "azure-nextgen:batch/v20210101:Application"}, }, }; var merged = CustomResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. merged.Id = id ?? merged.Id; return merged; } /// <summary> /// Get an existing Application resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// </summary> /// /// <param name="name">The unique name of the resulting resource.</param> /// <param name="id">The unique provider ID of the resource to lookup.</param> /// <param name="options">A bag of options that control this resource's behavior</param> public static Application Get(string name, Input<string> id, CustomResourceOptions? options = null) { return new Application(name, id, options); } } public sealed class ApplicationArgs : Pulumi.ResourceArgs { /// <summary> /// The name of the Batch account. /// </summary> [Input("accountName", required: true)] public Input<string> AccountName { get; set; } = null!; /// <summary> /// A value indicating whether packages within the application may be overwritten using the same version string. /// </summary> [Input("allowUpdates")] public Input<bool>? AllowUpdates { get; set; } /// <summary> /// The name of the application. This must be unique within the account. /// </summary> [Input("applicationName")] public Input<string>? ApplicationName { get; set; } /// <summary> /// The package to use if a client requests the application but does not specify a version. This property can only be set to the name of an existing package. /// </summary> [Input("defaultVersion")] public Input<string>? DefaultVersion { get; set; } /// <summary> /// The display name for the application. /// </summary> [Input("displayName")] public Input<string>? DisplayName { get; set; } /// <summary> /// The name of the resource group that contains the Batch account. /// </summary> [Input("resourceGroupName", required: true)] public Input<string> ResourceGroupName { get; set; } = null!; public ApplicationArgs() { } } }
43.380645
165
0.60113
[ "Apache-2.0" ]
pulumi/pulumi-azure-nextgen
sdk/dotnet/Batch/V20181201/Application.cs
6,724
C#
/* * Copyright (c) 2013-present, SteamDB. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; using SteamKit2; namespace SteamDatabaseBackend { internal static class FileDownloader { private static readonly JsonSerializerSettings JsonHandleAllReferences = new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.All }; private static readonly JsonSerializerSettings JsonErrorMissing = new JsonSerializerSettings { MissingMemberHandling = MissingMemberHandling.Error }; private static readonly SemaphoreSlim ChunkDownloadingSemaphore = new SemaphoreSlim(10); private static Dictionary<uint, string> DownloadFolders; private static Dictionary<uint, Regex> Files; private static CDNClient CDNClient; public static void SetCDNClient(CDNClient cdnClient) { CDNClient = cdnClient; ReloadFileList(); var filesDir = Path.Combine(Application.Path, "files", ".support", "hashes"); Directory.CreateDirectory(filesDir); } public static void ReloadFileList() { Files = new Dictionary<uint, Regex>(); DownloadFolders = new Dictionary<uint, string>(); var file = Path.Combine(Application.Path, "files", "depots_mapping.json"); if (!File.Exists(file)) { Log.WriteWarn("FileDownloader", "files/depots_mapping.json not found."); return; } DownloadFolders = JsonConvert.DeserializeObject<Dictionary<uint, string>>(File.ReadAllText(file), JsonErrorMissing); file = Path.Combine(Application.Path, "files", "files.json"); if (!File.Exists(file)) { Log.WriteWarn("FileDownloader", "files/files.json not found. No files will be downloaded."); return; } var files = JsonConvert.DeserializeObject<Dictionary<uint, List<string>>>(File.ReadAllText(file), JsonErrorMissing); foreach (var depot in files) { var pattern = string.Format("^({0})$", string.Join("|", depot.Value.Select(ConvertFileMatch))); Files[depot.Key] = new Regex(pattern, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture); if (!DownloadFolders.ContainsKey(depot.Key)) { throw new InvalidDataException(string.Format("Missing depot mapping for depotid {0}.", depot.Key)); } } } public static string GetAppDownloadFolder(uint appID) { return DownloadFolders.ContainsKey(appID) ? DownloadFolders[appID] : null; } public static bool IsImportantDepot(uint depotID) { return Files.ContainsKey(depotID); } /* * Here be dragons. */ public static async Task<EResult> DownloadFilesFromDepot(DepotProcessor.ManifestJob job, DepotManifest depotManifest) { var files = depotManifest.Files.Where(x => IsFileNameMatching(job.DepotID, x.FileName)).ToList(); var downloadState = EResult.Fail; var hashesFile = Path.Combine(Application.Path, "files", ".support", "hashes", string.Format("{0}.json", job.DepotID)); ConcurrentDictionary<string, byte[]> hashes; if (File.Exists(hashesFile)) { hashes = JsonConvert.DeserializeObject<ConcurrentDictionary<string, byte[]>>(File.ReadAllText(hashesFile)); } else { hashes = new ConcurrentDictionary<string, byte[]>(); } foreach (var file in hashes.Keys.Except(files.Select(x => x.FileName))) { Log.WriteWarn(nameof(FileDownloader), $"\"{file}\" no longer exists in manifest"); } Log.WriteInfo($"FileDownloader {job.DepotID}", $"Will download {files.Count} files"); var downloadedFiles = 0; var fileTasks = new Task[files.Count]; for (var i = 0; i < fileTasks.Length; i++) { var file = files[i]; fileTasks[i] = TaskManager.Run(async () => { hashes.TryGetValue(file.FileName, out var hash); var fileState = await DownloadFile(job, file, hash); if (fileState == EResult.OK || fileState == EResult.SameAsPreviousValue) { hashes[file.FileName] = file.FileHash; downloadedFiles++; } if (fileState != EResult.SameAsPreviousValue) { // Do not write progress info to log file Console.WriteLine("{1} [{0,6:#00.00}%] {2} files left to download", downloadedFiles / (float)files.Count * 100.0f, job.DepotName, files.Count - downloadedFiles); } if (downloadState == EResult.DataCorruption) { return; } if (fileState == EResult.OK || fileState == EResult.DataCorruption) { downloadState = fileState; } }).Unwrap(); // Register error handler on inner task TaskManager.RegisterErrorHandler(fileTasks[i]); } await Task.WhenAll(fileTasks).ConfigureAwait(false); if (downloadState == EResult.OK) { File.WriteAllText(hashesFile, JsonConvert.SerializeObject(hashes)); job.Result = EResult.OK; } else if (downloadState == EResult.DataCorruption) { job.Result = EResult.DataCorruption; } else { job.Result = EResult.Ignored; } return job.Result; } private static async Task<EResult> DownloadFile(DepotProcessor.ManifestJob job, DepotManifest.FileData file, byte[] hash) { var directory = Path.Combine(Application.Path, "files", DownloadFolders[job.DepotID], Path.GetDirectoryName(file.FileName)); var finalPath = new FileInfo(Path.Combine(directory, Path.GetFileName(file.FileName))); var downloadPath = new FileInfo(Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), ".steamdb_tmp"))); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } else if (file.TotalSize == 0) { if (!finalPath.Exists) { await using (var _ = finalPath.Create()) { // FileInfo.Create returns a stream but we don't need it } Log.WriteInfo($"FileDownloader {job.DepotID}", $"{file.FileName} created an empty file"); return EResult.SameAsPreviousValue; } else if (finalPath.Length == 0) { #if DEBUG Log.WriteDebug($"FileDownloader {job.DepotID}", $"{file.FileName} is already empty"); #endif return EResult.SameAsPreviousValue; } } else if (hash != null && file.FileHash.SequenceEqual(hash)) { #if DEBUG Log.WriteDebug($"FileDownloader {job.DepotID}", $"{file.FileName} already matches the file we have"); #endif return EResult.SameAsPreviousValue; } byte[] checksum; using (var sha = SHA1.Create()) { checksum = sha.ComputeHash(Encoding.UTF8.GetBytes(file.FileName)); } var neededChunks = new List<DepotManifest.ChunkData>(); var chunks = file.Chunks.OrderBy(x => x.Offset).ToList(); var oldChunksFile = Path.Combine(Application.Path, "files", ".support", "chunks", string.Format("{0}-{1}.json", job.DepotID, BitConverter.ToString(checksum))); await using (var fs = downloadPath.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite)) { fs.SetLength((long)file.TotalSize); if (finalPath.Exists && File.Exists(oldChunksFile)) { var oldChunks = JsonConvert.DeserializeObject<List<DepotManifest.ChunkData>>(File.ReadAllText(oldChunksFile), JsonHandleAllReferences); await using var fsOld = finalPath.Open(FileMode.Open, FileAccess.Read); foreach (var chunk in chunks) { var oldChunk = oldChunks.Find(c => c.ChunkID.SequenceEqual(chunk.ChunkID)); if (oldChunk != null) { var oldData = new byte[oldChunk.UncompressedLength]; fsOld.Seek((long)oldChunk.Offset, SeekOrigin.Begin); fsOld.Read(oldData, 0, oldData.Length); var existingChecksum = Utils.AdlerHash(oldData); if (existingChecksum.SequenceEqual(chunk.Checksum)) { fs.Seek((long)chunk.Offset, SeekOrigin.Begin); fs.Write(oldData, 0, oldData.Length); #if DEBUG Log.WriteDebug($"FileDownloader {job.DepotID}", $"{file.FileName} Found chunk ({chunk.Offset}), not downloading"); #endif } else { neededChunks.Add(chunk); #if DEBUG Log.WriteDebug($"FileDownloader {job.DepotID}", $"{file.FileName} Found chunk ({chunk.Offset}), but checksum differs"); #endif } } else { neededChunks.Add(chunk); } } } else { neededChunks = chunks; } } using var chunkCancellation = new CancellationTokenSource(); var downloadedSize = file.TotalSize - (ulong)neededChunks.Sum(x => x.UncompressedLength); var chunkTasks = new Task[neededChunks.Count]; Log.WriteInfo($"FileDownloader {job.DepotID}", $"Downloading {file.FileName} ({downloadedSize} bytes, {neededChunks.Count} out of {chunks.Count} chunks)"); for (var i = 0; i < chunkTasks.Length; i++) { var chunk = neededChunks[i]; chunkTasks[i] = TaskManager.Run(async () => { try { chunkCancellation.Token.ThrowIfCancellationRequested(); await ChunkDownloadingSemaphore.WaitAsync(chunkCancellation.Token).ConfigureAwait(false); var result = await DownloadChunk(job, chunk, downloadPath); if (!result) { Log.WriteWarn($"FileDownloader {job.DepotID}", $"Failed to download chunk for {file.FileName} ({chunk.Offset})"); chunkCancellation.Cancel(); } else { downloadedSize += chunk.UncompressedLength; // Do not write progress info to log file Console.WriteLine("{2} [{0,6:#00.00}%] {1}", downloadedSize / (float)file.TotalSize * 100.0f, file.FileName, job.DepotName); } } finally { ChunkDownloadingSemaphore.Release(); } }).Unwrap(); // Register error handler on inner task TaskManager.RegisterErrorHandler(chunkTasks[i]); } await Task.WhenAll(chunkTasks).ConfigureAwait(false); await using (var fs = downloadPath.Open(FileMode.Open, FileAccess.ReadWrite)) { fs.Seek(0, SeekOrigin.Begin); using var sha = SHA1.Create(); checksum = sha.ComputeHash(fs); } if (!file.FileHash.SequenceEqual(checksum)) { IRC.Instance.SendOps("{0}[{1}]{2} Failed to correctly download {3}{4}", Colors.OLIVE, job.DepotName, Colors.NORMAL, Colors.BLUE, file.FileName); Log.WriteWarn($"FileDownloader {job.DepotID}", $"Hash check failed for {file.FileName} ({job.Server})"); downloadPath.Delete(); return EResult.DataCorruption; } Log.WriteInfo($"FileDownloader {job.DepotID}", $"Downloaded {file.FileName}"); finalPath.Delete(); downloadPath.MoveTo(finalPath.FullName); if (chunks.Count > 1) { File.WriteAllText(oldChunksFile, JsonConvert.SerializeObject(chunks, Formatting.None, JsonHandleAllReferences)); } else if (File.Exists(oldChunksFile)) { File.Delete(oldChunksFile); } return EResult.OK; } private static async Task<bool> DownloadChunk(DepotProcessor.ManifestJob job, DepotManifest.ChunkData chunk, FileInfo downloadPath) { for (var i = 0; i <= 5; i++) { try { var chunkData = await CDNClient.DownloadDepotChunkAsync(job.DepotID, chunk, job.Server, string.Empty, job.DepotKey); await using (var fs = downloadPath.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)) { fs.Seek((long)chunk.Offset, SeekOrigin.Begin); await fs.WriteAsync(chunkData.Data, 0, chunkData.Data.Length); } return true; } catch (Exception e) { Log.WriteWarn($"FileDownloader {job.DepotID}", $"Exception: {e}"); } await Task.Delay(Utils.ExponentionalBackoff(i)); } return false; } private static bool IsFileNameMatching(uint depotID, string fileName) { return Files[depotID].IsMatch(fileName.Replace('\\', '/')); } private static string ConvertFileMatch(string input) { if (input.StartsWith("regex:", StringComparison.Ordinal)) { return input.Substring(6); } return Regex.Escape(input); } } }
37.977995
185
0.531578
[ "BSD-3-Clause" ]
CN-HM/SteamDatabaseBackend
Processors/FileDownloader.cs
15,535
C#
/* Copyright (C) 2019 de4dot@gmail.com Copyright (C) 2021 hez2010@outlook.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; using System.Collections.Generic; using dnlib.DotNet; using dnlib.DotNet.Emit; namespace JitDasm { readonly struct StatementInfo { public readonly string Line; public readonly Span Span; public readonly bool Partial; public StatementInfo(string line, Span span, bool partial) { Line = line; Span = span; Partial = partial; } } readonly struct Span { public readonly int Start; public readonly int End; public int Length => End - Start; public Span(int start, int end) { if (start < 0) throw new ArgumentOutOfRangeException(nameof(start)); if (end < 0 || start > end) throw new ArgumentOutOfRangeException(nameof(end)); Start = start; End = end; } } sealed class SourceCodeProvider : IDisposable { readonly MetadataProvider metadataProvider; readonly SourceDocumentProvider sourceDocumentProvider; ModuleDef? lastModule; MethodDef? lastMethod; public SourceCodeProvider(MetadataProvider metadataProvider, SourceDocumentProvider sourceDocumentProvider) { this.metadataProvider = metadataProvider; this.sourceDocumentProvider = sourceDocumentProvider; } MethodDef? GetMetadataMethod(DisasmInfo method) { if (!StringComparer.OrdinalIgnoreCase.Equals(lastModule?.Location, method.ModuleFilename)) { lastModule = metadataProvider.GetModule(method.ModuleFilename); lastMethod = null; } if (lastModule?.PdbState is null) return null; if (lastMethod?.MDToken.Raw != method.MethodToken) lastMethod = lastModule?.ResolveToken(method.MethodToken) as MethodDef; return lastMethod; } public IEnumerable<StatementInfo> GetStatementLines(DisasmInfo method, int ilOffset) { var instrs = GetMetadataMethod(method)?.Body?.Instructions; if (instrs is null) yield break; var instr = GetInstruction(instrs, (uint)ilOffset); var seqPoint = instr?.SequencePoint; if (seqPoint is null) yield break; const int HIDDEN = 0xFEEFEE; if (seqPoint.StartLine == HIDDEN || seqPoint.EndLine == HIDDEN) yield break; foreach (var info in sourceDocumentProvider.GetLines(seqPoint.Document.Url, seqPoint.StartLine, seqPoint.StartColumn, seqPoint.EndLine, seqPoint.EndColumn)) yield return new StatementInfo(info.line, info.span, info.partial); } Instruction? GetInstruction(IList<Instruction> instructions, uint offset) { int lo = 0, hi = instructions.Count - 1; while (lo <= hi && hi != -1) { int i = (lo + hi) / 2; var instr = instructions[i]; if (instr.Offset == offset) return instr; if (offset < instr.Offset) hi = i - 1; else lo = i + 1; } return null; } public void Dispose() { lastModule = null; lastMethod = null; } } }
32.760684
159
0.739369
[ "MIT" ]
hez2010/JitDasm
JitDasm/SourceCodeProvider.cs
3,833
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace passGen.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("passGen.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; } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap app_window_add { get { object obj = ResourceManager.GetObject("app-window-add", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap bin_1 { get { object obj = ResourceManager.GetObject("bin-1", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap close { get { object obj = ResourceManager.GetObject("close", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap conversation_question_warning { get { object obj = ResourceManager.GetObject("conversation-question-warning", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap information_circle { get { object obj = ResourceManager.GetObject("information-circle", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap notes_checklist_flip { get { object obj = ResourceManager.GetObject("notes-checklist-flip", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap notes_diary { get { object obj = ResourceManager.GetObject("notes-diary", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// <summary> /// Looks up a localized resource of type System.Drawing.Bitmap. /// </summary> internal static System.Drawing.Bitmap pg_icon_white { get { object obj = ResourceManager.GetObject("pg_icon_white", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } } }
40.444444
173
0.571772
[ "MIT" ]
josh-wong/passGen
passGen/Properties/Resources.Designer.cs
5,826
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the sagemaker-2017-07-24.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.SageMaker.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.SageMaker.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for AppSpecification Object /// </summary> public class AppSpecificationUnmarshaller : IUnmarshaller<AppSpecification, XmlUnmarshallerContext>, IUnmarshaller<AppSpecification, JsonUnmarshallerContext> { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> AppSpecification IUnmarshaller<AppSpecification, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context) { throw new NotImplementedException(); } /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public AppSpecification Unmarshall(JsonUnmarshallerContext context) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) return null; AppSpecification unmarshalledObject = new AppSpecification(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("ContainerArguments", targetDepth)) { var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance); unmarshalledObject.ContainerArguments = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ContainerEntrypoint", targetDepth)) { var unmarshaller = new ListUnmarshaller<string, StringUnmarshaller>(StringUnmarshaller.Instance); unmarshalledObject.ContainerEntrypoint = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ImageUri", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; unmarshalledObject.ImageUri = unmarshaller.Unmarshall(context); continue; } } return unmarshalledObject; } private static AppSpecificationUnmarshaller _instance = new AppSpecificationUnmarshaller(); /// <summary> /// Gets the singleton. /// </summary> public static AppSpecificationUnmarshaller Instance { get { return _instance; } } } }
36.682692
161
0.632241
[ "Apache-2.0" ]
ChristopherButtars/aws-sdk-net
sdk/src/Services/SageMaker/Generated/Model/Internal/MarshallTransformations/AppSpecificationUnmarshaller.cs
3,815
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Menu_Time")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Menu_Time")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("37063df4-3445-4ccb-acda-812d5d6a6f5c")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
25.216216
56
0.714898
[ "Apache-2.0" ]
swimhigher/ContextMenu
src/Menu_Time/Properties/AssemblyInfo.cs
1,274
C#
 using LiveToLift.Models; using LiveToLift.Web.Infrastructure.Mapping; using System.Collections.Generic; namespace LiveToLift.Web.Infrastructure.Models { public class FitnessProgramViewModel : BaseViewModel,IMapFrom<FitnessProgram> { public string Name { get; set; } public string AuthorName { get; set; } public string PhotoUrl { get; set; } public string VideoUrl { get; set; } public string CreatorId { get; set; } public int OverallTrainingCount { get; set; } } }
24.272727
81
0.681648
[ "MIT" ]
ivansto01/LiveToFit
LiveToLift.Web.Infrastructure/Models/FitnessProgramViewModel.cs
536
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using Microsoft.MixedReality.Toolkit.Editor; using UnityEditor; using UnityEditor.Build; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.Utilities.Editor { /// <summary> /// Editor runtime controller for showing Project Configuration window and performance checks logging in current Unity project /// </summary> [InitializeOnLoad] public class MixedRealityEditorSettings : IActiveBuildTargetChanged { private const string SessionKey = "_MixedRealityToolkit_Editor_ShownSettingsPrompts"; private const string MSFT_AudioSpatializerPlugin = "MS HRTF Spatializer"; public MixedRealityEditorSettings() { callbackOrder = 0; } static MixedRealityEditorSettings() { // Detect when we enter player mode so we can try checking for optimal configuration EditorApplication.playModeStateChanged += OnPlayStateModeChanged; // Subscribe to editor application update which will call us once the editor is initialized and running EditorApplication.update += OnInit; } private static void OnInit() { // We only want to execute once to initialize, unsubscribe from update event EditorApplication.update -= OnInit; ShowProjectConfigurationDialog(); } /// <inheritdoc /> public int callbackOrder { get; private set; } /// <inheritdoc /> public void OnActiveBuildTargetChanged(BuildTarget previousTarget, BuildTarget newTarget) { IgnoreProjectConfigForSession = false; } /// <summary> /// Session state wrapper that tracks whether to ignore checking Project Configuration for the current Unity session /// </summary> public static bool IgnoreProjectConfigForSession { get => SessionState.GetBool(SessionKey, false); set => SessionState.SetBool(SessionKey, value); } private static void OnPlayStateModeChanged(PlayModeStateChange state) { if (state == PlayModeStateChange.EnteredPlayMode && MixedRealityProjectPreferences.RunOptimalConfiguration) { LogConfigurationWarnings(); } } private static void ShowProjectConfigurationDialog() { if (!EditorApplication.isPlayingOrWillChangePlaymode && !IgnoreProjectConfigForSession && !MixedRealityProjectPreferences.IgnoreSettingsPrompt && !MixedRealityProjectConfigurator.IsProjectConfigured()) { MixedRealityProjectConfiguratorWindow.ShowWindow(); } } /// <summary> /// Checks critical project settings and suggests changes to optimize performance via logged warnings /// </summary> private static void LogConfigurationWarnings() { // Ensure compatibility with the pre-2019.3 XR architecture for customers / platforms // with legacy requirements. if (!XRSettingsUtilities.LegacyXREnabled) { Debug.LogWarning("<b>Virtual reality supported</b> not enabled. Check <i>XR Settings</i> under <i>Player Settings</i>"); } if (!MixedRealityOptimizeUtils.IsSinglePassInstanced()) { Debug.LogWarning("XR stereo rendering mode not set to <b>Single Pass Instanced</b>. See <i>Mixed Reality Toolkit</i> > <i>Utilities</i> > <i>Optimize Window</i> tool for more information to improve performance"); } // If targeting Windows Mixed Reality platform if (MixedRealityOptimizeUtils.IsBuildTargetUWP()) { if (!MixedRealityOptimizeUtils.IsDepthBufferSharingEnabled()) { // If depth buffer sharing not enabled, advise to enable setting Debug.LogWarning("<b>Depth Buffer Sharing</b> is not enabled to improve hologram stabilization. See <i>Mixed Reality Toolkit</i> > <i>Utilities</i> > <i>Optimize Window</i> tool for more information to improve performance"); } if (!MixedRealityOptimizeUtils.IsWMRDepthBufferFormat16bit()) { // If depth format is 24-bit, advise to consider 16-bit for performance. Debug.LogWarning("<b>Depth Buffer Sharing</b> has 24-bit depth format selected. Consider using 16-bit for performance. See <i>Mixed Reality Toolkit</i> > <i>Utilities</i> > <i>Optimize Window</i> tool for more information to improve performance"); } if (!AudioSettings.GetSpatializerPluginName().Equals(MSFT_AudioSpatializerPlugin)) { // If using UWP, developers should use the Microsoft Audio Spatializer plugin Debug.LogWarning("<b>Audio Spatializer Plugin</b> not currently set to <i>" + MSFT_AudioSpatializerPlugin + "</i>. Switch to <i>" + MSFT_AudioSpatializerPlugin + "</i> under <i>Project Settings</i> > <i>Audio</i> > <i>Spatializer Plugin</i>"); } } } } }
45.841667
268
0.624068
[ "MIT" ]
ForrestTrepte/azure-remote-rendering
Unity/Tutorial-Complete/Assets/MixedRealityToolkit/Inspectors/Setup/MixedRealityEditorSettings.cs
5,503
C#
//------------------------------------------------------------------------------ // <auto-generated /> // // This file was automatically generated by SWIG (http://www.swig.org). // Version 3.0.10 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. //------------------------------------------------------------------------------ using System; using System.Runtime.InteropServices; namespace Noesis { public class DataTemplateSelector : BaseComponent { internal new static DataTemplateSelector CreateProxy(IntPtr cPtr, bool cMemoryOwn) { return new DataTemplateSelector(cPtr, cMemoryOwn); } internal DataTemplateSelector(IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) { } internal static HandleRef getCPtr(DataTemplateSelector obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; } protected DataTemplateSelector() { } public virtual DataTemplate SelectTemplate(object item, DependencyObject container) { return null; } new internal static IntPtr GetStaticType() { IntPtr ret = NoesisGUI_PINVOKE.DataTemplateSelector_GetStaticType(); if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve(); return ret; } internal new static IntPtr Extend(string typeName) { IntPtr nativeType = NoesisGUI_PINVOKE.Extend_DataTemplateSelector(Marshal.StringToHGlobalAnsi(typeName)); if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve(); return nativeType; } } }
30.679245
112
0.687577
[ "MIT" ]
WaveEngine/Extensions
WaveEngine.NoesisGUI/Shared/Proxies/DataTemplateSelector.cs
1,626
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 kendra-2019-02-03.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.Kendra.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.Kendra.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for ListIndices operation /// </summary> public class ListIndicesResponseUnmarshaller : 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) { ListIndicesResponse response = new ListIndicesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("IndexConfigurationSummaryItems", targetDepth)) { var unmarshaller = new ListUnmarshaller<IndexConfigurationSummary, IndexConfigurationSummaryUnmarshaller>(IndexConfigurationSummaryUnmarshaller.Instance); response.IndexConfigurationSummaryItems = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = 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("InternalServerException")) { return InternalServerExceptionUnmarshaller.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 AmazonKendraException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode); } private static ListIndicesResponseUnmarshaller _instance = new ListIndicesResponseUnmarshaller(); internal static ListIndicesResponseUnmarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static ListIndicesResponseUnmarshaller Instance { get { return _instance; } } } }
41.1875
190
0.624241
[ "Apache-2.0" ]
philasmar/aws-sdk-net
sdk/src/Services/Kendra/Generated/Model/Internal/MarshallTransformations/ListIndicesResponseUnmarshaller.cs
5,272
C#
// ------------------------------------------------------------------------------------------------- // Copyright (c) Matt Fraser. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // ------------------------------------------------------------------------------------------------- namespace AmVinDecoderLib.VinComponents.Enums; public enum ModelType { /// <summary> /// Default value. The value has not been set. /// </summary> Unknown, /// <summary> /// DB9 Coupe /// </summary> Db9Coupe, /// <summary> /// DB9 Volante /// </summary> Db9Volante, /// <summary> /// V8/V8S Coupe /// </summary> V8VantageCoupe, /// <summary> /// V8/V8S Roadster /// </summary> V8VantageRoadster, /// <summary> /// DBS /// </summary> Dbs, /// <summary> /// DBS Coupe /// </summary> DbsCoupe, /// <summary> /// DBS Volante /// </summary> DbsVolante, /// <summary> /// Rapide /// </summary> Rapide, /// <summary> /// Virage Coupe /// </summary> VirageCoupe, /// <summary> /// Virage Volante /// </summary> VirageVolante, /// <summary> /// Vanquish Coupe /// </summary> VanquishCoupe, /// <summary> /// Vanquish Volante /// </summary> VanquishVolante, /// <summary> /// Vanquish Zagato Coupe /// </summary> VanquishZagatoCoupe, /// <summary> /// Vanquish Zagato Volante /// </summary> VanquishZagatoVolante, /// <summary> /// DB11 Coupe /// </summary> Db11Coupe, /// <summary> /// DB11 Volante /// </summary> Db11Volante, /// <summary> /// DB11 AMR /// </summary> Db11Amr, /// <summary> /// New Vantage Coupe /// </summary> NewVantageCoupe, /// <summary> /// New DBS Coupe /// </summary> NewDbsCoupe, /// <summary> /// New DBS Volante /// </summary> NewDbsVolante, /// <summary> /// V12 Vantage Coupe /// </summary> V12VantageCoupe, /// <summary> /// V12 Vantage Roadster /// </summary> V12VantageRoadster, /// <summary> /// V12 Vantage S Coupe /// </summary> V12VantageSCoupe, /// <summary> /// V12 Vantage S Roadster /// </summary> V12VantageSRoadster, /// <summary> /// Cygnet /// </summary> Cygnet, /// <summary> /// DBX /// </summary> Dbx, }
17.6
101
0.471395
[ "MIT" ]
LiquidPT/am-vin-decoder
src/AmVinDecoderLib/VinComponents/Enums/ModelType.cs
2,554
C#
using AdvanceSteel.Nodes.Plates; using Autodesk.AdvanceSteel.CADAccess; using Autodesk.DesignScript.Runtime; using DynGeometry = Autodesk.DesignScript.Geometry; using SteelGeometry = Autodesk.AdvanceSteel.Geometry; using SteelServices = Dynamo.Applications.AdvanceSteel.Services; using Autodesk.AdvanceSteel.ConstructionTypes; using System.Collections.Generic; using Autodesk.AdvanceSteel.Geometry; using System.Linq; using System; namespace AdvanceSteel.Nodes.ConnectionObjects.Bolts { /// <summary> /// Advance Steel Circular Bolt Pattern /// </summary> [DynamoServices.RegisterForTrace] public class CircularBoltPattern : GraphicObject { internal CircularBoltPattern() { } internal CircularBoltPattern(SteelGeometry.Point3d holeInsertPoint, IEnumerable<string> handlesToConnect, SteelGeometry.Vector3d vx, SteelGeometry.Vector3d vy, List<Property> boltData, int boltCon) { lock (access_obj) { using (var ctx = new SteelServices.DocContext()) { Autodesk.AdvanceSteel.Modelling.CircleScrewBoltPattern bolts = null; string handle = SteelServices.ElementBinder.GetHandleFromTrace(); if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null) { bolts = new Autodesk.AdvanceSteel.Modelling.CircleScrewBoltPattern(holeInsertPoint, vx, vy); Utils.SetParameters(bolts, boltData); bolts.WriteToDb(); } else { bolts = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.CircleScrewBoltPattern; if (bolts != null && bolts.IsKindOf(FilerObject.eObjectType.kCircleScrewBoltPattern)) { bolts.RefPoint = holeInsertPoint; bolts.XDirection = vx; bolts.YDirection = vy; Utils.SetParameters(bolts, boltData); } else throw new System.Exception("Not a circular pattern"); } FilerObject[] filerObjects = Utils.GetFilerObjects(handlesToConnect); bolts.Connect(filerObjects, (AtomicElement.eAssemblyLocation)boltCon); Handle = bolts.Handle; SteelServices.ElementBinder.CleanupAndSetElementForTrace(bolts); } } } /// <summary> /// Create an Advance Steel Circular Bolt Pattern By Circle /// </summary> /// <param name="circle"> Input circle</param> /// <param name="referenceVector"> Input Dynamo Vector for alignment of circle</param> /// <param name="objectsToConnect"> Input Objects to be bolted </param> /// <param name="boltConnectionType"> Input Bolt Connection type - Shop Bolt Default</param> /// <param name="additionalBoltParameters"> Optional Input Bolt Build Properties </param> /// <returns name="circularBoltPattern"> bolts</returns> public static CircularBoltPattern ByCircle(DynGeometry.Circle circle, DynGeometry.Vector referenceVector, IEnumerable<SteelDbObject> objectsToConnect, [DefaultArgument("2;")] int boltConnectionType, [DefaultArgument("null")] List<Property> additionalBoltParameters) { var norm = Utils.ToAstVector3d(circle.Normal, true); var vx = Utils.ToAstVector3d(referenceVector, true); var vy = norm.CrossProduct(vx); vx = vx.Normalize(); vy = vy.Normalize(); additionalBoltParameters = PreSetCircularValuesInListProps(additionalBoltParameters, Utils.ToInternalDistanceUnits(circle.Radius, true)); List<string> handlesList = Utils.GetSteelDbObjectsToConnect(objectsToConnect); return new CircularBoltPattern(Utils.ToAstPoint(circle.CenterPoint, true), handlesList, vx, vy, additionalBoltParameters, boltConnectionType); } /// <summary> /// Create an Advance Steel Circular Bolt Pattern By Center Point Radius Normal /// </summary> /// <param name="point"> Input radius center point</param> /// <param name="boltCS"> Input Coordinate System </param> /// <param name="objectsToConnect"> Input Objects to be bolted </param> /// <param name="boltConnectionType"> Input Bolt Connection type - Shop Bolt Default</param> /// <param name="additionalBoltParameters"> Optional Input Bolt Build Properties </param> /// <returns name="circularBoltPattern"> bolts</returns> public static CircularBoltPattern AtCentrePoint(DynGeometry.Point point, DynGeometry.CoordinateSystem boltCS, IEnumerable<SteelDbObject> objectsToConnect, [DefaultArgument("2;")] int boltConnectionType, [DefaultArgument("null")] List<Property> additionalBoltParameters) { SteelGeometry.Point3d astPointRef = Utils.ToAstPoint(point, true); var vx = Utils.ToAstVector3d(boltCS.XAxis, true); var vy = Utils.ToAstVector3d(boltCS.YAxis, true); vx = vx.Normalize(); vy = vy.Normalize(); IEnumerable<string> handles = Utils.GetSteelDbObjectsToConnect(objectsToConnect); return new CircularBoltPattern(Utils.ToAstPoint(point, true), handles, vx, vy, additionalBoltParameters, boltConnectionType); } private static List<Property> PreSetCircularValuesInListProps(List<Property> listOfBoltParameters, double radius) { if (listOfBoltParameters == null) { listOfBoltParameters = new List<Property>() { }; } Utils.CheckListUpdateOrAddValue(listOfBoltParameters, "Radius", radius); return listOfBoltParameters; } [IsVisibleInDynamoLibrary(false)] public override Autodesk.DesignScript.Geometry.Curve GetDynCurve() { lock (access_obj) { using (var ctx = new SteelServices.DocContext()) { var boltPattern = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.CircleScrewBoltPattern; if (boltPattern == null) { throw new Exception("Null bolt pattern"); } using (var point = Utils.ToDynPoint(boltPattern.RefPoint, true)) using (var norm = Utils.ToDynVector(boltPattern.Normal, true)) { return Autodesk.DesignScript.Geometry.Circle.ByCenterPointRadiusNormal(point, Utils.FromInternalDistanceUnits(boltPattern.Radius, true), norm); } } } } } }
41.9375
155
0.645007
[ "Apache-2.0" ]
DynamoDS/Dynamo-Advance-Steel
src/AdvanceSteelNodes/ConnectionObjects/CircularBoltPattern.cs
6,712
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 using System; namespace ClearCanvas.ImageServer.Enterprise { /// <summary> /// Class representing the primary key of a <see cref="ServerEntity"/> object. /// </summary> [Serializable] public class ServerEntityKey { #region Private Members private readonly object _key; private readonly String _name; #endregion #region Constructors /// <summary> /// Constructor. /// </summary> /// <param name="name">The name of the <see cref="ServerEntity"/>.</param> /// <param name="entityKey">The primary key object itself.</param> public ServerEntityKey(String name, object entityKey) { _name = name; _key = entityKey; } #endregion #region Public Properties /// <summary> /// The primary key itself. /// </summary> public object Key { get { return _key; } } /// <summary> /// The name of the <see cref="ServerEntity"/>. /// </summary> public String EntityName { get { return _name; } } #endregion #region Public Overrides public override int GetHashCode() { return _key.GetHashCode(); } public override bool Equals(object obj) { ServerEntityKey key = obj as ServerEntityKey; if (key == null) return false; return _key.Equals(key.Key); } public override string ToString() { return _key.ToString(); } #endregion } }
31.831776
87
0.616265
[ "Apache-2.0" ]
econmed/ImageServer20
ImageServer/Enterprise/ServerEntityKey.cs
3,408
C#
using System; using System.Threading.Tasks; namespace StackExchange.Redis { internal abstract partial class RedisBase : IRedis { internal static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); internal readonly ConnectionMultiplexer multiplexer; protected readonly object asyncState; internal RedisBase(ConnectionMultiplexer multiplexer, object asyncState) { this.multiplexer = multiplexer; this.asyncState = asyncState; } IConnectionMultiplexer IRedisAsync.Multiplexer => multiplexer; public virtual TimeSpan Ping(CommandFlags flags = CommandFlags.None) { var msg = GetTimerMessage(flags); return ExecuteSync(msg, ResultProcessor.ResponseTimer); } public virtual Task<TimeSpan> PingAsync(CommandFlags flags = CommandFlags.None) { var msg = GetTimerMessage(flags); return ExecuteAsync(msg, ResultProcessor.ResponseTimer); } public override string ToString() => multiplexer.ToString(); public bool TryWait(Task task) => task.Wait(multiplexer.TimeoutMilliseconds); public void Wait(Task task) => multiplexer.Wait(task); public T Wait<T>(Task<T> task) => multiplexer.Wait(task); public void WaitAll(params Task[] tasks) => multiplexer.WaitAll(tasks); internal virtual Task<T> ExecuteAsync<T>(Message message, ResultProcessor<T> processor, ServerEndPoint server = null) { if (message == null) return CompletedTask<T>.Default(asyncState); multiplexer.CheckMessage(message); return multiplexer.ExecuteAsyncImpl<T>(message, processor, asyncState, server); } internal virtual T ExecuteSync<T>(Message message, ResultProcessor<T> processor, ServerEndPoint server = null) { if (message == null) return default(T); // no-op multiplexer.CheckMessage(message); return multiplexer.ExecuteSyncImpl<T>(message, processor, server); } internal virtual RedisFeatures GetFeatures(in RedisKey key, CommandFlags flags, out ServerEndPoint server) { server = multiplexer.SelectServer(RedisCommand.PING, flags, key); var version = server == null ? multiplexer.RawConfig.DefaultVersion : server.Version; return new RedisFeatures(version); } protected static void WhenAlwaysOrExists(When when) { switch (when) { case When.Always: case When.Exists: break; default: throw new ArgumentException(when + " is not valid in this context; the permitted values are: Always, Exists"); } } protected static void WhenAlwaysOrExistsOrNotExists(When when) { switch (when) { case When.Always: case When.Exists: case When.NotExists: break; default: throw new ArgumentException(when + " is not valid in this context; the permitted values are: Always, Exists, NotExists"); } } protected static void WhenAlwaysOrNotExists(When when) { switch (when) { case When.Always: case When.NotExists: break; default: throw new ArgumentException(when + " is not valid in this context; the permitted values are: Always, NotExists"); } } private ResultProcessor.TimingProcessor.TimerMessage GetTimerMessage(CommandFlags flags) { // do the best we can with available commands var map = multiplexer.CommandMap; if (map.IsAvailable(RedisCommand.PING)) return ResultProcessor.TimingProcessor.CreateMessage(-1, flags, RedisCommand.PING); if (map.IsAvailable(RedisCommand.TIME)) return ResultProcessor.TimingProcessor.CreateMessage(-1, flags, RedisCommand.TIME); if (map.IsAvailable(RedisCommand.ECHO)) return ResultProcessor.TimingProcessor.CreateMessage(-1, flags, RedisCommand.ECHO, RedisLiterals.PING); // as our fallback, we'll do something odd... we'll treat a key like a value, out of sheer desperation // note: this usually means: twemproxy - in which case we're fine anyway, since the proxy does the routing return ResultProcessor.TimingProcessor.CreateMessage(0, flags, RedisCommand.EXISTS, (RedisValue)multiplexer.UniqueId); } internal static class CursorUtils { internal const long Origin = 0; internal const int DefaultRedisPageSize = 10, DefaultLibraryPageSize = 250; internal static bool IsNil(in RedisValue pattern) { if (pattern.IsNullOrEmpty) return true; if (pattern.IsInteger) return false; byte[] rawValue = pattern; return rawValue.Length == 1 && rawValue[0] == '*'; } } } }
40.465649
141
0.607998
[ "Apache-2.0" ]
rkarthick/StackExchange.Redis
src/StackExchange.Redis/RedisBase.cs
5,303
C#
namespace Employees.App.Core.Commands { using Contracts; using Dtos; public class EmployeeInfoCommand : ICommand { private readonly IEmployeeController employeeController; public EmployeeInfoCommand(IEmployeeController employeeController) { this.employeeController = employeeController; } public string Execute(string[] args) { int employeeId = int.Parse(args[0]); EmployeeDto employeeDto = this.employeeController.GetEmployeeInfo(employeeId); return $"ID: {employeeDto.Id} - {employeeDto.FirstName} {employeeDto.LastName} - ${employeeDto.Salary:f2}"; } } }
27.52
119
0.655523
[ "MIT" ]
ViktorAleksandrov/SoftUni--CSharp-DB-Fundamentals
Databases Advanced - Entity Framework/08. Auto Mapping Objects/Employees.App/Core/Commands/EmployeeInfoCommand.cs
690
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("DevelopmentInProgress.AuthorisationManager.Data")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DevelopmentInProgress.AuthorisationManager.Data")] [assembly: AssemblyCopyright("Copyright © 2016")] [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("82894f8e-8899-42b1-8fba-83a49e985dcf")] // 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.648649
84
0.754601
[ "Apache-2.0" ]
grantcolley/authorisationmanager
Data/DevelopmentInProgress.AuthorisationManager.Data/Properties/AssemblyInfo.cs
1,470
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class StopMusic : MonoBehaviour { // Update is called once per frame void Update() { } }
13.6
38
0.666667
[ "MIT" ]
SolomonRosemite/Unity-FutureCube
FutureCube/Assets/Assets/Game Jam Template/Scripts/Menu/StopMusic.cs
206
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; using Benchmarks.ClientJob; using Benchmarks.ServerJob; using Newtonsoft.Json; namespace BenchmarksDriver.Serializers { public class H2LoadSerializer : IResultsSerializer { public string JobLogText { get; set; } private static void Log(string message) { var time = DateTime.Now.ToString("hh:mm:ss.fff"); Console.WriteLine($"[{time}] {message}"); } public async Task WriteJobResultsToSqlAsync( ServerJob serverJob, ClientJob clientJob, string sqlConnectionString, string tableName, string path, string session, string description, Statistics statistics, bool longRunning) { var utcNow = DateTime.UtcNow; await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "RequestsPerSecond", value: statistics.RequestsPerSecond); if (statistics.StartupMain != -1 && !longRunning) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "Startup Main (ms)", value: statistics.StartupMain); } if (statistics.BuildTime != -1 && !longRunning) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "Build Time (ms)", value: statistics.BuildTime); } if (statistics.PublishedSize != -1 && !longRunning) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "Published Size (KB)", value: statistics.PublishedSize); } if (statistics.FirstRequest != -1 && !longRunning) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "First Request (ms)", value: statistics.FirstRequest); } await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "WorkingSet (MB)", value: statistics.WorkingSet); await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "CPU", value: statistics.Cpu); if (statistics.Latency != -1 && !longRunning) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, session: session, description: description, path: serverJob.Path, dimension: "Latency (ms)", value: statistics.Latency); } if (statistics.LatencyAverage != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "LatencyAverage (ms)", value: statistics.LatencyAverage); } if (statistics.Latency50Percentile != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "Latency50Percentile (ms)", value: statistics.Latency50Percentile); } if (statistics.Latency75Percentile != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "Latency75Percentile (ms)", value: statistics.Latency75Percentile); } if (statistics.Latency90Percentile != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "Latency90Percentile (ms)", value: statistics.Latency90Percentile); } if (statistics.Latency99Percentile != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "Latency99Percentile (ms)", value: statistics.Latency99Percentile); } if (statistics.MaxLatency != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "MaxLatency (ms)", value: statistics.MaxLatency); } if (statistics.SocketErrors != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "SocketErrors", value: statistics.SocketErrors); } if (statistics.BadResponses != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "BadResponses", value: statistics.BadResponses); } if (statistics.TotalRequests != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "TotalRequests", value: statistics.TotalRequests); } if (statistics.Duration != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: "Duration (ms)", value: statistics.Duration); } if (statistics.Other.Any()) { foreach (var counter in Program.Counters) { if (!statistics.Other.ContainsKey(counter.Name)) { continue; } if (statistics.Other[counter.Name] != -1) { await WriteJobsToSql( serverJob: serverJob, clientJob: clientJob, utcNow: utcNow, connectionString: sqlConnectionString, tableName: tableName, path: serverJob.Path, session: session, description: description, dimension: counter.DisplayName, value: statistics.Other[counter.Name]); } } } } private Task WriteJobsToSql(ServerJob serverJob, ClientJob clientJob, DateTime utcNow, string connectionString, string tableName, string path, string session, string description, string dimension, double value) { return RetryOnExceptionAsync(5, () => WriteResultsToSql( utcNow, connectionString: connectionString, tableName: tableName, scenario: serverJob.Scenario, session: session, description: description, aspnetCoreVersion: serverJob.AspNetCoreVersion, runtimeVersion: serverJob.RuntimeVersion, hardware: serverJob.Hardware.Value, hardwareVersion: serverJob.HardwareVersion, operatingSystem: serverJob.OperatingSystem.Value, scheme: serverJob.Scheme, source: serverJob.Source, webHost: serverJob.WebHost, kestrelThreadCount: serverJob.KestrelThreadCount, clientThreads: clientJob.Threads, connections: clientJob.Connections, duration: clientJob.Duration, pipelineDepth: clientJob.PipelineDepth, path: path, method: clientJob.Method, headers: clientJob.Headers, dimension: dimension, value: value, runtimeStore: serverJob.UseRuntimeStore) , 5000); } public async Task InitializeDatabaseAsync(string connectionString, string tableName) { string createCmd = @" IF OBJECT_ID(N'dbo." + tableName + @"', N'U') IS NULL BEGIN CREATE TABLE [dbo].[" + tableName + @"]( [Id] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY, [Excluded] [bit] DEFAULT 0, [DateTime] [datetimeoffset](7) NOT NULL, [Session] [nvarchar](200) NOT NULL, [Description] [nvarchar](200), [AspNetCoreVersion] [nvarchar](50) NOT NULL, [RuntimeVersion] [nvarchar](50) NOT NULL, [Scenario] [nvarchar](200) NOT NULL, [Hardware] [nvarchar](50) NOT NULL, [HardwareVersion] [nvarchar](128) NOT NULL, [OperatingSystem] [nvarchar](50) NOT NULL, [Framework] [nvarchar](50) NOT NULL, [RuntimeStore] [bit] NOT NULL, [Scheme] [nvarchar](50) NOT NULL, [WebHost] [nvarchar](50) NOT NULL, [KestrelThreadCount] [int] NULL, [ClientThreads] [int] NOT NULL, [Connections] [int] NOT NULL, [Duration] [int] NOT NULL, [PipelineDepth] [int] NULL, [Path] [nvarchar](200) NULL, [Method] [nvarchar](50) NOT NULL, [Headers] [nvarchar](max) NULL, [Dimension] [nvarchar](50) NOT NULL, [Value] [float] NOT NULL ) END "; using (var connection = new SqlConnection(connectionString)) { await connection.OpenAsync(); using (var command = new SqlCommand(createCmd, connection)) { await command.ExecuteNonQueryAsync(); } } } private async Task WriteResultsToSql( DateTime utcNow, string connectionString, string tableName, string session, string description, string aspnetCoreVersion, string runtimeVersion, string scenario, Hardware hardware, string hardwareVersion, Benchmarks.ServerJob.OperatingSystem operatingSystem, Scheme scheme, Source source, WebHost webHost, int? kestrelThreadCount, int clientThreads, int connections, int duration, int? pipelineDepth, string path, string method, IDictionary<string, string> headers, string dimension, double value, bool runtimeStore) { string insertCmd = @" INSERT INTO [dbo].[" + tableName + @"] ([DateTime] ,[Session] ,[Description] ,[AspNetCoreVersion] ,[RuntimeVersion] ,[Scenario] ,[Hardware] ,[HardwareVersion] ,[OperatingSystem] ,[Framework] ,[RuntimeStore] ,[Scheme] ,[WebHost] ,[KestrelThreadCount] ,[ClientThreads] ,[Connections] ,[Duration] ,[PipelineDepth] ,[Path] ,[Method] ,[Headers] ,[Dimension] ,[Value]) VALUES (@DateTime ,@Session ,@Description ,@AspNetCoreVersion ,@RuntimeVersion ,@Scenario ,@Hardware ,@HardwareVersion ,@OperatingSystem ,@Framework ,@RuntimeStore ,@Scheme ,@WebHost ,@KestrelThreadCount ,@ClientThreads ,@Connections ,@Duration ,@PipelineDepth ,@Path ,@Method ,@Headers ,@Dimension ,@Value) "; using (var connection = new SqlConnection(connectionString)) { await connection.OpenAsync(); var transaction = connection.BeginTransaction(); try { var command = new SqlCommand(insertCmd, connection, transaction); var p = command.Parameters; p.AddWithValue("@DateTime", utcNow); p.AddWithValue("@Session", session); p.AddWithValue("@Description", description); p.AddWithValue("@AspNetCoreVersion", aspnetCoreVersion); p.AddWithValue("@RuntimeVersion", runtimeVersion); p.AddWithValue("@Scenario", scenario.ToString()); p.AddWithValue("@Hardware", hardware.ToString()); p.AddWithValue("@HardwareVersion", hardwareVersion); p.AddWithValue("@OperatingSystem", operatingSystem.ToString()); p.AddWithValue("@Framework", "Core"); p.AddWithValue("@RuntimeStore", runtimeStore); p.AddWithValue("@Scheme", scheme.ToString().ToLowerInvariant()); p.AddWithValue("@WebHost", webHost.ToString()); p.AddWithValue("@KestrelThreadCount", (object)kestrelThreadCount ?? DBNull.Value); p.AddWithValue("@ClientThreads", clientThreads); p.AddWithValue("@Connections", connections); p.AddWithValue("@Duration", duration); p.AddWithValue("@PipelineDepth", (object)pipelineDepth ?? DBNull.Value); p.AddWithValue("@Path", string.IsNullOrEmpty(path) ? (object)DBNull.Value : path); p.AddWithValue("@Method", method.ToString().ToUpperInvariant()); p.AddWithValue("@Headers", headers.Any() ? JsonConvert.SerializeObject(headers) : (object)DBNull.Value); p.AddWithValue("@Dimension", dimension); p.AddWithValue("@Value", value); await command.ExecuteNonQueryAsync(); transaction.Commit(); } catch { transaction.Rollback(); throw; } finally { transaction.Dispose(); } } } private static string ConvertToSqlString(Source source) { const string aspnetPrefix = "https://github.com/aspnet/"; const string gitSuffix = ".git"; var shortRepository = source.Repository; if (shortRepository.StartsWith(aspnetPrefix)) { shortRepository = shortRepository.Substring(aspnetPrefix.Length); } if (shortRepository.EndsWith(gitSuffix)) { shortRepository = shortRepository.Substring(0, shortRepository.Length - gitSuffix.Length); } if (string.IsNullOrEmpty(source.BranchOrCommit)) { return shortRepository; } else { return shortRepository + "@" + source.BranchOrCommit; } } private async static Task RetryOnExceptionAsync(int retries, Func<Task> operation, int milliSecondsDelay = 0) { var attempts = 0; do { try { attempts++; await operation(); return; } catch (Exception e) { if (attempts == retries + 1) { throw; } Log($"Attempt {attempts} failed: {e.Message}"); if (milliSecondsDelay > 0) { await Task.Delay(milliSecondsDelay); } } } while (true); } public void Dispose() { } public void ComputeAverages(Statistics average, IEnumerable<Statistics> samples) { // No custom values } } }
37.556856
218
0.463689
[ "Apache-2.0" ]
Bhekinkosi12/Benchmarks
src/BenchmarksDriver/Serializers/H2LoadSerializer.cs
22,461
C#
namespace RpcModel { /// <summary> /// 获取远程服务器配置 /// </summary> public class GetRemoteServerRes { /// <summary> /// /// </summary> public GetRemoteServerRes() { } /// <summary> /// 服务器配置 /// </summary> public RpcServerConfig ServerConfig { get; set; } } }
21.076923
51
0.301095
[ "Apache-2.0" ]
tc303730352/WedonekRpcFrame
Source/RpcModel/Server/GetRemoteServerRes.cs
578
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public enum Dir { XY, ZY, XZ } public class TextureAutoTiler : MonoBehaviour { [Header("Scales the local copy of the material by the objects scale when the game runs.")] [Tooltip("Removes this script when the game starts.")] public bool destroyOnStart = false; [Tooltip("Sets which object-scale directions should be used.")] public Dir scaleDirection; [Tooltip("Tweaks the material scale further.")] public float additionalScaleFactor = 1f; // Start is called before the first frame update void Start() { ScaleTexture(); if (destroyOnStart) { Destroy(this); } } private void OnValidate() { ScaleTexture(); } void ScaleTexture() { if (Application.IsPlaying(gameObject)) { Renderer renderer = transform.GetComponent<Renderer>(); switch (scaleDirection) { case Dir.XY: renderer.material.mainTextureScale = new Vector2(transform.localScale.x * additionalScaleFactor, transform.localScale.y * additionalScaleFactor); break; case Dir.ZY: renderer.material.mainTextureScale = new Vector2(transform.localScale.z * additionalScaleFactor, transform.localScale.y * additionalScaleFactor); break; case Dir.XZ: renderer.material.mainTextureScale = new Vector2(transform.localScale.x * additionalScaleFactor, transform.localScale.z * additionalScaleFactor); break; } //Debug.Log("Rescaled texture on object"); } } }
31.912281
166
0.595932
[ "MIT" ]
Grailas/CodingPiratesAalborg
Projects/2018/RollABallPlus/Assets/_Completed-Game/Scripts/TextureAutoTiler.cs
1,821
C#
namespace eWAY.Rapid.Internals.Enums { internal enum CustomView { Default, Custom, Bootstrap, BootstrapAmelia, BootstrapCerulean, BootstrapCosmo, BootstrapCyborg, BootstrapFlatly, BootstrapJournal, BootstrapReadable, BootstrapSimplex, BootstrapSlate, BootstrapSpacelab, BootstrapUnited, Modal, } }
19.590909
37
0.584687
[ "MIT" ]
A5hpat/eway-rapid-net
eWAY.Rapid/Internals/Enums/CustomView.cs
433
C#
// ================================================================================================================================= // Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information. // ================================================================================================================================= using RapidField.SolidInstruments.Command; using RapidField.SolidInstruments.Core.ArgumentValidation; using RapidField.SolidInstruments.EventAuthoring; using RapidField.SolidInstruments.Messaging.EventMessages; using System; using System.Diagnostics; using System.Runtime.Serialization; using SolidInstrumentsCommand = RapidField.SolidInstruments.Command.Command; namespace RapidField.SolidInstruments.Messaging.CommandMessages { /// <summary> /// Represents a message that contains a command that can be described by an <see cref="IEvent" />. /// </summary> /// <remarks> /// <see cref="CommandMessage{TCommand, TEvent, TEventMessage}" /> is the default implementation of /// <see cref="IReportableCommandMessage{TCommand, TEvent, TEventMessage}" />. /// </remarks> /// <typeparam name="TCommand"> /// The type of the associated command. /// </typeparam> /// <typeparam name="TEvent"> /// The type of the event that describes the command. /// </typeparam> /// <typeparam name="TEventMessage"> /// The type of the event message that is published by the processor if <see cref="IReportableCommandMessage.IsReported" /> is /// <see langword="true" />. /// </typeparam> [DataContract] public abstract class CommandMessage<TCommand, TEvent, TEventMessage> : CommandMessage<TCommand>, IReportableCommandMessage<TCommand, TEvent, TEventMessage> where TEvent : Event, new() where TCommand : SolidInstrumentsCommand, IReportableCommand<TEvent>, new() where TEventMessage : EventMessage<TEvent>, IEventMessage<TEvent>, new() { /// <summary> /// Initializes a new instance of the <see cref="CommandMessage{TCommand, TEvent, TEventMessage}" /> class. /// </summary> protected CommandMessage() : this(DefaultIsReportedValue) { return; } /// <summary> /// Initializes a new instance of the <see cref="CommandMessage{TCommand, TEvent, TEventMessage}" /> class. /// </summary> /// <param name="isReported"> /// A value indicating whether or not the command should be reported with an event message by its processor. The default /// value is <see langword="true" />. /// </param> protected CommandMessage(Boolean isReported) : base() { IsReported = isReported; } /// <summary> /// Initializes a new instance of the <see cref="CommandMessage{TCommand, TEvent, TEventMessage}" /> class. /// </summary> /// <param name="commandObject"> /// The associated command. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="commandObject" /> is <see langword="null" />. /// </exception> protected CommandMessage(TCommand commandObject) : this(commandObject, DefaultIsReportedValue) { return; } /// <summary> /// Initializes a new instance of the <see cref="CommandMessage{TCommand, TEvent, TEventMessage}" /> class. /// </summary> /// <param name="commandObject"> /// The associated command. /// </param> /// <param name="isReported"> /// A value indicating whether or not the command should be reported with an event message by its processor. The default /// value is <see langword="true" />. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="commandObject" /> is <see langword="null" />. /// </exception> protected CommandMessage(TCommand commandObject, Boolean isReported) : base(commandObject) { IsReported = isReported; } /// <summary> /// Composes an <see cref="IEventMessage{TEvent}" /> representing information about the current /// <see cref="CommandMessage{TCommand, TEvent, TEventMessage}" />. /// </summary> /// <returns> /// An <see cref="IEventMessage{TEvent}" /> representing information about the current object. /// </returns> /// <exception cref="EventAuthoringException"> /// An exception was raised while composing the event. /// </exception> public TEventMessage ComposeEventMessage() { try { var associatedEventMessage = new TEventMessage(); var associatedEvent = Command.ComposeEvent(); associatedEventMessage.Event = associatedEvent; associatedEventMessage.CorrelationIdentifier = CorrelationIdentifier; EnrichEventMessage(associatedEventMessage); return associatedEventMessage; } catch (EventAuthoringException) { throw; } catch (Exception exception) { throw new EventAuthoringException(typeof(TEvent), exception); } } /// <summary> /// Composes a new <see cref="IEventMessage" /> and publishes it using the specified mediator if <see cref="IsReported" /> /// is <see langword="true" />. /// </summary> /// <param name="mediator"> /// A mediator that is used to publish the event message. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="mediator" /> is <see langword="null" />. /// </exception> /// <exception cref="CommandHandlingException"> /// An exception was raised while attempting to publish the event message. /// </exception> /// <exception cref="EventAuthoringException"> /// An exception was raised while composing the event. /// </exception> /// <exception cref="ObjectDisposedException"> /// <paramref name="mediator" /> is disposed. /// </exception> public void ConditionallyReport(ICommandMediator mediator) { _ = mediator.RejectIf().IsNull(nameof(mediator)); if (IsReported) { var associatedEventMessage = ComposeEventMessage(); mediator.Process(associatedEventMessage); } } /// <summary> /// Hydrates and enriches the specified event message with details that are pertinent to the current /// <see cref="CommandMessage{TCommand, TEvent, TEventMessage}" />. /// </summary> /// <remarks> /// When overridden by a derived class, this method is invoked by <see cref="ComposeEventMessage" /> to enrich event message /// objects with additional details. /// </remarks> /// <param name="associatedEventMessage"> /// The event message to enrich. /// </param> protected virtual void EnrichEventMessage(TEventMessage associatedEventMessage) { return; } /// <summary> /// Gets a value indicating whether or not the current <see cref="CommandMessage{TCommand, TEvent, TEventMessage}" /> should /// be reported as an <see cref="IEventMessage{TEvent}" /> by its processor. /// </summary> [DataMember] public Boolean IsReported { get; set; } /// <summary> /// Represents the default value indicating whether or not the current /// <see cref="CommandMessage{TCommand, TEvent, TEventMessage}" /> should be reported as an /// <see cref="IEventMessage{TEvent}" /> by its processor. /// </summary> [DebuggerBrowsable(DebuggerBrowsableState.Never)] private const Boolean DefaultIsReportedValue = true; } /// <summary> /// Represents a message that contains a command. /// </summary> /// <remarks> /// <see cref="CommandMessage{TCommand}" /> is the default implementation of <see cref="ICommandMessage{TCommand}" />. /// </remarks> /// <typeparam name="TCommand"> /// The type of the associated command. /// </typeparam> [DataContract] public abstract class CommandMessage<TCommand> : Message, ICommandMessage<TCommand> where TCommand : SolidInstrumentsCommand, new() { /// <summary> /// Initializes a new instance of the <see cref="CommandMessage{TCommand}" /> class. /// </summary> protected CommandMessage() : this(new TCommand()) { return; } /// <summary> /// Initializes a new instance of the <see cref="CommandMessage{TCommand}" /> class. /// </summary> /// <param name="commandObject"> /// The associated command. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="commandObject" /> is <see langword="null" />. /// </exception> protected CommandMessage(TCommand commandObject) : base(commandObject.CorrelationIdentifier, Guid.NewGuid()) { Command = commandObject.RejectIf().IsNull(nameof(commandObject)); } /// <summary> /// Gets or sets the associated command. /// </summary> [DataMember] public TCommand Command { get; set; } } }
41.008368
160
0.583308
[ "MIT" ]
RapidField/solid-instruments
src/RapidField.SolidInstruments.Messaging/CommandMessages/CommandMessage.cs
9,803
C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Filters.Infrastructure { public class CustomAuthAttribute : AuthorizeAttribute { private bool _localAllowed; public CustomAuthAttribute(bool allowedParam) { _localAllowed = allowedParam; } protected override bool AuthorizeCore(HttpContextBase httpContext) { if (httpContext.Request.IsLocal) return _localAllowed; else return true; } } }
22.807692
74
0.630691
[ "Apache-2.0" ]
nandehutuzn/SportsStore
Filters/Infrastructure/CustomAuthAttribute.cs
595
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace CustomMappings.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("CustomMappings.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; } } } }
33.847222
165
0.690193
[ "Apache-2.0" ]
mclt0568/CustomMappings
CustomMappings/Properties/Resources.Designer.cs
2,439
C#
#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Maths; using Robust.Shared.Serialization; namespace Content.Shared.Solar { [Serializable, NetSerializable] public class SolarControlConsoleBoundInterfaceState : BoundUserInterfaceState { /// <summary> /// The target rotation of the panels in radians. /// </summary> public Angle Rotation; /// <summary> /// The target velocity of the panels in radians/minute. /// </summary> public Angle AngularVelocity; /// <summary> /// The total amount of power the panels are supplying. /// </summary> public float OutputPower; /// <summary> /// The current sun angle. /// </summary> public Angle TowardsSun; public SolarControlConsoleBoundInterfaceState(Angle r, Angle vm, float p, Angle tw) { Rotation = r; AngularVelocity = vm; OutputPower = p; TowardsSun = tw; } } [Serializable, NetSerializable] public sealed class SolarControlConsoleAdjustMessage : BoundUserInterfaceMessage { /// <summary> /// New target rotation of the panels in radians. /// </summary> public Angle Rotation; /// <summary> /// New target velocity of the panels in radians/second. /// </summary> public Angle AngularVelocity; } [Serializable, NetSerializable] public enum SolarControlConsoleUiKey { Key } }
25.95082
91
0.602021
[ "MIT" ]
Bright0/space-station-14
Content.Shared/Solar/SharedSolarControlConsoleComponent.cs
1,583
C#
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace MOBOT.DigitalAnnotations.Data.Entities { [Table("AnnotationTags", Schema = "dbo")] public class AnnotationTag { [Key(), DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int AnnotationTagId { get; set; } [Required(ErrorMessage = "An annotation id is required.")] public long AnnotationId { get; set; } [Required(ErrorMessage = "A tag id is required.")] public int TagId { get; set; } public virtual Annotation Annotation { get; set; } public virtual Tag Tag { get; set; } } }
33.8
68
0.673077
[ "CC0-1.0" ]
MBG-CBI/C2C
MOBOT.DigitalAnnotations.Api/MOBOT.DigitalAnnotations.Data/Entities/AnnotationTag.cs
678
C#
// Copyright 2020 The Tilt Brush Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using UnityEngine; namespace TiltBrush { public class TutorialPointScript : MonoBehaviour { [SerializeField] private Transform m_BrushControllerAnchor; [SerializeField] private Transform m_WandControllerAnchor; [SerializeField] private Transform m_WandPanel; [SerializeField] private Renderer m_PointingLine; [SerializeField] private float m_RotationScalar = 30.0f; [SerializeField] private float m_TranslateScalar = 0.2f; [SerializeField] private float m_AnimationSpeed = 2.0f; [SerializeField] private float m_PanelScaleAmount = 1.25f; [SerializeField] private Vector2 m_PanelActivationRange; [SerializeField] private float m_PointingLineEmissionAmount = 5.0f; private float m_AnimationValue; private Vector3 m_TranslateBase; private Vector3 m_RotationBase; private Vector3 m_PanelScaleBase; void Start() { m_AnimationValue = 0.0f; m_TranslateBase = m_WandControllerAnchor.localPosition; m_RotationBase = m_BrushControllerAnchor.rotation.eulerAngles; m_PanelScaleBase = m_WandPanel.localScale; m_PointingLine.material.SetColor("_EmissionColor", Color.blue * m_PointingLineEmissionAmount); } void Update() { m_AnimationValue += Time.deltaTime * m_AnimationSpeed; float fSinValue = Mathf.Sin(m_AnimationValue); Vector3 vEulers = m_RotationBase; vEulers.x += fSinValue * m_RotationScalar; m_BrushControllerAnchor.rotation = Quaternion.Euler(vEulers); Vector3 vPosition = m_TranslateBase; vPosition.y += fSinValue * m_TranslateScalar; m_WandControllerAnchor.localPosition = vPosition; if (fSinValue > m_PanelActivationRange.x && fSinValue < m_PanelActivationRange.y) { m_WandPanel.localScale = m_PanelScaleBase * m_PanelScaleAmount; m_PointingLine.enabled = true; } else { m_WandPanel.localScale = m_PanelScaleBase; m_PointingLine.enabled = false; } } } } // namespace TiltBrush
38.045455
98
0.765432
[ "Apache-2.0" ]
Babouchot/open-brush
Assets/Scripts/Tutorials/TutorialPointScript.cs
2,513
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 iotsitewise-2019-12-02.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.IoTSiteWise.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.IoTSiteWise.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for ImageLocation Object /// </summary> public class ImageLocationUnmarshaller : IUnmarshaller<ImageLocation, XmlUnmarshallerContext>, IUnmarshaller<ImageLocation, JsonUnmarshallerContext> { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> ImageLocation IUnmarshaller<ImageLocation, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context) { throw new NotImplementedException(); } /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public ImageLocation Unmarshall(JsonUnmarshallerContext context) { context.Read(); if (context.CurrentTokenType == JsonToken.Null) return null; ImageLocation unmarshalledObject = new ImageLocation(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("id", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; unmarshalledObject.Id = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("url", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; unmarshalledObject.Url = unmarshaller.Unmarshall(context); continue; } } return unmarshalledObject; } private static ImageLocationUnmarshaller _instance = new ImageLocationUnmarshaller(); /// <summary> /// Gets the singleton. /// </summary> public static ImageLocationUnmarshaller Instance { get { return _instance; } } } }
35.010204
153
0.607986
[ "Apache-2.0" ]
philasmar/aws-sdk-net
sdk/src/Services/IoTSiteWise/Generated/Model/Internal/MarshallTransformations/ImageLocationUnmarshaller.cs
3,431
C#
using CCMS.Server.Services.DbServices; namespace Microsoft.Extensions.DependencyInjection { public static class DbServiceCollectionExtensions { public static IServiceCollection AddDbServices( this IServiceCollection services) { services.AddScoped<IAuthService, AuthService>(); services.AddScoped<IPlatformsService, PlatformsService>(); services.AddScoped<IRolesService, RolesService>(); services.AddScoped<IAppUsersService, AppUsersService>(); services.AddScoped<ILawyersService, LawyersService>(); services.AddScoped<ICourtsService, CourtsService>(); services.AddScoped<ICaseTypesService, CaseTypesService>(); services.AddScoped<ILocationsService, LocationsService>(); services.AddScoped<IProceedingDecisionsService, ProceedingDecisionsService>(); services.AddScoped<IActorTypesService, ActorTypesService>(); services.AddScoped<IAttachmentsService, AttachmentsService>(); services.AddScoped<ICourtCasesService, CourtCasesService>(); services.AddScoped<ICaseDatesService, CaseDatesService>(); services.AddScoped<ICaseActorsService, CaseActorsService>(); services.AddScoped<ICaseProceedingsService, CaseProceedingsService>(); services.AddScoped<IInsightsService, InsightsService>(); return services; } } }
41.857143
90
0.698294
[ "MIT" ]
aditya119/CCMS
CCMS.Server/Services/DbServices/DbServiceCollectionExtensions.cs
1,467
C#
using System.Collections.Generic; using System.Collections.ObjectModel; using System.Threading.Tasks; using PriceFlyerTicker.UI.Core.Models; namespace PriceFlyerTicker.UI.Core.Services { // This interface specifies methods used by some generated pages to show how they can be used. // TODO WTS: Delete this file once your app is using real data. public interface ISampleDataService { ObservableCollection<SampleOrder> GetContentGridData(); } }
30.625
99
0.740816
[ "MIT" ]
mark-s/BitFlyerDotNet
PriceFlyerTicker.UI.Core/Services/ISampleDataService.cs
492
C#
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. #nullable disable namespace StyleCop.Analyzers.Test.CSharp8.DocumentationRules { using StyleCop.Analyzers.Test.CSharp7.DocumentationRules; public class SA1634CSharp8UnitTests : SA1634CSharp7UnitTests { } }
27.785714
91
0.77892
[ "MIT" ]
RogerHowellDfE/StyleCopAnalyzers
StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp8/DocumentationRules/SA1634CSharp8UnitTests.cs
391
C#
// This file is part of Core WF which is licensed under the MIT license. // See LICENSE file in the project root for full license information. using System; using System.Runtime.InteropServices; using Portable.Xaml.Markup; // 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. // 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. // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("97bdccfe-43bf-4c17-991d-c797c2ef2243")] // Define XAML namespace mappings [assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2009/xaml/activities", "CoreWf")] [assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2009/xaml/activities", "CoreWf.Statements")] [assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2009/xaml/activities", "CoreWf.Expressions")] [assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2009/xaml/activities", "CoreWf.Validation")] [assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2009/xaml/activities", "CoreWf.XamlIntegration")] #if NET45 [assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger", "CoreWf.Debugger.Symbol")] [assembly: XmlnsPrefix("http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger", "sads")] #endif
50.935484
121
0.779607
[ "MIT" ]
OIgnat/corewf
src/CoreWf/AssemblyInfo.cs
1,579
C#
using UnityEngine; using UnityEditor; using System.Collections.Generic; using com.spacepuppy; using com.spacepuppy.Scenario; using com.spacepuppy.Utils; namespace com.spacepuppyeditor.Scenario { [CustomEditor(typeof(i_RecalculateAIGrid))] public class i_RecalculateAIGridInspector : SPEditor { public const string PROP_MODE = "_mode"; private const string PROP_OBJREF = "_objectRef"; protected override void OnSPInspectorGUI() { this.serializedObject.Update(); this.DrawPropertyField(EditorHelper.PROP_SCRIPT); this.DrawPropertyField(EditorHelper.PROP_ORDER); var modeProp = this.serializedObject.FindProperty(PROP_MODE); SPEditorGUILayout.PropertyField(modeProp); switch(modeProp.GetEnumValue<i_RecalculateAIGrid.RecalculateMode>()) { case i_RecalculateAIGrid.RecalculateMode.All: //draw nothing else break; case i_RecalculateAIGrid.RecalculateMode.Region: //draw nothing else break; case i_RecalculateAIGrid.RecalculateMode.BoundsOfCollider: var objProp = this.serializedObject.FindProperty(PROP_OBJREF); objProp.objectReferenceValue = EditorGUILayout.ObjectField("Collider", objProp.objectReferenceValue, typeof(Collider), true); break; } this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, EditorHelper.PROP_ORDER, PROP_MODE, PROP_OBJREF); this.serializedObject.ApplyModifiedProperties(); } [DrawGizmo(GizmoType.Selected | GizmoType.Active | GizmoType.InSelectionHierarchy)] private static void DrawGizmoBounds(i_RecalculateAIGrid targ, GizmoType gizmoType) { switch(targ.Mode) { case i_RecalculateAIGrid.RecalculateMode.Region: { var pos = targ.transform.position; var sc = targ.transform.localScale; Gizmos.color = Color.red; Gizmos.DrawWireCube(pos, sc); } break; case i_RecalculateAIGrid.RecalculateMode.BoundsOfCollider: { var c = targ.Collider; if (c == null) return; var bounds = c.bounds; Gizmos.color = Color.red; Gizmos.DrawWireCube(bounds.center, bounds.size); } break; } } } }
35.802632
145
0.575156
[ "Unlicense" ]
dipique/spacepuppy-unity-framework-3.0
SpacepuppyExtensions/SPAGAstarBridge/Editor/i_RecalculateAIGridInspector.cs
2,723
C#
using StackExchange.Redis; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Web; namespace RCNETAPI.Redis { public class RedisStore { private static readonly Lazy<ConnectionMultiplexer> LazyConnection; static RedisStore() { var configurationOptions = new ConfigurationOptions { AbortOnConnectFail = false, EndPoints = { ConfigurationManager.AppSettings["RedisEndPoints"] } }; LazyConnection = new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect(configurationOptions)); } public static ConnectionMultiplexer Connection => LazyConnection.Value; public static IDatabase RedisCache => Connection.GetDatabase(); } }
28.655172
120
0.676294
[ "MIT" ]
sguti/sample-dotnetframework-redis-docker
RCNETAPI/Redis/RedisStore.cs
833
C#
// This file is auto-generated, don't edit it. Thanks. using System; using System.Collections.Generic; using System.IO; using Tea; namespace AlibabaCloud.SDK.Dingtalkcrm_1_0.Models { public class ListGroupSetRequest : TeaModel { /// <summary> /// 每页返回的结果集个数 /// </summary> [NameInMap("maxResults")] [Validation(Required=false)] public int? MaxResults { get; set; } /// <summary> /// 第一页不传,下一页传入上一页返回的nextToken /// </summary> [NameInMap("nextToken")] [Validation(Required=false)] public string NextToken { get; set; } /// <summary> /// 查询DSL /// </summary> [NameInMap("queryDsl")] [Validation(Required=false)] public string QueryDsl { get; set; } /// <summary> /// 关系类型 /// </summary> [NameInMap("relationType")] [Validation(Required=false)] public string RelationType { get; set; } } }
23.116279
54
0.561368
[ "Apache-2.0" ]
aliyun/dingtalk-sdk
dingtalk/csharp/core/crm_1_0/Models/ListGroupSetRequest.cs
1,060
C#
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; using UFO.Server.Dal.Common; using UFO.Server.Domain; namespace UFO.Server.Dal.Dummy { class CategoryDao : ICategoryDao { public DaoResponse<Category> SelectById(string id) { throw new NotImplementedException(); } public DaoResponse<Category> Insert(Category entity) { throw new NotImplementedException(); } public DaoResponse<Category> Update(Category entity) { throw new NotImplementedException(); } public DaoResponse<Category> Delete(Category entity) { throw new NotImplementedException(); } public DaoResponse<List<Category>> SelectAll() { throw new NotImplementedException(); } public DaoResponse<List<Category>> SelectWhere<T>(Expression<Filter<Category, T>> filterExpression, T criteria = default(T)) { throw new NotImplementedException(); } } }
25.422222
132
0.628497
[ "Apache-2.0" ]
untitled-no1/ufo
ufo/UFO.Server/UFO.Server.Dal.Dummy/CategoryDao.cs
1,146
C#
using System; using Ztk.Drawing; namespace Ztk { public class Button : Control { private static Brush _backgroundBrush; private static Brush _mouseOverBrush; private bool _isMouseOver; private readonly ClickStateTracker _clickStateTracker; public object Content { get; set; } public FourSidedNumber Padding { get; set; } static Button() { _backgroundBrush = new SolidColorBrush(new Color(0x1F / 255f)); _mouseOverBrush = new SolidColorBrush(new Color(0x35/255f)); } public event EventHandler Click; public event EventHandler DoubleClick; public Button() { VerticalAlignment = VerticalAlignment.Top; HorizontalAlignment = HorizontalAlignment.Left; Padding = new FourSidedNumber(10, 5, 10, 5); _clickStateTracker = new ClickStateTracker(this); _clickStateTracker.Click += OnClick; _clickStateTracker.DoubleClick += OnDoubleClick; MouseEnter += OnMouseEnter; MouseLeave += Button_MouseLeave; } private void Button_MouseLeave(object sender, EventArgs e) { _isMouseOver = false; } private void OnMouseEnter(object sender, EventArgs e) { _isMouseOver = true; } private void OnClick(object sender, EventArgs e) { Click?.Invoke(this, new EventArgs()); } private void OnDoubleClick(object sender, EventArgs e) { DoubleClick?.Invoke(this, new EventArgs()); } public override Size MeasureDesiredSize(Size availableSize) { // First figure out size of our text and padding string text = Content.ToString(); Size desiredSize = text.GetSize("Sans", 14, FontSlant.Normal, FontWeight.Normal); double desiredHeight = desiredSize.Height + Padding.Top + Padding.Bottom; double desiredWidth = desiredSize.Width + Padding.Left + Padding.Right; Size newSize = new Size(desiredWidth <= availableSize.Width ? desiredWidth : availableSize.Width, desiredHeight <= availableSize.Height ? desiredHeight : availableSize.Height); // Now add our button border on to this newSize.Width = newSize.Width + 6; newSize.Height = newSize.Height + 6; // Ensure we are within bounds if (newSize.Width > availableSize.Width) newSize.Width = availableSize.Width; if (newSize.Height > availableSize.Height) newSize.Height = availableSize.Height; // Adjust desired size if we're stretch if (HorizontalAlignment == HorizontalAlignment.Stretch) newSize.Width = availableSize.Width; if (VerticalAlignment == VerticalAlignment.Stretch) newSize.Height = availableSize.Height; return newSize; } public override void Render(GraphicsContext g) { // First draw and fill our background Brush brush = _isMouseOver ? _mouseOverBrush : _backgroundBrush; g.Rectangle(0, 0, ActualWidth, ActualHeight); brush.ApplyBrushToContext(g); g.Fill(); //g.RoundedRect(0, 0, ActualWidth, ActualHeight, 5, brush, brush, 1); // Check we have text to draw string text = Content?.ToString(); if (string.IsNullOrWhiteSpace(text)) return; // Now draw the text Brushes.White.ApplyBrushToContext(g); g.SelectFontFace("Sans", FontSlant.Normal, FontWeight.Normal); g.SetFontSize(32); TextExtents te = g.TextExtents(text); double y = te.YBearing * -1 + Padding.Top; double x = te.XBearing * -1 + Padding.Left; double xRemaining = ActualWidth - Padding.Left - te.Width - Padding.Right; double yRemaining = ActualHeight - Padding.Top - te.Height - Padding.Bottom; g.MoveTo(x + (xRemaining / 2), y + (yRemaining / 2)); g.ShowText(text); } } }
36.747826
188
0.598675
[ "BSD-2-Clause" ]
guytp/ztk
Ztk/Button.cs
4,228
C#
using System; using TrueCraft.Core.Logic.Blocks; using UnityEngine; using TrueCraft.API.Logic; public class VegitationRenderer : FlatQuadRenderer { static VegitationRenderer() { BlockRenderer.RegisterRenderer(DandelionBlock.BlockID, new VegitationRenderer()); BlockRenderer.RegisterRenderer(RoseBlock.BlockID, new VegitationRenderer()); BlockRenderer.RegisterRenderer(TallGrassBlock.BlockID, new VegitationRenderer()); BlockRenderer.RegisterRenderer(DeadBushBlock.BlockID, new VegitationRenderer()); BlockRenderer.RegisterRenderer(SaplingBlock.BlockID, new VegitationRenderer()); } protected Vector2 DandelionTextureMap { get { return new Vector2(13, 0); } } protected Vector2 RoseTextureMap { get { return new Vector2(12, 0); } } protected Vector2 TallGrassTextureMap { get { return new Vector2(7, 2); } } protected Vector2 DeadBushTextureMap { get { return new Vector2(7, 3); } } protected Vector2 FernTextureMap { get { return new Vector2(8, 3); } } protected Vector2 OakSaplingTextureMap { get { return new Vector2(15, 0); } } protected Vector2 SpruceSaplingTextureMap { get { return new Vector2(15, 3); } } protected Vector2 BirchSaplingTextureMap { get { return new Vector2(15, 4); } } protected Vector2[] DandelionTexture, RoseTexture; protected Vector2[] TallGrassTexture, DeadBushTexture, FernTexture; protected Vector2[] OakSaplingTexture, SpruceSaplingTexture, BirchSaplingTexture; public VegitationRenderer() { DandelionTexture = new[] { DandelionTextureMap + Vector2.one, DandelionTextureMap + Vector2.up, DandelionTextureMap, DandelionTextureMap + Vector2.right, }; RoseTexture = new[] { RoseTextureMap + Vector2.one, RoseTextureMap + Vector2.up, RoseTextureMap, RoseTextureMap + Vector2.right, }; TallGrassTexture = new[] { TallGrassTextureMap + Vector2.one, TallGrassTextureMap + Vector2.up, TallGrassTextureMap, TallGrassTextureMap + Vector2.right, }; DeadBushTexture = new[] { DeadBushTextureMap + Vector2.one, DeadBushTextureMap + Vector2.up, DeadBushTextureMap, DeadBushTextureMap + Vector2.right, }; FernTexture = new[] { FernTextureMap + Vector2.one, FernTextureMap + Vector2.up, FernTextureMap, FernTextureMap + Vector2.right, }; OakSaplingTexture = new[] { OakSaplingTextureMap + Vector2.one, OakSaplingTextureMap + Vector2.up, OakSaplingTextureMap, OakSaplingTextureMap + Vector2.right, }; SpruceSaplingTexture = new[] { SpruceSaplingTextureMap + Vector2.one, SpruceSaplingTextureMap + Vector2.up, SpruceSaplingTextureMap, SpruceSaplingTextureMap + Vector2.right, }; BirchSaplingTexture = new[] { BirchSaplingTextureMap + Vector2.one, BirchSaplingTextureMap + Vector2.up, BirchSaplingTextureMap, BirchSaplingTextureMap + Vector2.right, }; for (int i = 0; i < Texture.Length; i++) { DandelionTexture[i] *= new Vector2(16f / 256f, 16f / 256f); RoseTexture[i] *= new Vector2(16f / 256f, 16f / 256f); TallGrassTexture[i] *= new Vector2(16f / 256f, 16f / 256f); DeadBushTexture[i] *= new Vector2(16f / 256f, 16f / 256f); FernTexture[i] *= new Vector2(16f / 256f, 16f / 256f); OakSaplingTexture[i] *= new Vector2(16f / 256f, 16f / 256f); SpruceSaplingTexture[i] *= new Vector2(16f / 256f, 16f / 256f); BirchSaplingTexture[i] *= new Vector2(16f / 256f, 16f / 256f); } } public override VertexPositionNormalColorTexture[] Render(BlockDescriptor descriptor, Vector3 offset, VisibleFaces faces, Tuple<int, int> textureMap, int indiciesOffset, out int[] indicies) { if (descriptor.ID == RoseBlock.BlockID) return RenderQuads(descriptor, offset, RoseTexture, indiciesOffset, out indicies, Color.white); else if (descriptor.ID == DandelionBlock.BlockID) return RenderQuads(descriptor, offset, DandelionTexture, indiciesOffset, out indicies, Color.white); else if (descriptor.ID == SaplingBlock.BlockID) { switch ((SaplingBlock.SaplingType)descriptor.Metadata) { case SaplingBlock.SaplingType.Oak: default: return RenderQuads(descriptor, offset, OakSaplingTexture, indiciesOffset, out indicies, Color.white); case SaplingBlock.SaplingType.Spruce: return RenderQuads(descriptor, offset, SpruceSaplingTexture, indiciesOffset, out indicies, Color.white); case SaplingBlock.SaplingType.Birch: return RenderQuads(descriptor, offset, BirchSaplingTexture, indiciesOffset, out indicies, Color.white); } } else { switch ((TallGrassBlock.TallGrassType)descriptor.Metadata) { case TallGrassBlock.TallGrassType.DeadBush: return RenderQuads(descriptor, offset, DeadBushTexture, indiciesOffset, out indicies, Color.white); case TallGrassBlock.TallGrassType.Fern: return RenderQuads(descriptor, offset, FernTexture, indiciesOffset, out indicies, GrassRenderer.BiomeColor); case TallGrassBlock.TallGrassType.TallGrass: default: return RenderQuads(descriptor, offset, TallGrassTexture, indiciesOffset, out indicies, GrassRenderer.BiomeColor); } } } }
46.911111
133
0.594821
[ "MIT" ]
michaelsakharov/TrueCraft
Client/Client/Assets/Scripts/Chunk/Block Builders/VegitationRenderer.cs
6,333
C#
// // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // limitations under the License. // // Warning: This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if the // code is regenerated. using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading; using System.Threading.Tasks; using Hyak.Common; using Microsoft.Azure; using Microsoft.Azure.Management.Sql.LegacySdk; using Microsoft.Azure.Management.Sql.LegacySdk.Models; using Newtonsoft.Json.Linq; namespace Microsoft.Azure.Management.Sql.LegacySdk { /// <summary> /// Represents all the operations for operating on Azure SQL Database /// Servers. Contains operations to: Create, Retrieve, Update, and Delete /// servers. /// </summary> internal partial class ServerOperations : IServiceOperations<SqlManagementClient>, IServerOperations { /// <summary> /// Initializes a new instance of the ServerOperations class. /// </summary> /// <param name='client'> /// Reference to the service client. /// </param> internal ServerOperations(SqlManagementClient client) { this._client = client; } private SqlManagementClient _client; /// <summary> /// Gets a reference to the /// Microsoft.Azure.Management.Sql.LegacySdk.SqlManagementClient. /// </summary> public SqlManagementClient Client { get { return this._client; } } /// <summary> /// Creates a new Azure SQL Database server. /// </summary> /// <param name='resourceGroupName'> /// Required. The name of the Resource Group to which the server /// belongs. /// </param> /// <param name='serverName'> /// Required. The name of the Azure SQL Database Server on which the /// database is hosted. /// </param> /// <param name='parameters'> /// Required. The required parameters for createing or updating a /// database. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// Represents the response to a Get Azure Sql Database Server request. /// </returns> public async Task<ServerGetResponse> CreateOrUpdateAsync(string resourceGroupName, string serverName, ServerCreateOrUpdateParameters parameters, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) { throw new ArgumentNullException("resourceGroupName"); } if (serverName == null) { throw new ArgumentNullException("serverName"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } if (parameters.Properties == null) { throw new ArgumentNullException("parameters.Properties"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); TracingAdapter.Enter(invocationId, this, "CreateOrUpdateAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); } url = url + "/resourceGroups/"; url = url + Uri.EscapeDataString(resourceGroupName); url = url + "/providers/"; url = url + "Microsoft.Sql"; url = url + "/servers/"; url = url + Uri.EscapeDataString(serverName); List<string> queryParameters = new List<string>(); queryParameters.Add("api-version=2014-04-01"); if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); } string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Put; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Serialize Request string requestContent = null; JToken requestDoc = null; JObject serverCreateOrUpdateParametersValue = new JObject(); requestDoc = serverCreateOrUpdateParametersValue; JObject propertiesValue = new JObject(); serverCreateOrUpdateParametersValue["properties"] = propertiesValue; if (parameters.Properties.Version != null) { propertiesValue["version"] = parameters.Properties.Version; } if (parameters.Properties.AdministratorLogin != null) { propertiesValue["administratorLogin"] = parameters.Properties.AdministratorLogin; } if (parameters.Properties.AdministratorLoginPassword != null) { propertiesValue["administratorLoginPassword"] = parameters.Properties.AdministratorLoginPassword; } if (parameters.Location != null) { serverCreateOrUpdateParametersValue["location"] = parameters.Location; } if (parameters.Tags != null) { JObject tagsDictionary = new JObject(); foreach (KeyValuePair<string, string> pair in parameters.Tags) { string tagsKey = pair.Key; string tagsValue = pair.Value; tagsDictionary[tagsKey] = tagsValue; } serverCreateOrUpdateParametersValue["tags"] = tagsDictionary; } requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented); httpRequest.Content = new StringContent(requestContent, Encoding.UTF8); httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Created) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result ServerGetResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Created) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new ServerGetResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { Server serverInstance = new Server(); result.Server = serverInstance; JToken propertiesValue2 = responseDoc["properties"]; if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null) { ServerProperties propertiesInstance = new ServerProperties(); serverInstance.Properties = propertiesInstance; JToken fullyQualifiedDomainNameValue = propertiesValue2["fullyQualifiedDomainName"]; if (fullyQualifiedDomainNameValue != null && fullyQualifiedDomainNameValue.Type != JTokenType.Null) { string fullyQualifiedDomainNameInstance = ((string)fullyQualifiedDomainNameValue); propertiesInstance.FullyQualifiedDomainName = fullyQualifiedDomainNameInstance; } JToken versionValue = propertiesValue2["version"]; if (versionValue != null && versionValue.Type != JTokenType.Null) { string versionInstance = ((string)versionValue); propertiesInstance.Version = versionInstance; } JToken administratorLoginValue = propertiesValue2["administratorLogin"]; if (administratorLoginValue != null && administratorLoginValue.Type != JTokenType.Null) { string administratorLoginInstance = ((string)administratorLoginValue); propertiesInstance.AdministratorLogin = administratorLoginInstance; } JToken administratorLoginPasswordValue = propertiesValue2["administratorLoginPassword"]; if (administratorLoginPasswordValue != null && administratorLoginPasswordValue.Type != JTokenType.Null) { string administratorLoginPasswordInstance = ((string)administratorLoginPasswordValue); propertiesInstance.AdministratorLoginPassword = administratorLoginPasswordInstance; } } JToken idValue = responseDoc["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { string idInstance = ((string)idValue); serverInstance.Id = idInstance; } JToken nameValue = responseDoc["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); serverInstance.Name = nameInstance; } JToken typeValue = responseDoc["type"]; if (typeValue != null && typeValue.Type != JTokenType.Null) { string typeInstance = ((string)typeValue); serverInstance.Type = typeInstance; } JToken locationValue = responseDoc["location"]; if (locationValue != null && locationValue.Type != JTokenType.Null) { string locationInstance = ((string)locationValue); serverInstance.Location = locationInstance; } JToken tagsSequenceElement = ((JToken)responseDoc["tags"]); if (tagsSequenceElement != null && tagsSequenceElement.Type != JTokenType.Null) { foreach (JProperty property in tagsSequenceElement) { string tagsKey2 = ((string)property.Name); string tagsValue2 = ((string)property.Value); serverInstance.Tags.Add(tagsKey2, tagsValue2); } } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return result; } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } } /// <summary> /// Returns information about an Azure SQL Database Server. /// </summary> /// <param name='resourceGroupName'> /// Required. The name of the Resource Group to which the server /// belongs. /// </param> /// <param name='serverName'> /// Required. The name of the server to delete. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// A standard service response including an HTTP status code and /// request ID. /// </returns> public async Task<AzureOperationResponse> DeleteAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) { throw new ArgumentNullException("resourceGroupName"); } if (serverName == null) { throw new ArgumentNullException("serverName"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); TracingAdapter.Enter(invocationId, this, "DeleteAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); } url = url + "/resourceGroups/"; url = url + Uri.EscapeDataString(resourceGroupName); url = url + "/providers/"; url = url + "Microsoft.Sql"; url = url + "/servers/"; url = url + Uri.EscapeDataString(serverName); List<string> queryParameters = new List<string>(); queryParameters.Add("api-version=2014-04-01"); if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); } string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Delete; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.NoContent) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result AzureOperationResponse result = null; // Deserialize Response result = new AzureOperationResponse(); result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return result; } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } } /// <summary> /// Returns information about an Azure SQL Database Server. /// </summary> /// <param name='resourceGroupName'> /// Required. The name of the Resource Group to which the server /// belongs. /// </param> /// <param name='serverName'> /// Required. The name of the server to retrieve. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// Represents the response to a Get Azure Sql Database Server request. /// </returns> public async Task<ServerGetResponse> GetAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) { throw new ArgumentNullException("resourceGroupName"); } if (serverName == null) { throw new ArgumentNullException("serverName"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); TracingAdapter.Enter(invocationId, this, "GetAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); } url = url + "/resourceGroups/"; url = url + Uri.EscapeDataString(resourceGroupName); url = url + "/providers/"; url = url + "Microsoft.Sql"; url = url + "/servers/"; url = url + Uri.EscapeDataString(serverName); List<string> queryParameters = new List<string>(); queryParameters.Add("api-version=2014-04-01"); if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); } string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result ServerGetResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new ServerGetResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { Server serverInstance = new Server(); result.Server = serverInstance; JToken propertiesValue = responseDoc["properties"]; if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { ServerProperties propertiesInstance = new ServerProperties(); serverInstance.Properties = propertiesInstance; JToken fullyQualifiedDomainNameValue = propertiesValue["fullyQualifiedDomainName"]; if (fullyQualifiedDomainNameValue != null && fullyQualifiedDomainNameValue.Type != JTokenType.Null) { string fullyQualifiedDomainNameInstance = ((string)fullyQualifiedDomainNameValue); propertiesInstance.FullyQualifiedDomainName = fullyQualifiedDomainNameInstance; } JToken versionValue = propertiesValue["version"]; if (versionValue != null && versionValue.Type != JTokenType.Null) { string versionInstance = ((string)versionValue); propertiesInstance.Version = versionInstance; } JToken administratorLoginValue = propertiesValue["administratorLogin"]; if (administratorLoginValue != null && administratorLoginValue.Type != JTokenType.Null) { string administratorLoginInstance = ((string)administratorLoginValue); propertiesInstance.AdministratorLogin = administratorLoginInstance; } JToken administratorLoginPasswordValue = propertiesValue["administratorLoginPassword"]; if (administratorLoginPasswordValue != null && administratorLoginPasswordValue.Type != JTokenType.Null) { string administratorLoginPasswordInstance = ((string)administratorLoginPasswordValue); propertiesInstance.AdministratorLoginPassword = administratorLoginPasswordInstance; } } JToken idValue = responseDoc["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { string idInstance = ((string)idValue); serverInstance.Id = idInstance; } JToken nameValue = responseDoc["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); serverInstance.Name = nameInstance; } JToken typeValue = responseDoc["type"]; if (typeValue != null && typeValue.Type != JTokenType.Null) { string typeInstance = ((string)typeValue); serverInstance.Type = typeInstance; } JToken locationValue = responseDoc["location"]; if (locationValue != null && locationValue.Type != JTokenType.Null) { string locationInstance = ((string)locationValue); serverInstance.Location = locationInstance; } JToken tagsSequenceElement = ((JToken)responseDoc["tags"]); if (tagsSequenceElement != null && tagsSequenceElement.Type != JTokenType.Null) { foreach (JProperty property in tagsSequenceElement) { string tagsKey = ((string)property.Name); string tagsValue = ((string)property.Value); serverInstance.Tags.Add(tagsKey, tagsValue); } } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return result; } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } } /// <summary> /// Returns information about an Azure SQL Database Server. /// </summary> /// <param name='resourceGroupName'> /// Required. The name of the Resource Group to which the server /// belongs. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// Represents the response to a Get Azure Sql Database Server request. /// </returns> public async Task<ServerListResponse> ListAsync(string resourceGroupName, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) { throw new ArgumentNullException("resourceGroupName"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); tracingParameters.Add("resourceGroupName", resourceGroupName); TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); } url = url + "/resourceGroups/"; url = url + Uri.EscapeDataString(resourceGroupName); url = url + "/providers/"; url = url + "Microsoft.Sql"; url = url + "/servers"; List<string> queryParameters = new List<string>(); queryParameters.Add("api-version=2014-04-01"); if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); } string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result ServerListResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new ServerListResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { JToken valueArray = responseDoc["value"]; if (valueArray != null && valueArray.Type != JTokenType.Null) { foreach (JToken valueValue in ((JArray)valueArray)) { Server serverInstance = new Server(); result.Servers.Add(serverInstance); JToken propertiesValue = valueValue["properties"]; if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { ServerProperties propertiesInstance = new ServerProperties(); serverInstance.Properties = propertiesInstance; JToken fullyQualifiedDomainNameValue = propertiesValue["fullyQualifiedDomainName"]; if (fullyQualifiedDomainNameValue != null && fullyQualifiedDomainNameValue.Type != JTokenType.Null) { string fullyQualifiedDomainNameInstance = ((string)fullyQualifiedDomainNameValue); propertiesInstance.FullyQualifiedDomainName = fullyQualifiedDomainNameInstance; } JToken versionValue = propertiesValue["version"]; if (versionValue != null && versionValue.Type != JTokenType.Null) { string versionInstance = ((string)versionValue); propertiesInstance.Version = versionInstance; } JToken administratorLoginValue = propertiesValue["administratorLogin"]; if (administratorLoginValue != null && administratorLoginValue.Type != JTokenType.Null) { string administratorLoginInstance = ((string)administratorLoginValue); propertiesInstance.AdministratorLogin = administratorLoginInstance; } JToken administratorLoginPasswordValue = propertiesValue["administratorLoginPassword"]; if (administratorLoginPasswordValue != null && administratorLoginPasswordValue.Type != JTokenType.Null) { string administratorLoginPasswordInstance = ((string)administratorLoginPasswordValue); propertiesInstance.AdministratorLoginPassword = administratorLoginPasswordInstance; } } JToken idValue = valueValue["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { string idInstance = ((string)idValue); serverInstance.Id = idInstance; } JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); serverInstance.Name = nameInstance; } JToken typeValue = valueValue["type"]; if (typeValue != null && typeValue.Type != JTokenType.Null) { string typeInstance = ((string)typeValue); serverInstance.Type = typeInstance; } JToken locationValue = valueValue["location"]; if (locationValue != null && locationValue.Type != JTokenType.Null) { string locationInstance = ((string)locationValue); serverInstance.Location = locationInstance; } JToken tagsSequenceElement = ((JToken)valueValue["tags"]); if (tagsSequenceElement != null && tagsSequenceElement.Type != JTokenType.Null) { foreach (JProperty property in tagsSequenceElement) { string tagsKey = ((string)property.Name); string tagsValue = ((string)property.Value); serverInstance.Tags.Add(tagsKey, tagsValue); } } } } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return result; } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } } /// <summary> /// Returns information about Azure SQL Database Server usage. /// </summary> /// <param name='resourceGroupName'> /// Required. The name of the Resource Group to which the server /// belongs. /// </param> /// <param name='serverName'> /// Required. The name of the Azure SQL Database Server in which the /// Azure SQL Databases are hosted. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// Represents the response to a List Azure Sql Database Server metrics /// request. /// </returns> public async Task<ServerMetricListResponse> ListUsagesAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) { throw new ArgumentNullException("resourceGroupName"); } if (serverName == null) { throw new ArgumentNullException("serverName"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary<string, object> tracingParameters = new Dictionary<string, object>(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); TracingAdapter.Enter(invocationId, this, "ListUsagesAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); } url = url + "/resourceGroups/"; url = url + Uri.EscapeDataString(resourceGroupName); url = url + "/providers/"; url = url + "Microsoft.Sql"; url = url + "/servers/"; url = url + Uri.EscapeDataString(serverName); url = url + "/usages"; List<string> queryParameters = new List<string>(); queryParameters.Add("api-version=2014-04-01"); if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); } string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result ServerMetricListResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new ServerMetricListResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { JToken valueArray = responseDoc["value"]; if (valueArray != null && valueArray.Type != JTokenType.Null) { foreach (JToken valueValue in ((JArray)valueArray)) { ServerMetric serverMetricInstance = new ServerMetric(); result.Metrics.Add(serverMetricInstance); JToken resourceNameValue = valueValue["resourceName"]; if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null) { string resourceNameInstance = ((string)resourceNameValue); serverMetricInstance.ResourceName = resourceNameInstance; } JToken displayNameValue = valueValue["displayName"]; if (displayNameValue != null && displayNameValue.Type != JTokenType.Null) { string displayNameInstance = ((string)displayNameValue); serverMetricInstance.DisplayName = displayNameInstance; } JToken currentValueValue = valueValue["currentValue"]; if (currentValueValue != null && currentValueValue.Type != JTokenType.Null) { double currentValueInstance = ((double)currentValueValue); serverMetricInstance.CurrentValue = currentValueInstance; } JToken limitValue = valueValue["limit"]; if (limitValue != null && limitValue.Type != JTokenType.Null) { double limitInstance = ((double)limitValue); serverMetricInstance.Limit = limitInstance; } JToken unitValue = valueValue["unit"]; if (unitValue != null && unitValue.Type != JTokenType.Null) { string unitInstance = ((string)unitValue); serverMetricInstance.Unit = unitInstance; } JToken nextResetTimeValue = valueValue["nextResetTime"]; if (nextResetTimeValue != null && nextResetTimeValue.Type != JTokenType.Null) { DateTime nextResetTimeInstance = ((DateTime)nextResetTimeValue); serverMetricInstance.NextResetTime = nextResetTimeInstance; } } } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return result; } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } } } }
48.735565
190
0.447363
[ "MIT" ]
3quanfeng/azure-powershell
src/Sql/Sql.LegacySdk/Generated/ServerOperations.cs
57,045
C#
namespace Serenity { using System; using System.Runtime.CompilerServices; [Imported] public class PanelAttribute : Attribute { } }
16.5
44
0.630303
[ "MIT" ]
BTDevelop/Serenity
Serenity.Script.Imports/Attribute/PanelAttribute.cs
167
C#
// <copyright file="IntegrationSettingsTests.cs" company="Datadog"> // Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. // </copyright> using System.Collections.Specialized; using Datadog.Trace.Configuration; using Xunit; namespace Datadog.Trace.Tests.Configuration { public class IntegrationSettingsTests { [Theory] [InlineData("DD_TRACE_FOO_ENABLED", "true", true)] [InlineData("DD_TRACE_FOO_ENABLED", "false", false)] [InlineData("DD_FOO_ENABLED", "true", true)] [InlineData("DD_FOO_ENABLED", "false", false)] public void IntegrationEnabled(string settingName, string settingValue, bool expected) { var source = new NameValueConfigurationSource(new NameValueCollection { { settingName, settingValue } }); var settings = new IntegrationSettings("FOO", source); Assert.Equal(expected, settings.Enabled); } [Theory] [InlineData("DD_TRACE_FOO_ANALYTICS_ENABLED", "true", true)] [InlineData("DD_TRACE_FOO_ANALYTICS_ENABLED", "false", false)] [InlineData("DD_FOO_ANALYTICS_ENABLED", "true", true)] [InlineData("DD_FOO_ANALYTICS_ENABLED", "false", false)] public void IntegrationAnalyticsEnabled(string settingName, string settingValue, bool expected) { var source = new NameValueConfigurationSource(new NameValueCollection { { settingName, settingValue } }); var settings = new IntegrationSettings("FOO", source); Assert.Equal(expected, settings.AnalyticsEnabled); } [Theory] [InlineData("DD_TRACE_FOO_ANALYTICS_SAMPLE_RATE", "0.2", 0.2)] [InlineData("DD_FOO_ANALYTICS_SAMPLE_RATE", "0.6", 0.6)] public void IntegrationAnalyticsSampleRate(string settingName, string settingValue, double expected) { var source = new NameValueConfigurationSource(new NameValueCollection { { settingName, settingValue } }); var settings = new IntegrationSettings("FOO", source); Assert.Equal(expected, settings.AnalyticsSampleRate); } } }
46.295082
113
0.557011
[ "Apache-2.0" ]
DataDog/dd-trace-csharp
tracer/test/Datadog.Trace.Tests/Configuration/IntegrationSettingsTests.cs
2,824
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("4.SortThreeRealNumbersDesc")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("4.SortThreeRealNumbersDesc")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a7b87a3b-6282-4369-9d51-2a0ba804bbbb")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
38.513514
84
0.748772
[ "MIT" ]
tenevdev/academy-csharp
csharp-meeting-1/ConditionalStatements/4.SortThreeRealNumbersDesc/Properties/AssemblyInfo.cs
1,428
C#
using OpenAC.Net.NFSe.Nota; using Xunit; namespace OpenAC.Net.NFSe.Test { public class TestProviderSigiss { [Fact] public void EmissaoNota() { var openNFSe = SetupOpenNFSe.Sigiss; //adicionado rps var nota = openNFSe.NotasServico.AddNew(); nota.Prestador.CpfCnpj = "37761587000161"; nota.RegimeEspecialTributacao = RegimeEspecialTributacao.SimplesNacional; nota.Servico.Valores.Aliquota = 2; nota.Servico.CodigoTributacaoMunicipio = "802"; nota.NaturezaOperacao = NaturezaOperacao.Sigiss.TributadaNoPrestador; nota.Servico.Valores.ValorServicos = 29.91M; nota.Servico.Valores.BaseCalculo = 29.91M; nota.Servico.Descricao = "serviço teste"; nota.Tomador.Tipo = TipoTomador.Sigiss.PFNI; nota.Tomador.DadosContato.Email = "a@a.com"; //enviando var retorno = openNFSe.Enviar(0); Assert.True(retorno.Sucesso); } [Fact] public void CancelarNota() { var openNFSe = SetupOpenNFSe.Sigiss; //enviando requisicao de cancelamento var retorno = openNFSe.CancelarNFSe("a@a.com", "7125", "motivo teste testetestetesteteste"); Assert.True(retorno.Sucesso); } } }
32.595238
104
0.604091
[ "MIT" ]
Desenv5DigiByte/OpenAC.Net.NFSe
src/OpenAC.Net.NFSe.Test/TestProviderSigiss.cs
1,372
C#
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; namespace CefSharp { public interface IRunContextMenuCallback : IDisposable { /// <summary> /// Complete context menu display by selecting the specified commandId and eventFlags; /// </summary> /// <param name="commandId">the command Id</param> /// <param name="eventFlags">the event flags</param> void Continue(CefMenuCommand commandId, CefEventFlags eventFlags); /// <summary> /// Cancel context menu display. /// </summary> void Cancel(); /// <summary> /// Gets a value indicating whether the callback has been disposed of. /// </summary> bool IsDisposed { get; } } }
30.551724
100
0.626411
[ "BSD-3-Clause" ]
297498075/CefSharp
CefSharp/IRunContextMenuCallback.cs
889
C#
using Inshapardaz.Api.Tests.Asserts; using Inshapardaz.Api.Tests.Dto; using Inshapardaz.Api.Views.Library; using Inshapardaz.Domain.Models; using NUnit.Framework; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; namespace Inshapardaz.Api.Tests.Library.Book.GetBooksSortedByDateAdded { [TestFixture] public class WhenGettingGetSortedByDateAddedWithMultipleAuthorsAndCategories : TestBase { private HttpResponseMessage _response; private PagingAssert<BookView> _assert; private IEnumerable<BookDto> _books; private IEnumerable<CategoryDto> _categories; private IEnumerable<AuthorDto> _authors; public WhenGettingGetSortedByDateAddedWithMultipleAuthorsAndCategories() : base(Role.Reader) { } [OneTimeSetUp] public async Task Setup() { _categories = CategoryBuilder.WithLibrary(LibraryId).Build(2); _authors = AuthorBuilder.WithLibrary(LibraryId).Build(2); _books = BookBuilder.WithLibrary(LibraryId).WithCategories(_categories).WithAuthors(_authors).IsPublic().Build(12); _response = await Client.GetAsync($"/libraries/{LibraryId}/books?pageNumber=1&pageSize=10&sortby=DateCreated&sort=Ascending"); _assert = new PagingAssert<BookView>(_response); } [OneTimeTearDown] public void Teardown() { Cleanup(); } [Test] public void ShouldReturnOk() { _response.ShouldBeOk(); } [Test] public void ShouldHaveSelfLink() { _assert.ShouldHaveSelfLink($"/libraries/{LibraryId}/books", new KeyValuePair<string, string>("sortby", "DateCreated")); } [Test] public void ShouldNotHaveNextLink() { _assert.ShouldHaveNextLink($"/libraries/{LibraryId}/books", 2, 10, new KeyValuePair<string, string>("sortby", "DateCreated")); } [Test] public void ShouldNotHavePreviousLink() { _assert.ShouldNotHavePreviousLink(); } [Test] public void ShouldNotHaveCreateLink() { _assert.ShouldNotHaveCreateLink(); } [Test] public void ShouldReturnCorrectPage() { _assert.ShouldHavePage(1) .ShouldHavePageSize(10) .ShouldHaveTotalCount(_books.Count()) .ShouldHaveItems(10); } [Test] public void ShouldReturnExpectedBooks() { var expectedItems = _books.OrderBy(a => a.DateAdded).Take(10); foreach (var item in expectedItems) { var actual = _assert.Data.FirstOrDefault(x => x.Id == item.Id); actual.ShouldMatch(item, DatabaseConnection, LibraryId) .InLibrary(LibraryId) .ShouldHaveCorrectLinks() .ShouldNotHaveEditLinks() .ShouldNotHaveImageUpdateLink() .ShouldNotHaveCreateChaptersLink() .ShouldNotHaveAddContentLink() .ShouldHaveChaptersLink() .ShouldHavePublicImageLink(); } } } }
32.121495
138
0.585685
[ "Apache-2.0" ]
inshapardaz/api
src/Inshapardaz.Api.Tests/Library/Book/GetBooksSortedByDateAdded/WhenGettingGetSortedByDateAddedWithMultipleAuthorsAndCategories.cs
3,437
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; namespace Dagent.Configuration { public interface IPackageAgentProvider { /// <summary> /// Gets an enumerable of all of the package agents /// </summary> /// <returns>Enumerable of all of the package agents</returns> IEnumerable<PackageAgent> LoadPackageAgents(); /// <summary> /// Gets the agent that matches a given name. /// </summary> /// <param name="name">Name of agent to be searched for</param> /// <returns>PackageAgent that matches the given name. Null if none was found</returns> /// <throws>ArgumentException when <paramref name="name"/> is null or empty.</throws> PackageAgent GetPackageAgentByName(string name); /// <summary> /// Gets the agent that matches a given agent url. /// </summary> /// <param name="agent">Url of agent to be searched for</param> /// <returns>PackageSource that matches the given agent. Null if none was found</returns> /// <throws>ArgumentException when <paramref name="agent"/> is null or empty.</throws> PackageAgent GetPackageAgentByAgent(string agent); /// <summary> /// Event raised when the package sources have been changed. /// </summary> event EventHandler PackageAgentsChanged; /// <summary> /// Removes the package agent that matches the given name /// </summary> /// <param name="name">Name of agent to remove</param> void RemovePackageAgent(string name); /// <summary> /// Enables the package source that matches the given name /// </summary> /// <param name="name">Name of agent to enable</param> void EnablePackageAgent(string name); /// <summary> /// Disables the package agent that matches the given name /// </summary> /// <param name="name">Name of agent to disable</param> void DisablePackageAgent(string name); /// <summary> /// Updates the values of the given package agent. /// </summary> /// <remarks>The package agent is matched by name.</remarks> /// <param name="agent">Agent with updated values</param> /// <param name="updateEnabled">Describes if enabled value from <paramref name="agent"/> should be updated or ignored</param> void UpdatePackageAgent(PackageAgent agent, bool updateEnabled); /// <summary> /// Adds a package agent to the current configuration /// </summary> /// <param name="agent">PackageAgent to add</param> void AddPackageAgent(PackageAgent agent); /// <summary> /// Compares the given list of PackageAgents with the current PackageAgents in the configuration /// and adds, removes or updates each agent as needed. /// </summary> /// <param name="sources">PackageAgents to be saved</param> void SavePackageAgents(IEnumerable<PackageAgent> agents); /// <summary> /// Checks if a package agent with a given name is part of the disabled ageets configuration /// </summary> /// <param name="name">Name of the agent to be queried</param> /// <returns>true if the agent with the given name is not part of the disabled agents</returns> bool IsPackageAgentEnabled(string name); /// <summary> /// Gets the name of the active PackageAgent /// </summary> string ActivePackageAgentName { get; } /// <summary> /// Gets the Default deploy agent /// </summary> string DefaultDeployAgent { get; } /// <summary> /// Updates the active package agent with the given agent. /// </summary> /// <param name="agent">Agent to be set as the active package agent</param> void SaveActivePackageAgent(PackageAgent agent); } }
41.598039
134
0.606646
[ "MIT" ]
dagent2/dagent
DagentExtensions/Configuration/PackageAgent/IPackageAgentProvider.cs
4,245
C#
using ph_UserEnv.Authentication; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.IdentityModel.Tokens; using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using System.Text; using System.Threading.Tasks; using ph_UserEnv.Models; using Microsoft.AspNetCore.Authorization; using System.Linq; using Newtonsoft.Json; namespace ph_UserEnv.Controllers { [Authorize] [Route("api/[controller]")] [ApiController] public class GameController : ControllerBase { private ApplicationDbContext _db; private readonly UserManager<ApplicationUser> userManager; private readonly RoleManager<IdentityRole> roleManager; private readonly IConfiguration _configuration; public GameController(UserManager<ApplicationUser> userManager, RoleManager<IdentityRole> roleManager, IConfiguration configuration, ApplicationDbContext db) { _db = db; this.userManager = userManager; this.roleManager = roleManager; _configuration = configuration; } [Route("getGamesByName")] [HttpPost] public async Task<IActionResult> GetGamesByName([FromBody] GameNameModel gameNameModel) { GameSession[] games = _db.GameSessions.Where(X => (X.game_name == gameNameModel.game_name && X.status == GameSession.gameStatus.Matchmaking)).OrderBy(x => x.created_at).ToArray(); List<CleanGame> cleanGames = new List<CleanGame>(); foreach (GameSession c in games) { if((DateTime.Now - c.created_at).Seconds < 15) { cleanGames.Add(new CleanGame { created_at = c.created_at, creator_id = c.creator_id, game_state = c.game_state, creator_username = _db.Users.Where(x => x.Id == c.creator_id).FirstOrDefault().UserName, current_turn_id = c.current_turn_id, current_turn_username = _db.Users.Where(x => x.Id == c.current_turn_id).FirstOrDefault().UserName, game_name = c.game_name, status = c.status, updated_at = c.updated_at, id = c.id }); } else { _db.GamePlayers.RemoveRange(_db.GamePlayers.Where(x => x.gameSession_id == c.id).ToArray()); _db.GameSessions.Remove(c); _db.SaveChanges(); } } return Ok(cleanGames); } [Route("createGame")] [HttpPost] public async Task<IActionResult> CreateGame([FromBody] GameModel gameModel) { var identity = HttpContext.User.Identity as ClaimsIdentity; IEnumerable<Claim> claims = identity.Claims; // or string claim = identity.FindFirst(ClaimTypes.NameIdentifier).Value; var user = await userManager.FindByIdAsync(claim); GameSession game = new GameSession() { created_at = DateTime.Now, updated_at = DateTime.Now, status = GameSession.gameStatus.Matchmaking, game_state = JsonConvert.SerializeObject((new string[,] { {"", "", "" }, { "", "", "" }, { "", "", "" } })), creator_id = claim, current_turn_id = claim, game_name = gameModel.game_name }; _db.GameSessions.Add(game); _db.SaveChanges(); GamePlayer gamePlayer = new GamePlayer() { gameSession_id = _db.GameSessions.Where(x => x == game).FirstOrDefault().id, user_id = claim, created_at = game.updated_at, updated_at = game.updated_at }; _db.GamePlayers.Add(gamePlayer); _db.SaveChanges(); return Ok(game); } [Route("joinGame")] [HttpPost] public async Task<IActionResult> JoinGame([FromBody] GameIdModel gameIdModel) { GameSession game = _db.GameSessions.Where(x => (x.id == gameIdModel.game_id && x.status == GameSession.gameStatus.Matchmaking)).FirstOrDefault(); var identity = HttpContext.User.Identity as ClaimsIdentity; if (identity != null) { IEnumerable<Claim> claims = identity.Claims; // or string claim = identity.FindFirst(ClaimTypes.NameIdentifier).Value; var user = await userManager.FindByIdAsync(claim); GamePlayer gamePlayer = new GamePlayer() { gameSession_id = game.id, user_id = claim, created_at = DateTime.Now, updated_at = DateTime.Now }; game.status = GameSession.gameStatus.in_progress; game.updated_at = DateTime.Now; _db.GamePlayers.Add(gamePlayer); _db.GameSessions.Update(game); _db.SaveChanges(); return Ok(game); } else { return Ok("failure"); } } [AllowAnonymous] [Route("remove")] [HttpPost] public async Task<IActionResult> remove([FromBody] GameIdModel gameIdModel) { GameSession game = _db.GameSessions.Where(x => (x.id == gameIdModel.game_id )).FirstOrDefault(); if (game.status != GameSession.gameStatus.completed) { List<GamePlayer> gamePlayers = _db.GamePlayers.Where(x => x.gameSession_id == gameIdModel.game_id).ToList(); foreach (GamePlayer player in gamePlayers) { _db.GamePlayers.Remove(player); } _db.GameSessions.Remove(game); _db.SaveChanges(); } return Ok(game); } [Route("checkMoveTTT")] [HttpPost] public async Task<IActionResult> CheckMoveTTT([FromBody] GameStateIdModel gameStateIdModel) { GameSession pastGame = _db.GameSessions.Where(X => (X.id == gameStateIdModel.game_id )).FirstOrDefault(); var identity = HttpContext.User.Identity as ClaimsIdentity; IEnumerable<Claim> claims = identity.Claims; // or string claim = identity.FindFirst(ClaimTypes.NameIdentifier).Value; List<GamePlayer> players = _db.GamePlayers.Where(x => x.gameSession_id == gameStateIdModel.game_id).ToList(); var user = await userManager.FindByIdAsync(claim); string[,] pastGameState = JsonConvert.DeserializeObject<string[,]>(pastGame.game_state); //string[,] purposedGameState = JsonConvert.DeserializeObject<string[,]>(gameStateIdModel.game_state); if (pastGame.status != GameSession.gameStatus.in_progress || pastGame.current_turn_id != claim || pastGame.updated_at != gameStateIdModel.update_at) { CleanGame sameGame = new CleanGame { created_at = pastGame.created_at, creator_id = pastGame.creator_id, game_state = pastGame.game_state, creator_username = _db.Users.Where(x => x.Id == pastGame.creator_id).FirstOrDefault().UserName, current_turn_id = pastGame.current_turn_id, current_turn_username = _db.Users.Where(x => x.Id == pastGame.current_turn_id).FirstOrDefault().UserName, game_name = pastGame.game_name, status = pastGame.status, updated_at = pastGame.updated_at, id = pastGame.id }; return Ok(new { game = sameGame, error = "returned early", }); } if(TTTGame.MarkBoard(gameStateIdModel.row,gameStateIdModel.col,((claim == pastGame.creator_id)? "X": "O"),pastGameState)) { pastGameState[gameStateIdModel.row, gameStateIdModel.col] = ((claim == pastGame.creator_id) ? "X" : "O"); } CleanGame cleanGame; int count = 0; for (int i =0; i < 3; i++) { for (int j = 0; j < 3; j++) { if(pastGameState[i,j] == "X" || pastGameState[i, j] == "O") { count++; } } } if(TTTGame.CheckForWinner(pastGameState)) { pastGame.winner_id = pastGame.current_turn_id; pastGame.status = GameSession.gameStatus.completed; pastGame.updated_at = DateTime.Now; pastGame.game_state = JsonConvert.SerializeObject(pastGameState); cleanGame = new CleanGame {winner_username = _db.Users.Where(x => x.Id == pastGame.current_turn_id).FirstOrDefault().UserName, winner_id = pastGame.winner_id, created_at = pastGame.created_at, creator_id = pastGame.creator_id, game_state = pastGame.game_state, creator_username = _db.Users.Where(x => x.Id == pastGame.creator_id).FirstOrDefault().UserName, current_turn_id = pastGame.current_turn_id, current_turn_username = _db.Users.Where(x => x.Id == pastGame.current_turn_id).FirstOrDefault().UserName, game_name = pastGame.game_name, status = pastGame.status, updated_at = pastGame.updated_at, id = pastGame.id }; }else if(count == 9) { pastGame.winner_id = "0"; pastGame.status = GameSession.gameStatus.completed; pastGame.updated_at = DateTime.Now; pastGame.game_state = JsonConvert.SerializeObject(pastGameState); cleanGame = new CleanGame { winner_username = "Draw", winner_id = "0", created_at = pastGame.created_at, creator_id = pastGame.creator_id, game_state = pastGame.game_state, creator_username = _db.Users.Where(x => x.Id == pastGame.creator_id).FirstOrDefault().UserName, current_turn_id = pastGame.current_turn_id, current_turn_username = _db.Users.Where(x => x.Id == pastGame.current_turn_id).FirstOrDefault().UserName, game_name = pastGame.game_name, status = pastGame.status, updated_at = pastGame.updated_at, id = pastGame.id }; } else { pastGame.current_turn_id = pastGame.current_turn_id == players[0].user_id? players[1].user_id : players[0].user_id; pastGame.updated_at = DateTime.Now; pastGame.game_state = JsonConvert.SerializeObject(pastGameState); cleanGame = new CleanGame { created_at = pastGame.created_at, creator_id = pastGame.creator_id, game_state = pastGame.game_state, creator_username = _db.Users.Where(x => x.Id == pastGame.creator_id).FirstOrDefault().UserName, current_turn_id = pastGame.current_turn_id, current_turn_username = _db.Users.Where(x => x.Id == pastGame.current_turn_id).FirstOrDefault().UserName, game_name = pastGame.game_name, status = pastGame.status, updated_at = pastGame.updated_at, id = pastGame.id }; } _db.GameSessions.Update(pastGame); _db.SaveChanges(); return Ok(new { game = cleanGame, error = count, }); ; } [Route("getGame")] [HttpPost] public async Task<IActionResult> GetGame([FromBody] IdModel idModel) { GameSession pastGame = _db.GameSessions.Where(X => (X.id == idModel.id)).FirstOrDefault(); if (pastGame != null) { CleanGame cleanGame; if (pastGame.winner_id != null && pastGame.winner_id != "0") { cleanGame = new CleanGame { winner_username = _db.Users.Where(x => x.Id == pastGame.winner_id).FirstOrDefault().UserName, winner_id = pastGame.winner_id, created_at = pastGame.created_at, creator_id = pastGame.creator_id, game_state = pastGame.game_state, creator_username = _db.Users.Where(x => x.Id == pastGame.creator_id).FirstOrDefault().UserName, current_turn_id = pastGame.current_turn_id, current_turn_username = _db.Users.Where(x => x.Id == pastGame.current_turn_id).FirstOrDefault().UserName, game_name = pastGame.game_name, status = pastGame.status, updated_at = pastGame.updated_at, id = pastGame.id }; } else if(pastGame.winner_id != null && pastGame.winner_id == "0") { cleanGame = new CleanGame { winner_username = "Draw", winner_id = pastGame.winner_id, created_at = pastGame.created_at, creator_id = pastGame.creator_id, game_state = pastGame.game_state, creator_username = _db.Users.Where(x => x.Id == pastGame.creator_id).FirstOrDefault().UserName, current_turn_id = pastGame.current_turn_id, current_turn_username = _db.Users.Where(x => x.Id == pastGame.current_turn_id).FirstOrDefault().UserName, game_name = pastGame.game_name, status = pastGame.status, updated_at = pastGame.updated_at, id = pastGame.id }; } else { cleanGame = new CleanGame { created_at = pastGame.created_at, creator_id = pastGame.creator_id, game_state = pastGame.game_state, creator_username = _db.Users.Where(x => x.Id == pastGame.creator_id).FirstOrDefault().UserName, current_turn_id = pastGame.current_turn_id, current_turn_username = _db.Users.Where(x => x.Id == pastGame.current_turn_id).FirstOrDefault().UserName, game_name = pastGame.game_name, status = pastGame.status, updated_at = pastGame.updated_at, id = pastGame.id }; } return Ok(cleanGame); } else { return Ok(new { }); } } } }
47.515358
634
0.605732
[ "Unlicense" ]
jbnilles/ph-api-deployment
Controllers/GameController.cs
13,924
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Feudal.Boards.Tiles.Units { public class Duke : Unit { public Duke() { CombatValue = 6; } public override List<Tile> GetValidMoves() { throw new NotImplementedException(); } } }
18.727273
51
0.565534
[ "MIT" ]
jdboronkas/Feudal
Feudal/Boards/Tiles/Units/Duke.cs
414
C#
using Microsoft.EntityFrameworkCore; namespace OpenEventSourcing.EntityFrameworkCore.EntityConfiguration { public interface IProjectionTypeConfiguration<T> : IEntityTypeConfiguration<T> where T : class { } }
23
82
0.769565
[ "MIT" ]
danielcirket/OpenEventSourcing
src/OpenEventSourcing.EntityFrameworkCore/EntityConfiguration/IProjectionTypeConfiguration.cs
232
C#
// ------------------------------------------------------------------------------------------------- // <copyright file="DateTemporalDataType.cs" company="RHEA System S.A."> // // Copyright 2022 RHEA System S.A. // // 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> // ------------------------------------------------------------------------------------------------ namespace Kalliope.Core { using Kalliope.Common; /// <summary> /// Values represent date information /// </summary> [Description("")] [Domain(isAbstract: false, general: "TemporalDataType")] public class DateTemporalDataType : TemporalDataType { } }
36.205882
102
0.56052
[ "Apache-2.0" ]
RHEAGROUP/Kalliope
Kalliope/Core/DataTypes/DateTemporalDataType.cs
1,233
C#
using System; using System.Drawing; namespace DevAge.Drawing { /// <summary> /// Rapresents a rounded rectangle, takes a rectangle and a round value from 0 to 1. Can be converted to a GraphicsPath for drawing operations. /// See also DevAge.Drawing.Utilities.FillRoundedRectangle and DrawRoundedRectangle methods. /// </summary> [Serializable] public struct RoundedRectangle { /// <summary> /// Costructor /// </summary> /// <param name="rect">Content rectangle</param> /// <param name="roundValue">The amount to round the rectangle. Can be any vavlues from 0 to 1. Set to 0 to draw a standard rectangle, 1 to have a full rounded rectangle.</param> public RoundedRectangle(Rectangle rect, double roundValue) { mRectangle = rect; mRoundValue = roundValue; } private Rectangle mRectangle; public Rectangle Rectangle { get{return mRectangle;} set{mRectangle = value;} } private double mRoundValue; /// <summary> /// The amount to round the rectangle. Can be any values from 0 to 1. Set to 0 to draw a standard rectangle, 1 to have a full rounded rectangle. /// </summary> public double RoundValue { get{return mRoundValue;} set { if (mRoundValue < 0 || mRoundValue > 1) throw new ApplicationException("Invalid value, must be a value from 0 to 1"); mRoundValue = value; } } /// <summary> /// Converts this structure to a GraphicsPath object, used to draw to a Graphics device. /// Consider that you can create a Region with a GraphicsPath object using one of the Region constructor. /// </summary> /// <returns></returns> public System.Drawing.Drawing2D.GraphicsPath ToGraphicsPath() { if (mRectangle.IsEmpty) return new System.Drawing.Drawing2D.GraphicsPath(); System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); if (mRoundValue == 0) { //Remove 1 from height and width to draw the border in the right location //path.AddRectangle(new Rectangle(new Point(mRectangle.X - 1, mRectangle.Y - 1), mRectangle.Size)); path.AddRectangle(mRectangle); } else { int x = mRectangle.X; int y = mRectangle.Y; int lineShift = 0; int lineShiftX2 = 0; //Basically the RoundValue is a percentage of the line to curve, so I simply multiply it with the lower side (height or width) if (mRectangle.Height < mRectangle.Width) { lineShift = (int)((double)mRectangle.Height * mRoundValue); lineShiftX2 = lineShift * 2; } else { lineShift = (int)((double)mRectangle.Width * mRoundValue); lineShiftX2 = lineShift * 2; } //Top path.AddLine(lineShift + x, 0 + y, (mRectangle.Width - lineShift) + x, 0 + y); //Angle Top Right path.AddArc((mRectangle.Width - lineShiftX2) + x, 0 + y, lineShiftX2, lineShiftX2, 270, 90); //Right path.AddLine(mRectangle.Width + x, lineShift + y, mRectangle.Width + x, (mRectangle.Height - lineShift) + y); //Angle Bottom Right path.AddArc((mRectangle.Width - lineShiftX2) + x, (mRectangle.Height - lineShiftX2) + y, lineShiftX2, lineShiftX2, 0, 90); //Bottom path.AddLine((mRectangle.Width - lineShift) + x, mRectangle.Height + y, lineShift + x, mRectangle.Height + y); //Angle Bottom Left path.AddArc(0 + x, (mRectangle.Height - lineShiftX2) + y, lineShiftX2, lineShiftX2, 90, 90); //Left path.AddLine(0 + x, (mRectangle.Height - lineShift) + y, 0 + x, lineShift + y); //Angle Top Left path.AddArc(0 + x, 0 + y, lineShiftX2, lineShiftX2, 180, 90); } return path; } } }
33.617391
180
0.629591
[ "Unlicense" ]
GibraltarSoftware/SourceGrid
src/DevAge.Windows.Forms/Drawing/RoundedRectangle.cs
3,866
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace betterpad { [Serializable] class RecoveryInfo { public string FilePath; public string Text; public int Position; } }
17.705882
34
0.647841
[ "MIT" ]
neosmart/betterpad
betterpad/RecoveryInfo.cs
287
C#
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; namespace FileHelpers { /// <summary> /// Indicates the value to assign to the field in the case of a NULL value. /// A default value if none supplied in the field itself. /// </summary> /// <remarks> /// You must specify a string and a converter that can be converted to the /// type or an object of the correct type to be directly assigned. /// <para/> /// See the <a href="http://www.filehelpers.net/mustread">complete attributes list</a> for more /// information and examples of each one. /// </remarks> [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public sealed class FieldNullValueAttribute : Attribute { /// <summary>Default value for a null value.</summary> public object NullValue { get; private set; } // internal bool NullValueOnWrite = false; /// <summary> /// Defines the default in event of a null value. /// Object must be of teh correct type /// </summary> /// <param name="nullValue">The value to assign the case of a NULL value.</param> public FieldNullValueAttribute(object nullValue) { NullValue = nullValue; // NullValueOnWrite = useOnWrite; } // /// <summary>Defines the default for a null value.</summary> // /// <param name="nullValue">The value to assign in the "NULL" case.</param> // public FieldNullValueAttribute(object nullValue): this(nullValue, false) // {} // /// <summary>Indicates a type and a string to be converted to that type.</summary> // /// <param name="type">The type of the null value.</param> // /// <param name="nullValue">The string to be converted to the specified type.</param> // /// <param name="useOnWrite">Indicates that if the field has that value when the library writes, then the engine use an empty string.</param> // public FieldNullValueAttribute(Type type, string nullValue, bool useOnWrite):this(Convert.ChangeType(nullValue, type, null), useOnWrite) // {} /// <summary>Indicates a type and a string to be converted to that type.</summary> /// <param name="type">The type of the null value.</param> /// <param name="nullValue">The string to be converted to the specified type.</param> public FieldNullValueAttribute(Type type, string nullValue) : this(TypeDescriptor.GetConverter(type).ConvertFromString(nullValue)) {} } }
43.568966
145
0.673526
[ "MIT" ]
kimseungkyeong/FileHelper
FileHelpers/Attributes/FieldNullValueAttribute.cs
2,527
C#
using System; using System.Collections.Generic; using System.Linq.Expressions; //Chaow.Expressions enhances the power of expression namespace Chaow.Expressions { //ExpressionComparer allows you to test expression for equality public static class ExpressionComparer_ { public static void Comparer_Usage() { //this example shows how to create/use ExpressionComparer //you can create comparer by ExpressionComparer.Default var comparer = ExpressionComparer.Default; //create expressions Expression<Func<int, int, int>> add = (x, y) => x + y; Expression<Func<int, int, int>> mult = (x, y) => x * y; //now compare Console.WriteLine(comparer.Equals(add, add)); Console.WriteLine(comparer.Equals(add, mult)); } public static void Comparer_IEqualityComparer() { //this example shows you can send ExpressionComparer as IEqualityComparer //you can create comparer by ExpressionComparer.Default var comparer = ExpressionComparer.Default; //create expressions Expression<Func<int, int, int>> add = (x, y) => x + y; Expression<Func<int, int, int>> mult = (x, y) => x * y; //create dictionary var dict = new Dictionary<Expression, string>(comparer) { {add, "add"}, {mult, "multiply"} }; //show result Console.WriteLine(dict[mult]); } } }
31.68
85
0.583965
[ "MIT" ]
chaowlert/algorithm
Sample/Samples/Expressions/ExpressionComparer_.cs
1,586
C#
using System; using System.Collections.Generic; using System.Configuration; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void addbook_Click(object sender, EventArgs e) { if (Branch.Text == "Select Branch") { Response.Write("Please choose branch"); } else { try { SqlConnection sq = new SqlConnection(ConfigurationManager.ConnectionStrings["DBC"].ConnectionString); sq.Open(); SqlCommand cmd = new SqlCommand("insert into " + Branch.SelectedValue + "books values('" + bid.Text + "','" + bname.Text + "','" + bauth.Text + "','" + copies.Text + "','" + copies.Text + "')", sq); cmd.ExecuteNonQuery(); sq.Close(); ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key", string.Format("alert('{0}'); ", "Book Added"), true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key", string.Format("alert('{0}'); ", ex), true); } } } }
31.162791
214
0.56791
[ "MIT" ]
dj2512/Alpha
Alpha Rebranded/Lib_addnew.aspx.cs
1,342
C#
using SkuVaultApiWrapper.Models.Shared; using System; using System.Collections.Generic; using System.Text; namespace SkuVaultApiWrapper.Models.GetKits { public class GetKitsRequest : BasePagedRequestModel { public override string Endpoint() => SkuVaultEndpoints.getKits; public string AvailableQuantityModifiedAfterDateTimeUtc { get; set; } public string AvailableQuantityModifiedBeforeDateTimeUtc { get; set; } public bool GetAvailableQuantity { get; set; } public bool IncludeKitCost { get; set; } public string ModifiedAfterDateTimeUtc { get; set; } public string ModifiedBeforeDateTimeUtc { get; set; } } }
33.157895
72
0.790476
[ "MIT" ]
ntoates/SkuVaultApiWrapper
SkuVaultApiWrapper/Models/GetKits/GetKitsRequest.cs
632
C#
namespace AutoStep.Elements.StepTokens { /// <summary> /// Represents a float token (actually backed by a decimal). /// </summary> internal class FloatToken : NumericalToken<decimal> { /// <summary> /// Initializes a new instance of the <see cref="FloatToken"/> class. /// </summary> /// <param name="startIndex">The starting 0-based index within the text.</param> /// <param name="length">The character length of the token.</param> public FloatToken(int startIndex, int length) : base(startIndex, length) { } } }
32.368421
88
0.596748
[ "MIT" ]
SivaGudivada/AutoStep
src/AutoStep/Elements/StepTokens/FloatToken.cs
617
C#
using UnityEngine; namespace UnityStandardAssets.ImageEffects { [ExecuteInEditMode] [RequireComponent (typeof(Camera))] [AddComponentMenu ("Image Effects/Camera/Depth of Field (deprecated)") ] public class DepthOfFieldDeprecated : PostEffectsBase { public enum Dof34QualitySetting { OnlyBackground = 1, BackgroundAndForeground = 2, } public enum DofResolution { High = 2, Medium = 3, Low = 4, } public enum DofBlurriness { Low = 1, High = 2, VeryHigh = 4, } public enum BokehDestination { Background = 0x1, Foreground = 0x2, BackgroundAndForeground = 0x3, } static private int SMOOTH_DOWNSAMPLE_PASS = 6; static private float BOKEH_EXTRA_BLUR = 2.0f; public Dof34QualitySetting quality = Dof34QualitySetting.OnlyBackground; public DofResolution resolution = DofResolution.Low; public bool simpleTweakMode = true; public float focalPoint = 1.0f; public float smoothness = 0.5f; public float focalZDistance = 0.0f; public float focalZStartCurve = 1.0f; public float focalZEndCurve = 1.0f; private float focalStartCurve = 2.0f; private float focalEndCurve = 2.0f; private float focalDistance01 = 0.1f; public Transform objectFocus = null; public float focalSize = 0.0f; public DofBlurriness bluriness = DofBlurriness.High; public float maxBlurSpread = 1.75f; public float foregroundBlurExtrude = 1.15f; public Shader dofBlurShader; private Material dofBlurMaterial = null; public Shader dofShader; private Material dofMaterial = null; public bool visualize = false; public BokehDestination bokehDestination = BokehDestination.Background; private float widthOverHeight = 1.25f; private float oneOverBaseSize = 1.0f / 512.0f; public bool bokeh = false; public bool bokehSupport = true; public Shader bokehShader; public Texture2D bokehTexture; public float bokehScale = 2.4f; public float bokehIntensity = 0.15f; public float bokehThresholdContrast = 0.1f; public float bokehThresholdLuminance = 0.55f; public int bokehDownsample = 1; private Material bokehMaterial; private Camera _camera; void CreateMaterials () { dofBlurMaterial = CheckShaderAndCreateMaterial (dofBlurShader, dofBlurMaterial); dofMaterial = CheckShaderAndCreateMaterial (dofShader,dofMaterial); bokehSupport = bokehShader.isSupported; if (bokeh && bokehSupport && bokehShader) bokehMaterial = CheckShaderAndCreateMaterial (bokehShader, bokehMaterial); } public override bool CheckResources () { CheckSupport (true); dofBlurMaterial = CheckShaderAndCreateMaterial (dofBlurShader, dofBlurMaterial); dofMaterial = CheckShaderAndCreateMaterial (dofShader,dofMaterial); bokehSupport = bokehShader.isSupported; if (bokeh && bokehSupport && bokehShader) bokehMaterial = CheckShaderAndCreateMaterial (bokehShader, bokehMaterial); if (!isSupported) ReportAutoDisable (); return isSupported; } void OnDisable () { Quads.Cleanup (); } void OnEnable () { _camera = GetComponent<Camera>(); _camera.depthTextureMode |= DepthTextureMode.Depth; } float FocalDistance01 ( float worldDist) { return _camera.WorldToViewportPoint((worldDist-_camera.nearClipPlane) * _camera.transform.forward + _camera.transform.position).z / (_camera.farClipPlane-_camera.nearClipPlane); } int GetDividerBasedOnQuality () { int divider = 1; if (resolution == DofResolution.Medium) divider = 2; else if (resolution == DofResolution.Low) divider = 2; return divider; } int GetLowResolutionDividerBasedOnQuality ( int baseDivider) { int lowTexDivider = baseDivider; if (resolution == DofResolution.High) lowTexDivider *= 2; if (resolution == DofResolution.Low) lowTexDivider *= 2; return lowTexDivider; } private RenderTexture foregroundTexture = null; private RenderTexture mediumRezWorkTexture = null; private RenderTexture finalDefocus = null; private RenderTexture lowRezWorkTexture = null; private RenderTexture bokehSource = null; private RenderTexture bokehSource2 = null; void OnRenderImage (RenderTexture source, RenderTexture destination) { if (CheckResources()==false) { Graphics.Blit (source, destination); return; } if (smoothness < 0.1f) smoothness = 0.1f; // update needed focal & rt size parameter bokeh = bokeh && bokehSupport; float bokehBlurAmplifier = bokeh ? BOKEH_EXTRA_BLUR : 1.0f; bool blurForeground = quality > Dof34QualitySetting.OnlyBackground; float focal01Size = focalSize / (_camera.farClipPlane - _camera.nearClipPlane);; if (simpleTweakMode) { focalDistance01 = objectFocus ? (_camera.WorldToViewportPoint (objectFocus.position)).z / (_camera.farClipPlane) : FocalDistance01 (focalPoint); focalStartCurve = focalDistance01 * smoothness; focalEndCurve = focalStartCurve; blurForeground = blurForeground && (focalPoint > (_camera.nearClipPlane + Mathf.Epsilon)); } else { if (objectFocus) { var vpPoint= _camera.WorldToViewportPoint (objectFocus.position); vpPoint.z = (vpPoint.z) / (_camera.farClipPlane); focalDistance01 = vpPoint.z; } else focalDistance01 = FocalDistance01 (focalZDistance); focalStartCurve = focalZStartCurve; focalEndCurve = focalZEndCurve; blurForeground = blurForeground && (focalPoint > (_camera.nearClipPlane + Mathf.Epsilon)); } widthOverHeight = (1.0f * source.width) / (1.0f * source.height); oneOverBaseSize = 1.0f / 512.0f; dofMaterial.SetFloat ("_ForegroundBlurExtrude", foregroundBlurExtrude); dofMaterial.SetVector ("_CurveParams", new Vector4 (simpleTweakMode ? 1.0f / focalStartCurve : focalStartCurve, simpleTweakMode ? 1.0f / focalEndCurve : focalEndCurve, focal01Size * 0.5f, focalDistance01)); dofMaterial.SetVector ("_InvRenderTargetSize", new Vector4 (1.0f / (1.0f * source.width), 1.0f / (1.0f * source.height),0.0f,0.0f)); int divider = GetDividerBasedOnQuality (); int lowTexDivider = GetLowResolutionDividerBasedOnQuality (divider); AllocateTextures (blurForeground, source, divider, lowTexDivider); // WRITE COC to alpha channel // source is only being bound to detect y texcoord flip Graphics.Blit (source, source, dofMaterial, 3); // better DOWNSAMPLE (could actually be weighted for higher quality) Downsample (source, mediumRezWorkTexture); // BLUR A LITTLE first, which has two purposes // 1.) reduce jitter, noise, aliasing // 2.) produce the little-blur buffer used in composition later Blur (mediumRezWorkTexture, mediumRezWorkTexture, DofBlurriness.Low, 4, maxBlurSpread); if ((bokeh) && ((BokehDestination.Foreground & bokehDestination) != 0)) { dofMaterial.SetVector ("_Threshhold", new Vector4(bokehThresholdContrast, bokehThresholdLuminance, 0.95f, 0.0f)); // add and mark the parts that should end up as bokeh shapes Graphics.Blit (mediumRezWorkTexture, bokehSource2, dofMaterial, 11); // remove those parts (maybe even a little tittle bittle more) from the regurlarly blurred buffer //Graphics.Blit (mediumRezWorkTexture, lowRezWorkTexture, dofMaterial, 10); Graphics.Blit (mediumRezWorkTexture, lowRezWorkTexture);//, dofMaterial, 10); // maybe you want to reblur the small blur ... but not really needed. //Blur (mediumRezWorkTexture, mediumRezWorkTexture, DofBlurriness.Low, 4, maxBlurSpread); // bigger BLUR Blur (lowRezWorkTexture, lowRezWorkTexture, bluriness, 0, maxBlurSpread * bokehBlurAmplifier); } else { // bigger BLUR Downsample (mediumRezWorkTexture, lowRezWorkTexture); Blur (lowRezWorkTexture, lowRezWorkTexture, bluriness, 0, maxBlurSpread); } dofBlurMaterial.SetTexture ("_TapLow", lowRezWorkTexture); dofBlurMaterial.SetTexture ("_TapMedium", mediumRezWorkTexture); Graphics.Blit (null, finalDefocus, dofBlurMaterial, 3); // we are only adding bokeh now if the background is the only part we have to deal with if ((bokeh) && ((BokehDestination.Foreground & bokehDestination) != 0)) AddBokeh (bokehSource2, bokehSource, finalDefocus); dofMaterial.SetTexture ("_TapLowBackground", finalDefocus); dofMaterial.SetTexture ("_TapMedium", mediumRezWorkTexture); // needed for debugging/visualization // FINAL DEFOCUS (background) Graphics.Blit (source, blurForeground ? foregroundTexture : destination, dofMaterial, visualize ? 2 : 0); // FINAL DEFOCUS (foreground) if (blurForeground) { // WRITE COC to alpha channel Graphics.Blit (foregroundTexture, source, dofMaterial, 5); // DOWNSAMPLE (unweighted) Downsample (source, mediumRezWorkTexture); // BLUR A LITTLE first, which has two purposes // 1.) reduce jitter, noise, aliasing // 2.) produce the little-blur buffer used in composition later BlurFg (mediumRezWorkTexture, mediumRezWorkTexture, DofBlurriness.Low, 2, maxBlurSpread); if ((bokeh) && ((BokehDestination.Foreground & bokehDestination) != 0)) { dofMaterial.SetVector ("_Threshhold", new Vector4(bokehThresholdContrast * 0.5f, bokehThresholdLuminance, 0.0f, 0.0f)); // add and mark the parts that should end up as bokeh shapes Graphics.Blit (mediumRezWorkTexture, bokehSource2, dofMaterial, 11); // remove the parts (maybe even a little tittle bittle more) that will end up in bokeh space //Graphics.Blit (mediumRezWorkTexture, lowRezWorkTexture, dofMaterial, 10); Graphics.Blit (mediumRezWorkTexture, lowRezWorkTexture);//, dofMaterial, 10); // big BLUR BlurFg (lowRezWorkTexture, lowRezWorkTexture, bluriness, 1, maxBlurSpread * bokehBlurAmplifier); } else { // big BLUR BlurFg (mediumRezWorkTexture, lowRezWorkTexture, bluriness, 1, maxBlurSpread); } // simple upsample once Graphics.Blit (lowRezWorkTexture, finalDefocus); dofMaterial.SetTexture ("_TapLowForeground", finalDefocus); Graphics.Blit (source, destination, dofMaterial, visualize ? 1 : 4); if ((bokeh) && ((BokehDestination.Foreground & bokehDestination) != 0)) AddBokeh (bokehSource2, bokehSource, destination); } ReleaseTextures (); } void Blur ( RenderTexture from, RenderTexture to, DofBlurriness iterations, int blurPass, float spread) { RenderTexture tmp = RenderTexture.GetTemporary (to.width, to.height); if ((int)iterations > 1) { BlurHex (from, to, blurPass, spread, tmp); if ((int)iterations > 2) { dofBlurMaterial.SetVector ("offsets", new Vector4 (0.0f, spread * oneOverBaseSize, 0.0f, 0.0f)); Graphics.Blit (to, tmp, dofBlurMaterial, blurPass); dofBlurMaterial.SetVector ("offsets", new Vector4 (spread / widthOverHeight * oneOverBaseSize, 0.0f, 0.0f, 0.0f)); Graphics.Blit (tmp, to, dofBlurMaterial, blurPass); } } else { dofBlurMaterial.SetVector ("offsets", new Vector4 (0.0f, spread * oneOverBaseSize, 0.0f, 0.0f)); Graphics.Blit (from, tmp, dofBlurMaterial, blurPass); dofBlurMaterial.SetVector ("offsets", new Vector4 (spread / widthOverHeight * oneOverBaseSize, 0.0f, 0.0f, 0.0f)); Graphics.Blit (tmp, to, dofBlurMaterial, blurPass); } RenderTexture.ReleaseTemporary (tmp); } void BlurFg ( RenderTexture from, RenderTexture to, DofBlurriness iterations, int blurPass, float spread) { // we want a nice, big coc, hence we need to tap once from this (higher resolution) texture dofBlurMaterial.SetTexture ("_TapHigh", from); RenderTexture tmp = RenderTexture.GetTemporary (to.width, to.height); if ((int)iterations > 1) { BlurHex (from, to, blurPass, spread, tmp); if ((int)iterations > 2) { dofBlurMaterial.SetVector ("offsets", new Vector4 (0.0f, spread * oneOverBaseSize, 0.0f, 0.0f)); Graphics.Blit (to, tmp, dofBlurMaterial, blurPass); dofBlurMaterial.SetVector ("offsets", new Vector4 (spread / widthOverHeight * oneOverBaseSize, 0.0f, 0.0f, 0.0f)); Graphics.Blit (tmp, to, dofBlurMaterial, blurPass); } } else { dofBlurMaterial.SetVector ("offsets", new Vector4 (0.0f, spread * oneOverBaseSize, 0.0f, 0.0f)); Graphics.Blit (from, tmp, dofBlurMaterial, blurPass); dofBlurMaterial.SetVector ("offsets", new Vector4 (spread / widthOverHeight * oneOverBaseSize, 0.0f, 0.0f, 0.0f)); Graphics.Blit (tmp, to, dofBlurMaterial, blurPass); } RenderTexture.ReleaseTemporary (tmp); } void BlurHex ( RenderTexture from, RenderTexture to, int blurPass, float spread, RenderTexture tmp) { dofBlurMaterial.SetVector ("offsets", new Vector4 (0.0f, spread * oneOverBaseSize, 0.0f, 0.0f)); Graphics.Blit (from, tmp, dofBlurMaterial, blurPass); dofBlurMaterial.SetVector ("offsets", new Vector4 (spread / widthOverHeight * oneOverBaseSize, 0.0f, 0.0f, 0.0f)); Graphics.Blit (tmp, to, dofBlurMaterial, blurPass); dofBlurMaterial.SetVector ("offsets", new Vector4 (spread / widthOverHeight * oneOverBaseSize, spread * oneOverBaseSize, 0.0f, 0.0f)); Graphics.Blit (to, tmp, dofBlurMaterial, blurPass); dofBlurMaterial.SetVector ("offsets", new Vector4 (spread / widthOverHeight * oneOverBaseSize, -spread * oneOverBaseSize, 0.0f, 0.0f)); Graphics.Blit (tmp, to, dofBlurMaterial, blurPass); } void Downsample ( RenderTexture from, RenderTexture to) { dofMaterial.SetVector ("_InvRenderTargetSize", new Vector4 (1.0f / (1.0f * to.width), 1.0f / (1.0f * to.height), 0.0f, 0.0f)); Graphics.Blit (from, to, dofMaterial, SMOOTH_DOWNSAMPLE_PASS); } void AddBokeh ( RenderTexture bokehInfo, RenderTexture tempTex, RenderTexture finalTarget) { if (bokehMaterial) { var meshes = Quads.GetMeshes (tempTex.width, tempTex.height); // quads: exchanging more triangles with less overdraw RenderTexture.active = tempTex; GL.Clear (false, true, new Color (0.0f, 0.0f, 0.0f, 0.0f)); GL.PushMatrix (); GL.LoadIdentity (); // point filter mode is important, otherwise we get bokeh shape & size artefacts bokehInfo.filterMode = FilterMode.Point; float arW = (bokehInfo.width * 1.0f) / (bokehInfo.height * 1.0f); float sc = 2.0f / (1.0f * bokehInfo.width); sc += bokehScale * maxBlurSpread * BOKEH_EXTRA_BLUR * oneOverBaseSize; bokehMaterial.SetTexture ("_Source", bokehInfo); bokehMaterial.SetTexture ("_MainTex", bokehTexture); bokehMaterial.SetVector ("_ArScale",new Vector4 (sc, sc * arW, 0.5f, 0.5f * arW)); bokehMaterial.SetFloat ("_Intensity", bokehIntensity); bokehMaterial.SetPass (0); foreach(Mesh m in meshes) if (m) Graphics.DrawMeshNow (m, Matrix4x4.identity); GL.PopMatrix (); Graphics.Blit (tempTex, finalTarget, dofMaterial, 8); // important to set back as we sample from this later on bokehInfo.filterMode = FilterMode.Bilinear; } } void ReleaseTextures () { if (foregroundTexture) RenderTexture.ReleaseTemporary (foregroundTexture); if (finalDefocus) RenderTexture.ReleaseTemporary (finalDefocus); if (mediumRezWorkTexture) RenderTexture.ReleaseTemporary (mediumRezWorkTexture); if (lowRezWorkTexture) RenderTexture.ReleaseTemporary (lowRezWorkTexture); if (bokehSource) RenderTexture.ReleaseTemporary (bokehSource); if (bokehSource2) RenderTexture.ReleaseTemporary (bokehSource2); } void AllocateTextures ( bool blurForeground, RenderTexture source, int divider, int lowTexDivider) { foregroundTexture = null; if (blurForeground) foregroundTexture = RenderTexture.GetTemporary (source.width, source.height, 0); mediumRezWorkTexture = RenderTexture.GetTemporary (source.width / divider, source.height / divider, 0); finalDefocus = RenderTexture.GetTemporary (source.width / divider, source.height / divider, 0); lowRezWorkTexture = RenderTexture.GetTemporary (source.width / lowTexDivider, source.height / lowTexDivider, 0); bokehSource = null; bokehSource2 = null; if (bokeh) { bokehSource = RenderTexture.GetTemporary (source.width / (lowTexDivider * bokehDownsample), source.height / (lowTexDivider * bokehDownsample), 0, RenderTextureFormat.ARGBHalf); bokehSource2 = RenderTexture.GetTemporary (source.width / (lowTexDivider * bokehDownsample), source.height / (lowTexDivider * bokehDownsample), 0, RenderTextureFormat.ARGBHalf); bokehSource.filterMode = FilterMode.Bilinear; bokehSource2.filterMode = FilterMode.Bilinear; RenderTexture.active = bokehSource2; GL.Clear (false, true, new Color(0.0f, 0.0f, 0.0f, 0.0f)); } // to make sure: always use bilinear filter setting source.filterMode = FilterMode.Bilinear; finalDefocus.filterMode = FilterMode.Bilinear; mediumRezWorkTexture.filterMode = FilterMode.Bilinear; lowRezWorkTexture.filterMode = FilterMode.Bilinear; if (foregroundTexture) foregroundTexture.filterMode = FilterMode.Bilinear; } } }
46.824356
218
0.612384
[ "MIT" ]
alexnaraghi/clash-of-clones
Assets/Plugins/Standard Assets/Effects/ImageEffects/Scripts/DepthOfFieldDeprecated.cs
19,994
C#
using FinanceAPICore.Tasks; using Microsoft.Extensions.Options; namespace FinanceAPIData.Tasks { public class LogoCalculatorTask : BaseTask { private readonly TransactionLogoCalculator _transactionLogoCalculator; public LogoCalculatorTask(IOptions<TaskSettings> settings, TransactionLogoCalculator transactionLogoCalculator) : base(settings) { _transactionLogoCalculator = transactionLogoCalculator; } public override void Execute(Task task) { var filterClientId = task.Data["ClientID"]?.ToString(); var filterAccountId = task.Data["AccountID"]?.ToString(); // Run Calculator _transactionLogoCalculator.Run(filterClientId, filterAccountId); base.Execute(task); } } }
33.4
136
0.663473
[ "Apache-2.0" ]
benfl3713/finance-api
src/FinanceAPI/FinanceAPIData/Tasks/LogoCalculatorTask.cs
837
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Threading.Tasks; using Sentry.Infrastructure; namespace Sentry.Extensibility { /// <summary> /// An implementation of <see cref="IHub" /> which forwards any call to <see cref="SentrySdk" />. /// </summary> /// <remarks> /// Allows testing classes which otherwise would need to depend on static <see cref="SentrySdk" /> /// by having them depend on <see cref="IHub"/> instead, which can be mocked. /// </remarks> /// <inheritdoc cref="IHub" /> [DebuggerStepThrough] public sealed class HubAdapter : IHub { /// <summary> /// The single instance which forwards all calls to <see cref="SentrySdk"/> /// </summary> public static readonly HubAdapter Instance = new(); private HubAdapter() { } /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> public bool IsEnabled { [DebuggerStepThrough] get => SentrySdk.IsEnabled; } /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> public SentryId LastEventId { [DebuggerStepThrough] get => SentrySdk.LastEventId; } /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public void ConfigureScope(Action<Scope> configureScope) => SentrySdk.ConfigureScope(configureScope); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public Task ConfigureScopeAsync(Func<Scope, Task> configureScope) => SentrySdk.ConfigureScopeAsync(configureScope); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public IDisposable PushScope() => SentrySdk.PushScope(); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public IDisposable PushScope<TState>(TState state) => SentrySdk.PushScope(state); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public void WithScope(Action<Scope> scopeCallback) => SentrySdk.WithScope(scopeCallback); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public ITransaction StartTransaction( ITransactionContext context, IReadOnlyDictionary<string, object?> customSamplingContext) => SentrySdk.StartTransaction(context, customSamplingContext); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public void BindException(Exception exception, ISpan span) => SentrySdk.BindException(exception, span); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public ISpan? GetSpan() => SentrySdk.GetSpan(); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public SentryTraceHeader? GetTraceHeader() => SentrySdk.GetTraceHeader(); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public void BindClient(ISentryClient client) => SentrySdk.BindClient(client); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public void AddBreadcrumb( string message, string? category = null, string? type = null, IDictionary<string, string>? data = null, BreadcrumbLevel level = default) => SentrySdk.AddBreadcrumb(message, category, type, data, level); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] public void AddBreadcrumb( ISystemClock clock, string message, string? category = null, string? type = null, IDictionary<string, string>? data = null, BreadcrumbLevel level = default) => SentrySdk.AddBreadcrumb( clock, message, category, type, data, level); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public SentryId CaptureEvent(SentryEvent evt) => SentrySdk.CaptureEvent(evt); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] public SentryId CaptureException(Exception exception) => SentrySdk.CaptureException(exception); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] public SentryId CaptureEvent(SentryEvent evt, Scope? scope) => SentrySdk.CaptureEvent(evt, scope); /// <summary> /// Forwards the call to <see cref="SentrySdk"/>. /// </summary> [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] public void CaptureTransaction(Transaction transaction) => SentrySdk.CaptureTransaction(transaction); /// <summary> /// Forwards the call to <see cref="SentrySdk"/> /// </summary> [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] public Task FlushAsync(TimeSpan timeout) => SentrySdk.FlushAsync(timeout); /// <summary> /// Forwards the call to <see cref="SentrySdk"/> /// </summary> [DebuggerStepThrough] [EditorBrowsable(EditorBrowsableState.Never)] public void CaptureUserFeedback(UserFeedback sentryUserFeedback) => SentrySdk.CaptureUserFeedback(sentryUserFeedback); } }
34.767196
102
0.581647
[ "MIT" ]
Genteure/sentry-dotnet
src/Sentry/Extensibility/HubAdapter.cs
6,571
C#
// -------------------------------------------------------------------------------------------------------------------- // <auto-generated> // Generated using OBeautifulCode.CodeGen.ModelObject (1.0.0.0) // </auto-generated> // -------------------------------------------------------------------------------------------------------------------- namespace OBeautifulCode.CodeGen.ModelObject.Test.Test { using global::System; using global::System.CodeDom.Compiler; using global::System.Collections.Concurrent; using global::System.Collections.Generic; using global::System.Collections.ObjectModel; using global::System.Diagnostics.CodeAnalysis; using global::System.Globalization; using global::System.Linq; using global::System.Reflection; using global::FakeItEasy; using global::OBeautifulCode.Assertion.Recipes; using global::OBeautifulCode.AutoFakeItEasy; using global::OBeautifulCode.CodeGen.ModelObject.Recipes; using global::OBeautifulCode.Equality.Recipes; using global::OBeautifulCode.Math.Recipes; using global::OBeautifulCode.Reflection.Recipes; using global::OBeautifulCode.Representation.System; using global::OBeautifulCode.Serialization; using global::OBeautifulCode.Serialization.Recipes; using global::OBeautifulCode.Type; using global::Xunit; using static global::System.FormattableString; public static partial class ModelStringRepresentationPublicSetNoneTest { private static readonly StringRepresentationTestScenarios<ModelStringRepresentationPublicSetNone> StringRepresentationTestScenarios = new StringRepresentationTestScenarios<ModelStringRepresentationPublicSetNone>(); [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] [SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")] public static class Structural { [Fact] [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] [SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")] [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")] [SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")] [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")] [SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")] [SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")] [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")] [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")] public static void ModelStringRepresentationPublicSetNone___Should_implement_IStringRepresentable___When_reflecting() { // Arrange var type = typeof(ModelStringRepresentationPublicSetNone); var expectedModelMethods = typeof(IStringRepresentable).GetInterfaceDeclaredAndImplementedMethods(); var expectedModelMethodHashes = expectedModelMethods.Select(_ => _.GetSignatureHash()); // Act var actualInterfaces = type.GetInterfaces(); var actualModelMethods = type.GetMethodsFiltered(MemberRelationships.DeclaredOrInherited, MemberOwners.Instance, MemberAccessModifiers.Public).ToList(); var actualModelMethodHashes = actualModelMethods.Select(_ => _.GetSignatureHash()); // Assert actualInterfaces.AsTest().Must().ContainElement(typeof(IStringRepresentable)); expectedModelMethodHashes.Except(actualModelMethodHashes).AsTest().Must().BeEmptyEnumerable(); } [Fact] [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] [SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")] [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")] [SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")] [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")] [SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")] [SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")] [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")] [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")] public static void ModelStringRepresentationPublicSetNone___Should_declare_ToString_method___When_reflecting() { // Arrange var expected = typeof(ModelStringRepresentationPublicSetNone); // Act var actual = expected.GetMethodsFiltered(MemberRelationships.DeclaredInType, MemberOwners.Instance, MemberAccessModifiers.Public).Single(_ => (_.Name == nameof(ToString)) && (!_.GetParameters().Any())); // Assert actual.DeclaringType.AsTest().Must().BeEqualTo(expected); } [Fact] [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] [SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")] [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")] [SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")] [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")] [SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")] [SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")] [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")] [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")] public static void ModelStringRepresentationPublicSetNone___Should_be_attributed_with_Serializable____When_reflecting() { // Arrange var type = typeof(ModelStringRepresentationPublicSetNone); // Act var actualAttributes = type.GetCustomAttributes(typeof(SerializableAttribute), false); // Assert actualAttributes.AsTest().Must().NotBeEmptyEnumerable(); } } [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] [SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")] public static class StringRepresentation { [Fact] [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")] [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] [SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")] [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")] [SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")] [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")] [SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")] [SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")] [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")] [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")] public static void ToString___Should_generate_friendly_string_representation_of_object___When_called() { var scenarios = StringRepresentationTestScenarios.ValidateAndPrepareForTesting(); foreach (var scenario in scenarios) { // Arrange, Act var actual = scenario.SystemUnderTest.ToString(); // Assert actual.AsTest().Must().BeEqualTo(scenario.ExpectedStringRepresentation, because: scenario.Id); } } } } }
61.276074
222
0.690328
[ "MIT" ]
OBeautifulCode/OBeautifulCode.CodeGen
OBeautifulCode.CodeGen.ModelObject.Test/ModelTests/Scripted/StringRepresentation/PublicSet/None/ModelStringRepresentationPublicSetNoneTest.designer.cs
9,990
C#
// ----------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // ----------------------------------------------------------------------- using System; using System.ComponentModel.Composition.Factories; using System.ComponentModel.Composition.Hosting; using System.Linq; using System.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace System.ComponentModel.Composition { [TestClass] public class CompositionContainerExtensibilityTests { [TestMethod] public void Dispose_DoesNotThrow() { var container = CreateCustomCompositionContainer(); container.Dispose(); } [TestMethod] public void DerivedCompositionContainer_CanExportItself() { var container = CreateCustomCompositionContainer(); container.AddAndComposeExportedValue<CustomCompositionContainer>(container); Assert.AreSame(container, container.GetExportedValue<CustomCompositionContainer>()); } [TestMethod] public void ICompositionService_CanBeExported() { var container = CreateCustomCompositionContainer(); container.AddAndComposeExportedValue<ICompositionService>(container); Assert.AreSame(container, container.GetExportedValue<ICompositionService>()); } [TestMethod] public void CompositionContainer_CanBeExported() { var container = CreateCustomCompositionContainer(); container.AddAndComposeExportedValue<CompositionContainer>(container); Assert.AreSame(container, container.GetExportedValue<CompositionContainer>()); } [TestMethod] public void CanBeCollectedAfterDispose() { AggregateExportProvider exportProvider = new AggregateExportProvider(); var catalog = new AggregateCatalog(CatalogFactory.CreateDefaultAttributed()); var container = new CompositionContainer(catalog, exportProvider); WeakReference weakContainer = new WeakReference(container); container.Dispose(); container = null; GC.Collect(); GC.WaitForPendingFinalizers(); Assert.IsFalse(weakContainer.IsAlive); GC.KeepAlive(exportProvider); GC.KeepAlive(catalog); } private CustomCompositionContainer CreateCustomCompositionContainer() { return new CustomCompositionContainer(); } // Type needs to be public otherwise container.GetExportedValue<CustomCompositionContainer> // fails on Silverlight because it cannot construct a Lazy<T,M> factory. public class CustomCompositionContainer : CompositionContainer { } } }
36.060976
101
0.624281
[ "MIT" ]
MicrosoftArchive/mef
redist/test/ComponentModelUnitTest/System/ComponentModel/Composition/CompositionContainerExtensibilityTests.cs
2,957
C#
using System; using System.Collections.Generic; using System.Text; namespace PR.Flopcsharp { public class FCS_Expression { public virtual void Action(FCS_MRow mrow, double factor) { } public static FCS_Expression_bound operator <=(FCS_Expression exp1, FCS_Expression_Numeric d) { FCS_Expression_bound expb = FCS_Expression_bound.GetExpressionBound(exp1, d, BOUNDS.SUP); return expb; } public static FCS_Expression_bound operator <=(FCS_Expression_Numeric d, FCS_Expression exp1) { FCS_Expression_bound expb = FCS_Expression_bound.GetExpressionBound(exp1, d, BOUNDS.INF); return expb; } public static FCS_Expression_bound operator >=(FCS_Expression exp1, FCS_Expression_Numeric d) { FCS_Expression_bound expb = FCS_Expression_bound.GetExpressionBound(exp1, d, BOUNDS.INF); return expb; } public static FCS_Expression_bound operator >=(FCS_Expression_Numeric d, FCS_Expression exp1) { FCS_Expression_bound expb = FCS_Expression_bound.GetExpressionBound(exp1, d, BOUNDS.SUP); return expb; } public static FCS_Expression_bound operator ==(FCS_Expression exp1, FCS_Expression_Numeric d) { FCS_Expression_bound expb = FCS_Expression_bound.GetExpressionBound(exp1, d, BOUNDS.EQ); return expb; } public static FCS_Expression_bound operator !=(FCS_Expression exp1, FCS_Expression_Numeric d) { FCS_Expression_bound expb = FCS_Expression_bound.GetExpressionBound(exp1, d, BOUNDS.EQ); return expb; } public virtual double GetValue() { return 0; } } }
34.425926
102
0.635826
[ "MIT" ]
lionelberton/FlopCSharp
src/Flopcsharp/FCS_Expression.cs
1,859
C#
#pragma checksum "..\..\App.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7B487C3479195958FFD65F8DB8DCF5CD9B5E68B92CC4940AAE6A82E91802DE8B" //------------------------------------------------------------------------------ // <auto-generated> // Tento kód byl generován nástrojem. // Verze modulu runtime:4.0.30319.42000 // // Změny tohoto souboru mohou způsobit nesprávné chování a budou ztraceny, // dojde-li k novému generování kódu. // </auto-generated> //------------------------------------------------------------------------------ using BeMusic; using ModernWpf; using ModernWpf.Controls; using ModernWpf.Controls.Primitives; using ModernWpf.DesignTime; using ModernWpf.Markup; using ModernWpf.Media.Animation; using System; using System.Diagnostics; using System.Windows; using System.Windows.Automation; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Effects; using System.Windows.Media.Imaging; using System.Windows.Media.Media3D; using System.Windows.Media.TextFormatting; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Shell; namespace BeMusic { /// <summary> /// App /// </summary> public partial class App : System.Windows.Application { private bool _contentLoaded; /// <summary> /// InitializeComponent /// </summary> [System.Diagnostics.DebuggerNonUserCodeAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; #line 5 "..\..\App.xaml" this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative); #line default #line hidden System.Uri resourceLocater = new System.Uri("/BeMusic;component/app.xaml", System.UriKind.Relative); #line 1 "..\..\App.xaml" System.Windows.Application.LoadComponent(this, resourceLocater); #line default #line hidden } /// <summary> /// Application Entry Point. /// </summary> [System.STAThreadAttribute()] [System.Diagnostics.DebuggerNonUserCodeAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] public static void Main() { BeMusic.App app = new BeMusic.App(); app.InitializeComponent(); app.Run(); } } }
32.211111
142
0.616419
[ "Apache-2.0" ]
bexcool/BeMusic
obj/Debug/App.g.cs
2,914
C#