content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2 values |
|---|---|---|---|---|---|---|---|---|
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Threading;
using MvvmTools.Extensions;
using MvvmTools.Services;
using Unity;
namespace MvvmTools.ViewModels
{
public class T4UserControlViewModel : BaseViewModel
{
#region Data
private string _initialBuffer;
private readonly DispatcherTimer _transformTimer;
#endregion Data
#region Ctor and Init
public T4UserControlViewModel(IUnityContainer container,
ITemplateService templateService) : base(container)
{
TemplateService = templateService;
// Transforms only happen at most every interval.
_transformTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(600)};
_transformTimer.Tick += TransformTimerOnTick;
}
private void TransformTimerOnTick(object sender, EventArgs eventArgs)
{
_transformTimer.Stop();
Transform();
}
#endregion Ctor and Init
#region Properties
public string HeaderFirstPart
{
get
{
var sb = new StringBuilder();
sb.AppendLine("<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>");
sb.AppendLine("<#@ assembly name=\"System.Core\" #>");
sb.AppendLine("<#@ assembly name=\"System.Data\" #>");
sb.AppendLine("<#@ assembly name=\"System.Data.DataSetExtensions\" #>");
sb.AppendLine("<#@ assembly name=\"System.IO\" #>");
sb.AppendLine("<#@ assembly name=\"System.Net.Http\" #>");
sb.AppendLine("<#@ assembly name=\"System.Runtime\" #>");
sb.AppendLine("<#@ assembly name=\"System.Text.Encoding\" #>");
sb.AppendLine("<#@ assembly name=\"System.Threading.Tasks\" #>");
sb.AppendLine("<#@ assembly name=\"Microsoft.CSharp\" #>");
sb.AppendLine("<#@ assembly name=\"Microsoft.CodeAnalysis.dll\" #>");
sb.AppendLine("<#@ assembly name=\"Microsoft.CodeAnalysis.CSharp.dll\" #>");
sb.AppendLine("<#@ assembly name=\"System.Collections.Immutable.dll\" #>");
sb.AppendLine("<#@ assembly name=\"PresentationCore\" #>");
sb.AppendLine("<#@ assembly name=\"PresentationFramework\" #>");
sb.AppendLine("<#@ assembly name=\"WindowsBase\" #>");
sb.AppendLine("<#@ assembly name=\"System.Xaml\" #>");
sb.AppendLine("<#@ assembly name=\"System.Xml\" #>");
sb.AppendLine("<#@ assembly name=\"System.Xml.Linq\" #>");
sb.AppendLine("<#@ assembly name=\"MvvmTools.Core.dll\" #>");
sb.AppendLine("<#@ import namespace=\"System.Linq\" #>");
sb.AppendLine("<#@ import namespace=\"System.Text\" #>");
sb.AppendLine("<#@ import namespace=\"System.Collections.Generic\" #>");
sb.AppendLine("<#@ import namespace=\"System.IO\" #>");
sb.AppendLine("<#@ import namespace=\"Microsoft.CodeAnalysis\" #>");
sb.AppendLine("<#@ import namespace=\"Microsoft.CodeAnalysis.CSharp\" #>");
sb.AppendLine("<#@ import namespace=\"Microsoft.CodeAnalysis.CSharp.Syntax\" #>");
sb.AppendLine("<#@ import namespace=\"MvvmTools.Core\" #>");
sb.AppendLine("<#@ import namespace=\"MvvmTools.Core.Extensions\" #>");
return sb.ToString().TrimEnd();
}
}
public string Header
{
get
{
var sb = new StringBuilder(HeaderFirstPart, HeaderFirstPart.Length + 1000);
foreach (var f in PredefinedFields)
sb.AppendLine($"<#@ parameter name=\"{f.Name}\" type=\"{f.Type}\" #>");
foreach (var f in CustomFields)
sb.AppendLine($"<#@ parameter name=\"{f.Name}\" type=\"{f.Type}\" #>");
return sb.ToString().TrimEnd();
}
}
public ITemplateService TemplateService { get; set; }
#region ShowErrors
private bool _showErrors;
public bool ShowErrors
{
get { return _showErrors; }
set { SetProperty(ref _showErrors, value); }
}
#endregion ShowErrors
#region Name
private string _name;
public string Name
{
get { return _name; }
set { SetProperty(ref _name, value); }
}
#endregion Name
#region Buffer
private string _buffer;
public string Buffer
{
get { return _buffer; }
set
{
if (SetProperty(ref _buffer, value))
{
NotifyPropertyChanged(nameof(IsModified));
_transformTimer.Stop();
_transformTimer.Start();
}
}
}
#endregion Buffer
#region Preview
private string _preview;
public string Preview
{
get { return _preview; }
set { SetProperty(ref _preview, value); }
}
#endregion Preview
#region Errors
private List<T4Error> _errors;
public List<T4Error> Errors
{
get { return _errors; }
set
{
if (SetProperty(ref _errors, value))
ShowErrors = Errors?.Count > 0;
}
}
#endregion Errors
#region IsModified
public bool IsModified => _initialBuffer != Buffer;
#endregion IsModified
#region PredefinedFields
private List<InsertFieldViewModel> _predefinedFields;
public List<InsertFieldViewModel> PredefinedFields
{
get { return _predefinedFields; }
set { SetProperty(ref _predefinedFields, value); }
}
#endregion PredefinedFields
#region CustomFields
private List<InsertFieldViewModel> _customFields;
public List<InsertFieldViewModel> CustomFields
{
get { return _customFields; }
set { SetProperty(ref _customFields, value); }
}
#endregion CustomFields
#endregion Properties
#region Commands
#endregion Commands
#region Public Methods
public static T4UserControlViewModel Create(IUnityContainer container, string buffer, List<InsertFieldViewModel> predefinedFields, List<InsertFieldViewModel> customFields)
{
var rval = container.Resolve<T4UserControlViewModel>();
rval.Init(buffer);
return rval;
}
public void Init(string buffer)
{
_initialBuffer = buffer;
Buffer = buffer;
}
public void ResetFieldValues(List<InsertFieldViewModel> predefinedFields, List<InsertFieldViewModel> customFields)
{
PredefinedFields = predefinedFields;
CustomFields = customFields;
Transform();
}
#endregion Public Methods
#region Virtuals
#endregion Virtuals
#region Private Helpers
private void Transform()
{
if (PredefinedFields == null || CustomFields == null)
return;
try
{
string preview;
Errors = TemplateService.Transform(Header + Buffer, PredefinedFields, CustomFields, out preview);
var lc = Header.LineCount();
foreach (var r in Errors)
{
r.Line -= lc;
if (r.Line < 1)
r.Line = 1;
}
Preview = preview;
}
catch (Exception ex)
{
Errors = new List<T4Error> { new T4Error(ex.ToString(), 0, 0) };
Preview = null;
}
}
#endregion Private Helpers
}
}
| 33.567347 | 179 | 0.530764 | [
"Apache-2.0"
] | HFMS-LHB/Mvvm-Tools | MvvmTools/ViewModels/T4UserControlViewModel.cs | 8,226 | C# |
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ProductsArchive.Infrastructure.Persistence;
#nullable disable
namespace ProductsArchive.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("Expiration")
.IsRequired()
.HasColumnType("datetime2");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("UserCode");
b.HasIndex("DeviceCode")
.IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes", (string)null);
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("Algorithm")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<bool>("DataProtected")
.HasColumnType("bit");
b.Property<bool>("IsX509Certificate")
.HasColumnType("bit");
b.Property<string>("Use")
.HasColumnType("nvarchar(450)");
b.Property<int>("Version")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("Use");
b.ToTable("Keys", (string)null);
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("ConsumedTime")
.HasColumnType("datetime2");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("Expiration")
.HasColumnType("datetime2");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Key");
b.HasIndex("ConsumedTime");
b.HasIndex("Expiration");
b.HasIndex("SubjectId", "ClientId", "Type");
b.HasIndex("SubjectId", "SessionId", "Type");
b.ToTable("PersistedGrants", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("ProductsArchive.Domain.Common.Localization.LocalizedString", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("LocalizedStrings", (string)null);
});
modelBuilder.Entity("ProductsArchive.Domain.Common.Localization.LocalizedStringValue", b =>
{
b.Property<Guid?>("LocalizedStringId")
.HasColumnType("uniqueidentifier");
b.Property<string>("TwoLetterISOLanguageName")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("LocalizedStringId", "TwoLetterISOLanguageName");
b.ToTable("LocalizedStringValues", (string)null);
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.Product", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GroupId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("NetWeight")
.HasColumnType("nvarchar(max)");
b.Property<string>("ProductId")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("SizeId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("GroupId");
b.HasIndex("SizeId");
b.ToTable("Products", (string)null);
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.ProductCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("NameId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("NameId");
b.ToTable("ProductCategories", (string)null);
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.ProductGroup", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CategoryId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("DescriptionId")
.HasColumnType("uniqueidentifier");
b.Property<string>("GroupId")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("NameId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("DescriptionId");
b.HasIndex("NameId");
b.ToTable("ProductGroups", (string)null);
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.ProductSize", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("NameId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("NameId");
b.ToTable("ProductSizes", (string)null);
});
modelBuilder.Entity("ProductsArchive.Infrastructure.Identity.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("ProductsArchive.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("ProductsArchive.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ProductsArchive.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("ProductsArchive.Infrastructure.Identity.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ProductsArchive.Domain.Common.Localization.LocalizedStringValue", b =>
{
b.HasOne("ProductsArchive.Domain.Common.Localization.LocalizedString", "LocalizedString")
.WithMany("LocalizedValues")
.HasForeignKey("LocalizedStringId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LocalizedString");
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.Product", b =>
{
b.HasOne("ProductsArchive.Domain.Entities.ProductsSection.ProductGroup", "Group")
.WithMany("Products")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ProductsArchive.Domain.Entities.ProductsSection.ProductSize", "Size")
.WithMany("Products")
.HasForeignKey("SizeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Group");
b.Navigation("Size");
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.ProductCategory", b =>
{
b.HasOne("ProductsArchive.Domain.Common.Localization.LocalizedString", "Name")
.WithMany()
.HasForeignKey("NameId");
b.Navigation("Name");
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.ProductGroup", b =>
{
b.HasOne("ProductsArchive.Domain.Entities.ProductsSection.ProductCategory", "Category")
.WithMany("Groups")
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ProductsArchive.Domain.Common.Localization.LocalizedString", "Description")
.WithMany()
.HasForeignKey("DescriptionId");
b.HasOne("ProductsArchive.Domain.Common.Localization.LocalizedString", "Name")
.WithMany()
.HasForeignKey("NameId");
b.Navigation("Category");
b.Navigation("Description");
b.Navigation("Name");
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.ProductSize", b =>
{
b.HasOne("ProductsArchive.Domain.Common.Localization.LocalizedString", "Name")
.WithMany()
.HasForeignKey("NameId");
b.Navigation("Name");
});
modelBuilder.Entity("ProductsArchive.Domain.Common.Localization.LocalizedString", b =>
{
b.Navigation("LocalizedValues");
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.ProductCategory", b =>
{
b.Navigation("Groups");
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.ProductGroup", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("ProductsArchive.Domain.Entities.ProductsSection.ProductSize", b =>
{
b.Navigation("Products");
});
#pragma warning restore 612, 618
}
}
}
| 37.190828 | 109 | 0.460403 | [
"MIT"
] | MatteoZampariniDev/ProductsArchive | src/Infrastructure/Persistence/Migrations/ApplicationDbContextModelSnapshot.cs | 25,143 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace GenExampleRuntimeT4
{
class Program
{
public const string OutputFileName = "Main.cs";
public const string TargetProject = "TargetRuntimeT4";
public static string OutputFileOfTargetProject
{
get { return String.Format(@"..\..\..\{0}\{1}", TargetProject, OutputFileName); }
}
public static string ReportFilename { get { return "MainReport.html"; } }
static void Main(string[] args)
{
var gencodeMain = new Main();
String gencodeMainText = gencodeMain.TransformText();
File.WriteAllText(OutputFileOfTargetProject, gencodeMainText);
Console.WriteLine("Generated file: " + OutputFileOfTargetProject);
var gencodeReport = new MainReport();
String gencodeReportText = gencodeReport.TransformText();
File.WriteAllText(ReportFilename, gencodeReportText);
System.Diagnostics.Process.Start(ReportFilename);
}
}
}
| 33.558824 | 93 | 0.653812 | [
"MIT"
] | mdobro1/AgileCodeGeneration | AgileCodeGen/GenExampleRuntimeT4/Program.cs | 1,143 | C# |
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace NP.PDD.MainApp
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
| 17.304348 | 44 | 0.585427 | [
"MIT"
] | npolyak/NP.PrototypeDrivenDevelopmentSample | CompleteApp/src/NP.PDD.MainApp/MainWindow.axaml.cs | 398 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNextGen.ContainerService.V20180801Preview.Inputs
{
/// <summary>
/// A Kubernetes add-on profile for a managed cluster.
/// </summary>
public sealed class ManagedClusterAddonProfileArgs : Pulumi.ResourceArgs
{
[Input("config")]
private InputMap<string>? _config;
/// <summary>
/// Key-value pairs for configuring an add-on.
/// </summary>
public InputMap<string> Config
{
get => _config ?? (_config = new InputMap<string>());
set => _config = value;
}
/// <summary>
/// Whether the add-on is enabled or not.
/// </summary>
[Input("enabled", required: true)]
public Input<bool> Enabled { get; set; } = null!;
public ManagedClusterAddonProfileArgs()
{
}
}
}
| 28.219512 | 81 | 0.611063 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/dotnet/ContainerService/V20180801Preview/Inputs/ManagedClusterAddonProfileArgs.cs | 1,157 | C# |
using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke.VssApi
{
/// <summary>Contains the methods used by VSS to manage shadow copy volumes.</summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nn-vsprov-ivssfilesharesnapshotprovider
[PInvokeData("vsprov.h", MSDNShortId = "NN:vsprov.IVssFileShareSnapshotProvider")]
[ComImport, Guid("c8636060-7c2e-11df-8c4a-0800200c9a66"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVssFileShareSnapshotProvider
{
/// <summary>Sets the context for the subsequent shadow copy-related operations.</summary>
/// <param name="lContext">
/// The context to be set. The context must be one of the supported values of _VSS_SNAPSHOT_CONTEXT or a supported combination of
/// _VSS_VOLUME_SNAPSHOT_ATTRIBUTES and <c>_VSS_SNAPSHOT_CONTEXT</c> values.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The context was set successfully.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_BAD_STATE</c></term>
/// <term>The context is frozen and cannot be changed.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>The default context for VSS shadow copies is VSS_CTX_BACKUP.</para>
/// <para>
/// <c>Windows XP:</c> The only supported context is the default context, VSS_CTX_BACKUP. Therefore, calling SetContext under
/// Windows XP returns E_NOTIMPL.
/// </para>
/// <para>
/// For more information about how the context that is set by SetContext affects how a shadow copy is created and managed, see
/// Implementation Details for Creating Shadow Copies.
/// </para>
/// <para>For a complete discussion of the permitted shadow copy contexts, see _VSS_SNAPSHOT_CONTEXT and _VSS_VOLUME_SNAPSHOT_ATTRIBUTES.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssfilesharesnapshotprovider-setcontext HRESULT SetContext(
// [in] LONG lContext );
[PreserveSig]
HRESULT SetContext(VSS_SNAPSHOT_CONTEXT lContext);
/// <summary>Gets the VSS_SNAPSHOT_PROP structure for a file share snapshot.</summary>
/// <param name="SnapshotId">Shadow copy identifier.</param>
/// <param name="pProp">
/// The address of a caller-allocated VSS_SNAPSHOT_PROP structure that receives the shadow copy properties. The provider is
/// responsible for setting the members of this structure. All members are required except <c>m_pwszExposedName</c> and
/// <c>m_pwszExposedPath</c>, which the provider can set to <c>NULL</c>. The provider allocates memory for all string members that
/// it sets in the structure. When the structure is no longer needed, the caller is responsible for freeing these strings by calling
/// the VssFreeSnapshotProperties function.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The requested information was successfully returned.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified volume was not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNEXPECTED</c></term>
/// <term>
/// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// The caller should set the contents of the VSS_SNAPSHOT_PROP structure to zero before calling the GetSnapshotProperties method.
/// </para>
/// <para>The provider is responsible for allocating and freeing the strings in the VSS_SNAPSHOT_PROP structure.</para>
/// <para>
/// The VSS coordinator calls this method during the PostSnapshot phase of snapshot creation in order to retrieve the snapshot
/// access path (UNC path for file share snapshots). The coordinator calls this method after PreFinalCommitSnapshots and before it
/// invokes PostSnapshot in the writers.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssfilesharesnapshotprovider-getsnapshotproperties HRESULT
// GetSnapshotProperties( [in] VSS_ID SnapshotId, [out] VSS_SNAPSHOT_PROP *pProp );
[PreserveSig]
HRESULT GetSnapshotProperties(Guid SnapshotId, out VSS_SNAPSHOT_PROP pProp);
/// <summary>
/// Gets an enumeration of VSS_SNAPSHOT_PROP structures for all file share snapshots that are available to the application server.
/// </summary>
/// <param name="QueriedObjectId">Reserved for system use. The value of this parameter must be GUID_NULL.</param>
/// <param name="eQueriedObjectType">Reserved for system use. The value of this parameter must be VSS_OBJECT_NONE.</param>
/// <param name="eReturnedObjectsType">Reserved for system use. The value of this parameter must be VSS_OBJECT_SNAPSHOT.</param>
/// <param name="ppEnum">
/// The address of an IVssEnumObject interface pointer, which is initialized on return. Callers must release the interface. This
/// parameter is required and cannot be null.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The query operation was successful.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>This method is typically called in response to requester generated snapshot query operations.</para>
/// <para>
/// Calling the IVssEnumObject::Next method on the IVssEnumObject interface that is returned though the <c>ppEnum</c> parameter will
/// return VSS_OBJECT_PROP structures containing a VSS_SNAPSHOT_PROP structure for each shadow copy.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssfilesharesnapshotprovider-query HRESULT Query( [in]
// VSS_ID QueriedObjectId, [in] VSS_OBJECT_TYPE eQueriedObjectType, [in] VSS_OBJECT_TYPE eReturnedObjectsType, [out] IVssEnumObject
// **ppEnum );
[PreserveSig]
HRESULT Query(Guid QueriedObjectId, VSS_OBJECT_TYPE eQueriedObjectType, VSS_OBJECT_TYPE eReturnedObjectsType, out IVssEnumObject ppEnum);
/// <summary>Deletes specific snapshots, or all snapshots in a specified snapshot set.</summary>
/// <param name="SourceObjectId">Identifier of the shadow copy or shadow copy set to be deleted.</param>
/// <param name="eSourceObjectType">Type of the object to be deleted. The value of this parameter is VSS_OBJECT_SNAPSHOT or VSS_OBJECT_SNAPSHOT_SET.</param>
/// <param name="bForceDelete">
/// If the value of this parameter is <c>TRUE</c>, the provider will do everything possible to delete the shadow copy or shadow
/// copies in a shadow copy set. If it is <c>FALSE</c>, no additional effort will be made.
/// </param>
/// <param name="plDeletedSnapshots">Pointer to a variable that receives the number of shadow copies that were deleted.</param>
/// <param name="pNondeletedSnapshotID">
/// If an error occurs, this parameter receives a pointer to the identifier of the first shadow copy that could not be deleted.
/// Otherwise, it points to GUID_NULL.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The shadow copies were successfully deleted.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified shadow copies were not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// The VSS coordinator calls this method as part of the snapshot auto-release process. The method is also called in response to
/// requester driven delete operations.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssfilesharesnapshotprovider-deletesnapshots HRESULT
// DeleteSnapshots( [in] VSS_ID SourceObjectId, [in] VSS_OBJECT_TYPE eSourceObjectType, [in] BOOL bForceDelete, [out] LONG
// *plDeletedSnapshots, [out] VSS_ID *pNondeletedSnapshotID );
[PreserveSig]
HRESULT DeleteSnapshots(Guid SourceObjectId, VSS_OBJECT_TYPE eSourceObjectType, [MarshalAs(UnmanagedType.Bool)] bool bForceDelete, out int plDeletedSnapshots, out Guid pNondeletedSnapshotID);
/// <summary>VSS calls this method for each shadow copy that is added to the shadow copy set.</summary>
/// <param name="SnapshotSetId">Shadow copy set identifier.</param>
/// <param name="SnapshotId">Identifier of the shadow copy to be created.</param>
/// <param name="pwszSharePath">The file share path.</param>
/// <param name="lNewContext">
/// The context for the shadow copy set. This context consists of a bitmask of _VSS_VOLUME_SNAPSHOT_ATTRIBUTES values.
/// </param>
/// <param name="ProviderId">The provider ID.</param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The shadow copy was successfully created.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified volume was not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNSUPPORTED_CONTEXT</c></term>
/// <term>The specified context is not supported.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER</c></term>
/// <term>The provider does not support the specified volume.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNEXPECTED</c></term>
/// <term>
/// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.
/// <c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> This value is not supported until Windows Server
/// 2008 R2 and Windows 7. E_UNEXPECTED is used instead.
/// </term>
/// </item>
/// </list>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssfilesharesnapshotprovider-beginpreparesnapshot HRESULT
// BeginPrepareSnapshot( [in] VSS_ID SnapshotSetId, [in] VSS_ID SnapshotId, [in] VSS_PWSZ pwszSharePath, [in] LONG lNewContext, [in]
// VSS_ID ProviderId );
[PreserveSig]
HRESULT BeginPrepareSnapshot(Guid SnapshotSetId, Guid SnapshotId, [MarshalAs(UnmanagedType.LPWStr)] string pwszSharePath,
VSS_VOLUME_SNAPSHOT_ATTRIBUTES lNewContext, Guid ProviderId);
/// <summary>Determines whether the given Universal Naming Convention (UNC) path is supported by this provider.</summary>
/// <param name="pwszSharePath">The path to the file share.</param>
/// <param name="pbSupportedByThisProvider">
/// This parameter receives <c>TRUE</c> if shadow copies are supported on the specified volume, otherwise <c>FALSE</c>.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The requested information was successfully returned.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_NESTED_VOLUME_LIMIT</c></term>
/// <term>
/// The specified volume is nested too deeply to participate in the VSS operation. <c>Windows Server 2008, Windows Vista, Windows
/// Server 2003 and Windows XP:</c> This return code is not supported.
/// </term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified volume was not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNEXPECTED</c></term>
/// <term>
/// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.
/// <c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> This value is not supported until Windows Server
/// 2008 R2 and Windows 7. E_UNEXPECTED is used instead.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// The VSS coordinator calls this method as part of AddToSnapshotSet to determine which provider to use for snapshot creation.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssfilesharesnapshotprovider-ispathsupported HRESULT
// IsPathSupported( [in] VSS_PWSZ pwszSharePath, [out] BOOL *pbSupportedByThisProvider );
[PreserveSig]
HRESULT IsPathSupported([MarshalAs(UnmanagedType.LPWStr)] string pwszSharePath, [MarshalAs(UnmanagedType.Bool)] out bool pbSupportedByThisProvider);
/// <summary>Determines whether the given Universal Naming Convention (UNC) path currently has any snapshots.</summary>
/// <param name="pwszSharePath">The path to the file share.</param>
/// <param name="pbSnapshotsPresent">
/// This parameter receives <c>TRUE</c> if the volume has a shadow copy, or <c>FALSE</c> if the volume does not have a shadow copy.
/// </param>
/// <param name="plSnapshotCompatibility">
/// A bitmask of VSS_SNAPSHOT_COMPATIBILITY values that indicate whether certain volume control or file I/O operations are disabled
/// for the given volume, if the volume has a shadow copy.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The requested information was successfully returned.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified volume was not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNEXPECTED</c></term>
/// <term>
/// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.
/// <c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> This value is not supported until Windows Server
/// 2008 R2 and Windows 7. E_UNEXPECTED is used instead.
/// </term>
/// </item>
/// </list>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssfilesharesnapshotprovider-ispathsnapshotted HRESULT
// IsPathSnapshotted( [in] VSS_PWSZ pwszSharePath, [out] BOOL *pbSnapshotsPresent, [out] LONG *plSnapshotCompatibility );
[PreserveSig]
HRESULT IsPathSnapshotted([MarshalAs(UnmanagedType.LPWStr)] string pwszSharePath, [MarshalAs(UnmanagedType.Bool)] out bool pbSnapshotsPresent,
out VSS_SNAPSHOT_COMPATIBILITY plSnapshotCompatibility);
/// <summary>Requests the provider to set a property value for the specified snapshot.</summary>
/// <param name="SnapshotId">Shadow copy identifier. This parameter is required and cannot be GUID_NULL.</param>
/// <param name="eSnapshotPropertyId">A VSS_SNAPSHOT_PROPERTY_ID value that specifies the property to be set for the shadow copy.</param>
/// <param name="vProperty">
/// The value to be set for the property. See the VSS_SNAPSHOT_PROP structure for valid data types and descriptions of the
/// properties that can be set for a shadow copy.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The property was set successfully.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified shadow copy was not found.</term>
/// </item>
/// </list>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssfilesharesnapshotprovider-setsnapshotproperty HRESULT
// SetSnapshotProperty( [in] VSS_ID SnapshotId, [in] VSS_SNAPSHOT_PROPERTY_ID eSnapshotPropertyId, [in] VARIANT vProperty );
[PreserveSig]
HRESULT SetSnapshotProperty(Guid SnapshotId, VSS_SNAPSHOT_PROPERTY_ID eSnapshotPropertyId, object vProperty);
}
/// <summary>
/// <para>
/// The <c>IVssHardwareSnapshotProvider</c> interface contains the methods used by VSS to map volumes to LUNs, discover LUNs created
/// during the shadow copy process, and transport LUNs on a SAN. All hardware providers must support this interface.
/// </para>
/// <para><c>Note</c> Hardware providers are only supported on Windows Server operating systems.</para>
/// </summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nn-vsprov-ivsshardwaresnapshotprovider
[PInvokeData("vsprov.h", MSDNShortId = "NN:vsprov.IVssHardwareSnapshotProvider")]
[ComImport, Guid("9593A157-44E9-4344-BBEB-44FBF9B06B10"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVssHardwareSnapshotProvider
{
/// <summary>
/// <para>
/// The <c>AreLunsSupported</c> method determines whether the hardware provider supports shadow copy creation for all LUNs that
/// contribute to the volume. VSS calls the <c>AreLunsSupported</c> method for each volume that is added to the shadow copy set.
/// Before calling this method, VSS determines the LUNs that contribute to the volume.
/// </para>
/// <para>For a specific volume, each LUN can contribute only once. A specific LUN may contribute to multiple volumes.</para>
/// <para><c>Note</c> Hardware providers are only supported on Windows Server operating systems.</para>
/// </summary>
/// <param name="lLunCount">Count of LUNs contributing to this shadow copy volume.</param>
/// <param name="lContext">
/// Shadow copy context for the current shadow copy set as enumerated by a bitmask of flags from the _VSS_VOLUME_SNAPSHOT_ATTRIBUTES
/// enumeration. If the <c>VSS_VOLSNAP_ATTR_TRANSPORTABLE</c> flag is set, the shadow copy set is transportable.
/// </param>
/// <param name="rgwszDevices">List of devices corresponding to the LUNs to be shadow copied.</param>
/// <param name="pLunInformation">
/// Array of <c>lLunCount</c> VDS_LUN_INFORMATION structures, one for each LUN contributing to this shadow copy volume.
/// </param>
/// <param name="pbIsSupported">
/// Pointer to a <c>BOOL</c> value. If all devices are supported for shadow copy, the provider should store a <c>TRUE</c> value at
/// the location pointed to by <c>pbIsSupported</c>.
/// </param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. The provider must report an event in the application event log providing the user with
/// information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// If the hardware subsystem supports the SCSI Inquiry Data and Vital Product Data page 80 (device serial number) and page 83
/// (device identity) guidelines, the provider should not need to modify the structures in the <c>pLunInformation</c> array.
/// </para>
/// <para>
/// In any case, the <c>AreLunsSupported</c> method should not modify the value of the <c>m_rgInterconnects</c> member of any
/// VDS_LUN_INFORMATION structure in the <c>pLunInformation</c> array.
/// </para>
/// <para>
/// If the provider supports hardware shadow copy creation for all of the LUNs in the <c>pLunInformation</c> array, it should return
/// <c>TRUE</c> in the <c>BOOL</c> value that the <c>pbIsSupported</c> parameter points to. If the provider does not support
/// hardware shadow copies for one or more LUNs, it must set this <c>BOOL</c> value to <c>FALSE</c>.
/// </para>
/// <para>
/// The provider must never agree to create shadow copies if it cannot, even if the problem is only temporary. If a transient
/// condition, such as low resources, makes it impossible for the provider to create a shadow copy using one or more LUNs when
/// <c>AreLunsSupported</c> is called, the provider must set the <c>BOOL</c> value to <c>FALSE</c>.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotprovider-arelunssupported HRESULT
// AreLunsSupported( [in] LONG lLunCount, [in] LONG lContext, [in] VSS_PWSZ *rgwszDevices, [in, out] VDS_LUN_INFORMATION
// *pLunInformation, [out] BOOL *pbIsSupported );
[PreserveSig]
HRESULT AreLunsSupported(int lLunCount, VSS_VOLUME_SNAPSHOT_ATTRIBUTES lContext,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0)] string[] rgwszDevices,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] VDS_LUN_INFORMATION[] pLunInformation,
[MarshalAs(UnmanagedType.Bool)] out bool pbIsSupported);
/// <summary>
/// <para>
/// The <c>FillInLunInfo</c> method prompts the hardware provider to indicate whether it supports the corresponding disk device and
/// correct any omissions in the VDS_LUN_INFORMATION structure. VSS calls the <c>FillInLunInfo</c> method after the
/// IVssHardwareSnapshotProvider::LocateLuns method or before the IVssHardwareSnapshotProvider::OnLunEmpty method to obtain the
/// VDS_LUN_INFORMATION structure associated with a shadow copy LUN. VSS will compare the <c>VDS_LUN_INFORMATION</c> structure
/// received in the IVssHardwareSnapshotProvider::GetTargetLuns method to identify shadow copy LUNs. If the structures do not match,
/// the requester will receive <c>VSS_S_SOME_SNAPSHOTS_NOT_IMPORTED</c>, which indicates a mismatch.
/// </para>
/// <para><c>Note</c> Hardware providers are only supported on Windows Server operating systems.</para>
/// </summary>
/// <param name="wszDeviceName">Device corresponding to the shadow copy LUN.</param>
/// <param name="pLunInfo">The VDS_LUN_INFORMATION structure for the shadow copy LUN.</param>
/// <param name="pbIsSupported">
/// The provider must return <c>TRUE</c> in the location pointed to by the <c>pbIsSupported</c> parameter if the device is supported.
/// </param>
/// <returns>
/// <para>VSS ignores this method's return value.</para>
/// <para><c>Windows Server 2003:</c> VSS does not ignore the return value, which can be one of the following values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c> 0x80042306L</term>
/// <term>
/// An unexpected provider error has occurred. The provider must report an event in the application event log providing the user
/// with information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// VSS calls the <c>FillInLunInfo</c> method for each VDS_LUN_INFORMATION structure that the provider previously initialized in its
/// GetTargetLuns method. VSS also calls the <c>FillInLunInfo</c> method for each new disk device that arrives in the system during
/// the import process.
/// </para>
/// <para>
/// The provider can correct any omissions in the VDS_LUN_INFORMATION structure received in the <c>pLunInfo</c> parameter. However,
/// the provider should not modify the value of the <c>m_rgInterconnects</c> member of this structure.
/// </para>
/// <para>
/// The members of the VDS_LUN_INFORMATION structure correspond to the SCSI Inquiry Data and Vital Product Data page 80 (device
/// serial number) information, with the following exceptions:
/// </para>
/// <list type="bullet">
/// <item>
/// <term>The <c>m_version</c> member must be set to <c>VER_VDS_LUN_INFORMATION</c>.</term>
/// </item>
/// <item>
/// <term>
/// The <c>m_BusType</c> member is ignored in comparisons during import. This value depends on the PnP storage stack on the
/// corresponding disk device. Usually this is <c>VDSBusTypeScsi</c>.
/// </term>
/// </item>
/// <item>
/// <term>The <c>m_diskSignature</c> member is ignored in comparisons during import. The provider must set this member to GUID_NULL.</term>
/// </item>
/// </list>
/// <para>
/// The members of the VDS_STORAGE_DEVICE_ID_DESCRIPTOR structure (in the <c>m_deviceIdDescriptor</c> member of the
/// VDS_LUN_INFORMATION structure) correspond to the page 83 information. In this structure, each VDS_STORAGE_IDENTIFIER structure
/// corresponds to the STORAGE_IDENTIFIER structure for a device identifier (that is, a storage identifier with an association type
/// of zero). For more information about the STORAGE_IDENTIFIER structure, see the Windows Driver Kit (WDK) documentation.
/// </para>
/// <para>
/// If the <c>FillInLunInfo</c> method is called for a LUN that is unknown to the provider, the provider should not return an error.
/// Instead, it should return <c>FALSE</c> in the <c>BOOL</c> value that the <c>pbIsSupported</c> parameter points to and return
/// success. If the provider recognizes the LUN, it should set the <c>BOOL</c> value to <c>TRUE</c>.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotprovider-fillinluninfo HRESULT
// FillInLunInfo( [in] VSS_PWSZ wszDeviceName, [in, out] VDS_LUN_INFORMATION *pLunInfo, [out] BOOL *pbIsSupported );
[PreserveSig]
HRESULT FillInLunInfo([MarshalAs(UnmanagedType.LPWStr)] string wszDeviceName, ref VDS_LUN_INFORMATION pLunInfo,
[MarshalAs(UnmanagedType.Bool)] out bool pbIsSupported);
/// <summary>
/// <para>The <c>BeginPrepareSnapshot</c> method is called for each shadow copy that is added to the shadow copy set.</para>
/// <para><c>Note</c> Hardware providers are only supported on Windows Server operating systems.</para>
/// </summary>
/// <param name="SnapshotSetId">Shadow copy set identifier.</param>
/// <param name="SnapshotId">Identifier of the shadow copy to be created.</param>
/// <param name="lContext">Shadow copy context for current shadow copy set as enumerated by _VSS_VOLUME_SNAPSHOT_ATTRIBUTES.</param>
/// <param name="lLunCount">Count of LUNs contributing to this shadow copy volume.</param>
/// <param name="rgDeviceNames">
/// Pointer to array of <c>lLunCount</c> pointers to strings, each string containing the name of a LUN to be shadow copied.
/// </param>
/// <param name="rgLunInformation">
/// Pointer to array of <c>lLunCount</c> VDS_LUN_INFORMATION structures, one for each LUN contributing to this shadow copy volume.
/// </param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED</c></c> 0x80042312L</term>
/// <term>The provider has reached the maximum number of volumes it can support.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_NESTED_VOLUME_LIMIT</c></term>
/// <term>
/// The specified volume is nested too deeply to participate in the VSS operation. <c>Windows Server 2008, Windows Vista, Windows
/// Server 2003 and Windows XP:</c> This return code is not supported.
/// </term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. The provider must report an event in the application event log providing the user with
/// information on how to resolve the problem.
/// </term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER</c></c> 0x8004230EL</term>
/// <term>The provider does not support this volume.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_UNSUPPORTED_CONTEXT</c></c> 0x8004231BL</term>
/// <term>The context specified by <c>lContext</c> is not supported.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>This method cannot be called for a virtual hard disk (VHD) that is nested inside another VHD.</para>
/// <para><c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> VHDs are not supported.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotprovider-beginpreparesnapshot HRESULT
// BeginPrepareSnapshot( [in] VSS_ID SnapshotSetId, [in] VSS_ID SnapshotId, [in] LONG lContext, [in] LONG lLunCount, [in] VSS_PWSZ
// *rgDeviceNames, [in, out] VDS_LUN_INFORMATION *rgLunInformation );
[PreserveSig]
HRESULT BeginPrepareSnapshot(Guid SnapshotSetId, Guid SnapshotId, VSS_VOLUME_SNAPSHOT_ATTRIBUTES lContext, int lLunCount,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 3)] string[] rgDeviceNames,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] VDS_LUN_INFORMATION[] rgLunInformation);
/// <summary>
/// <para>
/// The <c>GetTargetLuns</c> method prompts the hardware provider to initialize the VDS_LUN_INFORMATION structures for the newly
/// created shadow copy LUNs. The <c>GetTargetLuns</c> method is called after the IVssProviderCreateSnapshotSet::PostCommitSnapshots
/// method. Identifying information for each newly created LUN is returned to VSS through VDS_LUN_INFORMATION structures.
/// </para>
/// <para><c>Note</c> Hardware providers are only supported on Windows Server operating systems.</para>
/// </summary>
/// <param name="lLunCount">Count of LUNs that contribute to the original volume.</param>
/// <param name="rgDeviceNames">
/// Pointer to an array of <c>lLunCount</c> pointers to strings. Each string contains the name of an original LUN to be shadow copied.
/// </param>
/// <param name="rgSourceLuns">
/// Pointer to an array of <c>lLunCount</c> VDS_LUN_INFORMATION structures, one for each LUN that contributes to the original volume.
/// </param>
/// <param name="rgDestinationLuns">
/// Pointer to an array of <c>lLunCount</c> VDS_LUN_INFORMATION structures, one for each new shadow copy LUN created during shadow
/// copy processing. There should be a one-to-one correspondence between the elements of the <c>rgSourceLuns</c> and
/// <c>rgDestinationLuns</c> arrays.
/// </param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. The provider must report an event in the application event log providing the user with
/// information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// In the <c>rgDestinationLuns</c> parameter, VSS supplies an empty VDS_LUN_INFORMATION structure for each newly created shadow
/// copy LUN. The shadow copy LUNs are not surfaced or visible to the system. The provider should initialize the members of the
/// <c>VDS_LUN_INFORMATION</c> structure with the appropriate SCSI Inquiry Data and Vital Product Data page 80 (device serial
/// number) and page 83 (device identity) information. The structure should contain correct member values such that the shadow copy
/// LUNs can be located by Windows from the original computer or any other computer connected to the SAN.
/// </para>
/// <para>The members of the VDS_LUN_INFORMATION structure correspond to the page 80 information, with the following exceptions:</para>
/// <list type="bullet">
/// <item>
/// <term>The <c>m_version</c> member must be set to <c>VER_VDS_LUN_INFORMATION</c>.</term>
/// </item>
/// <item>
/// <term>
/// The <c>m_BusType</c> member is ignored in comparisons during import. This value depends on the PnP storage stack on the
/// corresponding disk device. Usually this is <c>VDSBusTypeScsi</c>.
/// </term>
/// </item>
/// <item>
/// <term>The <c>m_diskSignature</c> member is ignored in comparisons during import. The provider must set this member to GUID_NULL.</term>
/// </item>
/// </list>
/// <para>
/// The members of the VDS_STORAGE_DEVICE_ID_DESCRIPTOR structure (in the <c>m_deviceIdDescriptor</c> member of the
/// VDS_LUN_INFORMATION structure) correspond to the page 83 information. In this structure, each VDS_STORAGE_IDENTIFIER structure
/// corresponds to the STORAGE_IDENTIFIER structure for a device identifier (that is, a storage identifier with an association type
/// of zero). For more information about the STORAGE_IDENTIFIER structure, see the Windows Driver Kit (WDK) documentation.
/// </para>
/// <para>
/// The VDS_LUN_INFORMATION structures returned here must be the same as the structures provided in the
/// IVssHardwareSnapshotProvider::FillInLunInfo method during import so that VSS can use this information to identify the newly
/// arriving shadow copy LUNs at import. These same structures will be passed to the provider in the
/// IVssHardwareSnapshotProvider::LocateLuns method.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotprovider-gettargetluns HRESULT
// GetTargetLuns( [in] LONG lLunCount, [in] VSS_PWSZ *rgDeviceNames, [in] VDS_LUN_INFORMATION *rgSourceLuns, [in, out]
// VDS_LUN_INFORMATION *rgDestinationLuns );
[PreserveSig]
HRESULT GetTargetLuns(int lLunCount,
[In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0)] string[] rgDeviceNames,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] VDS_LUN_INFORMATION[] rgSourceLuns,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] VDS_LUN_INFORMATION[] rgDestinationLuns);
/// <summary>
/// <para>
/// The <c>LocateLuns</c> method prompts the hardware provider to make the shadow copy LUNs visible to the computer. The
/// <c>LocateLuns</c> method is called by VSS when a hardware shadow copy set is imported to a computer. The provider is responsible
/// for any unmasking (or "surfacing") at the hardware level.
/// </para>
/// <para><c>Note</c> Hardware providers are only supported on Windows Server operating systems.</para>
/// </summary>
/// <param name="lLunCount">Number of LUNs that contribute to this shadow copy set.</param>
/// <param name="rgSourceLuns">
/// Pointer to an array of <c>iLunCount</c> VDS_LUN_INFORMATION structures, one for each LUN that is part of the shadow copy set to
/// be imported.
/// </param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. The provider must report an event in the application event log providing the user with
/// information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// In the <c>rgSourceLuns</c> parameter, VSS supplies the same array of VDS_LUN_INFORMATION structures that the provider previously
/// initialized in its IVssHardwareSnapshotProvider::GetTargetLuns method. For each <c>VDS_LUN_INFORMATION</c> structure in the
/// array, the provider should unmask (or "surface") the corresponding shadow copy LUN to the computer.
/// </para>
/// <para>
/// Immediately after this method returns, VSS will perform a rescan and enumeration to detect any arrived devices. This causes any
/// exposed LUNs to be discovered by the PnP manager. In parallel with listening for disk arrivals, VSS will also listen for hidden
/// volume arrivals. VSS will stop listening after all volumes that contribute to a shadow copy set appear in the system or a
/// time-out occurs. If some disk or volume devices fail to appear in this window, the requester will be told that only some of the
/// shadow copies were imported by VSS returning <c>VSS_S_SOME_SNAPSHOTS_NOT_IMPORTED</c> to the requester. The requester will also
/// receive the same error from VSS if the VDS_LUN_INFORMATION structures received from the GetTargetLuns and
/// IVssHardwareSnapshotProvider::FillInLunInfo methods do not match.
/// </para>
/// <para>This method cannot be used to map shadow copy LUNs as read-only.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotprovider-locateluns HRESULT LocateLuns(
// [in] LONG lLunCount, [in] VDS_LUN_INFORMATION *rgSourceLuns );
[PreserveSig]
HRESULT LocateLuns(int lLunCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] VDS_LUN_INFORMATION[] rgSourceLuns);
/// <summary>
/// <para>
/// The <c>OnLunEmpty</c> method is called whenever VSS determines that a shadow copy LUN contains no interesting data. All shadow
/// copies have been deleted (which also causes deletion of the LUN.) The LUN resources may be reclaimed by the provider and reused
/// for another purpose. VSS will dismount any affected volumes. A provider should not issue a rescan during <c>OnLunEmpty</c>. VSS
/// will handle this cleanup.
/// </para>
/// <para><c>Note</c> Hardware providers are only supported on Windows Server operating systems.</para>
/// </summary>
/// <param name="wszDeviceName">Device corresponding to the LUN that contains the shadow copy to be deleted.</param>
/// <param name="pInformation">
/// Pointer to a VDS_LUN_INFORMATION structure containing information about the LUN containing the shadow copy to be deleted.
/// </param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. The provider must report an event in the application event log providing the user with
/// information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// Hardware providers should delete a shadow copy and reclaim the LUN if and only if <c>OnLunEmpty</c> is being called. A hardware
/// shadow copy may be used as the backup media itself, therefore the LUNs should be treated with the same care the storage array
/// treats LUNs used for regular disks. Reclaiming LUNs outside of processing for <c>OnLunEmpty</c> should be limited to emergency
/// or an administrator performing explicit action manually.
/// </para>
/// <para>
/// In the case of persistent shadow copies, the requester deletes the shadow copy when it is no longer needed. In the case of
/// nonpersistent non-auto-release shadow copies, the VSS service deletes the shadow copy when the computer is restarted. In all
/// cases, the VSS service calls the provider's <c>OnLunEmpty</c> method as needed for each shadow copy LUN.
/// </para>
/// <para>
/// Note that <c>OnLunEmpty</c> is called on a best effort basis. VSS invokes the method only when the LUN is guaranteed to be
/// empty. There may be many cases where the LUN is empty but VSS is unable to detect this due to errors or external circumstances.
/// In this case, the user should use storage management software to clear this state.
/// </para>
/// <para>Some examples:</para>
/// <list type="bullet">
/// <item>
/// <term>
/// When a shadow copy LUN is moved to a different host but not actually transported or imported through VSS, then that LUN appears
/// as any other LUN, and volumes can be simply deleted without any notification of VSS.
/// </term>
/// </item>
/// <item>
/// <term>A crash or unexpected reboot in the middle of a shadow copy creation.</term>
/// </item>
/// <item>
/// <term>A canceled import.</term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotprovider-onlunempty HRESULT OnLunEmpty(
// [in] VSS_PWSZ wszDeviceName, [in] VDS_LUN_INFORMATION *pInformation );
[PreserveSig]
HRESULT OnLunEmpty([MarshalAs(UnmanagedType.LPWStr)] string wszDeviceName, in VDS_LUN_INFORMATION pInformation);
}
/// <summary>
/// <para>
/// Provides an additional method used by VSS to notify hardware providers of LUN state changes. All hardware providers must support
/// this interface.
/// </para>
/// <para><c>Note</c> Hardware providers are only supported on Windows Server operating systems.</para>
/// </summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nn-vsprov-ivsshardwaresnapshotproviderex
[PInvokeData("vsprov.h", MSDNShortId = "NN:vsprov.IVssHardwareSnapshotProviderEx")]
[ComImport, Guid("7F5BA925-CDB1-4d11-A71F-339EB7E709FD"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVssHardwareSnapshotProviderEx : IVssHardwareSnapshotProvider
{
/// <summary>
/// <para>Not supported.</para>
/// <para>This method is reserved for future use.</para>
/// </summary>
/// <param name="pllOriginalCapabilityMask">This parameter is reserved for future use.</param>
/// <returns>None</returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotproviderex-getprovidercapabilities
// HRESULT GetProviderCapabilities( ULONGLONG *pllOriginalCapabilityMask );
[PreserveSig]
HRESULT GetProviderCapabilities(out ulong pllOriginalCapabilityMask);
/// <summary>
/// <para>The VSS service calls this method to notify hardware providers of a LUN state change.</para>
/// <para><c>Note</c> Hardware providers are only supported on Windows Server operating systems.</para>
/// </summary>
/// <param name="pSnapshotLuns">
/// A pointer to an array of <c>dwCount</c> VDS_LUN_INFORMATION structures, one for each LUN that contributes to the shadow copy volume.
/// </param>
/// <param name="pOriginalLuns">
/// A pointer to an array of <c>dwCount</c> VDS_LUN_INFORMATION structures, one for each LUN that contributes to the original volume.
/// </param>
/// <param name="dwCount">
/// Number of elements in the <c>pSnapshotLuns</c> array. This is also the number of elements in the <c>pOriginalLuns</c> array.
/// </param>
/// <param name="dwFlags">
/// <para>
/// A bitmask of _VSS_HARDWARE_OPTIONS flags that provide information about the state change that the shadow copy LUNs have
/// undergone. The following table describes how each flag is used in this parameter.
/// </para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>VSS_ONLUNSTATECHANGE_NOTIFY_READ_WRITE</c> 0x00000100</term>
/// <term>The shadow copy LUN will be converted permanently to read-write.</term>
/// </item>
/// <item>
/// <term><c>VSS_ONLUNSTATECHANGE_NOTIFY_LUN_PRE_RECOVERY</c> 0x00000200</term>
/// <term>The shadow copy LUNs will be converted temporarily to read-write and are about to undergo TxF recovery or VSS auto-recovery.</term>
/// </item>
/// <item>
/// <term><c>VSS_ONLUNSTATECHANGE_NOTIFY_LUN_POST_RECOVERY</c> 0x00000400</term>
/// <term>The shadow copy LUNs have just undergone TxF recovery or VSS auto-recovery and have been converted back to read-only.</term>
/// </item>
/// <item>
/// <term><c>VSS_ONLUNSTATECHANGE_DO_MASK_LUNS</c> 0x00000800</term>
/// <term>The shadow copy LUNs must be masked from the current machine but not deleted.</term>
/// </item>
/// </list>
/// </param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. If this is returned, the error must be described in an entry in the application event
/// log, giving the user information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotproviderex-onlunstatechange HRESULT
// OnLunStateChange( [in] VDS_LUN_INFORMATION *pSnapshotLuns, [in] VDS_LUN_INFORMATION *pOriginalLuns, [in] DWORD dwCount, [in]
// DWORD dwFlags );
[PreserveSig]
HRESULT OnLunStateChange([In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] VDS_LUN_INFORMATION[] pSnapshotLuns,
[In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] VDS_LUN_INFORMATION[] pOriginalLuns,
uint dwCount, VSS_HARDWARE_OPTIONS dwFlags);
/// <summary>The VSS service calls this method to notify hardware providers that a LUN resynchronization is needed.</summary>
/// <param name="pSourceLuns">
/// A pointer to an array of <c>dwCount</c> VDS_LUN_INFORMATION structures, one for each LUN that contributes to the shadow copy volume.
/// </param>
/// <param name="pTargetLuns">
/// A pointer to an array of <c>dwCount</c> VDS_LUN_INFORMATION structures, one for each LUN that contributes to the destination
/// volume where the contents of the shadow copy volume are to be copied.
/// </param>
/// <param name="dwCount">
/// The number of elements in the <c>pSourceLuns</c> array. This is also the number of elements in the <c>pTargetLuns</c> array.
/// </param>
/// <param name="ppAsync">
/// A pointer to a location that will receive an IVssAsync interface pointer that can be used to retrieve the status of the
/// resynchronization operation.
/// </param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. If this error code is returned, the error must be described in an entry in the
/// application event log, giving the user information on how to resolve the problem.
/// </term>
/// </item>
/// <item>
/// <term><c>VSS_E_INSUFFICIENT_STORAGE</c> 0x8004231FL</term>
/// <term>The provider cannot perform the operation because there is not enough disk space.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// The destination LUNs can be the LUNs that contribute to the original production volume from which the shadow copy was created,
/// or they can be new or existing LUNs that are used to replace an original volume that is removed from production.
/// </para>
/// <para>
/// The provider must perform the resynchronization by copying data at the LUN array level, not at the host level. This means that
/// the provider cannot implement LUN resynchronization by simply copying the contents of the source LUN to the destination LUN. The
/// I/O that is required to perform the LUN resynchronization must be performed in the hardware, through the disk devices of the
/// resynchronized LUNs, and not through the host computer. This I/O should be completely transparent to the host computer.
/// </para>
/// <para>When the resynchronization is complete, the LUNs are fully functional and are available for I/O operations.</para>
/// <para>The underlying disk hardware must support unique page 83 device identifiers.</para>
/// <para>
/// If the destination LUN is larger than the source LUN, the provider must resize the destination LUN if necessary to ensure that
/// it matches the source LUN after resynchronization.
/// </para>
/// <para>
/// This method cannot be called in WinPE, and it cannot be called in Safe mode. Before calling this method, the caller must use the
/// IVssBackupComponents::InitializeForRestore method to prepare for the resynchronization.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotproviderex-resyncluns HRESULT ResyncLuns(
// [in] VDS_LUN_INFORMATION *pSourceLuns, [in] VDS_LUN_INFORMATION *pTargetLuns, [in] DWORD dwCount, [out] IVssAsync **ppAsync );
[PreserveSig]
HRESULT ResyncLuns([In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] VDS_LUN_INFORMATION[] pSourceLuns,
[In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] VDS_LUN_INFORMATION[] pTargetLuns, uint dwCount,
out IVssAsync ppAsync);
/// <summary>
/// <para>Not supported.</para>
/// <para>This method is reserved for future use.</para>
/// </summary>
/// <param name="pSnapshotLuns">This parameter is reserved for future use.</param>
/// <param name="pOriginalLuns">This parameter is reserved for future use.</param>
/// <param name="dwCount">This parameter is reserved for future use.</param>
/// <returns>If this method succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsshardwaresnapshotproviderex-onreuseluns HRESULT
// OnReuseLuns( VDS_LUN_INFORMATION *pSnapshotLuns, VDS_LUN_INFORMATION *pOriginalLuns, DWORD dwCount );
[PreserveSig]
HRESULT OnReuseLuns([In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] VDS_LUN_INFORMATION[] pSnapshotLuns,
[In, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] VDS_LUN_INFORMATION[] pOriginalLuns,
uint dwCount);
}
/// <summary>The <c>IVssProviderCreateSnapshotSet</c> interface contains the methods used during shadow copy creation.</summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nn-vsprov-ivssprovidercreatesnapshotset
[PInvokeData("vsprov.h", MSDNShortId = "NN:vsprov.IVssProviderCreateSnapshotSet")]
[ComImport, Guid("5F894E5B-1E39-4778-8E23-9ABAD9F0E08C"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVssProviderCreateSnapshotSet
{
/// <summary>
/// The <c>EndPrepareSnapshots</c> method is called once for the complete shadow copy set, after the last
/// IVssHardwareSnapshotProvider::BeginPrepareSnapshot call. This method is intended as a point where the provider can wait for any
/// shadow copy preparation work to complete. Because <c>EndPrepareSnapshots</c> may take a long time to complete, a provider should
/// be prepared to accept an AbortSnapshots method call at any time and immediately end the preparation work.
/// </summary>
/// <param name="SnapshotSetId">The <c>VSS_ID</c> of the shadow copy set.</param>
/// <returns>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_INSUFFICIENT_STORAGE</c></c> 0x8004231FL</term>
/// <term>
/// There is not enough disk storage to create a shadow copy. Insufficient disk space can also generate <c>VSS_E_PROVIDER_VETO</c>
/// or <c>VSS_E_OBJECT_NOT_FOUND</c> error return values.
/// </term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_OBJECT_NOT_FOUND</c></c> 0x80042308L</term>
/// <term>The <c>SnapshotSetId</c> parameter refers to an object that was not found.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. If this is returned, the error must be described in an entry in the application event
/// log, giving the user information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// <para>If any other value is returned, VSS will write an event to the event log and convert the error to <c>VSS_E_UNEXPECTED_PROVIDER_ERROR</c>.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssprovidercreatesnapshotset-endpreparesnapshots HRESULT
// EndPrepareSnapshots( [in] VSS_ID SnapshotSetId );
[PreserveSig]
HRESULT EndPrepareSnapshots(Guid SnapshotSetId);
/// <summary>
/// The <c>PreCommitSnapshots</c> method ensures the provider is ready to quickly commit the prepared LUNs. This happens immediately
/// before the flush-and-hold writes, but while applications are in a frozen state. During this call the provider should prepare all
/// shadow copies in the shadow copy set indicated by <c>SnapshotSetId</c> for committing by the CommitSnapshots method call that
/// will follow. While the provider is processing this method, the applications have been frozen, so the time spent in this method
/// should be minimized.
/// </summary>
/// <param name="SnapshotSetId">The <c>VSS_ID</c> that identifies the shadow copy set.</param>
/// <returns>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_OBJECT_NOT_FOUND</c></c> 0x80042308L</term>
/// <term>The <c>SnapshotSetId</c> parameter refers to an object that was not found.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. If this is returned, the error must be described in an entry in the application event
/// log, giving the user information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// <para>If any other value is returned, VSS will write an event to the event log and convert the error to <c>VSS_E_UNEXPECTED_PROVIDER_ERROR</c>.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssprovidercreatesnapshotset-precommitsnapshots HRESULT
// PreCommitSnapshots( [in] VSS_ID SnapshotSetId );
[PreserveSig]
HRESULT PreCommitSnapshots(Guid SnapshotSetId);
/// <summary>The <c>CommitSnapshots</c> method quickly commits all LUNs in this provider.</summary>
/// <param name="SnapshotSetId">The <c>VSS_ID</c> that identifies the shadow copy set.</param>
/// <returns>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_OBJECT_NOT_FOUND</c></c> 0x80042308L</term>
/// <term>The <c>SnapshotSetId</c> parameter refers to an object that was not found.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>An unexpected provider error occurred. The provider must log the details of this error in the application event log.</term>
/// </item>
/// </list>
/// <para>If any other value is returned, VSS will write an event to the event log and convert the error to <c>VSS_E_UNEXPECTED_PROVIDER_ERROR</c>.</para>
/// </returns>
/// <remarks>
/// <para>
/// This method is called at the defined time at which the shadow copies should be taken. For each prepared LUN in this shadow copy
/// set, the provider will perform the work required to persist the point-in-time LUN contents. While this method is executing, both
/// applications and the I/O subsystem are largely quiescent. The provider must minimize the amount of time spent in this method. As
/// a general rule, this method should take less than one second to complete. This method is called during the Flush and Hold
/// window, and VSS Kernel Support will cancel the Flush and Hold if the release is not received within 10 seconds, which would
/// cause VSS to fail the shadow copy creation process. If each provider takes more than a second or two to complete this call,
/// there is a high probability that the entire shadow copy creation will fail.
/// </para>
/// <para>
/// Because the I/O system is quiescent, the provider must take care to not initiate any I/O as it could deadlock the system - for
/// example debug or tracing I/O by this method or any calls made from this method. Memory mapped files and paging I/O will not be
/// frozen at this time.
/// </para>
/// <para>
/// Note that the I/O system is quiescent only while this method is executing. Immediately after the last provider's
/// <c>CommitSnapshots</c> method returns, the VSS service releases all pending writes on the source LUNs. If the provider performs
/// any synchronization of the source and shadow copy LUNs, this synchronization must be completed before the provider's
/// <c>CommitSnapshots</c> method returns; it cannot be performed asynchronously.
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssprovidercreatesnapshotset-commitsnapshots HRESULT
// CommitSnapshots( [in] VSS_ID SnapshotSetId );
[PreserveSig]
HRESULT CommitSnapshots(Guid SnapshotSetId);
/// <summary>
/// The <c>PostCommitSnapshots</c> method is called after all providers involved in the shadow copy set have succeeded with
/// CommitSnapshots. The lock on the I/O system has been lifted, but the applications have not yet been unfrozen. This is an
/// opportunity for the provider to perform additional cleanup work after the shadow copy commit.
/// </summary>
/// <param name="SnapshotSetId">The <c>VSS_ID</c> that identifies the shadow copy set.</param>
/// <param name="lSnapshotsCount">Count of shadow copies in the shadow copy set.</param>
/// <returns>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_OBJECT_NOT_FOUND</c></c> 0x80042308L</term>
/// <term>The <c>SnapshotSetId</c> parameter refers to an object that was not found.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. If this is returned, the error must be described in an entry in the application event
/// log, giving the user information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// <para>If any other value is returned, VSS will write an event to the event log and convert the error to <c>VSS_E_UNEXPECTED_PROVIDER_ERROR</c>.</para>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssprovidercreatesnapshotset-postcommitsnapshots HRESULT
// PostCommitSnapshots( [in] VSS_ID SnapshotSetId, [in] LONG lSnapshotsCount );
[PreserveSig]
HRESULT PostCommitSnapshots(Guid SnapshotSetId, int lSnapshotsCount);
/// <summary>
/// The <c>PreFinalCommitSnapshots</c> method enables providers to support auto-recover shadow copies. If the shadow copy has the
/// <c>VSS_VOLSNAP_ATTR_AUTORECOVER</c> flag set in the context, the volume can receive a large number of writes during the
/// auto-recovery operation.
/// </summary>
/// <param name="SnapshotSetId">The <c>VSS_ID</c> that identifies the shadow copy set.</param>
/// <returns>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. If this is returned, the error must be described in an entry in the application event
/// log, giving the user information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// <para>If any other value is returned, VSS will write an event to the event log and convert the error to <c>VSS_E_UNEXPECTED_PROVIDER_ERROR</c>.</para>
/// </returns>
/// <remarks>
/// <para>
/// This method was added to enable binary compatibility when the auto-recover feature was introduced in Windows Server 2003 with
/// Service Pack 1 (SP1).
/// </para>
/// <para>
/// <c>Note</c> For Windows Server 2003, it is recommended that hardware providers implement this method using the following example:
/// </para>
/// <para>
/// <code>HRESULT PreFinalCommitSnapshots( VSS_ID /* SnapshotSetId */ ) { return S_OK; }</code>
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssprovidercreatesnapshotset-prefinalcommitsnapshots HRESULT
// PreFinalCommitSnapshots( [in] VSS_ID SnapshotSetId );
[PreserveSig]
HRESULT PreFinalCommitSnapshots(Guid SnapshotSetId);
/// <summary>
/// The <c>PostFinalCommitSnapshots</c> method supports auto-recover shadow copies. VSS calls this method to notify the provider
/// that the volume will now be read-only until a requester calls IVssBackupComponents::BreakSnapshotSet.
/// </summary>
/// <param name="SnapshotSetId">The <c>VSS_ID</c> that identifies the shadow copy set.</param>
/// <returns>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. If this is returned, the error must be described in an entry in the application event
/// log, giving the user information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// <para>If any other value is returned, VSS will write an event to the event log and convert the error to <c>VSS_E_UNEXPECTED_PROVIDER_ERROR</c>.</para>
/// </returns>
/// <remarks>
/// <para>
/// This method was added in Windows Server 2003 to enable binary compatibility when the auto-recover feature was introduced in
/// Windows Server 2003 with Service Pack 1 (SP1).
/// </para>
/// <para>
/// <c>Note</c> For Windows Server 2003, it is recommended that hardware providers implement this method using the following example:
/// </para>
/// <para>
/// <code>HRESULT PostFinalCommitSnapshots( VSS_ID /* SnapshotSetId */ ) { return S_OK; }</code>
/// </para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssprovidercreatesnapshotset-postfinalcommitsnapshots
// HRESULT PostFinalCommitSnapshots( [in] VSS_ID SnapshotSetId );
[PreserveSig]
HRESULT PostFinalCommitSnapshots(Guid SnapshotSetId);
/// <summary>
/// The <c>AbortSnapshots</c> method aborts prepared shadow copies in this provider. This includes all non-committed shadow copies
/// and pre-committed ones.
/// </summary>
/// <param name="SnapshotSetId">The <c>VSS_ID</c> that identifies the shadow copy set.</param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_OBJECT_NOT_FOUND</c></c> 0x80042308L</term>
/// <term>The <c>SnapshotSetId</c> parameter refers to an object that was not found.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. The provider must log a message in the application event log providing the user with
/// information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// VSS will only call <c>AbortSnapshots</c> after the requester has called IVssBackupComponents::DoSnapshotSet, even if the shadow
/// copy fails or is aborted before this point. This means that a provider will not receive an <c>AbortSnapshots</c> call until
/// after EndPrepareSnapshots has been called. If a shadow copy is aborted or fails before this point, the provider is not given any
/// indication until a new shadow copy is started. For this reason, the provider must be prepared to handle an out-of-sequence
/// IVssHardwareSnapshotProvider::BeginPrepareSnapshot call at any point. This out-of-sequence call represents the start of a new
/// shadow copy creation sequence and will have a new shadow copy set ID.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssprovidercreatesnapshotset-abortsnapshots HRESULT
// AbortSnapshots( [in] VSS_ID SnapshotSetId );
[PreserveSig]
HRESULT AbortSnapshots(Guid SnapshotSetId);
}
/// <summary>The <c>IVssProviderNotifications</c> interface manages providers registered with VSS.</summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nn-vsprov-ivssprovidernotifications
[PInvokeData("vsprov.h", MSDNShortId = "NN:vsprov.IVssProviderNotifications")]
[ComImport, Guid("E561901F-03A5-4afe-86D0-72BAEECE7004"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVssProviderNotifications
{
/// <summary>The <c>OnLoad</c> method notifies a provider that it was loaded.</summary>
/// <param name="pCallback">This parameter is reserved.</param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>The operation was successfully completed.</term>
/// </item>
/// <item>
/// <term><c><c>E_OUTOFMEMORY</c></c> 0x8007000EL</term>
/// <term>Out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c> 0x80070057L</term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_PROVIDER_VETO</c></c> 0x80042306L</term>
/// <term>
/// An unexpected provider error occurred. If this is returned, the error must be described in an entry in the application event
/// log, giving the user information on how to resolve the problem.
/// </term>
/// </item>
/// </list>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssprovidernotifications-onload HRESULT OnLoad( [in]
// IUnknown *pCallback );
[PreserveSig]
HRESULT OnLoad([In, Optional, MarshalAs(UnmanagedType.IUnknown)] object pCallback);
/// <summary>The <c>OnUnload</c> method notifies the provider to prepare to be unloaded.</summary>
/// <param name="bForceUnload">If <c>TRUE</c>, the provider must prepare to be released.</param>
/// <returns>
/// <para>This method can return one of these values.</para>
/// <list type="table">
/// <listheader>
/// <term>Return code/value</term>
/// <term>Description</term>
/// </listheader>
/// <item>
/// <term><c><c>S_OK</c></c> 0x00000000L</term>
/// <term>There are no pending operations and the provider is ready to be released.</term>
/// </item>
/// <item>
/// <term><c>S_FALSE</c> 0x00000001L</term>
/// <term>The provider should not be unloaded. This value can only be returned if <c>bForceUnload</c> is <c>FALSE</c>.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>If <c>bForceUnload</c> is <c>TRUE</c>, the return value must be <c>S_OK</c>.</remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivssprovidernotifications-onunload HRESULT OnUnload( [in]
// BOOL bForceUnload );
[PreserveSig]
HRESULT OnUnload([MarshalAs(UnmanagedType.Bool)] bool bForceUnload);
}
/// <summary>Contains the methods used by VSS to manage shadow copy volumes. All software providers must support this interface.</summary>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nn-vsprov-ivsssoftwaresnapshotprovider
[PInvokeData("vsprov.h", MSDNShortId = "NN:vsprov.IVssSoftwareSnapshotProvider")]
[ComImport, Guid("609e123e-2c5a-44d3-8f01-0b1d9a47d1ff"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVssSoftwareSnapshotProvider
{
/// <summary>Sets the context for subsequent shadow copy-related operations.</summary>
/// <param name="lContext">
/// The context to be set. The context must be one of the supported values of _VSS_SNAPSHOT_CONTEXT or a supported combination of
/// _VSS_VOLUME_SNAPSHOT_ATTRIBUTES and <c>_VSS_SNAPSHOT_CONTEXT</c> values.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The context was set successfully.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_BAD_STATE</c></term>
/// <term>The context is frozen and cannot be changed.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>The default context for VSS shadow copies is VSS_CTX_BACKUP.</para>
/// <para>
/// <c>Windows XP:</c> The only supported context is the default context, VSS_CTX_BACKUP. Therefore, calling <c>SetContext</c> under
/// Windows XP returns E_NOTIMPL.
/// </para>
/// <para>
/// For more information about how the context that is set by <c>SetContext</c> affects how a shadow copy is created and managed,
/// see Implementation Details for Creating Shadow Copies.
/// </para>
/// <para>For a complete discussion of the permitted shadow copy contexts, see _VSS_SNAPSHOT_CONTEXT and _VSS_VOLUME_SNAPSHOT_ATTRIBUTES.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-setcontext HRESULT SetContext(
// [in] LONG lContext );
[PreserveSig]
HRESULT SetContext(VSS_SNAPSHOT_CONTEXT lContext);
/// <summary>Gets the properties of the specified shadow copy.</summary>
/// <param name="SnapshotId">Shadow copy identifier.</param>
/// <param name="pProp">
/// The address of a caller-allocated VSS_SNAPSHOT_PROP structure that receives the shadow copy properties. The provider is
/// responsible for setting the members of this structure. All members are required except <c>m_pwszExposedName</c> and
/// <c>m_pwszExposedPath</c>, which the provider can set to <c>NULL</c>. The provider allocates memory for all string members that
/// it sets in the structure. When the structure is no longer needed, the caller is responsible for freeing these strings by calling
/// the VssFreeSnapshotProperties function.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The requested information was successfully returned.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified volume was not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNEXPECTED</c></term>
/// <term>
/// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.
/// <c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> This value is not supported until Windows Server
/// 2008 R2 and Windows 7. E_UNEXPECTED is used instead.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// The caller should set the contents of the VSS_SNAPSHOT_PROP structure to zero before calling the <c>GetSnapshotProperties</c> method.
/// </para>
/// <para>The provider is responsible for allocating and freeing the strings in the VSS_SNAPSHOT_PROP structure.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-getsnapshotproperties HRESULT
// GetSnapshotProperties( [in] VSS_ID SnapshotId, [out] VSS_SNAPSHOT_PROP *pProp );
[PreserveSig]
HRESULT GetSnapshotProperties(Guid SnapshotId, out VSS_SNAPSHOT_PROP pProp);
/// <summary>Queries the provider for information about the shadow copies that the provider has completed.</summary>
/// <param name="QueriedObjectId">Reserved for system use. The value of this parameter must be GUID_NULL.</param>
/// <param name="eQueriedObjectType">Reserved for system use. The value of this parameter must be VSS_OBJECT_NONE.</param>
/// <param name="eReturnedObjectsType">Reserved for system use. The value of this parameter must be VSS_OBJECT_SNAPSHOT.</param>
/// <param name="ppEnum">
/// The address of an IVssEnumObject interface pointer, which is initialized on return. Callers must release the interface. This
/// parameter is required and cannot be null.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The query operation was successful.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// Calling the IVssEnumObject::Next method on the IVssEnumObject interface that is returned though the <c>ppEnum</c> parameter will
/// return VSS_OBJECT_PROP structures containing a VSS_SNAPSHOT_PROP structure for each shadow copy.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-query HRESULT Query( [in] VSS_ID
// QueriedObjectId, [in] VSS_OBJECT_TYPE eQueriedObjectType, [in] VSS_OBJECT_TYPE eReturnedObjectsType, [out] IVssEnumObject
// **ppEnum );
[PreserveSig]
HRESULT Query(Guid QueriedObjectId, VSS_OBJECT_TYPE eQueriedObjectType, VSS_OBJECT_TYPE eReturnedObjectsType, out IVssEnumObject ppEnum);
/// <summary>Deletes one or more shadow copies or a shadow copy set.</summary>
/// <param name="SourceObjectId">Identifier of the shadow copy or shadow copy set to be deleted.</param>
/// <param name="eSourceObjectType">Type of the object to be deleted. The value of this parameter is VSS_OBJECT_SNAPSHOT or VSS_OBJECT_SNAPSHOT_SET.</param>
/// <param name="bForceDelete">
/// If the value of this parameter is <c>TRUE</c>, the provider will do everything possible to delete the shadow copy or shadow
/// copies in a shadow copy set. If it is <c>FALSE</c>, no additional effort will be made.
/// </param>
/// <param name="plDeletedSnapshots">Pointer to a variable that receives the number of shadow copies that were deleted.</param>
/// <param name="pNondeletedSnapshotID">
/// If an error occurs, this parameter receives a pointer to the identifier of the first shadow copy that could not be deleted.
/// Otherwise, it points to GUID_NULL.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The shadow copies were successfully deleted.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified shadow copies were not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// Multiple shadow copies in a shadow copy set are deleted sequentially. If an error occurs during one of these individual
/// deletions, <c>DeleteSnapshots</c> will return immediately; no attempt will be made to delete any remaining shadow copies. The
/// VSS_ID of the undeleted shadow copy is returned in <c>pNondeletedSnapshotID</c>.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-deletesnapshots HRESULT
// DeleteSnapshots( [in] VSS_ID SourceObjectId, [in] VSS_OBJECT_TYPE eSourceObjectType, [in] BOOL bForceDelete, [out] LONG
// *plDeletedSnapshots, [out] VSS_ID *pNondeletedSnapshotID );
[PreserveSig]
HRESULT DeleteSnapshots(Guid SourceObjectId, VSS_OBJECT_TYPE eSourceObjectType, [MarshalAs(UnmanagedType.Bool)] bool bForceDelete,
out int plDeletedSnapshots, out Guid pNondeletedSnapshotID);
/// <summary>VSS calls this method for each shadow copy that is added to the shadow copy set.</summary>
/// <param name="SnapshotSetId">Shadow copy set identifier.</param>
/// <param name="SnapshotId">Identifier of the shadow copy to be created.</param>
/// <param name="pwszVolumeName">
/// <para>
/// Null-terminated wide character string containing the volume name. The name must be in one of the following formats and must
/// include a trailing backslash (\):
/// </para>
/// <list type="bullet">
/// <item>
/// <term>The path of a mounted folder, for example, Y:\MountX\</term>
/// </item>
/// <item>
/// <term>A drive letter, for example, D:\</term>
/// </item>
/// <item>
/// <term>A volume GUID path of the form \\?\ <c>Volume</c>{ <c>GUID</c>}\ (where <c>GUID</c> identifies the volume)</term>
/// </item>
/// </list>
/// </param>
/// <param name="lNewContext">
/// The context for the shadow copy set. This context consists of a bitmask of _VSS_VOLUME_SNAPSHOT_ATTRIBUTES values.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The shadow copy was successfully created.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified volume was not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNSUPPORTED_CONTEXT</c></term>
/// <term>The specified context is not supported.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER</c></term>
/// <term>The provider does not support the specified volume.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNEXPECTED</c></term>
/// <term>
/// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.
/// <c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> This value is not supported until Windows Server
/// 2008 R2 and Windows 7. E_UNEXPECTED is used instead.
/// </term>
/// </item>
/// </list>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-beginpreparesnapshot HRESULT
// BeginPrepareSnapshot( [in] VSS_ID SnapshotSetId, [in] VSS_ID SnapshotId, [in] VSS_PWSZ pwszVolumeName, [in] LONG lNewContext );
[PreserveSig]
HRESULT BeginPrepareSnapshot(Guid SnapshotSetId, Guid SnapshotId, [MarshalAs(UnmanagedType.LPWStr)] string pwszVolumeName,
VSS_VOLUME_SNAPSHOT_ATTRIBUTES lNewContext);
/// <summary>Determines whether the provider supports shadow copies on the specified volume.</summary>
/// <param name="pwszVolumeName">
/// <para>
/// Null-terminated wide character string containing the volume name. The name must be in one of the following formats and must
/// include a trailing backslash (\):
/// </para>
/// <list type="bullet">
/// <item>
/// <term>The path of a mounted folder, for example, Y:\MountX\</term>
/// </item>
/// <item>
/// <term>A drive letter, for example, D:\</term>
/// </item>
/// <item>
/// <term>A volume GUID path of the form \\?\ <c>Volume</c>{ <c>GUID</c>}\ (where <c>GUID</c> identifies the volume)</term>
/// </item>
/// </list>
/// </param>
/// <param name="pbSupportedByThisProvider">
/// This parameter receives <c>TRUE</c> if shadow copies are supported on the specified volume, otherwise <c>FALSE</c>.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The requested information was successfully returned.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_NESTED_VOLUME_LIMIT</c></term>
/// <term>
/// The specified volume is nested too deeply to participate in the VSS operation. <c>Windows Server 2008, Windows Vista, Windows
/// Server 2003 and Windows XP:</c> This return code is not supported.
/// </term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified volume was not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNEXPECTED</c></term>
/// <term>
/// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.
/// <c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> This value is not supported until Windows Server
/// 2008 R2 and Windows 7. E_UNEXPECTED is used instead.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// <para>
/// The <c>IsVolumeSupported</c> method will return <c>TRUE</c> if it is possible to create shadow copies on the given volume, even
/// if the current configuration does not allow the creation of shadow copies on that volume at the present time.
/// </para>
/// <para>
/// For example, if the maximum number of shadow copies has been reached on a given volume (and therefore no more shadow copies can
/// be created on that volume), the method will still indicate that the volume can be shadow copied.
/// </para>
/// <para>This method cannot be called for a virtual hard disk (VHD) that is nested inside another VHD.</para>
/// <para><c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> VHDs are not supported.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-isvolumesupported HRESULT
// IsVolumeSupported( [in] VSS_PWSZ pwszVolumeName, [out] BOOL *pbSupportedByThisProvider );
[PreserveSig]
HRESULT IsVolumeSupported([MarshalAs(UnmanagedType.LPWStr)] string pwszVolumeName, [MarshalAs(UnmanagedType.Bool)] out bool pbSupportedByThisProvider);
/// <summary>Determines whether any shadow copies exist for the specified volume.</summary>
/// <param name="pwszVolumeName">
/// <para>
/// Null-terminated wide character string containing the volume name. The name must be in one of the following formats and must
/// include a trailing backslash (\):
/// </para>
/// <list type="bullet">
/// <item>
/// <term>The path of a mounted folder, for example, Y:\MountX\</term>
/// </item>
/// <item>
/// <term>A drive letter, for example, D:\</term>
/// </item>
/// <item>
/// <term>A volume GUID path of the form \\?\ <c>Volume</c>{ <c>GUID</c>}\ (where GUID identifies the volume)</term>
/// </item>
/// </list>
/// </param>
/// <param name="pbSnapshotsPresent">
/// This parameter receives <c>TRUE</c> if the volume has a shadow copy, or <c>FALSE</c> if the volume does not have a shadow copy.
/// </param>
/// <param name="plSnapshotCompatibility">
/// A bitmask of VSS_SNAPSHOT_COMPATIBILITY values that indicate whether certain volume control or file I/O operations are disabled
/// for the given volume, if the volume has a shadow copy.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The requested information was successfully returned.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified volume was not found.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_PROVIDER_VETO</c></term>
/// <term>
/// Provider error. The provider logged the error in the event log. For more information, see Event and Error Handling Under VSS.
/// </term>
/// </item>
/// <item>
/// <term><c>VSS_E_UNEXPECTED</c></term>
/// <term>
/// Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.
/// <c>Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:</c> This value is not supported until Windows Server
/// 2008 R2 and Windows 7. E_UNEXPECTED is used instead.
/// </term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// If no volume control or file I/O operations are disabled for the selected volume, then the shadow copy capability of the
/// selected volume returned by <c>plSnapshotCapability</c> will be zero.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-isvolumesnapshotted HRESULT
// IsVolumeSnapshotted( [in] VSS_PWSZ pwszVolumeName, [out] BOOL *pbSnapshotsPresent, [out] LONG *plSnapshotCompatibility );
[PreserveSig]
HRESULT IsVolumeSnapshotted([MarshalAs(UnmanagedType.LPWStr)] string pwszVolumeName, [MarshalAs(UnmanagedType.Bool)] out bool pbSnapshotsPresent,
out VSS_SNAPSHOT_COMPATIBILITY plSnapshotCompatibility);
/// <summary>Sets a property for a shadow copy.</summary>
/// <param name="SnapshotId">Shadow copy identifier. This parameter is required and cannot be GUID_NULL.</param>
/// <param name="eSnapshotPropertyId">A VSS_SNAPSHOT_PROPERTY_ID value that specifies the property to be set for the shadow copy.</param>
/// <param name="vProperty">
/// The value to be set for the property. See the VSS_SNAPSHOT_PROP structure for valid data types and descriptions of the
/// properties that can be set for a shadow copy.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The property was set successfully.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c>VSS_E_OBJECT_NOT_FOUND</c></term>
/// <term>The specified shadow copy was not found.</term>
/// </item>
/// </list>
/// </returns>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-setsnapshotproperty HRESULT
// SetSnapshotProperty( [in] VSS_ID SnapshotId, [in] VSS_SNAPSHOT_PROPERTY_ID eSnapshotPropertyId, [in] VARIANT vProperty );
[PreserveSig]
HRESULT SetSnapshotProperty(Guid SnapshotId, VSS_SNAPSHOT_PROPERTY_ID eSnapshotPropertyId, object vProperty);
/// <summary>
/// Reverts a volume to a previous shadow copy. Only shadow copies created with persistent contexts (VSS_CTX_APP_ROLLBACK,
/// VSS_CTX_CLIENT_ACCESSIBLE, VSS_CTX_CLIENT_ACCESSIBLE_WRITERS, or VSS_CTX_NAS_ROLLBACK) are supported.
/// </summary>
/// <param name="SnapshotId">Shadow copy identifier of the shadow copy to revert.</param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The revert operation was successful.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_REVERT_IN_PROGRESS</c></c></term>
/// <term>The volume already has a revert operation in process.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// This operation cannot be canceled, or undone once completed. If the computer is rebooted during the revert operation, the revert
/// process will continue when the system is restarted.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-reverttosnapshot HRESULT
// RevertToSnapshot( [in] VSS_ID SnapshotId );
[PreserveSig]
HRESULT RevertToSnapshot(Guid SnapshotId);
/// <summary>Returns an IVssAsync interface pointer that can be used to determine the status of the revert operation.</summary>
/// <param name="pwszVolume">
/// <para>
/// Null-terminated wide character string containing the volume name. The name must be in one of the following formats and must
/// include a trailing backslash (\):
/// </para>
/// <list type="bullet">
/// <item>
/// <term>The path of a mounted folder, for example, Y:\MountX\</term>
/// </item>
/// <item>
/// <term>A drive letter, for example, D:\</term>
/// </item>
/// <item>
/// <term>A volume GUID path of the form \\?\ <c>Volume</c>{ <c>GUID</c>}\ (where <c>GUID</c> identifies the volume)</term>
/// </item>
/// </list>
/// </param>
/// <param name="ppAsync">
/// Pointer to a location that will receive an IVssAsync interface pointer that can be used to retrieve the status of the revert
/// operation.
/// </param>
/// <returns>
/// <para>The following are the valid return codes for this method.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term><c>S_OK</c></term>
/// <term>The status of the revert operation was successfully queried.</term>
/// </item>
/// <item>
/// <term><c>E_ACCESSDENIED</c></term>
/// <term>The caller does not have sufficient backup privileges or is not an administrator.</term>
/// </item>
/// <item>
/// <term><c>E_INVALIDARG</c></term>
/// <term>One of the parameter values is not valid.</term>
/// </item>
/// <item>
/// <term><c>E_OUTOFMEMORY</c></term>
/// <term>The caller is out of memory or other system resources.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_OBJECT_NOT_FOUND</c></c></term>
/// <term>The <c>pwszVolume</c> parameter does not specify a valid volume.</term>
/// </item>
/// <item>
/// <term><c><c>VSS_E_VOLUME_NOT_SUPPORTED</c></c></term>
/// <term>The revert operation is not supported on this volume.</term>
/// </item>
/// </list>
/// </returns>
/// <remarks>
/// The revert operation will continue even if the computer is rebooted, and cannot be canceled or undone, except by restoring a
/// backup that was created using another method. The IVssAsync::QueryStatus method cannot return VSS_S_ASYNC_CANCELLED, because the
/// revert operation cannot be canceled after it has started.
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/vsprov/nf-vsprov-ivsssoftwaresnapshotprovider-queryrevertstatus HRESULT
// QueryRevertStatus( [in] VSS_PWSZ pwszVolume, [out] IVssAsync **ppAsync );
[PreserveSig]
HRESULT QueryRevertStatus([MarshalAs(UnmanagedType.LPWStr)] string pwszVolume, out IVssAsync ppAsync);
}
} | 49.182315 | 193 | 0.684948 | [
"MIT"
] | DigitalPlatform/Vanara | PInvoke/VssApiMgd/vsprov.cs | 107,908 | C# |
using System;
using System.IO;
namespace JsonAnaLex
{
class Program
{
static void Main(string[] args)
{
string pathEntrada, pathSalida;
if (args.Length > 1)
{
pathEntrada = args[0];
pathSalida = args[1];
try
{
using (StreamReader sr = new StreamReader(pathEntrada))
{
using (StreamWriter sw = new StreamWriter(pathSalida))
{
JsonAnaLex anaLex = new JsonAnaLex(sr, sw);
Token token = anaLex.siguienteToken();
while (token.Tipo != TipoToken.EOF)
{
token = anaLex.siguienteToken();
}
}
}
}
catch (System.Exception)
{
Console.WriteLine("Archivo no encontrado");
}
}
else
{
Console.WriteLine("Debe pasar como parámetros:");
Console.WriteLine("* Path al archivo fuente");
Console.WriteLine("* Path al archivo de salida");
}
}
}
}
| 27.571429 | 78 | 0.389341 | [
"MIT"
] | fatimalmada/fpuna-compiladores | Tarea1/JsonAnaLex/Program.cs | 1,354 | C# |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PushPackageCommand.cs" company="Hukano">
// Copyright (c) Hukano. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Sundew.Packaging.Publish.Internal.Commands;
using System.Collections.Generic;
using System.Threading.Tasks;
using global::NuGet.Commands;
using global::NuGet.Configuration;
using Sundew.Packaging.Versioning.Logging;
/// <summary>Pushes a NuGet package to a NuGet server.</summary>
/// <seealso cref="IPushPackageCommand" />
public class PushPackageCommand : IPushPackageCommand
{
private readonly ILogger logger;
private readonly NuGet.Common.ILogger nuGetLogger;
/// <summary>
/// Initializes a new instance of the <see cref="PushPackageCommand"/> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="nuGetLogger">The nu get logger.</param>
public PushPackageCommand(
global::Sundew.Packaging.Versioning.Logging.ILogger logger,
global::NuGet.Common.ILogger nuGetLogger)
{
this.logger = logger;
this.nuGetLogger = nuGetLogger;
}
/// <summary>
/// Pushes the asynchronous.
/// </summary>
/// <param name="packagePath">The package path.</param>
/// <param name="source">The source.</param>
/// <param name="apiKey">The API key.</param>
/// <param name="symbolPackagePath">The symbol package path.</param>
/// <param name="symbolsSource">The symbols source.</param>
/// <param name="symbolApiKey">The symbol API key.</param>
/// <param name="timeoutInSeconds">The timeout in seconds.</param>
/// <param name="settings">The settings.</param>
/// <param name="noServiceEndpoint">The no service endpoint.</param>
/// <param name="skipDuplicates">Skips duplicate.</param>
/// <returns>
/// An async task.
/// </returns>
public async Task PushAsync(
string packagePath,
string? source,
string? apiKey,
string? symbolPackagePath,
string? symbolsSource,
string? symbolApiKey,
int timeoutInSeconds,
ISettings settings,
bool noServiceEndpoint,
bool skipDuplicates)
{
var packageSourceProvider = new PackageSourceProvider(settings);
await PushRunner.Run(
settings,
packageSourceProvider,
new List<string> { packagePath },
source,
apiKey,
symbolsSource,
symbolApiKey,
timeoutInSeconds,
false,
string.IsNullOrEmpty(symbolPackagePath) || !string.IsNullOrEmpty(symbolsSource),
noServiceEndpoint,
skipDuplicates,
this.nuGetLogger);
this.logger.LogImportant($"Successfully pushed package to: {source}");
if (!string.IsNullOrEmpty(symbolPackagePath) && symbolPackagePath != null && !string.IsNullOrEmpty(symbolsSource))
{
await PushRunner.Run(
settings,
packageSourceProvider,
new List<string> { symbolPackagePath },
symbolsSource,
symbolApiKey,
null,
null,
timeoutInSeconds,
false,
true,
noServiceEndpoint,
skipDuplicates,
this.nuGetLogger);
this.logger.LogImportant($"Successfully pushed symbols package to: {symbolsSource}");
}
}
} | 37.91 | 122 | 0.583223 | [
"MIT"
] | hugener/Sundew.Packaging.Publish | Source/Sundew.Packaging.Publish/Internal/Commands/PushPackageCommand.cs | 3,793 | C# |
using Microsoft.CodeAnalysis;
using System;
using System.CodeDom.Compiler;
using System.IO;
namespace InlineMapping.Configuration
{
internal sealed class ConfigurationValues
{
public ConfigurationValues(GeneratorExecutionContext context, SyntaxTree tree)
{
var options = context.AnalyzerConfigOptions.GetOptions(tree);
this.IndentStyle = options.TryGetValue(IndentStyleKey, out var indentStyle) ?
(Enum.TryParse<IndentStyle>(indentStyle, out var indentStyleValue) ? indentStyleValue : IndentStyleDefaultValue) :
IndentStyleDefaultValue;
this.IndentSize = options.TryGetValue(IndentSizeKey, out var indentSize) ?
(uint.TryParse(indentSize, out var indentSizeValue) ? indentSizeValue : IndentSizeDefaultValue) :
IndentSizeDefaultValue;
this.EolStyle = options.TryGetValue(EolStyleKey, out var eol) ?
(Enum.TryParse<EolStyle>(eol, ignoreCase: true, out var eolValue) ? eolValue : EolDefaultValue) :
EolDefaultValue;
}
public IndentedTextWriter BuildIndentedTextWriter(StringWriter writer)
=> new IndentedTextWriter(writer, this.IndentStyle == IndentStyle.Tab ? "\t" : new string(' ', (int)this.IndentSize))
{
NewLine = this.EolStyle switch
{
EolStyle.LF => "\n",
EolStyle.CR => "\r",
EolStyle.CRLF => "\r\n",
_ => throw new NotSupportedException($"Invalid EolStyle {this.EolStyle}"),
}
};
internal EolStyle EolStyle { get; }
internal uint IndentSize { get; }
internal IndentStyle IndentStyle { get; }
private const EolStyle EolDefaultValue = EolStyle.LF;
private const string EolStyleKey = "end_of_line";
private const uint IndentSizeDefaultValue = 2u;
private const string IndentSizeKey = "indent_size";
private const IndentStyle IndentStyleDefaultValue = IndentStyle.Space;
private const string IndentStyleKey = "indent_style";
}
} | 40.8125 | 124 | 0.704441 | [
"MIT"
] | monoman/InlineMapping | src/InlineMapping/Configuration/ConfigurationValues.cs | 1,959 | C# |
#region COPYRIGHT© 2009-2014 Phillip Clark. All rights reserved.
// For licensing information see License.txt (MIT style licensing).
#endregion
using System;
using System.Text;
namespace FlitBit.Core.Buffers
{
/// <summary>
/// Helper class for writing little-endian binary data to a buffer.
/// </summary>
public sealed class LittleEndianBufferWriter : BufferWriter
{
/// <summary>
/// Creates a new instance.
/// </summary>
public LittleEndianBufferWriter()
: base(Encoding.Unicode) { }
/// <summary>
/// Creates a new instance.
/// </summary>
/// <param name="enc">the encoding used to produce bytes for strings.</param>
public LittleEndianBufferWriter(Encoding enc)
: base(enc) { }
/// <summary>
/// Writes an UInt16 to a buffer.
/// </summary>
/// <param name="buffer">the target buffer</param>
/// <param name="offset">an offset where writing begins</param>
/// <param name="value">a value</param>
/// <returns>the number of bytes written to the buffer</returns>
[CLSCompliant(false)]
public override int Write(byte[] buffer, ref int offset, ushort value)
{
var v = (int)value;
unchecked
{
buffer[offset] = (byte)((v >> 8) & 0xFF);
buffer[offset + 1] = (byte)(v & 0xFF);
}
offset += sizeof(UInt16);
return sizeof(UInt16);
}
/// <summary>
/// Writes an UInt32 to a buffer.
/// </summary>
/// <param name="buffer">the target buffer</param>
/// <param name="offset">an offset where writing begins</param>
/// <param name="value">a value</param>
/// <returns>the number of bytes written to the buffer</returns>
[CLSCompliant(false)]
public override int Write(byte[] buffer, ref int offset, uint value)
{
unchecked
{
buffer[offset] = (byte)((value >> 24) & 0xFF);
buffer[offset + 1] = (byte)((value >> 16) & 0xFF);
buffer[offset + 2] = (byte)((value >> 8) & 0xFF);
buffer[offset + 3] = (byte)(value & 0xFF);
}
offset += sizeof(UInt32);
return sizeof(UInt32);
}
/// <summary>
/// Writes an UInt64 to a buffer.
/// </summary>
/// <param name="buffer">the target buffer</param>
/// <param name="offset">an offset where writing begins</param>
/// <param name="value">a value</param>
/// <returns>the number of bytes written to the buffer</returns>
[CLSCompliant(false)]
public override int Write(byte[] buffer, ref int offset, ulong value)
{
unchecked
{
buffer[offset] = (byte)((value >> 56) & 0xFF);
buffer[offset + 1] = (byte)((value >> 48) & 0xFF);
buffer[offset + 2] = (byte)((value >> 40) & 0xFF);
buffer[offset + 3] = (byte)((value >> 32) & 0xFF);
buffer[offset + 4] = (byte)((value >> 24) & 0xFF);
buffer[offset + 5] = (byte)((value >> 16) & 0xFF);
buffer[offset + 6] = (byte)((value >> 8) & 0xFF);
buffer[offset + 7] = (byte)(value & 0xFF);
}
offset += sizeof(UInt64);
return sizeof(UInt64);
}
}
} | 32.53125 | 81 | 0.579571 | [
"MIT"
] | flitbit-org/fbcore | FlitBit.Core/Buffers/BufferWriter.little-endian.cs | 3,126 | C# |
using System.Collections.Generic;
namespace Cumulocity.SDK.Client.Rest.Model.Event
{
public sealed class CumulocityAlarmStatuses : IAlarmStatus
{
public static readonly CumulocityAlarmStatuses ACTIVE = new CumulocityAlarmStatuses("ACTIVE", InnerEnum.ACTIVE);
public static readonly CumulocityAlarmStatuses ACKNOWLEDGED = new CumulocityAlarmStatuses("ACKNOWLEDGED", InnerEnum.ACKNOWLEDGED);
public static readonly CumulocityAlarmStatuses CLEARED = new CumulocityAlarmStatuses("CLEARED", InnerEnum.CLEARED);
private static readonly IList<CumulocityAlarmStatuses> valueList = new List<CumulocityAlarmStatuses>();
static CumulocityAlarmStatuses()
{
valueList.Add(ACTIVE);
valueList.Add(ACKNOWLEDGED);
valueList.Add(CLEARED);
}
public enum InnerEnum
{
ACTIVE,
ACKNOWLEDGED,
CLEARED
}
public readonly InnerEnum innerEnumValue;
private readonly string nameValue;
private readonly int ordinalValue;
private static int nextOrdinal = 0;
private CumulocityAlarmStatuses(string name, InnerEnum innerEnum)
{
nameValue = name;
ordinalValue = nextOrdinal++;
innerEnumValue = innerEnum;
}
public static CumulocityAlarmStatuses asAlarmStatus(string status)
{
return string.ReferenceEquals(status, null) ? null : valueOf(status);
}
public static IList<CumulocityAlarmStatuses> values()
{
return valueList;
}
public int ordinal()
{
return ordinalValue;
}
public override string ToString()
{
return nameValue;
}
public string name()
{
return nameValue;
}
public static CumulocityAlarmStatuses valueOf(string name)
{
foreach (CumulocityAlarmStatuses enumInstance in CumulocityAlarmStatuses.valueList)
{
if (enumInstance.nameValue == name)
{
return enumInstance;
}
}
throw new System.ArgumentException(name);
}
}
} | 24.328947 | 132 | 0.750135 | [
"MIT"
] | SoftwareAG/cumulocity-sdk-cs | REST-SDK/src/Cumulocity.SDK.Client/Rest/Model/Event/CumulocityAlarmStatuses.cs | 1,851 | C# |
//
// CVPixelBufferPoolSettings.cs: Implements settings for CVPixelBufferPool
//
// Authors: Marek Safar (marek.safar@gmail.com)
//
// Copyright 2012-2014, Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Foundation;
using CoreFoundation;
using ObjCRuntime;
namespace CoreVideo {
[Watch (4,0)]
public class CVPixelBufferPoolSettings : DictionaryContainer
{
#if !COREBUILD
public CVPixelBufferPoolSettings ()
: base (new NSMutableDictionary ())
{
}
public CVPixelBufferPoolSettings (NSDictionary dictionary)
: base (dictionary)
{
}
public int? MinimumBufferCount {
set {
SetNumberValue (CVPixelBufferPool.MinimumBufferCountKey, value);
}
get {
return GetInt32Value (CVPixelBufferPool.MinimumBufferCountKey);
}
}
public double? MaximumBufferAgeInSeconds {
set {
SetNumberValue (CVPixelBufferPool.MaximumBufferAgeKey, value);
}
get {
return GetDoubleValue (CVPixelBufferPool.MaximumBufferAgeKey);
}
}
#endif
}
[Watch (4,0)]
public partial class CVPixelBufferPoolAllocationSettings : DictionaryContainer {
#if !COREBUILD
public CVPixelBufferPoolAllocationSettings ()
: base (new NSMutableDictionary ())
{
}
public CVPixelBufferPoolAllocationSettings (NSDictionary dictionary)
: base (dictionary)
{
}
public int? Threshold {
set {
SetNumberValue (ThresholdKey, value);
}
get {
return GetInt32Value (ThresholdKey);
}
}
#endif
}
}
| 26.829787 | 81 | 0.73751 | [
"BSD-3-Clause"
] | 1975781737/xamarin-macios | src/CoreVideo/CVPixelBufferPoolSettings.cs | 2,522 | C# |
/*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.IO;
using ThirdParty.Json.LitJson;
using Amazon.Glacier.Model;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.Glacier.Model.Internal.MarshallTransformations
{
/// <summary>
/// InventoryRetrievalJobDescriptionUnmarshaller
/// </summary>
internal class InventoryRetrievalJobDescriptionUnmarshaller : IUnmarshaller<InventoryRetrievalJobDescription, XmlUnmarshallerContext>, IUnmarshaller<InventoryRetrievalJobDescription, JsonUnmarshallerContext>
{
InventoryRetrievalJobDescription IUnmarshaller<InventoryRetrievalJobDescription, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
public InventoryRetrievalJobDescription Unmarshall(JsonUnmarshallerContext context)
{
if (context.CurrentTokenType == JsonToken.Null)
return null;
InventoryRetrievalJobDescription inventoryRetrievalJobDescription = new InventoryRetrievalJobDescription();
int originalDepth = context.CurrentDepth;
int targetDepth = originalDepth + 1;
while (context.Read())
{
if (context.TestExpression("Format", targetDepth))
{
context.Read();
inventoryRetrievalJobDescription.Format = StringUnmarshaller.GetInstance().Unmarshall(context);
continue;
}
if (context.TestExpression("StartDate", targetDepth))
{
context.Read();
inventoryRetrievalJobDescription.StartDate = StringUnmarshaller.GetInstance().Unmarshall(context);
continue;
}
if (context.TestExpression("EndDate", targetDepth))
{
context.Read();
inventoryRetrievalJobDescription.EndDate = StringUnmarshaller.GetInstance().Unmarshall(context);
continue;
}
if (context.TestExpression("Limit", targetDepth))
{
context.Read();
inventoryRetrievalJobDescription.Limit = StringUnmarshaller.GetInstance().Unmarshall(context);
continue;
}
if (context.TestExpression("Marker", targetDepth))
{
context.Read();
inventoryRetrievalJobDescription.Marker = StringUnmarshaller.GetInstance().Unmarshall(context);
continue;
}
if (context.CurrentDepth <= originalDepth)
{
return inventoryRetrievalJobDescription;
}
}
return inventoryRetrievalJobDescription;
}
private static InventoryRetrievalJobDescriptionUnmarshaller instance;
public static InventoryRetrievalJobDescriptionUnmarshaller GetInstance()
{
if (instance == null)
instance = new InventoryRetrievalJobDescriptionUnmarshaller();
return instance;
}
}
}
| 37.145631 | 213 | 0.625457 | [
"Apache-2.0"
] | virajs/aws-sdk-net | AWSSDK_DotNet35/Amazon.Glacier/Model/Internal/MarshallTransformations/InventoryRetrievalJobDescriptionUnmarshaller.cs | 3,826 | C# |
namespace FluentMigrator.Runner.Processors.Oracle
{
public class OracleDbFactory : ReflectionBasedDbFactory
{
public OracleDbFactory()
: base("Oracle.DataAccess", "Oracle.DataAccess.Client.OracleClientFactory")
{
}
}
} | 26.7 | 87 | 0.662921 | [
"Apache-2.0"
] | Athari/FluentMigrator | src/FluentMigrator.Runner/Processors/Oracle/OracleDbFactory.cs | 269 | C# |
namespace EnvironmentAssessment.Common.VimApi
{
public class AuthorizationPrivilege : DynamicData
{
protected string _privId;
protected bool _onParent;
protected string _name;
protected string _privGroupName;
public string PrivId
{
get
{
return this._privId;
}
set
{
this._privId = value;
}
}
public bool OnParent
{
get
{
return this._onParent;
}
set
{
this._onParent = value;
}
}
public string Name
{
get
{
return this._name;
}
set
{
this._name = value;
}
}
public string PrivGroupName
{
get
{
return this._privGroupName;
}
set
{
this._privGroupName = value;
}
}
}
}
| 12.854545 | 50 | 0.602546 | [
"MIT"
] | octansIt/environmentassessment | EnvironmentAssessment.Wizard/Common/VimApi/A/AuthorizationPrivilege.cs | 707 | C# |
using NBitcoin;
using Xels.Bitcoin.EventBus;
namespace Xels.Bitcoin.Features.MemoryPool
{
/// <summary>
/// Event that is executed when a transaction is removed from the mempool.
/// </summary>
/// <seealso cref="EventBase" />
public class TransactionRemovedFromMemoryPool : EventBase
{
public Transaction RemovedTransaction { get; }
/// <summary>
/// Whether this transaction was removed from the mempool because
/// it was included in a block that was added to the chain.
/// </summary>
/// <remarks>
/// This is useful to discern whether we expect to see a transaction again.
///
/// In the case that this is true, we can expect the transaction hash to still
/// be useful, as it has been or will soon be "confirmed" and exist as part of the chain.
///
/// In the case that this is false, we are most likely to not see the transaction hash again.
/// It was likely removed because of an input conflict or a similar error, so we may
/// want to discard the transaction hash entirely.
/// </remarks>
public bool RemovedForBlock { get; }
public TransactionRemovedFromMemoryPool(Transaction removedTransaction, bool removedForBlock)
{
this.RemovedTransaction = removedTransaction;
this.RemovedForBlock = removedForBlock;
}
}
}
| 38.756757 | 101 | 0.643654 | [
"MIT"
] | xels-io/SideChain-SmartContract | src/Xels.Bitcoin.Features.MemoryPool/TransactionRemovedFromMemoryPool.cs | 1,436 | C# |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using OCP.ExternalModule;
namespace OCP.Class
{
public class ConnectionLoggerDecorator : IConnection
{
private IConnection _Decorated;
private ISession _Session;
private ILogger _Logger;
public ConnectionLoggerDecorator(IConnection decorated)
{
this._Decorated = decorated;
}
public Task<T> Query<T>(string sql, object parameters)
{
var result = this._Decorated.Query<T>(sql, parameters);
this.LogQuery(result, sql, parameters);
return result;
}
public Task Execute(string sql, object parameters)
{
var result = this._Decorated.Execute(sql, parameters);
this.LogQuery(result, sql, parameters);
return result;
}
private void LogQuery(Task task, string sql, object parameters)
{
var context = this.GetContext(sql, parameters);
this._Logger.Info($"Logged query {task}", context);
}
private IReadOnlyDictionary<string, string> GetContext(string sql, object parameters)
{
var context = new Dictionary<string, string>
{
{ sql, parameters.ToString() },
{ this._Session.UserId().ToString(), DateTime.Now.ToString(CultureInfo.InvariantCulture) }
};
return context;
}
}
}
| 28.185185 | 106 | 0.60184 | [
"MIT"
] | merieskelinen/SolidPrinciplesWorkshop | SOLID.Principles.Workshop/OCP/Class/ConnectionLoggerDecorator.cs | 1,524 | C# |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Azure.WebJobs.Script.Config;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.MobileServices;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.Queue;
using Microsoft.WindowsAzure.Storage.Table;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Xunit;
namespace Microsoft.Azure.WebJobs.Script.Tests
{
public abstract class EndToEndTestsBase<TTestFixture> :
IClassFixture<TTestFixture> where TTestFixture : EndToEndTestFixture, new()
{
private INameResolver _nameResolver;
private IConfiguration _configuration;
private static readonly ScriptSettingsManager SettingsManager = ScriptSettingsManager.Instance;
public EndToEndTestsBase(TTestFixture fixture)
{
_configuration = TestHelpers.GetTestConfiguration();
_nameResolver = new DefaultNameResolver(_configuration);
Fixture = fixture;
}
protected TTestFixture Fixture { get; private set; }
protected async Task TableInputTest()
{
var input = new JObject
{
{ "Region", "West" },
{ "Status", 1 }
};
await Fixture.Host.BeginFunctionAsync("TableIn", input);
var result = await WaitForTraceAsync("TableIn", log =>
{
return log.FormattedMessage.Contains("Result:");
});
string message = result.FormattedMessage.Substring(result.FormattedMessage.IndexOf('{'));
// verify singleton binding
JObject resultObject = JObject.Parse(message);
JObject single = (JObject)resultObject["single"];
Assert.Equal("AAA", (string)single["PartitionKey"]);
Assert.Equal("001", (string)single["RowKey"]);
// verify partition binding
JArray partition = (JArray)resultObject["partition"];
Assert.Equal(3, partition.Count);
foreach (var entity in partition)
{
Assert.Equal("BBB", (string)entity["PartitionKey"]);
}
// verify query binding
JArray query = (JArray)resultObject["query"];
Assert.Equal(2, query.Count);
Assert.Equal("003", (string)query[0]["RowKey"]);
Assert.Equal("004", (string)query[1]["RowKey"]);
// verify input validation
input = new JObject
{
{ "Region", "West" },
{ "Status", "1 or Status neq 1" }
};
await Fixture.Host.BeginFunctionAsync("TableIn", input);
// Watch for the expected error.
var errorLog = await WaitForTraceAsync(log =>
{
return log.Category == LogCategories.CreateFunctionCategory("TableIn") &&
log.Exception is FunctionInvocationException;
});
Assert.Equal("An invalid parameter value was specified for filter parameter 'Status'.", errorLog.Exception.InnerException.Message);
}
protected async Task TableOutputTest()
{
CloudTable table = Fixture.TableClient.GetTableReference("testoutput");
await Fixture.DeleteEntities(table);
JObject item = new JObject
{
{ "partitionKey", "TestOutput" },
{ "rowKey", 1 },
{ "stringProp", "Mathew" },
{ "intProp", 123 },
{ "boolProp", true },
{ "guidProp", Guid.NewGuid() },
{ "floatProp", 68756.898 }
};
await Fixture.Host.BeginFunctionAsync("TableOut", item);
// read the entities and verify schema
TableQuery tableQuery = new TableQuery();
DynamicTableEntity[] entities = null;
await TestHelpers.Await(async () =>
{
var results = await table.ExecuteQuerySegmentedAsync(tableQuery, null);
entities = results.ToArray();
return entities.Length == 3;
});
foreach (var entity in entities)
{
Assert.Equal(EdmType.String, entity.Properties["stringProp"].PropertyType);
Assert.Equal(EdmType.Int32, entity.Properties["intProp"].PropertyType);
Assert.Equal(EdmType.Boolean, entity.Properties["boolProp"].PropertyType);
// Guids end up roundtripping as strings
Assert.Equal(EdmType.String, entity.Properties["guidProp"].PropertyType);
Assert.Equal(EdmType.Double, entity.Properties["floatProp"].PropertyType);
}
}
protected async Task ManualTrigger_Invoke_SucceedsTest()
{
string testData = Guid.NewGuid().ToString();
await Fixture.Host.BeginFunctionAsync("ManualTrigger", testData);
await TestHelpers.Await(() =>
{
// make sure the input string made it all the way through
var logs = Fixture.Host.GetLogMessages();
return logs.Any(p => p.FormattedMessage != null && p.FormattedMessage.Contains(testData));
}, userMessageCallback: Fixture.Host.GetLog);
}
public async Task QueueTriggerToBlobTest()
{
TestHelpers.ClearFunctionLogs("QueueTriggerToBlob");
string id = Guid.NewGuid().ToString();
string messageContent = string.Format("{{ \"id\": \"{0}\" }}", id);
CloudQueueMessage message = new CloudQueueMessage(messageContent);
await Fixture.TestQueue.AddMessageAsync(message);
var resultBlob = Fixture.TestOutputContainer.GetBlockBlobReference(id);
string result = await TestHelpers.WaitForBlobAndGetStringAsync(resultBlob);
Assert.Equal(TestHelpers.RemoveByteOrderMarkAndWhitespace(messageContent), TestHelpers.RemoveByteOrderMarkAndWhitespace(result));
string userCategory = LogCategories.CreateFunctionUserCategory("QueueTriggerToBlob");
LogMessage traceEvent = await WaitForTraceAsync(p => p?.FormattedMessage != null && p.FormattedMessage.Contains(id) && string.Equals(p.Category, userCategory, StringComparison.Ordinal));
Assert.Equal(LogLevel.Information, traceEvent.Level);
string trace = traceEvent.FormattedMessage;
Assert.Contains("script processed queue message", trace);
Assert.Contains(messageContent.Replace(" ", string.Empty), trace.Replace(" ", string.Empty));
}
//protected async Task NotificationHubTest(string functionName)
//{
// // NotificationHub tests need the following environment vars:
// // "AzureWebJobsNotificationHubsConnectionString" -- the connection string for NotificationHubs
// // "AzureWebJobsNotificationHubName" -- NotificationHubName
// Dictionary<string, object> arguments = new Dictionary<string, object>
// {
// { "input", "Hello" }
// };
// try
// {
// // Only verifying the call succeeds. It is not possible to verify
// // actual push notificaiton is delivered as they are sent only to
// // client applications that registered with NotificationHubs
// await Fixture.Host.CallAsync(functionName, arguments);
// }
// catch (Exception ex)
// {
// // Node: Check innerException, CSharp: check innerExcpetion.innerException
// if ((ex.InnerException != null && VerifyNotificationHubExceptionMessage(ex.InnerException)) ||
// (ex.InnerException != null & ex.InnerException.InnerException != null && VerifyNotificationHubExceptionMessage(ex.InnerException.InnerException)))
// {
// // Expected if using NH without any registrations
// }
// else
// {
// throw;
// }
// }
//}
//protected async Task MobileTablesTest(bool isDotNet = false)
//{
// // MobileApps needs the following environment vars:
// // "AzureWebJobsMobileAppUri" - the URI to the mobile app
// // The Mobile App needs an anonymous 'Item' table
// // First manually create an item.
// string id = Guid.NewGuid().ToString();
// Dictionary<string, object> arguments = new Dictionary<string, object>
// {
// { "input", id }
// };
// await Fixture.Host.CallAsync("MobileTableOut", arguments);
// var item = await WaitForMobileTableRecordAsync("Item", id);
// Assert.Equal(item["id"], id);
// string messageContent = string.Format("{{ \"recordId\": \"{0}\" }}", id);
// await Fixture.MobileTablesQueue.AddMessageAsync(new CloudQueueMessage(messageContent));
// // Only .NET fully supports updating from input bindings. Others will
// // create a new item with -success appended to the id.
// // https://github.com/Azure/azure-webjobs-sdk-script/issues/49
// var idToCheck = id + (isDotNet ? string.Empty : "-success");
// var textToCheck = isDotNet ? "This was updated!" : null;
// await WaitForMobileTableRecordAsync("Item", idToCheck, textToCheck);
//}
protected async Task<IEnumerable<CloudBlockBlob>> Scenario_RandGuidBinding_GeneratesRandomIDs()
{
var container = await GetEmptyContainer("scenarios-output");
// Call 3 times - expect 3 separate output blobs
for (int i = 0; i < 3; i++)
{
JObject input = new JObject
{
{ "scenario", "randGuid" },
{ "container", "scenarios-output" },
{ "value", i }
};
await Fixture.Host.BeginFunctionAsync("Scenarios", input);
}
IEnumerable<CloudBlockBlob> blobs = null;
await TestHelpers.Await(async () =>
{
blobs = await TestHelpers.ListBlobsAsync(container);
return blobs.Count() == 3;
});
// Different languages write different content, so let them validate the blobs.
return blobs;
}
protected async Task<CloudBlobContainer> GetEmptyContainer(string containerName)
{
var container = Fixture.BlobClient.GetContainerReference(containerName);
await TestHelpers.ClearContainerAsync(container);
return container;
}
protected async Task<JToken> WaitForMobileTableRecordAsync(string tableName, string itemId, string textToMatch = null)
{
// We know the tests are using the default INameResolver and this setting.
var mobileAppUri = _nameResolver.Resolve("AzureWebJobs_TestMobileUri");
var client = new MobileServiceClient(new Uri(mobileAppUri));
JToken item = null;
var table = client.GetTable(tableName);
await TestHelpers.Await(() =>
{
bool result = false;
try
{
item = Task.Run(() => table.LookupAsync(itemId)).Result;
if (textToMatch != null)
{
result = item["Text"].ToString() == textToMatch;
}
else
{
result = true;
}
}
catch (AggregateException aggEx)
{
var ex = (MobileServiceInvalidOperationException)aggEx.InnerException;
if (ex.Response.StatusCode != HttpStatusCode.NotFound)
{
throw;
}
}
return result;
});
return item;
}
protected async Task<Document> WaitForDocumentAsync(string itemId, string textToMatch = null)
{
var docUri = UriFactory.CreateDocumentUri("ItemDb", "ItemCollection", itemId);
// We know the tests are using the default connection string.
var connectionString = _configuration.GetConnectionString("CosmosDB");
var builder = new DbConnectionStringBuilder
{
ConnectionString = connectionString
};
var serviceUri = new Uri(builder["AccountEndpoint"].ToString());
var client = new DocumentClient(serviceUri, builder["AccountKey"].ToString());
Document doc = null;
await TestHelpers.Await(async () =>
{
bool result = false;
try
{
var response = await client.ReadDocumentAsync(docUri);
doc = response.Resource;
}
catch (DocumentClientException ex) when (ex.Error.Code == "NotFound")
{
return false;
}
if (textToMatch != null)
{
result = doc.GetPropertyValue<string>("text") == textToMatch;
}
else
{
result = true;
}
return result;
},
userMessageCallback: () =>
{
// AppVeyor only shows 4096 chars
var s = string.Join(Environment.NewLine, Fixture.Host.GetLogMessages());
return s.Length < 4096 ? s : s.Substring(s.Length - 4096);
});
return doc;
}
protected static bool VerifyNotificationHubExceptionMessage(Exception exception)
{
if ((exception.Source == "Microsoft.Azure.NotificationHubs")
&& exception.Message.Contains("notification has no target applications"))
{
// Expected if using NH without any registrations
return true;
}
return false;
}
protected async Task<LogMessage> WaitForTraceAsync(string functionName, Func<LogMessage, bool> filter)
{
LogMessage logMessage = null;
await TestHelpers.Await(() =>
{
logMessage = Fixture.Host.GetLogMessages(LogCategories.CreateFunctionUserCategory(functionName)).SingleOrDefault(filter);
return logMessage != null;
});
return logMessage;
}
protected async Task<LogMessage> WaitForTraceAsync(Func<LogMessage, bool> filter)
{
LogMessage logMessage = null;
await TestHelpers.Await(() =>
{
logMessage = Fixture.Host.GetLogMessages().SingleOrDefault(filter);
return logMessage != null;
});
return logMessage;
}
protected async Task<JObject> GetFunctionTestResult(string functionName)
{
string logEntry = null;
await TestHelpers.Await(() =>
{
// search the logs for token "TestResult:" and parse the following JSON
var logs = Fixture.Host.GetLogMessages(LogCategories.CreateFunctionUserCategory(functionName));
if (logs != null)
{
logEntry = logs.Select(p => p.FormattedMessage).SingleOrDefault(p => p != null && p.Contains("TestResult:"));
}
return logEntry != null;
});
int idx = logEntry.IndexOf("{");
logEntry = logEntry.Substring(idx);
return JObject.Parse(logEntry);
}
public class ScenarioInput
{
[JsonProperty("scenario")]
public string Scenario { get; set; }
[JsonProperty("container")]
public string Container { get; set; }
[JsonProperty("value")]
public string Value { get; set; }
}
}
} | 38.914352 | 198 | 0.564868 | [
"Apache-2.0",
"MIT"
] | RanjeetKumar27/azure-functions-host | test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/EndToEndTestsBase.cs | 16,813 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace IdentityManagerTest
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
| 27.916667 | 70 | 0.716418 | [
"MIT"
] | cridasua/identity-manager-test | IdentityManagerTest/IdentityManagerTest/Global.asax.cs | 672 | C# |
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Tests
{
[TestClass]
public class DTests
{
const int TimeLimit = 2000;
const double RelativeError = 1e-9;
[TestMethod, Timeout(TimeLimit)]
public void Test1()
{
const string input = @"6 5
8 -3 5 7 0 -4
";
const string output = @"3
";
Tester.InOutTest(Tasks.D.Solve, input, output);
}
[TestMethod, Timeout(TimeLimit)]
public void Test2()
{
const string input = @"2 -1000000000000000
1000000000 -1000000000
";
const string output = @"0
";
Tester.InOutTest(Tasks.D.Solve, input, output);
}
}
}
| 21.264706 | 59 | 0.5574 | [
"CC0-1.0"
] | AconCavy/AtCoder.Tasks.CS | ABC/ABC233/Tests/DTests.cs | 723 | C# |
namespace Datester.Data.Models
{
public class UserChat
{
public int Id { get; set; }
public string UserId { get; set; }
public ApplicationUser ApplicationUser { get; set; }
public int ChatId { get; set; }
public Chat Chat { get; set; }
}
}
| 21.071429 | 60 | 0.576271 | [
"MIT"
] | bazlus/DatesterAPI | DatesterAPI/Datester.Models/UserChat.cs | 297 | C# |
using System;
using System.Globalization;
using Parquet.Properties;
namespace Parquet
{
/// <summary>
/// Global access to the logging mechanism.
/// </summary>
/// <seealso cref="ILogger"/>
public static class Logger
{
#region Characteristics
/// <summary>The instance currently being used to log events.</summary>
private static ILogger currentLogger = new LoggerDefault();
#endregion
#region Initialization
/// <summary>
/// Sets up the logging system to use the provided instance when logging.
/// </summary>
/// <param name="loggerToUse">The logger being provided to the logging system.</param>
/// <remarks>
/// Inspired by Microsoft.Extensions.Logging.ILogger but simpler.
/// </remarks>
public static void SetLogger(ILogger loggerToUse)
=> currentLogger = loggerToUse is not null
? loggerToUse
: currentLogger;
#endregion
#region Log Access
/// <summary>
/// Writes a log entry.
/// </summary>
/// <param name="logLevel">The severity of the event being logged.</param>
/// <param name="message">A message summarizing the event being logged.</param>
/// <param name="exception">The exception related to this event, if any.</param>
public static void Log(LogLevel logLevel, string message = null, Exception exception = null)
=> currentLogger.Log(logLevel, message, exception);
/// <summary>
/// Writes a log entry.
/// </summary>
/// <param name="logLevel">The severity of the event being logged.</param>
/// <param name="objectToLog">An object related to the event being logged. This will be converted to a string.</param>
public static void Log(LogLevel logLevel, object objectToLog)
=> currentLogger.Log(logLevel, objectToLog?.ToString() ?? "", null);
#endregion
#region Convenience Routines
/// <summary>
/// Convenience method that logs a <see cref="LibraryState"/> error and returns the given default value.
/// </summary>
/// <typeparam name="T">The type of value to return.</typeparam>
/// <param name="name">The name of the item that cannot be used during play.</param>
/// <param name="defaultValue">The default value to return.</param>
/// <returns>The default value given.</returns>
internal static T DefaultWithImmutableInPlayLog<T>(string name, T defaultValue)
{
currentLogger.Log(LogLevel.Warning, string.Format(CultureInfo.CurrentCulture, Resources.WarningImmutableDuringPlay,
name), null);
return defaultValue;
}
/// <summary>
/// Convenience method that logs a conversion error and returns the given default value.
/// </summary>
/// <typeparam name="T">The type of value to return.</typeparam>
/// <param name="value">The value of the item that failed to convert.</param>
/// <param name="name">The name of the item that failed to convert.</param>
/// <param name="defaultValue">The default value to return.</param>
/// <returns>The default value given.</returns>
internal static T DefaultWithConvertLog<T>(string value, string name, T defaultValue)
{
currentLogger.Log(LogLevel.Error, string.Format(CultureInfo.CurrentCulture, Resources.ErrorCannotConvert,
value, name), null);
return defaultValue;
}
/// <summary>
/// Convenience method that logs a parsing error and returns the given default value.
/// </summary>
/// <typeparam name="T">The type of value to return.</typeparam>
/// <param name="value">The value of the item that failed to parse.</param>
/// <param name="name">The name of the item that failed to parse.</param>
/// <param name="defaultValue">The default value to return.</param>
/// <returns>The default value given.</returns>
internal static T DefaultWithParseLog<T>(string value, string name, T defaultValue)
{
currentLogger.Log(LogLevel.Error, string.Format(CultureInfo.CurrentCulture, Resources.ErrorCannotParse,
value, name), null);
return defaultValue;
}
/// <summary>
/// Convenience method that logs an unsupported command error and returns the given default value.
/// </summary>
/// <typeparam name="T">The type of value to return.</typeparam>
/// <param name="name">The name of the command type.</param>
/// <param name="commandText">The text version of the unsupported command.</param>
/// <param name="defaultValue">The default value to return.</param>
/// <returns>The default value given.</returns>
internal static T DefaultWithUnsupportedNodeLog<T>(string name, string commandText, T defaultValue)
{
currentLogger.Log(LogLevel.Warning, string.Format(CultureInfo.CurrentCulture,
Resources.ErrorUnsupportedNode,
name, commandText), null);
return defaultValue;
}
/// <summary>
/// Convenience method that logs a serialization error and returns the given default value.
/// </summary>
/// <typeparam name="T">The type of value to return.</typeparam>
/// <param name="name">The name of the item that failed to serialize.</param>
/// <param name="defaultValue">The default value to return.</param>
/// <returns>The default value given.</returns>
internal static T DefaultWithUnsupportedSerializationLog<T>(string name, T defaultValue)
{
currentLogger.Log(LogLevel.Error, string.Format(CultureInfo.CurrentCulture, Resources.ErrorUnsupportedSerialization,
name), null);
return defaultValue;
}
#endregion
}
}
| 49.421875 | 128 | 0.599273 | [
"MIT"
] | mxashlynn/Parquet | ParquetClassLibrary/Logger.cs | 6,326 | C# |
using Core;
using loadingStation.Base.Connection.Devices.Smartdevice;
using loadingStation.Base.Function;
using System;
using System.Windows.Forms;
namespace loadingStation.GUI.Settings
{
public partial class AppSetting : Form
{
#region DropShadow Properties
private const int CS_DROPSHADOW = 0x00020000;
protected override CreateParams CreateParams
{
get
{
// add the drop shadow flag for automatically drawing
// a drop shadow around the form
CreateParams cp = base.CreateParams;
cp.ClassStyle |= CS_DROPSHADOW;
return cp;
}
}
#endregion
private ModbusOutput DeviceOutput;
private bool ModeChanged = false;
// status true if is not filling & mixing
private bool Status = !(GlobalProperties.CurrentStatus is GlobalProperties.Status.Filling) && !(GlobalProperties.CurrentStatus is GlobalProperties.Status.Mixing);
public AppSetting()
{
InitializeComponent();
Region = System.Drawing.Region.FromHrgn(Actions.CreateRoundRectRgn(0, 0, Width, Height, 25, 25));
Actions.RecenterLocation(this);
Helper.AnimateBounce(this, 550, Location.X, Location.Y + 15);
}
#region Event
private void BtnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void BtnRestart_Click(object sender, EventArgs e)
{
ModeSaveSetting();
lblDashboard.Text = "Restart Safely, Please Wait";
Application.DoEvents();
foreach (ModbusOutput sd in GlobalProperties.DevicesOutput.Values)
{
// Close All Valve
sd.ResetAllBit();
}
System.Threading.Thread.Sleep(1000);
foreach (ModbusInput sd in GlobalProperties.DevicesInput.Values)
{
sd.StopLogging();
}
System.Threading.Thread.Sleep(1000);
Actions.RelaunchApplication();
}
private void BtnExit_Click(object sender, EventArgs e)
{
ModeSaveSetting();
// STOP LOGGING
GlobalProperties.FLAG_LOGGING = false;
lblDashboard.BackColor = System.Drawing.Color.FromArgb(235, 77, 75);
lblDashboard.Text = "Exit Safely, Please Wait";
Application.DoEvents();
foreach (ModbusOutput sd in GlobalProperties.DevicesOutput.Values)
{
// Close All Valve
sd.ResetAllBit();
}
System.Threading.Thread.Sleep(1100);
foreach (ModbusInput sd in GlobalProperties.DevicesInput.Values)
{
sd.StopLogging();
}
System.Threading.Thread.Sleep(1000);
Environment.Exit(0);
}
private void ListProperties_SelectedIndexChanged(object sender, EventArgs e)
{
}
#endregion
private void AppSetting_Load(object sender, EventArgs e)
{
DeviceOutput = GlobalProperties.ModbusOutput != null ? GlobalProperties.ModbusOutput : null;
bool ModeIndicator = GlobalProperties.Configuration.IndicatorOnly;
bool ModeDebug = GlobalProperties.Configuration.IsDebugging;
bool ManualState = GlobalProperties.ManualState;
rbIndicator.Checked = ModeIndicator ? true : false;
rbDebug.Checked = ModeDebug ? true : false;
rbRelease.Checked = !ModeDebug && !ModeIndicator ? true : false;
rbManualOn.Checked = ManualState;
cbPropeler.Checked = GlobalProperties.AllowPropeler;
cbCoolant.Checked = GlobalProperties.ManualCoolant;
cbWater.Checked = GlobalProperties.ManualWater;
}
private void RbRelease_CheckedChanged(object sender, EventArgs e)
{
ModeChanged = true;
}
private void RbDebug_CheckedChanged(object sender, EventArgs e)
{
ModeChanged = true;
}
private void RbIndicator_CheckedChanged(object sender, EventArgs e)
{
ModeChanged = true;
}
private void ModeSaveSetting()
{
if (ModeChanged)
{
bool Release = rbRelease.Checked;
bool Debug = rbDebug.Checked;
bool Indicator = rbIndicator.Checked;
GlobalProperties.Configuration.IsDebugging = Release ? false : true;
GlobalProperties.Configuration.IsDebugging = Debug ? true : false;
GlobalProperties.Configuration.IndicatorOnly = Indicator ? true : false;
Base.Configuration.Jsonconfig.GenerateConfig();
}
}
private void BtnSecurity_Click(object sender, EventArgs e)
{
using (SecuritySetting n = new SecuritySetting())
{
n.ShowDialog();
}
}
private void btnConfigurations_Click(object sender, EventArgs e)
{
using (LSSetting ls = new LSSetting())
{
ls.ShowDialog();
}
}
private void btnSmartdevice_Click(object sender, EventArgs e)
{
using (Smartdevices sd = new Smartdevices())
{
sd.ShowDialog();
}
}
private void btnCancel_Click_1(object sender, EventArgs e)
{
this.Close();
}
private void cbPropeler_CheckedChanged(object sender, EventArgs e)
{
GlobalProperties.AllowPropeler = cbPropeler.Checked ? true : false;
}
private void cbCoolant_CheckedChanged(object sender, EventArgs e)
{
GlobalProperties.ManualCoolant = cbCoolant.Checked ? true : false;
if (DeviceOutput != null && GlobalProperties.ManualState)
{
if (GlobalProperties.ManualCoolant && GlobalProperties.ManualState)
{
DeviceOutput.SetBit(11);
DeviceOutput.SetBit(14);
Actions.SetIndicator(GlobalProperties.Valve.Open, GlobalProperties.Type.ValveCoolant);
}
else if(!GlobalProperties.ManualCoolant && GlobalProperties.ManualState)
{
DeviceOutput.ResetBit(11);
DeviceOutput.ResetBit(14);
Actions.SetIndicator(GlobalProperties.Valve.Close, GlobalProperties.Type.ValveCoolant);
}
}
}
private void cbWater_CheckedChanged(object sender, EventArgs e)
{
GlobalProperties.ManualWater = cbWater.Checked ? true : false;
if (DeviceOutput != null && GlobalProperties.ManualState)
{
if (GlobalProperties.ManualWater && GlobalProperties.ManualState)
{
DeviceOutput.SetBit(13);
Actions.SetIndicator(GlobalProperties.Valve.Open, GlobalProperties.Type.ValveWater);
}
else if (!GlobalProperties.ManualWater && GlobalProperties.ManualState)
{
DeviceOutput.ResetBit(13);
Actions.SetIndicator(GlobalProperties.Valve.Close, GlobalProperties.Type.ValveWater);
}
}
}
private void rbManualOn_CheckedChanged(object sender, EventArgs e)
{
GlobalProperties.ManualState = true;
}
private void rbManualOff_CheckedChanged(object sender, EventArgs e)
{
GlobalProperties.ManualState = false;
// Uncheck
cbCoolant.Checked = false;
cbWater.Checked = false;
// Close Coolant
DeviceOutput.ResetBit(11);
DeviceOutput.ResetBit(14);
Actions.SetIndicator(GlobalProperties.Valve.Close, GlobalProperties.Type.ValveCoolant);
// Close Water
DeviceOutput.ResetBit(13);
Actions.SetIndicator(GlobalProperties.Valve.Close, GlobalProperties.Type.ValveWater);
}
}
}
| 32.527344 | 170 | 0.576678 | [
"MIT"
] | thatsallineed/Loading-Station | loadingStation/GUI/Settings/AppSetting.cs | 8,329 | C# |
using FluentAssertions;
using Formulaic.Finance;
using Xunit;
namespace FormulaicTests
{
public class SimpleDepreciationTests
{
private readonly int doublePrecision = 8;
[Theory]
[InlineData(100.0, 8.0, 5.0, 60.0)]
public void CalculateFinalValueTest(double principalValue, double depreciation, double years, double expected)
{
var result = SimpleDepreciation.CalculateFinalValue(principalValue, depreciation, years);
result.Should().BeApproximately(expected, doublePrecision);
}
[Theory]
[InlineData(60.0, 8.0, 5.0, 100.0)]
public void SimpleDepreciationPrincipalValueTest(double finalValue, double depreciation, double years, double expected)
{
var result = SimpleDepreciation.CalculatePrincipalValue(finalValue, depreciation, years);
result.Should().BeApproximately(expected, doublePrecision);
}
[Theory]
[InlineData(100.0, 60.0, 5.0, 8.0)]
public void SimpleDepreciationDepreciationTest(double principalValue, double finalValue, double years, double expected)
{
var result = SimpleDepreciation.CalculateDepreciation(principalValue, finalValue, years);
result.Should().BeApproximately(expected, doublePrecision);
}
[Theory]
[InlineData(100.0, 60.0, 8.0, 5.0)]
public void SimpleDepreciationYearsTest(double principalValue, double finalValue, double depreciation, double expected)
{
var result = SimpleDepreciation.CalculateYears(principalValue, finalValue, depreciation);
result.Should().BeApproximately(expected, doublePrecision);
}
}
}
| 35.244898 | 127 | 0.677475 | [
"MIT"
] | sjmeunier/formulaic | FormulaicTests/Finance/SimpleDepreciationTests.cs | 1,727 | C# |
namespace UiPath.Shared.Localization
{
class SharedResources : Ccint.Ocr.Activities.Design.Properties.Resources
{
}
} | 21.666667 | 76 | 0.738462 | [
"MIT"
] | allenlooplee/CcintOcrActivitiesPack | Ccint.Ocr/Ccint.Ocr.Activities.Design/Properties/SharedResources.cs | 132 | C# |
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime.Serialization;
namespace BigQ.Client.Classes
{
/// <summary>
/// The type of connection.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ConnectionType
{
/// <summary>
/// Connected via TCP without SSL.
/// </summary>
[EnumMember(Value = "Tcp")]
Tcp,
/// <summary>
/// Connected via TCP with SSL.
/// </summary>
[EnumMember(Value = "TcpSsl")]
TcpSsl,
/// <summary>
/// Connected via Websocket without SSL.
/// </summary>
[EnumMember(Value = "Websocket")]
Websocket,
/// <summary>
/// Connected via Websocket with SSL.
/// </summary>
[EnumMember(Value = "WebsocketSsl")]
WebsocketSsl
}
}
| 25.114286 | 48 | 0.54835 | [
"MIT"
] | bigqio/bigq | Client/Classes/ConnectionType.cs | 881 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
#if NETCOREAPP
using Microsoft.AspNetCore.Mvc;
#endif
#if NETFRAMEWORK
using System.Web.Mvc;
using System.Web.Security;
#endif
namespace EmailMaker.Controllers.ViewModels
{
#region Models
public class ChangePasswordModel
{
[Required]
[DataType(DataType.Password)]
[Display(Name = "Current password")]
public string OldPassword { get; set; }
[Required]
//[ValidatePasswordLength] // todo
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm new password")]
[System.ComponentModel.DataAnnotations.Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
public class LogOnModel
{
[Required]
[Display(Name = "Email address")]
public string EmailAddress { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
}
public class RegisterModel
{
// [Required]
// [Display(Name = "User name")]
// public string UserName { get; set; }
[Required]
[DataType(DataType.EmailAddress)]
[Display(Name = "Email address")]
public string Email { get; set; }
[Required]
//[ValidatePasswordLength] // todo
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[System.ComponentModel.DataAnnotations.Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
#endregion
}
| 27.481013 | 145 | 0.620912 | [
"MIT"
] | xhafan/emailmaker | src/EmailMaker.Controllers/ViewModels/AccountModels.cs | 2,173 | C# |
using IA;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
namespace Galaco
{
internal class Program
{
private static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult();
private async Task Start()
{
ClientInformation clientInfo = LoadKeyFromConfig();
Bot bot = new Bot(clientInfo);
new Hotloader(bot).Run();
await bot.ConnectAsync();
}
private ClientInformation LoadKeyFromConfig()
{
ClientInformation info = new ClientInformation();
string file = Directory.GetCurrentDirectory() + "/config/settings.config";
if (File.Exists(file))
{
StreamReader sr = new StreamReader(file);
while (!sr.EndOfStream)
{
string x = sr.ReadLine();
if (x.StartsWith("#")) continue;
PropertyInfo propertyInfo = info.GetType().GetProperty(x.Split(':')[0]);
if (propertyInfo != null)
{
propertyInfo.SetValue(info, Convert.ChangeType(x.Split(':')[1], propertyInfo.PropertyType), null);
}
else
{
Log.Warning($"{x} is not a valid option.");
}
}
sr.Close();
return info;
}
else
{
Directory.CreateDirectory(Directory.GetCurrentDirectory() + "/config");
StreamWriter sw = new StreamWriter(file);
List<string> allProperties = new List<string>();
List<PropertyInfo> properties = new List<PropertyInfo>();
properties.AddRange(typeof(ClientInformation).GetProperties());
//TODO: find a more elegant solution for this
properties.Remove(properties.Find(x => { return x.Name == "EventLoaderMethod"; }));
foreach(PropertyInfo p in properties)
{
allProperties.Add(p.Name);
}
WriteComments(sw,
"GALACO bot settings file v1.2",
"==============================",
"Here's a quick tutorial for you to understand GALACO's settings in a breeze!",
"Firstly, comments HAVE to start with a #. as you can see from this file.",
"Secondly, write a property like this: property:value. One on each line",
"There are a handful of settings you can change to however you want, I'll put a full list on the bottom!",
"-----------------------------",
"Created by: Veld#5128",
"-----------------------------",
"ALL PROPERTIES AVAILABLE",
string.Join(", ", allProperties.ToArray()),
"-----------------------------"
);
sw.WriteLine("Name:GALACO");
sw.WriteLine("Version:1.2");
sw.WriteLine("ShardCount:1");
sw.Close();
Console.WriteLine("First run detected!");
Console.WriteLine($"Created a config file at:\n {file}\n\nPress enter to continue...");
Console.ReadLine();
}
return null;
}
void WriteComments(StreamWriter sw, params string[] lines)
{
foreach(string s in lines)
{
sw.WriteLine("# " + s);
}
}
}
} | 34.740741 | 126 | 0.474147 | [
"MIT"
] | velddev/Galaco | Galaco/Program.cs | 3,754 | C# |
using System;
using Dates.Recurring.Type;
namespace Dates.Recurring.Builders
{
public class YearsBuilder
{
private int _skipYears;
private int? _dayOfMonth;
private Month _month = Month.JANUARY;
private Ordinal? _ordinalWeek;
private DayOfWeek? _dayOfWeek;
private DateTime _starting;
private DateTime? _ending;
public YearsBuilder(int skipYears, DateTime starting)
{
_skipYears = skipYears;
_starting = starting;
}
public YearsBuilder Ending(DateTime ending)
{
_ending = ending;
return this;
}
public YearsBuilder OnDay(int dayOfMonth)
{
_dayOfMonth = dayOfMonth;
return this;
}
public YearsBuilder OnMonths(Month months)
{
_month = months;
return this;
}
public YearsBuilder OnOrdinalWeek(Ordinal ordinalWeek)
{
_ordinalWeek = ordinalWeek;
return this;
}
public YearsBuilder OnDay(DayOfWeek dayOfWeek)
{
_dayOfWeek = dayOfWeek;
return this;
}
public YearsBuilder OnMonth(DateTime dateTime)
{
switch (dateTime.Month)
{
case 1:
_month = Month.JANUARY;
break;
case 2:
_month = Month.FEBRUARY;
break;
case 3:
_month = Month.MARCH;
break;
case 4:
_month = Month.APRIL;
break;
case 5:
_month = Month.MAY;
break;
case 6:
_month = Month.JUNE;
break;
case 7:
_month = Month.JULY;
break;
case 8:
_month = Month.AUGUST;
break;
case 9:
_month = Month.SEPTEMBER;
break;
case 10:
_month = Month.OCTOBER;
break;
case 11:
_month = Month.NOVEMBER;
break;
case 12:
_month = Month.DECEMBER;
break;
}
return this;
}
public Yearly Build()
{
if (_dayOfMonth.HasValue)
{
return new Yearly(_skipYears, _dayOfMonth, _month, _starting, _ending);
}
return new Yearly(_skipYears, _ordinalWeek, _dayOfWeek, _month, _starting, _ending);
}
}
}
| 26.537736 | 96 | 0.441522 | [
"MIT"
] | WaltDaniels/Dates.Recurring | Dates.Recurring/Builders/YearsBuilder.cs | 2,815 | 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.
// 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("a201babd-ae39-429a-9f9a-d8f857dcfa06")] | 45.285714 | 84 | 0.783912 | [
"Apache-2.0"
] | CopaDataPM/tfsaggregator | Aggregator.ConsoleApp/Properties/AssemblyInfo.cs | 636 | C# |
using Microsoft.AspNetCore.Authentication;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
namespace IdNet6.Services
{
/// <summary>
/// Models a user's authentication session
/// </summary>
public interface IUserSession
{
/// <summary>
/// Creates a session identifier for the signin context and issues the session id cookie.
/// </summary>
Task<string> CreateSessionIdAsync(ClaimsPrincipal principal, AuthenticationProperties properties);
/// <summary>
/// Gets the current authenticated user.
/// </summary>
Task<ClaimsPrincipal> GetUserAsync();
/// <summary>
/// Gets the current session identifier.
/// </summary>
/// <returns></returns>
Task<string> GetSessionIdAsync();
/// <summary>
/// Ensures the session identifier cookie asynchronous.
/// </summary>
/// <returns></returns>
Task EnsureSessionIdCookieAsync();
/// <summary>
/// Removes the session identifier cookie.
/// </summary>
Task RemoveSessionIdCookieAsync();
/// <summary>
/// Adds a client to the list of clients the user has signed into during their session.
/// </summary>
/// <param name="clientId">The client identifier.</param>
/// <returns></returns>
Task AddClientIdAsync(string clientId);
/// <summary>
/// Gets the list of clients the user has signed into during their session.
/// </summary>
/// <returns></returns>
Task<IEnumerable<string>> GetClientListAsync();
}
}
| 31.296296 | 106 | 0.605917 | [
"Apache-2.0"
] | simple0x47/IdNet6 | src/IdNet6/src/Services/IUserSession.cs | 1,692 | 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("WebFormsDocumentViewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebFormsDocumentViewer")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cbb712cd-dc08-4f05-808c-a41024538e0b")]
// 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.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
| 38.162162 | 84 | 0.751416 | [
"MIT"
] | HajbokRobert/WebFormsDocumentViewer | WebFormsDocumentViewer/Properties/AssemblyInfo.cs | 1,415 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using MS.Internal.Xml.Cache;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
namespace System.Xml.XPath
{
/// <summary>
/// XDocument follows the XPath/XQuery data model. All nodes in the tree reference the document,
/// and the document references the root node of the tree. All namespaces are stored out-of-line,
/// in an Element --> In-Scope-Namespaces map.
/// </summary>
public class XPathDocument : IXPathNavigable
{
private XPathNode[] _pageText, _pageRoot, _pageXmlNmsp;
private int _idxText, _idxRoot, _idxXmlNmsp;
private XmlNameTable _nameTable;
private bool _hasLineInfo;
private Dictionary<XPathNodeRef, XPathNodeRef> _mapNmsp;
private Dictionary<string, XPathNodeRef> _idValueMap;
/// <summary>
/// Flags that control Load behavior.
/// </summary>
internal enum LoadFlags
{
None = 0,
AtomizeNames = 1, // Do not assume that names passed to XPathDocumentBuilder have been pre-atomized, and atomize them
Fragment = 2, // Create a document with no document node
}
//-----------------------------------------------
// Creation Methods
//-----------------------------------------------
/// <summary>
/// Create a new empty document.
/// </summary>
internal XPathDocument()
{
_nameTable = new NameTable();
}
/// <summary>
/// Create a new empty document. All names should be atomized using "nameTable".
/// </summary>
internal XPathDocument(XmlNameTable nameTable)
{
if (nameTable == null)
throw new ArgumentNullException(nameof(nameTable));
_nameTable = nameTable;
}
/// <summary>
/// Create a new document and load the content from the reader.
/// </summary>
public XPathDocument(XmlReader reader) : this(reader, XmlSpace.Default)
{
}
/// <summary>
/// Create a new document from "reader", with whitespace handling controlled according to "space".
/// </summary>
public XPathDocument(XmlReader reader, XmlSpace space)
{
if (reader == null)
throw new ArgumentNullException(nameof(reader));
LoadFromReader(reader, space);
}
/// <summary>
/// Create a new document and load the content from the text reader.
/// </summary>
public XPathDocument(TextReader textReader)
{
XmlTextReaderImpl reader = SetupReader(new XmlTextReaderImpl(string.Empty, textReader));
try
{
LoadFromReader(reader, XmlSpace.Default);
}
finally
{
reader.Close();
}
}
/// <summary>
/// Create a new document and load the content from the stream.
/// </summary>
public XPathDocument(Stream stream)
{
XmlTextReaderImpl reader = SetupReader(new XmlTextReaderImpl(string.Empty, stream));
try
{
LoadFromReader(reader, XmlSpace.Default);
}
finally
{
reader.Close();
}
}
/// <summary>
/// Create a new document and load the content from the Uri.
/// </summary>
public XPathDocument(string uri) : this(uri, XmlSpace.Default)
{
}
/// <summary>
/// Create a new document and load the content from the Uri, with whitespace handling controlled according to "space".
/// </summary>
public XPathDocument(string uri, XmlSpace space)
{
XmlTextReaderImpl reader = SetupReader(new XmlTextReaderImpl(uri));
try
{
LoadFromReader(reader, space);
}
finally
{
reader.Close();
}
}
/// <summary>
/// Create a writer that can be used to create nodes in this document. The root node will be assigned "baseUri", and flags
/// can be passed to indicate that names should be atomized by the builder and/or a fragment should be created.
/// </summary>
internal XmlRawWriter LoadFromWriter(LoadFlags flags, string baseUri)
{
return new XPathDocumentBuilder(this, null, baseUri, flags);
}
/// <summary>
/// Create a writer that can be used to create nodes in this document. The root node will be assigned "baseUri", and flags
/// can be passed to indicate that names should be atomized by the builder and/or a fragment should be created.
/// </summary>
internal void LoadFromReader(XmlReader reader, XmlSpace space)
{
XPathDocumentBuilder builder;
IXmlLineInfo lineInfo;
string xmlnsUri;
bool topLevelReader;
int initialDepth;
if (reader == null)
throw new ArgumentNullException(nameof(reader));
// Determine line number provider
lineInfo = reader as IXmlLineInfo;
if (lineInfo == null || !lineInfo.HasLineInfo())
lineInfo = null;
_hasLineInfo = (lineInfo != null);
_nameTable = reader.NameTable;
builder = new XPathDocumentBuilder(this, lineInfo, reader.BaseURI, LoadFlags.None);
try
{
// Determine whether reader is in initial state
topLevelReader = (reader.ReadState == ReadState.Initial);
initialDepth = reader.Depth;
// Get atomized xmlns uri
Debug.Assert((object)_nameTable.Get(string.Empty) == (object)string.Empty, "NameTable must contain atomized string.Empty");
xmlnsUri = _nameTable.Get(XmlReservedNs.NsXmlNs);
// Read past Initial state; if there are no more events then load is complete
if (topLevelReader && !reader.Read())
return;
// Read all events
do
{
// If reader began in intermediate state, return when all siblings have been read
if (!topLevelReader && reader.Depth < initialDepth)
return;
switch (reader.NodeType)
{
case XmlNodeType.Element:
{
bool isEmptyElement = reader.IsEmptyElement;
builder.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI, reader.BaseURI);
// Add attribute and namespace nodes to element
while (reader.MoveToNextAttribute())
{
string namespaceUri = reader.NamespaceURI;
if ((object)namespaceUri == (object)xmlnsUri)
{
if (reader.Prefix.Length == 0)
{
// Default namespace declaration "xmlns"
Debug.Assert(reader.LocalName == "xmlns");
builder.WriteNamespaceDeclaration(string.Empty, reader.Value);
}
else
{
Debug.Assert(reader.Prefix == "xmlns");
builder.WriteNamespaceDeclaration(reader.LocalName, reader.Value);
}
}
else
{
builder.WriteStartAttribute(reader.Prefix, reader.LocalName, namespaceUri);
builder.WriteString(reader.Value, TextBlockType.Text);
builder.WriteEndAttribute();
}
}
if (isEmptyElement)
builder.WriteEndElement(true);
break;
}
case XmlNodeType.EndElement:
builder.WriteEndElement(false);
break;
case XmlNodeType.Text:
case XmlNodeType.CDATA:
builder.WriteString(reader.Value, TextBlockType.Text);
break;
case XmlNodeType.SignificantWhitespace:
if (reader.XmlSpace == XmlSpace.Preserve)
builder.WriteString(reader.Value, TextBlockType.SignificantWhitespace);
else
// Significant whitespace without xml:space="preserve" is not significant in XPath/XQuery data model
goto case XmlNodeType.Whitespace;
break;
case XmlNodeType.Whitespace:
// We intentionally ignore the reader.XmlSpace property here and blindly trust
// the reported node type. If the reported information is not in sync
// (in this case if the reader.XmlSpace == Preserve) then we make the choice
// to trust the reported node type. Since we have no control over the input reader
// we can't even assert here.
// Always filter top-level whitespace
if (space == XmlSpace.Preserve && (!topLevelReader || reader.Depth != 0))
builder.WriteString(reader.Value, TextBlockType.Whitespace);
break;
case XmlNodeType.Comment:
builder.WriteComment(reader.Value);
break;
case XmlNodeType.ProcessingInstruction:
builder.WriteProcessingInstruction(reader.LocalName, reader.Value, reader.BaseURI);
break;
case XmlNodeType.EntityReference:
reader.ResolveEntity();
break;
case XmlNodeType.DocumentType:
// Create ID tables
IDtdInfo info = reader.DtdInfo;
if (info != null)
builder.CreateIdTables(info);
break;
case XmlNodeType.EndEntity:
case XmlNodeType.None:
case XmlNodeType.XmlDeclaration:
break;
}
}
while (reader.Read());
}
finally
{
builder.Close();
}
}
/// <summary>
/// Create a navigator positioned on the root node of the document.
/// </summary>
public XPathNavigator CreateNavigator()
{
return new XPathDocumentNavigator(_pageRoot, _idxRoot, null, 0);
}
//-----------------------------------------------
// Document Properties
//-----------------------------------------------
/// <summary>
/// Return the name table used to atomize all name parts (local name, namespace uri, prefix).
/// </summary>
internal XmlNameTable NameTable
{
get { return _nameTable; }
}
/// <summary>
/// Return true if line number information is recorded in the cache.
/// </summary>
internal bool HasLineInfo
{
get { return _hasLineInfo; }
}
/// <summary>
/// Return the singleton collapsed text node associated with the document. One physical text node
/// represents each logical text node in the document that is the only content-typed child of its
/// element parent.
/// </summary>
internal int GetCollapsedTextNode(out XPathNode[] pageText)
{
pageText = _pageText;
return _idxText;
}
/// <summary>
/// Set the page and index where the singleton collapsed text node is stored.
/// </summary>
internal void SetCollapsedTextNode(XPathNode[] pageText, int idxText)
{
_pageText = pageText;
_idxText = idxText;
}
/// <summary>
/// Return the root node of the document. This may not be a node of type XPathNodeType.Root if this
/// is a document fragment.
/// </summary>
internal int GetRootNode(out XPathNode[] pageRoot)
{
pageRoot = _pageRoot;
return _idxRoot;
}
/// <summary>
/// Set the page and index where the root node is stored.
/// </summary>
internal void SetRootNode(XPathNode[] pageRoot, int idxRoot)
{
_pageRoot = pageRoot;
_idxRoot = idxRoot;
}
/// <summary>
/// Every document has an implicit xmlns:xml namespace node.
/// </summary>
internal int GetXmlNamespaceNode(out XPathNode[] pageXmlNmsp)
{
pageXmlNmsp = _pageXmlNmsp;
return _idxXmlNmsp;
}
/// <summary>
/// Set the page and index where the implicit xmlns:xml node is stored.
/// </summary>
internal void SetXmlNamespaceNode(XPathNode[] pageXmlNmsp, int idxXmlNmsp)
{
_pageXmlNmsp = pageXmlNmsp;
_idxXmlNmsp = idxXmlNmsp;
}
/// <summary>
/// Associate a namespace node with an element.
/// </summary>
internal void AddNamespace(XPathNode[] pageElem, int idxElem, XPathNode[] pageNmsp, int idxNmsp)
{
Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element && pageNmsp[idxNmsp].NodeType == XPathNodeType.Namespace);
if (_mapNmsp == null)
_mapNmsp = new Dictionary<XPathNodeRef, XPathNodeRef>();
_mapNmsp.Add(new XPathNodeRef(pageElem, idxElem), new XPathNodeRef(pageNmsp, idxNmsp));
}
/// <summary>
/// Lookup the namespace nodes associated with an element.
/// </summary>
internal int LookupNamespaces(XPathNode[] pageElem, int idxElem, out XPathNode[] pageNmsp)
{
XPathNodeRef nodeRef = new XPathNodeRef(pageElem, idxElem);
Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element);
// Check whether this element has any local namespaces
if (_mapNmsp == null || !_mapNmsp.ContainsKey(nodeRef))
{
pageNmsp = null;
return 0;
}
// Yes, so return the page and index of the first local namespace node
nodeRef = _mapNmsp[nodeRef];
pageNmsp = nodeRef.Page;
return nodeRef.Index;
}
/// <summary>
/// Add an element indexed by ID value.
/// </summary>
internal void AddIdElement(string id, XPathNode[] pageElem, int idxElem)
{
if (_idValueMap == null)
_idValueMap = new Dictionary<string, XPathNodeRef>();
if (!_idValueMap.ContainsKey(id))
_idValueMap.Add(id, new XPathNodeRef(pageElem, idxElem));
}
/// <summary>
/// Lookup the element node associated with the specified ID value.
/// </summary>
internal int LookupIdElement(string id, out XPathNode[] pageElem)
{
XPathNodeRef nodeRef;
if (_idValueMap == null || !_idValueMap.ContainsKey(id))
{
pageElem = null;
return 0;
}
// Extract page and index from XPathNodeRef
nodeRef = _idValueMap[id];
pageElem = nodeRef.Page;
return nodeRef.Index;
}
//-----------------------------------------------
// Helper Methods
//-----------------------------------------------
/// <summary>
/// Set properties on the reader so that it is backwards-compatible with V1.
/// </summary>
private XmlTextReaderImpl SetupReader(XmlTextReaderImpl reader)
{
reader.EntityHandling = EntityHandling.ExpandEntities;
reader.XmlValidatingReaderCompatibilityMode = true;
return reader;
}
}
}
| 37.934641 | 139 | 0.504078 | [
"MIT"
] | 71221-maker/runtime | src/libraries/System.Private.Xml/src/System/Xml/XPath/XPathDocument.cs | 17,412 | C# |
namespace BlazorState.Pipeline.State
{
using MediatR;
using System;
public class ExceptionNotification : INotification
{
//public TRequest Request { get; set; }
public string RequestName { get; set; }
public Exception Exception { get; set; }
}
}
| 19.285714 | 52 | 0.692593 | [
"Unlicense"
] | GillCleeren/blazor-state | Source/BlazorState/Pipeline/CloneState/ExceptionNotification.cs | 270 | C# |
using OpenNefia.Content.Charas;
using OpenNefia.Content.DisplayName;
using OpenNefia.Content.GameObjects.Pickable;
using OpenNefia.Core.GameObjects;
using OpenNefia.Core.IoC;
using OpenNefia.Core.Locale;
using OpenNefia.Core.Maps;
using System.Text;
namespace OpenNefia.Content.GameObjects
{
public class TargetTextSystem : EntitySystem
{
[Dependency] private readonly IEntityLookup _lookup = default!;
[Dependency] private readonly DisplayNameSystem _displayNames = default!;
public override void Initialize()
{
SubscribeLocalEvent<CharaComponent, GetTargetTextEventArgs>(HandleTargetTextChara, nameof(HandleTargetTextChara));
}
public bool GetTargetText(EntityUid onlooker, MapCoordinates targetPos, out string text, bool visibleOnly)
{
if (!Get<VisibilitySystem>().HasLineOfSight(onlooker, targetPos))
{
text = "You can't see this position.";
return false;
}
var sb = new StringBuilder();
foreach (var spatial in _lookup.GetLiveEntitiesAtCoords(targetPos))
{
var ev = new GetTargetTextEventArgs(onlooker, visibleOnly);
RaiseLocalEvent(spatial.Owner, ev);
foreach (var line in ev.TargetTexts)
{
sb.AppendLine(line);
}
}
text = sb.ToString();
return true;
}
private void HandleTargetTextChara(EntityUid uid, CharaComponent chara, GetTargetTextEventArgs args)
{
if (args.Handled)
return;
DoTargetTextChara(uid, args, chara);
}
private void DoTargetTextChara(EntityUid target, GetTargetTextEventArgs args,
CharaComponent? chara = null,
SpatialComponent? spatial = null,
MetaDataComponent? meta = null)
{
if (!Resolve(target, ref chara, ref spatial, ref meta))
return;
if (!meta.IsAlive)
return;
if (Get<VisibilitySystem>().CanSeeEntity(target, args.Onlooker)
&& EntityManager.TryGetComponent(args.Onlooker, out SpatialComponent? onlookerSpatial))
{
onlookerSpatial.MapPosition.TryDistanceTiled(spatial.MapPosition, out var dist);
var targetLevelText = GetTargetDangerText(args.Onlooker, target);
args.TargetTexts.Add("You are targeting " + _displayNames.GetDisplayName(target) + " (distance " + (int)dist + ")");
args.TargetTexts.Add(targetLevelText);
}
}
public string GetTargetDangerText(EntityUid onlooker, EntityUid target)
{
return "(danger text)";
}
/// <hsp>txtItemOnCell(x, y)</hsp>
public string? GetItemOnCellText(EntityUid player, MapCoordinates newPosition)
{
var ents = _lookup.GetLiveEntitiesAtCoords(newPosition).ToList();
var items = ents.Where(ent => EntityManager.HasComponent<PickableComponent>(ent.Owner)).ToList();
if (items.Count == 0)
return null;
if (items.Count > 3)
return Loc.GetString("Elona.TargetText.ItemOnCell.MoreThanThree", ("itemCount", items.Count));
var mes = new StringBuilder();
for (int i = 0; i < items.Count; i++)
{
if (i > 0)
{
mes.Append(Loc.GetString("Elona.TargetText.ItemOnCell.And"));
}
var item = items[i];
mes.Append(_displayNames.GetDisplayName(item.Owner));
}
var ownState = OwnState.None;
if (EntityManager.TryGetComponent(items.First().Owner, out PickableComponent? pickable))
ownState = pickable.OwnState;
var itemNames = mes.ToString();
switch (ownState)
{
case OwnState.None:
return Loc.GetString("Elona.TargetText.ItemOnCell.Item", ("itemNames", itemNames));
case OwnState.Construct:
return Loc.GetString("Elona.TargetText.ItemOnCell.Construct", ("itemNames", itemNames));
default:
return Loc.GetString("Elona.TargetText.ItemOnCell.NotOwned", ("itemNames", itemNames));
}
}
}
public class GetTargetTextEventArgs : HandledEntityEventArgs
{
public readonly List<string> TargetTexts = new();
public readonly bool VisibleOnly;
public readonly EntityUid Onlooker;
public GetTargetTextEventArgs(EntityUid onlooker, bool visibleOnly)
{
VisibleOnly = visibleOnly;
Onlooker = onlooker;
}
}
}
| 36.02963 | 132 | 0.589021 | [
"MIT"
] | OpenNefia/OpenNefia | OpenNefia.Content/GameObjects/EntitySystems/TargetTextSystem.cs | 4,866 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Media3D;
namespace RaggedPieChart
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
// The camera.
private PerspectiveCamera TheCamera = null;
// The camera controller.
private SphericalCameraController CameraController = null;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// Define WPF objects.
ModelVisual3D visual3d = new ModelVisual3D();
Model3DGroup group = new Model3DGroup();
visual3d.Content = group;
mainViewport.Children.Add(visual3d);
// Define the camera, lights, and model.
DefineCamera(mainViewport);
DefineLights(group);
DefineModel(group);
}
// Define the camera.
private void DefineCamera(Viewport3D viewport)
{
TheCamera = new PerspectiveCamera();
TheCamera.FieldOfView = 60;
CameraController = new SphericalCameraController
(TheCamera, viewport, this, mainGrid, mainGrid);
}
// Define the lights.
private void DefineLights(Model3DGroup group)
{
Color darker = Color.FromArgb(255, 96, 96, 96);
Color dark = Color.FromArgb(255, 128, 128, 128);
group.Children.Add(new AmbientLight(darker));
group.Children.Add(new DirectionalLight(darker, new Vector3D(-1, 0, 0)));
group.Children.Add(new DirectionalLight(darker, new Vector3D(0, -1, 0)));
group.Children.Add(new DirectionalLight(dark, new Vector3D(0, 0, -1)));
}
private const double YMax = 3100000;
private const double YScale = 5.0 / YMax;
// Define the model.
private void DefineModel(Model3DGroup group)
{
// Axes.
//MeshExtensions.AddAxes(group);
// General positioning parameters.
Point3D origin = new Point3D(0, -1, 0);
double[] values = LoadData();
double[] heights = LoadHeights();
Brush[] brushes = { Brushes.Red, Brushes.Green, Brushes.Blue, Brushes.Orange };
double radius = 3;
double height = 1;
MakeRaggedPieSlices(origin, radius, values, heights, brushes, 60, group);
// Title.
FontFamily ff = new FontFamily("Franklin Gothic Demi");
Point3D ll = new Point3D(-radius, origin.Y + height + 2, radius);
double fontSize = 0.9;
MakeLabel("Sales Makeup", ll, D3.ZVector(-2 * radius), D3.YVector(1.25),
Brushes.Transparent, Brushes.Blue, fontSize, ff,
HorizontalAlignment.Center, VerticalAlignment.Center, group);
// Key.
string[,] keyLabels =
{
{ "", "A", "B", "C", "D" },
{ "Units", "", "", "", "" },
{ "$ (M)", "", "", "", "" },
};
for (int i = 1; i < 5; i++)
{
keyLabels[1, i] = values[i - 1].ToString() + "%";
keyLabels[2, i] = "$" + (100 * heights[i - 1]).ToString();
}
Brush[,] keyBrushes =
{
{ Brushes.Red, Brushes.Green, Brushes.Blue, Brushes.Orange, },
{ Brushes.Red, Brushes.Green, Brushes.Blue, Brushes.Orange, },
};
const double wid = 1;
const double hgt = 0.6;
const double xgap = 0.1;
const double ygap = 0.1;
int numRows = keyLabels.GetUpperBound(0) + 1;
int numCols = keyLabels.GetUpperBound(1) + 1;
double keyWid = numCols * wid + (numCols - 1) * xgap;
double keyHgt = numRows * hgt + (numRows - 1) * ygap;
double y = origin.Y + height + keyHgt - hgt + 1.5;
fontSize = 0.4;
for (int row = 0; row < numRows; row++)
{
double x = -keyWid / 2;
for (int col = 0; col < numCols; col++)
{
ll = new Point3D(x, y, -radius);
Brush fgBrush = Brushes.Black;
Brush bgBrush = Brushes.Transparent;
if ((row > 0) && (col > 0))
{
fgBrush = Brushes.White;
bgBrush = keyBrushes[row - 1, col - 1];
}
MakeLabel(keyLabels[row, col], ll, D3.XVector(wid), D3.YVector(hgt),
bgBrush, fgBrush, fontSize, ff,
HorizontalAlignment.Center, VerticalAlignment.Center, group);
x += wid + xgap;
}
y -= hgt + ygap;
}
}
// Make a row of bars in the X direction.
private void MakeBars(double xmin, double ymin,
double zmin, double dx, double gap,
double[] values, string[] frontLabels, string[] topLabels,
Brush[] barBrushes, Brush[] bgBrushes, Brush[] fgBrushes,
FontFamily ff, Model3DGroup group)
{
double x = xmin;
double fontSize = 0.4;
for (int i = 0; i < values.Length; i++)
{
// Make the bar.
MeshGeometry3D barMesh = new MeshGeometry3D();
Point3D corner = new Point3D(x, ymin, zmin);
barMesh.AddBox(corner,
D3.XVector(dx),
D3.YVector(YScale * values[i]),
D3.ZVector(dx));
group.Children.Add(barMesh.MakeModel(barBrushes[i]));
// Display the front label.
const double textWid = 1.8;
MakeLabel(frontLabels[i],
new Point3D(x + dx, ymin, textWid + zmin + dx + gap),
D3.ZVector(-textWid), D3.XVector(-dx),
bgBrushes[i], fgBrushes[i], fontSize, ff,
HorizontalAlignment.Left, VerticalAlignment.Center, group);
// Display the top label.
MakeLabel(topLabels[i],
new Point3D(x,
ymin + YScale * values[i],
zmin - 0.1),
D3.XVector(dx), D3.YVector(dx),
Brushes.Transparent, fgBrushes[i], fontSize, ff,
HorizontalAlignment.Center, VerticalAlignment.Bottom, group);
x += dx + gap;
}
}
// Make rows of bars in the X and Z directions.
private void MakeRowColumnBars(double xmin, double ymin,
double zmin, double dx, double gap,
double[,] values, string[] frontLabels, string[] sideLabels,
Brush[,] barBrushes, Brush[] bgBrushes, Brush[] fgBrushes,
FontFamily ff, Model3DGroup group)
{
int numX = values.GetUpperBound(0) + 1;
int numZ = values.GetUpperBound(1) + 1;
double x = xmin;
double z;
double fontSize = 0.3;
for (int ix = 0; ix < numX; ix++)
{
z = zmin;
for (int iz = 0; iz < numZ; iz++)
{
// Make the bar.
MeshGeometry3D barMesh = new MeshGeometry3D();
Point3D corner = new Point3D(x, ymin, z);
barMesh.AddBox(corner,
D3.XVector(dx),
D3.YVector(YScale * values[ix, iz]),
D3.ZVector(dx));
group.Children.Add(barMesh.MakeModel(barBrushes[ix, iz]));
z += dx + gap;
}
// Display the front label.
const double textWid = 2;
MakeLabel(frontLabels[ix],
new Point3D(x + dx, ymin, z + textWid),
D3.ZVector(-textWid), D3.XVector(-dx),
bgBrushes[ix], fgBrushes[ix], fontSize, ff,
HorizontalAlignment.Left, VerticalAlignment.Center, group);
x += dx + gap;
}
// Display the side labels.
z = zmin + dx;
double xmax = xmin + numX * dx + (numX - 1) * gap;
for (int iz = 0; iz < numZ; iz++)
{
const double textWid = 2;
MakeLabel(sideLabels[iz],
new Point3D(xmax + gap, ymin, z),
D3.XVector(textWid), D3.ZVector(-dx),
Brushes.Transparent, Brushes.Black, fontSize, ff,
HorizontalAlignment.Left, VerticalAlignment.Center, group);
//MakeLabel(sideLabels[iz],
// new Point3D(xmin - textWid - gap, ymin, z),
// D3.XVector(textWid), D3.ZVector(-dx),
// Brushes.Transparent, Brushes.Black, fontSize, ff,
// HorizontalAlignment.Left, VerticalAlignment.Center, group);
z += dx + gap;
}
}
// Make a row of stacked bars in the X direction.
private void MakeStackedBars(double xmin, double ymin,
double zmin, double dx, double gap,
double[,] values, string[] frontLabels,
Brush[] barBrushes, Brush bgBrush, Brush fgBrush,
FontFamily ff, Model3DGroup group)
{
double x = xmin;
int numX = values.GetUpperBound(0) + 1;
int numZ = values.GetUpperBound(1) + 1;
double fontSize = 0.45;
for (int ix = 0; ix < numX; ix++)
{
double y = ymin;
for (int iz = 0; iz < numZ; iz++)
{
// Make this piece of the bar.
MeshGeometry3D barMesh = new MeshGeometry3D();
Point3D corner = new Point3D(x, y, zmin);
barMesh.AddBox(corner,
D3.XVector(dx),
D3.YVector(YScale * values[ix, iz]),
D3.ZVector(dx));
group.Children.Add(barMesh.MakeModel(barBrushes[iz]));
y += YScale * values[ix, iz];
}
// Display the front label.
const double textWid = 1.5;
MakeLabel(frontLabels[ix],
new Point3D(x + dx, ymin, textWid + zmin + dx + gap),
D3.ZVector(-textWid), D3.XVector(-dx),
bgBrush, fgBrush, fontSize, FontFamily,
HorizontalAlignment.Left, VerticalAlignment.Center, group);
x += dx + gap;
}
}
// Make a label.
private void MakeLabel(string text, Point3D ll,
Vector3D vRight, Vector3D vUp,
Brush bgBrush, Brush fgBrush,
double fontSize, FontFamily fontFamily,
HorizontalAlignment hAlign, VerticalAlignment vAlign,
Model3DGroup group)
{
double wid = vRight.Length;
double hgt = vUp.Length;
MeshGeometry3D mesh = new MeshGeometry3D();
group.Children.Add(
mesh.AddSizedText(text,
fontSize, wid, hgt,
ll, ll + vRight, ll + vRight + vUp, ll + vUp,
bgBrush, fgBrush, hAlign, vAlign, fontFamily));
}
// Make pie slices.
private void MakePieSlices(Point3D center, double r, double height,
double[] values, Brush[] brushes, int numPieces, Model3DGroup group)
{
// Calculate percentages.
double total = values.Sum();
int numValues = values.Length;
double[] percents = new double[numValues];
for (int i = 0; i < numValues; i++) percents[i] = values[i] / total;
// Draw slices.
double minTheta = 0;
for (int i = 0; i < numValues; i++)
{
double maxTheta = minTheta + 360.0 * percents[i];
MeshGeometry3D mesh = new MeshGeometry3D();
int slicePieces = (int)(numPieces * percents[i]);
if (slicePieces < 2) slicePieces = 2;
mesh.AddPieSlice(center, height, minTheta, maxTheta,
r, slicePieces);
group.Children.Add(mesh.MakeModel(brushes[i]));
minTheta = maxTheta;
}
}
// Make stacked pie slices.
private void MakeStackedPieSlices(Point3D center, double r, double height,
double[,] values, Brush[,] brushes, int numPieces, Model3DGroup group)
{
// Calculate percentages.
int numLevels = values.GetUpperBound(0) + 1;
int numWedges = values.GetUpperBound(1) + 1;
int numValues = values.Length;
double total = 0;
foreach (double value in values) total += value;
double[,] percents = new double[2, numWedges];
for (int level = 0; level < numLevels; level++)
for (int slice = 0; slice < numWedges; slice++)
percents[level, slice] = values[level, slice] / total;
// Draw slices.
double minTheta = 0;
for (int wedge = 0; wedge < numWedges; wedge++)
{
// Get this wedge's total percent.
double wedgePercent = 0;
for (int level = 0; level < numLevels; level++)
wedgePercent += percents[level, wedge];
// Calculate the size of the wedge in degrees.
double maxTheta = minTheta + 360.0 * wedgePercent;
int wedgePieces = (int)(numPieces * wedgePercent);
if (wedgePieces < 2) wedgePieces = 2;
// Make the slices.
double y = center.Y;
for (int level = 0; level < numLevels; level++)
{
// Calculate the slice's height.
double sliceHgt = height * percents[level, wedge] / wedgePercent;
MeshGeometry3D mesh = new MeshGeometry3D();
Point3D sliceCenter = new Point3D(center.X, y, center.Z);
mesh.AddPieSlice(sliceCenter, sliceHgt,
minTheta, maxTheta, r, wedgePieces);
group.Children.Add(mesh.MakeModel(brushes[level, wedge]));
y += sliceHgt;
}
minTheta = maxTheta;
}
}
// Make ragged pie slices.
private void MakeRaggedPieSlices(Point3D center, double r, double[] values,
double[] heights, Brush[] brushes, int numPieces, Model3DGroup group)
{
// Calculate percentages.
double total = values.Sum();
int numValues = values.Length;
double[] percents = new double[numValues];
for (int i = 0; i < numValues; i++) percents[i] = values[i] / total;
// Draw slices.
double minTheta = 0;
for (int i = 0; i < numValues; i++)
{
double maxTheta = minTheta + 360.0 * percents[i];
MeshGeometry3D mesh = new MeshGeometry3D();
int slicePieces = (int)(numPieces * percents[i]);
if (slicePieces < 2) slicePieces = 2;
mesh.AddPieSlice(center, heights[i], minTheta, maxTheta,
r, slicePieces);
group.Children.Add(mesh.MakeModel(brushes[i]));
minTheta = maxTheta;
}
}
// Load data.
// Source: Made up data.
private double[] LoadData()
{
return new double[] { 32, 27, 15, 16 };
}
private double[] LoadHeights()
{
return new double[] { 2.03, 1.54, 0.71, 1.20 };
}
}
}
| 39.235154 | 91 | 0.49891 | [
"MIT"
] | Macrotitech/WPF-3d-source | Ch34/RaggedPieChart/MainWindow.xaml.cs | 16,518 | C# |
using Maintenance_Helpdesk.Models;
using Microsoft.EntityFrameworkCore;
namespace Maintenance_Helpdesk.DbContexts
{
public class Maintenance_HelpdeskDbContext : DbContext
{
public Maintenance_HelpdeskDbContext(DbContextOptions<Maintenance_HelpdeskDbContext> options)
: base(options)
{
}
public DbSet<Maintenance_HelpdeskModel> Maintenance_Helpdesk { get; set; }
}
} | 28.266667 | 101 | 0.735849 | [
"MIT"
] | andersorlinder/e2e-lab5 | e2e-lab5/Maintenance_Helpdesk/DbContexts/Maintenance_HelpdeskDbContext.cs | 426 | C# |
#if UNITY_EDITOR
using System;
using Samples.Boids;
using Unity.Entities;
using UnityEngine;
[RequiresEntityConversion]
[AddComponentMenu("DOTS Samples/Boids/BoidTarget")]
[ConverterVersion("joe", 1)]
public class BoidTargetAuthoring : MonoBehaviour, IConvertGameObjectToEntity
{
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddComponentData(entity, new BoidTarget());
}
}
#endif
| 23.85 | 109 | 0.786164 | [
"MIT"
] | sapsari/Covid | Assets/Boids/BoidTargetAuthoring.cs | 477 | C# |
using System.Configuration;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using SFB.Web.UI.Attributes;
using SFB.Web.UI.Models;
namespace SFB.Web.UI.Controllers
{
[CustomAuthorize]
public class AccountController : Controller
{
private ApplicationSignInManager _signInManager;
private ApplicationUserManager _userManager;
public AccountController()
{
}
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager )
{
UserManager = userManager;
SignInManager = signInManager;
}
public ApplicationSignInManager SignInManager
{
get
{
return _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>();
}
private set
{
_signInManager = value;
}
}
public ApplicationUserManager UserManager
{
get
{
return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
}
private set
{
_userManager = value;
}
}
//
// GET: /Account/Login
[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
ViewBag.ReturnUrl = returnUrl;
return View();
}
//
// POST: /Account/Login
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
{
if (!ModelState.IsValid)
{
return View(model);
}
if (model.Username == ConfigurationManager.AppSettings["TestUserName"] && model.Password == ConfigurationManager.AppSettings["TestPassword"])
{
var user = new ApplicationUser()
{
UserName = model.Username
};
await SignInManager.SignInAsync(user, model.RememberMe, model.RememberMe);
return RedirectToLocal(returnUrl);
}
else
{
ModelState.AddModelError("", "Invalid login attempt.");
return View(model);
}
}
// POST: /Account/LogOff
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult LogOff()
{
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
return RedirectToAction("Index", "Home");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (_userManager != null)
{
_userManager.Dispose();
_userManager = null;
}
if (_signInManager != null)
{
_signInManager.Dispose();
_signInManager = null;
}
}
base.Dispose(disposing);
}
#region Helpers
// Used for XSRF protection when adding external logins
private const string XsrfKey = "XsrfId";
private IAuthenticationManager AuthenticationManager
{
get
{
return HttpContext.GetOwinContext().Authentication;
}
}
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError("", error);
}
}
private ActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
return RedirectToAction("Index", "Home");
}
#endregion
}
} | 27.230263 | 153 | 0.529355 | [
"MIT"
] | DFEAGILEDEVOPS/Schools.Financial.Benchmarking | Web/SFB.Web.UI/Controllers/AccountController.cs | 4,141 | C# |
using Newtonsoft.Json;
namespace NSW.EliteDangerous.API
{
public class MarketItem : Item
{
[JsonProperty("id")]
public long Id { get; internal set; }
[JsonProperty("Category")]
public string Category { get; internal set; }
[JsonProperty("Category_Localised")]
public string CategoryLocalised { get; internal set; }
[JsonProperty("BuyPrice")]
public long BuyPrice { get; internal set; }
[JsonProperty("SellPrice")]
public long SellPrice { get; internal set; }
[JsonProperty("MeanPrice")]
public long MeanPrice { get; internal set; }
[JsonProperty("StockBracket")]
public long StockBracket { get; internal set; }
[JsonProperty("DemandBracket")]
public long DemandBracket { get; internal set; }
[JsonProperty("Stock")]
public long Stock { get; internal set; }
[JsonProperty("Demand")]
public long Demand { get; internal set; }
[JsonProperty("Consumer")]
public bool Consumer { get; internal set; }
[JsonProperty("Producer")]
public bool Producer { get; internal set; }
[JsonProperty("Rare")]
public bool Rare { get; internal set; }
[JsonProperty("Legality")]
public string Legality { get; internal set; }
}
} | 27.653061 | 62 | 0.60369 | [
"MIT"
] | h0useRus/EliteDangerousAPI | EliteDangerousAPI/src/EliteDangerousAPI/Entities/MarketItem.cs | 1,355 | C# |
using System;
namespace Couchbase.Core.Diagnostics.Tracing
{
/// <summary>
/// A configuration class for tracing.
/// </summary>
public class TracingConfiguration
{
public TimeSpan EmitInterval { get; set; } = TimeSpan.FromSeconds(10);
/// <summary>
/// The interval after which the aggregated trace information is logged.
/// </summary>
/// <remarks>The default is 10 seconds.</remarks>
/// <param name="emitInterval">A <see cref="TimeSpan"/> interval.</param>
/// <returns>A <see cref="TracingConfiguration"/> for chaining.</returns>
public TracingConfiguration WithEmitInterval(TimeSpan emitInterval)
{
EmitInterval = emitInterval;
return this;
}
internal uint SampleSize { get; set; } = 10u;
/// <summary>
/// How many entries to sample per service in each emit interval
/// </summary>
/// <remarks>The default is 10 samples.</remarks>
/// <param name="sampleSize">A <see cref="uint"/> indicating the sample size.</param>
/// <returns>A <see cref="TracingConfiguration"/> for chaining.</returns>
public TracingConfiguration WithSampleSize(uint sampleSize)
{
SampleSize = sampleSize;
return this;
}
internal TimeSpan Threshold { get; set; } = TimeSpan.FromMilliseconds(500);
/// <summary>
/// The interval after which the aggregated trace information is logged.
/// </summary>
/// <remarks>The default is 500 Milliseconds.</remarks>
/// <param name="threshold">A <see cref="TimeSpan"/> interval.</param>
/// <returns>A <see cref="TracingConfiguration"/> for chaining.</returns>
public TracingConfiguration WithThreshold(TimeSpan threshold)
{
Threshold = Threshold;
return this;
}
internal string ServiceName { get; set; }
/// <summary>
/// The service name
/// </summary>
/// <param name="service"></param>
/// <returns></returns>
public TracingConfiguration WithService(string service)
{
ServiceName = service;
return this;
}
}
}
/* ************************************************************
*
* @author Couchbase <info@couchbase.com>
* @copyright 2021 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ************************************************************/
| 35.402299 | 93 | 0.587338 | [
"Apache-2.0"
] | Zeroshi/couchbase-net-client | src/Couchbase/Core/Diagnostics/Tracing/TracingConfiguration.cs | 3,080 | C# |
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/mfidl.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
using NUnit.Framework;
using System;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using static TerraFX.Interop.Windows.IID;
namespace TerraFX.Interop.Windows.UnitTests;
/// <summary>Provides validation of the <see cref="IMFContentDecryptorContext" /> struct.</summary>
[SupportedOSPlatform("windows10.0")]
public static unsafe partial class IMFContentDecryptorContextTests
{
/// <summary>Validates that the <see cref="Guid" /> of the <see cref="IMFContentDecryptorContext" /> struct is correct.</summary>
[Test]
public static void GuidOfTest()
{
Assert.That(typeof(IMFContentDecryptorContext).GUID, Is.EqualTo(IID_IMFContentDecryptorContext));
}
/// <summary>Validates that the <see cref="IMFContentDecryptorContext" /> struct is blittable.</summary>
[Test]
public static void IsBlittableTest()
{
Assert.That(Marshal.SizeOf<IMFContentDecryptorContext>(), Is.EqualTo(sizeof(IMFContentDecryptorContext)));
}
/// <summary>Validates that the <see cref="IMFContentDecryptorContext" /> struct has the right <see cref="LayoutKind" />.</summary>
[Test]
public static void IsLayoutSequentialTest()
{
Assert.That(typeof(IMFContentDecryptorContext).IsLayoutSequential, Is.True);
}
/// <summary>Validates that the <see cref="IMFContentDecryptorContext" /> struct has the correct size.</summary>
[Test]
public static void SizeOfTest()
{
if (Environment.Is64BitProcess)
{
Assert.That(sizeof(IMFContentDecryptorContext), Is.EqualTo(8));
}
else
{
Assert.That(sizeof(IMFContentDecryptorContext), Is.EqualTo(4));
}
}
}
| 37.584906 | 145 | 0.712349 | [
"MIT"
] | reflectronic/terrafx.interop.windows | tests/Interop/Windows/Windows/um/mfidl/IMFContentDecryptorContextTests.cs | 1,994 | C# |
using System;
using System.Collections.Generic;
using Devdog.General.ThirdParty.UniLinq;
using System.Text;
using Devdog.InventoryPro;
using UnityEngine;
namespace Devdog.InventoryPro
{
//[RequireComponent(typeof(LootableObject))]
[AddComponentMenu(InventoryPro.AddComponentMenuPath + "Other/Inventory item percentage container generator")]
public partial class InventoryItemPercentageContainerGenerator : MonoBehaviour, IInventoryItemContainerGenerator
{
public InventoryItemGeneratorItem[] items;
public IInventoryItemContainer container { get; protected set; }
public bool generateAtGameStart = true;
public int minAmountTotal = 2;
public int maxAmountTotal = 5;
public IItemGenerator generator { get; protected set; }
protected void Awake()
{
container = GetComponent<IInventoryItemContainer>();
generator = new PercentageItemGenerator();
// generator.SetItems(ItemManager.database.items); // Not needed, items are serialized as _items
generator.items = items;
if (generateAtGameStart)
{
container.items = generator.Generate(minAmountTotal, maxAmountTotal, true); // Create instances is required to get stack size to work (Can't change stacksize on prefab)
foreach (var item in container.items)
{
item.transform.SetParent(transform);
}
}
}
}
}
| 34.727273 | 184 | 0.663613 | [
"MIT"
] | BradyBromley/Inventory-Pro | Assets/Devdog/InventoryPro/Scripts/Modules/ItemGenerators/InventoryItemPercentageContainerGenerator.cs | 1,530 | C# |
// Copyright 2004-2020 Castle Project - http://www.castleproject.org/
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace Castle.Windsor.Extensions.DependencyInjection.Extensions
{
using System.Reflection;
using Castle.MicroKernel.Registration;
public static class ServiceDescriptorExtensions
{
public static IRegistration CreateWindsorRegistration(this Microsoft.Extensions.DependencyInjection.ServiceDescriptor service)
{
if (service.ServiceType.ContainsGenericParameters)
{
return RegistrationAdapter.FromOpenGenericServiceDescriptor(service);
}
else
{
var method = typeof(RegistrationAdapter).GetMethod("FromServiceDescriptor", BindingFlags.Static | BindingFlags.Public).MakeGenericMethod(service.ServiceType);
return method.Invoke(null, new object[] { service }) as IRegistration;
}
}
}
} | 37.5 | 162 | 0.774815 | [
"Apache-2.0"
] | generik0/Windsor | src/Castle.Windsor.Extensions.DependencyInjection/Extensions/ServiceDescriptorExtensions.cs | 1,350 | C# |
using System.Collections.Generic;
using ApplyIdentity.Infrastructure;
namespace ApplyIdentity.Models
{
public class RoleEditModel
{
public AppRole Role { get; set; }
public IEnumerable<AppUser> Members { get; set; }
public IEnumerable<AppUser> NonMembers { get; set; }
}
} | 22.285714 | 60 | 0.682692 | [
"MIT"
] | sukhoi1/.NET-MVC-ApplyIdentity | ApplyIdentity/Models/RoleEditModel.cs | 314 | 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("EncompassBrowserTab")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EncompassBrowserTab")]
[assembly: AssemblyCopyright("Copyright © AlgoHub, Inc. 2020")]
[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("53bee5ec-c6e7-43f9-b6ec-0366a3a372d7")]
// 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.*")]
| 38.114286 | 84 | 0.754873 | [
"MIT"
] | algohubhq/EncompassBrowserTab | EncompassBrowserTab/Properties/AssemblyInfo.cs | 1,337 | C# |
using System;
using NHapi.Base.Model;
using NHapi.Base.Log;
using NHapi.Base;
using NHapi.Base.Model.Primitive;
namespace NHapi.Model.V25.Datatype
{
///<summary>
/// <p>The HL7 JCC (Job Code/Class) data type. Consists of the following components: </p><ol>
/// <li>Job Code (IS)</li>
/// <li>Job Class (IS)</li>
/// <li>Job Description Text (TX)</li>
/// </ol>
///</summary>
[Serializable]
public class JCC : AbstractType, IComposite{
private IType[] data;
///<summary>
/// Creates a JCC.
/// <param name="message">The Message to which this Type belongs</param>
///</summary>
public JCC(IMessage message) : this(message, null){}
///<summary>
/// Creates a JCC.
/// <param name="message">The Message to which this Type belongs</param>
/// <param name="description">The description of this type</param>
///</summary>
public JCC(IMessage message, string description) : base(message, description){
data = new IType[3];
data[0] = new IS(message, 327,"Job Code");
data[1] = new IS(message, 328,"Job Class");
data[2] = new TX(message,"Job Description Text");
}
///<summary>
/// Returns an array containing the data elements.
///</summary>
public IType[] Components
{
get{
return this.data;
}
}
///<summary>
/// Returns an individual data component.
/// @throws DataTypeException if the given element number is out of range.
///<param name="index">The index item to get (zero based)</param>
///<returns>The data component (as a type) at the requested number (ordinal)</returns>
///</summary>
public IType this[int index] {
get{
try {
return this.data[index];
} catch (System.ArgumentOutOfRangeException) {
throw new DataTypeException("Element " + index + " doesn't exist in 3 element JCC composite");
}
}
}
///<summary>
/// Returns Job Code (component #0). This is a convenience method that saves you from
/// casting and handling an exception.
///</summary>
public IS JobCode {
get{
IS ret = null;
try {
ret = (IS)this[0];
} catch (DataTypeException e) {
HapiLogFactory.GetHapiLog(this.GetType()).Error("Unexpected problem accessing known data type component - this is a bug.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns Job Class (component #1). This is a convenience method that saves you from
/// casting and handling an exception.
///</summary>
public IS JobClass {
get{
IS ret = null;
try {
ret = (IS)this[1];
} catch (DataTypeException e) {
HapiLogFactory.GetHapiLog(this.GetType()).Error("Unexpected problem accessing known data type component - this is a bug.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns Job Description Text (component #2). This is a convenience method that saves you from
/// casting and handling an exception.
///</summary>
public TX JobDescriptionText {
get{
TX ret = null;
try {
ret = (TX)this[2];
} catch (DataTypeException e) {
HapiLogFactory.GetHapiLog(this.GetType()).Error("Unexpected problem accessing known data type component - this is a bug.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
}} | 29.491379 | 134 | 0.639287 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | afaonline/nHapi | src/NHapi.Model.V25/Datatype/JCC.cs | 3,421 | C# |
using System.Collections.Generic;
namespace OpenRpg.Localization
{
public class LocaleDataset
{
public string LocaleCode { get; set; }
public Dictionary<string, string> LocaleData { get; set; } = new Dictionary<string, string>();
}
} | 26.2 | 102 | 0.679389 | [
"MIT"
] | openrpg/OpenRpg | src/OpenRpg.Localization/LocaleDataset.cs | 262 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the mediapackage-vod-2018-11-07.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Net;
using Amazon.MediaPackageVod.Model;
using Amazon.MediaPackageVod.Model.Internal.MarshallTransformations;
using Amazon.MediaPackageVod.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.MediaPackageVod
{
/// <summary>
/// Implementation for accessing MediaPackageVod
///
/// AWS Elemental MediaPackage VOD
/// </summary>
public partial class AmazonMediaPackageVodClient : AmazonServiceClient, IAmazonMediaPackageVod
{
private static IServiceMetadata serviceMetadata = new AmazonMediaPackageVodMetadata();
#region Constructors
/// <summary>
/// Constructs AmazonMediaPackageVodClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
public AmazonMediaPackageVodClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonMediaPackageVodConfig()) { }
/// <summary>
/// Constructs AmazonMediaPackageVodClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="region">The region to connect.</param>
public AmazonMediaPackageVodClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonMediaPackageVodConfig{RegionEndpoint = region}) { }
/// <summary>
/// Constructs AmazonMediaPackageVodClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="config">The AmazonMediaPackageVodClient Configuration Object</param>
public AmazonMediaPackageVodClient(AmazonMediaPackageVodConfig config)
: base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary>
/// Constructs AmazonMediaPackageVodClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
public AmazonMediaPackageVodClient(AWSCredentials credentials)
: this(credentials, new AmazonMediaPackageVodConfig())
{
}
/// <summary>
/// Constructs AmazonMediaPackageVodClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="region">The region to connect.</param>
public AmazonMediaPackageVodClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonMediaPackageVodConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonMediaPackageVodClient with AWS Credentials and an
/// AmazonMediaPackageVodClient Configuration object.
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="clientConfig">The AmazonMediaPackageVodClient Configuration Object</param>
public AmazonMediaPackageVodClient(AWSCredentials credentials, AmazonMediaPackageVodConfig clientConfig)
: base(credentials, clientConfig)
{
}
/// <summary>
/// Constructs AmazonMediaPackageVodClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
public AmazonMediaPackageVodClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonMediaPackageVodConfig())
{
}
/// <summary>
/// Constructs AmazonMediaPackageVodClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="region">The region to connect.</param>
public AmazonMediaPackageVodClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonMediaPackageVodConfig() {RegionEndpoint=region})
{
}
/// <summary>
/// Constructs AmazonMediaPackageVodClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonMediaPackageVodClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="clientConfig">The AmazonMediaPackageVodClient Configuration Object</param>
public AmazonMediaPackageVodClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonMediaPackageVodConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
/// <summary>
/// Constructs AmazonMediaPackageVodClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
public AmazonMediaPackageVodClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonMediaPackageVodConfig())
{
}
/// <summary>
/// Constructs AmazonMediaPackageVodClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="region">The region to connect.</param>
public AmazonMediaPackageVodClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonMediaPackageVodConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonMediaPackageVodClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonMediaPackageVodClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="clientConfig">The AmazonMediaPackageVodClient Configuration Object</param>
public AmazonMediaPackageVodClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonMediaPackageVodConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#region Overrides
/// <summary>
/// Creates the signer for the service.
/// </summary>
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
/// <summary>
/// Capture metadata for the service.
/// </summary>
protected override IServiceMetadata ServiceMetadata
{
get
{
return serviceMetadata;
}
}
#endregion
#region Dispose
/// <summary>
/// Disposes the service client.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region CreateAsset
/// <summary>
/// Creates a new MediaPackage VOD Asset resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateAsset service method.</param>
///
/// <returns>The response from the CreateAsset service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/CreateAsset">REST API Reference for CreateAsset Operation</seealso>
public virtual CreateAssetResponse CreateAsset(CreateAssetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateAssetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateAssetResponseUnmarshaller.Instance;
return Invoke<CreateAssetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateAsset operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateAsset operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateAsset
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/CreateAsset">REST API Reference for CreateAsset Operation</seealso>
public virtual IAsyncResult BeginCreateAsset(CreateAssetRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateAssetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateAssetResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreateAsset operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateAsset.</param>
///
/// <returns>Returns a CreateAssetResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/CreateAsset">REST API Reference for CreateAsset Operation</seealso>
public virtual CreateAssetResponse EndCreateAsset(IAsyncResult asyncResult)
{
return EndInvoke<CreateAssetResponse>(asyncResult);
}
#endregion
#region CreatePackagingConfiguration
/// <summary>
/// Creates a new MediaPackage VOD PackagingConfiguration resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreatePackagingConfiguration service method.</param>
///
/// <returns>The response from the CreatePackagingConfiguration service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/CreatePackagingConfiguration">REST API Reference for CreatePackagingConfiguration Operation</seealso>
public virtual CreatePackagingConfigurationResponse CreatePackagingConfiguration(CreatePackagingConfigurationRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreatePackagingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreatePackagingConfigurationResponseUnmarshaller.Instance;
return Invoke<CreatePackagingConfigurationResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreatePackagingConfiguration operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreatePackagingConfiguration operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreatePackagingConfiguration
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/CreatePackagingConfiguration">REST API Reference for CreatePackagingConfiguration Operation</seealso>
public virtual IAsyncResult BeginCreatePackagingConfiguration(CreatePackagingConfigurationRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreatePackagingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreatePackagingConfigurationResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreatePackagingConfiguration operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreatePackagingConfiguration.</param>
///
/// <returns>Returns a CreatePackagingConfigurationResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/CreatePackagingConfiguration">REST API Reference for CreatePackagingConfiguration Operation</seealso>
public virtual CreatePackagingConfigurationResponse EndCreatePackagingConfiguration(IAsyncResult asyncResult)
{
return EndInvoke<CreatePackagingConfigurationResponse>(asyncResult);
}
#endregion
#region CreatePackagingGroup
/// <summary>
/// Creates a new MediaPackage VOD PackagingGroup resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreatePackagingGroup service method.</param>
///
/// <returns>The response from the CreatePackagingGroup service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/CreatePackagingGroup">REST API Reference for CreatePackagingGroup Operation</seealso>
public virtual CreatePackagingGroupResponse CreatePackagingGroup(CreatePackagingGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreatePackagingGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreatePackagingGroupResponseUnmarshaller.Instance;
return Invoke<CreatePackagingGroupResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreatePackagingGroup operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreatePackagingGroup operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreatePackagingGroup
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/CreatePackagingGroup">REST API Reference for CreatePackagingGroup Operation</seealso>
public virtual IAsyncResult BeginCreatePackagingGroup(CreatePackagingGroupRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreatePackagingGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreatePackagingGroupResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreatePackagingGroup operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreatePackagingGroup.</param>
///
/// <returns>Returns a CreatePackagingGroupResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/CreatePackagingGroup">REST API Reference for CreatePackagingGroup Operation</seealso>
public virtual CreatePackagingGroupResponse EndCreatePackagingGroup(IAsyncResult asyncResult)
{
return EndInvoke<CreatePackagingGroupResponse>(asyncResult);
}
#endregion
#region DeleteAsset
/// <summary>
/// Deletes an existing MediaPackage VOD Asset resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteAsset service method.</param>
///
/// <returns>The response from the DeleteAsset service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DeleteAsset">REST API Reference for DeleteAsset Operation</seealso>
public virtual DeleteAssetResponse DeleteAsset(DeleteAssetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteAssetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteAssetResponseUnmarshaller.Instance;
return Invoke<DeleteAssetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteAsset operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteAsset operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteAsset
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DeleteAsset">REST API Reference for DeleteAsset Operation</seealso>
public virtual IAsyncResult BeginDeleteAsset(DeleteAssetRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteAssetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteAssetResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteAsset operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteAsset.</param>
///
/// <returns>Returns a DeleteAssetResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DeleteAsset">REST API Reference for DeleteAsset Operation</seealso>
public virtual DeleteAssetResponse EndDeleteAsset(IAsyncResult asyncResult)
{
return EndInvoke<DeleteAssetResponse>(asyncResult);
}
#endregion
#region DeletePackagingConfiguration
/// <summary>
/// Deletes a MediaPackage VOD PackagingConfiguration resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeletePackagingConfiguration service method.</param>
///
/// <returns>The response from the DeletePackagingConfiguration service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DeletePackagingConfiguration">REST API Reference for DeletePackagingConfiguration Operation</seealso>
public virtual DeletePackagingConfigurationResponse DeletePackagingConfiguration(DeletePackagingConfigurationRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeletePackagingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeletePackagingConfigurationResponseUnmarshaller.Instance;
return Invoke<DeletePackagingConfigurationResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeletePackagingConfiguration operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeletePackagingConfiguration operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeletePackagingConfiguration
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DeletePackagingConfiguration">REST API Reference for DeletePackagingConfiguration Operation</seealso>
public virtual IAsyncResult BeginDeletePackagingConfiguration(DeletePackagingConfigurationRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeletePackagingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeletePackagingConfigurationResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeletePackagingConfiguration operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeletePackagingConfiguration.</param>
///
/// <returns>Returns a DeletePackagingConfigurationResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DeletePackagingConfiguration">REST API Reference for DeletePackagingConfiguration Operation</seealso>
public virtual DeletePackagingConfigurationResponse EndDeletePackagingConfiguration(IAsyncResult asyncResult)
{
return EndInvoke<DeletePackagingConfigurationResponse>(asyncResult);
}
#endregion
#region DeletePackagingGroup
/// <summary>
/// Deletes a MediaPackage VOD PackagingGroup resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeletePackagingGroup service method.</param>
///
/// <returns>The response from the DeletePackagingGroup service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DeletePackagingGroup">REST API Reference for DeletePackagingGroup Operation</seealso>
public virtual DeletePackagingGroupResponse DeletePackagingGroup(DeletePackagingGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeletePackagingGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeletePackagingGroupResponseUnmarshaller.Instance;
return Invoke<DeletePackagingGroupResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeletePackagingGroup operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeletePackagingGroup operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeletePackagingGroup
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DeletePackagingGroup">REST API Reference for DeletePackagingGroup Operation</seealso>
public virtual IAsyncResult BeginDeletePackagingGroup(DeletePackagingGroupRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeletePackagingGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeletePackagingGroupResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeletePackagingGroup operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeletePackagingGroup.</param>
///
/// <returns>Returns a DeletePackagingGroupResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DeletePackagingGroup">REST API Reference for DeletePackagingGroup Operation</seealso>
public virtual DeletePackagingGroupResponse EndDeletePackagingGroup(IAsyncResult asyncResult)
{
return EndInvoke<DeletePackagingGroupResponse>(asyncResult);
}
#endregion
#region DescribeAsset
/// <summary>
/// Returns a description of a MediaPackage VOD Asset resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeAsset service method.</param>
///
/// <returns>The response from the DescribeAsset service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DescribeAsset">REST API Reference for DescribeAsset Operation</seealso>
public virtual DescribeAssetResponse DescribeAsset(DescribeAssetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeAssetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeAssetResponseUnmarshaller.Instance;
return Invoke<DescribeAssetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeAsset operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeAsset operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeAsset
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DescribeAsset">REST API Reference for DescribeAsset Operation</seealso>
public virtual IAsyncResult BeginDescribeAsset(DescribeAssetRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeAssetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeAssetResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeAsset operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeAsset.</param>
///
/// <returns>Returns a DescribeAssetResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DescribeAsset">REST API Reference for DescribeAsset Operation</seealso>
public virtual DescribeAssetResponse EndDescribeAsset(IAsyncResult asyncResult)
{
return EndInvoke<DescribeAssetResponse>(asyncResult);
}
#endregion
#region DescribePackagingConfiguration
/// <summary>
/// Returns a description of a MediaPackage VOD PackagingConfiguration resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribePackagingConfiguration service method.</param>
///
/// <returns>The response from the DescribePackagingConfiguration service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DescribePackagingConfiguration">REST API Reference for DescribePackagingConfiguration Operation</seealso>
public virtual DescribePackagingConfigurationResponse DescribePackagingConfiguration(DescribePackagingConfigurationRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribePackagingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribePackagingConfigurationResponseUnmarshaller.Instance;
return Invoke<DescribePackagingConfigurationResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribePackagingConfiguration operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribePackagingConfiguration operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribePackagingConfiguration
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DescribePackagingConfiguration">REST API Reference for DescribePackagingConfiguration Operation</seealso>
public virtual IAsyncResult BeginDescribePackagingConfiguration(DescribePackagingConfigurationRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribePackagingConfigurationRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribePackagingConfigurationResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribePackagingConfiguration operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribePackagingConfiguration.</param>
///
/// <returns>Returns a DescribePackagingConfigurationResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DescribePackagingConfiguration">REST API Reference for DescribePackagingConfiguration Operation</seealso>
public virtual DescribePackagingConfigurationResponse EndDescribePackagingConfiguration(IAsyncResult asyncResult)
{
return EndInvoke<DescribePackagingConfigurationResponse>(asyncResult);
}
#endregion
#region DescribePackagingGroup
/// <summary>
/// Returns a description of a MediaPackage VOD PackagingGroup resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribePackagingGroup service method.</param>
///
/// <returns>The response from the DescribePackagingGroup service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DescribePackagingGroup">REST API Reference for DescribePackagingGroup Operation</seealso>
public virtual DescribePackagingGroupResponse DescribePackagingGroup(DescribePackagingGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribePackagingGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribePackagingGroupResponseUnmarshaller.Instance;
return Invoke<DescribePackagingGroupResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribePackagingGroup operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribePackagingGroup operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribePackagingGroup
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DescribePackagingGroup">REST API Reference for DescribePackagingGroup Operation</seealso>
public virtual IAsyncResult BeginDescribePackagingGroup(DescribePackagingGroupRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribePackagingGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribePackagingGroupResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribePackagingGroup operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribePackagingGroup.</param>
///
/// <returns>Returns a DescribePackagingGroupResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/DescribePackagingGroup">REST API Reference for DescribePackagingGroup Operation</seealso>
public virtual DescribePackagingGroupResponse EndDescribePackagingGroup(IAsyncResult asyncResult)
{
return EndInvoke<DescribePackagingGroupResponse>(asyncResult);
}
#endregion
#region ListAssets
/// <summary>
/// Returns a collection of MediaPackage VOD Asset resources.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListAssets service method.</param>
///
/// <returns>The response from the ListAssets service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListAssets">REST API Reference for ListAssets Operation</seealso>
public virtual ListAssetsResponse ListAssets(ListAssetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListAssetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListAssetsResponseUnmarshaller.Instance;
return Invoke<ListAssetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListAssets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListAssets operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListAssets
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListAssets">REST API Reference for ListAssets Operation</seealso>
public virtual IAsyncResult BeginListAssets(ListAssetsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListAssetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListAssetsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListAssets operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListAssets.</param>
///
/// <returns>Returns a ListAssetsResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListAssets">REST API Reference for ListAssets Operation</seealso>
public virtual ListAssetsResponse EndListAssets(IAsyncResult asyncResult)
{
return EndInvoke<ListAssetsResponse>(asyncResult);
}
#endregion
#region ListPackagingConfigurations
/// <summary>
/// Returns a collection of MediaPackage VOD PackagingConfiguration resources.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListPackagingConfigurations service method.</param>
///
/// <returns>The response from the ListPackagingConfigurations service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListPackagingConfigurations">REST API Reference for ListPackagingConfigurations Operation</seealso>
public virtual ListPackagingConfigurationsResponse ListPackagingConfigurations(ListPackagingConfigurationsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListPackagingConfigurationsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListPackagingConfigurationsResponseUnmarshaller.Instance;
return Invoke<ListPackagingConfigurationsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListPackagingConfigurations operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListPackagingConfigurations operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListPackagingConfigurations
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListPackagingConfigurations">REST API Reference for ListPackagingConfigurations Operation</seealso>
public virtual IAsyncResult BeginListPackagingConfigurations(ListPackagingConfigurationsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListPackagingConfigurationsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListPackagingConfigurationsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListPackagingConfigurations operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListPackagingConfigurations.</param>
///
/// <returns>Returns a ListPackagingConfigurationsResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListPackagingConfigurations">REST API Reference for ListPackagingConfigurations Operation</seealso>
public virtual ListPackagingConfigurationsResponse EndListPackagingConfigurations(IAsyncResult asyncResult)
{
return EndInvoke<ListPackagingConfigurationsResponse>(asyncResult);
}
#endregion
#region ListPackagingGroups
/// <summary>
/// Returns a collection of MediaPackage VOD PackagingGroup resources.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListPackagingGroups service method.</param>
///
/// <returns>The response from the ListPackagingGroups service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListPackagingGroups">REST API Reference for ListPackagingGroups Operation</seealso>
public virtual ListPackagingGroupsResponse ListPackagingGroups(ListPackagingGroupsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListPackagingGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListPackagingGroupsResponseUnmarshaller.Instance;
return Invoke<ListPackagingGroupsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListPackagingGroups operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListPackagingGroups operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListPackagingGroups
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListPackagingGroups">REST API Reference for ListPackagingGroups Operation</seealso>
public virtual IAsyncResult BeginListPackagingGroups(ListPackagingGroupsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListPackagingGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListPackagingGroupsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListPackagingGroups operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListPackagingGroups.</param>
///
/// <returns>Returns a ListPackagingGroupsResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListPackagingGroups">REST API Reference for ListPackagingGroups Operation</seealso>
public virtual ListPackagingGroupsResponse EndListPackagingGroups(IAsyncResult asyncResult)
{
return EndInvoke<ListPackagingGroupsResponse>(asyncResult);
}
#endregion
#region ListTagsForResource
/// <summary>
/// Returns a list of the tags assigned to the specified resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource service method.</param>
///
/// <returns>The response from the ListTagsForResource service method, as returned by MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual ListTagsForResourceResponse ListTagsForResource(ListTagsForResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return Invoke<ListTagsForResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListTagsForResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListTagsForResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual IAsyncResult BeginListTagsForResource(ListTagsForResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListTagsForResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListTagsForResource.</param>
///
/// <returns>Returns a ListTagsForResourceResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual ListTagsForResourceResponse EndListTagsForResource(IAsyncResult asyncResult)
{
return EndInvoke<ListTagsForResourceResponse>(asyncResult);
}
#endregion
#region TagResource
/// <summary>
/// Adds tags to the specified resource. You can specify one or more tags to add.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the TagResource service method.</param>
///
/// <returns>The response from the TagResource service method, as returned by MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual TagResourceResponse TagResource(TagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return Invoke<TagResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the TagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the TagResource operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndTagResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual IAsyncResult BeginTagResource(TagResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the TagResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginTagResource.</param>
///
/// <returns>Returns a TagResourceResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual TagResourceResponse EndTagResource(IAsyncResult asyncResult)
{
return EndInvoke<TagResourceResponse>(asyncResult);
}
#endregion
#region UntagResource
/// <summary>
/// Removes tags from the specified resource. You can specify one or more tags to remove.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UntagResource service method.</param>
///
/// <returns>The response from the UntagResource service method, as returned by MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual UntagResourceResponse UntagResource(UntagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return Invoke<UntagResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UntagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UntagResource operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUntagResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual IAsyncResult BeginUntagResource(UntagResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UntagResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUntagResource.</param>
///
/// <returns>Returns a UntagResourceResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual UntagResourceResponse EndUntagResource(IAsyncResult asyncResult)
{
return EndInvoke<UntagResourceResponse>(asyncResult);
}
#endregion
#region UpdatePackagingGroup
/// <summary>
/// Updates a specific packaging group. You can't change the id attribute or any other
/// system-generated attributes.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdatePackagingGroup service method.</param>
///
/// <returns>The response from the UpdatePackagingGroup service method, as returned by MediaPackageVod.</returns>
/// <exception cref="Amazon.MediaPackageVod.Model.ForbiddenException">
/// The client is not authorized to access the requested resource.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.InternalServerErrorException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.NotFoundException">
/// The requested resource does not exist.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.ServiceUnavailableException">
/// An unexpected error occurred.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.TooManyRequestsException">
/// The client has exceeded their resource or throttling limits.
/// </exception>
/// <exception cref="Amazon.MediaPackageVod.Model.UnprocessableEntityException">
/// The parameters sent in the request are not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/UpdatePackagingGroup">REST API Reference for UpdatePackagingGroup Operation</seealso>
public virtual UpdatePackagingGroupResponse UpdatePackagingGroup(UpdatePackagingGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdatePackagingGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdatePackagingGroupResponseUnmarshaller.Instance;
return Invoke<UpdatePackagingGroupResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdatePackagingGroup operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdatePackagingGroup operation on AmazonMediaPackageVodClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdatePackagingGroup
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/UpdatePackagingGroup">REST API Reference for UpdatePackagingGroup Operation</seealso>
public virtual IAsyncResult BeginUpdatePackagingGroup(UpdatePackagingGroupRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdatePackagingGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdatePackagingGroupResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdatePackagingGroup operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdatePackagingGroup.</param>
///
/// <returns>Returns a UpdatePackagingGroupResult from MediaPackageVod.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediapackage-vod-2018-11-07/UpdatePackagingGroup">REST API Reference for UpdatePackagingGroup Operation</seealso>
public virtual UpdatePackagingGroupResponse EndUpdatePackagingGroup(IAsyncResult asyncResult)
{
return EndInvoke<UpdatePackagingGroupResponse>(asyncResult);
}
#endregion
}
} | 56.247199 | 199 | 0.682533 | [
"Apache-2.0"
] | JeffAshton/aws-sdk-net | sdk/src/Services/MediaPackageVod/Generated/_bcl35/AmazonMediaPackageVodClient.cs | 75,315 | C# |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using Dasync.Collections;
using GraphQLDotNet.Contracts;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
namespace GraphQLDotNet.Services.OpenWeather
{
public class CachedOpenWeatherClient : IOpenWeatherClient
{
private readonly OpenWeatherConfiguration openWeatherConfiguration;
private readonly HttpClient httpClient;
private readonly IMemoryCache memoryCache;
private readonly ILogger<CachedOpenWeatherClient> logger;
private readonly Lazy<WeatherLocation[]> availableLocations;
public CachedOpenWeatherClient(OpenWeatherConfiguration openWeatherConfiguration,
HttpClient httpClient,
IMemoryCache memoryCache,
ILogger<CachedOpenWeatherClient> logger)
{
this.openWeatherConfiguration = openWeatherConfiguration;
this.httpClient = httpClient;
this.memoryCache = memoryCache;
this.logger = logger;
availableLocations = new Lazy<WeatherLocation[]>(ReadAllLocationsFromDisc);
}
public async Task<WeatherForecast> GetWeatherFor(long id)
{
if (id <= 0)
{
throw new ArgumentException("Specify a valid location id.", nameof(id));
}
return await GetOrSet(id,
GetWeather,
new MemoryCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(10) });
async Task<WeatherForecast> GetWeather()
{
var url = string.Format(openWeatherConfiguration.OpenWeatherURL, id);
var openWeatherForecast = await httpClient.GetAsync<Forecast>(url);
var weather = openWeatherForecast.Weather.First();
var weatherForecast = new WeatherForecast(
openWeatherForecast.Id,
openWeatherForecast.Name,
DateTimeOffset.FromUnixTimeSeconds(openWeatherForecast.Dt).UtcDateTime,
Math.Round(openWeatherForecast.Main.Temp, 1),
weather.Icon,
weather.Main,
weather.Description,
Math.Round(openWeatherForecast.Main.TempMin, 1),
Math.Round(openWeatherForecast.Main.TempMax, 1),
openWeatherForecast.Main.Pressure,
openWeatherForecast.Main.Humidity,
DateTimeOffset.FromUnixTimeSeconds(openWeatherForecast.Sys.Sunrise).UtcDateTime,
DateTimeOffset.FromUnixTimeSeconds(openWeatherForecast.Sys.Sunset).UtcDateTime,
openWeatherForecast.Wind.Speed,
openWeatherForecast.Wind.Deg,
openWeatherForecast.Visibility,
openWeatherForecast.Timezone,
openWeatherForecast.Clouds.All);
return weatherForecast;
}
}
public async Task<IEnumerable<WeatherSummary>> GetWeatherSummaryFor(long[] ids)
{
if (ids == null || ids.Length == 0)
{
throw new ArgumentException("Specify at least one location id", nameof(ids));
}
if (ids.Length == 1)
{
return new [] { await GetWeatherSummaryFor(ids[0]) };
}
var results = new ConcurrentBag<WeatherSummary>();
await ids.ParallelForEachAsync(async id =>
{
var weatherSummary = await GetWeatherSummaryFor(id);
results.Add(weatherSummary);
}, 0);
return results;
async Task<WeatherSummary> GetWeatherSummaryFor(long id)
{
if (id <= 0)
{
throw new ArgumentException("Specify a valid location id.", nameof(id));
}
return await GetOrSet(id,
GetWeatherSummary,
new MemoryCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(10) });
async Task<WeatherSummary> GetWeatherSummary()
{
var url = string.Format(openWeatherConfiguration.OpenWeatherURL, id);
var openWeatherForecast = await httpClient.GetAsync<Forecast>(url);
var weather = openWeatherForecast.Weather.First();
var weatherSummary = new WeatherSummary(openWeatherForecast.Name,
Math.Round(openWeatherForecast.Main.Temp, 1),
weather.Icon,
openWeatherForecast.Id,
DateTimeOffset.FromUnixTimeSeconds(openWeatherForecast.Dt).UtcDateTime,
openWeatherForecast.Timezone,
openWeatherForecast.Clouds.All);
return weatherSummary;
}
}
}
public IEnumerable<WeatherLocation> GetLocations(string searchTerms, int maxResults)
{
return GetOrSet(searchTerms + maxResults,
GetLocations,
new MemoryCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromDays(1) });
IEnumerable<WeatherLocation> GetLocations()
{
if (maxResults <= 0)
{
maxResults = IOpenWeatherClient.MaxNumberOfResults;
}
if (string.IsNullOrEmpty(searchTerms))
{
return availableLocations.Value.Take(maxResults);
}
var nameAndCountry = searchTerms.Split(',');
if (nameAndCountry.Length > 1)
{
var matchingLocations = availableLocations.Value
.Where(l => l.Name.StartsWith(nameAndCountry[0].Trim(), StringComparison.InvariantCultureIgnoreCase)
&& l.Country.StartsWith(nameAndCountry[1].Trim(), StringComparison.InvariantCultureIgnoreCase))
.Take(maxResults);
return matchingLocations;
}
return availableLocations.Value
.Where(l => l.Name.StartsWith(searchTerms.Trim(), StringComparison.InvariantCultureIgnoreCase))
.Take(maxResults);
}
}
private WeatherLocation[] ReadAllLocationsFromDisc()
{
using var cities = File.OpenRead(openWeatherConfiguration.CitiesFile);
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
var locations = JsonSerializer.DeserializeAsync<Location[]>(cities, options).GetAwaiter().GetResult();
return locations
.OrderBy(location => location.Name)
.Select(location => new WeatherLocation(location.Id, location.Name, location.Country, location.Coord.Lat, location.Coord.Lon)).ToArray();
}
private async Task<T> GetOrSet<T>(object key, Func<Task<T>> create, MemoryCacheEntryOptions options)
{
if (!memoryCache.TryGetValue(key, out T result))
{
logger.LogInformation($"Cache miss for {key}");
result = await create();
memoryCache.Set(key, result, options);
}
return result;
}
private T GetOrSet<T>(object key, Func<T> create, MemoryCacheEntryOptions options)
{
if (!memoryCache.TryGetValue(key, out T result))
{
logger.LogInformation($"Cache miss for {key}");
result = create();
memoryCache.Set(key, result, options);
}
return result;
}
}
}
| 41.57513 | 153 | 0.580508 | [
"MIT"
] | Sankra/GraphQLDotNet | src/API/GraphQLDotNet.Services/OpenWeather/CachedOpenWeatherClient.cs | 8,026 | C# |
#if WITH_GAME
#if PLATFORM_32BITS
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace UnrealEngine
{
public partial class UMaterialExpressionSetMaterialAttributes
{
static readonly int Inputs__Offset;
public TStructArray<FExpressionInput> Inputs
{
get{ CheckIsValid();return new TStructArray<FExpressionInput>((FScriptArray)Marshal.PtrToStructure(_this.Get()+Inputs__Offset, typeof(FScriptArray)));}
set{ CheckIsValid();Marshal.StructureToPtr(value.InterArray, _this.Get()+Inputs__Offset, false);}
}
static readonly int AttributeSetTypes__Offset;
public TStructArray<FGuid> AttributeSetTypes
{
get{ CheckIsValid();return new TStructArray<FGuid>((FScriptArray)Marshal.PtrToStructure(_this.Get()+AttributeSetTypes__Offset, typeof(FScriptArray)));}
set{ CheckIsValid();Marshal.StructureToPtr(value.InterArray, _this.Get()+AttributeSetTypes__Offset, false);}
}
static UMaterialExpressionSetMaterialAttributes()
{
IntPtr NativeClassPtr=GetNativeClassFromName("MaterialExpressionSetMaterialAttributes");
Inputs__Offset=GetPropertyOffset(NativeClassPtr,"Inputs");
AttributeSetTypes__Offset=GetPropertyOffset(NativeClassPtr,"AttributeSetTypes");
}
}
}
#endif
#endif
| 32.820513 | 154 | 0.79375 | [
"MIT"
] | RobertAcksel/UnrealCS | Engine/Plugins/UnrealCS/UECSharpDomain/UnrealEngine/GeneratedScriptFile_Game_32bits/UMaterialExpressionSetMaterialAttributes_FixSize.cs | 1,280 | C# |
using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace Parallax.Droid
{
[Activity (Label = "Parallax.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
global::Xamarin.Forms.Forms.Init (this, bundle);
LoadApplication (new App ());
}
}
}
| 23.444444 | 161 | 0.755134 | [
"MIT"
] | Mahtaran/xamarin-forms-samples | Parallax/Droid/MainActivity.cs | 635 | C# |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using ClearHl7.Extensions;
using ClearHl7.Helpers;
using ClearHl7.Serialization;
using ClearHl7.V282.Types;
namespace ClearHl7.V282.Segments
{
/// <summary>
/// HL7 Version 2 Segment RXE - Pharmacy Treatment Encoded Order.
/// </summary>
public class RxeSegment : ISegment
{
/// <inheritdoc/>
public string Id { get; } = "RXE";
/// <inheritdoc/>
public int Ordinal { get; set; }
/// <summary>
/// RXE.1 - Quantity/Timing.
/// </summary>
public string QuantityTiming { get; set; }
/// <summary>
/// RXE.2 - Give Code.
/// <para>Suggested: 0292 Vaccines Administered -> ClearHl7.Codes.V282.CodeVaccinesAdministered</para>
/// </summary>
public CodedWithExceptions GiveCode { get; set; }
/// <summary>
/// RXE.3 - Give Amount - Minimum.
/// </summary>
public decimal? GiveAmountMinimum { get; set; }
/// <summary>
/// RXE.4 - Give Amount - Maximum.
/// </summary>
public decimal? GiveAmountMaximum { get; set; }
/// <summary>
/// RXE.5 - Give Units.
/// </summary>
public CodedWithExceptions GiveUnits { get; set; }
/// <summary>
/// RXE.6 - Give Dosage Form.
/// </summary>
public CodedWithExceptions GiveDosageForm { get; set; }
/// <summary>
/// RXE.7 - Provider's Administration Instructions.
/// </summary>
public IEnumerable<CodedWithExceptions> ProvidersAdministrationInstructions { get; set; }
/// <summary>
/// RXE.8 - Deliver-To Location.
/// </summary>
public string DeliverToLocation { get; set; }
/// <summary>
/// RXE.9 - Substitution Status.
/// <para>Suggested: 0167 Substitution Status -> ClearHl7.Codes.V282.CodeSubstitutionStatus</para>
/// </summary>
public string SubstitutionStatus { get; set; }
/// <summary>
/// RXE.10 - Dispense Amount.
/// </summary>
public decimal? DispenseAmount { get; set; }
/// <summary>
/// RXE.11 - Dispense Units.
/// </summary>
public CodedWithExceptions DispenseUnits { get; set; }
/// <summary>
/// RXE.12 - Number Of Refills.
/// </summary>
public decimal? NumberOfRefills { get; set; }
/// <summary>
/// RXE.13 - Ordering Provider's DEA Number.
/// </summary>
public IEnumerable<ExtendedCompositeIdNumberAndNameForPersons> OrderingProvidersDeaNumber { get; set; }
/// <summary>
/// RXE.14 - Pharmacist/Treatment Supplier's Verifier ID.
/// </summary>
public IEnumerable<ExtendedCompositeIdNumberAndNameForPersons> PharmacistTreatmentSuppliersVerifierId { get; set; }
/// <summary>
/// RXE.15 - Prescription Number.
/// </summary>
public string PrescriptionNumber { get; set; }
/// <summary>
/// RXE.16 - Number of Refills Remaining.
/// </summary>
public decimal? NumberOfRefillsRemaining { get; set; }
/// <summary>
/// RXE.17 - Number of Refills/Doses Dispensed.
/// </summary>
public decimal? NumberOfRefillsDosesDispensed { get; set; }
/// <summary>
/// RXE.18 - D/T of Most Recent Refill or Dose Dispensed.
/// </summary>
public DateTime? DateTimeOfMostRecentRefillOrDoseDispensed { get; set; }
/// <summary>
/// RXE.19 - Total Daily Dose.
/// </summary>
public CompositeQuantityWithUnits TotalDailyDose { get; set; }
/// <summary>
/// RXE.20 - Needs Human Review.
/// <para>Suggested: 0136 Yes/No Indicator -> ClearHl7.Codes.V282.CodeYesNoIndicator</para>
/// </summary>
public string NeedsHumanReview { get; set; }
/// <summary>
/// RXE.21 - Special Dispensing Instructions.
/// </summary>
public IEnumerable<CodedWithExceptions> SpecialDispensingInstructions { get; set; }
/// <summary>
/// RXE.22 - Give Per (Time Unit).
/// </summary>
public string GivePerTimeUnit { get; set; }
/// <summary>
/// RXE.23 - Give Rate Amount.
/// </summary>
public string GiveRateAmount { get; set; }
/// <summary>
/// RXE.24 - Give Rate Units.
/// </summary>
public CodedWithExceptions GiveRateUnits { get; set; }
/// <summary>
/// RXE.25 - Give Strength.
/// </summary>
public decimal? GiveStrength { get; set; }
/// <summary>
/// RXE.26 - Give Strength Units.
/// </summary>
public CodedWithExceptions GiveStrengthUnits { get; set; }
/// <summary>
/// RXE.27 - Give Indication.
/// </summary>
public IEnumerable<CodedWithExceptions> GiveIndication { get; set; }
/// <summary>
/// RXE.28 - Dispense Package Size.
/// </summary>
public decimal? DispensePackageSize { get; set; }
/// <summary>
/// RXE.29 - Dispense Package Size Unit.
/// </summary>
public CodedWithExceptions DispensePackageSizeUnit { get; set; }
/// <summary>
/// RXE.30 - Dispense Package Method.
/// <para>Suggested: 0321 Dispense Method -> ClearHl7.Codes.V282.CodeDispenseMethod</para>
/// </summary>
public string DispensePackageMethod { get; set; }
/// <summary>
/// RXE.31 - Supplementary Code.
/// </summary>
public IEnumerable<CodedWithExceptions> SupplementaryCode { get; set; }
/// <summary>
/// RXE.32 - Original Order Date/Time.
/// </summary>
public DateTime? OriginalOrderDateTime { get; set; }
/// <summary>
/// RXE.33 - Give Drug Strength Volume.
/// </summary>
public decimal? GiveDrugStrengthVolume { get; set; }
/// <summary>
/// RXE.34 - Give Drug Strength Volume Units.
/// </summary>
public CodedWithExceptions GiveDrugStrengthVolumeUnits { get; set; }
/// <summary>
/// RXE.35 - Controlled Substance Schedule.
/// <para>Suggested: 0477 Controlled Substance Schedule -> ClearHl7.Codes.V282.CodeControlledSubstanceSchedule</para>
/// </summary>
public CodedWithExceptions ControlledSubstanceSchedule { get; set; }
/// <summary>
/// RXE.36 - Formulary Status.
/// <para>Suggested: 0478 Formulary Status -> ClearHl7.Codes.V282.CodeFormularyStatus</para>
/// </summary>
public string FormularyStatus { get; set; }
/// <summary>
/// RXE.37 - Pharmaceutical Substance Alternative.
/// </summary>
public IEnumerable<CodedWithExceptions> PharmaceuticalSubstanceAlternative { get; set; }
/// <summary>
/// RXE.38 - Pharmacy of Most Recent Fill.
/// </summary>
public CodedWithExceptions PharmacyOfMostRecentFill { get; set; }
/// <summary>
/// RXE.39 - Initial Dispense Amount.
/// </summary>
public decimal? InitialDispenseAmount { get; set; }
/// <summary>
/// RXE.40 - Dispensing Pharmacy.
/// </summary>
public CodedWithExceptions DispensingPharmacy { get; set; }
/// <summary>
/// RXE.41 - Dispensing Pharmacy Address.
/// </summary>
public ExtendedAddress DispensingPharmacyAddress { get; set; }
/// <summary>
/// RXE.42 - Deliver-to Patient Location.
/// </summary>
public PersonLocation DeliverToPatientLocation { get; set; }
/// <summary>
/// RXE.43 - Deliver-to Address.
/// </summary>
public ExtendedAddress DeliverToAddress { get; set; }
/// <summary>
/// RXE.44 - Pharmacy Order Type.
/// <para>Suggested: 0480 Pharmacy Order Types -> ClearHl7.Codes.V282.CodePharmacyOrderTypes</para>
/// </summary>
public string PharmacyOrderType { get; set; }
/// <summary>
/// RXE.45 - Pharmacy Phone Number.
/// </summary>
public IEnumerable<ExtendedTelecommunicationNumber> PharmacyPhoneNumber { get; set; }
/// <inheritdoc/>
public void FromDelimitedString(string delimitedString)
{
FromDelimitedString(delimitedString, null);
}
/// <inheritdoc/>
public void FromDelimitedString(string delimitedString, Separators separators)
{
Separators seps = separators ?? new Separators().UsingConfigurationValues();
string[] segments = delimitedString == null
? Array.Empty<string>()
: delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None);
if (segments.Length > 0)
{
if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0)
{
throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString));
}
}
QuantityTiming = segments.Length > 1 && segments[1].Length > 0 ? segments[1] : null;
GiveCode = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[2], false, seps) : null;
GiveAmountMinimum = segments.Length > 3 && segments[3].Length > 0 ? segments[3].ToNullableDecimal() : null;
GiveAmountMaximum = segments.Length > 4 && segments[4].Length > 0 ? segments[4].ToNullableDecimal() : null;
GiveUnits = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[5], false, seps) : null;
GiveDosageForm = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[6], false, seps) : null;
ProvidersAdministrationInstructions = segments.Length > 7 && segments[7].Length > 0 ? segments[7].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize<CodedWithExceptions>(x, false, seps)) : null;
DeliverToLocation = segments.Length > 8 && segments[8].Length > 0 ? segments[8] : null;
SubstitutionStatus = segments.Length > 9 && segments[9].Length > 0 ? segments[9] : null;
DispenseAmount = segments.Length > 10 && segments[10].Length > 0 ? segments[10].ToNullableDecimal() : null;
DispenseUnits = segments.Length > 11 && segments[11].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[11], false, seps) : null;
NumberOfRefills = segments.Length > 12 && segments[12].Length > 0 ? segments[12].ToNullableDecimal() : null;
OrderingProvidersDeaNumber = segments.Length > 13 && segments[13].Length > 0 ? segments[13].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize<ExtendedCompositeIdNumberAndNameForPersons>(x, false, seps)) : null;
PharmacistTreatmentSuppliersVerifierId = segments.Length > 14 && segments[14].Length > 0 ? segments[14].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize<ExtendedCompositeIdNumberAndNameForPersons>(x, false, seps)) : null;
PrescriptionNumber = segments.Length > 15 && segments[15].Length > 0 ? segments[15] : null;
NumberOfRefillsRemaining = segments.Length > 16 && segments[16].Length > 0 ? segments[16].ToNullableDecimal() : null;
NumberOfRefillsDosesDispensed = segments.Length > 17 && segments[17].Length > 0 ? segments[17].ToNullableDecimal() : null;
DateTimeOfMostRecentRefillOrDoseDispensed = segments.Length > 18 && segments[18].Length > 0 ? segments[18].ToNullableDateTime() : null;
TotalDailyDose = segments.Length > 19 && segments[19].Length > 0 ? TypeSerializer.Deserialize<CompositeQuantityWithUnits>(segments[19], false, seps) : null;
NeedsHumanReview = segments.Length > 20 && segments[20].Length > 0 ? segments[20] : null;
SpecialDispensingInstructions = segments.Length > 21 && segments[21].Length > 0 ? segments[21].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize<CodedWithExceptions>(x, false, seps)) : null;
GivePerTimeUnit = segments.Length > 22 && segments[22].Length > 0 ? segments[22] : null;
GiveRateAmount = segments.Length > 23 && segments[23].Length > 0 ? segments[23] : null;
GiveRateUnits = segments.Length > 24 && segments[24].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[24], false, seps) : null;
GiveStrength = segments.Length > 25 && segments[25].Length > 0 ? segments[25].ToNullableDecimal() : null;
GiveStrengthUnits = segments.Length > 26 && segments[26].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[26], false, seps) : null;
GiveIndication = segments.Length > 27 && segments[27].Length > 0 ? segments[27].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize<CodedWithExceptions>(x, false, seps)) : null;
DispensePackageSize = segments.Length > 28 && segments[28].Length > 0 ? segments[28].ToNullableDecimal() : null;
DispensePackageSizeUnit = segments.Length > 29 && segments[29].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[29], false, seps) : null;
DispensePackageMethod = segments.Length > 30 && segments[30].Length > 0 ? segments[30] : null;
SupplementaryCode = segments.Length > 31 && segments[31].Length > 0 ? segments[31].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize<CodedWithExceptions>(x, false, seps)) : null;
OriginalOrderDateTime = segments.Length > 32 && segments[32].Length > 0 ? segments[32].ToNullableDateTime() : null;
GiveDrugStrengthVolume = segments.Length > 33 && segments[33].Length > 0 ? segments[33].ToNullableDecimal() : null;
GiveDrugStrengthVolumeUnits = segments.Length > 34 && segments[34].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[34], false, seps) : null;
ControlledSubstanceSchedule = segments.Length > 35 && segments[35].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[35], false, seps) : null;
FormularyStatus = segments.Length > 36 && segments[36].Length > 0 ? segments[36] : null;
PharmaceuticalSubstanceAlternative = segments.Length > 37 && segments[37].Length > 0 ? segments[37].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize<CodedWithExceptions>(x, false, seps)) : null;
PharmacyOfMostRecentFill = segments.Length > 38 && segments[38].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[38], false, seps) : null;
InitialDispenseAmount = segments.Length > 39 && segments[39].Length > 0 ? segments[39].ToNullableDecimal() : null;
DispensingPharmacy = segments.Length > 40 && segments[40].Length > 0 ? TypeSerializer.Deserialize<CodedWithExceptions>(segments[40], false, seps) : null;
DispensingPharmacyAddress = segments.Length > 41 && segments[41].Length > 0 ? TypeSerializer.Deserialize<ExtendedAddress>(segments[41], false, seps) : null;
DeliverToPatientLocation = segments.Length > 42 && segments[42].Length > 0 ? TypeSerializer.Deserialize<PersonLocation>(segments[42], false, seps) : null;
DeliverToAddress = segments.Length > 43 && segments[43].Length > 0 ? TypeSerializer.Deserialize<ExtendedAddress>(segments[43], false, seps) : null;
PharmacyOrderType = segments.Length > 44 && segments[44].Length > 0 ? segments[44] : null;
PharmacyPhoneNumber = segments.Length > 45 && segments[45].Length > 0 ? segments[45].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize<ExtendedTelecommunicationNumber>(x, false, seps)) : null;
}
/// <inheritdoc/>
public string ToDelimitedString()
{
CultureInfo culture = CultureInfo.CurrentCulture;
return string.Format(
culture,
StringHelper.StringFormatSequence(0, 46, Configuration.FieldSeparator),
Id,
QuantityTiming,
GiveCode?.ToDelimitedString(),
GiveAmountMinimum.HasValue ? GiveAmountMinimum.Value.ToString(Consts.NumericFormat, culture) : null,
GiveAmountMaximum.HasValue ? GiveAmountMaximum.Value.ToString(Consts.NumericFormat, culture) : null,
GiveUnits?.ToDelimitedString(),
GiveDosageForm?.ToDelimitedString(),
ProvidersAdministrationInstructions != null ? string.Join(Configuration.FieldRepeatSeparator, ProvidersAdministrationInstructions.Select(x => x.ToDelimitedString())) : null,
DeliverToLocation,
SubstitutionStatus,
DispenseAmount.HasValue ? DispenseAmount.Value.ToString(Consts.NumericFormat, culture) : null,
DispenseUnits?.ToDelimitedString(),
NumberOfRefills.HasValue ? NumberOfRefills.Value.ToString(Consts.NumericFormat, culture) : null,
OrderingProvidersDeaNumber != null ? string.Join(Configuration.FieldRepeatSeparator, OrderingProvidersDeaNumber.Select(x => x.ToDelimitedString())) : null,
PharmacistTreatmentSuppliersVerifierId != null ? string.Join(Configuration.FieldRepeatSeparator, PharmacistTreatmentSuppliersVerifierId.Select(x => x.ToDelimitedString())) : null,
PrescriptionNumber,
NumberOfRefillsRemaining.HasValue ? NumberOfRefillsRemaining.Value.ToString(Consts.NumericFormat, culture) : null,
NumberOfRefillsDosesDispensed.HasValue ? NumberOfRefillsDosesDispensed.Value.ToString(Consts.NumericFormat, culture) : null,
DateTimeOfMostRecentRefillOrDoseDispensed.HasValue ? DateTimeOfMostRecentRefillOrDoseDispensed.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
TotalDailyDose?.ToDelimitedString(),
NeedsHumanReview,
SpecialDispensingInstructions != null ? string.Join(Configuration.FieldRepeatSeparator, SpecialDispensingInstructions.Select(x => x.ToDelimitedString())) : null,
GivePerTimeUnit,
GiveRateAmount,
GiveRateUnits?.ToDelimitedString(),
GiveStrength.HasValue ? GiveStrength.Value.ToString(Consts.NumericFormat, culture) : null,
GiveStrengthUnits?.ToDelimitedString(),
GiveIndication != null ? string.Join(Configuration.FieldRepeatSeparator, GiveIndication.Select(x => x.ToDelimitedString())) : null,
DispensePackageSize.HasValue ? DispensePackageSize.Value.ToString(Consts.NumericFormat, culture) : null,
DispensePackageSizeUnit?.ToDelimitedString(),
DispensePackageMethod,
SupplementaryCode != null ? string.Join(Configuration.FieldRepeatSeparator, SupplementaryCode.Select(x => x.ToDelimitedString())) : null,
OriginalOrderDateTime.HasValue ? OriginalOrderDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
GiveDrugStrengthVolume.HasValue ? GiveDrugStrengthVolume.Value.ToString(Consts.NumericFormat, culture) : null,
GiveDrugStrengthVolumeUnits?.ToDelimitedString(),
ControlledSubstanceSchedule?.ToDelimitedString(),
FormularyStatus,
PharmaceuticalSubstanceAlternative != null ? string.Join(Configuration.FieldRepeatSeparator, PharmaceuticalSubstanceAlternative.Select(x => x.ToDelimitedString())) : null,
PharmacyOfMostRecentFill?.ToDelimitedString(),
InitialDispenseAmount.HasValue ? InitialDispenseAmount.Value.ToString(Consts.NumericFormat, culture) : null,
DispensingPharmacy?.ToDelimitedString(),
DispensingPharmacyAddress?.ToDelimitedString(),
DeliverToPatientLocation?.ToDelimitedString(),
DeliverToAddress?.ToDelimitedString(),
PharmacyOrderType,
PharmacyPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, PharmacyPhoneNumber.Select(x => x.ToDelimitedString())) : null
).TrimEnd(Configuration.FieldSeparator.ToCharArray());
}
}
}
| 56.924084 | 281 | 0.615636 | [
"MIT"
] | kamlesh-microsoft/clear-hl7-net | src/ClearHl7/V282/Segments/RxeSegment.cs | 21,747 | C# |
/**
* The MIT License
* Copyright (c) 2016 Population Register Centre (VRK)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace PTV.Domain.Model.Enums
{
/// <summary>
/// Service channel connection type
/// </summary>
public enum ServiceChannelConnectionTypeEnum
{
/// <summary>
/// Not common
/// </summary>
NotCommon,
/// <summary>
/// Common for all
/// </summary>
CommonForAll,
/// <summary>
/// Common for selected
/// </summary>
CommonFor
}
} | 36.568182 | 80 | 0.684897 | [
"MIT"
] | MikkoVirenius/ptv-1.7 | src/PTV.Domain.Model/Enums/ServiceChannelConnectionTypeEnum.cs | 1,611 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EventManager : MonoBehaviour
{
public delegate void StartGameDelegate();
public static StartGameDelegate onStartGame;
public static StartGameDelegate onRefreshGame;
// public static StartGameDelegate onLevelComplete;
public static void StartGame()
{
if (onStartGame != null)
onStartGame();
}
public static void RefreshGame()
{
if (onRefreshGame != null)
onRefreshGame();
}
// public static void LevelComplete()
// {
// if (onLevelComplete != null)
// onLevelComplete();
// }
} | 24.428571 | 55 | 0.644737 | [
"MIT"
] | AnatoliiPerfun/PullAndScore-prototype | Assets/Scripts/EventManager.cs | 686 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.TemplateEngine.Abstractions;
using Microsoft.Templates.Core.Gen;
namespace Microsoft.Templates.Core.PostActions.Catalog
{
public class AddItemToContextPostAction : PostAction<IReadOnlyList<ICreationPath>>
{
private readonly Dictionary<string, string> _genParameters;
private readonly string _destinationPath;
public AddItemToContextPostAction(string relatedTemplate, IReadOnlyList<ICreationPath> config, Dictionary<string, string> genParameters, string destinationPath)
: base(relatedTemplate, config)
{
_genParameters = genParameters;
_destinationPath = destinationPath;
}
internal override void ExecuteInternal()
{
var itemsToAdd = Config
.Where(o => !string.IsNullOrWhiteSpace(o.Path))
.Select(o => Path.GetFullPath(Path.Combine(_destinationPath, o.Path)))
.ToList();
GenContext.Current.ProjectInfo.ProjectItems.AddRange(itemsToAdd);
}
}
}
| 37.842105 | 169 | 0.659944 | [
"MIT"
] | Microsoft/CoreTemplateStudio | code/src/CoreTemplateStudio/CoreTemplateStudio.Core/PostActions/Catalog/AddItemToContextPostAction.cs | 1,403 | C# |
using System;
namespace Editor_Mono.Cecil
{
internal class FieldDefinitionProjection
{
public readonly FieldAttributes Attributes;
public readonly FieldDefinitionTreatment Treatment;
public FieldDefinitionProjection(FieldDefinition field, FieldDefinitionTreatment treatment)
{
this.Attributes = field.Attributes;
this.Treatment = treatment;
}
}
}
| 24.4 | 93 | 0.806011 | [
"BSD-2-Clause"
] | ErQing/cshotfix | CSHotFix_ILRuntimeSimpleFramework/Assets/CSHotFixLibaray/Editor/Injector/MonoCecil/Mono.Cecil/FieldDefinitionProjection.cs | 366 | 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.DesktopVirtualization.V20210401Preview
{
/// <summary>
/// Represents a HostPool definition.
/// </summary>
[AzureNativeResourceType("azure-native:desktopvirtualization/v20210401preview:HostPool")]
public partial class HostPool : Pulumi.CustomResource
{
/// <summary>
/// List of applicationGroup links.
/// </summary>
[Output("applicationGroupReferences")]
public Output<ImmutableArray<string>> ApplicationGroupReferences { get; private set; } = null!;
/// <summary>
/// Is cloud pc resource.
/// </summary>
[Output("cloudPcResource")]
public Output<bool> CloudPcResource { get; private set; } = null!;
/// <summary>
/// Custom rdp property of HostPool.
/// </summary>
[Output("customRdpProperty")]
public Output<string?> CustomRdpProperty { get; private set; } = null!;
/// <summary>
/// Description of HostPool.
/// </summary>
[Output("description")]
public Output<string?> Description { get; private set; } = null!;
/// <summary>
/// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.
/// </summary>
[Output("etag")]
public Output<string> Etag { get; private set; } = null!;
/// <summary>
/// Friendly name of HostPool.
/// </summary>
[Output("friendlyName")]
public Output<string?> FriendlyName { get; private set; } = null!;
/// <summary>
/// HostPool type for desktop.
/// </summary>
[Output("hostPoolType")]
public Output<string> HostPoolType { get; private set; } = null!;
[Output("identity")]
public Output<Outputs.ResourceModelWithAllowedPropertySetResponseIdentity?> Identity { get; private set; } = null!;
/// <summary>
/// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.
/// </summary>
[Output("kind")]
public Output<string?> Kind { get; private set; } = null!;
/// <summary>
/// The type of the load balancer.
/// </summary>
[Output("loadBalancerType")]
public Output<string> LoadBalancerType { get; private set; } = null!;
/// <summary>
/// The geo-location where the resource lives
/// </summary>
[Output("location")]
public Output<string?> Location { get; private set; } = null!;
/// <summary>
/// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource.
/// </summary>
[Output("managedBy")]
public Output<string?> ManagedBy { get; private set; } = null!;
/// <summary>
/// The max session limit of HostPool.
/// </summary>
[Output("maxSessionLimit")]
public Output<int?> MaxSessionLimit { get; private set; } = null!;
/// <summary>
/// The registration info of HostPool.
/// </summary>
[Output("migrationRequest")]
public Output<Outputs.MigrationRequestPropertiesResponse?> MigrationRequest { get; private set; } = null!;
/// <summary>
/// The name of the resource
/// </summary>
[Output("name")]
public Output<string> Name { get; private set; } = null!;
/// <summary>
/// ObjectId of HostPool. (internal use)
/// </summary>
[Output("objectId")]
public Output<string> ObjectId { get; private set; } = null!;
/// <summary>
/// PersonalDesktopAssignment type for HostPool.
/// </summary>
[Output("personalDesktopAssignmentType")]
public Output<string?> PersonalDesktopAssignmentType { get; private set; } = null!;
[Output("plan")]
public Output<Outputs.ResourceModelWithAllowedPropertySetResponsePlan?> Plan { get; private set; } = null!;
/// <summary>
/// The type of preferred application group type, default to Desktop Application Group
/// </summary>
[Output("preferredAppGroupType")]
public Output<string> PreferredAppGroupType { get; private set; } = null!;
/// <summary>
/// Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints
/// </summary>
[Output("publicNetworkAccess")]
public Output<string?> PublicNetworkAccess { get; private set; } = null!;
/// <summary>
/// The registration info of HostPool.
/// </summary>
[Output("registrationInfo")]
public Output<Outputs.RegistrationInfoResponse?> RegistrationInfo { get; private set; } = null!;
/// <summary>
/// The ring number of HostPool.
/// </summary>
[Output("ring")]
public Output<int?> Ring { get; private set; } = null!;
[Output("sku")]
public Output<Outputs.ResourceModelWithAllowedPropertySetResponseSku?> Sku { get; private set; } = null!;
/// <summary>
/// ClientId for the registered Relying Party used to issue WVD SSO certificates.
/// </summary>
[Output("ssoClientId")]
public Output<string?> SsoClientId { get; private set; } = null!;
/// <summary>
/// Path to Azure KeyVault storing the secret used for communication to ADFS.
/// </summary>
[Output("ssoClientSecretKeyVaultPath")]
public Output<string?> SsoClientSecretKeyVaultPath { get; private set; } = null!;
/// <summary>
/// The type of single sign on Secret Type.
/// </summary>
[Output("ssoSecretType")]
public Output<string?> SsoSecretType { get; private set; } = null!;
/// <summary>
/// URL to customer ADFS server for signing WVD SSO certificates.
/// </summary>
[Output("ssoadfsAuthority")]
public Output<string?> SsoadfsAuthority { get; private set; } = null!;
/// <summary>
/// The flag to turn on/off StartVMOnConnect feature.
/// </summary>
[Output("startVMOnConnect")]
public Output<bool?> StartVMOnConnect { get; private set; } = null!;
/// <summary>
/// Resource tags.
/// </summary>
[Output("tags")]
public Output<ImmutableDictionary<string, string>?> Tags { get; private set; } = null!;
/// <summary>
/// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
/// </summary>
[Output("type")]
public Output<string> Type { get; private set; } = null!;
/// <summary>
/// Is validation environment.
/// </summary>
[Output("validationEnvironment")]
public Output<bool?> ValidationEnvironment { get; private set; } = null!;
/// <summary>
/// VM template for sessionhosts configuration within hostpool.
/// </summary>
[Output("vmTemplate")]
public Output<string?> VmTemplate { get; private set; } = null!;
/// <summary>
/// Create a HostPool 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 HostPool(string name, HostPoolArgs args, CustomResourceOptions? options = null)
: base("azure-native:desktopvirtualization/v20210401preview:HostPool", name, args ?? new HostPoolArgs(), MakeResourceOptions(options, ""))
{
}
private HostPool(string name, Input<string> id, CustomResourceOptions? options = null)
: base("azure-native:desktopvirtualization/v20210401preview:HostPool", 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:desktopvirtualization/v20210401preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20190123preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20190123preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20190924preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20190924preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20191210preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20191210preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20200921preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20200921preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20201019preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20201019preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20201102preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20201102preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20201110preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20201110preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20210114preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20210114preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20210201preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20210201preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20210309preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20210309preview:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20210712:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20210712:HostPool"},
new Pulumi.Alias { Type = "azure-native:desktopvirtualization/v20210903preview:HostPool"},
new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20210903preview:HostPool"},
},
};
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 HostPool 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 HostPool Get(string name, Input<string> id, CustomResourceOptions? options = null)
{
return new HostPool(name, id, options);
}
}
public sealed class HostPoolArgs : Pulumi.ResourceArgs
{
/// <summary>
/// Custom rdp property of HostPool.
/// </summary>
[Input("customRdpProperty")]
public Input<string>? CustomRdpProperty { get; set; }
/// <summary>
/// Description of HostPool.
/// </summary>
[Input("description")]
public Input<string>? Description { get; set; }
/// <summary>
/// Friendly name of HostPool.
/// </summary>
[Input("friendlyName")]
public Input<string>? FriendlyName { get; set; }
/// <summary>
/// The name of the host pool within the specified resource group
/// </summary>
[Input("hostPoolName")]
public Input<string>? HostPoolName { get; set; }
/// <summary>
/// HostPool type for desktop.
/// </summary>
[Input("hostPoolType", required: true)]
public InputUnion<string, Pulumi.AzureNative.DesktopVirtualization.V20210401Preview.HostPoolType> HostPoolType { get; set; } = null!;
[Input("identity")]
public Input<Inputs.ResourceModelWithAllowedPropertySetIdentityArgs>? Identity { get; set; }
/// <summary>
/// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.
/// </summary>
[Input("kind")]
public Input<string>? Kind { get; set; }
/// <summary>
/// The type of the load balancer.
/// </summary>
[Input("loadBalancerType", required: true)]
public InputUnion<string, Pulumi.AzureNative.DesktopVirtualization.V20210401Preview.LoadBalancerType> LoadBalancerType { get; set; } = null!;
/// <summary>
/// The geo-location where the resource lives
/// </summary>
[Input("location")]
public Input<string>? Location { get; set; }
/// <summary>
/// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource.
/// </summary>
[Input("managedBy")]
public Input<string>? ManagedBy { get; set; }
/// <summary>
/// The max session limit of HostPool.
/// </summary>
[Input("maxSessionLimit")]
public Input<int>? MaxSessionLimit { get; set; }
/// <summary>
/// The registration info of HostPool.
/// </summary>
[Input("migrationRequest")]
public Input<Inputs.MigrationRequestPropertiesArgs>? MigrationRequest { get; set; }
/// <summary>
/// PersonalDesktopAssignment type for HostPool.
/// </summary>
[Input("personalDesktopAssignmentType")]
public InputUnion<string, Pulumi.AzureNative.DesktopVirtualization.V20210401Preview.PersonalDesktopAssignmentType>? PersonalDesktopAssignmentType { get; set; }
[Input("plan")]
public Input<Inputs.ResourceModelWithAllowedPropertySetPlanArgs>? Plan { get; set; }
/// <summary>
/// The type of preferred application group type, default to Desktop Application Group
/// </summary>
[Input("preferredAppGroupType", required: true)]
public InputUnion<string, Pulumi.AzureNative.DesktopVirtualization.V20210401Preview.PreferredAppGroupType> PreferredAppGroupType { get; set; } = null!;
/// <summary>
/// Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints
/// </summary>
[Input("publicNetworkAccess")]
public InputUnion<string, Pulumi.AzureNative.DesktopVirtualization.V20210401Preview.PublicNetworkAccess>? PublicNetworkAccess { get; set; }
/// <summary>
/// The registration info of HostPool.
/// </summary>
[Input("registrationInfo")]
public Input<Inputs.RegistrationInfoArgs>? RegistrationInfo { get; set; }
/// <summary>
/// The name of the resource group. The name is case insensitive.
/// </summary>
[Input("resourceGroupName", required: true)]
public Input<string> ResourceGroupName { get; set; } = null!;
/// <summary>
/// The ring number of HostPool.
/// </summary>
[Input("ring")]
public Input<int>? Ring { get; set; }
[Input("sku")]
public Input<Inputs.ResourceModelWithAllowedPropertySetSkuArgs>? Sku { get; set; }
/// <summary>
/// ClientId for the registered Relying Party used to issue WVD SSO certificates.
/// </summary>
[Input("ssoClientId")]
public Input<string>? SsoClientId { get; set; }
/// <summary>
/// Path to Azure KeyVault storing the secret used for communication to ADFS.
/// </summary>
[Input("ssoClientSecretKeyVaultPath")]
public Input<string>? SsoClientSecretKeyVaultPath { get; set; }
/// <summary>
/// The type of single sign on Secret Type.
/// </summary>
[Input("ssoSecretType")]
public InputUnion<string, Pulumi.AzureNative.DesktopVirtualization.V20210401Preview.SSOSecretType>? SsoSecretType { get; set; }
/// <summary>
/// URL to customer ADFS server for signing WVD SSO certificates.
/// </summary>
[Input("ssoadfsAuthority")]
public Input<string>? SsoadfsAuthority { get; set; }
/// <summary>
/// The flag to turn on/off StartVMOnConnect feature.
/// </summary>
[Input("startVMOnConnect")]
public Input<bool>? StartVMOnConnect { get; set; }
[Input("tags")]
private InputMap<string>? _tags;
/// <summary>
/// Resource tags.
/// </summary>
public InputMap<string> Tags
{
get => _tags ?? (_tags = new InputMap<string>());
set => _tags = value;
}
/// <summary>
/// Is validation environment.
/// </summary>
[Input("validationEnvironment")]
public Input<bool>? ValidationEnvironment { get; set; }
/// <summary>
/// VM template for sessionhosts configuration within hostpool.
/// </summary>
[Input("vmTemplate")]
public Input<string>? VmTemplate { get; set; }
public HostPoolArgs()
{
}
}
}
| 44.827354 | 402 | 0.615315 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/dotnet/DesktopVirtualization/V20210401Preview/HostPool.cs | 19,993 | C# |
//
// SeasonalItem.cs
//
// Author:
// Sandy Chuang
//
// Copyright © 2020 Couchbase Inc. All rights reserved.
//
using P2PListSync.ViewModels;
namespace P2PListSync.Models
{
public class SeasonalItem : BaseViewModel
{
public int Index { get; set; }
private string _name;
public string Name
{
get { return _name; }
set { SetProperty(ref _name, value); }
}
private byte[] _imageByteArray;
public byte[] ImageByteArray
{
get { return _imageByteArray; }
set { SetProperty(ref _imageByteArray, value); }
}
private int _quantity;
public int Quantity
{
get { return _quantity; }
set { SetProperty(ref _quantity, value); }
}
}
} | 20.475 | 60 | 0.551893 | [
"MIT"
] | badaldesai/couchbase-lite-peer-to-peer-sync-examples | dotnet/P2PListSync/P2PListSync/Models/SeasonalItem.cs | 822 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PowerBuildToolDevOpsAPI.Models
{
public class BuildModel
{
public List<BuildModelValue> Builds { get; set; }
}
}
| 16.25 | 57 | 0.676923 | [
"MIT"
] | yesadahmed/DevOps | PowerBuildToolDevOpsAPI/PowerBuildToolDevOpsAPI/Models/BuildModel.cs | 262 | C# |
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LevelManager : MonoBehaviour {
public int ActiveScene { get; private set; }
public List<GameObject> GameplayPersistentObjects { get; set; }
private static LevelManager instance;
public static LevelManager Instance
{
get
{
if (instance == null)
{
instance = FindObjectOfType<LevelManager>();
}
return instance;
}
}
void Awake()
{
GameplayPersistentObjects = new List<GameObject>();
ActiveScene = SceneManager.GetActiveScene().buildIndex;
GameplayPersistentObjects.Add(gameObject);
}
public void LoadLevel(int scene)
{
/*if(scene == 0 || scene == 2)
{
foreach (GameObject go in GameplayPersistentObjects)
{
if (go != null) Destroy(go);
}
}
else if (scene > 1 && scene > ActiveScene)
{
if (!GameplayPersistentObjects.Contains(gameObject))
{
GameplayPersistentObjects.Add(gameObject);
}
foreach (GameObject go in GameplayPersistentObjects)
{
DontDestroyOnLoad(go);
}
}
*/
if(scene <= ActiveScene)
{
for (int i = 1; i < GameplayPersistentObjects.Count; i++)
{
GameObject go = GameplayPersistentObjects[i];
if (go != null) Destroy(go);
}
GameplayPersistentObjects.RemoveRange(1, GameplayPersistentObjects.Count - 1);
}
foreach (GameObject go in GameplayPersistentObjects)
{
DontDestroyOnLoad(go);
}
ActiveScene = scene;
SceneManager.LoadScene(scene);
}
}
| 26.222222 | 90 | 0.54661 | [
"MIT"
] | DominikaBogusz/Evilmine | Assets/Scripts/LevelManager.cs | 1,890 | C# |
namespace Zen.Base.Module.Data
{
public class DataAccessControl
{
public bool Read;
public bool Remove;
public bool Write;
}
} | 16.4 | 34 | 0.603659 | [
"MIT"
] | bucknellu/zen | Zen.Base/Module/Data/DataAccessControl.cs | 166 | C# |
using System;
using System.Linq;
using System.Runtime.InteropServices;
using Torque6.Engine.SimObjects;
using Torque6.Engine.SimObjects.Scene;
using Torque6.Engine.Namespaces;
using Torque6.Utility;
namespace Torque6.Engine.SimObjects.GuiControls
{
public unsafe class GuiMLTextEditCtrl : GuiMLTextCtrl
{
public GuiMLTextEditCtrl()
{
ObjectPtr = Sim.WrapObject(InternalUnsafeMethods.GuiMLTextEditCtrlCreateInstance());
}
public GuiMLTextEditCtrl(uint pId) : base(pId)
{
}
public GuiMLTextEditCtrl(string pName) : base(pName)
{
}
public GuiMLTextEditCtrl(IntPtr pObjPtr) : base(pObjPtr)
{
}
public GuiMLTextEditCtrl(Sim.SimObjectPtr* pObjPtr) : base(pObjPtr)
{
}
public GuiMLTextEditCtrl(SimObject pObj) : base(pObj)
{
}
#region UnsafeNativeMethods
new internal struct InternalUnsafeMethods
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate IntPtr _GuiMLTextEditCtrlGetEscapeCommand(IntPtr ctrl);
private static _GuiMLTextEditCtrlGetEscapeCommand _GuiMLTextEditCtrlGetEscapeCommandFunc;
internal static IntPtr GuiMLTextEditCtrlGetEscapeCommand(IntPtr ctrl)
{
if (_GuiMLTextEditCtrlGetEscapeCommandFunc == null)
{
_GuiMLTextEditCtrlGetEscapeCommandFunc =
(_GuiMLTextEditCtrlGetEscapeCommand)Marshal.GetDelegateForFunctionPointer(Interop.Torque6.DllLoadUtils.GetProcAddress(Interop.Torque6.Torque6LibHandle,
"GuiMLTextEditCtrlGetEscapeCommand"), typeof(_GuiMLTextEditCtrlGetEscapeCommand));
}
return _GuiMLTextEditCtrlGetEscapeCommandFunc(ctrl);
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void _GuiMLTextEditCtrlSetEscapeCommand(IntPtr ctrl, string command);
private static _GuiMLTextEditCtrlSetEscapeCommand _GuiMLTextEditCtrlSetEscapeCommandFunc;
internal static void GuiMLTextEditCtrlSetEscapeCommand(IntPtr ctrl, string command)
{
if (_GuiMLTextEditCtrlSetEscapeCommandFunc == null)
{
_GuiMLTextEditCtrlSetEscapeCommandFunc =
(_GuiMLTextEditCtrlSetEscapeCommand)Marshal.GetDelegateForFunctionPointer(Interop.Torque6.DllLoadUtils.GetProcAddress(Interop.Torque6.Torque6LibHandle,
"GuiMLTextEditCtrlSetEscapeCommand"), typeof(_GuiMLTextEditCtrlSetEscapeCommand));
}
_GuiMLTextEditCtrlSetEscapeCommandFunc(ctrl, command);
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate IntPtr _GuiMLTextEditCtrlCreateInstance();
private static _GuiMLTextEditCtrlCreateInstance _GuiMLTextEditCtrlCreateInstanceFunc;
internal static IntPtr GuiMLTextEditCtrlCreateInstance()
{
if (_GuiMLTextEditCtrlCreateInstanceFunc == null)
{
_GuiMLTextEditCtrlCreateInstanceFunc =
(_GuiMLTextEditCtrlCreateInstance)Marshal.GetDelegateForFunctionPointer(Interop.Torque6.DllLoadUtils.GetProcAddress(Interop.Torque6.Torque6LibHandle,
"GuiMLTextEditCtrlCreateInstance"), typeof(_GuiMLTextEditCtrlCreateInstance));
}
return _GuiMLTextEditCtrlCreateInstanceFunc();
}
}
#endregion
#region Properties
public string EscapeCommand
{
get
{
if (IsDead()) throw new Exceptions.SimObjectPointerInvalidException();
return Marshal.PtrToStringAnsi(InternalUnsafeMethods.GuiMLTextEditCtrlGetEscapeCommand(ObjectPtr->ObjPtr));
}
set
{
if (IsDead()) throw new Exceptions.SimObjectPointerInvalidException();
InternalUnsafeMethods.GuiMLTextEditCtrlSetEscapeCommand(ObjectPtr->ObjPtr, value);
}
}
#endregion
#region Methods
#endregion
}
} | 34.974359 | 169 | 0.684995 | [
"MIT"
] | lukaspj/Torque6-Embedded-C- | Torque6/Engine/SimObjects/GuiControls/GuiMLTextEditCtrl.cs | 4,092 | C# |
using System.Threading.Tasks;
using BabyYodaBot.Core.BabyYoda.Models;
namespace BabyYodaBot.Core.BabyYoda
{
public interface IBabyYodaClient
{
Task<bool> ProcessAsync(int serverPort);
Task FeedAsync(Player player);
}
}
| 20.75 | 48 | 0.718876 | [
"MIT"
] | haycc/BabyYoda | src/BabyYodaBot/BabyYodaBot.Core.BabyYoda/IBabyYodaClient.cs | 251 | C# |
// Copyright 2016 Google Inc. 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.
using System;
using Xunit;
using static Google.Cloud.Language.V1.AnnotateTextRequest.Types;
using static Google.Cloud.Language.V1.PartOfSpeech.Types;
namespace Google.Cloud.Language.V1.Snippets
{
public class LanguageServiceClientSnippets
{
[Fact]
public void AnalyzeEntities()
{
// Sample: AnalyzeEntities
// Additional: AnalyzeEntities(Document,*)
LanguageServiceClient client = LanguageServiceClient.Create();
Document document = Document.FromPlainText("Richard of York gave battle in vain.");
AnalyzeEntitiesResponse response = client.AnalyzeEntities(document);
Console.WriteLine($"Detected language: {response.Language}");
Console.WriteLine("Detected entities:");
foreach (Entity entity in response.Entities)
{
Console.WriteLine($" {entity.Name} ({(int) (entity.Salience * 100)}%)");
}
// End sample
Assert.Equal(3, response.Entities.Count);
Assert.Equal("Richard of York", response.Entities[0].Name);
}
[Fact]
public void AnalyzeSentiment()
{
// Sample: AnalyzeSentiment
// Additional: AnalyzeSentiment(Document,*)
LanguageServiceClient client = LanguageServiceClient.Create();
Document document = Document.FromPlainText("You're simply the best - better than all the rest.");
AnalyzeSentimentResponse response = client.AnalyzeSentiment(document);
Console.WriteLine($"Detected language: {response.Language}");
Console.WriteLine($"Sentiment score: {response.DocumentSentiment.Score}");
Console.WriteLine($"Sentiment magnitude: {response.DocumentSentiment.Magnitude}");
// End sample
// This is fairly positive...
Assert.True(response.DocumentSentiment.Score > 0.5);
}
[Fact]
public void AnalyzeSyntax()
{
// Sample: AnalyzeSyntax
// Additional: AnalyzeSyntax(Document,*)
LanguageServiceClient client = LanguageServiceClient.Create();
Document document = Document.FromPlainText(
"This is a simple sentence. This sentence, while not very complicated, is still more complicated than the first");
AnalyzeSyntaxResponse response = client.AnalyzeSyntax(document);
Console.WriteLine($"Detected language: {response.Language}");
Console.WriteLine($"Number of sentences: {response.Sentences.Count}");
Console.WriteLine($"Number of tokens: {response.Tokens.Count}");
// End sample
Assert.Equal(2, response.Sentences.Count);
Assert.Equal(21, response.Tokens.Count);
}
[Fact]
public void AnnotateText()
{
// Sample: AnnotateText
// Additional: AnnotateText(Document,Features,CallSettings)
LanguageServiceClient client = LanguageServiceClient.Create();
Document document = Document.FromPlainText("Richard of York gave battle in vain.");
// "Features" selects which features you wish to enable. Here we want to extract syntax
// and entities - you can also extract document sentiment.
AnnotateTextResponse response = client.AnnotateText(document,
new Features { ExtractSyntax = true, ExtractEntities = true });
Console.WriteLine($"Detected language: {response.Language}");
// The Sentences and Tokens properties provide all kinds of information
// about the parsed text.
Console.WriteLine($"Number of sentences: {response.Sentences.Count}");
Console.WriteLine($"Number of tokens: {response.Tokens.Count}");
Console.WriteLine("Detected entities:");
foreach (Entity entity in response.Entities)
{
Console.WriteLine($" {entity.Name} ({(int)(entity.Salience * 100)}%)");
}
// End sample
Assert.Equal(1, response.Sentences.Count);
Assert.Equal(8, response.Tokens.Count);
Assert.Equal("Richard", response.Tokens[0].Text.Content);
Assert.Equal(Tag.Noun, response.Tokens[0].PartOfSpeech.Tag);
Assert.Equal(".", response.Tokens[7].Text.Content);
Assert.Equal(Tag.Punct, response.Tokens[7].PartOfSpeech.Tag);
Assert.Equal(3, response.Entities.Count);
Assert.Equal("Richard of York", response.Entities[0].Name);
}
}
}
| 46.380531 | 130 | 0.637092 | [
"Apache-2.0"
] | Acidburn0zzz/google-cloud-dotnet | apis/Google.Cloud.Language.V1/Google.Cloud.Language.V1.Snippets/LanguageServiceClientSnippets.cs | 5,243 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GameSystem
{
namespace PresentSetting
{
[CreateAssetMenu(fileName = "DollSystemSetting", menuName = "系统配置文件/Doll System Setting")]
public class DollSystemSetting : ScriptableObject
{
public int dollMaxHealth;
public Sprite[] dollPics;
public GameObject bloodPrefab;
}
}
}
| 23.368421 | 98 | 0.65991 | [
"Apache-2.0"
] | Sakuralalala/Banou | Assets/Scripts/DollSystem/DollSystemSetting.cs | 458 | C# |
#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
#endif
using XLua;
using System.Collections.Generic;
namespace XLua.CSObjectWrap
{
using Utils = XLua.Utils;
public class XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapMongoDBBsonSerializationSerializersPartiallyRawBsonDocumentSerializerWrapWrapWrapWrap
{
public static void __Register(RealStatePtr L)
{
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
System.Type type = typeof(XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapMongoDBBsonSerializationSerializersPartiallyRawBsonDocumentSerializerWrapWrapWrap);
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
Utils.EndObjectRegister(type, L, translator, null, null,
null, null, null);
Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
Utils.RegisterFunc(L, Utils.CLS_IDX, "__Register", _m___Register_xlua_st_);
Utils.EndClassRegister(type, L, translator);
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int __CreateInstance(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
if(LuaAPI.lua_gettop(L) == 1)
{
XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapMongoDBBsonSerializationSerializersPartiallyRawBsonDocumentSerializerWrapWrapWrap gen_ret = new XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapMongoDBBsonSerializationSerializersPartiallyRawBsonDocumentSerializerWrapWrapWrap();
translator.Push(L, gen_ret);
return 1;
}
}
catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
return LuaAPI.luaL_error(L, "invalid arguments to XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapMongoDBBsonSerializationSerializersPartiallyRawBsonDocumentSerializerWrapWrapWrap constructor!");
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m___Register_xlua_st_(RealStatePtr L)
{
try {
{
System.IntPtr _L = LuaAPI.lua_touserdata(L, 1);
XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapMongoDBBsonSerializationSerializersPartiallyRawBsonDocumentSerializerWrapWrapWrap.__Register( _L );
return 0;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
}
}
| 28.481818 | 285 | 0.63262 | [
"MIT"
] | zxsean/DCET | Unity/Assets/Model/XLua/Gen/XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapMongoDBBsonSerializationSerializersPartiallyRawBsonDocumentSerializerWrapWrapWrapWrap.cs | 3,135 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Amazon.Lambda.Core;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
namespace AsyncFunction
{
public class Function
{
/// <summary>
/// A simple function that takes a string and does a ToUpper
/// </summary>
/// <param name="input"></param>
/// <param name="context"></param>
/// <returns></returns>
public async Task<string> FunctionHandler(string input, ILambdaContext context)
{
await Task.Delay(1000);
return input?.ToUpper();
}
}
}
| 28.482759 | 100 | 0.618644 | [
"MIT"
] | musement/dotnet-lambda-exec | src/Samples/AsyncFunction/Function.cs | 826 | C# |
using System.Collections.Generic;
using BrightstarDB.EntityFramework;
namespace Continuum.Master.ControlUnit
{
[Entity]
public interface IStreamNodes
{
[Identifier(KeySeparator = "", KeyProperties = new[] { "Name" })]
string Id { get; }
string Name { get; set; }
string AppId { get; set; }
[InverseProperty("Nodes")]
IContinuumRoot Root { get; set; }
ICollection<IProject> Projects { get; set; }
}
} | 21.727273 | 73 | 0.610879 | [
"Apache-2.0"
] | JonasSyrstad/Stardust.Interstellar.Rest | Stardust.Interstellar.Rest/Continuum.Master.ControlUnit/IStreamNodes.cs | 480 | C# |
// -----------------------------------------------------------------------
// <copyright file="CppCodeWriter.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root
// for license information.
// </copyright>
// -----------------------------------------------------------------------
using System;
using System.Linq;
namespace Mlos.SettingsSystem.CodeGen.CodeWriters
{
/// <summary>
/// Base class for writing cpp classes.
/// </summary>
internal abstract class CppCodeWriter : CodeWriter
{
/// <inheritdoc />
public override void WriteOpenTypeNamespace(string @namespace)
{
foreach (string subNamespace in @namespace.Split('.'))
{
WriteLine($"namespace {subNamespace}");
WriteLine("{");
}
WriteLine();
}
/// <inheritdoc />
public override void WriteCloseTypeNamespace(string @namespace)
{
WriteLine();
foreach (string subNamespace in @namespace.Split('.').Reverse())
{
WriteLine("} // end namespace " + subNamespace);
}
WriteLine();
}
/// <inheritdoc />
public override void WriteComments(CodeComment codeComment)
{
WriteLine();
foreach (string lineComment in codeComment.Summary.Split(new[] { Environment.NewLine }, StringSplitOptions.None))
{
WriteLine($"// {lineComment.Trim()}");
}
WriteLine("//");
}
/// <inheritdoc />
public override void EndVisitType(Type sourceType)
{
IndentationLevel--;
WriteLine("}; // end type " + sourceType.Name);
WriteLine();
}
/// <inheritdoc />
public override string FilePostfix => "_base.h";
}
}
| 29.414286 | 126 | 0.492472 | [
"MIT"
] | curino/MLOS | source/Mlos.SettingsSystem.CodeGen/CodeWriters/CppCodeWriter.cs | 2,059 | C# |
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// -----------------------------------------------
//
// This file is automatically generated
// Please do not edit these files manually
// Run the following in the root of the repos:
//
// *NIX : ./build.sh codegen
// Windows : build.bat codegen
//
// -----------------------------------------------
// ReSharper disable RedundantUsingDirective
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using Elasticsearch.Net;
using Elasticsearch.Net.Utf8Json;
using Elasticsearch.Net.Specification.SecurityApi;
// ReSharper disable RedundantBaseConstructorCall
// ReSharper disable UnusedTypeParameter
// ReSharper disable PartialMethodWithSinglePart
// ReSharper disable RedundantNameQualifier
namespace Nest
{
///<summary>Descriptor for Authenticate <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html</para></summary>
public partial class AuthenticateDescriptor : RequestDescriptorBase<AuthenticateDescriptor, AuthenticateRequestParameters, IAuthenticateRequest>, IAuthenticateRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityAuthenticate;
// values part of the url path
// Request parameters
}
///<summary>Descriptor for ChangePassword <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html</para></summary>
public partial class ChangePasswordDescriptor : RequestDescriptorBase<ChangePasswordDescriptor, ChangePasswordRequestParameters, IChangePasswordRequest>, IChangePasswordRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityChangePassword;
///<summary>/_security/user/{username}/_password</summary>
///<param name = "username">Optional, accepts null</param>
public ChangePasswordDescriptor(Name username): base(r => r.Optional("username", username))
{
}
///<summary>/_security/user/_password</summary>
public ChangePasswordDescriptor(): base()
{
}
// values part of the url path
Name IChangePasswordRequest.Username => Self.RouteValues.Get<Name>("username");
///<summary>The username of the user to change the password for</summary>
public ChangePasswordDescriptor Username(Name username) => Assign(username, (a, v) => a.RouteValues.Optional("username", v));
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public ChangePasswordDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for ClearCachedRealms <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html</para></summary>
public partial class ClearCachedRealmsDescriptor : RequestDescriptorBase<ClearCachedRealmsDescriptor, ClearCachedRealmsRequestParameters, IClearCachedRealmsRequest>, IClearCachedRealmsRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityClearCachedRealms;
///<summary>/_security/realm/{realms}/_clear_cache</summary>
///<param name = "realms">this parameter is required</param>
public ClearCachedRealmsDescriptor(Names realms): base(r => r.Required("realms", realms))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected ClearCachedRealmsDescriptor(): base()
{
}
// values part of the url path
Names IClearCachedRealmsRequest.Realms => Self.RouteValues.Get<Names>("realms");
// Request parameters
///<summary>Comma-separated list of usernames to clear from the cache</summary>
public ClearCachedRealmsDescriptor Usernames(params string[] usernames) => Qs("usernames", usernames);
}
///<summary>Descriptor for ClearCachedRoles <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html</para></summary>
public partial class ClearCachedRolesDescriptor : RequestDescriptorBase<ClearCachedRolesDescriptor, ClearCachedRolesRequestParameters, IClearCachedRolesRequest>, IClearCachedRolesRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityClearCachedRoles;
///<summary>/_security/role/{name}/_clear_cache</summary>
///<param name = "name">this parameter is required</param>
public ClearCachedRolesDescriptor(Names name): base(r => r.Required("name", name))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected ClearCachedRolesDescriptor(): base()
{
}
// values part of the url path
Names IClearCachedRolesRequest.Name => Self.RouteValues.Get<Names>("name");
// Request parameters
}
///<summary>Descriptor for CreateApiKey <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html</para></summary>
public partial class CreateApiKeyDescriptor : RequestDescriptorBase<CreateApiKeyDescriptor, CreateApiKeyRequestParameters, ICreateApiKeyRequest>, ICreateApiKeyRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityCreateApiKey;
// values part of the url path
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public CreateApiKeyDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for DeletePrivileges <para>TODO</para></summary>
public partial class DeletePrivilegesDescriptor : RequestDescriptorBase<DeletePrivilegesDescriptor, DeletePrivilegesRequestParameters, IDeletePrivilegesRequest>, IDeletePrivilegesRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityDeletePrivileges;
///<summary>/_security/privilege/{application}/{name}</summary>
///<param name = "application">this parameter is required</param>
///<param name = "name">this parameter is required</param>
public DeletePrivilegesDescriptor(Name application, Name name): base(r => r.Required("application", application).Required("name", name))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected DeletePrivilegesDescriptor(): base()
{
}
// values part of the url path
Name IDeletePrivilegesRequest.Application => Self.RouteValues.Get<Name>("application");
Name IDeletePrivilegesRequest.Name => Self.RouteValues.Get<Name>("name");
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public DeletePrivilegesDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for DeleteRole <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html</para></summary>
public partial class DeleteRoleDescriptor : RequestDescriptorBase<DeleteRoleDescriptor, DeleteRoleRequestParameters, IDeleteRoleRequest>, IDeleteRoleRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityDeleteRole;
///<summary>/_security/role/{name}</summary>
///<param name = "name">this parameter is required</param>
public DeleteRoleDescriptor(Name name): base(r => r.Required("name", name))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected DeleteRoleDescriptor(): base()
{
}
// values part of the url path
Name IDeleteRoleRequest.Name => Self.RouteValues.Get<Name>("name");
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public DeleteRoleDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for DeleteRoleMapping <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html</para></summary>
public partial class DeleteRoleMappingDescriptor : RequestDescriptorBase<DeleteRoleMappingDescriptor, DeleteRoleMappingRequestParameters, IDeleteRoleMappingRequest>, IDeleteRoleMappingRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityDeleteRoleMapping;
///<summary>/_security/role_mapping/{name}</summary>
///<param name = "name">this parameter is required</param>
public DeleteRoleMappingDescriptor(Name name): base(r => r.Required("name", name))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected DeleteRoleMappingDescriptor(): base()
{
}
// values part of the url path
Name IDeleteRoleMappingRequest.Name => Self.RouteValues.Get<Name>("name");
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public DeleteRoleMappingDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for DeleteUser <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-user.html</para></summary>
public partial class DeleteUserDescriptor : RequestDescriptorBase<DeleteUserDescriptor, DeleteUserRequestParameters, IDeleteUserRequest>, IDeleteUserRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityDeleteUser;
///<summary>/_security/user/{username}</summary>
///<param name = "username">this parameter is required</param>
public DeleteUserDescriptor(Name username): base(r => r.Required("username", username))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected DeleteUserDescriptor(): base()
{
}
// values part of the url path
Name IDeleteUserRequest.Username => Self.RouteValues.Get<Name>("username");
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public DeleteUserDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for DisableUser <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html</para></summary>
public partial class DisableUserDescriptor : RequestDescriptorBase<DisableUserDescriptor, DisableUserRequestParameters, IDisableUserRequest>, IDisableUserRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityDisableUser;
///<summary>/_security/user/{username}/_disable</summary>
///<param name = "username">this parameter is required</param>
public DisableUserDescriptor(Name username): base(r => r.Required("username", username))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected DisableUserDescriptor(): base()
{
}
// values part of the url path
Name IDisableUserRequest.Username => Self.RouteValues.Get<Name>("username");
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public DisableUserDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for EnableUser <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html</para></summary>
public partial class EnableUserDescriptor : RequestDescriptorBase<EnableUserDescriptor, EnableUserRequestParameters, IEnableUserRequest>, IEnableUserRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityEnableUser;
///<summary>/_security/user/{username}/_enable</summary>
///<param name = "username">this parameter is required</param>
public EnableUserDescriptor(Name username): base(r => r.Required("username", username))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected EnableUserDescriptor(): base()
{
}
// values part of the url path
Name IEnableUserRequest.Username => Self.RouteValues.Get<Name>("username");
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public EnableUserDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for GetApiKey <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html</para></summary>
public partial class GetApiKeyDescriptor : RequestDescriptorBase<GetApiKeyDescriptor, GetApiKeyRequestParameters, IGetApiKeyRequest>, IGetApiKeyRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityGetApiKey;
// values part of the url path
// Request parameters
///<summary>API key id of the API key to be retrieved</summary>
public GetApiKeyDescriptor Id(string id) => Qs("id", id);
///<summary>API key name of the API key to be retrieved</summary>
public GetApiKeyDescriptor Name(string name) => Qs("name", name);
///<summary>realm name of the user who created this API key to be retrieved</summary>
public GetApiKeyDescriptor RealmName(string realmname) => Qs("realm_name", realmname);
///<summary>user name of the user who created this API key to be retrieved</summary>
public GetApiKeyDescriptor Username(string username) => Qs("username", username);
}
///<summary>Descriptor for GetPrivileges <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html</para></summary>
public partial class GetPrivilegesDescriptor : RequestDescriptorBase<GetPrivilegesDescriptor, GetPrivilegesRequestParameters, IGetPrivilegesRequest>, IGetPrivilegesRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityGetPrivileges;
///<summary>/_security/privilege</summary>
public GetPrivilegesDescriptor(): base()
{
}
///<summary>/_security/privilege/{application}</summary>
///<param name = "application">Optional, accepts null</param>
public GetPrivilegesDescriptor(Name application): base(r => r.Optional("application", application))
{
}
///<summary>/_security/privilege/{application}/{name}</summary>
///<param name = "application">Optional, accepts null</param>
///<param name = "name">Optional, accepts null</param>
public GetPrivilegesDescriptor(Name application, Name name): base(r => r.Optional("application", application).Optional("name", name))
{
}
// values part of the url path
Name IGetPrivilegesRequest.Application => Self.RouteValues.Get<Name>("application");
Name IGetPrivilegesRequest.Name => Self.RouteValues.Get<Name>("name");
///<summary>Application name</summary>
public GetPrivilegesDescriptor Application(Name application) => Assign(application, (a, v) => a.RouteValues.Optional("application", v));
///<summary>Privilege name</summary>
public GetPrivilegesDescriptor Name(Name name) => Assign(name, (a, v) => a.RouteValues.Optional("name", v));
// Request parameters
}
///<summary>Descriptor for GetRole <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html</para></summary>
public partial class GetRoleDescriptor : RequestDescriptorBase<GetRoleDescriptor, GetRoleRequestParameters, IGetRoleRequest>, IGetRoleRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityGetRole;
///<summary>/_security/role/{name}</summary>
///<param name = "name">Optional, accepts null</param>
public GetRoleDescriptor(Name name): base(r => r.Optional("name", name))
{
}
///<summary>/_security/role</summary>
public GetRoleDescriptor(): base()
{
}
// values part of the url path
Name IGetRoleRequest.Name => Self.RouteValues.Get<Name>("name");
///<summary>Role name</summary>
public GetRoleDescriptor Name(Name name) => Assign(name, (a, v) => a.RouteValues.Optional("name", v));
// Request parameters
}
///<summary>Descriptor for GetRoleMapping <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html</para></summary>
public partial class GetRoleMappingDescriptor : RequestDescriptorBase<GetRoleMappingDescriptor, GetRoleMappingRequestParameters, IGetRoleMappingRequest>, IGetRoleMappingRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityGetRoleMapping;
///<summary>/_security/role_mapping/{name}</summary>
///<param name = "name">Optional, accepts null</param>
public GetRoleMappingDescriptor(Name name): base(r => r.Optional("name", name))
{
}
///<summary>/_security/role_mapping</summary>
public GetRoleMappingDescriptor(): base()
{
}
// values part of the url path
Name IGetRoleMappingRequest.Name => Self.RouteValues.Get<Name>("name");
///<summary>Role-Mapping name</summary>
public GetRoleMappingDescriptor Name(Name name) => Assign(name, (a, v) => a.RouteValues.Optional("name", v));
// Request parameters
}
///<summary>Descriptor for GetUserAccessToken <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html</para></summary>
public partial class GetUserAccessTokenDescriptor : RequestDescriptorBase<GetUserAccessTokenDescriptor, GetUserAccessTokenRequestParameters, IGetUserAccessTokenRequest>, IGetUserAccessTokenRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityGetUserAccessToken;
// values part of the url path
// Request parameters
}
///<summary>Descriptor for GetUser <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html</para></summary>
public partial class GetUserDescriptor : RequestDescriptorBase<GetUserDescriptor, GetUserRequestParameters, IGetUserRequest>, IGetUserRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityGetUser;
///<summary>/_security/user/{username}</summary>
///<param name = "username">Optional, accepts null</param>
public GetUserDescriptor(Names username): base(r => r.Optional("username", username))
{
}
///<summary>/_security/user</summary>
public GetUserDescriptor(): base()
{
}
// values part of the url path
Names IGetUserRequest.Username => Self.RouteValues.Get<Names>("username");
///<summary>A comma-separated list of usernames</summary>
public GetUserDescriptor Username(Names username) => Assign(username, (a, v) => a.RouteValues.Optional("username", v));
// Request parameters
}
///<summary>Descriptor for GetUserPrivileges <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html</para></summary>
public partial class GetUserPrivilegesDescriptor : RequestDescriptorBase<GetUserPrivilegesDescriptor, GetUserPrivilegesRequestParameters, IGetUserPrivilegesRequest>, IGetUserPrivilegesRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityGetUserPrivileges;
// values part of the url path
// Request parameters
}
///<summary>Descriptor for HasPrivileges <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html</para></summary>
public partial class HasPrivilegesDescriptor : RequestDescriptorBase<HasPrivilegesDescriptor, HasPrivilegesRequestParameters, IHasPrivilegesRequest>, IHasPrivilegesRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityHasPrivileges;
///<summary>/_security/user/_has_privileges</summary>
public HasPrivilegesDescriptor(): base()
{
}
///<summary>/_security/user/{user}/_has_privileges</summary>
///<param name = "user">Optional, accepts null</param>
public HasPrivilegesDescriptor(Name user): base(r => r.Optional("user", user))
{
}
// values part of the url path
Name IHasPrivilegesRequest.User => Self.RouteValues.Get<Name>("user");
///<summary>Username</summary>
public HasPrivilegesDescriptor User(Name user) => Assign(user, (a, v) => a.RouteValues.Optional("user", v));
// Request parameters
}
///<summary>Descriptor for InvalidateApiKey <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html</para></summary>
public partial class InvalidateApiKeyDescriptor : RequestDescriptorBase<InvalidateApiKeyDescriptor, InvalidateApiKeyRequestParameters, IInvalidateApiKeyRequest>, IInvalidateApiKeyRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityInvalidateApiKey;
// values part of the url path
// Request parameters
}
///<summary>Descriptor for InvalidateUserAccessToken <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html</para></summary>
public partial class InvalidateUserAccessTokenDescriptor : RequestDescriptorBase<InvalidateUserAccessTokenDescriptor, InvalidateUserAccessTokenRequestParameters, IInvalidateUserAccessTokenRequest>, IInvalidateUserAccessTokenRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityInvalidateUserAccessToken;
// values part of the url path
// Request parameters
}
///<summary>Descriptor for PutPrivileges <para>TODO</para></summary>
public partial class PutPrivilegesDescriptor : RequestDescriptorBase<PutPrivilegesDescriptor, PutPrivilegesRequestParameters, IPutPrivilegesRequest>, IPutPrivilegesRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityPutPrivileges;
// values part of the url path
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public PutPrivilegesDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for PutRole <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html</para></summary>
public partial class PutRoleDescriptor : RequestDescriptorBase<PutRoleDescriptor, PutRoleRequestParameters, IPutRoleRequest>, IPutRoleRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityPutRole;
///<summary>/_security/role/{name}</summary>
///<param name = "name">this parameter is required</param>
public PutRoleDescriptor(Name name): base(r => r.Required("name", name))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected PutRoleDescriptor(): base()
{
}
// values part of the url path
Name IPutRoleRequest.Name => Self.RouteValues.Get<Name>("name");
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public PutRoleDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for PutRoleMapping <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role-mapping.html</para></summary>
public partial class PutRoleMappingDescriptor : RequestDescriptorBase<PutRoleMappingDescriptor, PutRoleMappingRequestParameters, IPutRoleMappingRequest>, IPutRoleMappingRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityPutRoleMapping;
///<summary>/_security/role_mapping/{name}</summary>
///<param name = "name">this parameter is required</param>
public PutRoleMappingDescriptor(Name name): base(r => r.Required("name", name))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected PutRoleMappingDescriptor(): base()
{
}
// values part of the url path
Name IPutRoleMappingRequest.Name => Self.RouteValues.Get<Name>("name");
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public PutRoleMappingDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for PutUser <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html</para></summary>
public partial class PutUserDescriptor : RequestDescriptorBase<PutUserDescriptor, PutUserRequestParameters, IPutUserRequest>, IPutUserRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityPutUser;
///<summary>/_security/user/{username}</summary>
///<param name = "username">this parameter is required</param>
public PutUserDescriptor(Name username): base(r => r.Required("username", username))
{
}
///<summary>Used for serialization purposes, making sure we have a parameterless constructor</summary>
[SerializationConstructor]
protected PutUserDescriptor(): base()
{
}
// values part of the url path
Name IPutUserRequest.Username => Self.RouteValues.Get<Name>("username");
// Request parameters
///<summary>If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.</summary>
public PutUserDescriptor Refresh(Refresh? refresh) => Qs("refresh", refresh);
}
///<summary>Descriptor for GetCertificates <para>https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html</para></summary>
public partial class GetCertificatesDescriptor : RequestDescriptorBase<GetCertificatesDescriptor, GetCertificatesRequestParameters, IGetCertificatesRequest>, IGetCertificatesRequest
{
internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityGetCertificates;
// values part of the url path
// Request parameters
}
} | 53.483431 | 246 | 0.758173 | [
"Apache-2.0"
] | AnthAbou/elasticsearch-net | src/Nest/Descriptors.Security.cs | 27,883 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNextGen.Network.V20190601
{
/// <summary>
/// Azure Firewall resource.
/// </summary>
[AzureNextGenResourceType("azure-nextgen:network/v20190601:AzureFirewall")]
public partial class AzureFirewall : Pulumi.CustomResource
{
/// <summary>
/// Collection of application rule collections used by Azure Firewall.
/// </summary>
[Output("applicationRuleCollections")]
public Output<ImmutableArray<Outputs.AzureFirewallApplicationRuleCollectionResponse>> ApplicationRuleCollections { get; private set; } = null!;
/// <summary>
/// Gets a unique read-only string that changes whenever the resource is updated.
/// </summary>
[Output("etag")]
public Output<string> Etag { get; private set; } = null!;
/// <summary>
/// The firewallPolicy associated with this azure firewall.
/// </summary>
[Output("firewallPolicy")]
public Output<Outputs.SubResourceResponse?> FirewallPolicy { get; private set; } = null!;
/// <summary>
/// IP addresses associated with AzureFirewall.
/// </summary>
[Output("hubIpAddresses")]
public Output<Outputs.HubIPAddressesResponse> HubIpAddresses { get; private set; } = null!;
/// <summary>
/// IP configuration of the Azure Firewall resource.
/// </summary>
[Output("ipConfigurations")]
public Output<ImmutableArray<Outputs.AzureFirewallIPConfigurationResponse>> IpConfigurations { get; private set; } = null!;
/// <summary>
/// Resource location.
/// </summary>
[Output("location")]
public Output<string?> Location { get; private set; } = null!;
/// <summary>
/// Resource name.
/// </summary>
[Output("name")]
public Output<string> Name { get; private set; } = null!;
/// <summary>
/// Collection of NAT rule collections used by Azure Firewall.
/// </summary>
[Output("natRuleCollections")]
public Output<ImmutableArray<Outputs.AzureFirewallNatRuleCollectionResponse>> NatRuleCollections { get; private set; } = null!;
/// <summary>
/// Collection of network rule collections used by Azure Firewall.
/// </summary>
[Output("networkRuleCollections")]
public Output<ImmutableArray<Outputs.AzureFirewallNetworkRuleCollectionResponse>> NetworkRuleCollections { get; private set; } = null!;
/// <summary>
/// The provisioning state of the resource.
/// </summary>
[Output("provisioningState")]
public Output<string> ProvisioningState { get; private set; } = null!;
/// <summary>
/// Resource tags.
/// </summary>
[Output("tags")]
public Output<ImmutableDictionary<string, string>?> Tags { get; private set; } = null!;
/// <summary>
/// The operation mode for Threat Intelligence.
/// </summary>
[Output("threatIntelMode")]
public Output<string?> ThreatIntelMode { get; private set; } = null!;
/// <summary>
/// Resource type.
/// </summary>
[Output("type")]
public Output<string> Type { get; private set; } = null!;
/// <summary>
/// The virtualHub to which the firewall belongs.
/// </summary>
[Output("virtualHub")]
public Output<Outputs.SubResourceResponse?> VirtualHub { get; private set; } = null!;
/// <summary>
/// A list of availability zones denoting where the resource needs to come from.
/// </summary>
[Output("zones")]
public Output<ImmutableArray<string>> Zones { get; private set; } = null!;
/// <summary>
/// Create a AzureFirewall 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 AzureFirewall(string name, AzureFirewallArgs args, CustomResourceOptions? options = null)
: base("azure-nextgen:network/v20190601:AzureFirewall", name, args ?? new AzureFirewallArgs(), MakeResourceOptions(options, ""))
{
}
private AzureFirewall(string name, Input<string> id, CustomResourceOptions? options = null)
: base("azure-nextgen:network/v20190601:AzureFirewall", 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:network:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/latest:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20180401:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20180601:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20180701:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20180801:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20181001:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20181101:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20181201:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20190201:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20190401:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20190701:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20190801:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20190901:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20191101:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20191201:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20200301:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20200401:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20200501:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20200601:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20200701:AzureFirewall"},
new Pulumi.Alias { Type = "azure-nextgen:network/v20200801:AzureFirewall"},
},
};
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 AzureFirewall 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 AzureFirewall Get(string name, Input<string> id, CustomResourceOptions? options = null)
{
return new AzureFirewall(name, id, options);
}
}
public sealed class AzureFirewallArgs : Pulumi.ResourceArgs
{
[Input("applicationRuleCollections")]
private InputList<Inputs.AzureFirewallApplicationRuleCollectionArgs>? _applicationRuleCollections;
/// <summary>
/// Collection of application rule collections used by Azure Firewall.
/// </summary>
public InputList<Inputs.AzureFirewallApplicationRuleCollectionArgs> ApplicationRuleCollections
{
get => _applicationRuleCollections ?? (_applicationRuleCollections = new InputList<Inputs.AzureFirewallApplicationRuleCollectionArgs>());
set => _applicationRuleCollections = value;
}
/// <summary>
/// The name of the Azure Firewall.
/// </summary>
[Input("azureFirewallName")]
public Input<string>? AzureFirewallName { get; set; }
/// <summary>
/// The firewallPolicy associated with this azure firewall.
/// </summary>
[Input("firewallPolicy")]
public Input<Inputs.SubResourceArgs>? FirewallPolicy { get; set; }
/// <summary>
/// Resource ID.
/// </summary>
[Input("id")]
public Input<string>? Id { get; set; }
[Input("ipConfigurations")]
private InputList<Inputs.AzureFirewallIPConfigurationArgs>? _ipConfigurations;
/// <summary>
/// IP configuration of the Azure Firewall resource.
/// </summary>
public InputList<Inputs.AzureFirewallIPConfigurationArgs> IpConfigurations
{
get => _ipConfigurations ?? (_ipConfigurations = new InputList<Inputs.AzureFirewallIPConfigurationArgs>());
set => _ipConfigurations = value;
}
/// <summary>
/// Resource location.
/// </summary>
[Input("location")]
public Input<string>? Location { get; set; }
[Input("natRuleCollections")]
private InputList<Inputs.AzureFirewallNatRuleCollectionArgs>? _natRuleCollections;
/// <summary>
/// Collection of NAT rule collections used by Azure Firewall.
/// </summary>
public InputList<Inputs.AzureFirewallNatRuleCollectionArgs> NatRuleCollections
{
get => _natRuleCollections ?? (_natRuleCollections = new InputList<Inputs.AzureFirewallNatRuleCollectionArgs>());
set => _natRuleCollections = value;
}
[Input("networkRuleCollections")]
private InputList<Inputs.AzureFirewallNetworkRuleCollectionArgs>? _networkRuleCollections;
/// <summary>
/// Collection of network rule collections used by Azure Firewall.
/// </summary>
public InputList<Inputs.AzureFirewallNetworkRuleCollectionArgs> NetworkRuleCollections
{
get => _networkRuleCollections ?? (_networkRuleCollections = new InputList<Inputs.AzureFirewallNetworkRuleCollectionArgs>());
set => _networkRuleCollections = value;
}
/// <summary>
/// The name of the resource group.
/// </summary>
[Input("resourceGroupName", required: true)]
public Input<string> ResourceGroupName { get; set; } = null!;
[Input("tags")]
private InputMap<string>? _tags;
/// <summary>
/// Resource tags.
/// </summary>
public InputMap<string> Tags
{
get => _tags ?? (_tags = new InputMap<string>());
set => _tags = value;
}
/// <summary>
/// The operation mode for Threat Intelligence.
/// </summary>
[Input("threatIntelMode")]
public InputUnion<string, Pulumi.AzureNextGen.Network.V20190601.AzureFirewallThreatIntelMode>? ThreatIntelMode { get; set; }
/// <summary>
/// The virtualHub to which the firewall belongs.
/// </summary>
[Input("virtualHub")]
public Input<Inputs.SubResourceArgs>? VirtualHub { get; set; }
[Input("zones")]
private InputList<string>? _zones;
/// <summary>
/// A list of availability zones denoting where the resource needs to come from.
/// </summary>
public InputList<string> Zones
{
get => _zones ?? (_zones = new InputList<string>());
set => _zones = value;
}
public AzureFirewallArgs()
{
}
}
}
| 42.882155 | 151 | 0.611495 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/dotnet/Network/V20190601/AzureFirewall.cs | 12,736 | C# |
using UnityEngine;
using System.Collections;
using System.Runtime.Serialization;
public class SingleManager : MonoBehaviour {
public GameObject Scroll;
// Use this for initialization
void Start () {
}
// Update is called once per frame
public void Export() {
var selectedObject = Scroll.GetComponent<ModelScrollLayout>().GetSelectModel();
var patchManager = selectedObject.GetComponent<PatchCreator>();
patchManager.Export();
}
}
| 20.5 | 87 | 0.691057 | [
"MIT"
] | zackszhu/SE340_HCI | patchCreator/Assets/Scripts/SingleManager.cs | 494 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// このコードはツールによって生成されました。
// ランタイム バージョン:4.0.30319.42000
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします。
// </auto-generated>
//------------------------------------------------------------------------------
namespace MieStringMarger.Properties {
using System;
/// <summary>
/// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
/// </summary>
// このクラスは StronglyTypedResourceBuilder クラスが ResGen
// または Visual Studio のようなツールを使用して自動生成されました。
// メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
// ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.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>
/// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MieStringMarger.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします
/// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// <?xml version="1.0" encoding="utf-8"?>
///<Language>
/// <Name>japanese</Name>
/// <SteamAPICode>japanese</SteamAPICode>
/// <GUIString>Japanese</GUIString>
///</Language> に類似しているローカライズされた文字列を検索します。
/// </summary>
internal static string language_jp {
get {
return ResourceManager.GetString("language_jp", resourceCulture);
}
}
/// <summary>
/// <?xml version="1.0" encoding="utf-8"?>
///<Language>
/// <Name>jpr</Name>
/// <SteamAPICode>japanese</SteamAPICode>
/// <GUIString>Japanese with RederenceID</GUIString>
///</Language> に類似しているローカライズされた文字列を検索します。
/// </summary>
internal static string language_jpr {
get {
return ResourceManager.GetString("language_jpr", resourceCulture);
}
}
}
}
| 41.586957 | 182 | 0.577104 | [
"MIT"
] | synctam/PoE2JpModTools | MieStringMarger/Properties/Resources.Designer.cs | 4,562 | C# |
namespace MvcTemplate.Web.Controllers
{
using System.Web.Mvc;
public class HomeController : BaseController
{
public ActionResult Index()
{
return this.View();
}
}
}
| 16.846154 | 48 | 0.579909 | [
"MIT"
] | Abhinavchamallamudi/ASP.NET-MVC-Template | ASP.NET MVC 5/Web/MvcTemplate.Web/Controllers/HomeController.cs | 221 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the logs-2014-03-28.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.CloudWatchLogs.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.CloudWatchLogs.Model.Internal.MarshallTransformations
{
/// <summary>
/// AssociateKmsKey Request Marshaller
/// </summary>
public class AssociateKmsKeyRequestMarshaller : IMarshaller<IRequest, AssociateKmsKeyRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((AssociateKmsKeyRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(AssociateKmsKeyRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.CloudWatchLogs");
string target = "Logs_20140328.AssociateKmsKey";
request.Headers["X-Amz-Target"] = target;
request.Headers["Content-Type"] = "application/x-amz-json-1.1";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2014-03-28";
request.HttpMethod = "POST";
request.ResourcePath = "/";
request.MarshallerVersion = 2;
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetKmsKeyId())
{
context.Writer.WritePropertyName("kmsKeyId");
context.Writer.Write(publicRequest.KmsKeyId);
}
if(publicRequest.IsSetLogGroupName())
{
context.Writer.WritePropertyName("logGroupName");
context.Writer.Write(publicRequest.LogGroupName);
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static AssociateKmsKeyRequestMarshaller _instance = new AssociateKmsKeyRequestMarshaller();
internal static AssociateKmsKeyRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static AssociateKmsKeyRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 35.414414 | 145 | 0.623251 | [
"Apache-2.0"
] | DetlefGolze/aws-sdk-net | sdk/src/Services/CloudWatchLogs/Generated/Model/Internal/MarshallTransformations/AssociateKmsKeyRequestMarshaller.cs | 3,931 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MediatR;
using Microsoft.EntityFrameworkCore;
using Module.Catalog.Core.Abstractions;
using Module.Catalog.Core.Entities;
namespace Module.Catalog.Core.Queries;
public class GetAllBrandsQuery : IRequest<IEnumerable<Brand>>
{
}
internal class BrandQueryHandler : IRequestHandler<GetAllBrandsQuery, IEnumerable<Brand>>
{
private readonly ICatalogDbContext _context;
public BrandQueryHandler(ICatalogDbContext context)
{
_context = context;
}
public async Task<IEnumerable<Brand>> Handle(GetAllBrandsQuery request, CancellationToken cancellationToken)
{
var brands = await _context.Brands.OrderBy(x => x.Id).ToListAsync(cancellationToken: cancellationToken);
if (brands == null) throw new Exception("Brands Not Found!");
return brands;
}
}
| 28.030303 | 112 | 0.76 | [
"MIT"
] | mirusser/Learning-dontNet | src/ModularMonolithDemo/Module.Catalog.Core/Queries/GetAllBrandsQuery.cs | 927 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Extensions
{
static class MyExtensions
{
public static void DisplayDefiningAssembly(this object obj)
{
Console.WriteLine($"{obj.GetType().Name} lives here: => " +
Assembly.GetAssembly(obj.GetType()).GetName().Name);
}
public static int ReverseDigits(this int i)
{
char[] digits = i.ToString().ToCharArray();
Array.Reverse(digits);
return int.Parse(new String(digits));
}
}
}
| 23.428571 | 71 | 0.612805 | [
"MIT"
] | GreedNeSS/ExtensionMethods-and-InterfaceExtension | ExtensionMethods/MyExtensions.cs | 658 | C# |
using System;
using System.Threading.Tasks;
using Exceptionless.Core.Plugins.EventProcessor;
using Exceptionless.DateTimeExtensions;
using Foundatio.Utility;
using Microsoft.Extensions.Logging;
namespace Exceptionless.Core.Pipeline {
[Priority(1)]
public class CheckEventDateAction : EventPipelineActionBase {
public CheckEventDateAction(ILoggerFactory loggerFactory = null) : base(loggerFactory) {
ContinueOnError = true;
}
public override Task ProcessAsync(EventContext ctx) {
// If the date is in the future, set it to now using the same offset.
if (SystemClock.UtcNow.IsBefore(ctx.Event.Date.UtcDateTime))
ctx.Event.Date = ctx.Event.Date.Subtract(ctx.Event.Date.UtcDateTime - SystemClock.OffsetUtcNow);
// Discard events that are being submitted outside of the plan retention limit.
double eventAgeInDays = SystemClock.UtcNow.Subtract(ctx.Event.Date.UtcDateTime).TotalDays;
if (eventAgeInDays > 3 || ctx.Organization.RetentionDays > 0 && eventAgeInDays > ctx.Organization.RetentionDays) {
if (_logger.IsEnabled(LogLevel.Warning))
_logger.LogWarning("Discarding event that occurred more than three days ago or outside of your retention limit.");
ctx.IsCancelled = true;
}
return Task.CompletedTask;
}
}
} | 45.806452 | 134 | 0.687324 | [
"Apache-2.0"
] | ChanneForZM/Exceptionless | src/Exceptionless.Core/Pipeline/001_CheckEventDateAction.cs | 1,422 | C# |
//
// Code generated by a template.
//
using System;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
namespace CCLLC.CDS.Sdk.Metadata.Proxy
{
[EntityLogicalName("sdkmessagepair")]
public partial class SdkMessagePair : Entity
{
public static string EntityLogicalName => "sdkmessagepair";
public SdkMessagePair()
: base("sdkmessagepair") {}
#region Late Bound Field Constants
public class Fields
{
public const string Id = "sdkmessagepairid";
public const string Namespace = "namespace";
public const string ComponentState = "componentstate";
public const string CreatedBy = "createdby";
public const string CreatedOn = "createdon";
public const string CreatedOnBehalfBy = "createdonbehalfby";
public const string CreatedOnBehalfByName = "createdonbehalfbyname";
public const string CreatedOnBehalfByYomiName = "createdonbehalfbyyominame";
public const string CustomizationLevel = "customizationlevel";
public const string DeprecatedVersion = "deprecatedversion";
public const string Endpoint = "endpoint";
public const string IntroducedVersion = "introducedversion";
public const string IsManaged = "ismanaged";
public const string IsManagedName = "ismanagedname";
public const string ModifiedBy = "modifiedby";
public const string ModifiedOn = "modifiedon";
public const string ModifiedOnBehalfBy = "modifiedonbehalfby";
public const string ModifiedOnBehalfByName = "modifiedonbehalfbyname";
public const string ModifiedOnBehalfByYomiName = "modifiedonbehalfbyyominame";
public const string OrganizationId = "organizationid";
public const string OverwriteTime = "overwritetime";
public const string SdkMessageBindingInformation = "sdkmessagebindinginformation";
public const string SdkMessageId = "sdkmessageid";
public const string SdkMessagePairId = "sdkmessagepairid";
public const string SdkMessagePairIdUnique = "sdkmessagepairidunique";
public const string SolutionId = "solutionid";
public const string SupportingSolutionId = "supportingsolutionid";
public const string VersionNumber = "versionnumber";
}
#endregion
[AttributeLogicalName("sdkmessagepairid")]
public override Guid Id
{
get => base.Id;
set => SdkMessagePairId = value;
}
[AttributeLogicalName("namespace")]
public virtual string Namespace
{
get => GetAttributeValue<string>("namespace");
set => SetAttributeValue("namespace", value);
}
[AttributeLogicalName("componentstate")]
public virtual GlobalEnums.eComponentstate? ComponentState
{
get
{
var value = GetAttributeValue<OptionSetValue>("componentstate");
if(value is null) return null;
return (GlobalEnums.eComponentstate?)value.Value;
}
}
[AttributeLogicalName("createdby")]
public virtual EntityReference CreatedBy
{
get => GetAttributeValue<EntityReference>("createdby");
}
[AttributeLogicalName("createdon")]
public virtual DateTime? CreatedOn
{
get => GetAttributeValue<DateTime>("createdon");
}
[AttributeLogicalName("createdonbehalfby")]
public virtual EntityReference CreatedOnBehalfBy
{
get => GetAttributeValue<EntityReference>("createdonbehalfby");
}
[AttributeLogicalName("createdonbehalfbyname")]
public virtual string CreatedOnBehalfByName
{
get => GetAttributeValue<string>("createdonbehalfbyname");
}
[AttributeLogicalName("createdonbehalfbyyominame")]
public virtual string CreatedOnBehalfByYomiName
{
get => GetAttributeValue<string>("createdonbehalfbyyominame");
}
[AttributeLogicalName("customizationlevel")]
public virtual int? CustomizationLevel
{
get => GetAttributeValue<int>("customizationlevel");
}
[AttributeLogicalName("deprecatedversion")]
public virtual string DeprecatedVersion
{
get => GetAttributeValue<string>("deprecatedversion");
set => SetAttributeValue("deprecatedversion", value);
}
[AttributeLogicalName("endpoint")]
public virtual string Endpoint
{
get => GetAttributeValue<string>("endpoint");
set => SetAttributeValue("endpoint", value);
}
[AttributeLogicalName("introducedversion")]
public virtual string IntroducedVersion
{
get => GetAttributeValue<string>("introducedversion");
set => SetAttributeValue("introducedversion", value);
}
[AttributeLogicalName("ismanaged")]
public virtual bool? IsManaged
{
get => GetAttributeValue<bool>("ismanaged");
}
[AttributeLogicalName("ismanagedname")]
public virtual string IsManagedName
{
get => GetAttributeValue<string>("ismanagedname");
}
[AttributeLogicalName("modifiedby")]
public virtual EntityReference ModifiedBy
{
get => GetAttributeValue<EntityReference>("modifiedby");
}
[AttributeLogicalName("modifiedon")]
public virtual DateTime? ModifiedOn
{
get => GetAttributeValue<DateTime>("modifiedon");
}
[AttributeLogicalName("modifiedonbehalfby")]
public virtual EntityReference ModifiedOnBehalfBy
{
get => GetAttributeValue<EntityReference>("modifiedonbehalfby");
}
[AttributeLogicalName("modifiedonbehalfbyname")]
public virtual string ModifiedOnBehalfByName
{
get => GetAttributeValue<string>("modifiedonbehalfbyname");
}
[AttributeLogicalName("modifiedonbehalfbyyominame")]
public virtual string ModifiedOnBehalfByYomiName
{
get => GetAttributeValue<string>("modifiedonbehalfbyyominame");
}
[AttributeLogicalName("organizationid")]
public virtual EntityReference OrganizationId
{
get => GetAttributeValue<EntityReference>("organizationid");
}
[AttributeLogicalName("overwritetime")]
public virtual DateTime? OverwriteTime
{
get => GetAttributeValue<DateTime>("overwritetime");
}
[AttributeLogicalName("sdkmessagebindinginformation")]
public virtual string SdkMessageBindingInformation
{
get => GetAttributeValue<string>("sdkmessagebindinginformation");
set => SetAttributeValue("sdkmessagebindinginformation", value);
}
[AttributeLogicalName("sdkmessageid")]
public virtual EntityReference SdkMessageId
{
get => GetAttributeValue<EntityReference>("sdkmessageid");
}
[AttributeLogicalName("sdkmessagepairid")]
public virtual Guid SdkMessagePairId
{
get => GetAttributeValue<Guid>("sdkmessagepairid");
set => SetAttributeValue("sdkmessagepairid", value);
}
[AttributeLogicalName("sdkmessagepairidunique")]
public virtual object SdkMessagePairIdUnique
{
get => GetAttributeValue<object>("sdkmessagepairidunique");
}
[AttributeLogicalName("solutionid")]
public virtual object SolutionId
{
get => GetAttributeValue<object>("solutionid");
}
[AttributeLogicalName("supportingsolutionid")]
public virtual object SupportingSolutionId
{
get => GetAttributeValue<object>("supportingsolutionid");
}
[AttributeLogicalName("versionnumber")]
public virtual int? VersionNumber
{
get => GetAttributeValue<int>("versionnumber");
}
}
}
| 33.085714 | 85 | 0.749712 | [
"MIT"
] | ScottColson/CCLLCCodeLibraries | CCLLC.CDS/SharedProjects/CCLLC.CDS.Sdk.Metadata/Proxies/SdkMessagePair.cs | 6,948 | C# |
/*
Copyright (c) 2020 SICK AG <info@sick.de>
This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace AasxDictionaryImport.Cdd
{
/// <summary>
/// Base class for all elements in the CDD hierarchy.
/// <para>
/// This class defines the common attributes for all elements in the CDD hierarchy (Code, PreferredName, Definition)
/// and provides helper methods to access the data stored in the element. The data is stored as a dictionary that
/// maps the attribute codes to the attribute values, for example {"MDC_P001_12" => "0112/2///62683#ACI081"}.
/// </para>
/// </summary>
public abstract class Element
{
private const string BaseUrl = "https://cdd.iec.ch/cdd/";
private const string UrlPathPattern = "iec{0}/iec{0}.nsf/{2}/{1}";
private static readonly Regex CodeRegex = new Regex("^0112/2///([0-9]+)(_[0-9]+)?#.*$");
private readonly Dictionary<string, string> _data;
/// <summary>
/// The ID of the element.
/// </summary>
public abstract string Code { get; }
/// <summary>
/// The version of the element.
/// </summary>
public String Version => GetString("MDC_P002_1");
/// <summary>
/// The revision of the element.
/// </summary>
public String Revision => GetString("MDC_P002_2");
/// <summary>
/// The preferred name of the element in multiple languages.
/// </summary>
public MultiString PreferredName => GetMultiString("MDC_P004_1");
/// <summary>
/// The definition of the element in multiple languages.
/// </summary>
public MultiString Definition => GetMultiString("MDC_P005");
/// <summary>
/// Creates a new Element object based on the given data.
/// </summary>
/// <param name="data">The element data as a mapping from attribute codes to attribute values</param>
protected Element(Dictionary<string, string> data)
{
_data = data;
}
/// <summary>
/// Creates a new Element object, copying the data from the given element.
/// </summary>
/// <param name="element">The element to copy the data from</param>
protected Element(Element element)
{
_data = new Dictionary<string, string>(element._data);
}
/// <summary>
/// Returns the IEC 61360 attributes for this element.
/// </summary>
/// <param name="all">Whether all attributes or only the free attributes should be used</param>
/// <returns>The IEC 61360 data for this element</returns>
public virtual Iec61360Data GetIec61360Data(bool all)
{
var data = new Iec61360Data(FormatIrdi(Code, Version))
{
PreferredName = PreferredName,
};
if (all)
data.Definition = Definition;
return data;
}
/// <summary>
/// Returns the IEC CDD domain for this element, or null if the domain could not be determined. The domain is
/// extracted from the element code, assuming that it has the format "0112/2///{domain}#{id}".
/// </summary>
/// <returns>The IEC CDD domain for this element, or null if it can't be extracted</returns>
private string? GetDomain()
{
var match = CodeRegex.Match(Code);
if (!match.Success)
return null;
return match.Groups[1].Value;
}
/// <summary>
/// Returns the URL to the IEC CDD web page for this element, or null if the URL could not be determined.
/// </summary>
/// <returns>The URL for the IEC CDD web page for this element, or null if it could not be determined</returns>
// ReSharper disable once ReturnTypeCanBeNotNullable
public Uri? GetDetailsUrl()
{
var baseUri = new Uri(BaseUrl);
var domain = GetDomain();
if (domain == null)
return null;
var code = EncodeCode();
var endpoint = GetEndpoint();
var path = String.Format(UrlPathPattern, domain, code, endpoint);
return new Uri(baseUri, path);
}
/// <summary>
/// Returns the URL-encoded code for this element.
/// </summary>
/// <returns>The URL-encoded code for this element</returns>
private string EncodeCode()
{
return Code.Replace('/', '-').Replace("#", "%23");
}
/// <summary>
/// Returns the endpoint to use when constructing the IEC CDD URL for this element. See the URL pattern in <see
/// cref="UrlPathPattern"/> for more information.
/// </summary>
/// <returns>The endpoint to use in the details URL for this element</returns>
protected abstract string GetEndpoint();
/// <inheritdoc/>
public override string ToString()
{
return Code + ": " + PreferredName;
}
protected string GetString(string key)
{
return _data[key];
}
protected MultiString GetMultiString(string key)
{
var data = new Dictionary<string, string>();
var prefix = key + ".";
foreach (var s in _data.Keys)
{
if (s.StartsWith(prefix))
data.Add(s.Substring(prefix.Length), _data[s]);
}
return new MultiString(data);
}
protected Reference<T> GetReference<T>(string key)
where T : Element
{
return new Reference<T>(GetString(key));
}
private List<string> GetList(string key)
{
var list = new List<string>();
var value = GetString(key).TrimStart('(', '{').TrimEnd(')', '}');
foreach (var part in value.Split(','))
{
var trimmedPart = part.Trim();
if (trimmedPart.Length > 0)
list.Add(trimmedPart);
}
return list;
}
protected ReferenceList<T> GetReferenceList<T>(string key)
where T : Element
{
var list = new ReferenceList<T>();
foreach (var id in GetList(key))
{
list.Add(new Reference<T>(id));
}
return list;
}
protected static string FormatIrdi(string code, string version) => $"{code}#{version.PadLeft(3, '0')}";
}
/// <summary>
/// Reference to an element in the CDD hierarchy.
/// </summary>
/// <typeparam name="T">The type of the referenced element</typeparam>
public class Reference<T> where T : Element
{
public string Code { get; }
public bool IsSet => Code.Length > 0;
public Reference(string code)
{
Code = code;
}
public T? Get(Context context)
{
return context.GetElement<T>(Code);
}
public override string ToString()
{
return Code;
}
}
/// <summary>
/// A list of references to elements in the CDD hierarchy.
/// </summary>
/// <typeparam name="T">The type of the referenced elements</typeparam>
public class ReferenceList<T> : List<Reference<T>> where T : Element
{
public List<T> Get(Context context)
{
var list = new List<T>();
foreach (var r in this)
{
var value = r.Get(context);
if (value != null)
list.Add(value);
}
return list;
}
}
/// <summary>
/// CDD class, a collection of CDD properties.
/// </summary>
// Instances of this type are created using reflection in Parser.ParseElement.
// ReSharper disable once ClassNeverInstantiated.Global
public class Class : Element
{
public override string Code => GetString("MDC_P001_5");
public string DefinitionSource => GetString("MDC_P006_1");
public Reference<Class> Superclass => GetReference<Class>("MDC_P010");
public ReferenceList<Property> Properties
=> GetReferenceList<Property>("MDC_P014");
public ReferenceList<Property> ImportedProperties
=> GetReferenceList<Property>("MDC_P090");
public Class(Dictionary<string, string> data) : base(data)
{
}
public ReferenceList<Property> GetAllProperties(Context context)
{
var properties = new ReferenceList<Property>();
properties.AddRange(Properties);
properties.AddRange(ImportedProperties);
var superclass = Superclass.Get(context);
if (superclass != null)
{
properties.AddRange(superclass.GetAllProperties(context));
}
return properties;
}
public override Iec61360Data GetIec61360Data(bool all)
{
var data = base.GetIec61360Data(all);
if (all)
data.DefinitionSource = DefinitionSource;
return data;
}
protected override string GetEndpoint()
{
return "classes";
}
}
/// <summary>
/// CDD property, either an actual property or a reference to a class that holds more properties.
/// </summary>
// Instances of this type are created using reflection in Parser.ParseElement.
// ReSharper disable once ClassNeverInstantiated.Global
public class Property : Element
{
private readonly DataType? _overrideDataType;
public override string Code => GetString("MDC_P001_6");
public MultiString ShortName => GetMultiString("MDC_P004_3");
public string DefinitionSource => GetString("MDC_P006_1");
public string Symbol => GetString("MDC_P025_1");
public string PrimaryUnit => GetString("MDC_P023");
public string UnitCode => GetString("MDC_P041");
public string RawDataType => GetString("MDC_P022");
public DataType DataType
{
get
{
if (_overrideDataType != null)
return _overrideDataType;
return DataType.ParseType(RawDataType);
}
}
public string Format => GetString("MDC_P024");
public Property(Dictionary<string, string> data) : base(data)
{
}
private Property(Property property, DataType dataType) : base(property)
{
_overrideDataType = dataType;
}
public Property ReplaceDataType(DataType dataType)
{
return new Property(this, dataType);
}
public override Iec61360Data GetIec61360Data(bool all)
{
var data = base.GetIec61360Data(all);
data.Unit = PrimaryUnit;
data.UnitIrdi = UnitCode;
data.DataFormat = Format;
data.Symbol = Symbol;
if (all)
{
data.ShortName = ShortName;
data.DefinitionSource = DefinitionSource;
data.DataType = RawDataType;
}
return data;
}
protected override string GetEndpoint()
{
return "PropertiesAllVersions";
}
}
public abstract class DataType
{
private const string TypeSuffix = "_TYPE";
private static readonly Regex TypeRegex = new Regex(@"^([^\(\)]+)(?:\((.+)\))?$");
private static readonly Regex CompositeTypeRegex = new Regex(@"^(.*) OF (.*)$");
public virtual Reference<Class>? GetClassReference()
{
return null;
}
public static DataType ParseType(string s)
{
var match = CompositeTypeRegex.Match(s);
if (match.Success)
{
var subtype = ParseType(match.Groups[2].Value);
return ParseCompositeType(match.Groups[1].Value, subtype);
}
return ParseBasicType(s);
}
private static Tuple<string, string[]>? ParseTypeNameArgs(string s)
{
var match = TypeRegex.Match(s);
if (!match.Success)
return null;
var typeName = match.Groups[1].Value.ToUpperInvariant();
var typeArgs = new string[] { };
if (match.Groups[2].Value.Length > 0)
typeArgs = match.Groups[2].Value.Split(',').Select(p => p.Trim()).ToArray();
if (typeName.EndsWith(TypeSuffix))
typeName = typeName.Substring(0, typeName.Length - TypeSuffix.Length);
return Tuple.Create(typeName, typeArgs);
}
private static DataType ParseBasicType(string s)
{
var typeTuple = ParseTypeNameArgs(s);
DataType? dataType = null;
if (typeTuple != null)
{
var typeName = typeTuple.Item1;
var typeArgs = typeTuple.Item2;
dataType ??= SimpleType.ParseType(typeName, typeArgs);
dataType ??= EnumType.ParseType(typeName, typeArgs);
dataType ??= ClassInstanceType.ParseType(typeName, typeArgs);
dataType ??= ClassReferenceType.ParseType(typeName, typeArgs);
dataType ??= LargeObjectType.ParseType(typeName, typeArgs);
dataType ??= PlacementType.ParseType(typeName, typeArgs);
}
return dataType ?? new UnknownType(s);
}
private static DataType ParseCompositeType(string s, DataType subtype)
{
var typeTuple = ParseTypeNameArgs(s);
DataType? dataType = null;
if (typeTuple != null)
{
var typeName = typeTuple.Item1;
var typeArgs = typeTuple.Item2;
dataType ??= AggregateType.ParseType(typeName, typeArgs, subtype);
dataType ??= LevelType.ParseType(typeName, typeArgs, subtype);
}
return dataType ?? new UnknownType(s);
}
protected static bool ParseTypeEnum<TEnum>(string s, out TEnum result) where TEnum : struct
{
return Enum.TryParse(s.Replace("_", String.Empty), true, out result);
}
}
public class SimpleType : DataType, IEquatable<SimpleType>
{
public Type TypeValue { get; }
public SimpleType(Type typeValue)
{
TypeValue = typeValue;
}
public bool Equals(SimpleType? type)
{
return type != null && type.TypeValue == TypeValue;
}
public override bool Equals(object? o)
{
return Equals(o as SimpleType);
}
public override int GetHashCode()
{
return TypeValue.GetHashCode();
}
public static SimpleType? ParseType(string typeName, string[] typeArgs)
{
if (typeArgs.Length != 0)
return null;
if (ParseTypeEnum(typeName, out Type innerType))
return new SimpleType(innerType);
return null;
}
public enum Type
{
Boolean,
Binary,
String,
TranslatableString,
NonTranslatableString,
DateTime,
Date,
Time,
Irdi,
Icid,
Iso29002Irdi,
Uri,
Html5,
Number,
Int,
IntMeasure,
IntCurrency,
Rational,
RationalMeasure,
Real,
RealMeasure,
RealCurrency,
}
}
public class EnumType : DataType
{
private const string EnumPrefix = "ENUM_";
public Type TypeValue { get; }
public string ReferenceCode { get; }
public EnumType(Type typeValue, string referenceCode)
{
TypeValue = typeValue;
ReferenceCode = referenceCode;
}
public static EnumType? ParseType(string typeName, string[] typeArgs)
{
if (!typeName.StartsWith(EnumPrefix))
return null;
typeName = typeName.Substring(EnumPrefix.Length);
if (typeArgs.Length != 1)
return null;
if (ParseTypeEnum(typeName, out Type innerType))
return new EnumType(innerType, typeArgs[0]);
return null;
}
public enum Type
{
Code,
Int,
Real,
String,
Rational,
Reference,
Instance,
Boolean,
}
}
public class ClassInstanceType : DataType
{
public Reference<Class> Class { get; }
public ClassInstanceType(string irdi)
{
Class = new Reference<Class>(irdi);
}
public override Reference<Class> GetClassReference() => Class;
public static ClassInstanceType? ParseType(string typeName, string[] typeArgs)
{
if (typeName == "CLASS_INSTANCE" && typeArgs.Length == 1)
{
return new ClassInstanceType(typeArgs[0]);
}
return null;
}
}
public class ClassReferenceType : DataType
{
public Reference<Class> Class { get; }
public ClassReferenceType(string irdi)
{
Class = new Reference<Class>(irdi);
}
public override Reference<Class> GetClassReference() => Class;
public static ClassReferenceType? ParseType(string typeName, string[] typeArgs)
{
if (typeName == "CLASS_REFERENCE" && typeArgs.Length == 1)
{
return new ClassReferenceType(typeArgs[0]);
}
return null;
}
}
public class AggregateType : DataType
{
/// <summary>
/// The lower bound of this aggregate type. The meaning of this value
/// depends on the TypeValue:
/// - for Bag, List, UniqueList, Set and ConstrainedSet: The lower
/// bound is the minimum number of elements in the aggregate type.
/// - for all Array types: The lower bound is the index of the first
/// element in this aggregate type. This means that there are
/// exactly UpperBound - LowerBound + 1 elements.
/// </summary>
public int LowerBound { get; }
/// <summary>
/// The upper bound of this aggregate type. The meaning of this value
/// depends on the TypeValue:
/// - for Bag, List, UniqueList, Set and ConstrainedSet: The upper
/// bound is the maximum number of elements in the aggregate type.
/// If it is set to null, there is no upper bound.
/// - for all Array types: The upper bound is the index of the last
/// element in this aggregate type. This means that there are
/// exactly UpperBound - LowerBound + 1 elements. It may not be null.
/// </summary>
public int? UpperBound { get; }
/// <summary>
/// The minimum number of elements in this aggregate type, or zero if
/// there is no lower bound for the number of elements.
/// </summary>
public int MinimumElementCount
{
get
{
switch (TypeValue)
{
case Type.Bag:
case Type.List:
case Type.UniqueList:
case Type.Set:
return LowerBound;
case Type.ConstrainedSet:
return 0;
case Type.Array:
case Type.OptionalArray:
case Type.UniqueArray:
case Type.UniqueOptionalArray:
// UpperBound may not be null for array types
if (UpperBound == null)
return 0;
return UpperBound.Value - LowerBound + 1;
default:
return 0;
}
}
}
public Type TypeValue { get; }
/// <summary>
/// The type of the elements in this aggregate type.
/// </summary>
public DataType Subtype { get; }
public AggregateType(Type typeValue, DataType subtype, int lowerBound, int? upperBound)
{
TypeValue = typeValue;
Subtype = subtype;
LowerBound = lowerBound;
UpperBound = upperBound;
}
public static AggregateType? ParseType(string typeName, string[] typeArgs, DataType subtype)
{
// We need at least the lower and upper bound as arguments.
if (typeArgs.Length < 2)
return null;
if (!Int32.TryParse(typeArgs[0], out int lowerBound))
return null;
int? upperBound = null;
if (typeArgs[1] != "?")
{
if (!Int32.TryParse(typeArgs[1], out int upperBoundValue))
return null;
upperBound = upperBoundValue;
}
if (ParseTypeEnum(typeName, out Type typeValue))
return new AggregateType(typeValue, subtype, lowerBound, upperBound);
return null;
}
public enum Type
{
Bag,
List,
UniqueList,
Set,
ConstrainedSet,
Array,
OptionalArray,
UniqueArray,
UniqueOptionalArray,
}
}
public class LevelType : DataType
{
/// <summary>
/// The types of this level property, for example {Minimum, Maximum}
/// for LEVEL(MIN,MAX) OF INT_TYPE. May not be empty.
/// </summary>
public ISet<Type> Types { get; }
/// <summary>
/// The type of the underlying property, for example
/// SimpleType(Type.Integer) for LEVEL(MIN,MAX) OF INT_TYPE.
/// </summary>
public DataType Subtype { get; }
public LevelType(ISet<Type> types, DataType subtype)
{
Types = types;
Subtype = subtype;
}
public static LevelType? ParseType(string typeName, string[] typeArgs, DataType subtype)
{
if (typeName != "LEVEL")
return null;
var types = new HashSet<Type>();
foreach (var arg in typeArgs)
{
var typeValue = ParseTypeValue(arg);
if (typeValue == null)
return null;
types.Add((Type)typeValue);
}
if (types.Count > 0)
return new LevelType(types, subtype);
return null;
}
private static Type? ParseTypeValue(string s)
{
switch (s.ToLowerInvariant())
{
case "min":
return Type.Minimum;
case "max":
return Type.Maximum;
case "typ":
return Type.Typical;
case "nom":
return Type.Nominal;
default:
return null;
}
}
/// <summary>
/// The type of a level value.
/// </summary>
public enum Type
{
Minimum,
Maximum,
Nominal,
Typical,
}
}
public class LargeObjectType : DataType
{
public static LargeObjectType? ParseType(string typeName, string[] typeArgs)
{
if (typeName == "LOB")
return new LargeObjectType();
return null;
}
}
public class PlacementType : DataType
{
public Type TypeValue { get; }
public PlacementType(Type typeValue)
{
TypeValue = typeValue;
}
public static PlacementType? ParseType(string typeName, string[] typeArgs)
{
if (ParseTypeEnum(typeName, out Type type))
return new PlacementType(type);
return null;
}
public enum Type
{
Axis1Placement2D,
Axis1Placement3D,
Axis2Placement2D,
Axis2Placement3D,
}
}
public class UnknownType : DataType
{
public UnknownType(string typeValue)
{
TypeValue = typeValue;
}
public string TypeValue { get; }
}
}
| 31.198758 | 120 | 0.536054 | [
"Apache-2.0"
] | JMayrbaeurl/aasx-package-explorer | src/AasxDictionaryImport/Cdd/Data.cs | 25,117 | C# |
namespace ExeT4Template
{
public class MyClass
{
public string AccessModifier { get; set; }
public string DataType { get; set; }
public string PropName { get; set; }
}
}
| 17.416667 | 50 | 0.593301 | [
"MIT"
] | tharopan/T4Template | ExeT4Template/MyClass.cs | 211 | C# |
using FluentAssertions;
using Mt.MediaFiles.AppEngine.Matching;
using NSubstitute;
using System.Threading.Tasks;
using Xunit;
namespace Mt.MediaFiles.AppEngine.Test.Matching
{
public class PropertyMatcherFileNameTest
{
[Fact]
public async Task Should_Produce_Neutral_Result_For_Different_File_Names()
{
var mockAccessBase = Substitute.For<IInfoPartAccess>();
mockAccessBase.GetFilePropertiesAsync(0)
.Returns(new FileProperties
{
Path = @"x:\dir1\file1.mp4"
});
var mockAccessOther = Substitute.For<IInfoPartAccess>();
mockAccessOther.GetFilePropertiesAsync(0)
.Returns(new FileProperties
{
Path = @"x:\dir2\file2.mp4"
});
var matcher = new PropertyMatcherFileName(mockAccessBase, mockAccessOther);
var result = await matcher.MatchAsync(0, 0);
result.Should().BeEquivalentTo(
new MatchOutputProperty
{
Name = "file name",
Value = "file2.mp4",
Qualification = ComparisonQualification.Neutral
});
}
}
}
| 26.609756 | 81 | 0.660862 | [
"MIT"
] | mtebenev/mediafiles | AppEngine.Test/Matching/PropertyMatcherFileNameTest.cs | 1,091 | C# |
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using MSI.Keyboard.Backlight.Utils;
using Xunit;
namespace MSI.Keyboard.Backlight.Tests
{
public class ColorEnumToRgbConverterTests
{
[Fact]
public void ToRgb_ShouldConvertToRedRgbColor()
{
//arrange
var converter = new ColorEnumToRgbConverter();
//act
var result = converter.ToRgb(Enums.Color.Red);
//assert
result.Should().NotBeNull()
.And.BeEquivalentTo(Color.Red);
}
}
}
| 24.035714 | 58 | 0.637444 | [
"MIT"
] | dpozimski/msi-keyboard-backlight | source/MSI.Keyboard.Backlight.Tests/ColorEnumToRgbConverterTests.cs | 675 | C# |
using System.Linq;
using Northwind.Data;
using EasyLOB.Persistence;
namespace Northwind.Persistence
{
public class NorthwindRegionRepositoryLINQ2DB : NorthwindGenericRepositoryLINQ2DB<Region>
{
#region Methods
public NorthwindRegionRepositoryLINQ2DB(IUnitOfWork unitOfWork)
: base(unitOfWork)
{
}
public override IQueryable<Region> Join(IQueryable<Region> query)
{
return
from region in query
select new Region
{
RegionId = region.RegionId,
RegionDescription = region.RegionDescription
};
}
#endregion Methods
}
}
| 24.290323 | 94 | 0.563081 | [
"MIT"
] | EasyLOB/EasyLOB-Northwind-1 | Northwind.PersistenceLINQ2DB/Repositories/NorthwindRegionRepositoryLINQ2DB.cs | 753 | C# |
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace Server.Model {
public sealed class GameStateModel {
[BsonId]
public string Login;
[BsonElement("state")]
public BsonDocument State;
}
}
| 17.230769 | 44 | 0.75 | [
"MIT"
] | KonH/BattlerGame | Server/Model/GameStateModel.cs | 226 | C# |
/*
* Todo
*
* Sample todo-api
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using FeatureHubSDK;
using IO.FeatureHub.SSE.Model;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using ToDoAspCoreExample.Attributes;
using ToDoAspCoreExample.Models;
using ToDoAspCoreExample.Services;
namespace ToDoAspCoreExample.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class TodoServiceApiController : ControllerBase
{
private readonly ITodoServiceRepository _todoServiceRepository;
private readonly IFeatureHubConfig _featureHub;
public TodoServiceApiController(ITodoServiceRepository todoServiceRepository, IFeatureHubConfig featureHub)
{
_todoServiceRepository = todoServiceRepository;
_featureHub = featureHub;
}
private List<Todo> GetTodosForUser(string user)
{
return _todoServiceRepository.UsersTodos(user);
}
/// <summary>
/// addTodo
/// </summary>
/// <param name="user"></param>
/// <param name="todo"></param>
/// <response code="201"></response>
[HttpPost]
[Route("/todo/{user}")]
[ValidateModelState]
[SwaggerOperation("AddTodo")]
[SwaggerResponse(statusCode: 201, type: typeof(List<Todo>), description: "")]
public virtual async Task<IActionResult> AddTodo([FromRoute] [Required] string user, [FromBody] Todo todo)
{
if (todo.Id == null)
{
todo.Id = new Guid().ToString();
}
var todos = GetTodosForUser(user);
todos.Add(todo);
var result = new ObjectResult(await TransformTodos(user, todos)) {StatusCode = 201};
return result;
}
private async Task<List<Todo>> TransformTodos(string user, List<Todo> todos)
{
var ctx = await _featureHub.NewContext().UserKey(user).Platform(StrategyAttributePlatformName.Macos)
.Build();
var t = new List<Todo>();
foreach (var todo in todos)
{
var nTodo = new Todo();
nTodo.Id = todo.Id;
nTodo.Resolved = todo.Resolved;
nTodo.Title = _ProcessTitle(ctx, todo.Title);
nTodo.When = todo.When;
t.Add(nTodo);
}
return t;
}
private string _ProcessTitle(IClientContext ctx, string title)
{
if (title == null)
{
return null;
}
if (ctx == null)
{
return title;
}
if (ctx.IsSet("FEATURE_STRING") && "buy" == title)
{
title = title + " " + ctx["FEATURE_STRING"].StringValue;
// log.debug("Processes string feature: {}", title);
}
if (ctx.IsSet("FEATURE_NUMBER") && title == "pay")
{
title = title + " " + ctx["FEATURE_NUMBER"].NumberValue.ToString();
// log.debug("Processed number feature {}", title);
}
if (ctx.IsSet("FEATURE_JSON") && title == "find")
{
var feat = JsonConvert.DeserializeObject<Dictionary<string, string>>(ctx["FEATURE_JSON"].JsonValue);
title = title + " " + (feat.ContainsKey("foo") ? feat["foo"] : "");
// log.debug("Processed JSON feature {}", title);
}
if (ctx.IsEnabled("FEATURE_TITLE_TO_UPPERCASE"))
{
title = title.ToUpper();
// log.debug("Processed boolean feature {}", title);
}
return title;
}
/// <summary>
/// listTodos
/// </summary>
/// <param name="user"></param>
/// <response code="200"></response>
[HttpGet]
[Route("/todo/{user}")]
[ValidateModelState]
[SwaggerOperation("ListTodos")]
[SwaggerResponse(statusCode: 200, type: typeof(List<Todo>), description: "")]
public virtual async Task<IActionResult> ListTodos([FromRoute] [Required] string user)
{
var todos = await TransformTodos(user, GetTodosForUser(user));
var result = new ObjectResult(todos) {StatusCode = 200};
return result;
}
/// <summary>
/// removeAll
/// </summary>
/// <param name="user"></param>
/// <response code="204"></response>
[HttpDelete]
[Route("/todo/{user}")]
[ValidateModelState]
[SwaggerOperation("RemoveAllTodos")]
public virtual IActionResult RemoveAllTodos([FromRoute] [Required] string user)
{
GetTodosForUser(user).Clear();
return StatusCode(204);
}
/// <summary>
/// removeTodo
/// </summary>
/// <param name="user"></param>
/// <param name="id"></param>
/// <response code="200"></response>
[HttpDelete]
[Route("/todo/{user}/{id}")]
[ValidateModelState]
[SwaggerOperation("RemoveTodo")]
[SwaggerResponse(statusCode: 200, type: typeof(List<Todo>), description: "")]
public virtual async Task<IActionResult> RemoveTodo([FromRoute] [Required] string user,
[FromRoute] [Required] string id)
{
var todos = GetTodosForUser(user);
todos.RemoveAll((t) => t.Id == id);
var result = new ObjectResult(await TransformTodos(user, todos)) {StatusCode = 200};
return result;
}
/// <summary>
/// resolveTodo
/// </summary>
/// <param name="id"></param>
/// <param name="user"></param>
/// <response code="200"></response>
[HttpPut]
[Route("/todo/{user}/{id}/resolve")]
[ValidateModelState]
[SwaggerOperation("ResolveTodo")]
[SwaggerResponse(statusCode: 200, type: typeof(List<Todo>), description: "")]
public virtual async Task<IActionResult> ResolveTodo([FromRoute] [Required] string id,
[FromRoute] [Required] string user)
{
var todos = GetTodosForUser(user);
foreach (var todo in todos)
{
if (todo.Id == id)
{
todo.Resolved = true;
}
}
var result = new ObjectResult(await TransformTodos(user, todos)) {StatusCode = 200};
return result;
}
}
}
| 32.216981 | 116 | 0.542313 | [
"MIT"
] | LeaseQuery/featurehub-dotnet-sdk | ToDoAspCoreExample/src/ToDoAspCoreExample/Controllers/TodoServiceApi.cs | 6,830 | C# |
using DotNetty.Codecs.Http.WebSockets;
using DotNetty.Transport.Channels;
using System;
using System.Threading.Tasks;
namespace ONetworkTalk.Websocket
{
class WebSocketConnection : BaseTcpSocketConnection<IWebSocketServer, IWebSocketConnection, string>, IWebSocketConnection
{
#region 构造函数
public WebSocketConnection(IWebSocketServer server, IChannel channel, TcpSocketServerEvent<IWebSocketServer, IWebSocketConnection, string> serverEvent)
: base(server, channel, serverEvent)
{
}
#endregion
#region 私有成员
#endregion
#region 外部接口
public async Task Send(string msgStr)
{
try
{
await _channel.WriteAndFlushAsync(new TextWebSocketFrame(msgStr));
await Task.Run(() =>
{
_serverEvent.OnSend?.Invoke(_server, this, msgStr);
});
}
catch (Exception ex)
{
_serverEvent.OnException?.Invoke(ex);
}
}
#endregion
}
}
| 24.6 | 159 | 0.587173 | [
"MIT"
] | Leoforgo/ONetworkTalk | Websocket/WebSocketConnection.cs | 1,133 | C# |
using System;
using System.Threading.Tasks;
using Barista.Common;
using Barista.Common.MassTransit;
using Barista.Contracts.Commands.PointOfSale;
using Barista.Contracts.Events.PointOfSale;
using Barista.PointsOfSale.Handlers.PointOfSale;
using Barista.PointsOfSale.Repositories;
using Barista.PointsOfSale.Verifiers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace Barista.PointsOfSale.Tests.Handlers.PointOfSale
{
[TestClass]
public class CreatePointOfSaleHandlerTests
{
private static readonly Guid Id = Guid.Parse("73120441-86E2-4A1C-81CC-EF3A38883DC7");
private static readonly Guid SaleStrategyId = Guid.Parse("73120441-86E2-4A1C-81CC-EF3A38883DB7");
private static readonly Guid ParentAccountingGroupId = Guid.Parse("73120441-86E2-4A1C-81CC-EF3A38883DA7");
private const string DisplayName = "PoS";
private readonly Mock<ICreatePointOfSale> _command;
private ICreatePointOfSale Cmd => _command.Object;
public CreatePointOfSaleHandlerTests()
{
_command = new Mock<ICreatePointOfSale>();
_command.SetupGet(c => c.Id).Returns(Id);
_command.SetupGet(c => c.DisplayName).Returns(DisplayName);
_command.SetupGet(c => c.SaleStrategyId).Returns(SaleStrategyId);
_command.SetupGet(c => c.ParentAccountingGroupId).Returns(ParentAccountingGroupId);
}
private bool ValidateEquality(dynamic domainObjectOrEvent)
{
Assert.AreEqual(Cmd.Id, domainObjectOrEvent.Id);
Assert.AreEqual(Cmd.DisplayName, domainObjectOrEvent.DisplayName);
Assert.AreEqual(Cmd.SaleStrategyId, domainObjectOrEvent.SaleStrategyId);
return true;
}
[TestMethod]
public void AddsPointOfSaleToRepository_RaisesIntegrationEvent()
{
var repository = new Mock<IPointOfSaleRepository>(MockBehavior.Strict);
repository.Setup(r => r.AddAsync(It.Is<Domain.PointOfSale>(p => ValidateEquality(p)))).Returns(Task.CompletedTask).Verifiable();
repository.Setup(r => r.SaveChanges()).Returns(Task.CompletedTask).Verifiable();
var busPublisher = new Mock<IBusPublisher>(MockBehavior.Strict);
busPublisher.Setup(p => p.Publish<IPointOfSaleCreated>(It.Is<IPointOfSaleCreated>(e => ValidateEquality(e)))).Returns(Task.CompletedTask).Verifiable();
var agVerifier = new Mock<IAccountingGroupVerifier>(MockBehavior.Strict);
agVerifier.Setup(v => v.AssertExists(ParentAccountingGroupId)).Returns(Task.CompletedTask).Verifiable();
var ssVerifier = new Mock<ISaleStrategyVerifier>(MockBehavior.Strict);
ssVerifier.Setup(v => v.AssertExists(SaleStrategyId)).Returns(Task.CompletedTask).Verifiable();
var handler = new CreatePointOfSaleHandler(repository.Object, busPublisher.Object, agVerifier.Object, ssVerifier.Object);
var result = handler.HandleAsync(Cmd, new Mock<ICorrelationContext>().Object).GetAwaiter().GetResult();
Assert.IsTrue(result.Successful);
repository.Verify();
busPublisher.Verify();
agVerifier.Verify();
ssVerifier.Verify();
}
}
}
| 46.7 | 163 | 0.704191 | [
"MIT"
] | nesfit/Coffee | Barista.PointsOfSale.Tests/Handlers/PointOfSale/CreatePointOfSaleHandlerTests.cs | 3,271 | C# |
using MinerPlugin;
using MinerPluginToolkitV1;
using MinerPluginToolkitV1.Configs;
using MinerPluginToolkitV1.ExtraLaunchParameters;
using MinerPluginToolkitV1.Interfaces;
using NHM.Common;
using NHM.Common.Algorithm;
using NHM.Common.Device;
using NHM.Common.Enums;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace BrokenMiner
{
public class BrokenMinerPlugin : IMinerPlugin, IInitInternals, IBinaryPackageMissingFilesChecker, IReBenchmarkChecker, IGetApiMaxTimeoutV2
{
Version IMinerPlugin.Version => GetValueOrErrorSettings.GetValueOrError("Version", new Version(1,0));
string IMinerPlugin.Name => GetValueOrErrorSettings.GetValueOrError("Name", "Broken Plugin");
string IMinerPlugin.Author => GetValueOrErrorSettings.GetValueOrError("Author", "John Doe");
string IMinerPlugin.PluginUUID => GetValueOrErrorSettings.GetValueOrError("PluginUUID", "BrokenMinerPluginUUID");
bool IMinerPlugin.CanGroup(MiningPair a, MiningPair b) => GetValueOrErrorSettings.GetValueOrError("CanGroup", false);
IEnumerable<string> IBinaryPackageMissingFilesChecker.CheckBinaryPackageMissingFiles() =>
GetValueOrErrorSettings.GetValueOrError("CheckBinaryPackageMissingFiles", new List<string> { "text_file_acting_as_exe.txt" });
IMiner IMinerPlugin.CreateMiner() => GetValueOrErrorSettings.GetValueOrError("CreateMiner", new BrokenMiner());
TimeSpan IGetApiMaxTimeoutV2.GetApiMaxTimeout(IEnumerable<MiningPair> miningPairs) => GetValueOrErrorSettings.GetValueOrError("GetApiMaxTimeout", new TimeSpan(1, 10, 5));
bool IGetApiMaxTimeoutV2.IsGetApiMaxTimeoutEnabled => GetValueOrErrorSettings.GetValueOrError("IsGetApiMaxTimeoutEnabled", true);
Dictionary<BaseDevice, IReadOnlyList<Algorithm>> IMinerPlugin.GetSupportedAlgorithms(IEnumerable<BaseDevice> devices)
{
var supported = new Dictionary<BaseDevice, IReadOnlyList<Algorithm>>();
// TODO this will break the default loader
////// Fake device
//var gpu = new BaseDevice(DeviceType.NVIDIA, "FAKE-d97bdb7c-4155-9124-31b7-4743e16d3ac0", "GTX 1070 Ti", 0);
//supported.Add(gpu, new List<Algorithm>() { new Algorithm("BrokenMinerPluginUUID", AlgorithmType.ZHash), new Algorithm("BrokenMinerPluginUUID", AlgorithmType.DaggerHashimoto) });
// we support all devices
foreach (var dev in devices)
{
supported.Add(dev, new List<Algorithm>() { new Algorithm("BrokenMinerPluginUUID", AlgorithmType.ZHash) });
}
return GetValueOrErrorSettings.GetValueOrError("GetSupportedAlgorithms", supported);
}
void IInitInternals.InitInternals() => GetValueOrErrorSettings.SetError("InitInternals");
bool IReBenchmarkChecker.ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids) =>
GetValueOrErrorSettings.GetValueOrError("ShouldReBenchmarkAlgorithmOnDevice", false);
}
}
| 50.934426 | 191 | 0.749276 | [
"MIT"
] | TheGoddessInari/NiceHashMiner | src/Miners/BrokenMiner/BrokenMinerPlugin.cs | 3,109 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Diagnostics.CodeAnalysis;
using LinqToDB;
using LinqToDB.Common;
using LinqToDB.Data;
using LinqToDB.DataProvider;
using LinqToDB.Mapping;
using LinqToDB.SchemaProvider;
using LinqToDB.SqlProvider;
using LinqToDB.SqlQuery;
namespace Tests
{
internal class TestNoopConnection : IDbConnection
{
public TestNoopConnection(string connectionString)
{
ConnectionString = connectionString;
}
public bool Disposed { get; private set; }
[AllowNull]
public string ConnectionString { get; set; }
public int ConnectionTimeout { get; }
public string Database { get; } = null!;
public ConnectionState State { get; private set; }
public IDbTransaction BeginTransaction( ) => throw new NotImplementedException();
public IDbTransaction BeginTransaction(IsolationLevel il ) => throw new NotImplementedException();
public void ChangeDatabase (string databaseName) => throw new NotImplementedException();
public void Close()
{
State = ConnectionState.Closed;
}
public IDbCommand CreateCommand()
{
return new TestNoopDbCommand();
}
public void Open()
{
State = ConnectionState.Open;
}
public void Dispose()
{
Close();
Disposed = true;
}
}
internal class TestNoopDataReader : IDataReader
{
int IDataReader.Depth => throw new NotImplementedException();
bool IDataReader.IsClosed => throw new NotImplementedException();
int IDataReader.RecordsAffected => throw new NotImplementedException();
int IDataRecord.FieldCount => throw new NotImplementedException();
object IDataRecord.this[string name] => throw new NotImplementedException();
object IDataRecord.this[int i ] => throw new NotImplementedException();
void IDataReader.Close ( ) => throw new NotImplementedException();
DataTable IDataReader.GetSchemaTable ( ) => throw new NotImplementedException();
bool IDataReader.NextResult ( ) => throw new NotImplementedException();
bool IDataReader.Read ( ) => throw new NotImplementedException();
bool IDataRecord.GetBoolean (int i ) => throw new NotImplementedException();
byte IDataRecord.GetByte (int i ) => throw new NotImplementedException();
long IDataRecord.GetBytes (int i, long fieldOffset, byte[] buffer, int bufferoffset, int length) => throw new NotImplementedException();
char IDataRecord.GetChar (int i ) => throw new NotImplementedException();
long IDataRecord.GetChars (int i, long fieldoffset, char[] buffer, int bufferoffset, int length) => throw new NotImplementedException();
IDataReader IDataRecord.GetData (int i ) => throw new NotImplementedException();
string IDataRecord.GetDataTypeName(int i ) => throw new NotImplementedException();
DateTime IDataRecord.GetDateTime (int i ) => throw new NotImplementedException();
decimal IDataRecord.GetDecimal (int i ) => throw new NotImplementedException();
double IDataRecord.GetDouble (int i ) => throw new NotImplementedException();
Type IDataRecord.GetFieldType (int i ) => throw new NotImplementedException();
float IDataRecord.GetFloat (int i ) => throw new NotImplementedException();
Guid IDataRecord.GetGuid (int i ) => throw new NotImplementedException();
short IDataRecord.GetInt16 (int i ) => throw new NotImplementedException();
int IDataRecord.GetInt32 (int i ) => throw new NotImplementedException();
long IDataRecord.GetInt64 (int i ) => throw new NotImplementedException();
string IDataRecord.GetName (int i ) => throw new NotImplementedException();
int IDataRecord.GetOrdinal (string name ) => throw new NotImplementedException();
string IDataRecord.GetString (int i ) => throw new NotImplementedException();
object IDataRecord.GetValue (int i ) => throw new NotImplementedException();
int IDataRecord.GetValues (object[] values ) => throw new NotImplementedException();
bool IDataRecord.IsDBNull (int i ) => throw new NotImplementedException();
void IDisposable.Dispose ( ) => throw new NotImplementedException();
}
internal class TestNoopDbCommand : DbCommand
{
private readonly DbParameterCollection _parameters = new TestNoopDbParameterCollection();
[AllowNull]
public override string CommandText { get; set; } = null!;
public override int CommandTimeout
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override CommandType CommandType { get; set; }
public override bool DesignTimeVisible
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override UpdateRowSource UpdatedRowSource
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
protected override DbConnection? DbConnection
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
protected override DbParameterCollection DbParameterCollection => _parameters;
protected override DbTransaction? DbTransaction
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override void Cancel ( ) => throw new NotImplementedException();
public override int ExecuteNonQuery ( ) => 0;
public override object? ExecuteScalar ( ) => null;
public override void Prepare ( ) => throw new NotImplementedException();
protected override DbParameter CreateDbParameter ( ) => new TestNoopDbParameter();
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) => new TestNoopDbDataReader();
}
internal class TestNoopDbParameter : DbParameter
{
public override DbType DbType { get; set; }
public override ParameterDirection Direction
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override bool IsNullable
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
[AllowNull]
public override string ParameterName { get; set; } = null!;
public override int Size
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
[AllowNull]
public override string SourceColumn
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override bool SourceColumnNullMapping
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override DataRowVersion SourceVersion
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public override object? Value { get; set; }
public override void ResetDbType() => throw new NotImplementedException();
}
internal class TestNoopDbDataReader : DbDataReader
{
public override int Depth => throw new NotImplementedException();
public override int FieldCount => throw new NotImplementedException();
public override bool HasRows => throw new NotImplementedException();
public override bool IsClosed => throw new NotImplementedException();
public override int RecordsAffected => throw new NotImplementedException();
public override object this[string name] => throw new NotImplementedException();
public override object this[int ordinal] => throw new NotImplementedException();
public override void Close() { }
public override bool GetBoolean (int ordinal ) => throw new NotImplementedException();
public override byte GetByte (int ordinal ) => throw new NotImplementedException();
public override long GetBytes (int ordinal, long dataOffset, byte[]? buffer, int bufferOffset, int length) => throw new NotImplementedException();
public override char GetChar (int ordinal ) => throw new NotImplementedException();
public override long GetChars (int ordinal, long dataOffset, char[]? buffer, int bufferOffset, int length) => throw new NotImplementedException();
public override string GetDataTypeName(int ordinal ) => throw new NotImplementedException();
public override DateTime GetDateTime (int ordinal ) => throw new NotImplementedException();
public override decimal GetDecimal (int ordinal ) => throw new NotImplementedException();
public override double GetDouble (int ordinal ) => throw new NotImplementedException();
public override IEnumerator GetEnumerator ( ) => throw new NotImplementedException();
public override Type GetFieldType (int ordinal ) => throw new NotImplementedException();
public override float GetFloat (int ordinal ) => throw new NotImplementedException();
public override Guid GetGuid (int ordinal ) => throw new NotImplementedException();
public override short GetInt16 (int ordinal ) => throw new NotImplementedException();
public override int GetInt32 (int ordinal ) => throw new NotImplementedException();
public override long GetInt64 (int ordinal ) => throw new NotImplementedException();
public override string GetName (int ordinal ) => throw new NotImplementedException();
public override int GetOrdinal (string name ) => throw new NotImplementedException();
public override DataTable GetSchemaTable ( ) => throw new NotImplementedException();
public override string GetString (int ordinal ) => throw new NotImplementedException();
public override object GetValue (int ordinal ) => throw new NotImplementedException();
public override int GetValues (object[] values ) => throw new NotImplementedException();
public override bool IsDBNull (int ordinal ) => throw new NotImplementedException();
public override bool NextResult ( ) => throw new NotImplementedException();
public override bool Read ( ) => false;
}
internal class TestNoopDbParameterCollection : DbParameterCollection
{
private List<TestNoopDbParameter> _parameters = new List<TestNoopDbParameter>();
public override int Count => _parameters.Count;
public override bool IsFixedSize => throw new NotImplementedException();
public override bool IsReadOnly => throw new NotImplementedException();
public override bool IsSynchronized => throw new NotImplementedException();
public override object SyncRoot => throw new NotImplementedException();
public override int Add(object value)
{
_parameters.Add((TestNoopDbParameter)value);
return _parameters.Count - 1;
}
public override void Clear()
{
_parameters.Clear();
}
public override IEnumerator GetEnumerator( ) => Array<IEnumerator>.Empty.GetEnumerator();
public override void AddRange (Array values ) => throw new NotImplementedException();
public override bool Contains (string value ) => throw new NotImplementedException();
public override bool Contains (object value ) => throw new NotImplementedException();
public override void CopyTo (Array array, int index ) => throw new NotImplementedException();
public override int IndexOf (string parameterName ) => throw new NotImplementedException();
public override int IndexOf (object value ) => throw new NotImplementedException();
public override void Insert (int index, object value ) => throw new NotImplementedException();
public override void Remove (object value ) => throw new NotImplementedException();
public override void RemoveAt (string parameterName ) => throw new NotImplementedException();
public override void RemoveAt (int index ) => throw new NotImplementedException();
protected override DbParameter GetParameter (string parameterName ) => throw new NotImplementedException();
protected override DbParameter GetParameter (int index ) => throw new NotImplementedException();
protected override void SetParameter (string parameterName, DbParameter value) => throw new NotImplementedException();
protected override void SetParameter (int index, DbParameter value ) => throw new NotImplementedException();
}
internal class TestNoopProviderAdapter : IDynamicProviderAdapter
{
Type IDynamicProviderAdapter.ConnectionType => typeof(TestNoopConnection );
Type IDynamicProviderAdapter.DataReaderType => typeof(TestNoopDataReader );
Type IDynamicProviderAdapter.ParameterType => typeof(TestNoopDbParameter);
Type IDynamicProviderAdapter.CommandType => typeof(TestNoopDbCommand );
Type IDynamicProviderAdapter.TransactionType => throw new NotImplementedException();
}
internal class TestNoopProvider : DynamicDataProviderBase<TestNoopProviderAdapter>
{
public TestNoopProvider()
: base(TestProvName.NoopProvider, new MappingSchema(), new TestNoopProviderAdapter())
{
}
static TestNoopProvider()
{
DataConnection.AddDataProvider(new TestNoopProvider());
}
public static void Init()
{
// Just for triggering of static constructor
}
public override ISqlBuilder CreateSqlBuilder (MappingSchema mappingSchema) => new TestNoopSqlBuilder(MappingSchema);
public override ISchemaProvider GetSchemaProvider( ) => throw new NotImplementedException();
public override ISqlOptimizer GetSqlOptimizer ( ) => TestNoopSqlOptimizer.Instance;
public override TableOptions SupportedTableOptions => TableOptions.None;
}
internal class TestNoopSqlBuilder : BasicSqlBuilder
{
public TestNoopSqlBuilder(MappingSchema mappingSchema)
: base(mappingSchema, TestNoopSqlOptimizer.Instance, new SqlProviderFlags())
{
}
protected override ISqlBuilder CreateSqlBuilder() => throw new NotImplementedException();
protected override void BuildInsertOrUpdateQuery(SqlInsertOrUpdateStatement insertOrUpdate)
{
BuildInsertOrUpdateQueryAsMerge(insertOrUpdate, null);
}
}
internal class TestNoopSqlOptimizer : BasicSqlOptimizer
{
public static ISqlOptimizer Instance = new TestNoopSqlOptimizer();
private TestNoopSqlOptimizer()
: base(new SqlProviderFlags())
{
}
}
}
| 55.664671 | 162 | 0.564974 | [
"MIT"
] | AndreyAndryushinPSB/linq2db | Tests/Linq/TestProviders/TestNoopProvider.cs | 18,261 | C# |
using System;
namespace MadReflection.Osmotic.Tests
{
public struct TestStructWithExplicitIFormattable : IFormattable
{
private string _value;
public TestStructWithExplicitIFormattable(string value)
{
if (value is null)
throw new ArgumentNullException(nameof(value));
if (value == "")
throw new ArgumentException("Empty string is valid for this purpose.");
_value = value;
}
public string Value => _value;
public static TestStructWithExplicitIFormattable Parse(string s)
{
if (s is null)
throw new ArgumentNullException(nameof(s));
if (s.Length == 0)
throw new ArgumentException("Invalid input.");
return new TestStructWithExplicitIFormattable(s);
}
string IFormattable.ToString(string format, IFormatProvider formatProvider) => _value;
public override string ToString() => _value;
}
}
| 21.923077 | 88 | 0.730994 | [
"BSD-3-Clause"
] | madreflection/MadReflection.Osmotic | src/MadReflection.Osmotic.Tests/TestTypes_/TestStructWithExplicitIFormattable.cs | 857 | C# |
using System;
using Org.BouncyCastle.Math.Raw;
using Org.BouncyCastle.Utilities.Encoders;
namespace Org.BouncyCastle.Math.EC.Custom.Sec
{
internal class SecT113R1Curve
: AbstractF2mCurve
{
private const int SECT113R1_DEFAULT_COORDS = COORD_LAMBDA_PROJECTIVE;
private const int SECT113R1_FE_LONGS = 2;
private static readonly ECFieldElement[] SECT113R1_AFFINE_ZS = new ECFieldElement[] { new SecT113FieldElement(BigInteger.One) };
protected readonly SecT113R1Point m_infinity;
public SecT113R1Curve()
: base(113, 9, 0, 0)
{
this.m_infinity = new SecT113R1Point(this, null, null);
this.m_a = FromBigInteger(new BigInteger(1, Hex.DecodeStrict("003088250CA6E7C7FE649CE85820F7")));
this.m_b = FromBigInteger(new BigInteger(1, Hex.DecodeStrict("00E8BEE4D3E2260744188BE0E9C723")));
this.m_order = new BigInteger(1, Hex.DecodeStrict("0100000000000000D9CCEC8A39E56F"));
this.m_cofactor = BigInteger.Two;
this.m_coord = SECT113R1_DEFAULT_COORDS;
}
protected override ECCurve CloneCurve()
{
return new SecT113R1Curve();
}
public override bool SupportsCoordinateSystem(int coord)
{
switch (coord)
{
case COORD_LAMBDA_PROJECTIVE:
return true;
default:
return false;
}
}
public override ECPoint Infinity
{
get { return m_infinity; }
}
public override int FieldSize
{
get { return 113; }
}
public override ECFieldElement FromBigInteger(BigInteger x)
{
return new SecT113FieldElement(x);
}
protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, bool withCompression)
{
return new SecT113R1Point(this, x, y, withCompression);
}
protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, bool withCompression)
{
return new SecT113R1Point(this, x, y, zs, withCompression);
}
public override bool IsKoblitz
{
get { return false; }
}
public virtual int M
{
get { return 113; }
}
public virtual bool IsTrinomial
{
get { return true; }
}
public virtual int K1
{
get { return 9; }
}
public virtual int K2
{
get { return 0; }
}
public virtual int K3
{
get { return 0; }
}
public override ECLookupTable CreateCacheSafeLookupTable(ECPoint[] points, int off, int len)
{
ulong[] table = new ulong[len * SECT113R1_FE_LONGS * 2];
{
int pos = 0;
for (int i = 0; i < len; ++i)
{
ECPoint p = points[off + i];
Nat128.Copy64(((SecT113FieldElement)p.RawXCoord).x, 0, table, pos); pos += SECT113R1_FE_LONGS;
Nat128.Copy64(((SecT113FieldElement)p.RawYCoord).x, 0, table, pos); pos += SECT113R1_FE_LONGS;
}
}
return new SecT113R1LookupTable(this, table, len);
}
private class SecT113R1LookupTable
: AbstractECLookupTable
{
private readonly SecT113R1Curve m_outer;
private readonly ulong[] m_table;
private readonly int m_size;
internal SecT113R1LookupTable(SecT113R1Curve outer, ulong[] table, int size)
{
this.m_outer = outer;
this.m_table = table;
this.m_size = size;
}
public override int Size
{
get { return m_size; }
}
public override ECPoint Lookup(int index)
{
ulong[] x = Nat128.Create64(), y = Nat128.Create64();
int pos = 0;
for (int i = 0; i < m_size; ++i)
{
ulong MASK = (ulong)(long)(((i ^ index) - 1) >> 31);
for (int j = 0; j < SECT113R1_FE_LONGS; ++j)
{
x[j] ^= m_table[pos + j] & MASK;
y[j] ^= m_table[pos + SECT113R1_FE_LONGS + j] & MASK;
}
pos += (SECT113R1_FE_LONGS * 2);
}
return CreatePoint(x, y);
}
public override ECPoint LookupVar(int index)
{
ulong[] x = Nat128.Create64(), y = Nat128.Create64();
int pos = index * SECT113R1_FE_LONGS * 2;
for (int j = 0; j < SECT113R1_FE_LONGS; ++j)
{
x[j] = m_table[pos + j];
y[j] = m_table[pos + SECT113R1_FE_LONGS + j];
}
return CreatePoint(x, y);
}
private ECPoint CreatePoint(ulong[] x, ulong[] y)
{
return m_outer.CreateRawPoint(new SecT113FieldElement(x), new SecT113FieldElement(y), SECT113R1_AFFINE_ZS, false);
}
}
}
}
| 30.219101 | 137 | 0.519241 | [
"MIT"
] | 0x070696E65/Symnity | Assets/Plugins/Symnity/Pulgins/crypto/src/math/ec/custom/sec/SecT113R1Curve.cs | 5,381 | C# |
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/DirectML.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
namespace TerraFX.Interop.DirectX;
public enum DML_MATRIX_TRANSFORM
{
DML_MATRIX_TRANSFORM_NONE,
DML_MATRIX_TRANSFORM_TRANSPOSE,
}
| 32.846154 | 145 | 0.786885 | [
"MIT"
] | JeremyKuhne/terrafx.interop.windows | sources/Interop/Windows/DirectX/um/DirectML/DML_MATRIX_TRANSFORM.cs | 429 | C# |
using System;
using MsgPack.Serialization;
namespace scopely.msgpacksharp.tests
{
public class AnimalColor
{
public AnimalColor()
{
}
[MessagePackMember(0)]
public float Red { get; set; }
[MessagePackMember(1)]
public float Green { get; set; }
[MessagePackMember(2)]
public float Blue { get; set; }
public override bool Equals(object obj)
{
bool areEqual = false;
if (this == obj)
areEqual = true;
else
{
AnimalColor other = obj as AnimalColor;
if (other != null)
{
areEqual = this.Red == other.Red &&
this.Green == other.Green &&
this.Blue == other.Blue;
}
}
return areEqual;
}
public override int GetHashCode()
{
return (Red + Green * 2.0f + Blue * 3.0f).GetHashCode();
}
}
}
| 16.847826 | 59 | 0.618065 | [
"Apache-2.0"
] | scopely/msgpack-sharp | msgpack-sharp-tests/AnimalColor.cs | 777 | C# |
using System;
namespace Zoey.Quartz.Web.Models
{
public class ErrorViewModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
} | 19.363636 | 70 | 0.666667 | [
"MIT"
] | NameIsBad/Zoey.Quartz | src/Zoey.Quartz.Web/Models/ErrorViewModel.cs | 213 | C# |
namespace RTGS.Bank.Simulator.Controllers.Handlers.AtomicLockResponse;
public record AtomicLockResponseHandlerOutput()
{
public string LockId { get; init; }
public string LockExpiry { get; init; }
public decimal? ExchangeRate { get; init; }
public string EndToEndId { get; init; }
public decimal? DebtorAmount { get; init; }
public decimal? DebtorChargeAmount { get; init; }
public string DebtorCurrency { get; init; }
public string Message { get; init; }
}
| 33.428571 | 71 | 0.747863 | [
"MIT"
] | RTGS-OpenSource/cbs-simulator | src/RTGS.Bank.Simulator/Controllers/Handlers/AtomicLockResponse/AtomicLockResponseHandlerOutput.cs | 470 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
partial class BinarySearchTree<T> : ICloneable, IEnumerable<T>
where T : IComparable<T>, IEquatable<T>
{
public static bool operator ==(BinarySearchTree<T> array1, BinarySearchTree<T> array2)
{
return BinarySearchTree<T>.Equals(array1, array2);
}
public static bool operator !=(BinarySearchTree<T> array1, BinarySearchTree<T> array2)
{
return !BinarySearchTree<T>.Equals(array1, array2);
}
private IEnumerable<T> Traverse(Node root)
{
if (root != null)
{
foreach (T item in Traverse(root.Left))
yield return item;
yield return root.Key;
foreach (T item in Traverse(root.Right))
yield return item;
}
}
public IEnumerator<T> GetEnumerator()
{
return Traverse(root).GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public object Clone()
{
BinarySearchTree<T> tree = new BinarySearchTree<T>();
foreach (T item in this)
tree.Add(item);
return tree;
}
public override int GetHashCode()
{
int hash = 17;
unchecked
{
foreach (T item in this)
hash = hash * 23 + item.GetHashCode();
}
return hash;
}
public override bool Equals(object obj)
{
IEnumerator<T> tree1 = this.GetEnumerator();
IEnumerator<T> tree2 = (obj as BinarySearchTree<T>).GetEnumerator();
while (tree1.MoveNext() && tree2.MoveNext())
if (!tree1.Current.Equals(tree2.Current))
return false;
return !tree1.MoveNext() && !tree2.MoveNext();
}
public override string ToString()
{
return String.Join<T>(" ", this);
}
}
| 23.317073 | 90 | 0.577406 | [
"MIT"
] | trinityimma/TelerikAcademy | Programming/3.ObjectOrientedProgramming/6.CommonTypeSystem/6.BinarySearchTree/Helpers.cs | 1,914 | C# |
// Copyright (c) Ugo Lattanzi. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using StackExchange.Redis.Extensions.Core.Abstractions;
using StackExchange.Redis.Extensions.Core.Models;
namespace StackExchange.Redis.Samples.Web.Mvc.Controllers;
public class HomeController : Controller
{
private readonly IRedisDatabase redisDatabase;
private readonly IRedisConnectionPoolManager pool;
public HomeController(IRedisDatabase redisDatabase, IRedisConnectionPoolManager pool)
{
this.redisDatabase = redisDatabase;
this.pool = pool;
}
public async Task<string> Index()
{
var before = pool.GetConnectionInformations();
var rng = new Random();
await redisDatabase.AddAsync($"key-{rng}", new { a = rng.Next() }).ConfigureAwait(false);
var after = pool.GetConnectionInformations();
return BuildInfo(before) + "\t" + BuildInfo(after);
static string BuildInfo(ConnectionPoolInformation info)
{
return $"\talive: {info.ActiveConnections.ToString()}, required: {info.RequiredPoolSize.ToString()}";
}
}
}
| 32.65 | 147 | 0.69219 | [
"MIT"
] | adamralph/StackExchange.Redis.Extensions | samples/StackExchange.Redis.Samples.Web.Mvc/Controllers/HomeController.cs | 1,306 | C# |
// Copyright (c) 2016, SolidCP
// SolidCP is distributed under the Creative Commons Share-alike license
//
// SolidCP is a fork of WebsitePanel:
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using SolidCP.Setup.Actions;
namespace SolidCP.Setup
{
/// <summary>
/// Release 1.4.5
/// </summary>
public class Portal145 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, minimalInstallerVersion: "1.0.1");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.4.6,1.4.5,1.4.4",
updateSql: false);
}
}
/// <summary>
/// Release 1.4.4
/// </summary>
public class Portal144 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, "1.4.3");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.4.3,1.4.2",
updateSql: false);
}
}
/// <summary>
/// Release 1.4.3
/// </summary>
public class Portal143 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, "1.4.3");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.4.2,1.4.1",
updateSql: false);
}
}
/// <summary>
/// Release 1.4.2
/// </summary>
public class Portal142 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, "1.4.2");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.4.1,1.4.0",
updateSql: false);
}
}
/// <summary>
/// Release 1.4.1
/// </summary>
public class Portal141 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, "1.4.1");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.4.0,1.3.0",
updateSql: false);
}
}
/// <summary>
/// Release 1.4.0
/// </summary>
public class Portal140 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, "1.4.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.3.0,1.2.1",
updateSql: false);
}
}
/// <summary>
/// Release 1.3.0
/// </summary>
public class Portal130 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, "1.3.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.2.1,1.2.0",
updateSql: false);
}
}
/// <summary>
/// Release 1.2.1
/// </summary>
public class Portal121 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, "1.2.1");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.2.0,1.1.2",
updateSql: false);
}
}
/// <summary>
/// Release 1.2.0
/// </summary>
public class Portal120 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.1.4,1.1.2",
updateSql: false);
}
}
/// <summary>
/// Release 1.1.4
/// </summary>
public class Portal114 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.1.3,1.1.2",
updateSql: false);
}
}
/// <summary>
/// Release 1.1.3
/// </summary>
public class Portal113 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.1.2,1.1.1",
updateSql: false);
}
}
/// <summary>
/// Release 1.1.2
/// </summary>
public class Portal112 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.1.1,1.1.0",
updateSql: false);
}
}
/// <summary>
/// Release 1.1.1
/// </summary>
public class Portal111 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, minimalInstallerVersion: "1.0.1");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.1.0,1.0.4",
updateSql: false);
}
}
/// <summary>
/// Release 1.1.0
/// </summary>
public class Portal110 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, "1.1.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.0.4,1.0.3",
updateSql: false);
}
}
/// Release 1.0.4
/// </summary>
public class Portal104 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, minimalInstallerVersion: "1.0.1");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.0.3,1.0.1",
updateSql: false);
}
}
/// Release 1.0.3
/// </summary>
public class Portal103 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, minimalInstallerVersion: "1.0.1");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj,
minimalInstallerVersion: "1.0.1",
versionToUpgrade: "1.0.2,1.0.1",
updateSql: false);
}
}
/// Release 1.0.2
/// </summary>
public class Portal102 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, minimalInstallerVersion: "1.0.1");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.0.1", "1.0.0", false);
}
}
/// <summary>
/// Release 1.0.1
/// </summary>
public class Portal101 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, minimalInstallerVersion: "1.0.1");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.0.0", "1.0", false);
}
}
/// <summary>
/// Release 1.0
/// </summary>
public class Portal10 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
}
}
| 26.639033 | 83 | 0.541883 | [
"BSD-3-Clause"
] | eg2-hack/SolidCP | SolidCP.Installer/Sources/SolidCP.Setup/Portal10.cs | 15,424 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.