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
sequence
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
using System; using System.Globalization; using System.Windows.Data; namespace TankView.ObjectModel { public class NullValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var str = (string) value; return string.IsNullOrEmpty(str) ? "null" : str; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
30.722222
105
0.669078
[ "MIT" ]
Pandaaa2507/OWLib
TankView/ObjectModel/NullValueConverter.cs
555
C#
using System; using System.Collections.Generic; using System.Runtime.Serialization; using JetBrains.Annotations; namespace WebsitePoller.Entities { public abstract class SettingsBase { public string TimeZone { get; set; } public int[] PostalCodes { get; set; } public string[] Cities { get; set; } public decimal MaxEigenmittel { get; set; } public decimal MaxMonatlicheKosten { get; set; } public int MinNumberOfRooms { get; set; } public PostalAddress PostalAddress { get; set; } public int PollingIntervallInSeconds { get; set; } public Uri Url { get; set; } protected SettingsBase() { } protected static IEqualityComparer<SettingsBase> SettingsBaseComparer => new SettingsBaseEqualityComparer(); #region ISerializable protected SettingsBase([NotNull]SerializationInfo info, StreamingContext context) { TimeZone = info.GetValue<string>("timezone"); MaxEigenmittel = info.GetValue<decimal>("maxEigenmittel"); MaxMonatlicheKosten = info.GetValue<decimal>("maxMonatlicheKosten"); MinNumberOfRooms = info.GetValue<int>("minNumberOfRooms"); PostalAddress = info.GetValue<PostalAddress>("postalAddress"); PollingIntervallInSeconds = info.GetValue<int>("pollingIntervallInSeconds"); PostalCodes = info.GetValue<int[]>("postalCodes"); Cities = info.GetValue<string[]>("cities"); Url = info.GetValue<Uri>("url"); } protected void GetObjectDataBase([NotNull]SerializationInfo info, StreamingContext context) { info.AddValue("timezone", TimeZone); info.AddValue("postalCodes", PostalCodes); info.AddValue("cities", Cities); info.AddValue("maxEigenmittel", MaxEigenmittel); info.AddValue("maxMonatlicheKosten", MaxMonatlicheKosten); info.AddValue("minNumberOfRooms", MinNumberOfRooms); info.AddValue("postalAddress", PostalAddress); info.AddValue("pollingIntervallInSeconds", PollingIntervallInSeconds); info.AddValue("url", Url); } #endregion } }
41.62963
116
0.647242
[ "MIT" ]
MovGP0/WebsitePoller
WebsitePoller/Entities/SettingsBase.cs
2,250
C#
using System.Reflection; using System.Runtime.InteropServices; // Les informations générales relatives à un assembly dépendent de // l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations // associées à un assembly. [assembly: AssemblyTitle("Wexflow.Tasks.Unrar")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Wexflow.Tasks.Unrar")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly // aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de // COM, affectez la valeur true à l'attribut ComVisible sur ce type. [assembly: ComVisible(false)] // Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM [assembly: Guid("72ef213e-99a7-410c-992e-327dcf119a3b")] // Les informations de version pour un assembly se composent des quatre valeurs suivantes : // // Version principale // Version secondaire // Numéro de build // Révision // // Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut // en utilisant '*', comme indiqué ci-dessous : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("5.6.0.0")] [assembly: AssemblyFileVersion("5.6.0.0")]
40.722222
102
0.749659
[ "MIT" ]
weirdyang/Wexflow
src/net/Wexflow.Tasks.Unrar/Properties/AssemblyInfo.cs
1,491
C#
using WDE.Common.Managers; using WDE.Common.Services; using WDE.Module.Attributes; using WoWDatabaseEditorCore.Avalonia.Services.AppearanceService.Data; namespace WoWDatabaseEditorCore.Avalonia.Services.AppearanceService.Providers { [AutoRegister] [SingleInstance] public class ThemeSettingsProvider : IThemeSettingsProvider { private readonly IUserSettings userSettings; public ThemeSettingsProvider(IUserSettings userSettings) { this.userSettings = userSettings; Settings = userSettings.Get<ThemeSettings>(); } private ThemeSettings Settings { get; set; } public ThemeSettings GetSettings() { return Settings; } public void UpdateSettings(Theme theme, double? customScaling) { userSettings.Update(new ThemeSettings(theme.Name, customScaling.HasValue, customScaling ?? 1)); } } }
29.4375
107
0.687898
[ "Unlicense" ]
BAndysc/WoWDatabaseEditor
WoWDatabaseEditorCore.Avalonia/Services/AppearanceService/Providers/ThemeSettingsProvider.cs
944
C#
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Tools.Analyzers; using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Tests.Formatters; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; using Microsoft.CodeAnalysis.Tools.Tests.XUnit; using Microsoft.CodeAnalysis.Tools.Workspaces; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers { public class ThirdPartyAnalyzerFormatterTests : CSharpFormatterTests, IAsyncLifetime { private static readonly string s_analyzerProjectFilePath = Path.Combine("for_analyzer_formatter", "analyzer_project", "analyzer_project.csproj"); private protected override ICodeFormatter Formatter => AnalyzerFormatter.ThirdPartyFormatter; private Project _analyzerReferencesProject; public ThirdPartyAnalyzerFormatterTests(ITestOutputHelper output) { TestOutputHelper = output; } public async Task InitializeAsync() { var logger = new TestLogger(); try { // Restore the Analyzer packages that have been added to `for_analyzer_formatter/analyzer_project/analyzer_project.csproj` var exitCode = await DotNetHelper.PerformRestore(s_analyzerProjectFilePath, TestOutputHelper); Assert.Equal(0, exitCode); // Load the analyzer_project into a MSBuildWorkspace. var workspacePath = Path.Combine(TestProjectsPathHelper.GetProjectsDirectory(), s_analyzerProjectFilePath); MSBuildRegistrar.RegisterInstance(); var analyzerWorkspace = await MSBuildWorkspaceLoader.LoadAsync(workspacePath, WorkspaceType.Project, binaryLogPath: null, logWorkspaceWarnings: true, logger, CancellationToken.None); TestOutputHelper.WriteLine(logger.GetLog()); // From this project we can get valid AnalyzerReferences to add to our test project. _analyzerReferencesProject = analyzerWorkspace.CurrentSolution.Projects.Single(); } catch { TestOutputHelper.WriteLine(logger.GetLog()); throw; } } public Task DisposeAsync() { _analyzerReferencesProject = null; return Task.CompletedTask; } private IEnumerable<AnalyzerReference> GetAnalyzerReferences(string prefix) => _analyzerReferencesProject.AnalyzerReferences.Where(reference => reference.Display.StartsWith(prefix)); [MSBuildFact] public async Task TestStyleCopBlankLineFixer_RemovesUnnecessaryBlankLines() { var analyzerReferences = GetAnalyzerReferences("StyleCop"); var testCode = @" class C { void M() { object obj = new object(); int count = 5; } } "; var expectedCode = @" class C { void M() { object obj = new object(); int count = 5; } } "; var editorConfig = new Dictionary<string, string>() { // Turn off all diagnostics analyzers ["dotnet_analyzer_diagnostic.severity"] = "none", // Two or more consecutive blank lines: Remove down to one blank line. SA1507 ["dotnet_diagnostic.SA1507.severity"] = "error", // Blank line immediately before or after a { line: remove it. SA1505, SA1509 ["dotnet_diagnostic.SA1505.severity"] = "error", ["dotnet_diagnostic.SA1509.severity"] = "error", // Blank line immediately before a } line: remove it. SA1508 ["dotnet_diagnostic.SA1508.severity"] = "error", }; await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Analyzers, analyzerReferences: analyzerReferences); } [MSBuildFact] public async Task TestIDisposableAnalyzer_AddsUsing() { var analyzerReferences = GetAnalyzerReferences("IDisposable"); var testCode = @" using System.IO; class C { void M() { var stream = File.OpenRead(string.Empty); var b = stream.ReadByte(); stream.Dispose(); } } "; var expectedCode = @" using System.IO; class C { void M() { using (var stream = File.OpenRead(string.Empty)) { var b = stream.ReadByte(); } } } "; var editorConfig = new Dictionary<string, string>() { // Turn off all diagnostics analyzers ["dotnet_analyzer_diagnostic.severity"] = "none", // Prefer using. IDISP017 ["dotnet_diagnostic.IDISP017.severity"] = "error", }; await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Analyzers, analyzerReferences: analyzerReferences); } [MSBuildFact] public async Task TestLoadingAllAnalyzers_LoadsDependenciesFromAllSearchPaths() { // Loads all analyzer references. var analyzerReferences = _analyzerReferencesProject.AnalyzerReferences; var testCode = @" using System.IO; class C { void M() { var stream = File.OpenRead(string.Empty); var b = stream.ReadByte(); stream.Dispose(); } } "; var expectedCode = @" using System.IO; class C { void M() { using (var stream = File.OpenRead(string.Empty)) { var b = stream.ReadByte(); } } } "; var editorConfig = new Dictionary<string, string>() { // Turn off all diagnostics analyzers ["dotnet_analyzer_diagnostic.severity"] = "none", // Prefer using. IDISP017 ["dotnet_diagnostic.IDISP017.severity"] = "error", }; await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Analyzers, analyzerReferences: analyzerReferences); } } }
29.552511
198
0.628245
[ "MIT" ]
monoman/format
tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs
6,474
C#
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Windows; using Caliburn.Micro; using PoeTradeHub.TradeAPI; using PoeTradeHub.TradeAPI.Models; using PoeTradeHub.UI.Models; using PoeTradeHub.UI.Services; using Serilog; namespace PoeTradeHub.UI.ViewModels { public class ShellViewModel : Conductor<object> { private readonly ILogger _logger; private readonly IWindowManager _windowManager; private readonly IHotkeyService _hotkeyService; private readonly ConfigurationViewModel _configurationViewModel; private readonly ITradeAPI _tradeAPI; private ObservableCollection<LeagueInfoModel> _leagues; private LeagueInfoModel _selectedLeague; public ShellViewModel( ILogger logger, IWindowManager windowManager, IHotkeyService hotkeyService, ConfigurationViewModel configurationViewModel, ITradeAPI tradeAPI) { _logger = logger; _windowManager = windowManager; _hotkeyService = hotkeyService; _configurationViewModel = configurationViewModel; _tradeAPI = tradeAPI; Leagues = new ObservableCollection<LeagueInfoModel>(); } public ObservableCollection<LeagueInfoModel> Leagues { get => _leagues; set { _leagues = value; NotifyOfPropertyChange(nameof(Leagues)); } } public LeagueInfoModel SelectedLeague { get => _selectedLeague; set { _selectedLeague = value; NotifyOfPropertyChange(nameof(SelectedLeague)); } } protected override async void OnInitialize() { base.OnInitialize(); IList<LeagueInfo> leagues = await _tradeAPI.QueryLeagues(); _logger.Information("Available leagues: {@Leagues}", leagues.Select(league => league.Text)); if (leagues.Any()) { Leagues = new ObservableCollection<LeagueInfoModel>(leagues .Select(league => new LeagueInfoModel(league))); SelectedLeague = SelectDefaultLeague(Leagues); } } private LeagueInfoModel SelectDefaultLeague(IEnumerable<LeagueInfoModel> leagues) { IEnumerable<LeagueInfoModel> consideredLeagues = leagues; IEnumerable<LeagueInfoModel> tempLeagues = leagues .Where(league => league.Text.Trim() != "Standard") .Where(league => league.Text.Trim() != "Hardcore"); if (tempLeagues.Any()) { consideredLeagues = tempLeagues; } LeagueInfoModel selection = consideredLeagues .Where(league => !league.Text.Contains("Hardcore")) .FirstOrDefault(); if (selection == null) { selection = tempLeagues.FirstOrDefault(); } if (selection != null) { selection.IsSelected = true; } return selection; } protected override void OnActivate() { base.OnActivate(); _hotkeyService.Enable(); _hotkeyService.DebugItem += HandleDebugItem; _hotkeyService.PriceItem += HandlePriceItem; _hotkeyService.ItemInfo += HandleItemInfo; } protected override void OnDeactivate(bool close) { _hotkeyService.DebugItem -= HandleDebugItem; _hotkeyService.PriceItem -= HandlePriceItem; _hotkeyService.ItemInfo -= HandleItemInfo; _hotkeyService.Disable(); base.OnDeactivate(close); } private void HandleDebugItem(object sender, ItemEventArgs eventArgs) { var viewModel = new ItemDebugViewModel(); viewModel.ClipboardData = Clipboard.GetText(); viewModel.ItemData = JsonUtility.Serialize(eventArgs.Item); _windowManager.ShowWindow(viewModel); } private async void HandlePriceItem(object sender, ItemEventArgs eventArgs) { try { IList<ItemRecord> listings = await _tradeAPI.QueryPrice(_selectedLeague.Id, eventArgs.Item); _windowManager.ShowWindow(new ItemListingViewModel(listings)); } catch (NotImplementedException) { MessageBox.Show("Sorry, pricing for this type of item has not been implemented yet.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } private void HandleItemInfo(object sender, ItemEventArgs eventArgs) { var item = eventArgs.Item; if (item.ItemType == ItemType.Currency && item.Name.Contains("Essence of")) { try { var viewModel = new EssenceInfoViewModel(item); _windowManager.ShowWindow(viewModel); } catch (NotImplementedException e) { MessageBox.Show(e.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } } public void SelectLeague(LeagueInfoModel league) { foreach (var item in Leagues) { item.IsSelected = false; } league.IsSelected = true; SelectedLeague = league; } public void ShowConfiguration() { if (!_configurationViewModel.IsActive) { _windowManager.ShowWindow(_configurationViewModel); } } public void ExitApplication() { Application.Current.Shutdown(); } } }
31.591623
155
0.572257
[ "MIT" ]
qhris/PoeTradeHub
PoeTradeHub.UI/ViewModels/ShellViewModel.cs
6,036
C#
using System; using System.IO.Ports; using System.Text.RegularExpressions; namespace SupportManager.Control { public class SerialPortFactory { private static readonly Regex ConnectionStringRegex = new Regex(@"^(?:(?:(\w+)=)?(\w+))(?:;(\w+)=(\w+))*$"); /// <summary> /// Creates a <see cref="T:System.IO.Ports.SerialPort" /> from an optional port name and <see cref="T:System.IO.Ports.SerialPort" /> properties with values. /// </summary> /// <param name="connectionString">A <see cref="T:System.IO.Ports.SerialPort" /> connection string consisting of (optional) port name and semicolon separated properties with value assignments.</param> /// <returns><see cref="T:System.IO.Ports.SerialPort" /> with properties set according to supplied values.</returns> /// <example> /// The following are all valid invocations of <see cref="CreateFromConnectionString"/>: /// <code> /// SerialPortFactory.CreateFromConnectionString("COM1"); /// SerialPortFactory.CreateFromConnectionString("PortName=COM1"); /// SerialPortFactory.CreateFromConnectionString("COM1;BaudRate=115200"); /// SerialPortFactory.CreateFromConnectionString("PortName=COM1;BaudRate=115200"); /// SerialPortFactory.CreateFromConnectionString("COM1;BaudRate=115200;DataBits=8;StopBits=One;Parity=None;Handshake=RequestToSend"); /// </code> /// </example> public static SerialPort CreateFromConnectionString(string connectionString) { var match = ConnectionStringRegex.Match(connectionString); if (!match.Success) throw new ArgumentException($"Invalid connectionString specified: {connectionString}", nameof(connectionString)); var firstProp = match.Groups[1].Success ? match.Groups[1].Value : nameof(SerialPort.PortName); var firstValue = match.Groups[2].Value; var serialPort = new SerialPort(); try { SetPropertyValue(serialPort, firstProp, firstValue); var propCaptures = match.Groups[3].Captures; var valueCaptures = match.Groups[4].Captures; for (int i = 0; i < propCaptures.Count; i++) SetPropertyValue(serialPort, propCaptures[i].Value, valueCaptures[i].Value); return serialPort; } catch { // Cleanup serialPort.Dispose(); throw; } } private static void SetPropertyValue(SerialPort serialPort, string propertyName, string value) { var propertyInfo = typeof(SerialPort).GetProperty(propertyName) ?? throw new ArgumentException($"Couldn't find property {propertyName}.", propertyName); var typedValue = ConvertValue(value, propertyInfo.PropertyType); propertyInfo.SetValue(serialPort, typedValue); } private static object ConvertValue(string input, Type targetType) { if (targetType.IsEnum) return Enum.Parse(targetType, input); return Convert.ChangeType(input, targetType); } } }
45.394366
208
0.634192
[ "MIT" ]
ronaldme/SupportManager
SupportManager.Control/SerialPortFactory.cs
3,223
C#
//------------------------------------------------------------------------------ // <自动生成> // 此代码由工具生成。 // // 对此文件的更改可能会导致不正确的行为,并且如果 // 重新生成代码,这些更改将会丢失。 // </自动生成> //------------------------------------------------------------------------------ namespace MxWeiXinPF.Web.admin.sjb { public partial class qiudui_list { /// <summary> /// form1 控件。 /// </summary> /// <remarks> /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlForm form1; /// <summary> /// btnDelete 控件。 /// </summary> /// <remarks> /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// </remarks> protected global::System.Web.UI.WebControls.LinkButton btnDelete; /// <summary> /// txtKeywords 控件。 /// </summary> /// <remarks> /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// </remarks> protected global::System.Web.UI.WebControls.TextBox txtKeywords; /// <summary> /// lbtnSearch 控件。 /// </summary> /// <remarks> /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// </remarks> protected global::System.Web.UI.WebControls.LinkButton lbtnSearch; /// <summary> /// rptList 控件。 /// </summary> /// <remarks> /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// </remarks> protected global::System.Web.UI.WebControls.Repeater rptList; /// <summary> /// txtPageNum 控件。 /// </summary> /// <remarks> /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// </remarks> protected global::System.Web.UI.WebControls.TextBox txtPageNum; /// <summary> /// PageContent 控件。 /// </summary> /// <remarks> /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl PageContent; } }
27.620253
84
0.461503
[ "MIT" ]
herrylau/wwzkushop
MxWeiXinPF.Web/admin/sjb/qiudui_list.aspx.designer.cs
2,842
C#
namespace FilingHelper.Controls.Settings { partial class EmailSignatureSettingsPanel { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.txtNewDomain = new System.Windows.Forms.TextBox(); this.btnRemoveDomain = new System.Windows.Forms.Button(); this.lstDomains = new System.Windows.Forms.ListBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.lstExternalNew = new System.Windows.Forms.ComboBox(); this.lstExternalReply = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.btnAddDomain = new System.Windows.Forms.Button(); this.lstInternalReply = new System.Windows.Forms.ComboBox(); this.label6 = new System.Windows.Forms.Label(); this.lstInternalNew = new System.Windows.Forms.ComboBox(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.chkEnabled = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // txtNewDomain // this.txtNewDomain.Location = new System.Drawing.Point(103, 145); this.txtNewDomain.Name = "txtNewDomain"; this.txtNewDomain.Size = new System.Drawing.Size(200, 20); this.txtNewDomain.TabIndex = 22; this.txtNewDomain.TextChanged += new System.EventHandler(this.txtNewDomain_TextChanged); // // btnRemoveDomain // this.btnRemoveDomain.Enabled = false; this.btnRemoveDomain.Location = new System.Drawing.Point(345, 171); this.btnRemoveDomain.Name = "btnRemoveDomain"; this.btnRemoveDomain.Size = new System.Drawing.Size(75, 23); this.btnRemoveDomain.TabIndex = 21; this.btnRemoveDomain.Text = "Remove"; this.btnRemoveDomain.UseVisualStyleBackColor = true; this.btnRemoveDomain.Click += new System.EventHandler(this.btnRemoveDomain_Click); // // lstDomains // this.lstDomains.FormattingEnabled = true; this.lstDomains.Location = new System.Drawing.Point(103, 171); this.lstDomains.Name = "lstDomains"; this.lstDomains.Size = new System.Drawing.Size(236, 95); this.lstDomains.TabIndex = 20; this.lstDomains.SelectedIndexChanged += new System.EventHandler(this.lstDomains_SelectedIndexChanged); // // label1 // this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label1.BackColor = System.Drawing.SystemColors.ButtonFace; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.SystemColors.ControlDarkDark; this.label1.Location = new System.Drawing.Point(3, 29); this.label1.Name = "label1"; this.label1.Padding = new System.Windows.Forms.Padding(4, 0, 0, 0); this.label1.Size = new System.Drawing.Size(845, 23); this.label1.TabIndex = 25; this.label1.Text = "External emails signature"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(13, 60); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(82, 13); this.label2.TabIndex = 26; this.label2.Text = "New messages:"; // // lstExternalNew // this.lstExternalNew.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.lstExternalNew.FormattingEnabled = true; this.lstExternalNew.Location = new System.Drawing.Point(103, 57); this.lstExternalNew.Name = "lstExternalNew"; this.lstExternalNew.Size = new System.Drawing.Size(236, 21); this.lstExternalNew.TabIndex = 28; // // lstExternalReply // this.lstExternalReply.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.lstExternalReply.FormattingEnabled = true; this.lstExternalReply.Location = new System.Drawing.Point(103, 84); this.lstExternalReply.Name = "lstExternalReply"; this.lstExternalReply.Size = new System.Drawing.Size(236, 21); this.lstExternalReply.TabIndex = 30; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(13, 87); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(90, 13); this.label4.TabIndex = 29; this.label4.Text = "Replies/forwards:"; // // label3 // this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label3.BackColor = System.Drawing.SystemColors.ButtonFace; this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing.SystemColors.ControlDarkDark; this.label3.Location = new System.Drawing.Point(3, 108); this.label3.Name = "label3"; this.label3.Padding = new System.Windows.Forms.Padding(4, 0, 0, 0); this.label3.Size = new System.Drawing.Size(845, 23); this.label3.TabIndex = 31; this.label3.Text = "Internal emails signature"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(13, 171); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(87, 13); this.label5.TabIndex = 32; this.label5.Text = "Internal domains:"; // // btnAddDomain // this.btnAddDomain.Enabled = false; this.btnAddDomain.Image = global::FilingHelper.Properties.Resources.Add; this.btnAddDomain.Location = new System.Drawing.Point(309, 144); this.btnAddDomain.Name = "btnAddDomain"; this.btnAddDomain.Size = new System.Drawing.Size(28, 23); this.btnAddDomain.TabIndex = 23; this.btnAddDomain.UseVisualStyleBackColor = true; this.btnAddDomain.Click += new System.EventHandler(this.btnAddDomain_Click); // // lstInternalReply // this.lstInternalReply.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.lstInternalReply.FormattingEnabled = true; this.lstInternalReply.Location = new System.Drawing.Point(103, 308); this.lstInternalReply.Name = "lstInternalReply"; this.lstInternalReply.Size = new System.Drawing.Size(236, 21); this.lstInternalReply.TabIndex = 36; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(13, 311); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(90, 13); this.label6.TabIndex = 35; this.label6.Text = "Replies/forwards:"; // // lstInternalNew // this.lstInternalNew.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.lstInternalNew.FormattingEnabled = true; this.lstInternalNew.Location = new System.Drawing.Point(103, 281); this.lstInternalNew.Name = "lstInternalNew"; this.lstInternalNew.Size = new System.Drawing.Size(236, 21); this.lstInternalNew.TabIndex = 34; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(13, 284); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(82, 13); this.label7.TabIndex = 33; this.label7.Text = "New messages:"; // // label8 // this.label8.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label8.BackColor = System.Drawing.SystemColors.ButtonShadow; this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label8.ForeColor = System.Drawing.SystemColors.ControlDarkDark; this.label8.Location = new System.Drawing.Point(6, 269); this.label8.Name = "label8"; this.label8.Padding = new System.Windows.Forms.Padding(4, 0, 0, 0); this.label8.Size = new System.Drawing.Size(845, 2); this.label8.TabIndex = 37; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // chkEnabled // this.chkEnabled.AutoSize = true; this.chkEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkEnabled.Location = new System.Drawing.Point(12, 9); this.chkEnabled.Name = "chkEnabled"; this.chkEnabled.Size = new System.Drawing.Size(316, 17); this.chkEnabled.TabIndex = 38; this.chkEnabled.Text = "Enable different signatures for internal and external recepients"; this.chkEnabled.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.chkEnabled.UseVisualStyleBackColor = true; this.chkEnabled.CheckedChanged += new System.EventHandler(this.chkEnabled_CheckedChanged); // // AttachmentHelperPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.Controls.Add(this.chkEnabled); this.Controls.Add(this.label8); this.Controls.Add(this.lstInternalReply); this.Controls.Add(this.label6); this.Controls.Add(this.lstInternalNew); this.Controls.Add(this.label7); this.Controls.Add(this.label5); this.Controls.Add(this.label3); this.Controls.Add(this.lstExternalReply); this.Controls.Add(this.label4); this.Controls.Add(this.lstExternalNew); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.btnAddDomain); this.Controls.Add(this.txtNewDomain); this.Controls.Add(this.btnRemoveDomain); this.Controls.Add(this.lstDomains); this.Name = "AttachmentHelperPanel"; this.Size = new System.Drawing.Size(854, 413); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button btnAddDomain; private System.Windows.Forms.TextBox txtNewDomain; private System.Windows.Forms.Button btnRemoveDomain; private System.Windows.Forms.ListBox lstDomains; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.ComboBox lstExternalNew; private System.Windows.Forms.ComboBox lstExternalReply; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label5; private System.Windows.Forms.ComboBox lstInternalReply; private System.Windows.Forms.Label label6; private System.Windows.Forms.ComboBox lstInternalNew; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.CheckBox chkEnabled; } }
49.769231
172
0.605947
[ "MIT" ]
ShaiShulman/MailboxAngel
FilingHelper/Controls/Settings/EmailSignaturesPanel.Designer.cs
13,589
C#
/* * Apteco API * * An API to allow access to Apteco Marketing Suite resources * * OpenAPI spec version: v2 * Contact: [email protected] * Generated by: https://github.com/swagger-api/swagger-codegen.git */ using System; using System.Linq; using System.IO; using System.Text; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using SwaggerDateConverter = Apteco.OrbitDashboardRefresher.APIClient.Client.SwaggerDateConverter; namespace Apteco.OrbitDashboardRefresher.APIClient.Model { /// <summary> /// Display details for a user that was invalid for being added or removed from sharing a particular shareable item /// </summary> [DataContract] public partial class InvalidToShareUserDisplayDetails : IEquatable<InvalidToShareUserDisplayDetails> { /// <summary> /// The reason why the user was not valid for updating the share /// </summary> /// <value>The reason why the user was not valid for updating the share</value> [JsonConverter(typeof(StringEnumConverter))] public enum ReasonEnum { /// <summary> /// Enum ShareableAlreadySharedToUser for value: ShareableAlreadySharedToUser /// </summary> [EnumMember(Value = "ShareableAlreadySharedToUser")] ShareableAlreadySharedToUser = 1, /// <summary> /// Enum ShareableNotSharedToUser for value: ShareableNotSharedToUser /// </summary> [EnumMember(Value = "ShareableNotSharedToUser")] ShareableNotSharedToUser = 2, /// <summary> /// Enum ShareableOwnedByUser for value: ShareableOwnedByUser /// </summary> [EnumMember(Value = "ShareableOwnedByUser")] ShareableOwnedByUser = 3, /// <summary> /// Enum InvalidEmailDomain for value: InvalidEmailDomain /// </summary> [EnumMember(Value = "InvalidEmailDomain")] InvalidEmailDomain = 4 } /// <summary> /// The reason why the user was not valid for updating the share /// </summary> /// <value>The reason why the user was not valid for updating the share</value> [DataMember(Name="reason", EmitDefaultValue=false)] public ReasonEnum Reason { get; set; } /// <summary> /// Initializes a new instance of the <see cref="InvalidToShareUserDisplayDetails" /> class. /// </summary> [JsonConstructorAttribute] protected InvalidToShareUserDisplayDetails() { } /// <summary> /// Initializes a new instance of the <see cref="InvalidToShareUserDisplayDetails" /> class. /// </summary> /// <param name="reason">The reason why the user was not valid for updating the share (required).</param> /// <param name="id">The user&#39;s id (required).</param> /// <param name="username">The user&#39;s username (required).</param> /// <param name="firstname">The user&#39;s first name (required).</param> /// <param name="surname">The user&#39;s surname (required).</param> /// <param name="emailAddress">The user&#39;s email address (required).</param> public InvalidToShareUserDisplayDetails(ReasonEnum reason = default(ReasonEnum), int? id = default(int?), string username = default(string), string firstname = default(string), string surname = default(string), string emailAddress = default(string)) { // to ensure "reason" is required (not null) if (reason == null) { throw new InvalidDataException("reason is a required property for InvalidToShareUserDisplayDetails and cannot be null"); } else { this.Reason = reason; } // to ensure "id" is required (not null) if (id == null) { throw new InvalidDataException("id is a required property for InvalidToShareUserDisplayDetails and cannot be null"); } else { this.Id = id; } // to ensure "username" is required (not null) if (username == null) { throw new InvalidDataException("username is a required property for InvalidToShareUserDisplayDetails and cannot be null"); } else { this.Username = username; } // to ensure "firstname" is required (not null) if (firstname == null) { throw new InvalidDataException("firstname is a required property for InvalidToShareUserDisplayDetails and cannot be null"); } else { this.Firstname = firstname; } // to ensure "surname" is required (not null) if (surname == null) { throw new InvalidDataException("surname is a required property for InvalidToShareUserDisplayDetails and cannot be null"); } else { this.Surname = surname; } // to ensure "emailAddress" is required (not null) if (emailAddress == null) { throw new InvalidDataException("emailAddress is a required property for InvalidToShareUserDisplayDetails and cannot be null"); } else { this.EmailAddress = emailAddress; } } /// <summary> /// The user&#39;s id /// </summary> /// <value>The user&#39;s id</value> [DataMember(Name="id", EmitDefaultValue=false)] public int? Id { get; set; } /// <summary> /// The user&#39;s username /// </summary> /// <value>The user&#39;s username</value> [DataMember(Name="username", EmitDefaultValue=false)] public string Username { get; set; } /// <summary> /// The user&#39;s first name /// </summary> /// <value>The user&#39;s first name</value> [DataMember(Name="firstname", EmitDefaultValue=false)] public string Firstname { get; set; } /// <summary> /// The user&#39;s surname /// </summary> /// <value>The user&#39;s surname</value> [DataMember(Name="surname", EmitDefaultValue=false)] public string Surname { get; set; } /// <summary> /// The user&#39;s email address /// </summary> /// <value>The user&#39;s email address</value> [DataMember(Name="emailAddress", EmitDefaultValue=false)] public string EmailAddress { get; set; } /// <summary> /// Returns the string presentation of the object /// </summary> /// <returns>String presentation of the object</returns> public override string ToString() { var sb = new StringBuilder(); sb.Append("class InvalidToShareUserDisplayDetails {\n"); sb.Append(" Reason: ").Append(Reason).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Username: ").Append(Username).Append("\n"); sb.Append(" Firstname: ").Append(Firstname).Append("\n"); sb.Append(" Surname: ").Append(Surname).Append("\n"); sb.Append(" EmailAddress: ").Append(EmailAddress).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns the JSON string presentation of the object /// </summary> /// <returns>JSON string presentation of the object</returns> public virtual string ToJson() { return JsonConvert.SerializeObject(this, Formatting.Indented); } /// <summary> /// Returns true if objects are equal /// </summary> /// <param name="input">Object to be compared</param> /// <returns>Boolean</returns> public override bool Equals(object input) { return this.Equals(input as InvalidToShareUserDisplayDetails); } /// <summary> /// Returns true if InvalidToShareUserDisplayDetails instances are equal /// </summary> /// <param name="input">Instance of InvalidToShareUserDisplayDetails to be compared</param> /// <returns>Boolean</returns> public bool Equals(InvalidToShareUserDisplayDetails input) { if (input == null) return false; return ( this.Reason == input.Reason || (this.Reason != null && this.Reason.Equals(input.Reason)) ) && ( this.Id == input.Id || (this.Id != null && this.Id.Equals(input.Id)) ) && ( this.Username == input.Username || (this.Username != null && this.Username.Equals(input.Username)) ) && ( this.Firstname == input.Firstname || (this.Firstname != null && this.Firstname.Equals(input.Firstname)) ) && ( this.Surname == input.Surname || (this.Surname != null && this.Surname.Equals(input.Surname)) ) && ( this.EmailAddress == input.EmailAddress || (this.EmailAddress != null && this.EmailAddress.Equals(input.EmailAddress)) ); } /// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (this.Reason != null) hashCode = hashCode * 59 + this.Reason.GetHashCode(); if (this.Id != null) hashCode = hashCode * 59 + this.Id.GetHashCode(); if (this.Username != null) hashCode = hashCode * 59 + this.Username.GetHashCode(); if (this.Firstname != null) hashCode = hashCode * 59 + this.Firstname.GetHashCode(); if (this.Surname != null) hashCode = hashCode * 59 + this.Surname.GetHashCode(); if (this.EmailAddress != null) hashCode = hashCode * 59 + this.EmailAddress.GetHashCode(); return hashCode; } } } }
38.870175
257
0.540531
[ "Apache-2.0" ]
Apteco/OrbitDashboardRefresher
Apteco.OrbitDashboardRefresher.APIClient/Model/InvalidToShareUserDisplayDetails.cs
11,078
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("NotchExperiment.iOS")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NotchExperiment.iOS")] [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("72bdc44f-c588-44f3-b6df-9aace7daafdd")] // 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.135135
84
0.746279
[ "MIT" ]
lachlanwgordon/NotchExperiment
NotchExperiment.iOS/Properties/AssemblyInfo.cs
1,414
C#
// Needed for NET40 using System; namespace Theraot.Collections.ThreadSafe { public static class BucketHelper { private static readonly object _null; static BucketHelper() { _null = new object(); } internal static object Null { get { return _null; } } public static T GetOrInsert<T>(this IBucket<T> bucket, int index, T item) { if (bucket == null) { throw new ArgumentNullException("bucket"); } T previous; if (bucket.Insert(index, item, out previous)) { return item; } return previous; } public static T GetOrInsert<T>(this IBucket<T> bucket, int index, Func<T> itemFactory) { if (bucket == null) { throw new ArgumentNullException("bucket"); } T stored; if (!bucket.TryGet(index, out stored)) { var created = itemFactory.Invoke(); if (bucket.Insert(index, created, out stored)) { return created; } } return stored; } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="item">The item set.</param> /// <param name="itemUpdateFactory">The item factory to create the item to replace with.</param> /// <param name="check">A predicate to decide if a particular item should be replaced.</param> /// <returns> /// <c>true</c> if the item or repalced inserted; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static bool InsertOrUpdate<T>(this IBucket<T> bucket, int index, T item, Func<T, T> itemUpdateFactory, Predicate<T> check) { bool isNew; return InsertOrUpdate(bucket, index, item, itemUpdateFactory, check, out isNew); } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="item">The item insert.</param> /// <param name="itemUpdateFactory">The item factory to create the item to replace with.</param> /// <param name="check">A predicate to decide if a particular item should be replaced.</param> /// <param name="isNew">if set to <c>true</c> the index was not previously used.</param> /// <returns> /// <c>true</c> if the item or repalced inserted; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static bool InsertOrUpdate<T>(this IBucket<T> bucket, int index, T item, Func<T, T> itemUpdateFactory, Predicate<T> check, out bool isNew) { if (bucket == null) { throw new ArgumentNullException("bucket"); } isNew = true; while (true) { if (isNew) { T stored; if (bucket.Insert(index, item, out stored)) { return true; } isNew = false; } else { if (bucket.Update(index, itemUpdateFactory, check, out isNew)) { return true; } if (!isNew) { return false; // returns false only when check returns false } } } } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="item">The item set.</param> /// <param name="itemUpdateFactory">The item factory to create the item to replace with.</param> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static void InsertOrUpdate<T>(this IBucket<T> bucket, int index, T item, Func<T, T> itemUpdateFactory) { bool isNew; InsertOrUpdate(bucket, index, item, itemUpdateFactory, out isNew); } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="item">The item insert.</param> /// <param name="itemUpdateFactory">The item factory to create the item to replace with.</param> /// <param name="isNew">if set to <c>true</c> the index was not previously used.</param> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static void InsertOrUpdate<T>(this IBucket<T> bucket, int index, T item, Func<T, T> itemUpdateFactory, out bool isNew) { if (bucket == null) { throw new ArgumentNullException("bucket"); } isNew = true; while (true) { if (isNew) { T stored; if (bucket.Insert(index, item, out stored)) { return; } isNew = false; } else { if (bucket.Update(index, itemUpdateFactory, Tautology, out isNew)) { return; } } } } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="item">The item set.</param> /// <param name="check">A predicate to decide if a particular item should be replaced.</param> /// <returns> /// <c>true</c> if the item or repalced inserted; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static bool InsertOrUpdate<T>(this IBucket<T> bucket, int index, T item, Predicate<T> check) { bool isNew; return InsertOrUpdate(bucket, index, item, check, out isNew); } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="item">The item set.</param> /// <param name="check">A predicate to decide if a particular item should be replaced.</param> /// <param name="isNew">if set to <c>true</c> the index was not previously used.</param> /// <returns> /// <c>true</c> if the item or repalced inserted; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static bool InsertOrUpdate<T>(this IBucket<T> bucket, int index, T item, Predicate<T> check, out bool isNew) { if (bucket == null) { throw new ArgumentNullException("bucket"); } isNew = true; while (true) { if (isNew) { T stored; if (bucket.Insert(index, item, out stored)) { return true; } isNew = false; } else { if (bucket.Update(index, _ => item, check, out isNew)) { return true; } if (!isNew) { return false; // returns false only when check returns false } } } } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="itemFactory">The item factory to create the item to insert.</param> /// <param name="itemUpdateFactory">The item factory to create the item to replace with.</param> /// <param name="check">A predicate to decide if a particular item should be replaced.</param> /// <returns> /// <c>true</c> if the item or repalced inserted; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static bool InsertOrUpdate<T>(this IBucket<T> bucket, int index, Func<T> itemFactory, Func<T, T> itemUpdateFactory, Predicate<T> check) { if (bucket == null) { throw new ArgumentNullException("bucket"); } bool isNew; return InsertOrUpdate(bucket, index, itemFactory, itemUpdateFactory, check, out isNew); } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="itemFactory">The item factory to create the item to insert.</param> /// <param name="itemUpdateFactory">The item factory to create the item to replace with.</param> /// <param name="check">A predicate to decide if a particular item should be replaced.</param> /// <param name="isNew">if set to <c>true</c> the index was not previously used.</param> /// <returns> /// <c>true</c> if the item or repalced inserted; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static bool InsertOrUpdate<T>(this IBucket<T> bucket, int index, Func<T> itemFactory, Func<T, T> itemUpdateFactory, Predicate<T> check, out bool isNew) { if (bucket == null) { throw new ArgumentNullException("bucket"); } isNew = true; bool factoryUsed = false; var created = default(T); while (true) { if (isNew) { T stored; if (!factoryUsed) { created = itemFactory.Invoke(); factoryUsed = true; } if (bucket.Insert(index, created, out stored)) { return true; } isNew = false; } else { if (bucket.Update(index, itemUpdateFactory, check, out isNew)) { return true; } if (!isNew) { return false; // returns false only when check returns false } } } } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="itemFactory">The item factory to create the item to insert.</param> /// <param name="itemUpdateFactory">The item factory to create the item to replace with.</param> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static void InsertOrUpdate<T>(this IBucket<T> bucket, int index, Func<T> itemFactory, Func<T, T> itemUpdateFactory) { if (bucket == null) { throw new ArgumentNullException("bucket"); } bool isNew; InsertOrUpdate(bucket, index, itemFactory, itemUpdateFactory, out isNew); } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="itemFactory">The item factory to create the item to insert.</param> /// <param name="itemUpdateFactory">The item factory to create the item to replace with.</param> /// <param name="isNew">if set to <c>true</c> the index was not previously used.</param> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static void InsertOrUpdate<T>(this IBucket<T> bucket, int index, Func<T> itemFactory, Func<T, T> itemUpdateFactory, out bool isNew) { if (bucket == null) { throw new ArgumentNullException("bucket"); } isNew = true; bool factoryUsed = false; var created = default(T); while (true) { if (isNew) { T stored; if (!factoryUsed) { created = itemFactory.Invoke(); factoryUsed = true; } if (bucket.Insert(index, created, out stored)) { return; } isNew = false; } else { if (bucket.Update(index, itemUpdateFactory, Tautology, out isNew)) { return; } } } } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="itemFactory">The item factory to create the item to set.</param> /// <param name="check">A predicate to decide if a particular item should be replaced.</param> /// <returns> /// <c>true</c> if the item or repalced inserted; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static bool InsertOrUpdate<T>(this IBucket<T> bucket, int index, Func<T> itemFactory, Predicate<T> check) { if (bucket == null) { throw new ArgumentNullException("bucket"); } bool isNew; return InsertOrUpdate(bucket, index, itemFactory, check, out isNew); } /// <summary> /// Inserts or replaces the item at the specified index. /// </summary> /// <param name="bucket">The bucket on which to operate.</param> /// <param name="index">The index.</param> /// <param name="itemFactory">The item factory to create the item to set.</param> /// <param name="check">A predicate to decide if a particular item should be replaced.</param> /// <param name="isNew">if set to <c>true</c> the index was not previously used.</param> /// <returns> /// <c>true</c> if the item or repalced inserted; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">index;index must be greater or equal to 0 and less than capacity</exception> /// <remarks> /// The operation will be attempted as long as check returns true - this operation may starve. /// </remarks> public static bool InsertOrUpdate<T>(this IBucket<T> bucket, int index, Func<T> itemFactory, Predicate<T> check, out bool isNew) { if (bucket == null) { throw new ArgumentNullException("bucket"); } isNew = true; bool factoryUsed = false; var created = default(T); while (true) { if (isNew) { T stored; if (!factoryUsed) { created = itemFactory.Invoke(); factoryUsed = true; } if (bucket.Insert(index, created, out stored)) { return true; } isNew = false; } else { var result = itemFactory.Invoke(); if (bucket.Update(index, _ => result, check, out isNew)) { return true; } if (!isNew) { return false; // returns false only when check returns false } } } } public static void Set<T>(this IBucket<T> bucket, int index, T value) { if (bucket == null) { throw new ArgumentNullException("bucket"); } bool isNew; bucket.Set(index, value, out isNew); } public static bool TryGetOrInsert<T>(this IBucket<T> bucket, int index, T item, out T stored) { if (bucket == null) { throw new ArgumentNullException("bucket"); } T previous; if (bucket.Insert(index, item, out previous)) { stored = item; return true; } stored = previous; return false; } public static bool TryGetOrInsert<T>(this IBucket<T> bucket, int index, Func<T> itemFactory, out T stored) { if (bucket == null) { throw new ArgumentNullException("bucket"); } if (bucket.TryGet(index, out stored)) { return false; } var created = itemFactory.Invoke(); if (bucket.Insert(index, created, out stored)) { stored = created; return true; } return false; } public static bool Update<T>(this IBucket<T> bucket, int index, T item, Predicate<T> check) { if (bucket == null) { throw new ArgumentNullException("bucket"); } bool isEmpty; return bucket.Update(index, _ => item, check, out isEmpty); } public static bool Update<T>(this IBucket<T> bucket, int index, T item, Predicate<T> check, out bool isEmpty) { if (bucket == null) { throw new ArgumentNullException("bucket"); } return bucket.Update(index, _ => item, check, out isEmpty); } public static bool Update<T>(this IBucket<T> bucket, int index, Func<T, T> itemUpdateFactory) { if (bucket == null) { throw new ArgumentNullException("bucket"); } bool isEmpty; return bucket.Update(index, itemUpdateFactory, Tautology, out isEmpty); } public static bool Update<T>(this IBucket<T> bucket, int index, Func<T, T> itemUpdateFactory, out bool isEmpty) { if (bucket == null) { throw new ArgumentNullException("bucket"); } return bucket.Update(index, itemUpdateFactory, Tautology, out isEmpty); } private static bool Tautology<T>(T item) { return true; } } }
40.943262
166
0.51061
[ "Apache-2.0" ]
FFFF0h/SharedMemoryStream.Library
lib/NetSerializer.Library/lib/System.Core.Net35/Core/Theraot/Collections/ThreadSafe/BucketHelper.cs
23,094
C#
//---------------------- // <auto-generated> // This file was automatically generated. Any changes to it will be lost if and when the file is regenerated. // </auto-generated> //---------------------- #pragma warning disable using System; using SQEX.Luminous.Core.Object; using System.Collections.Generic; using CodeDom = System.CodeDom; namespace Black.Sequence.Action.Camera.Init { [Serializable, CodeDom.Compiler.GeneratedCode("Luminaire", "0.1")] public partial class SequenceActionInitCameraParameter : SQEX.Ebony.Framework.Sequence.SequenceAction { new public static ObjectType ObjectType { get; private set; } private static PropertyContainer fieldProperties; [UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphTriggerInputPin in_= new SQEX.Ebony.Framework.Node.GraphTriggerInputPin(); [UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphTriggerOutputPin out_= new SQEX.Ebony.Framework.Node.GraphTriggerOutputPin(); [UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphVariableInputPin cameraParamPin_= new SQEX.Ebony.Framework.Node.GraphVariableInputPin(); public int cameraParamType_; public float cameraParamValue_; new public static void SetupObjectType() { if (ObjectType != null) { return; } var dummy = new SequenceActionInitCameraParameter(); var properties = dummy.GetFieldProperties(); ObjectType = new ObjectType("Black.Sequence.Action.Camera.Init.SequenceActionInitCameraParameter", 0, Black.Sequence.Action.Camera.Init.SequenceActionInitCameraParameter.ObjectType, Construct, properties, 0, 464); } public override ObjectType GetObjectType() { return ObjectType; } protected override PropertyContainer GetFieldProperties() { if (fieldProperties != null) { return fieldProperties; } fieldProperties = new PropertyContainer("Black.Sequence.Action.Camera.Init.SequenceActionInitCameraParameter", base.GetFieldProperties(), -307387061, -760678701); fieldProperties.AddIndirectlyProperty(new Property("refInPorts_", 1035088696, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 24, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4)); fieldProperties.AddIndirectlyProperty(new Property("refOutPorts_", 283683627, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 40, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4)); fieldProperties.AddIndirectlyProperty(new Property("triInPorts_", 291734708, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 96, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4)); fieldProperties.AddIndirectlyProperty(new Property("triOutPorts_", 3107891487, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 112, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4)); fieldProperties.AddIndirectlyProperty(new Property("Isolated_", 56305607, "bool", 168, 1, 1, Property.PrimitiveType.Bool, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("in_.pinName_", 3330161590, "Base.String", 184, 16, 1, Property.PrimitiveType.String, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("in_.name_", 192292993, "Base.String", 200, 16, 1, Property.PrimitiveType.String, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("in_.connections_", 490033121, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 216, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1)); fieldProperties.AddIndirectlyProperty(new Property("in_.delayType_", 261766523, "SQEX.Ebony.Framework.Node.GraphPin.DelayType", 248, 4, 1, Property.PrimitiveType.Enum, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("in_.delayTime_", 1689218608, "float", 252, 4, 1, Property.PrimitiveType.Float, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("in_.delayMaxTime_", 1529341114, "float", 256, 4, 1, Property.PrimitiveType.Float, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("out_.pinName_", 1137295951, "Base.String", 280, 16, 1, Property.PrimitiveType.String, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("out_.name_", 2182257194, "Base.String", 296, 16, 1, Property.PrimitiveType.String, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("out_.connections_", 2048532136, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 312, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1)); fieldProperties.AddIndirectlyProperty(new Property("out_.delayType_", 124432558, "SQEX.Ebony.Framework.Node.GraphPin.DelayType", 344, 4, 1, Property.PrimitiveType.Enum, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("out_.delayTime_", 3264366185, "float", 348, 4, 1, Property.PrimitiveType.Float, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("out_.delayMaxTime_", 456551125, "float", 352, 4, 1, Property.PrimitiveType.Float, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("cameraParamPin_.pinName_", 1290755822, "Base.String", 376, 16, 1, Property.PrimitiveType.String, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("cameraParamPin_.name_", 3685226857, "Base.String", 392, 16, 1, Property.PrimitiveType.String, 0, (char)0)); fieldProperties.AddIndirectlyProperty(new Property("cameraParamPin_.connections_", 3316538841, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 408, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1)); fieldProperties.AddIndirectlyProperty(new Property("cameraParamPin_.pinValueType_", 1839066976, "Base.String", 440, 16, 1, Property.PrimitiveType.String, 0, (char)0)); fieldProperties.AddProperty(new Property("in_", 1827225043, "SQEX.Ebony.Framework.Node.GraphTriggerInputPin", 176, 96, 1, Property.PrimitiveType.ClassField, 0, (char)0)); fieldProperties.AddProperty(new Property("out_", 1514340864, "SQEX.Ebony.Framework.Node.GraphTriggerOutputPin", 272, 96, 1, Property.PrimitiveType.ClassField, 0, (char)0)); fieldProperties.AddProperty(new Property("cameraParamPin_", 2663502203, "SQEX.Ebony.Framework.Node.GraphVariableInputPin", 368, 88, 1, Property.PrimitiveType.ClassField, 0, (char)0)); fieldProperties.AddProperty(new Property("cameraParamType_", 4007445208, "Black.Camera.CameraManager.BlackCameraParamType", 456, 4, 1, Property.PrimitiveType.Enum, 0, (char)0)); fieldProperties.AddProperty(new Property("cameraParamValue_", 2770548737, "float", 460, 4, 1, Property.PrimitiveType.Float, 0, (char)0)); return fieldProperties; } private static BaseObject Construct() { return new SequenceActionInitCameraParameter(); } } }
75.021053
241
0.74323
[ "MIT" ]
Gurrimo/Luminaire
Assets/Editor/Generated/Black/Sequence/Action/Camera/Init/SequenceActionInitCameraParameter.generated.cs
7,127
C#
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Docker.DotNet; using Docker.DotNet.Models; namespace EasyNetQ.IntegrationTests { public class DockerProxy : IDisposable { private readonly DockerClient client; private readonly DockerClientConfiguration dockerConfiguration; public DockerProxy(Uri uri) { dockerConfiguration = new DockerClientConfiguration(uri); client = dockerConfiguration.CreateClient(); } public void Dispose() { dockerConfiguration.Dispose(); client.Dispose(); } public async Task<OSPlatform> GetDockerEngineOsAsync(CancellationToken token = default) { var response = await client.System.GetSystemInfoAsync(token); return OSPlatform.Create(response.OSType.ToUpper()); } public async Task CreateNetworkAsync(string name, CancellationToken token = default) { var networksCreateParameters = new NetworksCreateParameters { Name = name }; await client.Networks.CreateNetworkAsync(networksCreateParameters, token); } public async Task PullImageAsync(string image, string tag, CancellationToken token = default) { var createParameters = new ImagesCreateParameters { FromImage = image, Tag = tag }; var progress = new Progress<JSONMessage>(jsonMessage => { }); await client.Images.CreateImageAsync(createParameters, null, progress, token); } public async Task<string> CreateContainerAsync(string image, string name, IDictionary<string, ISet<string>> portMappings, string networkName = null, IList<string> envVars = null, CancellationToken token = default) { var createParameters = new CreateContainerParameters { Image = image, Env = envVars ?? Enumerable.Empty<string>().ToList(), Name = name, Hostname = name, HostConfig = new HostConfig { PortBindings = PortBindings(portMappings), NetworkMode = networkName }, ExposedPorts = portMappings.ToDictionary(x => x.Key, x => new EmptyStruct()) }; var response = await client.Containers.CreateContainerAsync(createParameters, token); return response.ID; } public async Task StartContainerAsync(string id, CancellationToken token = default) { await client.Containers.StartContainerAsync(id, new ContainerStartParameters(), token) ; } public async Task<string> GetContainerIpAsync(string id, CancellationToken token = default) { var response = await client.Containers.InspectContainerAsync(id, token); var networks = response.NetworkSettings.Networks; return networks.Select(x => x.Value.IPAddress).First(x => !string.IsNullOrEmpty(x)); } public async Task StopContainerAsync(string name, CancellationToken token = default) { var ids = await FindContainerIdsAsync(name); var stopTasks = ids.Select(x => client.Containers.StopContainerAsync(x, new ContainerStopParameters(), token)); await Task.WhenAll(stopTasks); } public Task StopContainerByIdAsync(string id, CancellationToken token = default) { return client.Containers.StopContainerAsync(id, new ContainerStopParameters(), token); } public async Task RemoveContainerAsync(string name, CancellationToken token = default) { var ids = await FindContainerIdsAsync(name); var containerRemoveParameters = new ContainerRemoveParameters {Force = true, RemoveVolumes = true}; var removeTasks = ids.Select(x => client.Containers.RemoveContainerAsync(x, containerRemoveParameters, token)); await Task.WhenAll(removeTasks); } public async Task DeleteNetworkAsync(string name, CancellationToken token = default) { var ids = await FindNetworkIdsAsync(name); var deleteTasks = ids.Select(x => client.Networks.DeleteNetworkAsync(x, token)); await Task.WhenAll(deleteTasks); } private static IDictionary<string, IList<PortBinding>> PortBindings( IDictionary<string, ISet<string>> portMappings) { return portMappings .Select(x => new {ContainerPort = x.Key, HostPorts = HostPorts(x.Value)}) .ToDictionary(x => x.ContainerPort, x => (IList<PortBinding>) x.HostPorts); } private static List<PortBinding> HostPorts(IEnumerable<string> hostPorts) { return hostPorts.Select(x => new PortBinding {HostPort = x}).ToList(); } public async Task<IEnumerable<string>> FindContainerIdsAsync(string name) { var containers = await client.Containers .ListContainersAsync(new ContainersListParameters {All = true, Filters = ListFilters(name)}) ; return containers.Select(x => x.ID); } private async Task<IEnumerable<string>> FindNetworkIdsAsync(string name) { var networks = await client.Networks .ListNetworksAsync(new NetworksListParameters {Filters = ListFilters(name)}); return networks.Select(x => x.ID); } private static Dictionary<string, IDictionary<string, bool>> ListFilters(string name) { return new Dictionary<string, IDictionary<string, bool>> { {"name", new Dictionary<string, bool> {{name, true}}} }; } } }
39.316129
116
0.615359
[ "MIT" ]
andy1199/EasyNetQ
Source/EasyNetQ.IntegrationTests/DockerProxy.cs
6,096
C#
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.Aws.Fsx.Inputs { public sealed class OpenZfsVolumeOriginSnapshotGetArgs : Pulumi.ResourceArgs { [Input("copyStrategy", required: true)] public Input<string> CopyStrategy { get; set; } = null!; [Input("snapshotArn", required: true)] public Input<string> SnapshotArn { get; set; } = null!; public OpenZfsVolumeOriginSnapshotGetArgs() { } } }
28.576923
88
0.682369
[ "ECL-2.0", "Apache-2.0" ]
chivandikwa/pulumi-aws
sdk/dotnet/Fsx/Inputs/OpenZfsVolumeOriginSnapshotGetArgs.cs
743
C#
namespace UnravelTravel.Services.Data.Contracts { using System; using System.Collections.Generic; using System.Threading.Tasks; using UnravelTravel.Models.InputModels.AdministratorInputModels.Destinations; using UnravelTravel.Models.ViewModels.Destinations; using UnravelTravel.Models.ViewModels.Enums; using UnravelTravel.Models.ViewModels.Home; public interface IDestinationsService : IBaseDataService { Task<DestinationDetailsViewModel> CreateAsync(DestinationCreateInputModel destinationCreateInputModel); Task EditAsync(DestinationEditViewModel destinationEditViewModel); Task<IEnumerable<DestinationViewModel>> GetAllDestinationsAsync(); Task<SearchResultViewModel> GetSearchResultAsync(int destinationId, DateTime startDate, DateTime endDate); IEnumerable<DestinationViewModel> SortBy(DestinationViewModel[] destinations, DestinationSorter sorter); IEnumerable<DestinationViewModel> GetDestinationFromSearch(string searchString); Task<string> GetDestinationName(int destinationId); } }
37.862069
114
0.79235
[ "MIT" ]
EmORz/Simple_Example_Projects
UnravelTravel-master/src/Services/UnravelTravel.Services.Data/Contracts/IDestinationsService.cs
1,100
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FileHasher.ObjectModel { public enum FSType { Directory, File } }
13.4
33
0.766169
[ "MIT" ]
albertkasdorf/FileHasher
FileHasher/ObjectModel/FSType.cs
203
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace UnrealEngine.Runtime { // Engine\Source\Runtime\Core\Public\Math\InterpCurvePoint.h // NOTE: This isn't exported with a specific size but it seems to be used everywhere with TEnumAsByte<> /// <summary>Interpolation data types.</summary> [UEnum, UMetaPath("/Script/CoreUObject.EInterpCurveMode")] public enum EInterpCurveMode : byte { /// <summary> /// A straight line between two keypoint values. /// </summary> Linear = 0, /// <summary> /// A cubic-hermite curve between two keypoints, using Arrive/Leave tangents. These tangents will be automatically /// updated when points are moved, etc. Tangents are unclamped and will plateau at curve start and end points. /// </summary> CurveAuto = 1, /// <summary> /// The out value is held constant until the next key, then will jump to that value. /// </summary> Constant = 2, /// <summary> /// A smooth curve just like CIM_Curve, but tangents are not automatically updated so you can have manual control over them (eg. in Curve Editor). /// </summary> CurveUser = 3, /// <summary> /// A curve like CIM_Curve, but the arrive and leave tangents are not forced to be the same, so you can create a 'corner' at this key. /// </summary> CurveBreak = 4, /// <summary> /// A cubic-hermite curve between two keypoints, using Arrive/Leave tangents. These tangents will be automatically /// updated when points are moved, etc. Tangents are clamped and will plateau at curve start and end points. /// </summary> CurveAutoClamped = 5, /// <summary> /// Invalid or unknown curve type. /// </summary> Unknown = 6 } }
35
154
0.626494
[ "MIT" ]
MiheevN/USharp
Managed/UnrealEngine.Runtime/UnrealEngine.Runtime/Core/Math/InterpCurvePoint/EInterpCurveMode.cs
1,927
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class QuestEnemy : MonoBehaviour { public string enemyName; public int questID; }
17.8
39
0.775281
[ "CC0-1.0" ]
csantos92/TFG
Project/Assets/Scripts/Game/Quests/QuestEnemy.cs
180
C#
namespace DotNetCsharpReverseShellServer { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); this.Text = "Form1"; } #endregion } }
29.707317
107
0.566502
[ "MIT" ]
melardev/.NetCSharpBindShell
DotNetCsharpBindShell/Form1.Designer.cs
1,220
C#
using FubuMVC.Core; using Shouldly; using NUnit.Framework; using StoryTeller; namespace Serenity.Testing { [TestFixture] public class BrowserType_selection_tester { private FubuMvcSystem theSystem; [SetUp] public void SetUp() { theSystem = new FubuMvcSystem(() => { return null; }); theSystem.DefaultBrowser = BrowserType.Chrome; } [Test] public void use_profile_if_it_exists() { Project.CurrentProject = new Project{Profile = BrowserType.Phantom.ToString()}; theSystem.ChooseBrowserType().ShouldBe(BrowserType.Phantom); } [Test] public void use_the_project_default_if_it_exists_and_no_profile() { Project.CurrentProject = new Project{Profile = null}; WebDriverSettings.Current.Browser = BrowserType.Chrome; theSystem.DefaultBrowser = BrowserType.IE; theSystem.ChooseBrowserType().ShouldBe(BrowserType.IE); } [Test] public void fall_back_to_the_webdriver_settings_current_if_no_profile_or_default() { Project.CurrentProject = new Project { Profile = null }; WebDriverSettings.Current.Browser = BrowserType.Chrome; theSystem.DefaultBrowser = null; theSystem.ChooseBrowserType().ShouldBe(BrowserType.Chrome); } } }
27.843137
91
0.63662
[ "Apache-2.0" ]
DarthFubuMVC/fubumvc
src/Serenity.Testing/BrowserType_selection_tester.cs
1,422
C#
using System; using System.Collections; using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Threading; namespace PluginBurnMedia.Interop { #region IMAPI2 Enums public enum EmulationType { EmulationNone, Emulation12MFloppy, Emulation144MFloppy, Emulation288MFloppy, EmulationHardDisk } [Flags] public enum FsiFileSystems { FsiFileSystemNone = 0, FsiFileSystemISO9660 = 1, FsiFileSystemJoliet = 2, FsiFileSystemUDF = 4, FsiFileSystemUnknown = 0x40000000 } public enum FsiItemType { FsiItemNotFound, FsiItemDirectory, FsiItemFile } public enum IMAPI_BURN_VERIFICATION_LEVEL { IMAPI_BURN_VERIFICATION_NONE, IMAPI_BURN_VERIFICATION_QUICK, IMAPI_BURN_VERIFICATION_FULL } public enum IMAPI_CD_SECTOR_TYPE { IMAPI_CD_SECTOR_AUDIO, IMAPI_CD_SECTOR_MODE_ZERO, IMAPI_CD_SECTOR_MODE1, IMAPI_CD_SECTOR_MODE2FORM0, IMAPI_CD_SECTOR_MODE2FORM1, IMAPI_CD_SECTOR_MODE2FORM2, IMAPI_CD_SECTOR_MODE1RAW, IMAPI_CD_SECTOR_MODE2FORM0RAW, IMAPI_CD_SECTOR_MODE2FORM1RAW, IMAPI_CD_SECTOR_MODE2FORM2RAW } public enum IMAPI_CD_TRACK_DIGITAL_COPY_SETTING { IMAPI_CD_TRACK_DIGITAL_COPY_PERMITTED, IMAPI_CD_TRACK_DIGITAL_COPY_PROHIBITED, IMAPI_CD_TRACK_DIGITAL_COPY_SCMS } public enum IMAPI_FEATURE_PAGE_TYPE { IMAPI_FEATURE_PAGE_TYPE_PROFILE_LIST = 0, IMAPI_FEATURE_PAGE_TYPE_CORE = 1, IMAPI_FEATURE_PAGE_TYPE_MORPHING = 2, IMAPI_FEATURE_PAGE_TYPE_REMOVABLE_MEDIUM = 3, IMAPI_FEATURE_PAGE_TYPE_WRITE_PROTECT = 4, IMAPI_FEATURE_PAGE_TYPE_RANDOMLY_READABLE = 0x10, IMAPI_FEATURE_PAGE_TYPE_CD_MULTIREAD = 0x1d, IMAPI_FEATURE_PAGE_TYPE_CD_READ = 0x1e, IMAPI_FEATURE_PAGE_TYPE_DVD_READ = 0x1f, IMAPI_FEATURE_PAGE_TYPE_RANDOMLY_WRITABLE = 0x20, IMAPI_FEATURE_PAGE_TYPE_INCREMENTAL_STREAMING_WRITABLE = 0x21, IMAPI_FEATURE_PAGE_TYPE_SECTOR_ERASABLE = 0x22, IMAPI_FEATURE_PAGE_TYPE_FORMATTABLE = 0x23, IMAPI_FEATURE_PAGE_TYPE_HARDWARE_DEFECT_MANAGEMENT = 0x24, IMAPI_FEATURE_PAGE_TYPE_WRITE_ONCE = 0x25, IMAPI_FEATURE_PAGE_TYPE_RESTRICTED_OVERWRITE = 0x26, IMAPI_FEATURE_PAGE_TYPE_CDRW_CAV_WRITE = 0x27, IMAPI_FEATURE_PAGE_TYPE_MRW = 0x28, IMAPI_FEATURE_PAGE_TYPE_ENHANCED_DEFECT_REPORTING = 0x29, IMAPI_FEATURE_PAGE_TYPE_DVD_PLUS_RW = 0x2a, IMAPI_FEATURE_PAGE_TYPE_DVD_PLUS_R = 0x2b, IMAPI_FEATURE_PAGE_TYPE_RIGID_RESTRICTED_OVERWRITE = 0x2c, IMAPI_FEATURE_PAGE_TYPE_CD_TRACK_AT_ONCE = 0x2d, IMAPI_FEATURE_PAGE_TYPE_CD_MASTERING = 0x2e, IMAPI_FEATURE_PAGE_TYPE_DVD_DASH_WRITE = 0x2f, IMAPI_FEATURE_PAGE_TYPE_DOUBLE_DENSITY_CD_READ = 0x30, IMAPI_FEATURE_PAGE_TYPE_DOUBLE_DENSITY_CD_R_WRITE = 0x31, IMAPI_FEATURE_PAGE_TYPE_DOUBLE_DENSITY_CD_RW_WRITE = 0x32, IMAPI_FEATURE_PAGE_TYPE_LAYER_JUMP_RECORDING = 0x33, IMAPI_FEATURE_PAGE_TYPE_CD_RW_MEDIA_WRITE_SUPPORT = 0x37, IMAPI_FEATURE_PAGE_TYPE_BD_PSEUDO_OVERWRITE = 0x38, IMAPI_FEATURE_PAGE_TYPE_DVD_PLUS_R_DUAL_LAYER = 0x3b, IMAPI_FEATURE_PAGE_TYPE_BD_READ = 0x40, IMAPI_FEATURE_PAGE_TYPE_BD_WRITE = 0x41, IMAPI_FEATURE_PAGE_TYPE_HD_DVD_READ = 0x50, IMAPI_FEATURE_PAGE_TYPE_HD_DVD_WRITE = 0x51, IMAPI_FEATURE_PAGE_TYPE_POWER_MANAGEMENT = 0x100, IMAPI_FEATURE_PAGE_TYPE_SMART = 0x101, IMAPI_FEATURE_PAGE_TYPE_EMBEDDED_CHANGER = 0x102, IMAPI_FEATURE_PAGE_TYPE_CD_ANALOG_PLAY = 0x103, IMAPI_FEATURE_PAGE_TYPE_MICROCODE_UPDATE = 0x104, IMAPI_FEATURE_PAGE_TYPE_TIMEOUT = 0x105, IMAPI_FEATURE_PAGE_TYPE_DVD_CSS = 0x106, IMAPI_FEATURE_PAGE_TYPE_REAL_TIME_STREAMING = 0x107, IMAPI_FEATURE_PAGE_TYPE_LOGICAL_UNIT_SERIAL_NUMBER = 0x108, IMAPI_FEATURE_PAGE_TYPE_MEDIA_SERIAL_NUMBER = 0x109, IMAPI_FEATURE_PAGE_TYPE_DISC_CONTROL_BLOCKS = 0x10a, IMAPI_FEATURE_PAGE_TYPE_DVD_CPRM = 0x10b, IMAPI_FEATURE_PAGE_TYPE_FIRMWARE_INFORMATION = 0x10c, IMAPI_FEATURE_PAGE_TYPE_AACS = 0x10d, IMAPI_FEATURE_PAGE_TYPE_VCPS = 0x110 } public enum IMAPI_FORMAT2_DATA_MEDIA_STATE { [TypeLibVar((short)0x40)] IMAPI_FORMAT2_DATA_MEDIA_STATE_UNKNOWN = 0, IMAPI_FORMAT2_DATA_MEDIA_STATE_OVERWRITE_ONLY = 1, IMAPI_FORMAT2_DATA_MEDIA_STATE_RANDOMLY_WRITABLE = 1, IMAPI_FORMAT2_DATA_MEDIA_STATE_BLANK = 2, IMAPI_FORMAT2_DATA_MEDIA_STATE_APPENDABLE = 4, IMAPI_FORMAT2_DATA_MEDIA_STATE_FINAL_SESSION = 8, IMAPI_FORMAT2_DATA_MEDIA_STATE_INFORMATIONAL_MASK = 15, IMAPI_FORMAT2_DATA_MEDIA_STATE_DAMAGED = 0x400, IMAPI_FORMAT2_DATA_MEDIA_STATE_ERASE_REQUIRED = 0x800, IMAPI_FORMAT2_DATA_MEDIA_STATE_NON_EMPTY_SESSION = 0x1000, IMAPI_FORMAT2_DATA_MEDIA_STATE_WRITE_PROTECTED = 0x2000, IMAPI_FORMAT2_DATA_MEDIA_STATE_FINALIZED = 0x4000, IMAPI_FORMAT2_DATA_MEDIA_STATE_UNSUPPORTED_MEDIA = 0x8000, IMAPI_FORMAT2_DATA_MEDIA_STATE_UNSUPPORTED_MASK = 0xfc00 } public enum IMAPI_FORMAT2_DATA_WRITE_ACTION { IMAPI_FORMAT2_DATA_WRITE_ACTION_VALIDATING_MEDIA, IMAPI_FORMAT2_DATA_WRITE_ACTION_FORMATTING_MEDIA, IMAPI_FORMAT2_DATA_WRITE_ACTION_INITIALIZING_HARDWARE, IMAPI_FORMAT2_DATA_WRITE_ACTION_CALIBRATING_POWER, IMAPI_FORMAT2_DATA_WRITE_ACTION_WRITING_DATA, IMAPI_FORMAT2_DATA_WRITE_ACTION_FINALIZATION, IMAPI_FORMAT2_DATA_WRITE_ACTION_COMPLETED, IMAPI_FORMAT2_DATA_WRITE_ACTION_VERIFYING } public enum IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE { IMAPI_FORMAT2_RAW_CD_SUBCODE_PQ_ONLY = 1, IMAPI_FORMAT2_RAW_CD_SUBCODE_IS_COOKED = 2, IMAPI_FORMAT2_RAW_CD_SUBCODE_IS_RAW = 3 } public enum IMAPI_FORMAT2_RAW_CD_WRITE_ACTION { [TypeLibVar((short)0x40)] IMAPI_FORMAT2_RAW_CD_WRITE_ACTION_UNKNOWN = 0, IMAPI_FORMAT2_RAW_CD_WRITE_ACTION_PREPARING = 1, IMAPI_FORMAT2_RAW_CD_WRITE_ACTION_WRITING = 2, IMAPI_FORMAT2_RAW_CD_WRITE_ACTION_FINISHING = 3 } public enum IMAPI_FORMAT2_TAO_WRITE_ACTION { [TypeLibVar((short)0x40)] IMAPI_FORMAT2_TAO_WRITE_ACTION_UNKNOWN = 0, IMAPI_FORMAT2_TAO_WRITE_ACTION_PREPARING = 1, IMAPI_FORMAT2_TAO_WRITE_ACTION_WRITING = 2, IMAPI_FORMAT2_TAO_WRITE_ACTION_FINISHING = 3, IMAPI_FORMAT2_TAO_WRITE_ACTION_VERIFYING = 4 } public enum IMAPI_MEDIA_PHYSICAL_TYPE { IMAPI_MEDIA_TYPE_UNKNOWN = 0, IMAPI_MEDIA_TYPE_CDROM = 1, IMAPI_MEDIA_TYPE_CDR = 2, IMAPI_MEDIA_TYPE_CDRW = 3, IMAPI_MEDIA_TYPE_DVDROM = 4, IMAPI_MEDIA_TYPE_DVDRAM = 5, IMAPI_MEDIA_TYPE_DVDPLUSR = 6, IMAPI_MEDIA_TYPE_DVDPLUSRW = 7, IMAPI_MEDIA_TYPE_DVDPLUSR_DUALLAYER = 8, IMAPI_MEDIA_TYPE_DVDDASHR = 9, IMAPI_MEDIA_TYPE_DVDDASHRW = 10, IMAPI_MEDIA_TYPE_DVDDASHR_DUALLAYER = 11, IMAPI_MEDIA_TYPE_DISK = 12, IMAPI_MEDIA_TYPE_DVDPLUSRW_DUALLAYER = 13, IMAPI_MEDIA_TYPE_HDDVDROM = 14, IMAPI_MEDIA_TYPE_HDDVDR = 15, IMAPI_MEDIA_TYPE_HDDVDRAM = 0x10, IMAPI_MEDIA_TYPE_BDROM = 0x11, IMAPI_MEDIA_TYPE_BDR = 0x12, IMAPI_MEDIA_TYPE_BDRE = 0x13, IMAPI_MEDIA_TYPE_MAX = 0x13 } public enum IMAPI_MEDIA_WRITE_PROTECT_STATE { IMAPI_WRITEPROTECTED_UNTIL_POWERDOWN = 1, IMAPI_WRITEPROTECTED_BY_CARTRIDGE = 2, IMAPI_WRITEPROTECTED_BY_MEDIA_SPECIFIC_REASON = 4, IMAPI_WRITEPROTECTED_BY_SOFTWARE_WRITE_PROTECT = 8, IMAPI_WRITEPROTECTED_BY_DISC_CONTROL_BLOCK = 0x10, IMAPI_WRITEPROTECTED_READ_ONLY_MEDIA = 0x4000 } public enum IMAPI_MODE_PAGE_REQUEST_TYPE { IMAPI_MODE_PAGE_REQUEST_TYPE_CURRENT_VALUES, IMAPI_MODE_PAGE_REQUEST_TYPE_CHANGEABLE_VALUES, IMAPI_MODE_PAGE_REQUEST_TYPE_DEFAULT_VALUES, IMAPI_MODE_PAGE_REQUEST_TYPE_SAVED_VALUES } public enum IMAPI_MODE_PAGE_TYPE { IMAPI_MODE_PAGE_TYPE_READ_WRITE_ERROR_RECOVERY = 1, IMAPI_MODE_PAGE_TYPE_MRW = 3, IMAPI_MODE_PAGE_TYPE_WRITE_PARAMETERS = 5, IMAPI_MODE_PAGE_TYPE_CACHING = 8, IMAPI_MODE_PAGE_TYPE_POWER_CONDITION = 0x1a, IMAPI_MODE_PAGE_TYPE_TIMEOUT_AND_PROTECT = 0x1d, IMAPI_MODE_PAGE_TYPE_INFORMATIONAL_EXCEPTIONS = 0x1c, IMAPI_MODE_PAGE_TYPE_LEGACY_CAPABILITIES = 0x2a } public enum IMAPI_PROFILE_TYPE { IMAPI_PROFILE_TYPE_INVALID = 0, IMAPI_PROFILE_TYPE_NON_REMOVABLE_DISK = 1, IMAPI_PROFILE_TYPE_REMOVABLE_DISK = 2, IMAPI_PROFILE_TYPE_MO_ERASABLE = 3, IMAPI_PROFILE_TYPE_MO_WRITE_ONCE = 4, IMAPI_PROFILE_TYPE_AS_MO = 5, IMAPI_PROFILE_TYPE_CDROM = 8, IMAPI_PROFILE_TYPE_CD_RECORDABLE = 9, IMAPI_PROFILE_TYPE_CD_REWRITABLE = 10, IMAPI_PROFILE_TYPE_DVDROM = 0x10, IMAPI_PROFILE_TYPE_DVD_DASH_RECORDABLE = 0x11, IMAPI_PROFILE_TYPE_DVD_RAM = 0x12, IMAPI_PROFILE_TYPE_DVD_DASH_REWRITABLE = 0x13, IMAPI_PROFILE_TYPE_DVD_DASH_RW_SEQUENTIAL = 0x14, IMAPI_PROFILE_TYPE_DVD_DASH_R_DUAL_SEQUENTIAL = 0x15, IMAPI_PROFILE_TYPE_DVD_DASH_R_DUAL_LAYER_JUMP = 0x16, IMAPI_PROFILE_TYPE_DVD_PLUS_RW = 0x1a, IMAPI_PROFILE_TYPE_DVD_PLUS_R = 0x1b, IMAPI_PROFILE_TYPE_DDCDROM = 0x20, IMAPI_PROFILE_TYPE_DDCD_RECORDABLE = 0x21, IMAPI_PROFILE_TYPE_DDCD_REWRITABLE = 0x22, IMAPI_PROFILE_TYPE_DVD_PLUS_RW_DUAL = 0x2a, IMAPI_PROFILE_TYPE_DVD_PLUS_R_DUAL = 0x2b, IMAPI_PROFILE_TYPE_BD_ROM = 0x40, IMAPI_PROFILE_TYPE_BD_R_SEQUENTIAL = 0x41, IMAPI_PROFILE_TYPE_BD_R_RANDOM_RECORDING = 0x42, IMAPI_PROFILE_TYPE_BD_REWRITABLE = 0x43, IMAPI_PROFILE_TYPE_HD_DVD_ROM = 0x50, IMAPI_PROFILE_TYPE_HD_DVD_RECORDABLE = 0x51, IMAPI_PROFILE_TYPE_HD_DVD_RAM = 0x52, IMAPI_PROFILE_TYPE_NON_STANDARD = 0xffff } public enum IMAPI_READ_TRACK_ADDRESS_TYPE { IMAPI_READ_TRACK_ADDRESS_TYPE_LBA, IMAPI_READ_TRACK_ADDRESS_TYPE_TRACK, IMAPI_READ_TRACK_ADDRESS_TYPE_SESSION } public enum PlatformId { PlatformX86 = 0, PlatformPowerPC = 1, PlatformMac = 2, PlatformEFI = 0xef } #endregion #region IMAPI2 Structures [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct _FILETIME { public uint dwLowDateTime; public uint dwHighDateTime; } [StructLayout(LayoutKind.Sequential, Pack = 8)] public struct _LARGE_INTEGER { public long QuadPart; } [StructLayout(LayoutKind.Sequential, Pack = 8)] public struct _ULARGE_INTEGER { public ulong QuadPart; } [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct tagCONNECTDATA { [MarshalAs(UnmanagedType.IUnknown)] public object pUnk; public uint dwCookie; } [StructLayout(LayoutKind.Sequential, Pack = 8)] public struct tagSTATSTG { [MarshalAs(UnmanagedType.LPWStr)] public string pwcsName; public uint type; public _ULARGE_INTEGER cbSize; public _FILETIME mtime; public _FILETIME ctime; public _FILETIME atime; public uint grfMode; public uint grfLocksSupported; public Guid clsid; public uint grfStateBits; public uint reserved; } #endregion #region DDiscFormat2DataEvents /// <summary> /// Data Writer /// </summary> [ComImport] [Guid("2735413C-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FNonExtensible | TypeLibTypeFlags.FOleAutomation | TypeLibTypeFlags.FDispatchable)] public interface DDiscFormat2DataEvents { // Update to current progress [DispId(0x200)] // DISPID_DDISCFORMAT2DATAEVENTS_UPDATE [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress); } [ComVisible(false)] [ComEventInterface(typeof(DDiscFormat2DataEvents), typeof(DiscFormat2Data_EventProvider))] [TypeLibType(TypeLibTypeFlags.FHidden)] public interface DiscFormat2Data_Event { // Events event DiscFormat2Data_EventHandler Update; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscFormat2Data_EventProvider : DiscFormat2Data_Event, IDisposable { // Fields private Hashtable m_aEventSinkHelpers = new Hashtable(); private IConnectionPoint m_connectionPoint = null; // Methods public DiscFormat2Data_EventProvider(object pointContainer) { lock (this) { Guid eventsGuid = typeof(DDiscFormat2DataEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_connectionPoint); } } public event DiscFormat2Data_EventHandler Update { add { lock (this) { DiscFormat2Data_SinkHelper helper = new DiscFormat2Data_SinkHelper(value); int cookie; m_connectionPoint.Advise(helper, out cookie); helper.Cookie = cookie; m_aEventSinkHelpers.Add(helper.UpdateDelegate, helper); } } remove { lock (this) { DiscFormat2Data_SinkHelper helper = m_aEventSinkHelpers[value] as DiscFormat2Data_SinkHelper; if (helper != null) { m_connectionPoint.Unadvise(helper.Cookie); m_aEventSinkHelpers.Remove(helper.UpdateDelegate); } } } } ~DiscFormat2Data_EventProvider() { Cleanup(); } public void Dispose() { Cleanup(); GC.SuppressFinalize(this); } private void Cleanup() { Monitor.Enter(this); try { foreach (DiscFormat2Data_SinkHelper helper in m_aEventSinkHelpers.Values) { m_connectionPoint.Unadvise(helper.Cookie); } m_aEventSinkHelpers.Clear(); Marshal.ReleaseComObject(m_connectionPoint); } catch (SynchronizationLockException) { return; } finally { Monitor.Exit(this); } } } [ClassInterface(ClassInterfaceType.None)] [TypeLibType(TypeLibTypeFlags.FHidden)] public sealed class DiscFormat2Data_SinkHelper : DDiscFormat2DataEvents { // Fields private int m_dwCookie; private DiscFormat2Data_EventHandler m_UpdateDelegate; // Methods internal DiscFormat2Data_SinkHelper(DiscFormat2Data_EventHandler eventHandler) { if (eventHandler == null) throw new ArgumentNullException("Delegate (callback function) cannot be null"); m_dwCookie = 0; m_UpdateDelegate = eventHandler; } public void Update(object sender, object args) { m_UpdateDelegate(sender, args); } public int Cookie { get { return m_dwCookie; } set { m_dwCookie = value; } } public DiscFormat2Data_EventHandler UpdateDelegate { get { return m_UpdateDelegate; } set { m_UpdateDelegate = value; } } } [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void DiscFormat2Data_EventHandler([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress); #endregion // DDiscFormat2DataEvents #region DDiscFormat2EraseEvents /// <summary> /// Provides notification of media erase progress. /// </summary> [ComImport] [TypeLibType(TypeLibTypeFlags.FNonExtensible | TypeLibTypeFlags.FOleAutomation | TypeLibTypeFlags.FDispatchable)] [Guid("2735413A-7F64-5B0F-8F00-5D77AFBE261E")] public interface DDiscFormat2EraseEvents { // Update to current progress [DispId(0x200)] // DISPID_IDISCFORMAT2ERASEEVENTS_UPDATE [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In] int elapsedSeconds, [In] int estimatedTotalSeconds); } [TypeLibType(TypeLibTypeFlags.FHidden)] [ComVisible(false)] [ComEventInterface(typeof(DDiscFormat2EraseEvents), typeof(DiscFormat2Erase_EventProvider))] public interface DiscFormat2Erase_Event { // Events event DiscFormat2Erase_EventHandler Update; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscFormat2Erase_EventProvider : DiscFormat2Erase_Event, IDisposable { // Fields private Hashtable m_aEventSinkHelpers = new Hashtable(); private IConnectionPoint m_connectionPoint = null; // Methods public DiscFormat2Erase_EventProvider(object pointContainer) { lock (this) { Guid eventsGuid = typeof(DDiscFormat2EraseEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_connectionPoint); } } public event DiscFormat2Erase_EventHandler Update { add { lock (this) { DiscFormat2Erase_SinkHelper helper = new DiscFormat2Erase_SinkHelper(value); int cookie = -1; m_connectionPoint.Advise(helper, out cookie); helper.Cookie = cookie; m_aEventSinkHelpers.Add(helper.UpdateDelegate, helper); } } remove { lock (this) { DiscFormat2Erase_SinkHelper helper = m_aEventSinkHelpers[value] as DiscFormat2Erase_SinkHelper; if (helper != null) { m_connectionPoint.Unadvise(helper.Cookie); m_aEventSinkHelpers.Remove(helper.UpdateDelegate); } } } } ~DiscFormat2Erase_EventProvider() { Cleanup(); } public void Dispose() { Cleanup(); GC.SuppressFinalize(this); } private void Cleanup() { Monitor.Enter(this); try { foreach (DiscFormat2Erase_SinkHelper helper in m_aEventSinkHelpers.Values) { m_connectionPoint.Unadvise(helper.Cookie); } m_aEventSinkHelpers.Clear(); Marshal.ReleaseComObject(m_connectionPoint); } catch (SynchronizationLockException) { return; } finally { Monitor.Exit(this); } } } [TypeLibType(TypeLibTypeFlags.FHidden)] [ClassInterface(ClassInterfaceType.None)] public sealed class DiscFormat2Erase_SinkHelper : DDiscFormat2EraseEvents { // Fields private int m_dwCookie; private DiscFormat2Erase_EventHandler m_UpdateDelegate; public DiscFormat2Erase_SinkHelper(DiscFormat2Erase_EventHandler eventHandler) { if (eventHandler == null) throw new ArgumentNullException("Delegate (callback function) cannot be null"); m_dwCookie = 0; m_UpdateDelegate = eventHandler; } public void Update(object sender, int elapsedSeconds, int estimatedTotalSeconds) { m_UpdateDelegate(sender, elapsedSeconds, estimatedTotalSeconds); } public int Cookie { get { return m_dwCookie; } set { m_dwCookie = value; } } public DiscFormat2Erase_EventHandler UpdateDelegate { get { return m_UpdateDelegate; } set { m_UpdateDelegate = value; } } } [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void DiscFormat2Erase_EventHandler([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In] int elapsedSeconds, [In] int estimatedTotalSeconds); #endregion // DDiscFormat2EraseEvents #region DDiscFormat2RawCDEvents /// <summary> /// CD Disc-At-Once RAW Writer Events /// </summary> [ComImport] [TypeLibType(TypeLibTypeFlags.FNonExtensible | TypeLibTypeFlags.FOleAutomation | TypeLibTypeFlags.FDispatchable)] [Guid("27354142-7F64-5B0F-8F00-5D77AFBE261E")] public interface DDiscFormat2RawCDEvents { // Update to current progress [DispId(0x200)] // DISPID_DDISCFORMAT2RAWCDEVENTS_UPDATE [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress); } [ComEventInterface(typeof(DDiscFormat2RawCDEvents), typeof(DiscFormat2RawCD_EventProvider))] [TypeLibType(TypeLibTypeFlags.FHidden)] [ComVisible(false)] public interface DiscFormat2RawCD_Event { // Events event DiscFormat2RawCD_EventHandler Update; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscFormat2RawCD_EventProvider : DiscFormat2RawCD_Event, IDisposable { // Fields private Hashtable m_aEventSinkHelpers = new Hashtable(); private IConnectionPoint m_connectionPoint = null; // Methods public DiscFormat2RawCD_EventProvider(object pointContainer) { lock (this) { Guid eventsGuid = typeof(DDiscFormat2RawCDEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_connectionPoint); } } public event DiscFormat2RawCD_EventHandler Update { add { lock (this) { DiscFormat2RawCD_SinkHelper helper = new DiscFormat2RawCD_SinkHelper(value); int cookie; m_connectionPoint.Advise(helper, out cookie); helper.Cookie = cookie; m_aEventSinkHelpers.Add(helper.UpdateDelegate, helper); } } remove { lock (this) { DiscFormat2RawCD_SinkHelper helper = m_aEventSinkHelpers[value] as DiscFormat2RawCD_SinkHelper; if (helper != null) { m_connectionPoint.Unadvise(helper.Cookie); m_aEventSinkHelpers.Remove(helper.UpdateDelegate); } } } } ~DiscFormat2RawCD_EventProvider() { Cleanup(); } public void Dispose() { Cleanup(); GC.SuppressFinalize(this); } private void Cleanup() { Monitor.Enter(this); try { foreach (DiscFormat2RawCD_SinkHelper helper in m_aEventSinkHelpers.Values) { m_connectionPoint.Unadvise(helper.Cookie); } m_aEventSinkHelpers.Clear(); Marshal.ReleaseComObject(m_connectionPoint); } catch (SynchronizationLockException) { return; } finally { Monitor.Exit(this); } } } [ClassInterface(ClassInterfaceType.None)] [TypeLibType(TypeLibTypeFlags.FHidden)] public sealed class DiscFormat2RawCD_SinkHelper : DDiscFormat2RawCDEvents { // Fields private int m_dwCookie; private DiscFormat2RawCD_EventHandler m_UpdateDelegate; public DiscFormat2RawCD_SinkHelper(DiscFormat2RawCD_EventHandler eventHandler) { if (eventHandler == null) throw new ArgumentNullException("Delegate (callback function) cannot be null"); m_dwCookie = 0; m_UpdateDelegate = eventHandler; } public void Update(object sender, object progress) { m_UpdateDelegate(sender, progress); } public int Cookie { get { return m_dwCookie; } set { m_dwCookie = value; } } public DiscFormat2RawCD_EventHandler UpdateDelegate { get { return m_UpdateDelegate; } set { m_UpdateDelegate = value; } } } [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void DiscFormat2RawCD_EventHandler([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress); #endregion // DDiscFormat2RawCDEvents #region DDiscFormat2TrackAtOnceEvents /// <summary> /// CD Track-at-Once Audio Writer Events /// </summary> [ComImport] [Guid("2735413F-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FNonExtensible | TypeLibTypeFlags.FOleAutomation | TypeLibTypeFlags.FDispatchable)] public interface DDiscFormat2TrackAtOnceEvents { // Update to current progress [DispId(0x200)] // DISPID_DDISCFORMAT2TAOEVENTS_UPDATE [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress); } [ComVisible(false)] [TypeLibType(TypeLibTypeFlags.FHidden)] [ComEventInterface(typeof(DDiscFormat2TrackAtOnceEvents), typeof(DiscFormat2TrackAtOnce_EventProvider))] public interface DiscFormat2TrackAtOnce_Event { // Events event DiscFormat2TrackAtOnce_EventHandler Update; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscFormat2TrackAtOnce_EventProvider : DiscFormat2TrackAtOnce_Event, IDisposable { // Fields private Hashtable m_aEventSinkHelpers = new Hashtable(); private IConnectionPoint m_connectionPoint = null; // Methods public DiscFormat2TrackAtOnce_EventProvider(object pointContainer) { lock (this) { Guid eventsGuid = typeof(DDiscFormat2TrackAtOnceEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_connectionPoint); } } public event DiscFormat2TrackAtOnce_EventHandler Update { add { lock (this) { DiscFormat2TrackAtOnce_SinkHelper helper = new DiscFormat2TrackAtOnce_SinkHelper(value); int cookie; m_connectionPoint.Advise(helper, out cookie); helper.Cookie = cookie; m_aEventSinkHelpers.Add(helper.UpdateDelegate, helper); } } remove { lock (this) { DiscFormat2TrackAtOnce_SinkHelper helper = m_aEventSinkHelpers[value] as DiscFormat2TrackAtOnce_SinkHelper; if (helper != null) { m_connectionPoint.Unadvise(helper.Cookie); m_aEventSinkHelpers.Remove(helper.UpdateDelegate); } } } } ~DiscFormat2TrackAtOnce_EventProvider() { Cleanup(); } public void Dispose() { Cleanup(); GC.SuppressFinalize(this); } private void Cleanup() { Monitor.Enter(this); try { foreach (DiscFormat2TrackAtOnce_SinkHelper helper in m_aEventSinkHelpers.Values) { m_connectionPoint.Unadvise(helper.Cookie); } m_aEventSinkHelpers.Clear(); Marshal.ReleaseComObject(m_connectionPoint); } catch (SynchronizationLockException) { return; } finally { Monitor.Exit(this); } } } [TypeLibType(TypeLibTypeFlags.FHidden)] [ClassInterface(ClassInterfaceType.None)] public sealed class DiscFormat2TrackAtOnce_SinkHelper : DDiscFormat2TrackAtOnceEvents { // Fields private int m_dwCookie; private DiscFormat2TrackAtOnce_EventHandler m_UpdateDelegate; public DiscFormat2TrackAtOnce_SinkHelper(DiscFormat2TrackAtOnce_EventHandler eventHandler) { if (eventHandler == null) throw new ArgumentNullException("Delegate (callback function) cannot be null"); m_dwCookie = 0; m_UpdateDelegate = eventHandler; } public void Update(object sender, object progress) { m_UpdateDelegate(sender, progress); } public int Cookie { get { return m_dwCookie; } set { m_dwCookie = value; } } public DiscFormat2TrackAtOnce_EventHandler UpdateDelegate { get { return m_UpdateDelegate; } set { m_UpdateDelegate = value; } } } [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void DiscFormat2TrackAtOnce_EventHandler([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress); #endregion // DDiscFormat2TrackAtOnceEvents #region DDiscMaster2Events /// <summary> /// Provides notification of the arrival/removal of CD/DVD (optical) devices. /// </summary> [ComImport] [Guid("27354131-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FNonExtensible | TypeLibTypeFlags.FOleAutomation | TypeLibTypeFlags.FDispatchable)] public interface DDiscMaster2Events { // A device was added to the system [DispId(0x100)] // DISPID_DDISCMASTER2EVENTS_DEVICEADDED [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void NotifyDeviceAdded([In, MarshalAs(UnmanagedType.IDispatch)] object sender, string uniqueId); // A device was removed from the system [DispId(0x101)] // DISPID_DDISCMASTER2EVENTS_DEVICEREMOVED [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void NotifyDeviceRemoved([In, MarshalAs(UnmanagedType.IDispatch)] object sender, string uniqueId); } [ComVisible(false)] [TypeLibType(TypeLibTypeFlags.FHidden)] [ComEventInterface(typeof(DDiscMaster2Events), typeof(DiscMaster2_EventProvider))] public interface DiscMaster2_Event { // Events event DiscMaster2_NotifyDeviceAddedEventHandler NotifyDeviceAdded; event DiscMaster2_NotifyDeviceRemovedEventHandler NotifyDeviceRemoved; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscMaster2_EventProvider : DiscMaster2_Event, IDisposable { // Fields private Hashtable m_aEventSinkHelpers = new Hashtable(); private IConnectionPoint m_connectionPoint = null; // Methods public DiscMaster2_EventProvider(object pointContainer) { lock (this) { Guid eventsGuid = typeof(DDiscMaster2Events).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_connectionPoint); } } public event DiscMaster2_NotifyDeviceAddedEventHandler NotifyDeviceAdded { add { lock (this) { DiscMaster2_SinkHelper helper = new DiscMaster2_SinkHelper(value); int cookie; m_connectionPoint.Advise(helper, out cookie); helper.Cookie = cookie; m_aEventSinkHelpers.Add(helper.NotifyDeviceAddedDelegate, helper); } } remove { lock (this) { DiscMaster2_SinkHelper helper = m_aEventSinkHelpers[value] as DiscMaster2_SinkHelper; if (helper != null) { m_connectionPoint.Unadvise(helper.Cookie); m_aEventSinkHelpers.Remove(helper.NotifyDeviceAddedDelegate); } } } } public event DiscMaster2_NotifyDeviceRemovedEventHandler NotifyDeviceRemoved { add { lock (this) { DiscMaster2_SinkHelper helper = new DiscMaster2_SinkHelper(value); int cookie; m_connectionPoint.Advise(helper, out cookie); helper.Cookie = cookie; m_aEventSinkHelpers.Add(helper.NotifyDeviceRemovedDelegate, helper); } } remove { lock (this) { DiscMaster2_SinkHelper helper = m_aEventSinkHelpers[value] as DiscMaster2_SinkHelper; if (helper != null) { m_connectionPoint.Unadvise(helper.Cookie); m_aEventSinkHelpers.Remove(helper.NotifyDeviceRemovedDelegate); } } } } ~DiscMaster2_EventProvider() { Cleanup(); } public void Dispose() { Cleanup(); GC.SuppressFinalize(this); } private void Cleanup() { Monitor.Enter(this); try { foreach (DiscMaster2_SinkHelper helper in m_aEventSinkHelpers.Values) { m_connectionPoint.Unadvise(helper.Cookie); } m_aEventSinkHelpers.Clear(); Marshal.ReleaseComObject(m_connectionPoint); } catch (SynchronizationLockException) { return; } finally { Monitor.Exit(this); } } } [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void DiscMaster2_NotifyDeviceAddedEventHandler([In, MarshalAs(UnmanagedType.IDispatch)] object sender, string uniqueId); [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void DiscMaster2_NotifyDeviceRemovedEventHandler([In, MarshalAs(UnmanagedType.IDispatch)] object sender, string uniqueId); [ClassInterface(ClassInterfaceType.None)] [TypeLibType(TypeLibTypeFlags.FHidden)] public sealed class DiscMaster2_SinkHelper : DDiscMaster2Events { // Fields private int m_dwCookie; private DiscMaster2_NotifyDeviceAddedEventHandler m_AddedDelegate = null; private DiscMaster2_NotifyDeviceRemovedEventHandler m_RemovedDelegate = null; public DiscMaster2_SinkHelper(DiscMaster2_NotifyDeviceAddedEventHandler eventHandler) { if (eventHandler == null) throw new ArgumentNullException("Delegate (callback function) cannot be null"); m_dwCookie = 0; m_AddedDelegate = eventHandler; } public DiscMaster2_SinkHelper(DiscMaster2_NotifyDeviceRemovedEventHandler eventHandler) { if (eventHandler == null) throw new ArgumentNullException("Delegate (callback function) cannot be null"); m_dwCookie = 0; m_RemovedDelegate = eventHandler; } public void NotifyDeviceAdded(object sender, string uniqueId) { m_AddedDelegate(sender, uniqueId); } public void NotifyDeviceRemoved(object sender, string uniqueId) { m_RemovedDelegate(sender, uniqueId); } public int Cookie { get { return m_dwCookie; } set { m_dwCookie = value; } } public DiscMaster2_NotifyDeviceAddedEventHandler NotifyDeviceAddedDelegate { get { return m_AddedDelegate; } set { m_AddedDelegate = value; } } public DiscMaster2_NotifyDeviceRemovedEventHandler NotifyDeviceRemovedDelegate { get { return m_RemovedDelegate; } set { m_RemovedDelegate = value; } } } #endregion DDiscMaster2Events #region DFileSystemImageEvents /// <summary> /// Provides notification of file system import progress /// </summary> [ComImport] [Guid("2C941FDF-975B-59BE-A960-9A2A262853A5")] [TypeLibType(TypeLibTypeFlags.FNonExtensible | TypeLibTypeFlags.FOleAutomation | TypeLibTypeFlags.FDispatchable)] public interface DFileSystemImageEvents { // Update to current progress [DispId(0x100)] // DISPID_DFILESYSTEMIMAGEEVENTS_UPDATE [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] object sender, string currentFile, [In] int copiedSectors, [In] int totalSectors); } [ComVisible(false)] [ComEventInterface(typeof(DFileSystemImageEvents), typeof(DFileSystemImage_EventProvider))] [TypeLibType(TypeLibTypeFlags.FHidden)] public interface DFileSystemImage_Event { // Events event DFileSystemImage_EventHandler Update; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DFileSystemImage_EventProvider : DFileSystemImage_Event, IDisposable { // Fields private Hashtable m_aEventSinkHelpers = new Hashtable(); private IConnectionPoint m_connectionPoint = null; // Methods public DFileSystemImage_EventProvider(object pointContainer) { lock (this) { Guid eventsGuid = typeof(DFileSystemImageEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_connectionPoint); } } public event DFileSystemImage_EventHandler Update { add { lock (this) { DFileSystemImage_SinkHelper helper = new DFileSystemImage_SinkHelper(value); int cookie; m_connectionPoint.Advise(helper, out cookie); helper.Cookie = cookie; m_aEventSinkHelpers.Add(helper.UpdateDelegate, helper); } } remove { lock (this) { DFileSystemImage_SinkHelper helper = m_aEventSinkHelpers[value] as DFileSystemImage_SinkHelper; if (helper != null) { m_connectionPoint.Unadvise(helper.Cookie); m_aEventSinkHelpers.Remove(helper.UpdateDelegate); } } } } ~DFileSystemImage_EventProvider() { Cleanup(); } public void Dispose() { Cleanup(); GC.SuppressFinalize(this); } private void Cleanup() { Monitor.Enter(this); try { foreach (DFileSystemImage_SinkHelper helper in m_aEventSinkHelpers.Values) { m_connectionPoint.Unadvise(helper.Cookie); } m_aEventSinkHelpers.Clear(); Marshal.ReleaseComObject(m_connectionPoint); } catch (SynchronizationLockException) { return; } finally { Monitor.Exit(this); } } } [ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FHidden)] public sealed class DFileSystemImage_SinkHelper : DFileSystemImageEvents { // Fields private int m_dwCookie; private DFileSystemImage_EventHandler m_UpdateDelegate; public DFileSystemImage_SinkHelper(DFileSystemImage_EventHandler eventHandler) { if (eventHandler == null) throw new ArgumentNullException("Delegate (callback function) cannot be null"); m_dwCookie = 0; m_UpdateDelegate = eventHandler; } public void Update(object sender, string currentFile, int copiedSectors, int totalSectors) { m_UpdateDelegate(sender, currentFile, copiedSectors, totalSectors); } public int Cookie { get { return m_dwCookie; } set { m_dwCookie = value; } } public DFileSystemImage_EventHandler UpdateDelegate { get { return m_UpdateDelegate; } set { m_UpdateDelegate = value; } } } [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void DFileSystemImage_EventHandler([In, MarshalAs(UnmanagedType.IDispatch)] object sender, string currentFile, int copiedSectors, int totalSectors); #endregion // DFileSystemImageEvents #region DFileSystemImageImportEvents // // DFileSystemImageImportEvents // [ComImport] [Guid("D25C30F9-4087-4366-9E24-E55BE286424B")] [TypeLibType(TypeLibTypeFlags.FNonExtensible | TypeLibTypeFlags.FOleAutomation | TypeLibTypeFlags.FDispatchable)] public interface DFileSystemImageImportEvents { [DispId(0x101)] // DISPID_DFILESYSTEMIMAGEIMPORTEVENTS_UPDATEIMPORT [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void UpdateImport([In, MarshalAs(UnmanagedType.IDispatch)] object sender, FsiFileSystems fileSystem, string currentItem, int importedDirectoryItems, int totalDirectoryItems, int importedFileItems, int totalFileItems); } [ComVisible(false)] [ComEventInterface(typeof(DFileSystemImageImportEvents), typeof(DFileSystemImageImport_EventProvider))] [TypeLibType(TypeLibTypeFlags.FHidden)] public interface DFileSystemImageImport_Event { // Events event DFileSystemImageImport_EventHandler UpdateImport; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DFileSystemImageImport_EventProvider : DFileSystemImageImport_Event, IDisposable { // Fields private Hashtable m_aEventSinkHelpers = new Hashtable(); private IConnectionPoint m_connectionPoint = null; // Methods public DFileSystemImageImport_EventProvider(object pointContainer) { lock (this) { Guid eventsGuid = typeof(DFileSystemImageImportEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_connectionPoint); } } public event DFileSystemImageImport_EventHandler UpdateImport { add { lock (this) { DFileSystemImageImport_SinkHelper helper = new DFileSystemImageImport_SinkHelper(value); int cookie; m_connectionPoint.Advise(helper, out cookie); helper.Cookie = cookie; m_aEventSinkHelpers.Add(helper.UpdateDelegate, helper); } } remove { lock (this) { DFileSystemImageImport_SinkHelper helper = m_aEventSinkHelpers[value] as DFileSystemImageImport_SinkHelper; if (helper != null) { m_connectionPoint.Unadvise(helper.Cookie); m_aEventSinkHelpers.Remove(helper.UpdateDelegate); } } } } ~DFileSystemImageImport_EventProvider() { Cleanup(); } public void Dispose() { Cleanup(); GC.SuppressFinalize(this); } private void Cleanup() { Monitor.Enter(this); try { foreach (DFileSystemImageImport_SinkHelper helper in m_aEventSinkHelpers.Values) { m_connectionPoint.Unadvise(helper.Cookie); } m_aEventSinkHelpers.Clear(); Marshal.ReleaseComObject(m_connectionPoint); } catch (SynchronizationLockException) { return; } finally { Monitor.Exit(this); } } } [TypeLibType(TypeLibTypeFlags.FHidden)] [ClassInterface(ClassInterfaceType.None)] public sealed class DFileSystemImageImport_SinkHelper : DFileSystemImageImportEvents { // Fields private int m_dwCookie; private DFileSystemImageImport_EventHandler m_UpdateDelegate; public DFileSystemImageImport_SinkHelper(DFileSystemImageImport_EventHandler eventHandler) { if (eventHandler == null) throw new ArgumentNullException("Delegate (callback function) cannot be null"); m_dwCookie = 0; m_UpdateDelegate = eventHandler; } public void UpdateImport(object sender, FsiFileSystems fileSystems, string currentItem, int importedDirectoryItems, int totalDirectoryItems, int importedFileItems, int totalFileItems) { m_UpdateDelegate(sender, fileSystems, currentItem, importedDirectoryItems, totalDirectoryItems, importedFileItems, totalFileItems); } public int Cookie { get { return m_dwCookie; } set { m_dwCookie = value; } } public DFileSystemImageImport_EventHandler UpdateDelegate { get { return m_UpdateDelegate; } set { m_UpdateDelegate = value; } } } [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void DFileSystemImageImport_EventHandler([In, MarshalAs(UnmanagedType.IDispatch)] object sender, FsiFileSystems fileSystem, string currentItem, int importedDirectoryItems, int totalDirectoryItems, int importedFileItems, int totalFileItems); #endregion // DFileSystemImageImportEvents #region DWriteEngine2Events /// <summary> /// Provides notification of the progress of the WriteEngine2 writing. /// </summary> [ComImport] [TypeLibType(TypeLibTypeFlags.FNonExtensible | TypeLibTypeFlags.FOleAutomation | TypeLibTypeFlags.FDispatchable)] [Guid("27354137-7F64-5B0F-8F00-5D77AFBE261E")] public interface DWriteEngine2Events { // Update to current progress [DispId(0x100)] // DISPID_DWRITEENGINE2EVENTS_UPDATE [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress); } [ComVisible(false)] [ComEventInterface(typeof(DWriteEngine2Events), typeof(DWriteEngine2_EventProvider))] [TypeLibType(TypeLibTypeFlags.FHidden)] public interface DWriteEngine2_Event { // Events event DWriteEngine2_EventHandler Update; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DWriteEngine2_EventProvider : DWriteEngine2_Event, IDisposable { // Fields private Hashtable m_aEventSinkHelpers = new Hashtable(); private IConnectionPoint m_connectionPoint = null; // Methods public DWriteEngine2_EventProvider(object pointContainer) { lock (this) { Guid eventsGuid = typeof(DWriteEngine2Events).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_connectionPoint); } } public event DWriteEngine2_EventHandler Update { add { lock (this) { DWriteEngine2_SinkHelper helper = new DWriteEngine2_SinkHelper(value); int cookie; m_connectionPoint.Advise(helper, out cookie); helper.Cookie = cookie; m_aEventSinkHelpers.Add(helper.UpdateDelegate, helper); } } remove { lock (this) { DWriteEngine2_SinkHelper helper = m_aEventSinkHelpers[value] as DWriteEngine2_SinkHelper; if (helper != null) { m_connectionPoint.Unadvise(helper.Cookie); m_aEventSinkHelpers.Remove(helper.UpdateDelegate); } } } } ~DWriteEngine2_EventProvider() { Cleanup(); } public void Dispose() { Cleanup(); GC.SuppressFinalize(this); } private void Cleanup() { Monitor.Enter(this); try { foreach (DWriteEngine2_SinkHelper helper in m_aEventSinkHelpers.Values) { m_connectionPoint.Unadvise(helper.Cookie); } m_aEventSinkHelpers.Clear(); Marshal.ReleaseComObject(m_connectionPoint); } catch (SynchronizationLockException) { return; } finally { Monitor.Exit(this); } } } [TypeLibType(TypeLibTypeFlags.FHidden)] [ClassInterface(ClassInterfaceType.None)] public sealed class DWriteEngine2_SinkHelper : DWriteEngine2Events { // Fields private int m_dwCookie; private DWriteEngine2_EventHandler m_UpdateDelegate; public DWriteEngine2_SinkHelper(DWriteEngine2_EventHandler eventHandler) { if (eventHandler == null) throw new ArgumentNullException("Delegate (callback function) cannot be null"); m_dwCookie = 0; m_UpdateDelegate = eventHandler; } public void Update(object sender, object progress) { m_UpdateDelegate(sender, progress); } public int Cookie { get { return m_dwCookie; } set { m_dwCookie = value; } } public DWriteEngine2_EventHandler UpdateDelegate { get { return m_UpdateDelegate; } set { m_UpdateDelegate = value; } } } [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void DWriteEngine2_EventHandler([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress); #endregion // DWriteEngine2Events #region Interfaces /// <summary> /// Boot Options /// </summary> [Guid("2C941FD4-975B-59BE-A960-9A2A262853A5")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IBootOptions { // Get boot image data stream [DispId(1)] IStream BootImage { get; } // Get boot manufacturer [DispId(2)] string Manufacturer { get; set; } // Get boot platform identifier [DispId(3)] PlatformId PlatformId { get; set; } // Get boot emulation type [DispId(4)] EmulationType Emulation { get; set; } // Get boot image size [DispId(5)] uint ImageSize { get; } // Set the boot image data stream, emulation type, and image size [DispId(20)] void AssignBootImage(IStream newVal); } /// <summary> /// An interface to control burn verification for a burning object /// </summary> [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("D2FFD834-958B-426D-8470-2A13879C6A91")] public interface IBurnVerification { // The requested level of burn verification [DispId(0x400)] IMAPI_BURN_VERIFICATION_LEVEL BurnVerificationLevel { set; get; } } /// <summary> /// Common Disc Format (writer) Operations /// </summary> [ComImport] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("27354152-8F64-5B0F-8F00-5D77AFBE261E")] public interface IDiscFormat2 { // Determines if the recorder object supports the given format [DispId(0x800)] bool IsRecorderSupported(IDiscRecorder2 Recorder); // Determines if the current media in a supported recorder object supports the given format [DispId(0x801)] bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); // Determines if the current media is reported as physically blank by the drive [DispId(0x700)] bool MediaPhysicallyBlank { get; } // Attempts to determine if the media is blank using heuristics (mainly for DVD+RW and DVD-RAM media) [DispId(0x701)] bool MediaHeuristicallyBlank { get; } // Supported media types [DispId(0x702)] object[] SupportedMediaTypes { get; } } /// <summary> /// Data Writer /// </summary> [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("27354153-9F64-5B0F-8F00-5D77AFBE261E")] public interface IDiscFormat2Data { // // IDiscFormat2 // // Determines if the recorder object supports the given format [DispId(0x800)] bool IsRecorderSupported(IDiscRecorder2 Recorder); // Determines if the current media in a supported recorder object supports the given format [DispId(0x801)] bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); // Determines if the current media is reported as physically blank by the drive [DispId(0x700)] bool MediaPhysicallyBlank { get; } // Attempts to determine if the media is blank using heuristics (mainly for DVD+RW and DVD-RAM media) [DispId(0x701)] bool MediaHeuristicallyBlank { get; } // Supported media types [DispId(0x702)] object[] SupportedMediaTypes { get; } // // IDiscFormat2Data // // The disc recorder to use [DispId(0x100)] IDiscRecorder2 Recorder { set; get; } // Buffer Underrun Free recording should be disabled [DispId(0x101)] bool BufferUnderrunFreeDisabled { set; get; } // Postgap is included in image [DispId(260)] bool PostgapAlreadyInImage { set; get; } // The state (usability) of the current media [DispId(0x106)] IMAPI_FORMAT2_DATA_MEDIA_STATE CurrentMediaStatus { get; } // The write protection state of the current media [DispId(0x107)] IMAPI_MEDIA_WRITE_PROTECT_STATE WriteProtectStatus { get; } // Total sectors available on the media (used + free). [DispId(0x108)] int TotalSectorsOnMedia { get; } // Free sectors available on the media. [DispId(0x109)] int FreeSectorsOnMedia { get; } // Next writable address on the media (also used sectors) [DispId(0x10a)] int NextWritableAddress { get; } // The first sector in the previous session on the media [DispId(0x10b)] int StartAddressOfPreviousSession { get; } // The last sector in the previous session on the media [DispId(0x10c)] int LastWrittenAddressOfPreviousSession { get; } // Prevent further additions to the file system [DispId(0x10d)] bool ForceMediaToBeClosed { set; get; } // Default is to maximize compatibility with DVD-ROM. May be disabled to // reduce time to finish writing the disc or increase usable space on the // media for later writing. [DispId(270)] bool DisableConsumerDvdCompatibilityMode { set; get; } // Get the current physical media type [DispId(0x10f)] IMAPI_MEDIA_PHYSICAL_TYPE CurrentPhysicalMediaType { get; } // The friendly name of the client (used to determine recorder reservation conflicts) [DispId(0x110)] string ClientName { set; get; } // The last requested write speed [DispId(0x111)] int RequestedWriteSpeed { get; } // The last requested rotation type [DispId(0x112)] bool RequestedRotationTypeIsPureCAV { get; } // The drive's current write speed [DispId(0x113)] int CurrentWriteSpeed { get; } // The drive's current rotation type. [DispId(0x114)] bool CurrentRotationTypeIsPureCAV { get; } // Gets an array of the write speeds supported for the attached disc recorder and current media [DispId(0x115)] object[] SupportedWriteSpeeds { get; } // Gets an array of the detailed write configurations supported for the attached disc recorder // and current media [DispId(0x116)] object[] SupportedWriteSpeedDescriptors { get; } // Forces the Datawriter to overwrite the disc on overwritable media types [DispId(0x117)] bool ForceOverwrite { set; get; } // Returns the array of available multi-session interfaces. The array shall not be empty [DispId(280)] object[] MultisessionInterfaces { get; } // Writes all the data provided in the IStream to the device [DispId(0x200)] void Write(IStream data); // Cancels the current write operation [DispId(0x201)] void CancelWrite(); // Sets the write speed (in sectors per second) of the attached disc recorder [DispId(0x202)] void SetWriteSpeed(int RequestedSectorsPerSecond, bool RotationTypeIsPureCAV); } /// <summary> /// Track-at-once Data Writer /// </summary> [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2735413D-7F64-5B0F-8F00-5D77AFBE261E")] public interface IDiscFormat2DataEventArgs { // // IWriteEngine2EventArgs // // The starting logical block address for the current write operation. [DispId(0x100)] int StartLba { get; } // The number of sectors being written for the current write operation. [DispId(0x101)] int SectorCount { get; } // The last logical block address of data read for the current write operation. [DispId(0x102)] int LastReadLba { get; } // The last logical block address of data written for the current write operation [DispId(0x103)] int LastWrittenLba { get; } // The total bytes available in the system's cache buffer [DispId(0x106)] int TotalSystemBuffer { get; } // The used bytes in the system's cache buffer [DispId(0x107)] int UsedSystemBuffer { get; } // The free bytes in the system's cache buffer [DispId(0x108)] int FreeSystemBuffer { get; } // // IDiscFormat2DataEventArgs // // The total elapsed time for the current write operation [DispId(0x300)] int ElapsedTime { get; } // The estimated time remaining for the write operation. [DispId(0x301)] int RemainingTime { get; } // The estimated total time for the write operation. [DispId(770)] int TotalTime { get; } // The current write action. [DispId(0x303)] IMAPI_FORMAT2_DATA_WRITE_ACTION CurrentAction { get; } } [ComImport, Guid("27354156-8F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IDiscFormat2Erase { // // IDiscFormat2 // // Determines if the recorder object supports the given format [DispId(0x800)] bool IsRecorderSupported(IDiscRecorder2 Recorder); // Determines if the current media in a supported recorder object supports the given format [DispId(0x801)] bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); // Determines if the current media is reported as physically blank by the drive [DispId(0x700)] bool MediaPhysicallyBlank { get; } // Attempts to determine if the media is blank using heuristics (mainly for DVD+RW and DVD-RAM media) [DispId(0x701)] bool MediaHeuristicallyBlank { get; } // Supported media types [DispId(0x702)] object[] SupportedMediaTypes { get; } // // IDiscFormat2Erase // // Sets the recorder object to use for an erase operation [DispId(0x100)] IDiscRecorder2 Recorder { set; get; } // [DispId(0x101)] bool FullErase { set; get; } // Get the current physical media type [DispId(0x102)] IMAPI_MEDIA_PHYSICAL_TYPE CurrentPhysicalMediaType { get; } // The friendly name of the client (used to determine recorder reservation conflicts) [DispId(0x103)] string ClientName { set; get; } // Erases the media in the active disc recorder [DispId(0x201)] void EraseMedia(); } /// <summary> /// CD Disc-At-Once RAW Writer /// </summary> [ComImport, Guid("27354155-8F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IDiscFormat2RawCD { // // IDiscFormat2 // // Determines if the recorder object supports the given format [DispId(0x800)] bool IsRecorderSupported(IDiscRecorder2 Recorder); // Determines if the current media in a supported recorder object supports the given format [DispId(0x801)] bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); // Determines if the current media is reported as physically blank by the drive [DispId(0x700)] bool MediaPhysicallyBlank { get; } // Attempts to determine if the media is blank using heuristics (mainly for DVD+RW and DVD-RAM media) [DispId(0x701)] bool MediaHeuristicallyBlank { get; } // Supported media types [DispId(0x702)] object[] SupportedMediaTypes { get; } // // IDiscFormat2RawCD // // Locks the current media for use by this writer [DispId(0x200)] void PrepareMedia(); // Writes a RAW image that starts at 95:00:00 (MSF) to the currently inserted blank CD media [DispId(0x201)] void WriteMedia(IStream data); // Writes a RAW image to the currently inserted blank CD media. A stream starting at 95:00:00 // (-5 minutes) would use 5*60*75 + 150 sectors pregap == 22,650 for the number of sectors [DispId(0x202)] void WriteMedia2(IStream data, int streamLeadInSectors); // Cancels the current write. [DispId(0x203)] void CancelWrite(); // Finishes use of the locked media. [DispId(0x204)] void ReleaseMedia(); // Sets the write speed (in sectors per second) of the attached disc recorder [DispId(0x205)] void SetWriteSpeed(int RequestedSectorsPerSecond, bool RotationTypeIsPureCAV); // The disc recorder to use [DispId(0x100)] IDiscRecorder2 Recorder { set; get; } // Buffer Underrun Free recording should be disabled [DispId(0x102)] bool BufferUnderrunFreeDisabled { set; get; } // The first sector of the next session. May be negative for blank media [DispId(0x103)] int StartOfNextSession { get; } // The last possible start for the leadout area. Can be used to // calculate available space on media [DispId(260)] int LastPossibleStartOfLeadout { get; } // Get the current physical media type [DispId(0x105)] IMAPI_MEDIA_PHYSICAL_TYPE CurrentPhysicalMediaType { get; } // Supported data sector types for the current recorder [DispId(0x108)] object[] SupportedSectorTypes { get; } // Requested data sector to use during write of the stream [DispId(0x109)] IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE RequestedSectorType { set; get; } // The friendly name of the client (used to determine recorder reservation conflicts). [DispId(0x10a)] string ClientName { set; get; } // The last requested write speed [DispId(0x10b)] int RequestedWriteSpeed { get; } // The last requested rotation type. [DispId(0x10c)] bool RequestedRotationTypeIsPureCAV { get; } // The drive's current write speed. [DispId(0x10d)] int CurrentWriteSpeed { get; } // The drive's current rotation type [DispId(270)] bool CurrentRotationTypeIsPureCAV { get; } // Gets an array of the write speeds supported for the attached disc // recorder and current media [DispId(0x10f)] object[] SupportedWriteSpeeds { get; } // Gets an array of the detailed write configurations supported for the // attached disc recorder and current media [DispId(0x110)] object[] SupportedWriteSpeedDescriptors { get; } } /// <summary> /// CD Disc-At-Once RAW Writer Event Arguments /// </summary> [ComImport, Guid("27354143-7F64-5B0F-8F00-5D77AFBE261E"), TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IDiscFormat2RawCDEventArgs { // // IWriteEngine2EventArgs // // The starting logical block address for the current write operation. [DispId(0x100)] int StartLba { get; } // The number of sectors being written for the current write operation. [DispId(0x101)] int SectorCount { get; } // The last logical block address of data read for the current write operation. [DispId(0x102)] int LastReadLba { get; } // The last logical block address of data written for the current write operation [DispId(0x103)] int LastWrittenLba { get; } // The total bytes available in the system's cache buffer [DispId(0x106)] int TotalSystemBuffer { get; } // The used bytes in the system's cache buffer [DispId(0x107)] int UsedSystemBuffer { get; } // The free bytes in the system's cache buffer [DispId(0x108)] int FreeSystemBuffer { get; } // // IDiscFormat2RawCDEventArgs // // The current write action [DispId(0x301)] IMAPI_FORMAT2_RAW_CD_WRITE_ACTION CurrentAction { get; } // The elapsed time for the current track write or media finishing operation [DispId(770)] int ElapsedTime { get; } // The estimated time remaining for the current track write or media finishing operation [DispId(0x303)] int RemainingTime { get; } } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [ComImport] [Guid("27354154-8F64-5B0F-8F00-5D77AFBE261E")] public interface IDiscFormat2TrackAtOnce { // // IDiscFormat2 // // Determines if the recorder object supports the given format [DispId(0x800)] bool IsRecorderSupported(IDiscRecorder2 Recorder); // Determines if the current media in a supported recorder object supports the given format [DispId(0x801)] bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); // Determines if the current media is reported as physically blank by the drive [DispId(0x700)] bool MediaPhysicallyBlank { get; } // Attempts to determine if the media is blank using heuristics (mainly for DVD+RW and DVD-RAM media) [DispId(0x701)] bool MediaHeuristicallyBlank { get; } // Supported media types [DispId(0x702)] object[] SupportedMediaTypes { get; } // // IDiscFormat2TrackAtOnce // // Locks the current media for use by this writer. [DispId(0x200)] void PrepareMedia(); // Immediately writes a new audio track to the locked media [DispId(0x201)] void AddAudioTrack(IStream data); // Cancels the current addition of a track [DispId(0x202)] void CancelAddTrack(); // Finishes use of the locked media [DispId(0x203)] void ReleaseMedia(); // Sets the write speed (in sectors per second) of the attached disc recorder [DispId(0x204)] void SetWriteSpeed(int RequestedSectorsPerSecond, bool RotationTypeIsPureCAV); // The disc recorder to use [DispId(0x100)] IDiscRecorder2 Recorder { set; get; } // Buffer Underrun Free recording should be disabled [DispId(0x102)] bool BufferUnderrunFreeDisabled { set; get; } // Number of tracks already written to the locked media [DispId(0x103)] int NumberOfExistingTracks { get; } // Total sectors available on locked media if writing one continuous audio track [DispId(260)] int TotalSectorsOnMedia { get; } // Number of sectors available for adding a new track to the media [DispId(0x105)] int FreeSectorsOnMedia { get; } // Number of sectors used on the locked media, including overhead (space between tracks) [DispId(0x106)] int UsedSectorsOnMedia { get; } // Set the media to be left 'open' after writing, to allow multisession discs [DispId(0x107)] bool DoNotFinalizeMedia { set; get; } // Get the current physical media type [DispId(0x10a)] object[] ExpectedTableOfContents { get; } // Get the current physical media type [DispId(0x10b)] IMAPI_MEDIA_PHYSICAL_TYPE CurrentPhysicalMediaType { get; } // The friendly name of the client (used to determine recorder reservation conflicts) [DispId(270)] string ClientName { set; get; } // The last requested write speed [DispId(0x10f)] int RequestedWriteSpeed { get; } // The last requested rotation type. [DispId(0x110)] bool RequestedRotationTypeIsPureCAV { get; } // The drive's current write speed. [DispId(0x111)] int CurrentWriteSpeed { get; } // The drive's current rotation type. [DispId(0x112)] bool CurrentRotationTypeIsPureCAV { get; } // Gets an array of the write speeds supported for the attached disc recorder and current media [DispId(0x113)] object[] SupportedWriteSpeeds { get; } // Gets an array of the detailed write configurations supported for the attached disc recorder and current media [DispId(0x114)] object[] SupportedWriteSpeedDescriptors { get; } } /// <summary> /// CD Track-at-once Audio Writer Event Arguments /// </summary> [ComImport] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("27354140-7F64-5B0F-8F00-5D77AFBE261E")] public interface IDiscFormat2TrackAtOnceEventArgs { // // IWriteEngine2EventArgs // // The starting logical block address for the current write operation. [DispId(0x100)] int StartLba { get; } // The number of sectors being written for the current write operation. [DispId(0x101)] int SectorCount { get; } // The last logical block address of data read for the current write operation. [DispId(0x102)] int LastReadLba { get; } // The last logical block address of data written for the current write operation [DispId(0x103)] int LastWrittenLba { get; } // The total bytes available in the system's cache buffer [DispId(0x106)] int TotalSystemBuffer { get; } // The used bytes in the system's cache buffer [DispId(0x107)] int UsedSystemBuffer { get; } // The free bytes in the system's cache buffer [DispId(0x108)] int FreeSystemBuffer { get; } // // IDiscFormat2TrackAtOnceEventArgs // // The total elapsed time for the current write operation [DispId(0x300)] int CurrentTrackNumber { get; } // The current write action [DispId(0x301)] IMAPI_FORMAT2_TAO_WRITE_ACTION CurrentAction { get; } // The elapsed time for the current track write or media finishing operation [DispId(770)] int ElapsedTime { get; } // The estimated time remaining for the current track write or media finishing operation [DispId(0x303)] int RemainingTime { get; } } /// <summary> /// IDiscMaster2 is used to get an enumerator for the set of CD/DVD (optical) devices on the system /// </summary> [ComImport] [Guid("27354130-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IDiscMaster2 { // Enumerates the list of CD/DVD devices on the system (VT_BSTR) [DispId(-4), TypeLibFunc((short)0x41)] IEnumerator GetEnumerator(); // Gets a single recorder's ID (ZERO BASED INDEX) [DispId(0)] string this[int index] { get; } // The current number of recorders in the system. [DispId(1)] int Count { get; } // Whether IMAPI is running in an environment with optical devices and permission to access them. [DispId(2)] bool IsSupportedEnvironment { get; } } /// <summary> /// Represents a single CD/DVD type device, and enables many common operations via a simplified API. /// </summary> [ComImport] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("27354133-7F64-5B0F-8F00-5D77AFBE261E")] public interface IDiscRecorder2 { // Ejects the media (if any) and opens the tray [DispId(0x100)] void EjectMedia(); // Close the media tray and load any media in the tray. [DispId(0x101)] void CloseTray(); // Acquires exclusive access to device. May be called multiple times. [DispId(0x102)] void AcquireExclusiveAccess(bool force, string clientName); // Releases exclusive access to device. Call once per AcquireExclusiveAccess(). [DispId(0x103)] void ReleaseExclusiveAccess(); // Disables Media Change Notification (MCN). [DispId(260)] void DisableMcn(); // Re-enables Media Change Notification after a call to DisableMcn() [DispId(0x105)] void EnableMcn(); // Initialize the recorder, opening a handle to the specified recorder. [DispId(0x106)] void InitializeDiscRecorder(string recorderUniqueId); // The unique ID used to initialize the recorder. [DispId(0)] string ActiveDiscRecorder { get; } // The vendor ID in the device's INQUIRY data. [DispId(0x201)] string VendorId { get; } // The Product ID in the device's INQUIRY data. [DispId(0x202)] string ProductId { get; } // The Product Revision in the device's INQUIRY data. [DispId(0x203)] string ProductRevision { get; } // Get the unique volume name (this is not a drive letter). [DispId(0x204)] string VolumeName { get; } // Drive letters and NTFS mount points to access the recorder. [DispId(0x205)] object[] VolumePathNames { [DispId(0x205)] get; } // One of the volume names associated with the recorder. [DispId(0x206)] bool DeviceCanLoadMedia { [DispId(0x206)] get; } // Gets the legacy 'device number' associated with the recorder. This number is not guaranteed to be static. [DispId(0x207)] int LegacyDeviceNumber { [DispId(0x207)] get; } // Gets a list of all feature pages supported by the device [DispId(520)] object[] SupportedFeaturePages { [DispId(520)] get; } // Gets a list of all feature pages with 'current' bit set to true [DispId(0x209)] object[] CurrentFeaturePages { [DispId(0x209)] get; } // Gets a list of all profiles supported by the device [DispId(0x20a)] object[] SupportedProfiles { [DispId(0x20a)] get; } // Gets a list of all profiles with 'currentP' bit set to true [DispId(0x20b)] object[] CurrentProfiles { [DispId(0x20b)] get; } // Gets a list of all MODE PAGES supported by the device [DispId(0x20c)] object[] SupportedModePages { [DispId(0x20c)] get; } // Queries the device to determine who, if anyone, has acquired exclusive access [DispId(0x20d)] string ExclusiveAccessOwner { [DispId(0x20d)] get; } } /// <summary> /// Represents a single CD/DVD type device, enabling additional commands requiring advanced marshalling code /// </summary> [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("27354132-7F64-5B0F-8F00-5D77AFBE261E")] public interface IDiscRecorder2Ex { // // Send a command to the device that does not transfer any data // void SendCommandNoData( [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] byte[] Cdb, uint CdbSize, [MarshalAs(UnmanagedType.LPArray, SizeConst = 18)] byte[] SenseBuffer, uint Timeout); // Send a command to the device that requires data sent to the device void SendCommandSendDataToDevice( [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] byte[] Cdb, uint CdbSize, [MarshalAs(UnmanagedType.LPArray, SizeConst = 18)] byte[] SenseBuffer, uint Timeout, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 5)] byte[] Buffer, uint BufferSize); // Send a command to the device that requests data from the device void SendCommandGetDataFromDevice( [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] byte[] Cdb, uint CdbSize, [MarshalAs(UnmanagedType.LPArray, SizeConst = 18)] byte[] SenseBuffer, uint Timeout, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 5)] byte[] Buffer, uint BufferSize, out uint BufferFetched); // Read a DVD Structure from the media void ReadDvdStructure(uint format, uint address, uint layer, uint agid, out IntPtr data, out uint Count); // Sends a DVD structure to the media void SendDvdStructure(uint format, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] data, uint Count); // Get the full adapter descriptor (via IOCTL_STORAGE_QUERY_PROPERTY). void GetAdapterDescriptor(out IntPtr data, ref uint byteSize); // Get the full device descriptor (via IOCTL_STORAGE_QUERY_PROPERTY). void GetDeviceDescriptor(out IntPtr data, ref uint byteSize); // Gets data from a READ_DISC_INFORMATION command void GetDiscInformation(out IntPtr discInformation, ref uint byteSize); // Gets data from a READ_TRACK_INFORMATION command void GetTrackInformation(uint address, IMAPI_READ_TRACK_ADDRESS_TYPE addressType, out IntPtr trackInformation, ref uint byteSize); // Gets a feature's data from a GET_CONFIGURATION command void GetFeaturePage(IMAPI_FEATURE_PAGE_TYPE requestedFeature, sbyte currentFeatureOnly, out IntPtr featureData, ref uint byteSize); // Gets data from a MODE_SENSE10 command void GetModePage(IMAPI_MODE_PAGE_TYPE requestedModePage, IMAPI_MODE_PAGE_REQUEST_TYPE requestType, out IntPtr modePageData, ref uint byteSize); // Sets mode page data using MODE_SELECT10 command void SetModePage(IMAPI_MODE_PAGE_REQUEST_TYPE requestType, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] data, uint byteSize); // Gets a list of all feature pages supported by the device void GetSupportedFeaturePages(sbyte currentFeatureOnly, out IntPtr featureData, ref uint byteSize); // Gets a list of all PROFILES supported by the device void GetSupportedProfiles(sbyte currentOnly, out IntPtr profileTypes, out uint validProfiles); // Gets a list of all MODE PAGES supported by the device void GetSupportedModePages(IMAPI_MODE_PAGE_REQUEST_TYPE requestType, out IntPtr modePageTypes, out uint validPages); // The byte alignment requirement mask for this device. uint GetByteAlignmentMask(); // The maximum non-page-aligned transfer size for this device. uint GetMaximumNonPageAlignedTransferSize(); // The maximum non-page-aligned transfer size for this device. uint GetMaximumPageAlignedTransferSize(); } /// <summary> /// FileSystemImage item enumerator /// </summary> [Guid("2C941FDA-975B-59BE-A960-9A2A262853A5")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IEnumFsiItems { // Note: not listed in COM Interface, but it is in Interop.cs void Next(uint celt, out IFsiItem rgelt, out uint pceltFetched); // Remoting support for Next (allow NULL pointer for item count when requesting single item) void RemoteNext(uint celt, out IFsiItem rgelt, out uint pceltFetched); // Skip items in the enumeration void Skip(uint celt); // Reset the enumerator void Reset(); // Make a copy of the enumerator void Clone(out IEnumFsiItems ppEnum); } /// <summary> /// FileSystemImageResult progress item enumerator /// </summary> [Guid("2C941FD6-975B-59BE-A960-9A2A262853A5")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IEnumProgressItems { // Not in COM, but is in Interop.cs void Next(uint celt, out IProgressItem rgelt, out uint pceltFetched); // Remoting support for Next (allow NULL pointer for item count when requesting single item) void RemoteNext(uint celt, out IProgressItem rgelt, out uint pceltFetched); // Skip items in the enumeration void Skip(uint celt); // Reset the enumerator void Reset(); // Make a copy of the enumerator void Clone(out IEnumProgressItems ppEnum); } /// <summary> /// File system image /// </summary> [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FE1-975B-59BE-A960-9A2A262853A5")] public interface IFileSystemImage { // Root directory item [DispId(0)] IFsiDirectoryItem Root { get; } // Disc start block for the image [DispId(1)] int SessionStartBlock { get; set; } // Maximum number of blocks available for the image [DispId(2)] int FreeMediaBlocks { get; set; } // Set maximum number of blocks available based on the recorder // supported discs. 0 for unknown maximum may be set. [DispId(0x24)] void SetMaxMediaBlocksFromDevice(IDiscRecorder2 discRecorder); // Number of blocks in use [DispId(3)] int UsedBlocks { get; } // Volume name [DispId(4)] string VolumeName { get; set; } // Imported Volume name [DispId(5)] string ImportedVolumeName { get; } // Boot image and boot options [DispId(6)] IBootOptions BootImageOptions { get; set; } // Number of files in the image [DispId(7)] int FileCount { get; } // Number of directories in the image [DispId(8)] int DirectoryCount { get; } // Temp directory for stash files [DispId(9)] string WorkingDirectory { get; set; } // Change point identifier [DispId(10)] int ChangePoint { get; } // Strict file system compliance option [DispId(11)] bool StrictFileSystemCompliance { get; set; } // If true, indicates restricted character set is being used for file and directory names [DispId(12)] bool UseRestrictedCharacterSet { get; set; } // File systems to create [DispId(13)] FsiFileSystems FileSystemsToCreate { get; set; } // File systems supported [DispId(14)] FsiFileSystems FileSystemsSupported { get; } // UDF revision [DispId(0x25)] int UDFRevision { set; get; } // UDF revision(s) supported [DispId(0x1f)] object[] UDFRevisionsSupported { get; } // Select filesystem types and image size based on the current media [DispId(0x20)] void ChooseImageDefaults(IDiscRecorder2 discRecorder); // Select filesystem types and image size based on the media type [DispId(0x21)] void ChooseImageDefaultsForMediaType(IMAPI_MEDIA_PHYSICAL_TYPE value); // ISO compatibility level to create [DispId(0x22)] int ISO9660InterchangeLevel { set; get; } // ISO compatibility level(s) supported [DispId(0x26)] object[] ISO9660InterchangeLevelsSupported { get; } // Create result image stream [DispId(15)] IFileSystemImageResult CreateResultImage(); // Check for existance an item in the file system [DispId(0x10)] FsiItemType Exists(string FullPath); // Return a string useful for identifying the current disc [DispId(0x12)] string CalculateDiscIdentifier(); // Identify file systems on a given disc [DispId(0x13)] FsiFileSystems IdentifyFileSystemsOnDisc(IDiscRecorder2 discRecorder); // Identify which of the specified file systems would be imported by default [DispId(20)] FsiFileSystems GetDefaultFileSystemForImport(FsiFileSystems fileSystems); // Import the default file system on the current disc [DispId(0x15)] FsiFileSystems ImportFileSystem(); // Import a specific file system on the current disc [DispId(0x16)] void ImportSpecificFileSystem(FsiFileSystems fileSystemToUse); // Roll back to the specified change point [DispId(0x17)] void RollbackToChangePoint(int ChangePoint); // Lock in changes [DispId(0x18)] void LockInChangePoint(); // Create a directory item with the specified name [DispId(0x19)] IFsiDirectoryItem CreateDirectoryItem(string Name); // Create a file item with the specified name [DispId(0x1a)] IFsiFileItem CreateFileItem(string Name); // Volume Name UDF [DispId(0x1b)] string VolumeNameUDF { get; } // Volume name Joliet [DispId(0x1c)] string VolumeNameJoliet { get; } // Volume name ISO 9660 [DispId(0x1d)] string VolumeNameISO9660 { get; } // Indicates whether or not IMAPI should stage the filesystem before the burn [DispId(30)] bool StageFiles { get; set; } // Get array of available multi-session interfaces. [DispId(40)] object[] MultisessionInterfaces { get; set; } } /// <summary> /// File system image (rev.2) /// </summary> [ComImport] [Guid("D7644B2C-1537-4767-B62F-F1387B02DDFD")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IFileSystemImage2 { // // IFileSystemImage // // Root directory item [DispId(0)] IFsiDirectoryItem Root { get; } // Disc start block for the image [DispId(1)] int SessionStartBlock { get; set; } // Maximum number of blocks available for the image [DispId(2)] int FreeMediaBlocks { get; set; } // Set maximum number of blocks available based on the recorder // supported discs. 0 for unknown maximum may be set. [DispId(0x24)] void SetMaxMediaBlocksFromDevice(IDiscRecorder2 discRecorder); // Number of blocks in use [DispId(3)] int UsedBlocks { get; } // Volume name [DispId(4)] string VolumeName { get; set; } // Imported Volume name [DispId(5)] string ImportedVolumeName { get; } // Boot image and boot options [DispId(6)] IBootOptions BootImageOptions { get; set; } // Number of files in the image [DispId(7)] int FileCount { get; } // Number of directories in the image [DispId(8)] int DirectoryCount { get; } // Temp directory for stash files [DispId(9)] string WorkingDirectory { get; set; } // Change point identifier [DispId(10)] int ChangePoint { get; } // Strict file system compliance option [DispId(11)] bool StrictFileSystemCompliance { get; set; } // If true, indicates restricted character set is being used for file and directory names [DispId(12)] bool UseRestrictedCharacterSet { get; set; } // File systems to create [DispId(13)] FsiFileSystems FileSystemsToCreate { get; set; } // File systems supported [DispId(14)] FsiFileSystems FileSystemsSupported { get; } // UDF revision [DispId(0x25)] int UDFRevision { set; get; } // UDF revision(s) supported [DispId(0x1f)] object[] UDFRevisionsSupported { get; } // Select filesystem types and image size based on the current media [DispId(0x20)] void ChooseImageDefaults(IDiscRecorder2 discRecorder); // Select filesystem types and image size based on the media type [DispId(0x21)] void ChooseImageDefaultsForMediaType(IMAPI_MEDIA_PHYSICAL_TYPE value); // ISO compatibility level to create [DispId(0x22)] int ISO9660InterchangeLevel { set; get; } // ISO compatibility level(s) supported [DispId(0x26)] object[] ISO9660InterchangeLevelsSupported { get; } // Create result image stream [DispId(15)] IFileSystemImageResult CreateResultImage(); // Check for existance an item in the file system [DispId(0x10)] FsiItemType Exists(string FullPath); // Return a string useful for identifying the current disc [DispId(0x12)] string CalculateDiscIdentifier(); // Identify file systems on a given disc [DispId(0x13)] FsiFileSystems IdentifyFileSystemsOnDisc(IDiscRecorder2 discRecorder); // Identify which of the specified file systems would be imported by default [DispId(20)] FsiFileSystems GetDefaultFileSystemForImport(FsiFileSystems fileSystems); // Import the default file system on the current disc [DispId(0x15)] FsiFileSystems ImportFileSystem(); // Import a specific file system on the current disc [DispId(0x16)] void ImportSpecificFileSystem(FsiFileSystems fileSystemToUse); // Roll back to the specified change point [DispId(0x17)] void RollbackToChangePoint(int ChangePoint); // Lock in changes [DispId(0x18)] void LockInChangePoint(); // Create a directory item with the specified name [DispId(0x19)] IFsiDirectoryItem CreateDirectoryItem(string Name); // Create a file item with the specified name [DispId(0x1a)] IFsiFileItem CreateFileItem(string Name); // Volume Name UDF [DispId(0x1b)] string VolumeNameUDF { get; } // Volume name Joliet [DispId(0x1c)] string VolumeNameJoliet { get; } // Volume name ISO 9660 [DispId(0x1d)] string VolumeNameISO9660 { get; } // Indicates whether or not IMAPI should stage the filesystem before the burn [DispId(30)] bool StageFiles { get; set; } // Get array of available multi-session interfaces. [DispId(40)] object[] MultisessionInterfaces { get; set; } // // IFileSystemImage2 // // Get boot options array for supporting multi-boot [DispId(60)] object[] BootImageOptionsArray { get; set; } } /// <summary> /// File system image (rev.3)"), /// </summary> [ComImport] [Guid("7CFF842C-7E97-4807-8304-910DD8F7C051")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IFileSystemImage3 { // // IFileSystemImage // // Root directory item [DispId(0)] IFsiDirectoryItem Root { get; } // Disc start block for the image [DispId(1)] int SessionStartBlock { get; set; } // Maximum number of blocks available for the image [DispId(2)] int FreeMediaBlocks { get; set; } // Set maximum number of blocks available based on the recorder // supported discs. 0 for unknown maximum may be set. [DispId(0x24)] void SetMaxMediaBlocksFromDevice(IDiscRecorder2 discRecorder); // Number of blocks in use [DispId(3)] int UsedBlocks { get; } // Volume name [DispId(4)] string VolumeName { get; set; } // Imported Volume name [DispId(5)] string ImportedVolumeName { get; } // Boot image and boot options [DispId(6)] IBootOptions BootImageOptions { get; set; } // Number of files in the image [DispId(7)] int FileCount { get; } // Number of directories in the image [DispId(8)] int DirectoryCount { get; } // Temp directory for stash files [DispId(9)] string WorkingDirectory { get; set; } // Change point identifier [DispId(10)] int ChangePoint { get; } // Strict file system compliance option [DispId(11)] bool StrictFileSystemCompliance { get; set; } // If true, indicates restricted character set is being used for file and directory names [DispId(12)] bool UseRestrictedCharacterSet { get; set; } // File systems to create [DispId(13)] FsiFileSystems FileSystemsToCreate { get; set; } // File systems supported [DispId(14)] FsiFileSystems FileSystemsSupported { get; } // UDF revision [DispId(0x25)] int UDFRevision { set; get; } // UDF revision(s) supported [DispId(0x1f)] object[] UDFRevisionsSupported { get; } // Select filesystem types and image size based on the current media [DispId(0x20)] void ChooseImageDefaults(IDiscRecorder2 discRecorder); // Select filesystem types and image size based on the media type [DispId(0x21)] void ChooseImageDefaultsForMediaType(IMAPI_MEDIA_PHYSICAL_TYPE value); // ISO compatibility level to create [DispId(0x22)] int ISO9660InterchangeLevel { set; get; } // ISO compatibility level(s) supported [DispId(0x26)] object[] ISO9660InterchangeLevelsSupported { get; } // Create result image stream [DispId(15)] IFileSystemImageResult CreateResultImage(); // Check for existance an item in the file system [DispId(0x10)] FsiItemType Exists(string FullPath); // Return a string useful for identifying the current disc [DispId(0x12)] string CalculateDiscIdentifier(); // Identify file systems on a given disc [DispId(0x13)] FsiFileSystems IdentifyFileSystemsOnDisc(IDiscRecorder2 discRecorder); // Identify which of the specified file systems would be imported by default [DispId(20)] FsiFileSystems GetDefaultFileSystemForImport(FsiFileSystems fileSystems); // Import the default file system on the current disc [DispId(0x15)] FsiFileSystems ImportFileSystem(); // Import a specific file system on the current disc [DispId(0x16)] void ImportSpecificFileSystem(FsiFileSystems fileSystemToUse); // Roll back to the specified change point [DispId(0x17)] void RollbackToChangePoint(int ChangePoint); // Lock in changes [DispId(0x18)] void LockInChangePoint(); // Create a directory item with the specified name [DispId(0x19)] IFsiDirectoryItem CreateDirectoryItem(string Name); // Create a file item with the specified name [DispId(0x1a)] IFsiFileItem CreateFileItem(string Name); // Volume Name UDF [DispId(0x1b)] string VolumeNameUDF { get; } // Volume name Joliet [DispId(0x1c)] string VolumeNameJoliet { get; } // Volume name ISO 9660 [DispId(0x1d)] string VolumeNameISO9660 { get; } // Indicates whether or not IMAPI should stage the filesystem before the burn [DispId(30)] bool StageFiles { get; set; } // Get array of available multi-session interfaces. [DispId(40)] object[] MultisessionInterfaces { get; set; } // // IFileSystemImage2 // // Get boot options array for supporting multi-boot [DispId(60)] object[] BootImageOptionsArray { get; set; } // // IFileSystemImage3 // // If true, indicates that UDF Metadata and Metadata Mirror files are truly redundant, // i.e. reference different extents [DispId(0x3d)] bool CreateRedundantUdfMetadataFiles { get; set; } // Probe if a specific file system on the disc is appendable through IMAPI [DispId(70)] bool ProbeSpecificFileSystem(FsiFileSystems fileSystemToProbe); } /// <summary> /// FileSystemImage result stream /// </summary> [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FD8-975B-59BE-A960-9A2A262853A5")] public interface IFileSystemImageResult { // Image stream [DispId(1)] IStream ImageStream { get; } // Progress item block mapping collection [DispId(2)] IProgressItems ProgressItems { get; } // Number of blocks in the result image [DispId(3)] int TotalBlocks { get; } // Number of bytes in a block [DispId(4)] int BlockSize { get; } // Disc Identifier (for identifing imported session of multi-session disc) [DispId(5)] string DiscId { get; } } [Guid("2C941FDC-975B-59BE-A960-9A2A262853A5")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IFsiDirectoryItem { // // IFsiItem // // Item name [DispId(11)] string Name { get; } // Full path [DispId(12)] string FullPath { get; } // Date and time of creation [DispId(13)] DateTime CreationTime { get; set; } // Date and time of last access [DispId(14)] DateTime LastAccessedTime { get; set; } // Date and time of last modification [DispId(15)] DateTime LastModifiedTime { get; set; } // Flag indicating if item is hidden [DispId(0x10)] bool IsHidden { get; set; } // Name of item in the specified file system [DispId(0x11)] string FileSystemName(FsiFileSystems fileSystem); // Name of item in the specified file system [DispId(0x12)] string FileSystemPath(FsiFileSystems fileSystem); // // IFsiDirectoryItem // // Get an enumerator for the collection [TypeLibFunc((short)0x41), DispId(-4)] IEnumerator GetEnumerator(); // Get the item with the given relative path [DispId(0)] IFsiItem this[string path] { get; } // Number of items in the collection [DispId(1)] int Count { get; } // Get a non-variant enumerator [DispId(2)] IEnumFsiItems EnumFsiItems { get; } // Add a directory with the specified relative path [DispId(30)] void AddDirectory(string path); // Add a file with the specified relative path and data [DispId(0x1f)] void AddFile(string path, IStream fileData); // Add files and directories from the specified source directory [DispId(0x20)] void AddTree(string sourceDirectory, bool includeBaseDirectory); // Add an item [DispId(0x21)] void Add(IFsiItem Item); // Remove an item with the specified relative path [DispId(0x22)] void Remove(string path); // Remove a subtree with the specified relative path [DispId(0x23)] void RemoveTree(string path); } /// <summary> /// FileSystemImage directory item (rev.2) /// </summary> [ComImport] [Guid("F7FB4B9B-6D96-4D7B-9115-201B144811EF")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IFsiDirectoryItem2 : IFsiDirectoryItem { // Add files and directories from the specified source directory including named streams [DispId(0x24)] void AddTreeWithNamedStreams(string sourceDirectory, bool includeBaseDirectory); } /// <summary> /// FileSystemImage file item /// </summary> [Guid("2C941FDB-975B-59BE-A960-9A2A262853A5")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IFsiFileItem { // // IFsiItem // // Item name [DispId(11)] string Name { get; } // Full path [DispId(12)] string FullPath { get; } // Date and time of creation [DispId(13)] DateTime CreationTime { get; set; } // Date and time of last access [DispId(14)] DateTime LastAccessedTime { get; set; } // Date and time of last modification [DispId(15)] DateTime LastModifiedTime { get; set; } // Flag indicating if item is hidden [DispId(0x10)] bool IsHidden { get; set; } // Name of item in the specified file system [DispId(0x11)] string FileSystemName(FsiFileSystems fileSystem); // Name of item in the specified file system [DispId(0x12)] string FileSystemPath(FsiFileSystems fileSystem); // // IFsiFileItem // // Data byte count [DispId(0x29)] long DataSize { get; } // Lower 32 bits of the data byte count [DispId(0x2a)] int DataSize32BitLow { get; } // Upper 32 bits of the data byte count [DispId(0x2b)] int DataSize32BitHigh { get; } // Data stream [DispId(0x2c)] IStream Data { get; set; } } /// <summary> /// FileSystemImage file item (rev.2) /// </summary> [ComImport] [Guid("199D0C19-11E1-40EB-8EC2-C8C822A07792")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IFsiFileItem2 { // // IFsiItem // // Item name [DispId(11)] string Name { get; } // Full path [DispId(12)] string FullPath { get; } // Date and time of creation [DispId(13)] DateTime CreationTime { get; set; } // Date and time of last access [DispId(14)] DateTime LastAccessedTime { get; set; } // Date and time of last modification [DispId(15)] DateTime LastModifiedTime { get; set; } // Flag indicating if item is hidden [DispId(0x10)] bool IsHidden { get; set; } // Name of item in the specified file system [DispId(0x11)] string FileSystemName(FsiFileSystems fileSystem); // Name of item in the specified file system [DispId(0x12)] string FileSystemPath(FsiFileSystems fileSystem); // // IFsiFileItem // // Data byte count [DispId(0x29)] long DataSize { get; } // Lower 32 bits of the data byte count [DispId(0x2a)] int DataSize32BitLow { get; } // Upper 32 bits of the data byte count [DispId(0x2b)] int DataSize32BitHigh { get; } // Data stream [DispId(0x2c)] IStream Data { get; set; } // // IFsiFileItem2 // // Get the list of the named streams of the file [DispId(0x2d)] FsiNamedStreams FsiNamedStreams { get; } // Flag indicating if file item is a named stream of a file [DispId(0x2e)] bool IsNamedStream { get; } // Add a new named stream to the collection [DispId(0x2f)] void AddStream(string Name, FsiStream streamData); // Remove a specific named stream from the collection [DispId(0x30)] void RemoveStream(string Name); // Flag indicating if file is Real-Time [DispId(0x31)] bool IsRealTime { get; set; } } /// <summary> /// FileSystemImage item /// </summary> [Guid("2C941FD9-975B-59BE-A960-9A2A262853A5")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IFsiItem { // Item name [DispId(11)] string Name { get; } // Full path [DispId(12)] string FullPath { get; } // Date and time of creation [DispId(13)] DateTime CreationTime { get; set; } // Date and time of last access [DispId(14)] DateTime LastAccessedTime { get; set; } // Date and time of last modification [DispId(15)] DateTime LastModifiedTime { get; set; } // Flag indicating if item is hidden [DispId(0x10)] bool IsHidden { get; set; } // Name of item in the specified file system [DispId(0x11)] string FileSystemName(FsiFileSystems fileSystem); // Name of item in the specified file system [DispId(0x12)] string FileSystemPath(FsiFileSystems fileSystem); } /// <summary> /// Named stream collection /// </summary> [ComImport] [Guid("ED79BA56-5294-4250-8D46-F9AECEE23459")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IFsiNamedStreams : IEnumerable { // Get a named stream from the collection [DispId(0)] FsiFileItem this[int Index] { get; } // Number of named streams in the collection [DispId(0x51)] int Count { [DispId(0x51)] get; } // Get a non-variant enumerator for the named stream collection [DispId(0x52)] EnumFsiItems EnumNamedStreams { get; } } /// <summary> /// ISO Image Manager: Helper object for ISO image file manipulation /// </summary> [ComImport] [TypeLibType(TypeLibTypeFlags.FDispatchable)] [Guid("6CA38BE5-FBBB-4800-95A1-A438865EB0D4")] public interface IIsoImageManager { // Path to the ISO image file [DispId(0x100)] string path { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } // Stream from the ISO image [DispId(0x101)] FsiStream Stream { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } // Set path to the ISO image file, overwrites stream [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetPath(string Val); // Set stream from the ISO image, overwrites path [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void SetStream([In, MarshalAs(UnmanagedType.Interface)] FsiStream Data); // Validate if the ISO image file is a valid file [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Validate(); } [ComImport] [Guid("27354150-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FDispatchable)] public interface IMultisession { // Is it possible to write this multi-session type on the current media in its present state [DispId(0x100)] bool IsSupportedOnCurrentMediaState { get; } // Is this multi-session type the one to use on current media [DispId(0x101)] bool InUse { set; get; } // The disc recorder to use to import previous session(s) [DispId(0x102)] MsftDiscRecorder2 ImportRecorder { get; } } [ComImport] [Guid("27354151-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FDispatchable)] public interface IMultisessionSequential { // // IMultisession // // Is it possible to write this multi-session type on the current media in its present state [DispId(0x100)] bool IsSupportedOnCurrentMediaState { get; } // Is this multi-session type the one to use on current media [DispId(0x101)] bool InUse { set; get; } // The disc recorder to use to import previous session(s) [DispId(0x102)] MsftDiscRecorder2 ImportRecorder { get; } // // IMultisessionSequential // // Is this the first data session on the media? [DispId(0x200)] bool IsFirstDataSession { get; } // The first sector in the previous session on the media. [DispId(0x201)] int StartAddressOfPreviousSession { get; } // The last sector in the previous session on the media [DispId(0x202)] int LastWrittenAddressOfPreviousSession { get; } // Next writable address on the media (also used sectors). [DispId(0x203)] int NextWritableAddress { get; } // Free sectors available on the media [DispId(0x204)] int FreeSectorsOnMedia { get; } } /// <summary> /// FileSystemImageResult progress item /// </summary> [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FD5-975B-59BE-A960-9A2A262853A5")] public interface IProgressItem { // Progress item description [DispId(1)] string Description { get; } // First block in the range of blocks used by the progress item [DispId(2)] uint FirstBlock { get; } // Last block in the range of blocks used by the progress item [DispId(3)] uint LastBlock { get; } // Number of blocks used by the progress item [DispId(4)] uint BlockCount { get; } } /// <summary> /// FileSystemImageResult progress item /// </summary> [Guid("2C941FD7-975B-59BE-A960-9A2A262853A5")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IProgressItems { // Get an enumerator for the collection [DispId(-4), TypeLibFunc((short)0x41)] IEnumerator GetEnumerator(); // Find the block mapping from the specified index [DispId(0)] IProgressItem this[int Index] { get; } // Number of items in the collection [DispId(1)] int Count { get; } // Find the block mapping from the specified block [DispId(2)] IProgressItem ProgressItemFromBlock(uint block); // Find the block mapping from the specified item description [DispId(3)] IProgressItem ProgressItemFromDescription(string Description); // Get a non-variant enumerator [DispId(4)] IEnumProgressItems EnumProgressItems { get; } } [ComImport] [Guid("25983550-9D65-49CE-B335-40630D901227")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IRawCDImageCreator { // Creates the result stream [DispId(0x200)] IStream CreateResultImage(); // Adds a track to the media (defaults to audio, always 2352 bytes/sector) [DispId(0x201)] int AddTrack(IMAPI_CD_SECTOR_TYPE dataType, [In, MarshalAs(UnmanagedType.Interface)] IStream data); // Adds a special pregap to the first track, and implies an audio CD [DispId(0x202)] void AddSpecialPregap([In, MarshalAs(UnmanagedType.Interface)] IStream data); // Adds an R-W subcode generation object to supply R-W subcode (i.e. CD-Text or CD-G). [DispId(0x203)] void AddSubcodeRWGenerator([In, MarshalAs(UnmanagedType.Interface)] IStream subcode); [DispId(0x100)] IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE ResultingImageType { set; get; } // Equal to (final user LBA+1), defines minimum disc size image can be written to. [DispId(0x101)] int StartOfLeadout { get; } // [DispId(0x102)] int StartOfLeadoutLimit { set; get; } // Disables gapless recording of consecutive audio tracks [DispId(0x103)] bool DisableGaplessAudio { set; get; } // The Media Catalog Number for the CD image [DispId(260)] string MediaCatalogNumber { set; get; } // The starting track number (only for pure audio CDs) [DispId(0x105)] int StartingTrackNumber { set; get; } [DispId(0x106)] IRawCDImageTrackInfo this[int trackIndex] { [DispId(0x106)] get; } [DispId(0x107)] int NumberOfExistingTracks { get; } [DispId(0x108)] int LastUsedUserSectorInImage { get; } [DispId(0x109)] object[] ExpectedTableOfContents { get; } } [ComImport] [Guid("25983551-9D65-49CE-B335-40630D901227")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IRawCDImageTrackInfo { // The LBA of the first user sector in this track [DispId(0x100)] int StartingLba { get; } // The number of user sectors in this track [DispId(0x101)] int SectorCount { get; } // The track number assigned for this track [DispId(0x102)] int TrackNumber { get; } // The type of data being recorded on the current sector. [DispId(0x103)] IMAPI_CD_SECTOR_TYPE SectorType { get; } // The International Standard Recording Code (ISRC) for this track. [DispId(260)] string ISRC { get; set; } // The digital audio copy setting for this track [DispId(0x105)] IMAPI_CD_TRACK_DIGITAL_COPY_SETTING DigitalAudioCopySetting { get; set; } // The audio provided already has preemphasis applied (rare). [DispId(0x106)] bool AudioHasPreemphasis { get; set; } // The list of current track-relative indexes within the CD track. [DispId(0x107)] object[] TrackIndexes { get; } // Add the specified LBA (relative to the start of the track) as an index. [DispId(0x200)] void AddTrackIndex(int lbaOffset); // Removes the specified LBA (relative to the start of the track) as an index. [DispId(0x201)] void ClearTrackIndex(int lbaOffset); } /// <summary> /// Write Engine /// </summary> [ComImport] [Guid("27354135-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] public interface IWriteEngine2 { // Writes data provided in the IStream to the device [DispId(0x200)] void WriteSection(IStream data, int startingBlockAddress, int numberOfBlocks); // Cancels the current write operation [DispId(0x201)] void CancelWrite(); // The disc recorder to use [DispId(0x100)] IDiscRecorder2Ex Recorder { set; get; } // If true, uses WRITE12 with the AV bit set to one; else uses WRITE10 [DispId(0x101)] bool UseStreamingWrite12 { set; get; } // The approximate number of sectors per second the device can write at // the start of the write process. This is used to optimize sleep time // in the write engine. [DispId(0x102)] int StartingSectorsPerSecond { set; get; } // The approximate number of sectors per second the device can write at // the end of the write process. This is used to optimize sleep time // in the write engine. [DispId(0x103)] int EndingSectorsPerSecond { set; get; } // The number of bytes to use for each sector during writing. [DispId(260)] int BytesPerSector { set; get; } // Simple check to see if the object is currently writing to media. [DispId(0x105)] bool WriteInProgress { get; } } /// <summary> /// CD Write Engine /// </summary> [ComImport] [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("27354136-7F64-5B0F-8F00-5D77AFBE261E")] public interface IWriteEngine2EventArgs { // The starting logical block address for the current write operation. [DispId(0x100)] int StartLba { get; } // The number of sectors being written for the current write operation. [DispId(0x101)] int SectorCount { get; } // The last logical block address of data read for the current write operation. [DispId(0x102)] int LastReadLba { get; } // The last logical block address of data written for the current write operation [DispId(0x103)] int LastWrittenLba { get; } // The total bytes available in the system's cache buffer [DispId(0x106)] int TotalSystemBuffer { get; } // The used bytes in the system's cache buffer [DispId(0x107)] int UsedSystemBuffer { get; } // The free bytes in the system's cache buffer [DispId(0x108)] int FreeSystemBuffer { get; } } /// <summary> /// A single optical drive Write Speed Configuration /// </summary> [ComImport] [Guid("27354144-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FDual)] public interface IWriteSpeedDescriptor { // The type of media that this descriptor is valid for [DispId(0x101)] IMAPI_MEDIA_PHYSICAL_TYPE MediaType { get; } // Whether or not this descriptor represents a writing configuration that uses // Pure CAV rotation control [DispId(0x102)] bool RotationTypeIsPureCAV { get; } // The maximum speed at which the media will be written in the write configuration // represented by this descriptor [DispId(0x103)] int WriteSpeed { get; } } #endregion // Interfaces [ComImport] [CoClass(typeof(MsftDiscFormat2DataClass))] [Guid("27354153-9F64-5B0F-8F00-5D77AFBE261E")] public interface MsftDiscFormat2Data : IDiscFormat2Data, DiscFormat2Data_Event { } [ComImport] [ComSourceInterfaces("DDiscFormat2DataEvents\0")] [Guid("2735412A-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FCanCreate), ClassInterface(ClassInterfaceType.None)] public class MsftDiscFormat2DataClass { } [ComImport] [Guid("27354156-8F64-5B0F-8F00-5D77AFBE261E")] [CoClass(typeof(MsftDiscFormat2EraseClass))] public interface MsftDiscFormat2Erase : IDiscFormat2Erase, DiscFormat2Erase_Event { } [ComImport] [Guid("2735412B-7F64-5B0F-8F00-5D77AFBE261E")] [ComSourceInterfaces("DDiscFormat2EraseEvents\0")] [TypeLibType(TypeLibTypeFlags.FCanCreate), ClassInterface(ClassInterfaceType.None)] public class MsftDiscFormat2EraseClass { } [ComImport] [CoClass(typeof(MsftDiscFormat2RawCDClass))] [Guid("27354155-8F64-5B0F-8F00-5D77AFBE261E")] public interface MsftDiscFormat2RawCD : IDiscFormat2RawCD, DiscFormat2RawCD_Event { } [ComImport] [Guid("27354128-7F64-5B0F-8F00-5D77AFBE261E")] [ComSourceInterfaces("DDiscFormat2RawCDEvents\0")] [TypeLibType(TypeLibTypeFlags.FCanCreate)] [ClassInterface(ClassInterfaceType.None)] public class MsftDiscFormat2RawCDClass { } /// <summary> /// Microsoft IMAPIv2 Track-at-Once Audio CD Writer /// </summary> [ComImport] [Guid("27354154-8F64-5B0F-8F00-5D77AFBE261E")] [CoClass(typeof(MsftDiscFormat2TrackAtOnceClass))] public interface MsftDiscFormat2TrackAtOnce : IDiscFormat2TrackAtOnce, DiscFormat2TrackAtOnce_Event { } [ComImport] [TypeLibType(TypeLibTypeFlags.FCanCreate)] [ComSourceInterfaces("DDiscFormat2TrackAtOnceEvents\0")] [Guid("27354129-7F64-5B0F-8F00-5D77AFBE261E")] [ClassInterface(ClassInterfaceType.None)] public class MsftDiscFormat2TrackAtOnceClass { } /// <summary> /// Microsoft IMAPIv2 Disc Master /// </summary> [ComImport] [Guid("27354130-7F64-5B0F-8F00-5D77AFBE261E")] [CoClass(typeof(MsftDiscMaster2Class))] public interface MsftDiscMaster2 : IDiscMaster2 //, DiscMaster2_Event { } [ComImport, ComSourceInterfaces("DDiscMaster2Events\0")] [TypeLibType(TypeLibTypeFlags.FCanCreate)] [Guid("2735412E-7F64-5B0F-8F00-5D77AFBE261E")] [ClassInterface(ClassInterfaceType.None)] public class MsftDiscMaster2Class { } [ComImport] [CoClass(typeof(MsftDiscRecorder2Class))] [Guid("27354133-7F64-5B0F-8F00-5D77AFBE261E")] public interface MsftDiscRecorder2 : IDiscRecorder2 { } [ComImport] [Guid("2735412D-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FCanCreate)] [ClassInterface(ClassInterfaceType.None)] public class MsftDiscRecorder2Class { } [ComImport] [Guid("27354151-7F64-5B0F-8F00-5D77AFBE261E")] [CoClass(typeof(MsftMultisessionSequentialClass))] public interface MsftMultisessionSequential : IMultisessionSequential { } [ComImport] [Guid("27354122-7F64-5B0F-8F00-5D77AFBE261E")] [ClassInterface(ClassInterfaceType.None)] public class MsftMultisessionSequentialClass { } [ComImport] [Guid("25983550-9D65-49CE-B335-40630D901227")] [CoClass(typeof(MsftRawCDImageCreatorClass))] public interface MsftRawCDImageCreator : IRawCDImageCreator { } [ComImport] [Guid("25983561-9D65-49CE-B335-40630D901227")] [TypeLibType(TypeLibTypeFlags.FCanCreate)] [ClassInterface(ClassInterfaceType.None)] public class MsftRawCDImageCreatorClass { } [ComImport] [Guid("27354135-7F64-5B0F-8F00-5D77AFBE261E")] [CoClass(typeof(MsftWriteEngine2Class))] public interface MsftWriteEngine2 : IWriteEngine2, DWriteEngine2_Event { } [ComImport] [Guid("2735412C-7F64-5B0F-8F00-5D77AFBE261E")] [TypeLibType(TypeLibTypeFlags.FCanCreate)] [ComSourceInterfaces("DWriteEngine2Events\0")] [ClassInterface(ClassInterfaceType.None)] public class MsftWriteEngine2Class { } [ComImport] [CoClass(typeof(MsftWriteSpeedDescriptorClass))] [Guid("27354144-7F64-5B0F-8F00-5D77AFBE261E")] public interface MsftWriteSpeedDescriptor : IWriteSpeedDescriptor { } [ComImport] [ClassInterface(ClassInterfaceType.None)] [Guid("27354123-7F64-5B0F-8F00-5D77AFBE261E")] public class MsftWriteSpeedDescriptorClass { } [ComImport] [CoClass(typeof(BootOptionsClass))] [Guid("2C941FD4-975B-59BE-A960-9A2A262853A5")] public interface BootOptions : IBootOptions { } [ComImport] [ClassInterface(ClassInterfaceType.None)] [TypeLibType(TypeLibTypeFlags.FCanCreate)] [Guid("2C941FCE-975B-59BE-A960-9A2A262853A5")] public class BootOptionsClass { } [ComImport] [Guid("2C941FDA-975B-59BE-A960-9A2A262853A5")] [CoClass(typeof(EnumFsiItemsClass))] public interface EnumFsiItems : IEnumFsiItems { } [ComImport] [Guid("2C941FC6-975B-59BE-A960-9A2A262853A5")] [ClassInterface(ClassInterfaceType.None)] public class EnumFsiItemsClass { } [ComImport] [Guid("2C941FD6-975B-59BE-A960-9A2A262853A5")] [CoClass(typeof(EnumProgressItemsClass))] public interface EnumProgressItems : IEnumProgressItems { } [ComImport] [ClassInterface(ClassInterfaceType.None)] [Guid("2C941FCA-975B-59BE-A960-9A2A262853A5")] public class EnumProgressItemsClass { } [ComImport] [Guid("2C941FD8-975B-59BE-A960-9A2A262853A5")] [CoClass(typeof(FileSystemImageResultClass))] public interface FileSystemImageResult : IFileSystemImageResult { } [ComImport] [Guid("2C941FCC-975B-59BE-A960-9A2A262853A5")] [ClassInterface(ClassInterfaceType.None)] public class FileSystemImageResultClass { } [ComImport] [Guid("F7FB4B9B-6D96-4D7B-9115-201B144811EF")] [CoClass(typeof(FsiDirectoryItemClass))] public interface FsiDirectoryItem : IFsiDirectoryItem2 { } [ComImport] [ClassInterface(ClassInterfaceType.None)] [Guid("2C941FC8-975B-59BE-A960-9A2A262853A5")] public class FsiDirectoryItemClass { } [ComImport] [CoClass(typeof(FsiFileItemClass))] [Guid("199D0C19-11E1-40EB-8EC2-C8C822A07792")] public interface FsiFileItem : IFsiFileItem2 { } [ComImport] [ClassInterface(ClassInterfaceType.None)] [Guid("2C941FC7-975B-59BE-A960-9A2A262853A5")] public class FsiFileItemClass { } [ComImport] [Guid("ED79BA56-5294-4250-8D46-F9AECEE23459")] [CoClass(typeof(FsiNamedStreamsClass))] public interface FsiNamedStreams : IFsiNamedStreams { } [ComImport] [Guid("C6B6F8ED-6D19-44B4-B539-B159B793A32D")] [ClassInterface(ClassInterfaceType.None)] public class FsiNamedStreamsClass { } [ComImport] [Guid("0000000C-0000-0000-C000-000000000046")] [CoClass(typeof(FsiStreamClass))] public interface FsiStream : IStream { } [ComImport] [ClassInterface(ClassInterfaceType.None)] [Guid("2C941FCD-975B-59BE-A960-9A2A262853A5")] public class FsiStreamClass { } [ComImport] [CoClass(typeof(MsftFileSystemImageClass))] [Guid("2C941FE1-975B-59BE-A960-9A2A262853A5")] public interface MsftFileSystemImage : IFileSystemImage, DFileSystemImage_Event { } [ComImport] [TypeLibType(TypeLibTypeFlags.FCanCreate)] [Guid("2C941FC5-975B-59BE-A960-9A2A262853A5")] [ComSourceInterfaces("DFileSystemImageEvents\0DFileSystemImageImportEvents\0")] [ClassInterface(ClassInterfaceType.None)] public class MsftFileSystemImageClass { } [ComImport] [Guid("6CA38BE5-FBBB-4800-95A1-A438865EB0D4")] [CoClass(typeof(MsftIsoImageManagerClass))] public interface MsftIsoImageManager : IIsoImageManager { } [ComImport] [ClassInterface(ClassInterfaceType.None)] [Guid("CEEE3B62-8F56-4056-869B-EF16917E3EFC")] [TypeLibType(TypeLibTypeFlags.FCanCreate)] public class MsftIsoImageManagerClass { } [ComImport] [Guid("2C941FD5-975B-59BE-A960-9A2A262853A5")] [CoClass(typeof(ProgressItemClass))] public interface ProgressItem : IProgressItem { } [ComImport] [Guid("2C941FCB-975B-59BE-A960-9A2A262853A5")] [ClassInterface(ClassInterfaceType.None)] public class ProgressItemClass { } [ComImport] [Guid("2C941FD7-975B-59BE-A960-9A2A262853A5")] [CoClass(typeof(ProgressItemsClass))] public interface ProgressItems : IProgressItems { } [ComImport] [Guid("2C941FC9-975B-59BE-A960-9A2A262853A5")] [ClassInterface(ClassInterfaceType.None)] public class ProgressItemsClass { } }
32.229739
175
0.622985
[ "MIT" ]
AxionDrak/GameCube-Backup-Manager
GCBM/tools/Interop/imapi2Interop.cs
134,819
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Com.Danliris.Service.Packing.Inventory.Data.Models.Garmentshipping.LetterOfCredit; using Com.Danliris.Service.Packing.Inventory.Infrastructure.IdentityProvider; using Com.Moonlay.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; namespace Com.Danliris.Service.Packing.Inventory.Infrastructure.Repositories.GarmentShipping.LetterOfCredit { public class GarmentLetterOfCreditRepository : IGarmentLetterOfCreditRepository { private const string UserAgent = "Repository"; private readonly PackingInventoryDbContext _dbContext; private readonly IIdentityProvider _identityProvider; private readonly DbSet<GarmentShippingLetterOfCreditModel> _dbSet; public GarmentLetterOfCreditRepository(PackingInventoryDbContext dbContext, IServiceProvider serviceProvider) { _dbContext = dbContext; _dbSet = dbContext.Set<GarmentShippingLetterOfCreditModel>(); _identityProvider = serviceProvider.GetService<IIdentityProvider>(); } public Task<int> DeleteAsync(int id) { var model = _dbSet.FirstOrDefault(s => s.Id == id); model.FlagForDelete(_identityProvider.Username, UserAgent); return _dbContext.SaveChangesAsync(); } public Task<int> InsertAsync(GarmentShippingLetterOfCreditModel model) { model.FlagForCreate(_identityProvider.Username, UserAgent); _dbSet.Add(model); return _dbContext.SaveChangesAsync(); } public IQueryable<GarmentShippingLetterOfCreditModel> ReadAll() { return _dbSet.AsNoTracking(); } public Task<GarmentShippingLetterOfCreditModel> ReadByIdAsync(int id) { return _dbSet.FirstOrDefaultAsync(s => s.Id == id); } public async Task<int> UpdateAsync(int id, GarmentShippingLetterOfCreditModel model) { var modelToUpdate = _dbSet.First(s => s.Id == id); modelToUpdate.SetDate(model.Date, _identityProvider.Username, UserAgent); modelToUpdate.SetApplicantCode(model.ApplicantCode, _identityProvider.Username, UserAgent); modelToUpdate.SetApplicantId(model.ApplicantId, _identityProvider.Username, UserAgent); modelToUpdate.SetApplicantName(model.ApplicantName, _identityProvider.Username, UserAgent); modelToUpdate.SetDocumentCreditNo(model.DocumentCreditNo, _identityProvider.Username, UserAgent); modelToUpdate.SetExpireDate(model.ExpireDate, _identityProvider.Username, UserAgent); modelToUpdate.SetExpirePlace(model.ExpirePlace, _identityProvider.Username, UserAgent); modelToUpdate.SetIssuedBank(model.IssuedBank, _identityProvider.Username, UserAgent); modelToUpdate.SetLatestShipment(model.LatestShipment, _identityProvider.Username, UserAgent); modelToUpdate.SetLCCondition(model.LCCondition, _identityProvider.Username, UserAgent); modelToUpdate.SetQuantity(model.Quantity, _identityProvider.Username, UserAgent); modelToUpdate.SetTotalAmount(model.TotalAmount, _identityProvider.Username, UserAgent); modelToUpdate.SetUomId(model.UomId, _identityProvider.Username, UserAgent); modelToUpdate.SetUomUnit(model.UomUnit, _identityProvider.Username, UserAgent); return await _dbContext.SaveChangesAsync(); } } }
46.282051
117
0.727978
[ "MIT" ]
AndreaZain/com-danliris-service-packing-inventory
src/Com.Danliris.Service.Packing.Inventory.Infrastructure/Repositories/GarmentShipping/LetterOfCredit/GarmentLetterOfCreditRepository.cs
3,612
C#
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AWSSDK.AlexaForBusiness")] [assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - Alexa For Business. Alexa for Business is now generally available for production use. Alexa for Business makes it easy for you to use Alexa in your organization. The Alexa for Business SDK gives you APIs to manage Alexa devices, enroll users, and assign skills at scale. For more information about Alexa for Business, go to https://aws.amazon.com/alexaforbusiness")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Amazon Web Services SDK for .NET")] [assembly: AssemblyCompany("Amazon.com, Inc")] [assembly: AssemblyCopyright("Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("3.3")] [assembly: AssemblyFileVersion("3.7.0.65")]
53.53125
443
0.758319
[ "Apache-2.0" ]
wdolek/aws-sdk-net
sdk/code-analysis/ServiceAnalysis/AlexaForBusiness/Properties/AssemblyInfo.cs
1,713
C#
#region License // // Copyright Tony Beveridge 2015. All rights reserved. // MIT license applies. // #endregion using System.Collections.Generic; namespace FSM { public interface IEventQueue { void Enqueue(IEventInstance instance); IEventInstance Dequeue(); bool Any(); IEnumerable<IEventInstance> All { get; } } }
18.947368
55
0.669444
[ "MIT" ]
afgbeveridge/Quorum
FSM/IEventQueue.cs
362
C#
using UnityEngine; using UtilityTools; #if UNITY_EDITOR using UnityEditor; using UtilityToolsEditor; #endif [DisallowMultipleComponent] public class PlayerCameraControl : MonoBehaviour { public Transform objective; public Vector3 objectiveOffset; public Transform objectiveBase; public Vector3 objectiveBaseOffset; [DisplayProperties] public InputHelper inputs; [HideInInspector] [SerializeField] bool _lockCursor; [HideInInspector] public bool lockToTransform; [HideInInspector] public float currentDistance = 5; [HideInInspector] public float zoomSpeed = 10; [HideInInspector] public float collisionMargin = 2; [HideInInspector] public LayerMask collisionMask; [HideInInspector] [SerializeField] float maxDistance = 10; [HideInInspector] [SerializeField] float minDistance = 0; [HideInInspector] [SerializeField] float movementSmoothness = 0.02f; [HideInInspector] [SerializeField] float maxPitch = 85; [HideInInspector] [SerializeField] float minPitch = -70; [HideInInspector] [SerializeField] Vector3 rotationSpeed = new Vector3(4, 3.5f, 1); [HideInInspector] [SerializeField] float pitch, yaw, roll; [HideInInspector] [SerializeField] float rotationSmoothness = 0.01f; public bool lockCursor { get { return _lockCursor; } set { SetCursorMode(value); } } Vector3 rotateSmoothVelocity; Vector3 currentRotation; Vector3 moveSmoothVelocity; Vector3 currentPosition; Vector3 targetPosition; Vector3 basePosition; Vector3 toCamera; float collisionDistance; RaycastHit rayHit; float t; protected void Awake() { lockCursor = _lockCursor; if (FindObjectOfType<InputHelper>()) { inputs = FindObjectOfType<InputHelper>(); } if (GameObject.FindWithTag("Player")) { objective = !objective ? GameObject.FindWithTag("Player").transform : objective; } if (objective != null) { transform.rotation = Quaternion.Euler(pitch, yaw, roll); transform.position = objective.position + objectiveOffset - transform.forward * currentDistance; } else { Debug.LogWarning("Objetive 'Transform' not found", this); } if (inputs == null) { Debug.LogWarning("Inputs 'InputHelper' not found", this); } } protected void FixedUpdate() { if (objective == null || inputs == null) return; // Inputs ~ currentDistance += Input.GetAxis(inputs.scrollWheel) * zoomSpeed; currentDistance = Mathf.Clamp(currentDistance, minDistance, maxDistance); yaw += Input.GetAxis(inputs.mouseHorizontal) * rotationSpeed.x; pitch -= Input.GetAxis(inputs.mouseVertical) * rotationSpeed.y; t = (currentDistance - minDistance) / (maxDistance - minDistance); targetPosition = objective.position; basePosition = objectiveBase != null ? objectiveBase.position : objective.position; basePosition += lockToTransform ? (objectiveBase != null ? objectiveBase.rotation : objective.rotation) * objectiveBaseOffset : objectiveBaseOffset; targetPosition += lockToTransform ? objective.rotation * objectiveOffset : objectiveOffset; targetPosition = Vector3.Lerp(targetPosition, basePosition, t); toCamera = transform.position - targetPosition; // vector to the camera toCamera = toCamera.magnitude < 0.0001f ? transform.forward : toCamera; // Fix objetive too close // Debug.DrawRay(targetPosition, toCamera.normalized * (currentDistance + collisionMargin), Color.red); if (Physics.Raycast(targetPosition, toCamera.normalized, out rayHit, currentDistance + collisionMargin, collisionMask)) { collisionDistance = (rayHit.point - targetPosition).magnitude - collisionMargin; collisionDistance = collisionDistance < 0 ? 0 : collisionDistance; } else { collisionDistance = currentDistance; } if (maxPitch < 180 && minPitch > -180) pitch = Mathf.Clamp(pitch, minPitch, maxPitch); // Clamp the angle if (Input.GetAxis(inputs.mouseHorizontal).Equals(0)) { if (InputHelper.inactiveTime > 60) { //Reset the angle number when inactive to avoid jiggering yaw += 360; yaw %= 360; yaw -= yaw > 180 ? 360 : 0; currentRotation.y = yaw; } } else { InputHelper.inactiveTime = 0; } currentRotation = Vector3.SmoothDamp(currentRotation, new Vector3(pitch, yaw), ref rotateSmoothVelocity, movementSmoothness); transform.eulerAngles = currentRotation; currentPosition = Vector3.SmoothDamp(currentPosition, targetPosition - transform.forward * collisionDistance, ref moveSmoothVelocity, rotationSmoothness); transform.position = currentPosition; } void SetCursorMode(bool value) { _lockCursor = value; Cursor.lockState = CursorLockMode.None; Cursor.visible = true; #if UNITY_EDITOR if (EditorApplication.isPlaying) { #endif Cursor.lockState = _lockCursor ? CursorLockMode.Locked : CursorLockMode.None; #if UNITY_EDITOR } #endif } } #if UNITY_EDITOR [CanEditMultipleObjects] [CustomEditor(typeof(PlayerCameraControl))] public class PlayerCameraControlEditor : Editor { SerializedProperty objective, objectiveOffset; SerializedProperty _lockCursor, lockToTransform; SerializedProperty currentDistance, collisionMargin, collisionMask, maxDistance, minDistance; SerializedProperty maxPitch, minPitch, rotationSpeed, roll, yaw, pitch; SerializedProperty zoomSpeed, rotationSmoothness, movementSmoothness; //SerializedProperty inputs; PlayerCameraControl serializedTarget; void OnEnable() { objective = serializedObject.FindProperty("objective"); objectiveOffset = serializedObject.FindProperty("objectiveOffset"); _lockCursor = serializedObject.FindProperty("_lockCursor"); lockToTransform = serializedObject.FindProperty("lockToTransform"); currentDistance = serializedObject.FindProperty("currentDistance"); collisionMargin = serializedObject.FindProperty("collisionMargin"); collisionMask = serializedObject.FindProperty("collisionMask"); maxDistance = serializedObject.FindProperty("maxDistance"); minDistance = serializedObject.FindProperty("minDistance"); movementSmoothness = serializedObject.FindProperty("movementSmoothness"); maxPitch = serializedObject.FindProperty("maxPitch"); minPitch = serializedObject.FindProperty("minPitch"); rotationSpeed = serializedObject.FindProperty("rotationSpeed"); roll = serializedObject.FindProperty("roll"); yaw = serializedObject.FindProperty("yaw"); pitch = serializedObject.FindProperty("pitch"); zoomSpeed = serializedObject.FindProperty("zoomSpeed"); rotationSmoothness = serializedObject.FindProperty("rotationSmoothness"); serializedTarget = serializedObject.targetObject as PlayerCameraControl; } public override void OnInspectorGUI() { DrawDefaultInspector(); GUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(_lockCursor, new GUIContent("Lock Cursor")); if (GUI.changed) { serializedTarget.lockCursor = _lockCursor.boolValue; } EditorGUILayout.PropertyField(lockToTransform); GUILayout.EndHorizontal(); EditorTool.AddSpecialSpace(0); EditorGUILayout.LabelField("Movement Settings", new GUIStyle("BoldLabel")); EditorGUI.indentLevel++; EditorTool.MakeMinMaxSlider(minDistance, maxDistance, 0, 100, "Distance Clamp"); EditorGUILayout.Slider(currentDistance, minDistance.floatValue, maxDistance.floatValue); EditorGUILayout.Slider(collisionMargin, -(maxDistance.floatValue - minDistance.floatValue) / 2 , (maxDistance.floatValue - minDistance.floatValue) / 2); EditorGUILayout.PropertyField(collisionMask); EditorGUILayout.Slider(zoomSpeed, -25, 25); EditorGUILayout.Slider(movementSmoothness, 0f, 1, "Smoothness"); EditorGUI.indentLevel--; EditorTool.AddSpecialSpace(0); EditorGUILayout.LabelField("Rotation Settings", new GUIStyle("BoldLabel")); Vector3 rotations = new Vector3(pitch.floatValue, yaw.floatValue, roll.floatValue); Rect buttonRect = GUILayoutUtility.GetLastRect(); buttonRect.x += EditorGUIUtility.labelWidth; buttonRect.width -= EditorGUIUtility.labelWidth; if (GUI.Button(buttonRect, "Calculate Initial Rotation")) { if (objective.objectReferenceValue != null) { var objectiveTransform = objective.objectReferenceValue as Transform; var rotation = serializedTarget.transform.rotation; serializedTarget.transform.LookAt(objectiveTransform.position + objectiveOffset.vector3Value); rotations = serializedTarget.transform.rotation.eulerAngles; serializedTarget.transform.rotation = rotation; pitch.floatValue = rotations.x; yaw.floatValue = rotations.y; roll.floatValue = rotations.z; } } EditorGUI.indentLevel++; EditorTool.MakeMinMaxSlider(minPitch, maxPitch, -180, 180, "Pitch Clamp"); rotationSpeed.vector3Value = EditorGUILayout.Vector3Field(rotationSpeed.displayName, rotationSpeed.vector3Value); rotations = EditorGUILayout.Vector3Field("Rotations", rotations); if (GUI.changed) { pitch.floatValue = rotations.x; yaw.floatValue = rotations.y; roll.floatValue = rotations.z; } EditorGUILayout.Slider(rotationSmoothness, 0f, 0.5f, "Smoothness"); GUI.enabled = objective.objectReferenceValue; GUI.enabled = true; EditorGUI.indentLevel--; serializedObject.ApplyModifiedProperties(); } } #endif
43.172249
156
0.77646
[ "MIT" ]
Consalv0/MyUnityTools
Assets/Controllers/PlayerCameraControl.cs
9,023
C#
using System; using System.IO; using Microsoft.Azure.WebJobs; using Microsoft.Extensions.Logging; using Microsoft.WindowsAzure.Storage.Blob; using GLEIF.lei; using System.Linq; using System.Xml.Serialization; using Newtonsoft.Json; using CsvHelper; namespace GLEIF.FunctionApp { public static class ExtractSubset { [FunctionName("ExtractSubset")] public static void Run( [BlobTrigger("gleif-xml/{name}lei2.xml", Connection = "GleifBlobStorage")/*, Disable()*/] CloudBlockBlob inputBlob, [Blob("gleif-xml/{name}", FileAccess.Write, Connection = "GleifBlobStorage")] CloudBlockBlob outputBlob, string name, string blobTrigger, ILogger logger, ExecutionContext context) { logger.LogInformation("Extracting subsets from '{0}'...", blobTrigger); // local variable leiData as LEIData Object (classes generated from XSD using XSD.exe) LEIData _leiData; // Read Xml into LEIData object logger.LogInformation("Serializing inputStream into LEIData object from '{0}'...", blobTrigger); _leiData = ReadXml(inputBlob.OpenReadAsync().Result); // Write Top records (using LINQ filtering) logger.LogInformation("Writing TopN.xml files to blob from '{0}'...", blobTrigger); WriteXmlTopN(_leiData, new Uri(outputBlob.Parent.Uri.AbsoluteUri + '/' + inputBlob.Name.Replace(".xml", "-Top10.xml")), outputBlob.ServiceClient, 10); WriteXmlTopN(_leiData, new Uri(outputBlob.Parent.Uri.AbsoluteUri + '/' + inputBlob.Name.Replace(".xml", "-Top100.xml")), outputBlob.ServiceClient, 100); WriteXmlTopN(_leiData, new Uri(outputBlob.Parent.Uri.AbsoluteUri + '/' + inputBlob.Name.Replace(".xml", "-Top1000.xml")), outputBlob.ServiceClient, 1000); WriteXmlTopN(_leiData, new Uri(outputBlob.Parent.Uri.AbsoluteUri + '/' + inputBlob.Name.Replace(".xml", "-Top10000.xml")), outputBlob.ServiceClient, 10000); WriteXmlTopN(_leiData, new Uri(outputBlob.Parent.Uri.AbsoluteUri + '/' + inputBlob.Name.Replace(".xml", "-Top100000.xml")), outputBlob.ServiceClient, 100000); // Write Country (using LINQ filtering) logger.LogInformation("Writing Country.xml files to blob from '{0}'...", blobTrigger); WriteXmlCountry(_leiData, new Uri(outputBlob.Parent.Uri.AbsoluteUri + '/' + inputBlob.Name.Replace(".xml", "-NL.xml")), outputBlob.ServiceClient, "NL"); WriteXmlCountry(_leiData, new Uri(outputBlob.Parent.Uri.AbsoluteUri + '/' + inputBlob.Name.Replace(".xml", "-PT.xml")), outputBlob.ServiceClient, "PT"); // Write other formats logger.LogInformation("Writing .json & .csv files to blob from '{0}'...", blobTrigger); WriteJson(_leiData, new Uri(outputBlob.Parent.Uri.AbsoluteUri + '/' + inputBlob.Name.Replace(".xml", ".json")), outputBlob.ServiceClient); WriteCsv(_leiData, new Uri(outputBlob.Parent.Uri.AbsoluteUri + '/' + inputBlob.Name.Replace(".xml", ".csv")), outputBlob.ServiceClient); // Cleanup memory & force Garbage Collection _leiData = null; GC.Collect(); } // Deserialize XML file straight into LEIData Object (stream) private static LEIData ReadXml(Stream input) { LEIData leiData; XmlSerializer serializer = new XmlSerializer(typeof(LEIData)); leiData = (LEIData)serializer.Deserialize(input); return leiData; } // serialize LEIData object straight into XML stream private static void WriteXmlStream(LEIData leiData, Stream output, XmlSerializerNamespaces ns = null) { if (ns == null) { // explicitly include NameSpaces, to comply with 2017-03-21_lei-cdf-v2-1.pdf | 1.6.1. XML Design Rules ns = new XmlSerializerNamespaces(); ns.Add("gleif", "http://www.gleif.org/concatenated-file/header-extension/2.0"); ns.Add("lei", "http://www.gleif.org/data/schema/leidata/2016"); } XmlSerializer serializer = new XmlSerializer(typeof(LEIData)); serializer.Serialize(output, leiData, ns); } // filter LEIData object using LINQ expression to TopN records private static void WriteXmlTopN(LEIData leiData, Uri outputUri, CloudBlobClient cloudBlobClient, int count) { // Inititialize TopN object based on parent object LEIData _leiData = new LEIData { LEIHeader = leiData.LEIHeader, LEIRecords = new LEIRecordsType() }; // Filter top N records, using List<> methods _leiData.LEIRecords.LEIRecord = leiData.LEIRecords.LEIRecord.Take<LEIRecordType>(count).ToList(); // Update actual RecordCount in Header _leiData.LEIHeader.RecordCount = _leiData.LEIRecords.LEIRecord.Count.ToString(); // Write serialized object to Blob CloudBlockBlob outputBlob = new CloudBlockBlob(outputUri, cloudBlobClient); using (var outputStream = outputBlob.OpenWriteAsync().Result) { WriteXmlStream(_leiData, outputStream); } } // filter LEIData object using LINQ expression to country specific set // append CountryCode to NameSpace (as experiment for different formats) private static void WriteXmlCountry(LEIData leiData, Uri outputUri, CloudBlobClient cloudBlobClient, string countryCode) { // Inititialize TopN object based on parent object LEIData _leiData = new LEIData { LEIHeader = leiData.LEIHeader, LEIRecords = new LEIRecordsType() }; // Filter only specified Country records, using LINQ Lambda Expressions // The Any operator enumerates the source sequence and returns true if any Country == countryCode _leiData.LEIRecords.LEIRecord = leiData.LEIRecords.LEIRecord. Where(rec => rec.Entity.LegalAddress.Country == countryCode || rec.Entity.HeadquartersAddress.Country == countryCode ).ToList(); // Update actual RecordCount in Header _leiData.LEIHeader.RecordCount = _leiData.LEIRecords.LEIRecord.Count.ToString(); // as an Experiment, use different Namespace for this country; append the CountryCode XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("gleif" + countryCode, "http://www.gleif.org/concatenated-file/header-extension/2.0"); ns.Add("lei" + countryCode, "http://www.gleif.org/data/schema/leidata/2016"); // Write serialized object to Blob CloudBlockBlob outputBlob = new CloudBlockBlob(outputUri, cloudBlobClient); using (var outputStream = outputBlob.OpenWriteAsync().Result) { WriteXmlStream(_leiData, outputStream); } } // Write serialized object via MemoryStream to Blob as JSON private static void WriteJson(LEIData leiData, Uri outputUri, CloudBlobClient cloudBlobClient) { CloudBlockBlob outputBlob = new CloudBlockBlob(outputUri, cloudBlobClient); using (var sw = new StreamWriter(outputBlob.OpenWriteAsync().Result)) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(sw, leiData); } } // Write serialized object via MemoryStream to Blob as CSV private static void WriteCsv(LEIData leiData, Uri outputUri, CloudBlobClient cloudBlobClient) { CloudBlockBlob outputBlob = new CloudBlockBlob(outputUri, cloudBlobClient); using (var sw = new StreamWriter(outputBlob.OpenWriteAsync().Result)) { CsvWriter csv = new CsvWriter(sw); csv.WriteRecords(leiData.LEIRecords.LEIRecord); } } } }
48.252941
170
0.635499
[ "MIT" ]
modusnl/GLEIF
FunctionApp/ExtractSubset.cs
8,203
C#
using System.Collections; using System.Collections.Generic; using Improbable.Gdk.Subscriptions; using PlayFab; using PlayFab.ServerModels; using Spatialplayfab; using UnityEditor; using UnityEngine; public class PlayerStateBehavior : MonoBehaviour { [Require] protected PlayerStateWriter PlayerStateWriter; [Require] protected PlayerStateCommandReceiver PlayerStateCommandReceiver; private LinkedEntityComponent _spatialOsComponent; void OnEnable() { _spatialOsComponent = GetComponent<LinkedEntityComponent>(); PlayerStateCommandReceiver.OnValidateRequestReceived += OnValidateRequest; } private void OnValidateRequest(PlayerState.Validate.ReceivedRequest request) { if (string.IsNullOrEmpty(request.Payload.SessionTicket)) { #if UNITY_EDITOR PlayerStateWriter.SendUpdate(new PlayerState.Update() {Validated = true,}); PlayerStateCommandReceiver.SendValidateResponse(request.RequestId, new ValidateResponse(true)); return; #endif Debug.LogError("No Session Ticket Sent for Player"); PlayerStateCommandReceiver.SendValidateResponse(request.RequestId, new ValidateResponse(false)); return; } PlayFabServerAPI.AuthenticateSessionTicket( new AuthenticateSessionTicketRequest() {SessionTicket = request.Payload.SessionTicket,}, resultAuth => { if (resultAuth.UserInfo.PlayFabId != request.Payload.PlayerId) { Debug.LogError("Player Id not matching what player sent"); PlayerStateCommandReceiver.SendValidateResponse(request.RequestId, new ValidateResponse(false)); return; } PlayFabServerAPI.GetUserData(new GetUserDataRequest() { PlayFabId = resultAuth.UserInfo.PlayFabId }, result => { //used loaded user data or player data from PlayFab var playerState = new PlayerState.Update() { Validated = true, }; PlayerStateWriter.SendUpdate(playerState); PlayerStateCommandReceiver.SendValidateResponse(request.RequestId, new ValidateResponse(true)); }, error => { SendBadResult(request.RequestId); Debug.LogError(error.GenerateErrorReport()); }); }, error => { Debug.LogError(error.GenerateErrorReport()); SendBadResult(request.RequestId); }); } void SendBadResult(long requestId) { PlayerStateCommandReceiver.SendValidateResponse(requestId, new ValidateResponse(false)); } }
31.715909
126
0.643497
[ "MIT" ]
judah4/spatial-playfab-platform-sdk
workers/unity/Assets/_Game/Scripts/Playfab/PlayerStateBehavior.cs
2,791
C#
using Avalonia.Collections; using Avalonia.Controls.Presenters; using Avalonia.LogicalTree; namespace Avalonia.Controls.Primitives { /// <summary> /// Represents a <see cref="SelectingItemsControl"/> with a related header. /// </summary> public class HeaderedSelectingItemsControl : SelectingItemsControl, IContentPresenterHost { /// <summary> /// Defines the <see cref="Header"/> property. /// </summary> public static readonly StyledProperty<object?> HeaderProperty = HeaderedContentControl.HeaderProperty.AddOwner<HeaderedSelectingItemsControl>(); /// <summary> /// Initializes static members of the <see cref="ContentControl"/> class. /// </summary> static HeaderedSelectingItemsControl() { HeaderProperty.Changed.AddClassHandler<HeaderedSelectingItemsControl>((x, e) => x.HeaderChanged(e)); } /// <summary> /// Gets or sets the content of the control's header. /// </summary> public object? Header { get { return GetValue(HeaderProperty); } set { SetValue(HeaderProperty, value); } } /// <summary> /// Gets the header presenter from the control's template. /// </summary> public IContentPresenter? HeaderPresenter { get; private set; } /// <inheritdoc/> IAvaloniaList<ILogical> IContentPresenterHost.LogicalChildren => LogicalChildren; /// <inheritdoc/> bool IContentPresenterHost.RegisterContentPresenter(IContentPresenter presenter) { return RegisterContentPresenter(presenter); } /// <summary> /// Called when an <see cref="IContentPresenter"/> is registered with the control. /// </summary> /// <param name="presenter">The presenter.</param> protected virtual bool RegisterContentPresenter(IContentPresenter presenter) { if (presenter.Name == "PART_HeaderPresenter") { HeaderPresenter = presenter; return true; } return false; } private void HeaderChanged(AvaloniaPropertyChangedEventArgs e) { if (e.OldValue is ILogical oldChild) { LogicalChildren.Remove(oldChild); } if (e.NewValue is ILogical newChild) { LogicalChildren.Add(newChild); } } } }
31.243902
112
0.587041
[ "MIT" ]
0x0ade/Avalonia
src/Avalonia.Controls/Primitives/HeaderedSelectingItemsControl.cs
2,562
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using AdventureWorks.Models; namespace AdventureWorks.Repository { public interface ISalesOrdersRepository { List<SalesOrder> GetSalesOrders(int? customerID = null); List<SalesOrderDetails> GetSalesOrderDetails(int orderId); } }
20.944444
66
0.758621
[ "MIT" ]
devizer/Universe.SqlInsights
src/AdventureWorks/Repository/ISalesOrdersRepository.cs
379
C#
namespace RingCentral { public partial class CountryResource { // public string @uri { get; set; } // public string @id { get; set; } // public string @name { get; set; } // public string @isoCode { get; set; } // public string @callingCode { get; set; } // public bool? @emergencyCalling { get; set; } // public bool? @numberSelling { get; set; } // public bool? @loginAllowed { get; set; } } }
23.304348
52
0.483209
[ "MIT" ]
ringcentral/ringcentral-csharp-client
RingCentral/Definitions/CountryResource.cs
536
C#
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="Process.cs" company="MLambda"> // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see https://www.gnu.org/licenses/. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace MLambda.Actors { using System; using System.Threading.Tasks; using MLambda.Actors.Abstraction; using MLambda.Actors.Abstraction.Core; /// <summary> /// The process class. /// </summary> public class Process : IProcess { private readonly IBucket bucket; private LifeCycle state; /// <summary> /// Initializes a new instance of the <see cref="Process"/> class. /// </summary> /// <param name="bucket">the bucket.</param> /// <param name="parent">the parent job.</param> /// <param name="current">the current job.</param> public Process(IBucket bucket, IProcess parent, IWorkUnit current) { this.bucket = bucket; this.Parent = parent?.Current; this.Route = $"{parent?.Route}{current.Name}"; this.Current = current; this.state = LifeCycle.Created; } /// <summary> /// The lifecycle event. /// </summary> public delegate void LifeCycleHandler(); /// <summary> /// Adds or removes events to on post stop. /// </summary> public event LifeCycleHandler PostStop { add => this.OnPostStop += value; remove => this.OnPostStop -= value; } private event LifeCycleHandler OnPostStop; /// <summary> /// The lifecycle of the process. /// </summary> public enum LifeCycle { /// <summary> /// The process is initializes. /// </summary> Starting, /// <summary> /// The process can receiving the message. /// </summary> Receiving, /// <summary> /// The process cleans up the actual state. /// </summary> Stopping, /// <summary> /// The process is going to restart and assign new schedulers. /// </summary> Restarting, /// <summary> /// The process is dead. /// </summary> Terminated, /// <summary> /// The new one state. /// </summary> Created, } /// <summary> /// Gets the id. /// </summary> public Guid Id => this.Current.Id; /// <summary> /// Gets the status. /// </summary> public string Status => Enum.GetName(typeof(LifeCycle), this.state); /// <summary> /// Gets the parent job. /// </summary> public IWorkUnit Parent { get; } /// <summary> /// Gets the actual job. /// </summary> public IWorkUnit Current { get; } /// <summary> /// Gets the path. /// </summary> public string Route { get; } /// <summary> /// Stops the scheduler. /// </summary> public void Stop() { this.state = LifeCycle.Stopping; this.Current.Stop(); this.OnPostStop?.Invoke(); this.state = LifeCycle.Terminated; } /// <summary> /// Starts the actor model. /// </summary> public void Start() { this.state = LifeCycle.Starting; this.Current.Start(this.Receive); this.state = LifeCycle.Receiving; } /// <summary> /// Resumes the actor model. /// </summary> public void Resume() { ////TODO } /// <summary> /// Escalate the exception to the parent. /// </summary> /// <param name="exception">The exception.</param> public void Escalate(Exception exception) => this.Parent.Supervisor.Handle(exception, this.bucket.Parent(this)); /// <summary> /// Restart the actor model. /// </summary> public void Restart() { this.state = LifeCycle.Stopping; //// this.PreRestart(); this.state = LifeCycle.Restarting; //// this.PostRestart(); this.Start(); } /// <summary> /// Spawns the actor link. /// </summary> /// <typeparam name="T">the type of the actor.</typeparam> /// <returns>The link of the actor.</returns> public IAddress Spawn<T>() where T : IActor => this.bucket.Spawn<T>(this); private async Task Receive(IMessage message) => await this.Current.Supervisor.Apply(message)(new Context(this)); } }
30.362162
119
0.503116
[ "MIT" ]
RoyGI/MActor
src/MLambda.Actors/Process.cs
5,617
C#
namespace WebDriverProvider.Implementation.Chrome { internal interface IReleaseNotesParser { string FindCompatibleDriverVersion(string releaseNotes, string requiredChromeVersion); } }
26.857143
88
0.851064
[ "MIT" ]
pawelkmiec/WebDriverProvider
WebDriverProvider/Implementation/Chrome/IReleaseNotesParser.cs
188
C#
using Domain.Entity.Base; using System; using System.Collections.Generic; namespace Domain.Entity { public class FilmInCinemaEntity : EntityBase { public virtual CinemaEntity Cinema { get; set; } public int? CinemaId { get; set; } public DateTime DateOfStart { get; set; } public DateTime DateOfEnd { get; set; } public virtual FilmEntity Film { get; set; } public int? FilmId { get; set; } public ICollection<SessionEntity> Sessions { get; set; } } }
29
64
0.649425
[ "MIT" ]
EldarMamishev/Cinemarx
Domain/Entity/FilmInCinema.cs
524
C#
using UniRx; namespace Manager { public class GameStateManager { //GameState.Homeで初期化 private ReactiveProperty<GameState> currentGameState = new ReactiveProperty<GameState>(GameState.Play); public IReadOnlyReactiveProperty<GameState> CurrentGameState => currentGameState; public GameState GameState => currentGameState.Value; //状態を変更 public void SetGameState(GameState state) { currentGameState.Value = state; } } }
24.238095
111
0.67387
[ "MIT" ]
VeyronSakai/ML-Agents_BombBattle
Assets/Project/Scripts/Manager/GameStateManager.cs
529
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.Cloud.Optimization.V1.Snippets { // [START cloudoptimization_v1_generated_FleetRouting_BatchOptimizeTours_sync] using Google.Cloud.Optimization.V1; using Google.LongRunning; public sealed partial class GeneratedFleetRoutingClientSnippets { /// <summary>Snippet for BatchOptimizeTours</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void BatchOptimizeToursRequestObject() { // Create client FleetRoutingClient fleetRoutingClient = FleetRoutingClient.Create(); // Initialize request argument(s) BatchOptimizeToursRequest request = new BatchOptimizeToursRequest { Parent = "", ModelConfigs = { new BatchOptimizeToursRequest.Types.AsyncModelConfig(), }, }; // Make the request Operation<BatchOptimizeToursResponse, AsyncModelMetadata> response = fleetRoutingClient.BatchOptimizeTours(request); // Poll until the returned long-running operation is complete Operation<BatchOptimizeToursResponse, AsyncModelMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result BatchOptimizeToursResponse result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation<BatchOptimizeToursResponse, AsyncModelMetadata> retrievedResponse = fleetRoutingClient.PollOnceBatchOptimizeTours(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result BatchOptimizeToursResponse retrievedResult = retrievedResponse.Result; } } } // [END cloudoptimization_v1_generated_FleetRouting_BatchOptimizeTours_sync] }
44.446154
151
0.681205
[ "Apache-2.0" ]
AlexandrTrf/google-cloud-dotnet
apis/Google.Cloud.Optimization.V1/Google.Cloud.Optimization.V1.GeneratedSnippets/FleetRoutingClient.BatchOptimizeToursRequestObjectSnippet.g.cs
2,889
C#
/* INFINITY CODE 2013-2017 */ /* http://www.infinity-code.com */ using UnityEngine; namespace InfinityCode.OnlineMapsExamples { /// <summary> /// Example of animated reset camera rotation. /// </summary> [AddComponentMenu("Infinity Code/Online Maps/Examples (API Usage)/ResetCameraRotationExample")] public class ResetCameraRotationExample : MonoBehaviour { /// <summary> /// Time of animation (sec). /// </summary> public float animationTime = 3; /// <summary> /// Animation Curve. /// </summary> public AnimationCurve animationCurve = AnimationCurve.EaseInOut(0, 0, 1, 1); private float time; private bool isReset; private float camX; private float camY; private OnlineMapsTileSetControl control; private void OnGUI() { if (GUI.Button(new Rect(5, 5, 100, 30), "Reset") && !isReset) { // Store the current rotation, and marks that reset is started. camX = control.cameraRotation.x; camY = control.cameraRotation.y; isReset = true; } } private void Start() { control = OnlineMapsTileSetControl.instance; } private void Update() { if (!isReset) return; // Updating the progress of the animation. time += Time.deltaTime; float t = time / animationTime; // If the animation is finished if (t >= 1) { // Reset values time = 0; isReset = false; t = 1; } // Update the rotation of camera. float f = animationCurve.Evaluate(t); control.cameraRotation.x = Mathf.Lerp(camX, 0, f); control.cameraRotation.y = Mathf.Lerp(camY, 0, f); } } }
28.637681
99
0.525304
[ "Apache-2.0" ]
Mobinlion/Asphault
Assets/Infinity Code/Online maps/Examples (API usage)/ResetCameraRotationExample.cs
1,978
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Morris { public static class ExtensionMethods { /// <summary> /// Gibt den Gegner des Spielers zurück /// </summary> public static Player Opponent(this Player p) { // Es ist in der Regel vermutlich einfacher ~player anstatt player.Opponent() zu // schreiben, Änderungen am Schema von Player sind so jedoch von dem Code, der // Player verwendet, wegabstrahiert und die semantische Bedeutung von Code, // der .Opponent verwendet, ist einfacher zu erkennen (Kapselung). return ~p; } /// <summary> /// Gibt an, ob ein Feld von einem bestimmten Spieler besetzt ist /// </summary> public static bool IsOccupiedBy(this Occupation o, Player p) { return o == (Occupation)p; } private static Random rng = new Random(); /// <summary> /// Gibt ein zufälliges Element der IList zurück /// </summary> public static T ChooseRandom<T>(this IList<T> it) { if (it == null) throw new ArgumentNullException(nameof(it)); return it[rng.Next(it.Count)]; } /// <summary> /// Gibt alle Element in input zurück, für die der Wert, der selector zurückgibt, laut comparer maximal ist /// </summary> public static IEnumerable<T> AllMaxBy<T, TCompare>(this IEnumerable<T> input, Func<T, TCompare> selector, out TCompare finalMax, IComparer<TCompare> comparer = null) { if (input == null) throw new ArgumentNullException(nameof(input)); if (selector == null) throw new ArgumentNullException(nameof(input)); comparer = comparer ?? Comparer<TCompare>.Default; List<T> collector = new List<T>(); // Enthält alle Elemente, die den höchsten gesehenen Wert von selector(element) aufweisen bool hasMax = false; // Ob wir bereits überhaupt ein Element gesehen haben und daher den Wert von max verwenden können TCompare max = default(TCompare); // Der höchste gesehene Wert von selector(element) foreach (T element in input) { TCompare current = selector(element); int comparisonResult = comparer.Compare(current, max); if (!hasMax || comparisonResult > 0) { // Es gibt einen neuen maximalen Wert von selector(element) hasMax = true; max = current; collector.Clear(); collector.Add(element); } else if (comparisonResult == 0) collector.Add(element); } finalMax = max; return collector; } } }
30.419753
167
0.691964
[ "MIT" ]
TwoFX/Morris
Morris/Util/ExtensionMethods.cs
2,478
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using FSQL.Interfaces; using FSQL.ProgramParts.Core; namespace FSQL.ProgramParts.Functions { public class CodeBlock : StatementBase { protected string Name { get; } public CodeBlock(string name, IEnumerable<IStatement> body) { Name = name; Body = body; } private IEnumerable<IStatement> Body { get; } protected override object OnExecute(IExecutionContext ctx, params object[] parms) { object results = null; //var myContext = ctx.Enter(Name); try { foreach (var stmt in Body) { try { results = stmt.Execute(ctx, parms); } catch (Exception ex) { if (ctx.Throw(ex, $"Exception thrown by statement [{stmt}]")) throw; } if (stmt is ReturnStatement) { break; } } } finally { //ctx.Exit(results); } return results; } public override void Dispose() { } public virtual string GetListing() { var sb = new StringBuilder(); sb.AppendLine("{"); foreach (var ln in Body) { sb.AppendLine($" {ln}"); } sb.AppendLine("}"); return sb.ToString(); } public override string ToString() { var sb = new StringBuilder(); //sb.AppendLine($"BEGIN CODEBLOCK: {Name}"); sb.AppendLine("{"); foreach (var ln in Body.Take(3)) { sb.AppendLine($" {ln}"); } if (Body.Count() > 3) sb.AppendLine($" ..."); sb.AppendLine("}"); //sb.AppendLine($" END CODEBLOCK: {Name}"); return sb.ToString(); } protected override string GetTraceMessage(IExecutionContext ctx) { return null; } } }
30.971429
92
0.467712
[ "MIT" ]
Ill-Eagle-Software/FSQL
FSQL/ProgramParts/Functions/CodeBlock.cs
2,168
C#
using Never.Serialization; using Never.WorkFlow.Coordinations; using System; using System.Collections.Generic; using System.Linq; namespace Never.WorkFlow.Repository { /// <summary> /// 内存模式的执行任务仓库 /// </summary> public class MemoryExecutingRepository : IExecutingRepository, ITemplateRepository { #region field private readonly Dictionary<Guid, TaskschedNode> task = null; private readonly Dictionary<Guid, ExecutingNode> executing = null; private readonly Dictionary<string, Template> template = null; #endregion field #region ctor /// <summary> /// /// </summary> public MemoryExecutingRepository() { this.task = new Dictionary<Guid, TaskschedNode>(100); this.executing = new Dictionary<Guid, ExecutingNode>(500); this.template = new Dictionary<string, Template>(20); } #endregion ctor #region executing /// <summary> /// /// </summary> /// <param name="task"></param> /// <param name="nodes"></param> /// <returns></returns> public int Abort(TaskschedNode task, ExecutingNode[] nodes) { return 1; } /// <summary> /// /// </summary> /// <param name="statusArray"></param> /// <returns></returns> public TaskschedNode[] GetAll(TaskschedStatus[] statusArray) { return this.task.Values.Where(o => statusArray.Contains(o.Status)).ToArray(); } /// <summary> /// 查询所有的任务 /// </summary> /// <param name="statusArray"></param> /// <param name="commandType">命令类型</param> /// <returns></returns> public TaskschedNode[] GetAll(TaskschedStatus[] statusArray, string commandType) { return this.task.Values.Where(o => statusArray.Contains(o.Status) && o.CommandType.IsEquals(commandType)).ToArray(); } /// <summary> /// /// </summary> /// <param name="taskId"></param> /// <param name="withAllMessage">是否需要所有消息字段</param> /// <returns></returns> public ExecutingNode[] GetAll(Guid taskId, bool withAllMessage = false) { return this.executing.Values.Where(o => o.TaskId == taskId).ToArray(); } /// <summary> /// /// </summary> /// <param name="usersign"></param> /// <param name="statusArray"></param> /// <param name="startTime"></param> /// <returns></returns> public TaskschedNode[] GetAll(string usersign, TaskschedStatus[] statusArray, DateTime? startTime = null) { if (statusArray != null && statusArray.Length > 0) { return this.task.Values.Where(o => statusArray.Contains(o.Status) && o.UserSign.IsEquals(usersign) && o.StartTime > startTime).ToArray(); } return this.task.Values.Where(o => o.UserSign.IsEquals(usersign) && o.StartTime > startTime).ToArray(); } /// <summary> /// 查询某标识下的所有的任务 /// </summary> /// <param name="commandType">命令类型</param> /// <param name="usersign"></param> /// <param name="statusArray"></param> /// <param name="startTime"></param> /// <returns></returns> public TaskschedNode[] GetAll(string usersign, string commandType, TaskschedStatus[] statusArray, DateTime? startTime = null) { if (statusArray != null && statusArray.Length > 0) { return this.task.Values.Where(o => statusArray.Contains(o.Status) && o.UserSign.IsEquals(usersign) && o.CommandType.IsEquals(commandType) && o.StartTime > startTime).ToArray(); } return this.task.Values.Where(o => o.UserSign.IsEquals(usersign) && o.CommandType.IsEquals(commandType) && o.StartTime > startTime).ToArray(); } /// <summary> /// 查询用户标识的所有任务 /// </summary> /// <param name="statusArray">状态</param> /// <param name="paged">分页查询</param> /// <returns></returns> public virtual TaskschedNode[] GetList(PagedSearch paged, TaskschedStatus[] statusArray) { return this.GetAll(statusArray); } /// <summary> /// 查询用户标识的所有任务 /// </summary> /// <param name="commandType">命令类型</param> /// <param name="statusArray">状态</param> /// <param name="paged">分页查询</param> /// <returns></returns> public virtual TaskschedNode[] GetList(PagedSearch paged, TaskschedStatus[] statusArray, string commandType) { return this.GetAll(statusArray, commandType); } /// <summary> /// 查询用户标识的所有任务 /// </summary> /// <param name="userSign">用户标识</param> /// <param name="statusArray">状态</param> /// <param name="paged">分页查询</param> /// <returns></returns> public virtual TaskschedNode[] GetList(PagedSearch paged, string userSign, TaskschedStatus[] statusArray) { return this.GetAll(userSign, statusArray); } /// <summary> /// 查询用户标识的所有任务 /// </summary> /// <param name="commandType">命令类型</param> /// <param name="userSign">用户标识</param> /// <param name="statusArray">状态</param> /// <param name="paged">分页查询</param> /// <returns></returns> public virtual TaskschedNode[] GetList(PagedSearch paged, string userSign, string commandType, TaskschedStatus[] statusArray) { return this.GetAll(userSign, commandType, statusArray); } /// <summary> /// /// </summary> /// <param name="task"></param> /// <param name="node"></param> /// <returns></returns> public int AllDone(TaskschedNode task, ExecutingNode node) { return 1; } /// <summary> /// /// </summary> /// <param name="task"></param> /// <param name="nodes"></param> /// <returns></returns> public int Save(TaskschedNode task, ExecutingNode[] nodes) { this.task[task.TaskId] = task; foreach (var node in nodes) { this.executing[node.RowId] = node; } return 1; } /// <summary> /// /// </summary> /// <param name="task"></param> /// <param name="node"></param> /// <returns></returns> public int Done(TaskschedNode task, ExecutingNode node) { return 1; } /// <summary> /// /// </summary> /// <param name="task"></param> /// <param name="node"></param> /// <returns></returns> public int Exception(TaskschedNode task, ExecutingNode node) { return 1; } /// <summary> /// /// </summary> /// <param name="task"></param> /// <returns></returns> public int Finish(TaskschedNode task) { return 1; } /// <summary> /// /// </summary> /// <param name="task"></param> /// <param name="node"></param> /// <returns></returns> public int NextWork(TaskschedNode task, ExecutingNode node) { return 1; } /// <summary> /// /// </summary> /// <param name="taskId"></param> /// <returns></returns> public TaskschedNode Get(Guid taskId) { return this.task.ContainsKey(taskId) ? this.task[taskId] : null; } /// <summary> /// /// </summary> /// <param name="taskId"></param> /// <param name="rowId"></param> /// <param name="withAllMessage">是否需要所有消息字段</param> /// <returns></returns> public ExecutingNode Query(Guid taskId, Guid rowId, bool withAllMessage = false) { return this.executing.Values.Where(o => o.TaskId == taskId && o.RowId == rowId).FirstOrDefault(); } #endregion executing #region template /// <summary> /// /// </summary> /// <param name="template"></param> /// <returns></returns> public int Change(Template template) { if (!this.template.ContainsKey(template.Name)) { return 0; } this.template[template.Name] = template; return 1; } /// <summary> /// /// </summary> /// <param name="template"></param> /// <returns></returns> public int Create(Template template) { this.template[template.Name] = template; return 1; } /// <summary> /// 批量创建模板 /// </summary> /// <param name="jsonSerializer"></param> /// <param name="addTemplates"></param> /// <param name="changeTemplates"></param> public void SaveAndChange(IJsonSerializer jsonSerializer, Template[] addTemplates, Template[] changeTemplates) { foreach (var template in addTemplates) { this.Create(template); } foreach (var template in changeTemplates) { this.Change(template); } } /// <summary> /// /// </summary> /// <param name="jsonSerializer"></param> /// <returns></returns> public Template[] GetAll(IJsonSerializer jsonSerializer) { return this.template.Values.ToArray(); } /// <summary> /// /// </summary> /// <param name="jsonSerializer"></param> /// <param name="templateName"></param> /// <returns></returns> public Template Get(IJsonSerializer jsonSerializer, string templateName) { if (!this.template.ContainsKey(templateName)) { return null; } return this.template[templateName]; } /// <summary> /// /// </summary> /// <param name="templateName"></param> /// <returns></returns> public int Remove(string templateName) { if (!this.template.ContainsKey(templateName)) { return 0; } this.template.Remove(templateName); return 1; } #endregion template } }
30.605714
192
0.517084
[ "MIT" ]
daniel1519/never
src/Never.WorkFlow/Repository/MemoryExecutingRepository.cs
11,010
C#
using HyperV.Definitions; namespace HyperV { ///<summary>Defines the configuration of a new virtual machine.</summary> public class VirtualMachineDefinition { ///<summary>Defines the Automatic Start Action settings.</summary> public AutomaticStartDefinition AutomaticStart { get; set; } = new AutomaticStartDefinition(); ///<summary>Defines the Automatic Stop Action settings.</summary> public AutomaticStopDefinition AutomaticStop { get; set; } = new AutomaticStopDefinition(); ///<summary>Defines the Checkpoints settings.</summary> public CheckpointsDefinition Checkpoints { get; set; } = new CheckpointsDefinition(); ///<summary>Defines the Integration Services settings.</summary> public IntegrationServicesDefinition IntegrationServices { get; set; } = new IntegrationServicesDefinition(); ///<summary>Defines the Memory settings.</summary> public MemoryDefinition Memory { get; set; } = new MemoryDefinition(); ///<summary>The name of the virtual machine.</summary> public string Name { get; set; } ///<summary>Defines the settings for up to 8 Network Adapters.</summary> ///<remarks>The configuration includes one Network Adapter by default.</remarks> public NetworkAdaptersDefinition NetworkAdapters { get; set; } = new NetworkAdaptersDefinition(); ///<summary>Notes for the virtual machine.</summary> public string Notes { get; set; } private string path; ///<summary>The path where the configuration files will be stored.</summary> ///<remarks>Setting the configuration path will reset the Checkpoints and Smart Paging paths to their defaults.</remarks> public string Path { get { return path; } set { path = value; Checkpoints.Path = value; SmartPaging.Path = value; } } ///<summary>Defines the Processor settings.</summary> public ProcessorDefinition Processor { get; set; } = new ProcessorDefinition(); ///<summary>Defines the settings for up to 4 SCSI Controllers.</summary> ///<remarks>The configuration includes one SCSI Controller by default.</remarks> public ScsiControllersDefinition ScsiControllers { get; set; } = new ScsiControllersDefinition(); ///<summary>Defines the Security settings.</summary> public SecurityDefinition Security { get; set; } = new SecurityDefinition(); ///<summary>Defines the Smart Paging settings.</summary> public SmartPagingDefinition SmartPaging { get; set; } = new SmartPagingDefinition(); ///<summary>Initializes a new instance of the <see cref="VirtualMachineDefinition"/> class with the specified virtual machine name and configuration path.</summary> ///<param name="name">The name of the virtual machine.</param> ///<param name="path">The path where the configuration files will be stored.</param> public VirtualMachineDefinition(string name, string path) { Name = name; Notes = ""; Path = path; ScsiControllers.Add(new ScsiController()); NetworkAdapters.Add(new NetworkAdapter()); } } }
45.69863
172
0.658873
[ "MIT" ]
Jerhynh/HyperV.NET
HyperV.NET/VirtualMachineDefinition.cs
3,338
C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace Aula1406 { public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } } }
24
99
0.585069
[ "MIT" ]
bernardodn/asp.net-projetos
Aula1406_Views_Controllers/Aula1406/App_Start/RouteConfig.cs
578
C#
// Copyright 2019 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using Google.Api.Ads.AdManager.Lib; using Google.Api.Ads.AdManager.v202105; using System; namespace Google.Api.Ads.AdManager.Examples.CSharp.v202105 { /// <summary> /// This code example creates new activities. To determine which activities /// exist, run GetAllActivities.cs. /// </summary> public class CreateActivities : SampleBase { /// <summary> /// Returns a description about the code example. /// </summary> public override string Description { get { return "This code example creates new activities. To determine which activities " + "exist, run GetAllActivities.cs."; } } /// <summary> /// Main method, to run this code example as a standalone application. /// </summary> public static void Main() { CreateActivities codeExample = new CreateActivities(); Console.WriteLine(codeExample.Description); codeExample.Run(new AdManagerUser()); } /// <summary> /// Run the code example. /// </summary> public void Run(AdManagerUser user) { using (ActivityService activityService = user.GetService<ActivityService>()) { // Set the ID of the activity group this activity is associated with. long activityGroupId = long.Parse(_T("INSERT_ACTIVITY_GROUP_ID_HERE")); // Create a daily visits activity. Activity dailyVisitsActivity = new Activity(); dailyVisitsActivity.name = "Activity #" + GetTimeStamp(); dailyVisitsActivity.activityGroupId = activityGroupId; dailyVisitsActivity.type = ActivityType.DAILY_VISITS; // Create a custom activity. Activity customActivity = new Activity(); customActivity.name = "Activity #" + GetTimeStamp(); customActivity.activityGroupId = activityGroupId; customActivity.type = ActivityType.CUSTOM; try { // Create the activities on the server. Activity[] activities = activityService.createActivities(new Activity[] { dailyVisitsActivity, customActivity }); // Display results. if (activities != null) { foreach (Activity newActivity in activities) { Console.WriteLine( "An activity with ID \"{0}\", name \"{1}\", and type \"{2}\" " + "was created.", newActivity.id, newActivity.name, newActivity.type); } } else { Console.WriteLine("No activities were created."); } } catch (Exception e) { Console.WriteLine("Failed to create activities. Exception says \"{0}\"", e.Message); } } } } }
37.304762
100
0.537912
[ "Apache-2.0" ]
googleads/googleads-dotnet-lib
examples/AdManager/CSharp/v202105/ActivityService/CreateActivities.cs
3,917
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("GitNoob")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("MIT license")] [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("6616fb99-930a-4ac8-97ca-f57bbbdf0a59")] // Version Information via GlobalAssemblyInfo.cs
40.48
84
0.775692
[ "MIT" ]
MircoBabin/GitNoob
src/GitNoob.ProjectTypes/Properties/AssemblyInfo.cs
1,014
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNative.DocumentDB.V20210115 { /// <summary> /// An Azure Cosmos DB trigger. /// </summary> [AzureNativeResourceType("azure-native:documentdb/v20210115:SqlResourceSqlTrigger")] public partial class SqlResourceSqlTrigger : Pulumi.CustomResource { /// <summary> /// The location of the resource group to which the resource belongs. /// </summary> [Output("location")] public Output<string?> Location { get; private set; } = null!; /// <summary> /// The name of the ARM resource. /// </summary> [Output("name")] public Output<string> Name { get; private set; } = null!; [Output("resource")] public Output<Outputs.SqlTriggerGetPropertiesResponseResource?> Resource { get; private set; } = null!; /// <summary> /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". /// </summary> [Output("tags")] public Output<ImmutableDictionary<string, string>?> Tags { get; private set; } = null!; /// <summary> /// The type of Azure resource. /// </summary> [Output("type")] public Output<string> Type { get; private set; } = null!; /// <summary> /// Create a SqlResourceSqlTrigger 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 SqlResourceSqlTrigger(string name, SqlResourceSqlTriggerArgs args, CustomResourceOptions? options = null) : base("azure-native:documentdb/v20210115:SqlResourceSqlTrigger", name, args ?? new SqlResourceSqlTriggerArgs(), MakeResourceOptions(options, "")) { } private SqlResourceSqlTrigger(string name, Input<string> id, CustomResourceOptions? options = null) : base("azure-native:documentdb/v20210115:SqlResourceSqlTrigger", 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:documentdb/v20210115:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20190801:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20190801:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20191212:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20191212:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20200301:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20200301:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20200401:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20200401:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20200601preview:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20200601preview:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20200901:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20200901:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20210301preview:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20210301preview:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20210315:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20210315:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20210401preview:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20210401preview:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-native:documentdb/v20210415:SqlResourceSqlTrigger"}, new Pulumi.Alias { Type = "azure-nextgen:documentdb/v20210415:SqlResourceSqlTrigger"}, }, }; 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 SqlResourceSqlTrigger 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 SqlResourceSqlTrigger Get(string name, Input<string> id, CustomResourceOptions? options = null) { return new SqlResourceSqlTrigger(name, id, options); } } public sealed class SqlResourceSqlTriggerArgs : Pulumi.ResourceArgs { /// <summary> /// Cosmos DB database account name. /// </summary> [Input("accountName", required: true)] public Input<string> AccountName { get; set; } = null!; /// <summary> /// Cosmos DB container name. /// </summary> [Input("containerName", required: true)] public Input<string> ContainerName { get; set; } = null!; /// <summary> /// Cosmos DB database name. /// </summary> [Input("databaseName", required: true)] public Input<string> DatabaseName { get; set; } = null!; /// <summary> /// The location of the resource group to which the resource belongs. /// </summary> [Input("location")] public Input<string>? Location { get; set; } /// <summary> /// A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. /// </summary> [Input("options")] public Input<Inputs.CreateUpdateOptionsArgs>? Options { get; set; } /// <summary> /// The standard JSON format of a trigger /// </summary> [Input("resource", required: true)] public Input<Inputs.SqlTriggerResourceArgs> Resource { get; set; } = null!; /// <summary> /// The name of the resource group. The name is case insensitive. /// </summary> [Input("resourceGroupName", required: true)] public Input<string> ResourceGroupName { get; set; } = null!; [Input("tags")] private InputMap<string>? _tags; /// <summary> /// Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". /// </summary> public InputMap<string> Tags { get => _tags ?? (_tags = new InputMap<string>()); set => _tags = value; } /// <summary> /// Cosmos DB trigger name. /// </summary> [Input("triggerName")] public Input<string>? TriggerName { get; set; } public SqlResourceSqlTriggerArgs() { } } }
51.640884
509
0.630256
[ "Apache-2.0" ]
sebtelko/pulumi-azure-native
sdk/dotnet/DocumentDB/V20210115/SqlResourceSqlTrigger.cs
9,347
C#
using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Text; using Epi.Analysis; using Epi.Collections; using Epi.Core.AnalysisInterpreter; using Epi.Data; using Epi.Windows.Dialogs; using Epi.Windows.Analysis; namespace Epi.Windows.Analysis.Dialogs { public partial class BuildKeyDialog : CommandDesignDialog { #region Private Members string relatedTable = string.Empty; private object selectedDataSource = null; string callingDialog = string.Empty; List<string> relatedFields = new List<string>(); List<string> currentFields = new List<string>(); List<string> relatedFields2 = new List<string>(); List<string> currentFields2 = new List<string>(); bool LoadIsFinished = false; /// <summary> /// key variable /// </summary> public string key = string.Empty; #endregion #region Public Properties /// <summary> /// List of related table column names. /// </summary> public string RelatedTable { get { return relatedTable; } set { relatedTable = value; } } /// <summary> /// selectedDataSource from calling dialog. Used to get the column names for the related table. /// </summary> public object SelectedDataSource { get { return selectedDataSource; } set { selectedDataSource = value; } } /// <summary> /// CallingDialog from the dialog that called this dialog. Used to determine if BuildKeyDialog was called by the /// MERGE or RELATE command dialogs so the appropriate instructions can be dispalyed. /// </summary> public string CallingDialog { get { return callingDialog; } set { callingDialog = value; } } /// <summary> /// KEY statement /// </summary> public string Key { get { return key; } set { key = value; } } #endregion #region Constructors /// <summary> /// Default constructor - NOT TO BE USED FOR INSTANTIATION /// </summary> [Obsolete("Use of default constructor not allowed", true)] public BuildKeyDialog() { InitializeComponent(); } /// <summary> /// Constructor for BuildKey dialog /// </summary> public BuildKeyDialog(Epi.Windows.Analysis.Forms.AnalysisMainForm frm) : base(frm) { InitializeComponent(); Construct(); } private void Construct() { if (!this.DesignMode) { this.btnOK.Click += new System.EventHandler(this.btnOK_Click); } } #endregion #region Event Handlers private void ClickHandler(object sender, System.EventArgs e) { ToolStripButton btn = (ToolStripButton)sender; txtKeyComponent.Text += StringLiterals.SPACE; if ((string)btn.Tag == null) { txtKeyComponent.Text += btn.Text; } else { txtKeyComponent.Text += (string)btn.Tag; } txtKeyComponent.Text += StringLiterals.SPACE; } private void btnClear_Click(object sender, EventArgs e) { txtKeyComponent.Text = string.Empty; currentFields.Clear(); relatedFields.Clear(); currentFields2.Clear(); relatedFields2.Clear(); } /// <summary> /// Opens a process to show the related help topic /// </summary> /// <param name="sender">Object that fired the event.</param> /// <param name="e">.NET supplied event args.</param> protected override void btnHelp_Click(object sender, System.EventArgs e) { System.Diagnostics.Process.Start("http://www.cdc.gov/epiinfo/user-guide/classic-analysis/managedata.html"); } private void BuildKeyDialog_Load(object sender, EventArgs e) { if (SelectedDataSource != null) { if (SelectedDataSource is IDbDriver) { IDbDriver db = SelectedDataSource as IDbDriver; //--EI-114 // relatedFields = db.GetTableColumnNames(RelatedTable); if (RelatedTable.Contains(StringLiterals.SPACE)) { string pstr = "Select TOP 2 * from [" + RelatedTable + "]"; DataTable relfields = DBReadExecute.GetDataTable(db, pstr); foreach (DataColumn dc in relfields.Columns) { relatedFields.Add(dc.ColumnName); } } else { relatedFields = db.GetTableColumnNames(RelatedTable); } //--- } else if (SelectedDataSource is Project) { Project project = SelectedDataSource as Project; if(project.Views.Exists(relatedTable)) { foreach(Epi.Fields.IField field in project.Views[RelatedTable].Fields) { if (!(field is Epi.Fields.LabelField) & !(field is Epi.Fields.CommandButtonField) & !(field is Epi.Fields.PhoneNumberField)//EI-705 & !(field is Epi.Fields.MultilineTextField) & !(field is Epi.Fields.GroupField) & !(field is Epi.Fields.CheckBoxField) & !(field is Epi.Fields.ImageField) & !(field is Epi.Fields.OptionField) & !(field is Epi.Fields.GridField) & !(field is Epi.Fields.MirrorField)) relatedFields.Add(field.Name); } } else { relatedFields = project.GetTableColumnNames(RelatedTable); } } if (this.EpiInterpreter.Context.DataSet != null) { View CurrentView = null; bool currentReadIdentifierIsView = false; if(this.EpiInterpreter.Context.CurrentProject != null) { currentReadIdentifierIsView = this.EpiInterpreter.Context.CurrentProject.IsView(this.EpiInterpreter.Context.CurrentRead.Identifier); } if (currentReadIdentifierIsView) { CurrentView = this.EpiInterpreter.Context.CurrentProject.GetViewByName(this.EpiInterpreter.Context.CurrentRead.Identifier);//EI-705 foreach (DataColumn column in this.EpiInterpreter.Context.DataSet.Tables["Output"].Columns) { if ((CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.LabelField)) & (CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.CommandButtonField)) & (CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.PhoneNumberField)) & (CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.MultilineTextField)) & (CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.GroupField)) & (CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.CheckBoxField)) & (CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.ImageField)) & (CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.OptionField)) & (CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.GridField)) & (CurrentView.Fields.Exists(column.ColumnName) && !(CurrentView.Fields[column.ColumnName] is Epi.Fields.MirrorField))) currentFields.Add(column.ColumnName); } } else { foreach (DataColumn column in this.EpiInterpreter.Context.DataSet.Tables["Output"].Columns) { currentFields.Add(column.ColumnName); } } } currentFields.Sort(); } //rdbCurrentTable.Checked = true; relatedFields.Sort(); currentFields.Sort(); //cmbAvailableVariables2.DataSource = relatedFields; lbxRelatedTableFields.DataSource = relatedFields; //cmbAvailableVariables.DataSource = currentFields; lbxCurrentTableFields.DataSource = currentFields; lbxCurrentTableFields.SelectedIndex = -1; lbxRelatedTableFields.SelectedIndex = -1; if (CallingDialog == "RELATE") { lblBuildKeyInstructions.Text = SharedStrings.BUILDKEY_RELATE_INSTRUCTIONS; } else { lblBuildKeyInstructions.Text = SharedStrings.BUILDKEY_MERGE_INSTRUCTIONS; } this.LoadIsFinished = true; } //private void selectedTable_CheckedChanged(object sender, EventArgs e) //{ // if (rdbRelatedTable.Checked) // { // if (!string.IsNullOrEmpty(txtKeyComponent.Text)) // { // lbxCurrentTableFields.Items.Add(txtKeyComponent.Text); // } // } // else // { // if (!string.IsNullOrEmpty(txtKeyComponent.Text)) // { // lbxRelatedTableFields.Items.Add(txtKeyComponent.Text); // } // } // txtKeyComponent.Text = string.Empty; // cmbAvailableVariables.SelectedIndex = -1; //} //private void cmbAvailableVariables_SelectedIndexChanged(object sender, EventArgs e) //{ // if (cmbAvailableVariables.SelectedIndex != -1) // { // string strSelectedVar = cmbAvailableVariables.SelectedItem.ToString(); // txtKeyComponent.Text += FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar; // cmbAvailableVariables.SelectedIndex = -1; // } //} //private void cmbAvailableVariables2_SelectedIndexChanged(object sender, EventArgs e) //{ // if (cmbAvailableVariables.SelectedIndex != -1) // { // string strSelectedVar = cmbAvailableVariables2.SelectedItem.ToString(); // txtKeyComponent.Text += FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar; // cmbAvailableVariables2.SelectedIndex = -1; // } //} /// <summary> /// Override of OK click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void btnOK_Click(object sender, EventArgs e) { if (currentFields2.Count == relatedFields2.Count) { StringBuilder builtKey = new StringBuilder(); for (int i = 0; i < currentFields2.Count; i++) { if (i > 0) { builtKey.Append(StringLiterals.SPACE); builtKey.Append("AND"); builtKey.Append(StringLiterals.SPACE); } builtKey.Append(currentFields2[i]); builtKey.Append(StringLiterals.SPACE); builtKey.Append(StringLiterals.COLON); builtKey.Append(StringLiterals.COLON); builtKey.Append(StringLiterals.SPACE); builtKey.Append(relatedFields2[i]); } this.Key = builtKey.ToString(); this.DialogResult = DialogResult.OK; this.Hide(); } else { MsgBox.ShowError(SharedStrings.ERROR_RELATE_KEYS); } } #endregion private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { //ListBox btn = (ListBox)sender; //txtKeyComponent.Text += StringLiterals.SPACE; //switch(btn.Text) //{ // case "\"Yes\"": // txtKeyComponent.Text += "(+)"; // break; // case "\"No\"": // txtKeyComponent.Text += "(-)"; // break; // case "\"Missing\"": // txtKeyComponent.Text += "(.)"; // break; // default: // txtKeyComponent.Text += btn.Text; // break; //} //txtKeyComponent.Text += StringLiterals.SPACE; } private void lbxRelatedTableFields_SelectedIndexChanged(object sender, EventArgs e) { if (this.LoadIsFinished && lbxCurrentTableFields.SelectedIndex != -1 && lbxRelatedTableFields.SelectedIndex != -1 ) { string strSelectedVar = lbxCurrentTableFields.SelectedItem.ToString(); AddLabel.Text = FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar; AddLabel.Text += StringLiterals.SPACE; AddLabel.Text += " = "; AddLabel.Text += StringLiterals.SPACE; strSelectedVar = lbxRelatedTableFields.SelectedItem.ToString(); AddLabel.Text += FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar; } else { AddLabel.Text = ""; } } private void lbxCurrentTableFields_SelectedIndexChanged(object sender, EventArgs e) { if (this.LoadIsFinished && lbxCurrentTableFields.SelectedIndex != -1 && lbxRelatedTableFields.SelectedIndex != -1) { string strSelectedVar = lbxCurrentTableFields.SelectedItem.ToString(); AddLabel.Text = FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar; AddLabel.Text += StringLiterals.SPACE; AddLabel.Text += " = "; AddLabel.Text += StringLiterals.SPACE; strSelectedVar = lbxRelatedTableFields.SelectedItem.ToString(); AddLabel.Text += FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar; } else { AddLabel.Text = ""; } } private void BackCommandButton_Click(object sender, EventArgs e) { //txtKeyComponent.SelectionStart = txtKeyComponent.Text.Length; if(txtKeyComponent.Text.Length > 0) { txtKeyComponent.Text = txtKeyComponent.Text.Remove(txtKeyComponent.Text.Length - 1); } } private void EraseWordCommandButton_Click(object sender, EventArgs e) { if (txtKeyComponent.Text.Length > 0 && txtKeyComponent.Text.LastIndexOf(" ") > 0) { txtKeyComponent.Text = txtKeyComponent.Text.Remove(txtKeyComponent.Text.LastIndexOf(" ")); } } private void AddCommandButton_Click(object sender, EventArgs e) { if (lbxCurrentTableFields.SelectedIndex != -1 && lbxRelatedTableFields.SelectedIndex != -1 ) { string strSelectedVar = lbxCurrentTableFields.SelectedItem.ToString(); currentFields2.Add(FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar); txtKeyComponent.AppendText(FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar); lbxCurrentTableFields.SelectedIndex = -1; txtKeyComponent.AppendText(StringLiterals.SPACE); txtKeyComponent.AppendText(" = "); /* switch (this.listBox1.Text) { case "\"Yes\"": txtKeyComponent.Text += "(+)"; break; case "\"No\"": txtKeyComponent.Text += "(-)"; break; case "\"Missing\"": txtKeyComponent.Text += "(.)"; break; default: txtKeyComponent.Text += this.listBox1.Text; break; }*/ txtKeyComponent.AppendText(StringLiterals.SPACE); strSelectedVar = lbxRelatedTableFields.SelectedItem.ToString(); relatedFields2.Add(FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar); txtKeyComponent.AppendText(FieldNameNeedsBrackets(strSelectedVar) ? Util.InsertInSquareBrackets(strSelectedVar) : strSelectedVar); lbxRelatedTableFields.SelectedIndex = -1; txtKeyComponent.AppendText("\n"); AddLabel.Text = ""; } } #region Private Methods #endregion } }
38.906188
399
0.514673
[ "Apache-2.0" ]
keymind/Epi-Info-Community-Edition
Epi.Windows.Analysis/Dialogs/BuildKeyDialog.cs
19,492
C#
using messanger.Server.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace messanger.Server.EfConfigurations { public class FriendshipRequestEfConfiguration : IEntityTypeConfiguration<FriendshipRequest> { public void Configure(EntityTypeBuilder<FriendshipRequest> builder) { builder.ToTable("FriendshipRequest"); builder.HasKey(f => new { f.IdSender, f.IdReceiver }) .HasName("FriendshipRequest_pk"); builder.Property(f => f.CreatedAt).IsRequired(); builder.HasOne(f => f.IdSenderNavigation) .WithMany(s => s.SentFriendshipRequests) .HasForeignKey(f => f.IdSender) .HasConstraintName("FriendshipRequest_Sender") .OnDelete(DeleteBehavior.ClientSetNull); builder.HasOne(f => f.IdReceiverNavigation) .WithMany(r => r.ReceivedFriendshipRequests) .HasForeignKey(f => f.IdReceiver) .HasConstraintName("FriendshipRequest_Receiver") .OnDelete(DeleteBehavior.ClientSetNull); } } }
36.75
95
0.647109
[ "Apache-2.0" ]
xlegodroit/blazor-messanger
Server/EfConfigurations/FriendshipRequestEfConfiguration.cs
1,178
C#
using System; using System.Linq; namespace _02TheLift { class Program { static void Main(string[] args) { int peopleWaiting = int.Parse(Console.ReadLine()); int[] wagon = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); int peopleCurrentWagon = 0; int peopleOnTheLift = 0; bool NoPeople = false; //finds a place for the tourist on a lift for (int i = 0; i < wagon.Length; i++) { //every wagon should have a maximum of 4 people while (wagon[i] < 4) { wagon[i]++; peopleCurrentWagon++; int wagonPeople = peopleOnTheLift + peopleCurrentWagon; if (wagonPeople == peopleWaiting) { NoPeople = true; break; } } peopleOnTheLift += peopleCurrentWagon; //if there is no more waiting people stop the program if (NoPeople) { break; } peopleCurrentWagon = 0; } if (peopleWaiting > peopleOnTheLift) { //if there are still people on the queue and no more available space, Console.WriteLine($"There isn't enough space! {peopleWaiting - peopleOnTheLift} people in a queue!"); Console.WriteLine(string.Join(" ", wagon)); } else if (peopleWaiting < wagon.Length * 4 && wagon.Any(w => w < 4)) { //if there are no more people and the lift have empty spots Console.WriteLine("The lift has empty spots!"); Console.WriteLine(string.Join(" ", wagon)); } else if (wagon.All(w => w == 4) && NoPeople) { //if the lift is full and there are no more people in the queue Console.WriteLine(string.Join(" ", wagon)); } } } }
34.666667
117
0.475733
[ "MIT" ]
StasiS-web/SoftuniCourse
C# Fundamentals/Mid-Exams/1.02TheLift/02TheLift.cs
2,186
C#
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ using System; using System.Collections.Generic; using Aliyun.Acs.Core.Transform; using Aliyun.Acs.schedulerx2.Model.V20190430; namespace Aliyun.Acs.schedulerx2.Transform.V20190430 { public class GrantPermissionResponseUnmarshaller { public static GrantPermissionResponse Unmarshall(UnmarshallerContext context) { GrantPermissionResponse grantPermissionResponse = new GrantPermissionResponse(); grantPermissionResponse.HttpResponse = context.HttpResponse; grantPermissionResponse.RequestId = context.StringValue("GrantPermission.RequestId"); grantPermissionResponse.Code = context.IntegerValue("GrantPermission.Code"); grantPermissionResponse.Success = context.BooleanValue("GrantPermission.Success"); grantPermissionResponse.Message = context.StringValue("GrantPermission.Message"); return grantPermissionResponse; } } }
39.697674
89
0.7686
[ "Apache-2.0" ]
awei1688/aliyun-openapi-net-sdk
aliyun-net-sdk-schedulerx2/Schedulerx2/Transform/V20190430/GrantPermissionResponseUnmarshaller.cs
1,707
C#
using AutoMapper; using ODMIdentity.Admin.Api.Dtos.Roles; using ODMIdentity.Admin.Api.Dtos.Users; using Skoruba.IdentityServer4.Admin.BusinessLogic.Identity.Dtos.Identity; namespace ODMIdentity.Admin.Api.Mappers { public class IdentityMapperProfile<TRoleDto, TRoleDtoKey, TUserRolesDto, TUserDtoKey, TUserClaimsDto, TUserClaimDto, TUserProviderDto, TUserProvidersDto, TUserChangePasswordDto, TRoleClaimDto, TRoleClaimsDto> : Profile where TUserClaimsDto : UserClaimsDto<TUserDtoKey> where TUserClaimDto : UserClaimDto<TUserDtoKey> where TRoleDto : RoleDto<TRoleDtoKey> where TUserRolesDto : UserRolesDto<TRoleDto, TUserDtoKey, TRoleDtoKey> where TUserProviderDto : UserProviderDto<TUserDtoKey> where TUserProvidersDto : UserProvidersDto<TUserDtoKey> where TUserChangePasswordDto : UserChangePasswordDto<TUserDtoKey> where TRoleClaimsDto : RoleClaimsDto<TRoleDtoKey> where TRoleClaimDto : RoleClaimDto<TRoleDtoKey> { public IdentityMapperProfile() { // entity to model CreateMap<TUserClaimsDto, UserClaimsApiDto<TUserDtoKey>>(MemberList.Destination); CreateMap<TUserClaimsDto, UserClaimApiDto<TUserDtoKey>>(MemberList.Destination); CreateMap<UserClaimApiDto<TUserDtoKey>, TUserClaimsDto>(MemberList.Source); CreateMap<TUserClaimDto, UserClaimApiDto<TUserDtoKey>>(MemberList.Destination); CreateMap<TUserRolesDto, UserRolesApiDto<TRoleDto>>(MemberList.Destination); CreateMap<UserRoleApiDto<TUserDtoKey, TRoleDtoKey>, TUserRolesDto>(MemberList.Destination); CreateMap<TUserProviderDto, UserProviderApiDto<TUserDtoKey>>(MemberList.Destination); CreateMap<TUserProvidersDto, UserProvidersApiDto<TUserDtoKey>>(MemberList.Destination); CreateMap<UserProviderDeleteApiDto<TUserDtoKey>, TUserProviderDto>(MemberList.Source); CreateMap<UserChangePasswordApiDto<TUserDtoKey>, TUserChangePasswordDto>(MemberList.Destination); CreateMap<RoleClaimsApiDto<TRoleDtoKey>, TRoleClaimsDto>(MemberList.Source); CreateMap<RoleClaimApiDto<TRoleDtoKey>, TRoleClaimDto>(MemberList.Destination); CreateMap<RoleClaimApiDto<TRoleDtoKey>, TRoleClaimsDto>(MemberList.Destination); } } }
55.738095
222
0.754378
[ "MIT" ]
omikolaj/IdentityServer4-Admin
ODMIdentity/src/ODMIdentity.Admin.Api/Mappers/IdentityMapperProfile.cs
2,343
C#
/* * Exchange Web Services Managed API * * Copyright (c) Microsoft Corporation * All rights reserved. * * MIT License * * 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.Reflection; // Assembly information [assembly: AssemblyTitle("Microsoft Exchange Managed API")] [assembly: AssemblyDescription("Microsoft Exchange Web Services (EWS Managed API")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyProduct("Microsoft Exchange Managed API")] [assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] // Master branch will have version as 0.0.0.0, when a stable branch is created // this file will be updated with the appropriate version number and the release // will be built from there. [assembly: AssemblyVersion("2.2.1")] [assembly: AssemblyFileVersion("2.2.1.0")]
48.564103
94
0.751848
[ "MIT" ]
AlbertoMonteiro/ews-managed-api
Properties/AssemblyInfoOpenSource.cs
1,895
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Xunit.Abstractions; namespace Microsoft.Coyote.SystematicTesting.Tests.Tasks { public class TaskExceptionTests : Production.Tests.Tasks.TaskExceptionTests { public TaskExceptionTests(ITestOutputHelper output) : base(output) { } public override bool SystematicTest => true; } }
23.222222
79
0.691388
[ "MIT" ]
Bhaskers-Blu-Org2/coyote
Tests/SystematicTesting.Tests/Tasks/TaskExceptionTests.cs
420
C#
using Microsoft.VisualStudio.TestTools.UnitTesting; using NoTenKee; namespace NoTenKeeTest2 { /// <summary> /// キーブレイク関連テスト /// </summary> [TestClass] public class NoTenKeetest_KeyBreak { /// <summary> /// 単票形式キーブレイクなし /// </summary> [TestMethod] public void TestMethod_NoBreak_Single_p1() { string[] args = { ConstTest.XML_PATH + "NoTenkee_environment.xml", ConstTest.XML_PATH + "Excel_Report_SINGLE_NoKeyBreake.xml", ConstTest.INPUT_PATH + "testData_NoBreak_Single_p1.csv", TestUtil.CreateOutputPath(ConstTest.OUTPUT_PATH, "Excel_Report_SINGLE_NoKeyBreake") }; NotenKee notenkee = new NotenKee(); notenkee.Execute(args); } /// <summary> /// 単票形式キーブレイクなし 3ページで新しいBook 3ページ出力 /// </summary> [TestMethod] public void TestMethod_NoBreak_Single_p3() { string[] args = { ConstTest.XML_PATH + "NoTenkee_environment.xml", ConstTest.XML_PATH + "Excel_Report_SINGLE_NoKeyBreake.xml", ConstTest.INPUT_PATH + "testData_NoBreak_Single_p3.csv", TestUtil.CreateOutputPath(ConstTest.OUTPUT_PATH, "Excel_Report_SINGLE_NoKeyBreake") }; NotenKee notenkee = new NotenKee(); notenkee.Execute(args); } /// <summary> /// 単票形式キーブレイクなし 3ページで新しいBook 4ページ出力 /// </summary> [TestMethod] public void TestMethod_NoBreak_Single_4() { string[] args = { ConstTest.XML_PATH + "NoTenkee_environment.xml", ConstTest.XML_PATH + "Excel_Report_SINGLE_NoKeyBreake.xml", ConstTest.INPUT_PATH + "testData_NoBreak_Single_p4.csv", TestUtil.CreateOutputPath(ConstTest.OUTPUT_PATH, "Excel_Report_SINGLE_NoKeyBreake") }; NotenKee notenkee = new NotenKee(); notenkee.Execute(args); } /// <summary> /// 表票形式キーブレイクなし /// </summary> [TestMethod] public void TestMethod_NoBreak_List_p1() { string[] args = { ConstTest.XML_PATH + "NoTenkee_environment.xml", ConstTest.XML_PATH + "Excel_Report_N1_NoKeyBreake.xml", ConstTest.INPUT_PATH + "testData_NoBreak_N1_p1.csv", TestUtil.CreateOutputPath(ConstTest.OUTPUT_PATH, "Excel_Report_N1_NoKeyBreake") }; NotenKee notenkee = new NotenKee(); notenkee.Execute(args); } /// <summary> /// 表票形式キーブレイクなし 3ページで新しいBook 3ページ出力 /// </summary> [TestMethod] public void TestMethod_NoBreak_List_p3() { string[] args = { ConstTest.XML_PATH + "NoTenkee_environment.xml", ConstTest.XML_PATH + "Excel_Report_N1_NoKeyBreake.xml", ConstTest.INPUT_PATH + "testData_NoBreak_N1_p3.csv", TestUtil.CreateOutputPath(ConstTest.OUTPUT_PATH, "Excel_Report_N1_NoKeyBreake") }; NotenKee notenkee = new NotenKee(); notenkee.Execute(args); } /// <summary> /// 表票形式キーブレイクなし 3ページで新しいBook 4ページ出力 /// </summary> [TestMethod] public void TestMethod_NoBreak_List_p4() { string[] args = { ConstTest.XML_PATH + "NoTenkee_environment.xml", ConstTest.XML_PATH + "Excel_Report_N1_NoKeyBreake.xml", ConstTest.INPUT_PATH + "testData_NoBreak_N1_p4.csv", TestUtil.CreateOutputPath(ConstTest.OUTPUT_PATH, "Excel_Report_N1_NoKeyBreake") }; NotenKee notenkee = new NotenKee(); notenkee.Execute(args); } } }
34.809091
102
0.585009
[ "MIT" ]
takasgy/NoTenKee
NoTenKeeTest2/NoTenKeetest_KeyBreak.cs
4,109
C#
/* * Copyright (c) 2018 THL A29 Limited, a Tencent company. 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. */ namespace TencentCloud.Iotcloud.V20180614.Models { using Newtonsoft.Json; using System.Collections.Generic; using TencentCloud.Common; public class CreateTaskResponse : AbstractModel { /// <summary> /// 创建的任务ID /// </summary> [JsonProperty("TaskId")] public string TaskId{ get; set; } /// <summary> /// 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 /// </summary> [JsonProperty("RequestId")] public string RequestId{ get; set; } /// <summary> /// For internal usage only. DO NOT USE IT. /// </summary> internal override void ToMap(Dictionary<string, string> map, string prefix) { this.SetParamSimple(map, prefix + "TaskId", this.TaskId); this.SetParamSimple(map, prefix + "RequestId", this.RequestId); } } }
30.27451
83
0.642487
[ "Apache-2.0" ]
ImEdisonJiang/tencentcloud-sdk-dotnet
TencentCloud/Iotcloud/V20180614/Models/CreateTaskResponse.cs
1,612
C#
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using TagHelperDemo.Library; namespace TagHelperDemo.TagHelpers { [HtmlTargetElement("email")] public class EmailTagHelper : TagHelper { [HtmlAttributeName("mail-to")] public string EmailAddress { get; set; } [HtmlAttributeNotBound] [ViewContext] public ViewContext ViewContext { get; set; } // Injected protected IHtmlGenerator Generator { get; } /// <summary> /// Constructor /// </summary> /// <param name="generator">Injected IHtmlGenerator</param> public EmailTagHelper(IHtmlGenerator generator) { Generator = generator; } /// <summary> /// Process Tag /// </summary> /// <param name="context"></param> /// <param name="output"></param> public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { output.Attributes.RemoveAll("mail-to"); if (EmailAddress.IsEmpty()) // Custom Helper function { output.TagName = "span"; return; } if (ValidateEmail(EmailAddress) == true) { output.TagName = "a"; output.Attributes.SetAttribute("href", $"mailto:{EmailAddress}"); } else { output.TagName = "span"; } await base.ProcessAsync(context, output); } /// <summary> /// Email validation /// TODO: Make a better one. This is too basic /// </summary> /// <param name="email"></param> /// <returns></returns> private bool ValidateEmail(string email) { return !email.StartsWith("-") && !email.EndsWith("-") && !email.StartsWith(".") && !email.EndsWith(".") && !email.Contains("..") && !email.Contains(".@") && !email.Contains("@.") && email.CountOf("@") == 1; // Custom Helper function } } }
29.873418
97
0.530508
[ "MIT" ]
jpriestley70/taghelper
src/TagHelperDemo/TagHelperDemo/TagHelpers/EmailTagHelper.cs
2,362
C#
using System; using System.Text.Json; using JetBrains.Space.Common.Json.Serialization; using Xunit; namespace JetBrains.Space.Client.Tests.Json.Serialization { public class SpaceDateTimeConverterTests { private static JsonSerializerOptions CreateSerializerOptions() { var options = new JsonSerializerOptions { MaxDepth = 32, PropertyNameCaseInsensitive = true, PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; options.Converters.Add(new SpaceDateTimeConverter()); return options; } [Fact] public void CanDeserializeDateTime() { var inputJsonString = "{\"iso\":\"2020-10-21T16:30:00.000Z\",\"timestamp\":1603297800000}"; var result = (DateTime)(JsonSerializer.Deserialize(inputJsonString, typeof(DateTime), CreateSerializerOptions()) ?? throw new NullReferenceException("Deserialized value is null.")); Assert.Equal("2020-10-21", result.ToString("yyyy-MM-dd")); Assert.True(result.Kind == DateTimeKind.Utc); } [Fact] public void CanDeserializeNullableDateTime() { var inputJsonString = "{\"iso\":\"2020-10-21T16:30:00.000Z\",\"timestamp\":1603297800000}"; var result = (DateTime?)JsonSerializer.Deserialize(inputJsonString, typeof(DateTime?), CreateSerializerOptions()); Assert.NotNull(result); if (result != null) { Assert.Equal("2020-10-21", result.Value.ToString("yyyy-MM-dd")); Assert.True(result.Value.Kind == DateTimeKind.Utc); } } } }
34.5
193
0.605217
[ "Apache-2.0" ]
JetBrains/space-dotnet-sdk
tests/JetBrains.Space.Client.Tests/Json.Serialization/SpaceDateTimeConverterTests.cs
1,725
C#
namespace _1._Winning_Ticket { using System; using System.Text; using System.Text.RegularExpressions; public class WinningTichet { public static void Main() { string[] tickets = Console .ReadLine() .Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); string pattern = @"(\@{6,20}|\#{6,20}|\${6,20}|\^{6,20})"; StringBuilder result = new StringBuilder(); Regex regex = new Regex(pattern); foreach (string ticket in tickets) { if (ticket.Length != 20) { result.Append($"invalid ticket{Environment.NewLine}"); continue; } Match leftMatch = regex.Match(ticket.Substring(0, 10)); Match rightMatch = regex.Match(ticket.Substring(10, 10)); int minLength = Math.Min(leftMatch.Length, rightMatch.Length); if (!leftMatch.Success || !rightMatch.Success) { result.Append($"ticket \"{ticket}\" - no match{Environment.NewLine}"); continue; } string leftPart = leftMatch.Value.Substring(0, minLength); string rightPart = rightMatch.Value.Substring(0, minLength); if (leftPart == rightPart) { string matchedSymbol = leftPart.Substring(0, 1); if (leftPart.Length == 10) { result.Append($"ticket \"{ ticket}\" - {minLength}{matchedSymbol} Jackpot!{Environment.NewLine}"); } else { result.Append($"ticket \"{ ticket}\" - {minLength}{matchedSymbol}{Environment.NewLine}"); } } else { result.Append($"ticket \"{ ticket}\" - no match{Environment.NewLine}"); } } Console.WriteLine(result.ToString()); } } }
33.015385
122
0.466915
[ "MIT" ]
MiroslavPeychev/C-Sharp-Fundamentals
Regular Expressions/More Exercise/1. Winning Ticket/WinningTichet.cs
2,148
C#
namespace SMOWMS.Domain { /// <summary> /// 最基础的类接口IEntity(可以定义通用性的属性和方法) /// </summary> public interface IEntity { } }
14.5
37
0.57931
[ "MIT" ]
comsmobiler/SmoWMS
Source/SMOWMS.Domain/IEntity.cs
187
C#
namespace H8QMedia.Web.Areas.Users.ViewModels.Manage { using System.Collections.Generic; using Microsoft.AspNet.Identity; public class IndexViewModel { public bool HasPassword { get; set; } public IList<UserLoginInfo> Logins { get; set; } public string PhoneNumber { get; set; } public bool TwoFactor { get; set; } public bool BrowserRemembered { get; set; } } }
22.578947
56
0.648019
[ "MIT" ]
IvoPaunov/Course-Project-ASP.NET-MVC
Source/Web/H8QMedia.Web/Areas/Users/ViewModels/Manage/IndexViewModel.cs
431
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Net; using System.Net.Sockets; using System.IO; using System.Threading; namespace FastCGI { /// <summary> /// Main FastCGI listener class. /// </summary> /// /// <remarks> /// This class manages a connection to a webserver by listening on a given port on localhost and receiving FastCGI /// requests by a webserver like Apache or nginx. /// /// In FastCGI terms, this class implements the responder role. Refer to section 6.2 of the FastCGI specification /// for details. /// /// Use <see cref="OnRequestReceived"/> to get notified of received requests. You can call <see cref="Run"/> to /// enter an infinite loopand let the app handle everything. /// Alternatively, if you want to control the execution flow by yourself, call <see cref="Listen(int)"/> to start /// accepting connections. Then repeatedly call <see cref="Process"/> to handle incoming requests. /// /// If you want to manage the socket connection details by yourself, or for testing purposes, /// you can also call <see cref="ProcessSingleRecord(Stream, Stream)"/> instead of any of the above methods. /// /// See the below example to learn how to accept requests. /// For more detailed information, have a look at the <see cref="Request"/> class. /// /// If you need to fiddle with the FastCGI packets itself, see the <see cref="Record"/> class and read the /// [FastCGI specification](http://www.fastcgi.com/devkit/doc/fcgi-spec.html). /// </remarks> /// /// <example> /// <code> /// // Create a new FCGIApplication, will accept FastCGI requests /// var app = new FCGIApplication(); /// /// // Handle requests by responding with a 'Hello World' message /// app.OnRequestReceived += (sender, request) => /// { /// var responseString = /// "HTTP/1.1 200 OK\n" /// + "Content-Type:text/html\n" /// + "\n" /// + "Hello World!"; /// /// request.WriteResponseASCII(responseString); /// request.Close(); /// }; /// // Start listening on port 19000 /// app.Run(19000); /// /// // You now need a webserver like nginx or Apache to pass incoming requests /// // via FastCGI to your application. /// </code> /// </example> public class FCGIApplication { /// <summary> /// A dictionary of all open <see cref="Request">Requests</see>, indexed by the FastCGI request id. /// </summary> public Dictionary<int, Request> OpenRequests = new Dictionary<int, Request>(); /// <summary> /// True iff this application is currently connected to a webserver. /// </summary> public bool Connected { get { return OpenConnections.Count != 0; } } /// <summary> /// Will be called when a request has been fully received. /// </summary> /// <remarks> /// Please note that multiple requests can be open at the same time. /// This means that this event may fire multiple times before you call <see cref="Request.Close"/> on the first one. /// </remarks> public event EventHandler<Request> OnRequestReceived = null; /// <summary> /// Will be called when a new request is incoming, before it has been fully received. /// </summary> /// <remarks> /// At the time of calling, the request will have neither any parameters nor any request body. /// Please note that multiple requests can be open at the same time. /// </remarks> public event EventHandler<Request> OnRequestIncoming = null; int _Timeout = 5000; /// <summary> /// The read/write timeouts in miliseconds for the listening socket, the connections, and the streams. /// </summary> /// <remarks>Zero or -1 mean infinite timeout.</remarks> public int Timeout { get { return _Timeout; } set { _Timeout = value; ApplyTimeoutSetting(); } } void ApplyTimeoutSetting() { if (ListeningSocket != null) { ListeningSocket.ReceiveTimeout = Timeout; ListeningSocket.SendTimeout = Timeout; } foreach(var connection in OpenConnections) { // Can't set zero timeout, so use int.MaxValue instead var ms = Timeout; if (ms <= 0) ms = int.MaxValue; connection.ReadTimeout = ms; connection.WriteTimeout = ms; } } /// <summary> /// The main listening socket that is used to establish connections. /// </summary> public Socket ListeningSocket { get; protected set; } /// <summary> /// A list of open <see cref="FCGIStream"/> connections. /// </summary> /// <remarks> /// When a connection is accepted from <see cref="ListeningSocket"/>, it is added here. /// Contains all connections that were still open after the last <see cref="Process"/> call. /// </remarks> public List<FCGIStream> OpenConnections { get; protected set; } = new List<FCGIStream>(); /// <summary> /// Starts listening for connections on the given port. /// </summary> /// <remarks> /// Will only accept connections from localhost. Use the <see cref="Listen(IPEndPoint)"/> overload of this method to specify where to listen for connection. /// </remarks> public void Listen(int port) { Listen(new IPEndPoint(IPAddress.Loopback, port)); } /// <summary> /// Starts listening for connections on the given IP end point. /// </summary> public void Listen(IPEndPoint endPoint) { if (ListeningSocket != null) throw new InvalidOperationException("Can not start listening while already listening."); ListeningSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); ListeningSocket.Bind(endPoint); ApplyTimeoutSetting(); ListeningSocket.Listen(1); } IAsyncResult AcceptAsyncResult; bool AcceptIsReady; /// <summary> /// Processes all data available on the current FastCGI connection and handles the received data. /// </summary> /// <remarks> /// Call this repeatedly to process incoming requests. /// Alternatively, you can call <see cref="Run(int)"/> once, which will call <see cref="Listen(int)"/> and execute this method in an infinite loop. /// Internally, this method manages reconnections on the network socket and calls <see cref="ProcessSingleRecord(Stream, Stream)"/>. /// Returns true if a record was read, false otherwise. /// </remarks> public bool Process() { // When listening, but not currently connected, and not yet waiting for an incoming connection, start the connection accept if (ListeningSocket != null && AcceptAsyncResult == null) { AcceptAsyncResult = ListeningSocket.BeginAccept((r) => { AcceptIsReady = true; }, null); } if(AcceptAsyncResult != null && AcceptAsyncResult.IsCompleted) { var connection = ListeningSocket.EndAccept(AcceptAsyncResult); AcceptIsReady = false; AcceptAsyncResult = ListeningSocket.BeginAccept((r) => { AcceptIsReady = true; }, null); var stream = new FCGIStream(connection); OpenConnections.Add(stream); ApplyTimeoutSetting(); } bool readARecord = false; var currentConnections = OpenConnections.ToArray(); foreach(var stream in currentConnections) { if (!stream.IsConnected) OpenConnections.Remove(stream); else readARecord |= ProcessStream(stream, stream); } return readARecord; } /// <summary> /// Reads and handles all <see cref="Record">Records</see> available on the custom inputStream and writes responses to outputStream. /// </summary> /// <remarks> /// Use <see cref="Process"/> if you don't need a custom stream, but instead want to process the records on the current FastCGI connection. /// Returns true if a record was read, false otherwise. /// </remarks> public bool ProcessStream(Stream inputStream, Stream outputStream) { bool readARecord = false; bool finished = false; while(!finished) { var gotRecord = ProcessSingleRecord(inputStream, outputStream); if(gotRecord) readARecord = true; else finished = true; } return readARecord; } /// <summary> /// Tries to read and handle a <see cref="Record"/> from inputStream and writes responses to outputStream. /// </summary> /// <remarks> /// Use <see cref="ProcessStream"/> to process all records on a stream. /// Returns true if a record was read, false otherwise. /// </remarks> public bool ProcessSingleRecord(Stream inputStream, Stream outputStream) { if (!inputStream.CanRead) return false; Record r = Record.ReadRecord(inputStream); // No record found on the stream? if (r == null) { return false; } if (r.Type == Record.RecordType.BeginRequest) { if (OpenRequests.ContainsKey(r.RequestId)) OpenRequests.Remove(r.RequestId); var content = new MemoryStream(r.ContentData); var role = Record.ReadInt16(content); // Todo: Refuse requests for other roles than FCGI_RESPONDER var flags = content.ReadByte(); var keepAlive = (flags & Constants.FCGI_KEEP_CONN) != 0; var request = new Request(r.RequestId, outputStream, this, keepAlive: keepAlive); OpenRequests.Add(request.RequestId, request); var incomingHandler = OnRequestIncoming; if (incomingHandler != null) incomingHandler(this, request); } else if (r.Type == Record.RecordType.AbortRequest || r.Type == Record.RecordType.EndRequest) { OpenRequests.Remove(r.RequestId); } else if (r.Type == Record.RecordType.GetValues) { var getValuesResult = Record.CreateGetValuesResult(1, 1, false); getValuesResult.Send(outputStream); } else { if (OpenRequests.ContainsKey(r.RequestId)) { var request = OpenRequests[r.RequestId]; bool requestReady = request.HandleRecord(r); if (requestReady) { var evh = OnRequestReceived; if (evh != null) OnRequestReceived(this, request); } } } return true; } /// <summary> /// Used internally to notify the app that a <see cref="Request"/> has been closed. /// </summary> /// <param name="request"></param> internal void RequestClosed(Request request) { OpenRequests.Remove(request.RequestId); } /// <summary> /// Used internally to notify the app that a connection has been closed. /// </summary> internal void ConnectionClosed(FCGIStream connection) { if (connection != null && OpenConnections.Contains(connection)) { OpenConnections.Remove(connection); } } /// <summary> /// Stops listening for incoming connections. /// </summary> public void StopListening() { if(ListeningSocket != null) { ListeningSocket.Close(); ListeningSocket = null; } } /// <summary> /// True if the FastCGI application is shutting down. Call <see cref="Stop"/> to initiate the shutdown. /// </summary> public bool IsStopping { get; protected set; } /// <summary> /// Initiate the shutdown of the FastCGI application. This is not blocking, so after calling this the application might still be running for a while. /// </summary> public void Stop() { IsStopping = true; } /// <summary> /// This method never returns! Starts listening for FastCGI requests on the given port. /// </summary> /// <remarks> /// Use <see cref="OnRequestReceived"/> to react to incoming requests. /// Internally, this simply calls <see cref="Listen(int)"/> and enters an infinite loop of <see cref="Process()"/> calls. /// </remarks> public void Run(int port) { IsStopping = false; Listen(port); while (!IsStopping) { var receivedARecord = Process(); // If no records were processed, sleep for 1 millisecond until the next try to reduce CPU load if(!receivedARecord) Thread.Sleep(1); } } } }
37.766578
164
0.555836
[ "MIT" ]
LukasBoersma/FastCGI
FastCGI/FCGIApplication.cs
14,240
C#
using System.Collections.Generic; using System.Linq; using LoggingCalculator.AbstractionsAndModels.Aggregations; using LoggingCalculator.AbstractionsAndModels.Models; namespace Calculator.Aggregations { public class MinAggregator : AggregationsBase, IMinAggregator<CalculatorValue> { public MinAggregator() { FunctionName = nameof(Min); } public CalculatorValue Min(IEnumerable<CalculatorValue> values) => Calculate(values); public CalculatorValue Min(CalculatorValue valueX, CalculatorValue valueY) { return Min(new[] { valueX, valueY }); } protected override decimal CalculateAggregate(IEnumerable<CalculatorValue> values) => values.Min(x => x.Value); } }
29.807692
93
0.695484
[ "MIT" ]
ashyrokoriadov/CalculatorLogger
Calculator/Aggregations/MinAggregator.cs
777
C#
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using System; using System.Collections.Generic; using System.Security.Principal; using System.Text; using System.Threading.Tasks; namespace BlazorFluentUI { public partial class DocumentCardLocation : FluentUIComponentBase { /// <summary> /// Text for the location of the document. /// </summary> [Parameter] public string? Location { get; set; } /// <summary> /// URL to navigate to for this location. /// </summary> [Parameter] public string? LocationHref { get; set; } /// <summary> /// Function to call when the location is clicked. /// </summary> public EventCallback? OnClick { get; set; } private ICollection<IRule> DocumentCardLocationRules { get; set; } = new List<IRule>(); private Rule RootRule = new(); private Rule RootHoverRule = new(); protected override void OnParametersSet() { base.OnParametersSet(); SetStyle(); } protected override Task OnInitializedAsync() { CreateLocalCss(); SetStyle(); return base.OnInitializedAsync(); } protected override void OnThemeChanged() { SetStyle(); } private void CreateLocalCss() { RootRule.Selector = new ClassSelector() { SelectorName = $"ms-DocumentCardLocation" }; DocumentCardLocationRules.Add(RootRule); RootHoverRule.Selector = new ClassSelector() { SelectorName = $"ms-DocumentCardLocation:hover" }; DocumentCardLocationRules.Add(RootHoverRule); } private void SetStyle() { RootRule.Properties = new CssString() { Css = $"color: {Theme.Palette.ThemePrimary};" + $"display: block;" + $"font-size: {Theme.FontStyle.FontSize.Small};" + $"font-weight: {Theme.FontStyle.FontWeight.SemiBold};" + "overflow:hidde;" + "padding: 8px 16px;" + "position: relative;" + "text-decoration: none;" + "text-overflow: ellipsis;" + "white-space:nowrap;" }; RootHoverRule.Properties = new CssString() { Css = $"color: {Theme.Palette.ThemePrimary};" + "cursor: pointer;" }; } } }
30.267442
109
0.541299
[ "MIT" ]
Frank67618/BlazorFluentUI
src/BlazorFluentUI.CoreComponents/DocumentCard/DocumentCardLocation.razor.cs
2,605
C#
using System; using System.Collections.Generic; using System.Linq; using Foundation; using UIKit; namespace PhotosXamarin.iOS { // The UIApplicationDelegate for the application. This class is responsible for launching the // User Interface of the application, as well as listening (and optionally responding) to // application events from iOS. [Register("AppDelegate")] public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate { // // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental"); global::Xamarin.Forms.Forms.Init(); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(); LoadApplication(new App()); return base.FinishedLaunching(app, options); } } }
36.911765
98
0.682869
[ "MIT" ]
gentilijuanmanuel/cross-platform-competition
xamarin/PhotosXamarin/PhotosXamarin.iOS/AppDelegate.cs
1,257
C#
// ============================================================================================================== // Microsoft patterns & practices // CQRS Journey project // ============================================================================================================== // ©2012 Microsoft. All rights reserved. Certain content used with permission from contributors // http://go.microsoft.com/fwlink/p/?LinkID=258575 // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software distributed under the License is // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and limitations under the License. // ============================================================================================================== namespace Infrastructure.Sql.Processes { using System; public class UndispatchedMessages { protected UndispatchedMessages() { } public UndispatchedMessages(Guid id) { this.Id = id; } public Guid Id { get; set; } public string Commands { get; set; } } }
45.709677
114
0.539873
[ "Apache-2.0" ]
wayne-o/delete-me
source/Infrastructure/Sql/Infrastructure.Sql/Processes/UndispatchedMessages.cs
1,420
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.3074 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace MathClient.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", "2.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("MathClient.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
38.555556
176
0.602666
[ "MIT", "Unlicense" ]
NuLL3rr0r/tutorials-in-my-class
C#/SOAP/SOAP_WebServices/Projects/MathClient/MathClient/Properties/Resources.Designer.cs
2,778
C#
using System.Linq; using System.Numerics; using System.Threading.Tasks; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.Primitives; using SixLabors.Shapes; using SixLabors.Svg.Shapes; using SVGSharpie; namespace SixLabors.Svg.Dom { internal sealed partial class SvgDocumentRenderer<TPixel> : SvgElementWalker where TPixel : struct, IPixel<TPixel> { private Matrix3x2 activeMatrix = Matrix3x2.Identity; private readonly Vector2 size; private readonly IImageProcessingContext<TPixel> image; public SvgDocumentRenderer(SizeF size, IImageProcessingContext<TPixel> image) { this.size = size; this.image = image; } public override void VisitSvgElement(SvgSvgElement element) { activeMatrix = element.CalculateViewboxFit(size.X, size.Y).AsMatrix3x2(); base.VisitSvgElement(element); } private Matrix3x2 CalulateUpdatedMatrix(SvgGraphicsElement elm) { var matrix = activeMatrix; foreach (var t in elm.Transform) { matrix = matrix * t.Matrix.AsMatrix3x2(); } return matrix; } public override void VisitGElement(SvgGElement element) { var oldMatrix = activeMatrix; activeMatrix = CalulateUpdatedMatrix(element); base.VisitGElement(element); activeMatrix = oldMatrix; } } }
28.87037
85
0.648493
[ "Apache-2.0" ]
SixLabors/Svg
src/SixLabors.Svg/RenderTree/SvgDocument.cs
1,561
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; using Xamarin.Forms.Xaml; namespace MotoServicesExpress.Views { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class CustomMasterDetailPage : FlyoutPage { public static FlyoutPage Root; public CustomMasterDetailPage() { InitializeComponent(); Root = this; } } }
19.76
60
0.690283
[ "MIT" ]
JomaDoT/MotoServicesExpress
MotoServicesExpress/Views/CustomMasterDetailPage.xaml.cs
496
C#
//--------------------------------------------------------- // <auto-generated> // This code was generated by a tool. Changes to this // file may cause incorrect behavior and will be lost // if the code is regenerated. // // Generated on 2020 October 09 04:47:07 UTC // </auto-generated> //--------------------------------------------------------- using System.CodeDom.Compiler; using System.Runtime.CompilerServices; #nullable enable namespace go { public static partial class runtime_package { [GeneratedCode("go2cs", "0.1.0.0")] private partial struct bucketType { // Value of the bucketType struct private readonly long m_value; public bucketType(long value) => m_value = value; // Enable implicit conversions between long and bucketType struct [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator bucketType(long value) => new bucketType(value); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator long(bucketType value) => value.m_value; // Enable comparisons between nil and bucketType struct [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(bucketType value, NilType nil) => value.Equals(default(bucketType)); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(bucketType value, NilType nil) => !(value == nil); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(NilType nil, bucketType value) => value == nil; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(NilType nil, bucketType value) => value != nil; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator bucketType(NilType nil) => default(bucketType); } } }
39.692308
111
0.62064
[ "MIT" ]
GridProtectionAlliance/go2cs
src/go-src-converted/runtime/mprof_bucketTypeStructOf(long).cs
2,064
C#
namespace NetFusion.Messaging { /// <summary> /// Determines the scope to which a given message publisher /// sends domain events to interested subscribers. /// </summary> public enum IntegrationTypes { /// <summary> /// Used to specify all integration types apply. /// </summary> All = 0, /// <summary> /// The publisher dispatches the event to subscribers located /// within the same process as the publisher. /// </summary> Internal = 1, /// <summary> /// The publisher dispatches the event to subscribers located /// external to the publisher via a central message bus. /// </summary> External = 2 } }
27.740741
69
0.576769
[ "MIT" ]
grecosoft/NetFusion
netfusion/src/Core/NetFusion.Messaging/IntegrationTypes.cs
751
C#
#pragma warning disable 108 // new keyword hiding #pragma warning disable 114 // new keyword hiding namespace Windows.Data.Json { #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented] #endif public static partial class JsonError { #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public static global::Windows.Data.Json.JsonErrorStatus GetJsonStatus( int hresult) { throw new global::System.NotImplementedException("The member JsonErrorStatus JsonError.GetJsonStatus(int hresult) is not implemented in Uno."); } #endif } }
41.736842
146
0.747793
[ "Apache-2.0" ]
AbdalaMask/uno
src/Uno.UWP/Generated/3.0.0.0/Windows.Data.Json/JsonError.cs
793
C#
using Lambda.Tests.Acceptance.Builders; namespace Lambda.Tests.Acceptance { internal static class Docker { internal static TestingApiBuilder TestingApi => new TestingApiBuilder(); } }
22.777778
80
0.731707
[ "MIT" ]
joaoasrosa/aws-sam-local-blog
tests/Lambda.Tests.Acceptance/Docker.cs
207
C#
using Juce.Core.Tickable; using Playground.Content.Stage.VisualLogic.UseCases.GenerateSections; namespace Playground.Content.Stage.VisualLogic.Tickables { public class GenerateSectionsTickable : ActivableTickable { private readonly IGenerateSectionsUseCase generateSectionsUseCase; public GenerateSectionsTickable(IGenerateSectionsUseCase generateSectionsUseCase) : base(active: false) { this.generateSectionsUseCase = generateSectionsUseCase; } protected override void ActivableTick() { generateSectionsUseCase.Execute(); } } }
29.761905
111
0.7264
[ "MIT" ]
Guillemsc/Playground
Assets/Playground/Scripts/Runtime/Content/Stage/VisualLogic/Tickables/GenerateSectionsTickable.cs
627
C#
using System.Resources; 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("TaskDelayClock")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TaskDelayClock")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // 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")]
34.935484
84
0.745152
[ "Apache-2.0" ]
NoleHealth/xamarin-forms-book-preview-2
Chapter20/TaskDelayClock/TaskDelayClock/TaskDelayClock/Properties/AssemblyInfo.cs
1,086
C#
// 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. //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by google-apis-code-generator 1.5.1 // C# generator version: 1.32.2 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ /** * \brief * Google Fonts Developer API Version v1 * * \section ApiInfo API Version Information * <table> * <tr><th>API * <td><a href='https://developers.google.com/fonts/docs/developer_api'>Google Fonts Developer API</a> * <tr><th>API Version<td>v1 * <tr><th>API Rev<td>20160302 (426) * <tr><th>API Docs * <td><a href='https://developers.google.com/fonts/docs/developer_api'> * https://developers.google.com/fonts/docs/developer_api</a> * <tr><th>Discovery Name<td>webfonts * </table> * * \section ForMoreInfo For More Information * * The complete API documentation for using Google Fonts Developer API can be found at * <a href='https://developers.google.com/fonts/docs/developer_api'>https://developers.google.com/fonts/docs/developer_api</a>. * * For more information about the Google APIs Client Library for .NET, see * <a href='https://developers.google.com/api-client-library/dotnet/get_started'> * https://developers.google.com/api-client-library/dotnet/get_started</a> */ namespace Google.Apis.Webfonts.v1 { /// <summary>The Webfonts Service.</summary> public class WebfontsService : Google.Apis.Services.BaseClientService { /// <summary>The API version.</summary> public const string Version = "v1"; /// <summary>The discovery version used to generate this service.</summary> public static Google.Apis.Discovery.DiscoveryVersion DiscoveryVersionUsed = Google.Apis.Discovery.DiscoveryVersion.Version_1_0; /// <summary>Constructs a new service.</summary> public WebfontsService() : this(new Google.Apis.Services.BaseClientService.Initializer()) {} /// <summary>Constructs a new service.</summary> /// <param name="initializer">The service initializer.</param> public WebfontsService(Google.Apis.Services.BaseClientService.Initializer initializer) : base(initializer) { webfonts = new WebfontsResource(this); } /// <summary>Gets the service supported features.</summary> public override System.Collections.Generic.IList<string> Features { get { return new string[0]; } } /// <summary>Gets the service name.</summary> public override string Name { get { return "webfonts"; } } /// <summary>Gets the service base URI.</summary> public override string BaseUri { get { return "https://www.googleapis.com/webfonts/v1/"; } } /// <summary>Gets the service base path.</summary> public override string BasePath { get { return "webfonts/v1/"; } } #if !NET40 /// <summary>Gets the batch base URI; <c>null</c> if unspecified.</summary> public override string BatchUri { get { return "https://www.googleapis.com/batch/webfonts/v1"; } } /// <summary>Gets the batch base path; <c>null</c> if unspecified.</summary> public override string BatchPath { get { return "batch/webfonts/v1"; } } #endif private readonly WebfontsResource webfonts; /// <summary>Gets the Webfonts resource.</summary> public virtual WebfontsResource Webfonts { get { return webfonts; } } } ///<summary>A base abstract class for Webfonts requests.</summary> public abstract class WebfontsBaseServiceRequest<TResponse> : Google.Apis.Requests.ClientServiceRequest<TResponse> { ///<summary>Constructs a new WebfontsBaseServiceRequest instance.</summary> protected WebfontsBaseServiceRequest(Google.Apis.Services.IClientService service) : base(service) { } /// <summary>Data format for the response.</summary> /// [default: json] [Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)] public virtual System.Nullable<AltEnum> Alt { get; set; } /// <summary>Data format for the response.</summary> public enum AltEnum { /// <summary>Responses with Content-Type of application/json</summary> [Google.Apis.Util.StringValueAttribute("json")] Json, } /// <summary>Selector specifying which fields to include in a partial response.</summary> [Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)] public virtual string Fields { get; set; } /// <summary>API key. Your API key identifies your project and provides you with API access, quota, and reports. /// Required unless you provide an OAuth 2.0 token.</summary> [Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)] public virtual string Key { get; set; } /// <summary>OAuth 2.0 token for the current user.</summary> [Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)] public virtual string OauthToken { get; set; } /// <summary>Returns response with indentations and line breaks.</summary> /// [default: true] [Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)] public virtual System.Nullable<bool> PrettyPrint { get; set; } /// <summary>Available to use for quota purposes for server-side applications. Can be any arbitrary string /// assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.</summary> [Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)] public virtual string QuotaUser { get; set; } /// <summary>IP address of the site where the request originates. Use this if you want to enforce per-user /// limits.</summary> [Google.Apis.Util.RequestParameterAttribute("userIp", Google.Apis.Util.RequestParameterType.Query)] public virtual string UserIp { get; set; } /// <summary>Initializes Webfonts parameter list.</summary> protected override void InitParameters() { base.InitParameters(); RequestParameters.Add( "alt", new Google.Apis.Discovery.Parameter { Name = "alt", IsRequired = false, ParameterType = "query", DefaultValue = "json", Pattern = null, }); RequestParameters.Add( "fields", new Google.Apis.Discovery.Parameter { Name = "fields", IsRequired = false, ParameterType = "query", DefaultValue = null, Pattern = null, }); RequestParameters.Add( "key", new Google.Apis.Discovery.Parameter { Name = "key", IsRequired = false, ParameterType = "query", DefaultValue = null, Pattern = null, }); RequestParameters.Add( "oauth_token", new Google.Apis.Discovery.Parameter { Name = "oauth_token", IsRequired = false, ParameterType = "query", DefaultValue = null, Pattern = null, }); RequestParameters.Add( "prettyPrint", new Google.Apis.Discovery.Parameter { Name = "prettyPrint", IsRequired = false, ParameterType = "query", DefaultValue = "true", Pattern = null, }); RequestParameters.Add( "quotaUser", new Google.Apis.Discovery.Parameter { Name = "quotaUser", IsRequired = false, ParameterType = "query", DefaultValue = null, Pattern = null, }); RequestParameters.Add( "userIp", new Google.Apis.Discovery.Parameter { Name = "userIp", IsRequired = false, ParameterType = "query", DefaultValue = null, Pattern = null, }); } } /// <summary>The "webfonts" collection of methods.</summary> public class WebfontsResource { private const string Resource = "webfonts"; /// <summary>The service which this resource belongs to.</summary> private readonly Google.Apis.Services.IClientService service; /// <summary>Constructs a new resource.</summary> public WebfontsResource(Google.Apis.Services.IClientService service) { this.service = service; } /// <summary>Retrieves the list of fonts currently served by the Google Fonts Developer API</summary> public virtual ListRequest List() { return new ListRequest(service); } /// <summary>Retrieves the list of fonts currently served by the Google Fonts Developer API</summary> public class ListRequest : WebfontsBaseServiceRequest<Google.Apis.Webfonts.v1.Data.WebfontList> { /// <summary>Constructs a new List request.</summary> public ListRequest(Google.Apis.Services.IClientService service) : base(service) { InitParameters(); } /// <summary>Enables sorting of the list</summary> [Google.Apis.Util.RequestParameterAttribute("sort", Google.Apis.Util.RequestParameterType.Query)] public virtual System.Nullable<SortEnum> Sort { get; set; } /// <summary>Enables sorting of the list</summary> public enum SortEnum { /// <summary>Sort alphabetically</summary> [Google.Apis.Util.StringValueAttribute("alpha")] Alpha, /// <summary>Sort by date added</summary> [Google.Apis.Util.StringValueAttribute("date")] Date, /// <summary>Sort by popularity</summary> [Google.Apis.Util.StringValueAttribute("popularity")] Popularity, /// <summary>Sort by number of styles</summary> [Google.Apis.Util.StringValueAttribute("style")] Style, /// <summary>Sort by trending</summary> [Google.Apis.Util.StringValueAttribute("trending")] Trending, } ///<summary>Gets the method name.</summary> public override string MethodName { get { return "list"; } } ///<summary>Gets the HTTP method.</summary> public override string HttpMethod { get { return "GET"; } } ///<summary>Gets the REST path.</summary> public override string RestPath { get { return "webfonts"; } } /// <summary>Initializes List parameter list.</summary> protected override void InitParameters() { base.InitParameters(); RequestParameters.Add( "sort", new Google.Apis.Discovery.Parameter { Name = "sort", IsRequired = false, ParameterType = "query", DefaultValue = null, Pattern = null, }); } } } } namespace Google.Apis.Webfonts.v1.Data { public class Webfont : Google.Apis.Requests.IDirectResponseSchema { /// <summary>The category of the font.</summary> [Newtonsoft.Json.JsonPropertyAttribute("category")] public virtual string Category { get; set; } /// <summary>The name of the font.</summary> [Newtonsoft.Json.JsonPropertyAttribute("family")] public virtual string Family { get; set; } /// <summary>The font files (with all supported scripts) for each one of the available variants, as a key : /// value map.</summary> [Newtonsoft.Json.JsonPropertyAttribute("files")] public virtual System.Collections.Generic.IDictionary<string,string> Files { get; set; } /// <summary>This kind represents a webfont object in the webfonts service.</summary> [Newtonsoft.Json.JsonPropertyAttribute("kind")] public virtual string Kind { get; set; } /// <summary>The date (format "yyyy-MM-dd") the font was modified for the last time.</summary> [Newtonsoft.Json.JsonPropertyAttribute("lastModified")] public virtual string LastModified { get; set; } /// <summary>The scripts supported by the font.</summary> [Newtonsoft.Json.JsonPropertyAttribute("subsets")] public virtual System.Collections.Generic.IList<string> Subsets { get; set; } /// <summary>The available variants for the font.</summary> [Newtonsoft.Json.JsonPropertyAttribute("variants")] public virtual System.Collections.Generic.IList<string> Variants { get; set; } /// <summary>The font version.</summary> [Newtonsoft.Json.JsonPropertyAttribute("version")] public virtual string Version { get; set; } /// <summary>The ETag of the item.</summary> public virtual string ETag { get; set; } } public class WebfontList : Google.Apis.Requests.IDirectResponseSchema { /// <summary>The list of fonts currently served by the Google Fonts API.</summary> [Newtonsoft.Json.JsonPropertyAttribute("items")] public virtual System.Collections.Generic.IList<Webfont> Items { get; set; } /// <summary>This kind represents a list of webfont objects in the webfonts service.</summary> [Newtonsoft.Json.JsonPropertyAttribute("kind")] public virtual string Kind { get; set; } /// <summary>The ETag of the item.</summary> public virtual string ETag { get; set; } } }
39.715736
127
0.582119
[ "Apache-2.0" ]
Ramkarthik/google-api-dotnet-client
Src/Generated/Google.Apis.Webfonts.v1/Google.Apis.Webfonts.v1.cs
15,648
C#
using System; using System.Threading.Tasks; using Codeworx.Identity.Cryptography; using Codeworx.Identity.Login; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Logging; using Newtonsoft.Json; namespace Codeworx.Identity.Cache { // EventIds 148xx public class DistributedExternalTokenCache : IExternalTokenCache { private static readonly Action<ILogger, string, Exception> _logKeyNotFound; private static readonly Action<ILogger, Exception> _logInvalidKeyFormat; private static readonly Action<ILogger, string, Exception> _logInvalidKeyFormatTrace; private readonly IDistributedCache _cache; private readonly ILogger<DistributedExternalTokenCache> _logger; private readonly ISymmetricDataEncryption _dataEncryption; static DistributedExternalTokenCache() { _logKeyNotFound = LoggerMessage.Define<string>(LogLevel.Warning, new EventId(14803), "The external token data {Key} was not found!"); _logInvalidKeyFormat = LoggerMessage.Define(LogLevel.Error, new EventId(14804), "The format of cache key is invalid!"); _logInvalidKeyFormatTrace = LoggerMessage.Define<string>(LogLevel.Trace, new EventId(14804), "The format of cache key {Key} is invalid!"); } public DistributedExternalTokenCache(IDistributedCache cache, ILogger<DistributedExternalTokenCache> logger, ISymmetricDataEncryption dataEncryption) { _cache = cache; _logger = logger; _dataEncryption = dataEncryption; } public virtual async Task<ExternalTokenData> GetAsync(string key, TimeSpan extend) { string cacheKey, encryptionKey; GetKeys(key, out cacheKey, out encryptionKey); var entry = await _cache.GetStringAsync(cacheKey) .ConfigureAwait(false); if (entry == null) { _logKeyNotFound(_logger, cacheKey, null); throw new CacheEntryNotFoundException(); } await _cache.SetStringAsync( cacheKey, entry, new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = extend }) .ConfigureAwait(false); var decoded = await _dataEncryption.DecryptAsync(entry, encryptionKey); return JsonConvert.DeserializeObject<ExternalTokenData>(decoded); } public virtual async Task<string> SetAsync(ExternalTokenData value, TimeSpan validFor) { var cacheKey = Guid.NewGuid().ToString("N"); var serializedValue = JsonConvert.SerializeObject(value); var encryped = await _dataEncryption.EncryptAsync(serializedValue); await _cache.SetStringAsync( cacheKey, encryped.Data, new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = validFor }) .ConfigureAwait(false); return $"{cacheKey}.{encryped.Key}"; } public virtual async Task UpdateAsync(string key, ExternalTokenData value, TimeSpan validFor) { string cacheKey, encryptionKey; GetKeys(key, out cacheKey, out encryptionKey); var encoded = await _dataEncryption.EncryptAsync(JsonConvert.SerializeObject(value), encryptionKey); await _cache.SetStringAsync( cacheKey, encoded.Data, new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = validFor }) .ConfigureAwait(false); } private void GetKeys(string key, out string cacheKey, out string encryptionKey) { var splitKey = key.Split('.'); if (splitKey.Length != 2) { var exception = new InvalidCacheKeyFormatException(); _logInvalidKeyFormat(_logger, exception); _logInvalidKeyFormatTrace(_logger, key, exception); } cacheKey = splitKey[0]; encryptionKey = splitKey[1]; } } }
39.292453
157
0.645858
[ "MIT" ]
SteSinger/identity
src/Codeworx.Identity/Cache/DistributedExternalTokenCache.cs
4,167
C#
using System; using Android.Graphics; namespace XWeather.Droid { public static class ColorExtensions { public static Tuple<Color [], int> GetTimeOfDayGradient (this WuLocation location, bool random = false) { var index = location.GetTimeOfDayIndex (random); return new Tuple<Color [], int> (Colors.Gradients [index], index); } } }
21.8125
105
0.724928
[ "MIT" ]
andrewchungxam/XWeather
XWeather/Droid/Extensions/ColorExtensions.cs
351
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // // Umbraco.ModelsBuilder.Embedded v9.0.0-beta004+c41d05f6a67e1d217d565d055a85231792520f88 // // Changes to this file will be lost if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Linq.Expressions; using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Core.PublishedCache; using Umbraco.Cms.Infrastructure.ModelsBuilder; using Umbraco.Cms.Core; using Umbraco.Extensions; namespace Umbraco.Cms.Web.Common.PublishedModels { /// <summary>Split Photo Settings</summary> [PublishedModel("splitPhotoSettings")] public partial class SplitPhotoSettings : PublishedElementModel, ITitleElement { // helpers #pragma warning disable 0109 // new is redundant [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "9.0.0-beta004+c41d05f6a67e1d217d565d055a85231792520f88")] public new const string ModelTypeAlias = "splitPhotoSettings"; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "9.0.0-beta004+c41d05f6a67e1d217d565d055a85231792520f88")] public new const PublishedItemType ModelItemType = PublishedItemType.Content; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "9.0.0-beta004+c41d05f6a67e1d217d565d055a85231792520f88")] public new static IPublishedContentType GetModelContentType(IPublishedSnapshotAccessor publishedSnapshotAccessor) => PublishedModelUtility.GetModelContentType(publishedSnapshotAccessor, ModelItemType, ModelTypeAlias); [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "9.0.0-beta004+c41d05f6a67e1d217d565d055a85231792520f88")] public static IPublishedPropertyType GetModelPropertyType<TValue>(IPublishedSnapshotAccessor publishedSnapshotAccessor, Expression<Func<SplitPhotoSettings, TValue>> selector) => PublishedModelUtility.GetModelPropertyType(GetModelContentType(publishedSnapshotAccessor), selector); #pragma warning restore 0109 private IPublishedValueFallback _publishedValueFallback; // ctor public SplitPhotoSettings(IPublishedElement content, IPublishedValueFallback publishedValueFallback) : base(content, publishedValueFallback) { _publishedValueFallback = publishedValueFallback; } // properties ///<summary> /// Title ///</summary> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "9.0.0-beta004+c41d05f6a67e1d217d565d055a85231792520f88")] [ImplementPropertyType("title")] public virtual string Title => global::Umbraco.Cms.Web.Common.PublishedModels.TitleElement.GetTitle(this, _publishedValueFallback); } }
49.517241
176
0.772284
[ "MIT" ]
ManiPeralta/Umbraco9-Mano-a-mano-Template
umbraco/models/SplitPhotoSettings.generated.cs
2,872
C#
using System; using System.Collections.Generic; using System.Text; namespace Microsoft.Telepathy.ClientAPI { public class SessionStartInfo { public string ServiceName => serviceName; private string serviceName; public Version ServiceVersion => serviceVersion; private Version serviceVersion; public bool SharedSession { get; set; } public string Username { get; set; } public string Password { get; set; } public int SessionIdleTimeout { get; set; } = 60000; public int ClientConnectTimeout { get; set; } public int ClientIdleTimeout { get; set; } = 60000; public int MaxServiceNum { get; set; } = 1; public string TelepathyAddress => telepathyAddress; private string telepathyAddress; public SessionStartInfo(string address, string serviceName) : this(address, serviceName, null) { } public SessionStartInfo(string address, string serviceName, Version serviceVersion) { telepathyAddress = address; this.serviceName = serviceName; if (serviceVersion != Constant.NoServiceVersion) this.serviceVersion = serviceVersion; } } }
26.934783
102
0.653753
[ "MIT" ]
jingjlii/Telepathy-1
client/ClientAPI/SessionStartInfo.cs
1,241
C#
using Fosol.Schedule.Entities; using System; namespace Fosol.Schedule.Models { public class Account : BaseModel { #region Properties public int? Id { get; set; } public Guid? Key { get; set; } public int OwnerId { get; set; } public string Name { get; set; } public string Description { get; set; } /// <summary> /// get/set - The current state of this account. /// </summary> public AccountState State { get; set; } /// <summary> /// get/set - The kind of account [Personal, Business] /// </summary> public AccountKind Kind { get; set; } /// <summary> /// get/set - Foreign key to the subscription for this account [Free|...]. /// </summary> public int SubscriptionId { get; set; } #endregion } }
25.166667
83
0.525386
[ "MIT" ]
FosolSolutions/fosol.schedule
Fosol.Schedule.Models/Account.cs
908
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Key : MonoBehaviour { public DoorKey door; public void OnTriggerEnter2D(Collider2D collision) { door.SendMessage("Open"); Destroy(transform.gameObject); } }
20.428571
54
0.702797
[ "MIT" ]
remi-espie/KJam-WonderJam
Assets/Scripts/Key.cs
288
C#
using System; using Microsoft.AspNetCore.Components.Rendering; using Microsoft.Extensions.Logging; namespace Fuzzy.Components { /// <summary> /// Adds the <see cref="Build(RenderTreeBuilder, bool, int, int, ILogger?)">Build(...)</see> method /// to the <see cref="RenderTreeBuilder"/> class to start the fluent call chain of /// <see cref="FluentRenderTreeBuilder"/> methods. /// </summary> public static class RenderTreeBuilderExtensions { /// <summary> /// Starts the call chain of <see cref="FluentRenderTreeBuilder"/> methods using the given /// <see cref="RenderTreeBuilder"/>. /// </summary> /// <param name="builder">The <see cref="RenderTreeBuilder"/> to use for building the render tree.</param> /// <param name="prettyPrint"><c>true</c> to add whitespace (newlines and indents) around block elements.</param> /// <param name="initialIndent">If <paramref name="prettyPrint"/> is <c>true</c>, the initial indentation /// level for block elements.</param> /// <param name="maxPerLine"> /// The maximum number of frames that can be generated per source code line (including pretty printing whitespace). /// </param> /// <param name="logger"> /// The optional <see cref="ILogger{TCategoryName}"/> implementation to use for logging. /// </param> public static FluentRenderTreeBuilder Build(this RenderTreeBuilder builder, bool prettyPrint = true, int initialIndent = 0, int maxPerLine = FluentRenderTreeBuilder.MAX_FRAMES_PER_LINE, ILogger? logger = null) => new (builder, prettyPrint, initialIndent, maxPerLine, logger); } }
42.891892
117
0.712665
[ "MIT" ]
Fuzzy-Work/FluentRenderTreeBuilder
Fuzzy.FluentRenderTreeBuilder/RenderTreeBuilderExtensions.cs
1,589
C#
using UnityEngine; using UnityEditor; [CustomEditor(typeof(TagObject))] public class TagObjectEditor : Editor { public override void OnInspectorGUI() { DrawDefaultInspector(); TagObject myScript = (TagObject)target; if (GUILayout.Button("FilterMe")) { myScript.ToggleTag(); } } }
18.315789
47
0.623563
[ "MIT" ]
afauch/goodearth-dev
Assets/Editor/TagObjectEditor.cs
350
C#
using System; using System.Text; namespace Lucene.Net.Benchmarks.ByTask.Feeds { /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /// <summary> /// Parser for the FT docs in trec disks 4+5 collection format /// </summary> public class TrecFTParser : TrecDocParser { private const string DATE = "<DATE>"; private const string DATE_END = "</DATE>"; private const string HEADLINE = "<HEADLINE>"; private const string HEADLINE_END = "</HEADLINE>"; public override DocData Parse(DocData docData, string name, TrecContentSource trecSrc, StringBuilder docBuf, ParsePathType pathType) { int mark = 0; // that much is skipped // date... DateTime? date = null; string dateStr = Extract(docBuf, DATE, DATE_END, -1, null); if (dateStr != null) { date = trecSrc.ParseDate(dateStr); } // title... string title = Extract(docBuf, HEADLINE, HEADLINE_END, -1, null); docData.Clear(); docData.Name = name; docData.SetDate(date); docData.Title = title; docData.Body = StripTags(docBuf, mark).ToString(); return docData; } } }
35.898305
94
0.616619
[ "Apache-2.0" ]
10088/lucenenet
src/Lucene.Net.Benchmark/ByTask/Feeds/TrecFTParser.cs
2,120
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.Concurrent; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Utilities; namespace Microsoft.EntityFrameworkCore.ValueGeneration { /// <summary> /// <para> /// Keeps a cache of value generators for properties. /// </para> /// <para> /// This type is typically used by database providers (and other extensions). It is generally /// not used in application code. /// </para> /// </summary> public class ValueGeneratorCache : IValueGeneratorCache { /// <summary> /// Initializes a new instance of the <see cref="ValueGeneratorCache" /> class. /// </summary> /// <param name="dependencies"> Parameter object containing dependencies for this service. </param> public ValueGeneratorCache([NotNull] ValueGeneratorCacheDependencies dependencies) { Check.NotNull(dependencies, nameof(dependencies)); } private readonly ConcurrentDictionary<CacheKey, ValueGenerator> _cache = new ConcurrentDictionary<CacheKey, ValueGenerator>(); private struct CacheKey { public CacheKey(IProperty property, IEntityType entityType, Func<IProperty, IEntityType, ValueGenerator> factory) { Property = property; EntityType = entityType; Factory = factory; } public IProperty Property { get; } public IEntityType EntityType { get; } public Func<IProperty, IEntityType, ValueGenerator> Factory { get; } private bool Equals(CacheKey other) => Property.Equals(other.Property) && EntityType.Equals(other.EntityType); public override bool Equals(object obj) { if (obj is null) { return false; } return obj is CacheKey && Equals((CacheKey)obj); } public override int GetHashCode() { unchecked { return (Property.GetHashCode() * 397) ^ EntityType.GetHashCode(); } } } /// <summary> /// Gets the existing value generator from the cache, or creates a new one if one is not present in /// the cache. /// </summary> /// <param name="property"> The property to get the value generator for. </param> /// <param name="entityType"> /// The entity type that the value generator will be used for. When called on inherited properties on derived entity types, /// this entity type may be different from the declared entity type on <paramref name="property" /> /// </param> /// <param name="factory"> Factory to create a new value generator if one is not present in the cache. </param> /// <returns> The existing or newly created value generator. </returns> public virtual ValueGenerator GetOrAdd( IProperty property, IEntityType entityType, Func<IProperty, IEntityType, ValueGenerator> factory) { Check.NotNull(property, nameof(property)); Check.NotNull(factory, nameof(factory)); return _cache.GetOrAdd(new CacheKey(property, entityType, factory), ck => ck.Factory(ck.Property, ck.EntityType)); } } }
39.623656
135
0.604342
[ "Apache-2.0" ]
EasonDongH/EntityFrameworkCore
src/EFCore/ValueGeneration/ValueGeneratorCache.cs
3,685
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; /// <summary> /// Controller class for the ship. /// Main functions: /// 1) To contain, and enact movements. /// 2) Populate a common object for other objects to access the next movements and current position of the player. /// </summary> public class ConcentrationController : MonoBehaviour { // GAME SETTINGS.. TODO: Move out to config object // [SerializeField] private int _moveOffset = 1; [SerializeField] private List<Vector3> _potentialLocations; [SerializeField] private int Segments = 10; // PUBLIC ACCESSORS AND INFO PROVIDERS // public PlayerInformationProvider PlayerInformationProvider { get; } public Vector3 SlerpToPosition { get; private set; } private int postiionIndex = 2; public Vector3[] PotentialPositions; Queue<MoveDirection> playerMoves; // PRIVATE VARIABLES // private GameObject playerObject; // Use this for initialization void Start () { playerMoves = new Queue<MoveDirection>(); _potentialLocations = new List<Vector3>(); SetupLocationsList(); playerObject = ObjectProvider.ProvidePlayer(); } // Set Up // private void SetupLocationsList() { var centreOfCamera = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, 0)); transform.position = LocationProvider.Test(transform); var locations = LocationProvider.ProvideLocations(Segments, transform); PotentialPositions = locations.ToArray(); } // Update is called once per frame void Update () { var moveDirection = MoveDirection.Undefined; if(TryProvideMove(out moveDirection)) { Debug.Log("Got a move = " + moveDirection.ToString()); playerMoves.Enqueue(moveDirection); } if (playerMoves.Count > _moveOffset) { ApplyMove(playerMoves.Dequeue()); Debug.Log("Applied a move"); } // Last to call ConstantlySlerpTowardsDesiredLocation(); } public bool TryProvideMove(out MoveDirection direction) { if(Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A)) { direction = MoveDirection.Left; return true; } if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D)) { direction = MoveDirection.Right; return true; } direction = MoveDirection.Undefined; return false; } public void ApplyMove(MoveDirection move) { var directionAsint = (int)move; var potentialNewIndex = postiionIndex + directionAsint; if(potentialNewIndex > Segments -1 || potentialNewIndex < 0) { return; } postiionIndex = potentialNewIndex; } private void ConstantlySlerpTowardsDesiredLocation() { playerObject.transform.position = Vector3.Lerp(playerObject.transform.position, PotentialPositions[postiionIndex], 0.25f); } }
25.018349
124
0.735607
[ "MIT" ]
TheIncredibleK/Concentration
Concentration/Assets/src/player/ConcentrationController.cs
2,729
C#
using System; namespace ovn1 { class Program { static void Main(string[] args) { double total = 0; string[] food = new string[] { "Mjölk", "3 Mjau - Noga Utvalt Kyckling i Sås", "Bananer" }; double[] pris = new double[] { 17.30d, 20d, 26.95d }; for (int i = 0; i < food.Length; i++) { Console.WriteLine($"{food[i]} {pris[i]}"); total += pris[i]; } Console.WriteLine("Summa: " + total); } } }
22.142857
65
0.393548
[ "MIT" ]
tthorin/NET21OOP
ArrayAndList/ArrayAndList/ovn1/Program.cs
624
C#
using Aspor.Streaming.Core.Attributes; using Newtonsoft.Json.Linq; using Aspor.Streaming.Core; using Aspor.Streaming.Core.Bus; using Aspor.Streaming.Core.Content; using Aspor.Streaming.Core.Subscription; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace Aspor.Streaming.Core { public class DefaultStreamProvider : IStreamProvider, IStreamReceiveHandler { private IStreamBus _bus; private readonly ICollection<IIStreamSubscription> _subscriptions; public DefaultStreamProvider() { _subscriptions = new List<IIStreamSubscription>(); } public DefaultStreamProvider(IStreamBus bus) { _subscriptions = new List<IIStreamSubscription>(); _bus = bus; _bus.InitzializeHandler(this); } public void UseBus(IStreamBus bus) { _bus = bus; _bus.InitzializeHandler(this); } public void Publish(string topic, string content) { Publish(topic, new StringStreamContent(content)); } public void PublishObject<E>(string topic, E content) where E : class { Publish(topic, new ObjectStreamContent<E>(content)); } public void PublishObject<E>(string topic, E content, IEnumerable<string> affectedProperties) where E : class { Publish(topic, new EntityStreamContent<E>(content, affectedProperties)); } public void Publish(string topic, JToken content) { Publish(topic, new JsonStreamContent(content)); } public void Publish(string topic, byte[] content) { Publish(topic, new ByteStreamContent(content)); } public void Publish(string topic, IStreamContent content) { if (_bus == null) throw new InvalidOperationException("No bus available"); StreamData data = new StreamData() { Topic = topic, Body = content.Encode(), }; _bus.Publish(data); } public void Consume(string topic, Action<StreamContext> consumer) { if (_bus == null) throw new InvalidOperationException("No bus available"); string[] nodes = TopicMatcher.Compute(topic); string[] normalizedNodes = TopicMatcher.Noramlize(nodes); _subscriptions.Add(new ActionStreamSubscription(nodes, normalizedNodes, consumer)); _bus.Subscribe(string.Join(TopicMatcher.NODE_DELIMITER, normalizedNodes)); } public void Consume<T>(string topic, Action<StreamContext<T>> consumer) where T : IStreamContent, new() { if (_bus == null) throw new InvalidOperationException("No bus available"); string[] nodes = TopicMatcher.Compute(topic); string[] normalizedNodes = TopicMatcher.Noramlize(nodes); _subscriptions.Add(new TypedActionStreamSubscription<T>(nodes, normalizedNodes, consumer)); _bus.Subscribe(string.Join(TopicMatcher.NODE_DELIMITER, normalizedNodes)); } public void OnReceive(StreamData data) { foreach (IIStreamSubscription subscription in _subscriptions) { if (TopicMatcher.Matches(subscription.NormalizedNodes, data.Topic)) { subscription.Invoke(data); } } } public void Consume<T>() where T : class, new() { Consume(new T()); } public void Consume(Type type) { Consume(Activator.CreateInstance(type)); } public void Consume(object listener) { if (_bus == null) throw new InvalidOperationException("No bus available"); IEnumerable<MethodInfo> methods = listener.GetType().GetMethods().Where(m => !m.IsStatic && m.IsPublic && m.GetCustomAttributes(false).Any(c => c.GetType() == typeof(StreamTopicAttribute))); foreach (MethodInfo method in methods) { IEnumerable<StreamTopicAttribute> topics = method.GetCustomAttributes<StreamTopicAttribute>(); foreach(StreamTopicAttribute topic in topics) { string[] nodes = TopicMatcher.Compute(topic.Topic); string[] normalizedNodes = TopicMatcher.Noramlize(nodes); _subscriptions.Add(new MethodStreamSubscription(nodes, normalizedNodes, method, listener)); _bus.Subscribe(string.Join(TopicMatcher.NODE_DELIMITER, normalizedNodes)); } } } public void AddConsumers() { if (_bus == null) throw new InvalidOperationException("No bus available"); var controllerType = typeof(StreamConsumer); var controllers = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(t => controllerType.IsAssignableFrom(t)); foreach (Type controller in controllers) Consume(controllers); } } }
36.340278
117
0.605962
[ "Apache-2.0" ]
Aspor-Stack/aspor
Aspor.Streaming.Core/DefaultStreamProvider.cs
5,235
C#
using System; using System.Text; using System.Data; using System.Data.SqlClient; using System.Data.Common; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Xml; using System.Xml.Serialization; using SubSonic; using SubSonic.Utilities; namespace DalSic { /// <summary> /// Strongly-typed collection for the PnPermisosUsuario class. /// </summary> [Serializable] public partial class PnPermisosUsuarioCollection : ActiveList<PnPermisosUsuario, PnPermisosUsuarioCollection> { public PnPermisosUsuarioCollection() {} /// <summary> /// Filters an existing collection based on the set criteria. This is an in-memory filter /// Thanks to developingchris for this! /// </summary> /// <returns>PnPermisosUsuarioCollection</returns> public PnPermisosUsuarioCollection Filter() { for (int i = this.Count - 1; i > -1; i--) { PnPermisosUsuario o = this[i]; foreach (SubSonic.Where w in this.wheres) { bool remove = false; System.Reflection.PropertyInfo pi = o.GetType().GetProperty(w.ColumnName); if (pi.CanRead) { object val = pi.GetValue(o, null); switch (w.Comparison) { case SubSonic.Comparison.Equals: if (!val.Equals(w.ParameterValue)) { remove = true; } break; } } if (remove) { this.Remove(o); break; } } } return this; } } /// <summary> /// This is an ActiveRecord class which wraps the PN_permisos_usuarios table. /// </summary> [Serializable] public partial class PnPermisosUsuario : ActiveRecord<PnPermisosUsuario>, IActiveRecord { #region .ctors and Default Settings public PnPermisosUsuario() { SetSQLProps(); InitSetDefaults(); MarkNew(); } private void InitSetDefaults() { SetDefaults(); } public PnPermisosUsuario(bool useDatabaseDefaults) { SetSQLProps(); if(useDatabaseDefaults) ForceDefaults(); MarkNew(); } public PnPermisosUsuario(object keyID) { SetSQLProps(); InitSetDefaults(); LoadByKey(keyID); } public PnPermisosUsuario(string columnName, object columnValue) { SetSQLProps(); InitSetDefaults(); LoadByParam(columnName,columnValue); } protected static void SetSQLProps() { GetTableSchema(); } #endregion #region Schema and Query Accessor public static Query CreateQuery() { return new Query(Schema); } public static TableSchema.Table Schema { get { if (BaseSchema == null) SetSQLProps(); return BaseSchema; } } private static void GetTableSchema() { if(!IsSchemaInitialized) { //Schema declaration TableSchema.Table schema = new TableSchema.Table("PN_permisos_usuarios", TableType.Table, DataService.GetInstance("sicProvider")); schema.Columns = new TableSchema.TableColumnCollection(); schema.SchemaName = @"dbo"; //columns TableSchema.TableColumn colvarIdPu = new TableSchema.TableColumn(schema); colvarIdPu.ColumnName = "id_pu"; colvarIdPu.DataType = DbType.Int32; colvarIdPu.MaxLength = 0; colvarIdPu.AutoIncrement = true; colvarIdPu.IsNullable = false; colvarIdPu.IsPrimaryKey = true; colvarIdPu.IsForeignKey = false; colvarIdPu.IsReadOnly = false; colvarIdPu.DefaultSetting = @""; colvarIdPu.ForeignKeyTableName = ""; schema.Columns.Add(colvarIdPu); TableSchema.TableColumn colvarIdPermiso = new TableSchema.TableColumn(schema); colvarIdPermiso.ColumnName = "id_permiso"; colvarIdPermiso.DataType = DbType.Int32; colvarIdPermiso.MaxLength = 0; colvarIdPermiso.AutoIncrement = false; colvarIdPermiso.IsNullable = false; colvarIdPermiso.IsPrimaryKey = false; colvarIdPermiso.IsForeignKey = true; colvarIdPermiso.IsReadOnly = false; colvarIdPermiso.DefaultSetting = @""; colvarIdPermiso.ForeignKeyTableName = "PN_permisos"; schema.Columns.Add(colvarIdPermiso); TableSchema.TableColumn colvarIdUsuario = new TableSchema.TableColumn(schema); colvarIdUsuario.ColumnName = "id_usuario"; colvarIdUsuario.DataType = DbType.Int32; colvarIdUsuario.MaxLength = 0; colvarIdUsuario.AutoIncrement = false; colvarIdUsuario.IsNullable = false; colvarIdUsuario.IsPrimaryKey = false; colvarIdUsuario.IsForeignKey = true; colvarIdUsuario.IsReadOnly = false; colvarIdUsuario.DefaultSetting = @""; colvarIdUsuario.ForeignKeyTableName = "PN_usuarios"; schema.Columns.Add(colvarIdUsuario); BaseSchema = schema; //add this schema to the provider //so we can query it later DataService.Providers["sicProvider"].AddSchema("PN_permisos_usuarios",schema); } } #endregion #region Props [XmlAttribute("IdPu")] [Bindable(true)] public int IdPu { get { return GetColumnValue<int>(Columns.IdPu); } set { SetColumnValue(Columns.IdPu, value); } } [XmlAttribute("IdPermiso")] [Bindable(true)] public int IdPermiso { get { return GetColumnValue<int>(Columns.IdPermiso); } set { SetColumnValue(Columns.IdPermiso, value); } } [XmlAttribute("IdUsuario")] [Bindable(true)] public int IdUsuario { get { return GetColumnValue<int>(Columns.IdUsuario); } set { SetColumnValue(Columns.IdUsuario, value); } } #endregion #region ForeignKey Properties /// <summary> /// Returns a PnPermiso ActiveRecord object related to this PnPermisosUsuario /// /// </summary> public DalSic.PnPermiso PnPermiso { get { return DalSic.PnPermiso.FetchByID(this.IdPermiso); } set { SetColumnValue("id_permiso", value.IdPermiso); } } /// <summary> /// Returns a PnUsuario ActiveRecord object related to this PnPermisosUsuario /// /// </summary> public DalSic.PnUsuario PnUsuario { get { return DalSic.PnUsuario.FetchByID(this.IdUsuario); } set { SetColumnValue("id_usuario", value.IdUsuario); } } #endregion //no ManyToMany tables defined (0) #region ObjectDataSource support /// <summary> /// Inserts a record, can be used with the Object Data Source /// </summary> public static void Insert(int varIdPermiso,int varIdUsuario) { PnPermisosUsuario item = new PnPermisosUsuario(); item.IdPermiso = varIdPermiso; item.IdUsuario = varIdUsuario; if (System.Web.HttpContext.Current != null) item.Save(System.Web.HttpContext.Current.User.Identity.Name); else item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name); } /// <summary> /// Updates a record, can be used with the Object Data Source /// </summary> public static void Update(int varIdPu,int varIdPermiso,int varIdUsuario) { PnPermisosUsuario item = new PnPermisosUsuario(); item.IdPu = varIdPu; item.IdPermiso = varIdPermiso; item.IdUsuario = varIdUsuario; item.IsNew = false; if (System.Web.HttpContext.Current != null) item.Save(System.Web.HttpContext.Current.User.Identity.Name); else item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name); } #endregion #region Typed Columns public static TableSchema.TableColumn IdPuColumn { get { return Schema.Columns[0]; } } public static TableSchema.TableColumn IdPermisoColumn { get { return Schema.Columns[1]; } } public static TableSchema.TableColumn IdUsuarioColumn { get { return Schema.Columns[2]; } } #endregion #region Columns Struct public struct Columns { public static string IdPu = @"id_pu"; public static string IdPermiso = @"id_permiso"; public static string IdUsuario = @"id_usuario"; } #endregion #region Update PK Collections #endregion #region Deep Save #endregion } }
26.307927
134
0.626956
[ "MIT" ]
saludnqn/Empadronamiento
DalSic/generated/PnPermisosUsuario.cs
8,629
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("PrintNumbersFromOneToThousand")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PrintNumbersFromOneToThousand")] [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("6880f59e-2eeb-44a0-bff3-6e0f1e93a6ee")] // 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.675676
84
0.751223
[ "MIT" ]
bozhinov86/test
Examples/PrintNumbersFromOneToThousand/Properties/AssemblyInfo.cs
1,434
C#
using System; namespace Chainly { /// <summary> /// A field in a form model. /// </summary> public struct Field : IKeyable<string> { readonly string name; // can be string or string[] object value; // actual items in the value int items; internal readonly byte[] contentbuf; readonly int offset; readonly int count; internal Field(string key, string v) { this.name = key; value = v; items = 1; contentbuf = null; offset = 0; count = 0; } internal Field(string key, string filename, byte[] contentbuf, int offset, int count) { this.name = key; value = filename; items = 1; this.contentbuf = contentbuf; this.offset = offset; this.count = count; } public string Key => name; internal void Add(string v) { if (items == 1) // a single string { var arr = new string[8]; arr[0] = (string) value; arr[1] = v; value = arr; items = 2; } else { // ensure capacity string[] arr = (string[]) value; int len = arr.Length; if (items >= len) { string[] alloc = new string[len * 4]; Array.Copy(arr, 0, alloc, 0, len); value = arr = alloc; } arr[items++] = v; } } string First => (items == 0) ? null : (items == 1) ? (string) value : ((string[]) value)[0]; // // CONVERSION // public static implicit operator bool(Field v) { string str = v.First; if (str != null) { return "true".Equals(str) || "1".Equals(str) || "on".Equals(str); } return false; } public static implicit operator char(Field v) { string str = v.First; if (!string.IsNullOrEmpty(str)) { return str[0]; } return '\0'; } public static implicit operator short(Field v) { string str = v.First; if (str != null) { if (short.TryParse(str, out var n)) { return n; } } return 0; } public static implicit operator int(Field v) { string str = v.First; if (str != null) { if (int.TryParse(str, out var n)) { return n; } } return 0; } public static implicit operator long(Field v) { string str = v.First; if (str != null) { if (long.TryParse(str, out var n)) { return n; } } return 0; } public static implicit operator double(Field v) { string str = v.First; if (str != null) { if (double.TryParse(str, out var n)) { return n; } } return 0; } public static implicit operator decimal(Field v) { string str = v.First; if (str != null) { if (decimal.TryParse(str, out var n)) { return n; } } return 0; } public static implicit operator DateTime(Field v) { string str = v.First; if (TextUtility.TryParseDate(str, out var dt)) { return dt; } return default; } public static implicit operator string(Field v) { return v.First; } public static implicit operator ValueTuple<int, string>(Field v) { string str = v.First; if (string.IsNullOrEmpty(str)) { return (0, null); } int pos = 0; var a = str.ParseInt(ref pos); var b = str.ParseString(ref pos); return (a, b); } public static implicit operator byte[](Field v) { byte[] buf = v.contentbuf; if (buf != null) { if (v.count == buf.Length) { return buf; } } return null; } public static implicit operator ArraySegment<byte>(Field v) { if (v.count == 0) { return default; } return new ArraySegment<byte>(v.contentbuf, v.offset, v.count); } public static implicit operator short[](Field v) { int len = v.items; if (len == 0) return null; if (len == 1) { string str = (string) v.value; return new[] {short.TryParse(str, out var n) ? n : (short) 0}; } var strs = (string[]) v.value; var arr = new short[len]; for (int i = 0; i < len; i++) { arr[i] = short.TryParse(strs[i], out var n) ? n : (short) 0; } return arr; } public static implicit operator int[](Field v) { int len = v.items; if (len == 0) return null; if (len == 1) { string str = (string) v.value; return new[] {int.TryParse(str, out var n) ? n : 0}; } var strs = (string[]) v.value; var arr = new int[len]; for (int i = 0; i < len; i++) { arr[i] = int.TryParse(strs[i], out var n) ? n : 0; } return arr; } public static implicit operator long[](Field v) { int len = v.items; if (len == 0) return null; if (len == 1) { string str = (string) v.value; return new[] {long.TryParse(str, out var n) ? n : 0}; } var strs = (string[]) v.value; var arr = new long[len]; for (int i = 0; i < len; i++) { arr[i] = long.TryParse(strs[i], out var n) ? n : 0; } return arr; } public static implicit operator DateTime[](Field v) { int len = v.items; if (len == 0) return null; if (len == 1) { string str = (string) v.value; DateTime.TryParse(str, out var dt); return new[] {dt}; } var strs = (string[]) v.value; var arr = new DateTime[len]; for (int i = 0; i < len; i++) { DateTime.TryParse(strs[i], out var dt); arr[i] = dt; } return arr; } public static implicit operator string[](Field v) { int len = v.items; if (len == 0) return null; if (len == 1) { string str = (string) v.value; return new[] {str}; } var strs = (string[]) v.value; var arr = new string[len]; for (int i = 0; i < len; i++) { arr[i] = strs[i]; } return arr; } } }
26.957792
94
0.371673
[ "Apache-2.0" ]
careign/chainbase
Source/Field.cs
8,303
C#
namespace AllReady.Areas.Admin.ViewModels.Request { public class AddRequestCommentViewModel { // possibly have a list of the comments which will be displayed below the dialog boxes /// <summary> /// The comment message /// </summary> public string Comment { get; set; } } }
25.153846
94
0.629969
[ "MIT" ]
7as8ydh/allReady
AllReadyApp/Web-App/AllReady/Areas/Admin/ViewModels/Request/AddRequestCommentViewModel.cs
327
C#
using System; using System.Collections.Generic; using System.IO; using static System.BitConverter; public static class IMG2ICOUtil { /* ICO FILE Format Desc. ┌ ----| header └ ┌ ----| Entry └ ┌ ----| Entry └ ┌ ----| ... └ ┌ ----| Data └ ┌ ----| Data └ ┌ ----| ..... └ 256x256 will be saved as 32bpp 8bit alpha 48x48 will be saved as 32bpp 8bit alpha 48x48 will be saved as 8bpp 1bit alpha 32x32 will be saved as 32bpp 8bit alpha 32x32 will be saved as 8bpp 1bit alpha 32x32 will be saved as 4bpp 1bit alpha 16x16 will be saved as 32bpp 8bit alpha 16x16 will be saved as 8bpp 1bit alpha 16x16 will be saved as 4bpp 1bit alpha */ /* Entry Offset# Size Purpose 0 1B Specifies image width in pixels. Can be any number between 0 and 255. Value 0 means image width is 256 pixels. 1 1B Specifies image height in pixels. Can be any number between 0 and 255. Value 0 means image height is 256 pixels. 2 1B Specifies number of colors in the color palette. Should be 0 if the image does not use a color palette. 3 1B Reserved. Should be 0.[Notes 2] 4 2B In ICO format: Specifies color planes. Should be 0 or 1.[Notes 3] In CUR format: Specifies the horizontal coordinates of the hotspot in number of pixels from the left. 6 2B In ICO format: Specifies bits per pixel. [Notes 4] In CUR format: Specifies the vertical coordinates of the hotspot in number of pixels from the top. 8 4B Specifies the size of the image's data in bytes 12 4B Specifies the offset of BMP or PNG data from the beginning of the ICO/CUR file */ /* Header Offset# Size Purpose 0 2B Reserved. Must always be 0. 2 2B Specifies image type: 1 for icon (.ICO) image, 2 for cursor (.CUR) image. Other values are invalid. 4 2B Specifies number of images in the file. */ public static void CopyTo2(this ICOAssetProvider provider, Stream stream) { stream.Position = 0; var _D_S_Rev = GetBytes(provider.Reserved); //OFFSET:0 L:2 var _D_S_Type = GetBytes(provider.Type); //OFFSET:2 L:2 var _D_S_Ents = GetBytes(provider.EntryCount); //OFFSET:4 L:2 stream.Write(_D_S_Rev, 0, 2); stream.Write(_D_S_Type, 0, 2); stream.Write(_D_S_Ents, 0, 2); // one entry header 16B int rawDataOffset = 6 + 16 * provider.EntryCount; for (int i = 0; i < provider.Count; i++) { var entry = provider[i]; entry.CopyEntryTo(rawDataOffset, stream); rawDataOffset = rawDataOffset + entry.Size; } for (int i = 0; i < provider.Count; i++) { var entry = provider[i]; entry.CopyDataTo(stream); } } [Obsolete()] public static void CopyTo(this ICOAssetProvider provider, Stream stream) { stream.Position = 0; var _D_S_Rev = GetBytes(provider.Reserved); //OFFSET:0 L:2 var _D_S_Type = GetBytes(provider.Type); //OFFSET:2 L:2 var _D_S_Ents = GetBytes(provider.EntryCount); //OFFSET:4 L:2 stream.Write(_D_S_Rev, 0, 2); stream.Write(_D_S_Type, 0, 2); stream.Write(_D_S_Ents, 0, 2); for (int i = 0; i < provider.Count; i++) { var entry = provider[i]; entry.CopyTo(stream); } } [Obsolete()] public static void CopyTo(this ImageAssetProvider entry, Stream stream) { var _D_Plans = GetBytes(entry.ColorPlanes); var _D_pixels = GetBytes(entry.Pixels); var _D_size = GetBytes(entry.Size); stream.WriteByte(entry.WIDTH); //OFFSET: 0 L: 1 stream.WriteByte(entry.HEIGHT); //OFFSET: 1 L: 1 stream.WriteByte(entry.Palette); //OFFSET: 2 L: 1 stream.WriteByte(entry.Reserved); //OFFSET: 3 L: 1 stream.Write(_D_Plans, 0, 2); //OFFSET: 4 L: 2 stream.Write(_D_pixels, 0, 2); //OFFSET: 6 L: 2 stream.Write(_D_size, 0, 4); //OFFSET: 8 L: 4 entry.Offset = (int)stream.Position + 4; var _D_offset = GetBytes(entry.Offset); //OFFSET: 12 L: 4 stream.Write(_D_offset, 0, 4); stream.Write(entry.ImageData, 0, entry.Size); } public static void CopyEntryTo(this ImageAssetProvider entry, int offset, Stream stream) { var _D_Plans = GetBytes(entry.ColorPlanes); var _D_pixels = GetBytes(entry.Pixels); var _D_size = GetBytes(entry.Size); stream.WriteByte(entry.WIDTH); //OFFSET: 0 L: 1 stream.WriteByte(entry.HEIGHT); //OFFSET: 1 L: 1 stream.WriteByte(entry.Palette); //OFFSET: 2 L: 1 stream.WriteByte(entry.Reserved); //OFFSET: 3 L: 1 stream.Write(_D_Plans, 0, 2); //OFFSET: 4 L: 2 stream.Write(_D_pixels, 0, 2); //OFFSET: 6 L: 2 stream.Write(_D_size, 0, 4); //OFFSET: 8 L: 4 entry.Offset = offset; var _D_offset = GetBytes(entry.Offset); //OFFSET: 12 L: 4 stream.Write(_D_offset, 0, 4); } public static void CopyDataTo(this ImageAssetProvider entry, Stream stream) { //check ? if (stream.Position == entry.Offset) stream.Write(entry.ImageData, 0, entry.Size); else throw new Exception($"Entry Offset CheckError true:{stream.Position},false:{entry.Offset}"); } }
36.423529
124
0.536337
[ "MIT" ]
HinxVietti/img2ico
img2ico.core/IMG2ICOUtil.cs
6,222
C#
using System; using Xamarin.Forms; using Xamarin.Forms.Xaml; namespace Xamarin.CommunityToolkit.UI.Views { [TypeConversion(typeof(Uri))] public class UriTypeConverter : TypeConverter { public override object ConvertFromInvariantString(string value) => string.IsNullOrWhiteSpace(value) ? null : (object)new Uri(value, UriKind.RelativeOrAbsolute); } }
27.692308
96
0.786111
[ "MIT" ]
AbuMandour/XamarinCommunityToolkit
XamarinCommunityToolkit/Views/MediaElement/UriTypeConverter.shared.cs
362
C#
using Common; using Backend.Game; namespace Backend.Network { public partial class Incoming { private void OnRecvPositionRevise(IChannel channel, Message message) { CPositionRevise request = message as CPositionRevise; Entity entity = World.Instance.GetEntity(request.entityId); entity.Position = Entity.V3ToPoint3d(request.pos); } } }
26.5625
77
0.64
[ "Apache-2.0" ]
DaSE-DBMS/MMORPG
Backend/Network/Incoming/OnRecvPositionRevise.cs
427
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using WorkflowCore.Interface; using WorkflowCore.Models; namespace WorkflowCore.Services.BackgroundTasks { internal class EventConsumer : QueueConsumer, IBackgroundTask { private readonly IPersistenceProvider _persistenceStore; private readonly IDistributedLockProvider _lockProvider; private readonly IDateTimeProvider _datetimeProvider; protected override int MaxConcurrentItems => 2; protected override QueueType Queue => QueueType.Event; public EventConsumer(IPersistenceProvider persistenceStore, IQueueProvider queueProvider, ILoggerFactory loggerFactory, IServiceProvider serviceProvider, IWorkflowRegistry registry, IDistributedLockProvider lockProvider, WorkflowOptions options, IDateTimeProvider datetimeProvider) : base(queueProvider, loggerFactory, options) { _persistenceStore = persistenceStore; _lockProvider = lockProvider; _datetimeProvider = datetimeProvider; } protected override async Task ProcessItem(string itemId, CancellationToken cancellationToken) { if (!await _lockProvider.AcquireLock($"evt:{itemId}", cancellationToken)) { Logger.LogInformation($"Event locked {itemId}"); return; } try { cancellationToken.ThrowIfCancellationRequested(); var evt = await _persistenceStore.GetEvent(itemId); if (evt.EventTime <= _datetimeProvider.Now.ToUniversalTime()) { var subs = await _persistenceStore.GetSubcriptions(evt.EventName, evt.EventKey, evt.EventTime); var toQueue = new List<string>(); var complete = true; foreach (var sub in subs.ToList()) complete = complete && await SeedSubscription(evt, sub, toQueue, cancellationToken); if (complete) await _persistenceStore.MarkEventProcessed(itemId); foreach (var eventId in toQueue) await QueueProvider.QueueWork(eventId, QueueType.Event); } } finally { await _lockProvider.ReleaseLock($"evt:{itemId}"); } } private async Task<bool> SeedSubscription(Event evt, EventSubscription sub, List<string> toQueue, CancellationToken cancellationToken) { foreach (var eventId in await _persistenceStore.GetEvents(sub.EventName, sub.EventKey, sub.SubscribeAsOf)) { if (eventId == evt.Id) continue; var siblingEvent = await _persistenceStore.GetEvent(eventId); if ((!siblingEvent.IsProcessed) && (siblingEvent.EventTime < evt.EventTime)) { await QueueProvider.QueueWork(eventId, QueueType.Event); return false; } if (!siblingEvent.IsProcessed) toQueue.Add(siblingEvent.Id); } if (!await _lockProvider.AcquireLock(sub.WorkflowId, cancellationToken)) { Logger.LogInformation("Workflow locked {0}", sub.WorkflowId); return false; } try { var workflow = await _persistenceStore.GetWorkflowInstance(sub.WorkflowId); var pointers = workflow.ExecutionPointers.Where(p => p.EventName == sub.EventName && p.EventKey == sub.EventKey && !p.EventPublished && p.EndTime == null); foreach (var p in pointers) { p.EventData = evt.EventData; p.EventPublished = true; p.Active = true; } workflow.NextExecution = 0; await _persistenceStore.PersistWorkflow(workflow); await _persistenceStore.TerminateSubscription(sub.Id); return true; } catch (Exception ex) { Logger.LogError(ex.Message); return false; } finally { await _lockProvider.ReleaseLock(sub.WorkflowId); await QueueProvider.QueueWork(sub.WorkflowId, QueueType.Workflow); } } } }
40.780702
289
0.5812
[ "MIT" ]
7studios/workflow-core
src/WorkflowCore/Services/BackgroundTasks/EventConsumer.cs
4,651
C#
// <copyright file="MelodicStructure.cs" company="Traced-Ideas, Czech republic"> // Copyright (c) 1990-2021 All Right Reserved // </copyright> // <author>vl</author> // <email></email> // <date>2021-09-01</date> // <summary>Part of Largo Composer</summary> using System; using System.Diagnostics.Contracts; using System.Globalization; using System.Text; using System.Xml.Serialization; using LargoSharedClasses.Interfaces; using LargoSharedClasses.Localization; using LargoSharedClasses.Melody; namespace LargoSharedClasses.Music { /// <summary> Melodic fragment. </summary> /// <remarks> Melodic fragment is a subclass of figural structure. Two types of figures are distinguished: /// modal (tones step within current harmonic modality) and harmonic (tones in actual harmonic structure). /// Melodic fragment is defined by its pattern. In addition to that some characteristics /// (like variability, stability or homogeneity...) are planned to be computed. </remarks> [Serializable] [XmlRoot] public sealed class MelodicStructure : FiguralSchema, IModalStruct { #region Constructors /// <summary> /// Initializes a new instance of the MelodicStructure class. Serializable. </summary> public MelodicStructure() { this.ToneSchema = this.SymbolStringOfMode(0); } /// <summary> /// Initializes a new instance of the MelodicStructure class. /// </summary> /// <param name="givenSystem">The given system.</param> /// <param name="structuralCode">Structural code.</param> public MelodicStructure(GeneralSystem givenSystem, string structuralCode) : base(givenSystem, structuralCode) { Contract.Requires(givenSystem != null); //// if (givenSystem == null) { return; } //// if (givenSystem.Order == 0) { throw new ArgumentException("Order of MelodicStructure not defined."); } //// HarmonicSystem hs = HarmonicSystem.GetHarmonicSystem(DefaultValue.HarmonicOrder); //// this.HarmonicModality = HarmonicModality.GetNewHarmonicModality(hs, 2741); } /// <summary> /// Initializes a new instance of the MelodicStructure class. /// </summary> /// <param name="givenSystem">The given system.</param> /// <param name="number">Number of instance.</param> public MelodicStructure(GeneralSystem givenSystem, decimal number) : base(givenSystem, number) { Contract.Requires(givenSystem != null); } /// <summary> Initializes a new instance of the MelodicStructure class. </summary> /// <param name="structure">Figural structure.</param> public MelodicStructure(FiguralStructure structure) : base(structure) { Contract.Requires(structure != null); } #endregion #region Interface - simple properties /// <summary> Gets or sets the starting drift of the structure. </summary> /// <value> Property description. </value> public int Drift { get; set; } /// <summary> Gets or sets the starting octave of the structure. </summary> /// <value> Property description. </value> public MusicalOctave Octave { get; set; } /// <summary> Gets or sets the starting band type of the structure. </summary> /// <value> Property description. </value> public MusicalBand BandType { get; set; } /// <summary> Gets or sets the starting guessed part type of the structure. </summary> /// <value> Property description. </value> public MelodicFunction MelodicFunction { get; set; } /// <summary> /// Gets or sets the bar number. /// </summary> /// <value> /// The bar number. /// </value> public int BarNumber { get; set; } #endregion #region Interface - object properties /// <summary> Gets harmonic system. </summary> /// <value> Property description. </value> [XmlIgnore] public MelodicSystem MelodicSystem => (MelodicSystem)this.GSystem; /// <summary> Gets or sets harmonic modality. </summary> /// <value> Property description. </value> public HarmonicModality HarmonicModality { get => (HarmonicModality)this.Modality; set => this.Modality = value; } /// <summary> Gets schema of tones. </summary> /// <value> Property description. </value> [XmlAttribute] public string ToneSchema { get; private set; } /// <summary> Gets direction. </summary> /// <value> Property description. </value> public float Direction { get; private set; } #endregion #region Properties /// <summary> /// Gets MelodicTypeString. /// </summary> /// <value> Property description. </value> public string MelodicTypeString => LocalizedMusic.String("MelodicFunction" + ((byte)this.MelodicFunction).ToString(CultureInfo.CurrentCulture)); /// <summary> /// Gets BandTypeString. /// </summary> /// <value> Property description. </value> public string OctaveString => LocalizedMusic.String("Octave" + ((byte)this.Octave).ToString(CultureInfo.CurrentCulture)); #endregion #region Static factory methods /// <summary> /// Get New Melodic Struct. /// </summary> /// <param name="givenSystem">The given system.</param> /// <param name="structuralCode">Structural code.</param> /// <returns> /// Returns value. /// </returns> public static MelodicStructure GetNewMelStruct(GeneralSystem givenSystem, string structuralCode) { Contract.Requires(givenSystem != null); var ms = new MelodicStructure(givenSystem, structuralCode); ms.DetermineBehavior(); return ms; } #endregion #region Comparison /// <summary> Support sorting according to level and number. </summary> /// <param name="obj">Object to be compared.</param> /// <returns> Returns value. </returns> public override int CompareTo(object obj) { return obj is MelodicStructure ms ? string.Compare(this.PositiveElementSchema, ms.PositiveElementSchema, StringComparison.Ordinal) : 0; //// This kills the DataGrid //// throw new ArgumentException("Object is not a MelodicStructure"); } /// <summary> Test of equality. </summary> /// <param name="obj">Object to be compared.</param> /// <returns> Returns value. </returns> public override bool Equals(object obj) { //// check null (this pointer is never null in C# methods) if (object.ReferenceEquals(obj, null)) { return false; } if (object.ReferenceEquals(this, obj)) { return true; } if (this.GetType() != obj.GetType()) { return false; } return this.CompareTo(obj) == 0; } #endregion #region Public methods /// <summary> /// Get Hash Code. /// </summary> /// <returns> Returns value. </returns> public override int GetHashCode() { const byte hashBase = 17; const byte hashQuotient = 23; unchecked { int result = hashBase; result = (result * hashQuotient) + (this.ToneSchema != null ? this.ToneSchema.GetHashCode() : 0); result = (result * hashQuotient) + this.Drift.GetHashCode(); result = (result * hashQuotient) + this.Octave.GetHashCode(); result = (result * hashQuotient) + this.BandType.GetHashCode(); result = (result * hashQuotient) + this.MelodicFunction.GetHashCode(); result = (result * hashQuotient) + this.Direction.GetHashCode(); return result; } } /// <summary> Evaluate properties of the structure. Used in descendant objects. /// Must be virtual, because of call from StructuralVariety. </summary> public override void DetermineBehavior() { this.SetElementsFromDifferences(); } /// <summary> Test of emptiness. </summary> /// <returns> Returns value. </returns> public override bool IsEmptyStruct() { return false; } /// <summary> Validity test. </summary> /// <returns> Returns value. </returns> public override bool IsValidStruct() { if (this.ElementList.Count <= 0) { return true; } int sum = this.ElementList[this.ElementList.Count - 1]; Contract.Assume(sum > short.MinValue); //// Only fragments not exceeding 10 modality steps (c. 1-2 octaves) var ok = Math.Abs(sum) <= 10; return ok; } /// <summary> Determine and sets the direction property. </summary> public void ComputeDirection() { Contract.Requires(this.ElementList.Count > 0); short firstElem = (byte)this.ElementList[0]; short lastElem = (byte)this.ElementList[this.ElementList.Count - 1]; this.Direction = lastElem - firstElem; } /// <summary> /// Complete FromElements. /// </summary> public override void CompleteFromElements() { //// Contract.Requires(0 < this.ElementList.Count); if (this.ElementList.Count > 0) { base.CompleteFromElements(); } if (this.ElementList.Count > 0) { this.ComputeDirection(); } } /// <summary> /// Planned altitude. /// </summary> /// <param name="harmonicSystem">The harmonic system.</param> /// <param name="harmonicModality">The harmonic modality.</param> /// <param name="modalityIndex">Index of the modality.</param> /// <returns> Returns value. </returns> public int PlannedAltitude(GeneralSystem harmonicSystem, BinarySchema harmonicModality, int modalityIndex) { var elements = this.ElementList; if (harmonicSystem == null) { return 0; } if (harmonicModality == null) { return 0; } if (elements.Count <= 0) { return 0; } while (modalityIndex < 0) { modalityIndex += elements.Count; } int index = elements[modalityIndex % elements.Count]; int octaveShift = modalityIndex / harmonicModality.Level; var altitude = (byte)(this.Octave + octaveShift) * harmonicSystem.Order; if (harmonicModality.Level <= 0) { return altitude; } index = index % harmonicModality.Level; if (index >= 0) { altitude += harmonicModality.Places[index]; } return altitude; } #endregion #region String representation /// <summary> /// Make string of musical symbols. /// </summary> /// <param name="givenShift">Given Shift.</param> /// <returns> Returns value. </returns> public string SymbolStringOfMode(short givenShift) { var str = new StringBuilder(); var lastE = (byte)(this.GSystem.Order - 1); var hm = (HarmonicModality)this.Modality; if (hm == null) { return string.Empty; } string s; //// = hm.Symbol(givenShift); //// str.Append(s.PadRight(2)); short level; for (byte e = 0; e < lastE; e++) { if (e >= this.ElementList.Count) { continue; } level = (short)(this.ElementList[e] + givenShift); s = hm.SymbolAtLevel(level); if (s != null) { str.Append(s.PadRight(2)); } } if (lastE >= this.ElementList.Count) { return str.ToString(); } level = (short)(this.ElementList[lastE] + givenShift); s = hm.SymbolAtLevel(level); if (s != null) { str.Append(s.PadRight(2)); } return str.ToString(); } /// <summary> String representation of the object. </summary> /// <returns> Returns value.</returns> public override string ToString() { // s.Append(this.ElementString()); return string.Format(CultureInfo.InvariantCulture, "{0} {1}", base.ToString(), this.ToneSchema); } #endregion #region Transformations /// <summary> /// Makes the descending. /// </summary> public void MakeDescending() { var cnt = this.ElementList.Count; for (byte e = 0; e < cnt; e++) { this.ElementList[e] = (short)(cnt - e); } } /// <summary> /// Makes the ascending. /// </summary> public void MakeAscending() { var cnt = this.ElementList.Count; for (byte e = 0; e < cnt; e++) { this.ElementList[e] = e; } } /// <summary> /// Inverts this instance. /// </summary> public void Invert() { var cnt = this.ElementList.Count; for (byte e = 0; e < cnt; e++) { this.ElementList[e] = (short)-this.ElementList[e]; } } /// <summary> /// Magnifies this instance. /// </summary> public void Magnify() { var cnt = this.ElementList.Count; for (byte e = 0; e < cnt; e++) { this.ElementList[e] = (short)(2 * this.ElementList[e]); } } #endregion } }
37.059896
152
0.55871
[ "MIT" ]
Vladimir1965/LargoComposer
LargoSharedClasses/Music/MelodicStructure.cs
14,233
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Integer_to_Hex_and_Binary { class Program { static void Main(string[] args) { var num = int.Parse(Console.ReadLine()); Console.WriteLine($"{Convert.ToString(num, 16).ToUpper()}\n{Convert.ToString(num, 2)}"); } } }
21.210526
100
0.637717
[ "MIT" ]
BlueDress/School
Programming Fundamentals C#/Data Types and Variables Exercises/Integer to Hex and Binary/Program.cs
405
C#
namespace Project_CSWM { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.TaskManagerChk = new System.Windows.Forms.CheckBox(); this.CreditsLbl = new System.Windows.Forms.Label(); this.CreateRestorePointBtn = new System.Windows.Forms.Button(); this.RestorePointNty = new System.Windows.Forms.NotifyIcon(this.components); this.TaskManagerBtn = new System.Windows.Forms.Button(); this.SuspendLayout(); // // TaskManagerChk // this.TaskManagerChk.AutoSize = true; this.TaskManagerChk.Location = new System.Drawing.Point(12, 86); this.TaskManagerChk.Name = "TaskManagerChk"; this.TaskManagerChk.Size = new System.Drawing.Size(183, 17); this.TaskManagerChk.TabIndex = 0; this.TaskManagerChk.Text = "[Enable/Disable] - Task Manager"; this.TaskManagerChk.UseVisualStyleBackColor = true; this.TaskManagerChk.CheckedChanged += new System.EventHandler(this.TaskManagerChk_CheckedChanged); // // CreditsLbl // this.CreditsLbl.AutoSize = true; this.CreditsLbl.Location = new System.Drawing.Point(9, 118); this.CreditsLbl.Name = "CreditsLbl"; this.CreditsLbl.Size = new System.Drawing.Size(238, 13); this.CreditsLbl.TabIndex = 1; this.CreditsLbl.Text = "Computer Software Working Management - 2019"; // // CreateRestorePointBtn // this.CreateRestorePointBtn.Location = new System.Drawing.Point(12, 12); this.CreateRestorePointBtn.Name = "CreateRestorePointBtn"; this.CreateRestorePointBtn.Size = new System.Drawing.Size(238, 23); this.CreateRestorePointBtn.TabIndex = 2; this.CreateRestorePointBtn.Text = "Create Restore Point"; this.CreateRestorePointBtn.UseVisualStyleBackColor = true; this.CreateRestorePointBtn.Click += new System.EventHandler(this.CreateRestorePointBtn_Click); // // RestorePointNty // this.RestorePointNty.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; this.RestorePointNty.BalloonTipText = "Creating restore point.."; this.RestorePointNty.BalloonTipTitle = "Restore Point"; this.RestorePointNty.Text = "CSWM - Restore Point"; this.RestorePointNty.Visible = true; // // TaskManagerBtn // this.TaskManagerBtn.Location = new System.Drawing.Point(12, 41); this.TaskManagerBtn.Name = "TaskManagerBtn"; this.TaskManagerBtn.Size = new System.Drawing.Size(238, 23); this.TaskManagerBtn.TabIndex = 3; this.TaskManagerBtn.Text = "Task Manager"; this.TaskManagerBtn.UseVisualStyleBackColor = true; this.TaskManagerBtn.Click += new System.EventHandler(this.Button1_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(265, 142); this.Controls.Add(this.TaskManagerBtn); this.Controls.Add(this.CreateRestorePointBtn); this.Controls.Add(this.CreditsLbl); this.Controls.Add(this.TaskManagerChk); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.Name = "Form1"; this.Text = "CSWM - Settings"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.CheckBox TaskManagerChk; private System.Windows.Forms.Label CreditsLbl; private System.Windows.Forms.Button CreateRestorePointBtn; private System.Windows.Forms.NotifyIcon RestorePointNty; private System.Windows.Forms.Button TaskManagerBtn; } }
44.965217
111
0.594856
[ "MIT" ]
ShA-FR/Computer-Software-Working-Management
Project_CSWM/Panel.Designer.cs
5,173
C#
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System; using Orleans; using Squidex.Infrastructure.Orleans; namespace Squidex.Infrastructure.EventSourcing.Grains { public sealed class OrleansEventNotifier : IEventNotifier { private readonly Lazy<IEventConsumerManagerGrain> eventConsumerManagerGrain; public OrleansEventNotifier(IGrainFactory factory) { eventConsumerManagerGrain = new Lazy<IEventConsumerManagerGrain>(() => { return factory.GetGrain<IEventConsumerManagerGrain>(SingleGrain.Id); }); } public void NotifyEventsStored(string streamName) { eventConsumerManagerGrain.Value.ActivateAsync(streamName); } } }
33.8125
84
0.54159
[ "MIT" ]
Dakraid/squidex
backend/src/Squidex.Infrastructure/EventSourcing/Grains/OrleansEventNotifier.cs
1,084
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Counter_wfa.Models; namespace Counter_wfa.Repositories { class CountersTemporarilyRepository : ICountersRepository { readonly List<Counter> counters; public CountersTemporarilyRepository() { counters = new List<Counter>(); } public Task<IEnumerable<Counter>> GetCounters() { return Task.FromResult<IEnumerable<Counter>>(counters); } public Task SaveOrReplace(Counter counter) { var repoCounter = counters.FirstOrDefault(c => c.Name.Equals(counter.Name)); if (repoCounter == null) return Task.Run(() => Save(counter)); return Task.Run(() => Replace(repoCounter, counter)); } void Save(Counter counter) { counters.Add(counter); } void Replace(Counter old, Counter newCounter) { var index = counters.IndexOf(old); counters.RemoveAt(index); counters.Insert(index, newCounter); } } }
26.272727
88
0.605536
[ "MIT" ]
sakusnowman/study_samples
counter/Counter_wfa/Counter_wfa/Repositories/CountersTemporarilyRepository.cs
1,158
C#