content
stringlengths 5
1.04M
| avg_line_length
float64 1.75
12.9k
| max_line_length
int64 2
244k
| alphanum_fraction
float64 0
0.98
| licenses
sequence | repository_name
stringlengths 7
92
| path
stringlengths 3
249
| size
int64 5
1.04M
| lang
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|
using Abp.Authorization.Users;
using Abp.Domain.Repositories;
using Abp.Domain.Uow;
using Abp.Linq;
using Abp.Organizations;
using SmartCompany.Authorization.Roles;
namespace SmartCompany.Authorization.Users
{
public class UserStore : AbpUserStore<Role, User>
{
public UserStore(
IUnitOfWorkManager unitOfWorkManager,
IRepository<User, long> userRepository,
IRepository<Role> roleRepository,
IAsyncQueryableExecuter asyncQueryableExecuter,
IRepository<UserRole, long> userRoleRepository,
IRepository<UserLogin, long> userLoginRepository,
IRepository<UserClaim, long> userClaimRepository,
IRepository<UserPermissionSetting, long> userPermissionSettingRepository,
IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository,
IRepository<OrganizationUnitRole, long> organizationUnitRoleRepository)
: base(
unitOfWorkManager,
userRepository,
roleRepository,
asyncQueryableExecuter,
userRoleRepository,
userLoginRepository,
userClaimRepository,
userPermissionSettingRepository,
userOrganizationUnitRepository,
organizationUnitRoleRepository)
{
}
}
}
| 36.447368 | 85 | 0.66065 | [
"MIT"
] | hatem1223/fullstack | aspnet-core/src/SmartCompany.Core/Authorization/Users/UserStore.cs | 1,385 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iTile.Core
{
public interface IInitializable
{
void Init();
}
}
| 15.142857 | 35 | 0.707547 | [
"MIT"
] | ha1fdaew/iTile | Core/IInitializable.cs | 214 | C# |
using System.Threading.Tasks;
using System.Web.Mvc;
using set.messaging.Data.Services;
using set.messaging.Helpers;
using set.messaging.Models;
namespace set.messaging.Controllers
{
public class UserController : BaseController
{
private readonly IAuthService _authService;
private readonly IUserService _userService;
public UserController(
IAuthService authService,
IUserService userService)
{
_authService = authService;
_userService = userService;
}
[HttpGet, AllowAnonymous]
public ActionResult Login()
{
var model = new LoginModel();
return View(model);
}
[HttpPost, ValidateAntiForgeryToken, AllowAnonymous]
public async Task<ActionResult> Login(LoginModel model)
{
if (!model.IsValid())
{
SetPleaseTryAgain(model);
return View(model);
}
var authenticated = await _userService.Authenticate(model.Email, model.Password);
if (!authenticated)
{
SetPleaseTryAgain(model);
return View(model);
}
var user = await _userService.GetByEmail(model.Email);
if (user == null)
{
SetPleaseTryAgain(model);
return View(model);
}
_authService.SignIn(user.Id, user.Name, user.Email, user.RoleName, true);
return Redirect(!string.IsNullOrEmpty(model.ReturnUrl) ? model.ReturnUrl : "/app/list");
}
[HttpGet, AllowAnonymous]
public ActionResult PasswordReset()
{
var model = new PasswordResetModel();
if (User.Identity.IsAuthenticated)
{
model.Email = User.Identity.GetEmail();
}
return View(model);
}
[HttpPost, ValidateAntiForgeryToken, AllowAnonymous]
public async Task<ActionResult> PasswordReset(PasswordResetModel model)
{
SetPleaseTryAgain(model);
if (model.IsNotValid())
{
return View(model);
}
var isOk = await _userService.RequestPasswordReset(model.Email);
if (isOk)
{
model.Msg = "password_reset_request_successful".Localize();
}
return View(model);
}
[HttpGet, AllowAnonymous]
public async Task<ActionResult> PasswordChange(string email, string token)
{
var model = new PasswordChangeModel { Email = email, Token = token };
if (!await _userService.IsPasswordResetRequestValid(model.Email, model.Token))
{
return Redirect("/User/Login");
}
return View(model);
}
[HttpPost, AllowAnonymous]
public async Task<ActionResult> PasswordChange(PasswordChangeModel model)
{
SetPleaseTryAgain(model);
if (model.IsNotValid())
{
return View(model);
}
if (!await _userService.ChangePassword(model.Email, model.Token, model.Password))
{
return View(model);
}
return Redirect("/User/Login");
}
[HttpGet]
public ActionResult Logout()
{
_authService.SignOut();
return RedirectToHome();
}
}
} | 27.858268 | 100 | 0.546637 | [
"MIT"
] | bbilginn/set-messaging | sources/set.messaging/Controllers/UserController.cs | 3,540 | C# |
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using BrmsGeneratorResearcher.Helpers;
using BrmsGeneratorResearcher.Models;
using BrmsGeneratorResearcher.Resources;
using Newtonsoft.Json;
using Formatting = Newtonsoft.Json.Formatting;
namespace BrmsGeneratorResearcher
{
public partial class MainForm : Form
{
#region Properties
/// <summary>
/// Experiment's Trials
/// </summary>
protected static Dictionary<string, Trial> Experiments;
/// <summary>
/// Experiment's Trials Name List
/// </summary>
protected static List<string> ExperimentsOrder;
/// <summary>
/// Fullscreen Trial Count
/// </summary>
protected static int FullscreenCount;
/// <summary>
/// Introduction Trial Count
/// </summary>
protected static int IntroCount;
/// <summary>
/// Introduction Trial Count
/// </summary>
protected static int ImageButtonCount;
/// <summary>
/// Survey Trials Count
/// </summary>
protected static int SurveyCount;
/// <summary>
/// bRMS Trials Count
/// </summary>
protected static int BRmsCount;
#endregion
#region Constractors
/// <summary>
/// MainForm Constructor
/// </summary>
public MainForm()
{
InitializeComponent();
Experiments = new Dictionary<string, Trial>();
ExperimentsOrder = new List<string>();
FullscreenCount = 0;
IntroCount = 0;
BRmsCount = 0;
ImageButtonCount = 0;
}
#endregion
#region Private Methods
/// <summary>
/// Open Create Introduction Dialog
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void IntroButton_Click(object sender, EventArgs e)
{
var intro = new InstructionsForm();
intro.ShowDialog();
BindListView();
}
/// <summary>
/// Get names of exiting bRMS trials
/// </summary>
/// <returns></returns>
private static List<string> GetExistingBrmsNames()
{
var result = new List<string>();
foreach (var trial in Experiments.Keys)
{
if (Experiments[trial].type == ExperimentTypes.bRMS)
{
result.Add(Experiments[trial].name);
}
}
return result;
}
/// <summary>
/// Open Create bRMS Dialog
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BRms_button_Click(object sender, EventArgs e)
{
var bRms = new BrmsForm(null, GetExistingBrmsNames());
bRms.ShowDialog();
BindListView();
}
/// <summary>
/// Open Create Survey Dialog
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SurveyButton_Click(object sender, EventArgs e)
{
var sForm = new SurveyForm();
sForm.ShowDialog();
BindListView();
}
/// <summary>
/// Open Create Fullscreen Dialog
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FullscreenButton_Click(object sender, EventArgs e)
{
var newForm = new FullscreenForm();
newForm.ShowDialog();
BindListView();
}
/// <summary>
/// Bind ListView by experiment list
/// </summary>
private void BindListView()
{
TrialsListView.Clear();
foreach (var item in ExperimentsOrder)
{
TrialsListView.Items.Add(item);
}
}
/// <summary>
/// Load existing Experiment (for edit)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void LoadButton_Click(object sender, EventArgs e)
{
var result = openFileDialog1.ShowDialog();
if (result != DialogResult.OK) return;
var newExperiment = Utils.LoadExperimentJson(openFileDialog1.FileName);
NameTextBox.Text = newExperiment.name;
NameTextBox.Enabled = false;
this.TrialsListView.Clear();
LoadExperiment(newExperiment.trialList);
BindListView();
}
/// <summary>
/// Load experiment
/// </summary>
/// <param name="trialLst"></param>
private static void LoadExperiment(IEnumerable<Trial> trialLst)
{
foreach (var item in trialLst)
{
switch (item.type)
{
case "bRMS":
{
var helpDic = new Dictionary<string, Brms>
{
{"bRMS", (Brms) item}
};
AddBrms(helpDic);
break;
}
case "survey-text":
case "survey-likert":
case "survey-multi-choice":
AddSurvey((Survey) item);
break;
case "fullscreen":
AddFullscreen((FullScreen) item);
break;
case "instructions":
AddIntro((Instructions) item);
break;
}
}
}
/// <summary>
/// Remove Trial from experiment list view
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RemoveButton_Click(object sender, EventArgs e)
{
if (TrialsListView.SelectedItems.Count < 1) { return; }
var itemIndex = TrialsListView.SelectedItems[0].Index;
var item = ExperimentsOrder[itemIndex];
Experiments.Remove(item);
ExperimentsOrder.Remove(item);
BindListView();
}
private static bool ValidRgb(string str)
{
if (string.IsNullOrWhiteSpace(str))
{
return false;
}
else if (!str.StartsWith("#"))
{
return false;
}
else if (str.Length < 7)
{
return false;
}
else
{
return true;
}
}
/// <summary>
/// Validation Before Save
/// </summary>
/// <returns></returns>
private string ValidateBeforeSave()
{
if (string.IsNullOrWhiteSpace(NameTextBox.Text))
{
return ErrMsg.NameMissingError;
}
else if (TrialsListView.Items.Count == 0)
{
return ErrMsg.NoTrialAddedError;
}
else if(!ValidRgb(BackgoundRgbTextBox.Text))
{
return ErrMsg.InvalidRGBcode;
}
else
{
return string.Empty;
}
}
private static List<Trial> GetFinalTimeline()
{
var resultList = new List<Trial>();
foreach (var trialString in ExperimentsOrder)
{
resultList.Add(Experiments[trialString]);
}
return resultList;
}
private static Dictionary<string, object> ToDictionary(object obj)
{
var json = JsonConvert.SerializeObject(obj);
var dictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
return dictionary;
}
private static Experiment ExperimentListToDic(Experiment experiment)
{
experiment.timeline = new List<Dictionary<string, object>>();
foreach (var trial in experiment.trialList)
{
experiment.timeline.Add(ToDictionary(trial));
}
experiment.trialList = null;
return experiment;
}
/// <summary>
/// Save all experiment button click
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SaveButton_Click(object sender, EventArgs e)
{
if (TrialsListView.Items.Count == 0){ return; }
var validationString = ValidateBeforeSave();
if (!string.IsNullOrWhiteSpace(validationString))
{
MessageBox.Show(validationString);
return;
}
var newExperiment = new Experiment(NameTextBox.Text,
BackgoundRgbTextBox.Text,
CompletionCodeText.Text,
GetFinalTimeline());
newExperiment = ExperimentListToDic(newExperiment);
var json = JsonConvert.SerializeObject(newExperiment, Formatting.Indented);
// Displays a SaveFileDialog so the user can save the Image
var saveFileDialog1 = new SaveFileDialog
{
FileName = NameTextBox.Text,
Filter = BasicResources.ExperimentFilter,
Title = BasicResources.ExperimentDialogTitle
};
saveFileDialog1.ShowDialog();
if (!string.IsNullOrEmpty(saveFileDialog1.FileName))
{
//write string to file
System.IO.File.WriteAllText(saveFileDialog1.FileName, json);
}
}
/// <summary>
/// Edit Trial Button Click
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void EditButton_Click(object sender, EventArgs e)
{
if (TrialsListView.SelectedItems.Count == 0) {return;}
var selectedIndex = TrialsListView.SelectedItems[0].Index;
//if (Experiments[ExperimentsOrder[selectedIndex]].type == ExperimentTypes.bRMS)
//{
// MessageBox.Show(BasicResources.EditBrmsInvalid);
// //return;
//}
EditExperiment(selectedIndex);
}
/// <summary>
/// Edit Trial
/// </summary>
/// <param name="trialIndex"></param>
private void EditExperiment(int trialIndex)
{
var trial = Experiments[ExperimentsOrder[trialIndex]];
switch (trial.type)
{
case ExperimentTypes.ScaleSurvey:
case ExperimentTypes.TextSurvey:
case ExperimentTypes.MultiChoiceSurvey:
{
var surveyF = new SurveyForm((Survey)trial);
surveyF.ShowDialog();
if (surveyF.ReturnEdit != null)
{
Experiments[ExperimentsOrder[trialIndex]] = surveyF.ReturnEdit;
}
break;
}
case ExperimentTypes.Fullscreen:
{
var fullscreenF = new FullscreenForm((FullScreen)trial);
fullscreenF.ShowDialog();
if (fullscreenF.ReturnEdit != null)
{
Experiments[ExperimentsOrder[trialIndex]] = fullscreenF.ReturnEdit;
}
break;
}
case ExperimentTypes.Instructions:
{
var instructionsF = new InstructionsForm((Instructions)trial);
instructionsF.ShowDialog();
if (instructionsF.ReturnEdit != null)
{
Experiments[ExperimentsOrder[trialIndex]] = instructionsF.ReturnEdit;
}
break;
}
case ExperimentTypes.bRMS:
var rmsForm = new BrmsForm((Brms)trial);
rmsForm.ShowDialog();
if (rmsForm.ReturnEdit != null)
{
Experiments[ExperimentsOrder[trialIndex]] = rmsForm.ReturnEdit;
}
break;
}
BindListView();
}
/// <summary>
/// Plus button click
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PlusButton_Click(object sender, EventArgs e)
{
if (TrialsListView.SelectedItems.Count <= 0 || TrialsListView.SelectedItems[0].Index <= 0) return;
var tmp = TrialsListView.SelectedItems[0].Text;
var tmpIndex = TrialsListView.SelectedItems[0].Index;
TrialsListView.Items[tmpIndex].Text = TrialsListView.Items[tmpIndex - 1].Text;
TrialsListView.Items[tmpIndex - 1].Text = tmp;
ExperimentsOrder[tmpIndex] = ExperimentsOrder[tmpIndex - 1];
ExperimentsOrder[tmpIndex - 1] = tmp;
TrialsListView.Items[tmpIndex].Selected = false;
TrialsListView.Items[tmpIndex - 1].Selected = true;
}
/// <summary>
/// Minus button click
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MinusButton_Click(object sender, EventArgs e)
{
if (TrialsListView.SelectedItems.Count <= 0 ||
TrialsListView.SelectedItems[0].Index >= TrialsListView.Items.Count - 1) return;
var tmp = TrialsListView.SelectedItems[0].Text;
var tmpIndex = TrialsListView.SelectedItems[0].Index;
TrialsListView.Items[tmpIndex].Text = TrialsListView.Items[tmpIndex + 1].Text;
TrialsListView.Items[tmpIndex + 1].Text = tmp;
ExperimentsOrder[tmpIndex] = ExperimentsOrder[tmpIndex + 1];
ExperimentsOrder[tmpIndex + 1] = tmp;
TrialsListView.Items[tmpIndex].Selected = false;
TrialsListView.Items[tmpIndex + 1].Selected = true;
}
private static void AddTrial(Trial obj)
{
if (ExperimentsOrder.Contains(obj.name))
{
var i = 2;
while (ExperimentsOrder.Contains(obj.name + 1))
{
i++;
}
obj.name += i;
}
Experiments.Add(obj.name, obj);
ExperimentsOrder.Add(obj.name);
}
#endregion
#region Public Methods
/// <summary>
/// Add fullscreen experiment in to experiments list
/// </summary>
/// <param name="obj"></param>
public static void AddFullscreen(FullScreen obj)
{
AddTrial(obj);
FullscreenCount++;
}
/// <summary>
/// Add intro experiment in to experiments list
/// </summary>
/// <param name="obj"></param>
public static void AddIntro(Instructions obj)
{
AddTrial(obj);
IntroCount++;
}
/// <summary>
/// Add ImageKeyboard experiment in to experiments list
/// </summary>
/// <param name="obj"></param>
public static void AddImageKeyboard(ImageButton obj)
{
AddTrial(obj);
ImageButtonCount++;
}
/// <summary>
/// Add survey experiment in to experiments list
/// </summary>
/// <param name="obj"></param>
public static void AddSurvey(Survey obj)
{
AddTrial(obj);
SurveyCount++;
}
/// <summary>
/// Add bRMS trials to Experiment list view
/// </summary>
/// <param name="_brmsList"></param>
public static void AddBrms(Dictionary<string, Brms> _brmsList)
{
foreach (var item in _brmsList.Values)
{
if (ExperimentsOrder.Contains(item.name))
{
var i = 2;
while (ExperimentsOrder.Contains(item.name + 1))
{
i++;
}
item.name += i;
}
Experiments.Add(item.name, item);
ExperimentsOrder.Add(item.name);
BRmsCount++;
}
}
private void ImageButton_Click(object sender, EventArgs e)
{
var newForm = new ImageForm();
newForm.ShowDialog();
BindListView();
}
#endregion
}
}
| 31.75 | 110 | 0.498237 | [
"MIT"
] | nadavWeisler/BrmsGeneratorResearcher | PopUp_Researcher/MainForm.cs | 17,020 | 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.
#nullable enable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Reflection.Metadata;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.Debugging;
using Microsoft.CodeAnalysis.Emit;
using EmitContext = Microsoft.CodeAnalysis.Emit.EmitContext;
namespace Microsoft.Cci
{
/// <summary>
/// Specifies how the caller passes parameters to the callee and who cleans up the stack.
/// </summary>
[Flags]
internal enum CallingConvention
{
/// <summary>
/// C/C++ style calling convention for unmanaged methods. The call stack is cleaned up by the caller,
/// which makes this convention suitable for calling methods that accept extra arguments.
/// </summary>
C = SignatureCallingConvention.CDecl,
/// <summary>
/// The convention for calling managed methods with a fixed number of arguments.
/// </summary>
Default = SignatureCallingConvention.Default,
/// <summary>
/// The convention for calling managed methods that accept extra arguments.
/// </summary>
ExtraArguments = SignatureCallingConvention.VarArgs,
/// <summary>
/// Arguments are passed in registers when possible. This calling convention is not yet supported.
/// </summary>
FastCall = SignatureCallingConvention.FastCall,
/// <summary>
/// Win32 API calling convention for calling unmanaged methods via PlatformInvoke. The call stack is cleaned up by the callee.
/// </summary>
Standard = SignatureCallingConvention.StdCall,
/// <summary>
/// C++ member unmanaged method (non-vararg) calling convention. The callee cleans the stack and the this pointer is pushed on the stack last.
/// </summary>
ThisCall = SignatureCallingConvention.ThisCall,
/// <summary>
/// The convention for calling a generic method.
/// </summary>
Generic = SignatureAttributes.Generic,
/// <summary>
/// The convention for calling an instance method with an implicit this parameter (the method does not have an explicit parameter definition for this).
/// </summary>
HasThis = SignatureAttributes.Instance,
/// <summary>
/// The convention for calling an instance method that explicitly declares its first parameter to correspond to the this instance.
/// </summary>
ExplicitThis = SignatureAttributes.ExplicitThis
}
/// <summary>
/// An event is a member that enables an object or class to provide notifications. Clients can attach executable code for events by supplying event handlers.
/// This interface models the metadata representation of an event.
/// </summary>
internal interface IEventDefinition : ITypeDefinitionMember
{
/// <summary>
/// A list of methods that are associated with the event.
/// </summary>
IEnumerable<IMethodReference> GetAccessors(EmitContext context);
/// <summary>
/// The method used to add a handler to the event.
/// </summary>
IMethodReference Adder { get; }
/// <summary>
/// The method used to call the event handlers when the event occurs. May be null.
/// </summary>
IMethodReference? Caller { get; }
/// <summary>
/// True if the event gets special treatment from the runtime.
/// </summary>
bool IsRuntimeSpecial { get; }
/// <summary>
/// This event is special in some way, as specified by the name.
/// </summary>
bool IsSpecialName { get; }
/// <summary>
/// The method used to add a handler to the event.
/// </summary>
IMethodReference Remover { get; }
/// <summary>
/// The (delegate) type of the handlers that will handle the event.
/// </summary>
ITypeReference GetType(EmitContext context);
}
/// <summary>
/// A field is a member that represents a variable associated with an object or class.
/// This interface models the metadata representation of a field.
/// </summary>
internal interface IFieldDefinition : ITypeDefinitionMember, IFieldReference
{
/// <summary>
/// The compile time value of the field. This value should be used directly in IL, rather than a reference to the field.
/// If the field does not have a valid compile time value, Dummy.Constant is returned.
/// </summary>
MetadataConstant? GetCompileTimeValue(EmitContext context);
/// <summary>
/// Mapped field data, or null if the field is not mapped.
/// </summary>
ImmutableArray<byte> MappedData
{
get;
}
/// <summary>
/// This field is a compile-time constant. The field has no runtime location and cannot be directly addressed from IL.
/// </summary>
bool IsCompileTimeConstant { get; }
/// <summary>
/// This field has associated field marshalling information.
/// </summary>
bool IsMarshalledExplicitly { get; }
/// <summary>
/// The field does not have to be serialized when its containing instance is serialized.
/// </summary>
bool IsNotSerialized { get; }
/// <summary>
/// This field can only be read. Initialization takes place in a constructor.
/// </summary>
bool IsReadOnly { get; }
/// <summary>
/// True if the field gets special treatment from the runtime.
/// </summary>
bool IsRuntimeSpecial { get; }
/// <summary>
/// This field is special in some way, as specified by the name.
/// </summary>
bool IsSpecialName { get; }
/// <summary>
/// This field is static (shared by all instances of its declaring type).
/// </summary>
bool IsStatic { get; }
/// <summary>
/// Specifies how this field is marshalled when it is accessed from unmanaged code.
/// </summary>
IMarshallingInformation? MarshallingInformation
{
get;
// ^ requires this.IsMarshalledExplicitly;
}
/// <summary>
/// Checked if IsMarshalledExplicitly == true and MarshallingInformation is null
/// </summary>
ImmutableArray<byte> MarshallingDescriptor
{
get;
// ^ requires this.IsMarshalledExplicitly;
}
/// <summary>
/// Offset of the field.
/// </summary>
int Offset
{
get;
// ^ requires this.ContainingTypeDefinition.Layout == LayoutKind.Explicit;
}
}
/// <summary>
/// A reference to a field.
/// </summary>
internal interface IFieldReference : ITypeMemberReference
{ // TODO: add custom modifiers
/// <summary>
/// The type of value that is stored in this field.
/// </summary>
ITypeReference GetType(EmitContext context);
/// <summary>
/// The Field being referred to.
/// </summary>
IFieldDefinition? GetResolvedField(EmitContext context);
ISpecializedFieldReference? AsSpecializedFieldReference { get; }
/// <summary>
/// True, if field is an IContextualNamedEntity, even if field reference implements the interface,
/// doesn't mean it is contextual.
/// </summary>
bool IsContextualNamedEntity
{
get;
}
}
/// <summary>
/// An object that represents a local variable or constant.
/// </summary>
internal interface ILocalDefinition : INamedEntity
{
/// <summary>
/// The compile time value of the definition, if it is a local constant.
/// </summary>
MetadataConstant CompileTimeValue
{
get;
}
/// <summary>
/// Custom modifiers associated with local variable definition.
/// </summary>
ImmutableArray<ICustomModifier> CustomModifiers
{
get;
}
/// <summary>
/// TODO: use <see cref="Constraints"/> instead.
/// True if the value referenced by the local must not be moved by the actions of the garbage collector.
/// </summary>
bool IsPinned { get; }
/// <summary>
/// TODO: use <see cref="Constraints"/> instead.
/// True if the local contains a managed pointer (for example a reference to a local variable or a reference to a field of an object).
/// </summary>
bool IsReference { get; }
LocalSlotConstraints Constraints { get; }
/// <summary>
/// Each local has an attributes field in the PDB. To match the native compiler,
/// we emit <see cref="LocalVariableAttributes.DebuggerHidden"/> for locals that should
/// definitely not bind in the debugger and <see cref="LocalVariableAttributes.None"/>
/// for all other locals.
/// </summary>
/// <remarks>
/// A value of <see cref="LocalVariableAttributes.DebuggerHidden"/> is a sufficient, but not a necessary, condition for hiding the
/// local in the debugger. Locals with value <see cref="LocalVariableAttributes.None"/> may also be hidden.
///
/// Hidden locals must still be emitted because they participate in evaluation.
/// </remarks>
LocalVariableAttributes PdbAttributes { get; }
/// <summary>
/// The synthesized dynamic attributes of the local definition if any, or empty.
/// </summary>
ImmutableArray<bool> DynamicTransformFlags { get; }
/// <summary>
/// The tuple element names of the local definition if any, or empty.
/// </summary>
ImmutableArray<string> TupleElementNames { get; }
/// <summary>
/// The type of the local.
/// </summary>
ITypeReference Type { get; }
/// <summary>
/// Location for reporting diagnostics about the local.
/// </summary>
/// <remark>
/// Use <see cref="Location.None"/> rather than null.
/// </remark>
Location Location { get; }
/// <summary>
/// Slot index or -1 if not applicable.
/// </summary>
int SlotIndex { get; }
/// <summary>
/// Optional serialized local signature.
/// </summary>
byte[]? Signature { get; }
/// <summary>
/// Local id, or <see cref="LocalDebugId.None"/> if this is a local constant, short-lived temp variable,
/// or we are not emitting local variable ids (release builds).
/// </summary>
LocalSlotDebugInfo SlotInfo { get; }
}
/// <summary>
/// A metadata (IL) level representation of the body of a method or of a property/event accessor.
/// </summary>
internal interface IMethodBody
{
/// <summary>
/// A list exception data within the method body IL.
/// </summary>
ImmutableArray<ExceptionHandlerRegion> ExceptionRegions
{
get;
// ^ requires !this.MethodDefinition.IsAbstract && !this.MethodDefinition.IsExternal && this.MethodDefinition.IsCil;
}
/// <summary>
/// True if the locals are initialized by zeroing the stack upon method entry.
/// </summary>
bool AreLocalsZeroed { get; }
/// <summary>
/// True if there's a stackalloc somewhere in the method.
/// </summary>
bool HasStackalloc { get; }
/// <summary>
/// The local variables of the method.
/// </summary>
ImmutableArray<ILocalDefinition> LocalVariables { get; }
/// <summary>
/// The definition of the method whose body this is.
/// If this is the body of an event or property accessor, this will hold the corresponding adder/remover/setter or getter method.
/// </summary>
IMethodDefinition MethodDefinition { get; }
/// <summary>
/// Debugging information associated with a MoveNext method of a state machine.
/// </summary>
StateMachineMoveNextBodyDebugInfo MoveNextBodyInfo { get; }
/// <summary>
/// The maximum number of elements on the evaluation stack during the execution of the method.
/// </summary>
ushort MaxStack { get; }
ImmutableArray<byte> IL { get; }
ImmutableArray<SequencePoint> SequencePoints { get; }
/// <summary>
/// Returns true if there is at least one dynamic local within the MethodBody
/// </summary>
bool HasDynamicLocalVariables { get; }
/// <summary>
/// Returns zero or more local (block) scopes into which the CLR IL operations in the given method body is organized.
/// </summary>
ImmutableArray<LocalScope> LocalScopes { get; }
/// <summary>
/// Returns an import scope the method is declared within, or null if there is none
/// (e.g. the method doesn't contain user code).
/// </summary>
/// <remarks>
/// The chain is a spine of a tree in a forest of import scopes. A tree of import scopes is created by the language for each source file
/// based on namespace declarations. In VB each tree is trivial single-node tree that declares the imports of a file.
/// In C# the tree copies the nesting of namespace declarations in the file. There is a separate scope for each dotted component in
/// the namespace type name. For instance namespace type x.y.z will have two namespace scopes, the first is for the x and the second
/// is for the y.
/// </remarks>
IImportScope ImportScope { get; }
DebugId MethodId { get; }
/// <summary>
/// Returns debug information for local variables hoisted to state machine fields,
/// or null if this method isn't MoveNext method of a state machine.
/// </summary>
/// <remarks>
/// Returns zero or more local (block) scopes, each defining an IL range in which an iterator local is defined.
/// The scopes are returned for the MoveNext method of the object returned by the iterator method.
/// The index of the scope corresponds to the index of the local. Specifically local scope i corresponds
/// to the local stored in a field named <localName>5__i of the class used to store the local values in
/// between calls to MoveNext, where localName is the original name of the local variable. For example, if
/// the first local to be moved into the class is named "xyzzy", it will be stored in a field named
/// "<xyzzy>5__1", and the ILocalScope returned from this method at index 1 (i.e. the second one) will
/// have the scope information for where that variable is in scope.
/// </remarks>
ImmutableArray<StateMachineHoistedLocalScope> StateMachineHoistedLocalScopes { get; }
/// <summary>
/// The name of the state machine generated for the method,
/// or null if the method isn't the kickoff method of a state machine.
/// </summary>
string StateMachineTypeName { get; }
/// <summary>
/// Returns information relevant to EnC on slots of local variables hoisted to state machine fields,
/// or null if the method isn't the kickoff method of a state machine.
/// </summary>
ImmutableArray<EncHoistedLocalInfo> StateMachineHoistedLocalSlots { get; }
/// <summary>
/// Returns types of awaiter slots allocated on the state machine,
/// or null if the method isn't the kickoff method of a state machine.
/// </summary>
ImmutableArray<ITypeReference> StateMachineAwaiterSlots { get; }
ImmutableArray<ClosureDebugInfo> ClosureDebugInfo { get; }
ImmutableArray<LambdaDebugInfo> LambdaDebugInfo { get; }
DynamicAnalysisMethodBodyData DynamicAnalysisData { get; }
}
/// <summary>
/// This interface models the metadata representation of a method.
/// </summary>
internal interface IMethodDefinition : ITypeDefinitionMember, IMethodReference
{
/// <summary>
/// A container for a list of IL instructions providing the implementation (if any) of this method.
/// </summary>
/// <remarks>
/// When emitting metadata-only assemblies this returns null even if <see cref="Cci.Extensions.HasBody"/> returns true.
/// </remarks>
IMethodBody GetBody(EmitContext context);
/// <summary>
/// If the method is generic then this list contains the type parameters.
/// </summary>
IEnumerable<IGenericMethodParameter> GenericParameters
{
get;
// ^ requires this.IsGeneric;
}
/// <summary>
/// Returns true if this symbol was automatically created by the compiler, and does not have
/// an explicit corresponding source code declaration.
/// </summary>
bool IsImplicitlyDeclared { get; }
/// <summary>
/// True if this method has a non empty collection of SecurityAttributes or the System.Security.SuppressUnmanagedCodeSecurityAttribute.
/// </summary>
bool HasDeclarativeSecurity { get; }
/// <summary>
/// True if the method does not provide an implementation.
/// </summary>
bool IsAbstract { get; }
/// <summary>
/// True if the method can only be overridden when it is also accessible.
/// </summary>
bool IsAccessCheckedOnOverride { get; }
/// <summary>
/// True if the method is a constructor.
/// </summary>
bool IsConstructor { get; }
/// <summary>
/// True if the method has an external implementation (i.e. not supplied by this definition).
/// </summary>
/// <remarks>
/// If the method is not external and not abstract it has to provide an IL body.
/// </remarks>
bool IsExternal { get; }
/// <summary>
/// True if this method is hidden if a derived type declares a method with the same name and signature.
/// If false, any method with the same name hides this method. This flag is ignored by the runtime and is only used by compilers.
/// </summary>
bool IsHiddenBySignature { get; }
/// <summary>
/// The method always gets a new slot in the virtual method table.
/// This means the method will hide (not override) a base type method with the same name and signature.
/// </summary>
bool IsNewSlot { get; }
/// <summary>
/// True if the method is implemented via the invocation of an underlying platform method.
/// </summary>
bool IsPlatformInvoke { get; }
/// <summary>
/// True if the method gets special treatment from the runtime. For example, it might be a constructor.
/// </summary>
bool IsRuntimeSpecial { get; }
/// <summary>
/// True if the method may not be overridden.
/// </summary>
bool IsSealed { get; }
/// <summary>
/// True if the method is special in some way for tools. For example, it might be a property getter or setter.
/// </summary>
bool IsSpecialName { get; }
/// <summary>
/// True if the method does not require an instance of its declaring type as its first argument.
/// </summary>
bool IsStatic { get; }
/// <summary>
/// True if the method may be overridden (or if it is an override).
/// </summary>
bool IsVirtual
{
get;
// ^ ensures result ==> !this.IsStatic;
}
/// <summary>
/// Implementation flags.
/// </summary>
MethodImplAttributes GetImplementationAttributes(EmitContext context);
/// <summary>
/// The parameters forming part of this signature.
/// </summary>
ImmutableArray<IParameterDefinition> Parameters { get; }
/// <summary>
/// Detailed information about the PInvoke stub. Identifies which method to call, which module has the method and the calling convention among other things.
/// </summary>
IPlatformInvokeInformation PlatformInvokeData
{
get;
// ^ requires this.IsPlatformInvoke;
}
/// <summary>
/// True if the method calls another method containing security code. If this flag is set, the method
/// should have System.Security.DynamicSecurityMethodAttribute present in its list of custom attributes.
/// </summary>
bool RequiresSecurityObject { get; }
/// <summary>
/// Custom attributes associated with the method's return value.
/// </summary>
IEnumerable<ICustomAttribute> GetReturnValueAttributes(EmitContext context);
/// <summary>
/// The return value has associated marshalling information.
/// </summary>
bool ReturnValueIsMarshalledExplicitly { get; }
/// <summary>
/// Specifies how the return value is marshalled when the method is called from unmanaged code.
/// </summary>
IMarshallingInformation ReturnValueMarshallingInformation
{
get;
// ^ requires this.ReturnValueIsMarshalledExplicitly;
}
/// <summary>
/// Checked if ReturnValueIsMarshalledExplicitly == true and ReturnValueMarshallingInformation is null
/// </summary>
ImmutableArray<byte> ReturnValueMarshallingDescriptor
{
get;
// ^ requires this.ReturnValueIsMarshalledExplicitly;
}
/// <summary>
/// Declarative security actions for this method.
/// </summary>
IEnumerable<SecurityAttribute> SecurityAttributes { get; }
/// <summary>
/// Namespace containing this method.
/// TODO: Ideally we would expose INamespace on INamespaceTypeDefinition. Right now we can only get the qualified namespace name.
/// </summary>
INamespace ContainingNamespace { get; }
}
/// <summary>
/// This interface models the metadata representation of a method or property parameter.
/// </summary>
internal interface IParameterDefinition : IDefinition, INamedEntity, IParameterTypeInformation
{
/// <summary>
/// A compile time constant value that should be supplied as the corresponding argument value by callers that do not explicitly specify an argument value for this parameter.
/// Null if the parameter doesn't have default value.
/// </summary>
MetadataConstant? GetDefaultValue(EmitContext context);
/// <summary>
/// True if the parameter has a default value that should be supplied as the argument value by a caller for which the argument value has not been explicitly specified.
/// </summary>
bool HasDefaultValue { get; }
/// <summary>
/// True if the argument value must be included in the marshalled arguments passed to a remote callee.
/// </summary>
bool IsIn { get; }
/// <summary>
/// This parameter has associated marshalling information.
/// </summary>
bool IsMarshalledExplicitly { get; }
/// <summary>
/// True if the argument value must be included in the marshalled arguments passed to a remote callee only if it is different from the default value (if there is one).
/// </summary>
bool IsOptional
{
get;
// ^ result ==> this.HasDefaultValue;
}
/// <summary>
/// True if the final value assigned to the parameter will be marshalled with the return values passed back from a remote callee.
/// </summary>
bool IsOut { get; }
/// <summary>
/// Specifies how this parameter is marshalled when it is accessed from unmanaged code.
/// </summary>
IMarshallingInformation? MarshallingInformation
{
get;
// ^ requires this.IsMarshalledExplicitly;
}
/// <summary>
/// Checked if IsMarshalledExplicitly == true and MarshallingInformation is null
/// </summary>
ImmutableArray<byte> MarshallingDescriptor
{
get;
// ^ requires this.IsMarshalledExplicitly;
}
}
/// <summary>
/// A property is a member that provides access to an attribute of an object or a class.
/// This interface models the metadata representation of a property.
/// </summary>
internal interface IPropertyDefinition : ISignature, ITypeDefinitionMember
{
/// <summary>
/// A list of methods that are associated with the property.
/// </summary>
IEnumerable<IMethodReference> GetAccessors(EmitContext context);
/// <summary>
/// A compile time constant value that provides the default value for the property. (Who uses this and why?)
/// </summary>
MetadataConstant? DefaultValue
{
get;
// ^ requires this.HasDefaultValue;
}
/// <summary>
/// The method used to get the value of this property. May be absent (null).
/// </summary>
IMethodReference? Getter { get; }
/// <summary>
/// True if this property has a compile time constant associated with that serves as a default value for the property. (Who uses this and why?)
/// </summary>
bool HasDefaultValue { get; }
/// <summary>
/// True if this property gets special treatment from the runtime.
/// </summary>
bool IsRuntimeSpecial { get; }
/// <summary>
/// True if this property is special in some way, as specified by the name.
/// </summary>
bool IsSpecialName { get; }
/// <summary>
/// The parameters forming part of this signature.
/// </summary>
ImmutableArray<IParameterDefinition> Parameters { get; }
/// <summary>
/// The method used to set the value of this property. May be absent (null).
/// </summary>
IMethodReference? Setter { get; }
}
/// <summary>
/// The parameters and return type that makes up a method or property signature.
/// This interface models the metadata representation of a signature.
/// </summary>
internal interface ISignature
{
/// <summary>
/// Calling convention of the signature.
/// </summary>
CallingConvention CallingConvention { get; }
/// <summary>
/// The number of required parameters of the signature.
/// </summary>
ushort ParameterCount { get; }
/// <summary>
/// The parameters forming part of this signature.
/// </summary>
ImmutableArray<IParameterTypeInformation> GetParameters(EmitContext context);
/// <summary>
/// Returns the list of custom modifiers, if any, associated with the return type.
/// </summary>
ImmutableArray<ICustomModifier> ReturnValueCustomModifiers
{
get;
}
/// <summary>
/// Returns the list of custom modifiers, if any, associated with the ref modifier.
/// </summary>
ImmutableArray<ICustomModifier> RefCustomModifiers
{
get;
}
/// <summary>
/// True if the return value is passed by reference (using a managed pointer).
/// </summary>
bool ReturnValueIsByRef { get; }
/// <summary>
/// The return type of the method or type of the property.
/// </summary>
ITypeReference GetType(EmitContext context);
}
/// <summary>
/// A member of a type definition, such as a field or a method.
/// This interface models the metadata representation of a type member.
/// </summary>
internal interface ITypeDefinitionMember : ITypeMemberReference, IDefinition
{
/// <summary>
/// The type definition that contains this member.
/// </summary>
ITypeDefinition ContainingTypeDefinition { get; }
/// <summary>
/// Indicates if the member is public or confined to its containing type, derived types and/or declaring assembly.
/// </summary>
TypeMemberVisibility Visibility { get; }
}
/// <summary>
/// A reference to a member of a type, such as a field or a method.
/// This interface models the metadata representation of a type member reference.
/// </summary>
internal interface ITypeMemberReference : IReference, INamedEntity
{
/// <summary>
/// A reference to the containing type of the referenced type member.
/// </summary>
ITypeReference GetContainingType(EmitContext context);
}
/// <summary>
/// Represents the specialized event definition.
/// </summary>
internal interface ISpecializedEventDefinition : IEventDefinition
{
/// <summary>
/// The event that has been specialized to obtain this event. When the containing type is an instance of type which is itself a specialized member (i.e. it is a nested
/// type of a generic type instance), then the unspecialized member refers to a member from the unspecialized containing type. (I.e. the unspecialized member always
/// corresponds to a definition that is not obtained via specialization.)
/// </summary>
[NotNull]
IEventDefinition UnspecializedVersion
{
get;
}
}
/// <summary>
/// Represents reference specialized field.
/// </summary>
internal interface ISpecializedFieldReference : IFieldReference
{
/// <summary>
/// A reference to the field definition that has been specialized to obtain the field definition referred to by this field reference.
/// When the containing type of the referenced specialized field definition is itself a specialized nested type of a generic type instance,
/// then the unspecialized field reference refers to the corresponding field definition from the unspecialized containing type definition.
/// (I.e. the unspecialized field reference always refers to a field definition that is not obtained via specialization.)
/// </summary>
IFieldReference UnspecializedVersion { get; }
}
/// <summary>
/// Represents reference specialized method.
/// </summary>
internal interface ISpecializedMethodReference : IMethodReference
{
/// <summary>
/// A reference to the method definition that has been specialized to obtain the method definition referred to by this method reference.
/// When the containing type of the referenced specialized method definition is itself a specialized nested type of a generic type instance,
/// then the unspecialized method reference refers to the corresponding method definition from the unspecialized containing type definition.
/// (I.e. the unspecialized method reference always refers to a method definition that is not obtained via specialization.)
/// </summary>
IMethodReference UnspecializedVersion { get; }
}
/// <summary>
/// Represents the specialized property definition.
/// </summary>
internal interface ISpecializedPropertyDefinition : IPropertyDefinition
{
/// <summary>
/// The property that has been specialized to obtain this property. When the containing type is an instance of type which is itself a specialized member (i.e. it is a nested
/// type of a generic type instance), then the unspecialized member refers to a member from the unspecialized containing type. (I.e. the unspecialized member always
/// corresponds to a definition that is not obtained via specialization.)
/// </summary>
[NotNull]
IPropertyDefinition UnspecializedVersion
{
get;
}
}
/// <summary>
/// A reference to a method.
/// </summary>
internal interface IMethodReference : ISignature, ITypeMemberReference
{
/// <summary>
/// True if the call sites that references the method with this object supply extra arguments.
/// </summary>
bool AcceptsExtraArguments { get; }
/// <summary>
/// The number of generic parameters of the method. Zero if the referenced method is not generic.
/// </summary>
ushort GenericParameterCount
{
get;
// ^ ensures !this.IsGeneric ==> result == 0;
// ^ ensures this.IsGeneric ==> result > 0;
}
/// <summary>
/// True if the method has generic parameters;
/// </summary>
bool IsGeneric { get; }
/// <summary>
/// The method being referred to.
/// </summary>
IMethodDefinition? GetResolvedMethod(EmitContext context);
// ^ ensures this is IMethodDefinition ==> result == this;
/// <summary>
/// Information about this types of the extra arguments supplied at the call sites that references the method with this object.
/// </summary>
ImmutableArray<IParameterTypeInformation> ExtraParameters { get; }
IGenericMethodInstanceReference? AsGenericMethodInstanceReference { get; }
ISpecializedMethodReference? AsSpecializedMethodReference { get; }
}
/// <summary>
/// A reference to generic method instantiated with a list of type arguments.
/// </summary>
internal interface IGenericMethodInstanceReference : IMethodReference
{
/// <summary>
/// The type arguments that were used to instantiate this.GenericMethod in order to create this method.
/// </summary>
IEnumerable<ITypeReference> GetGenericArguments(EmitContext context);
// ^ ensures result.GetEnumerator().MoveNext(); // The collection is always non empty.
/// <summary>
/// Returns the generic method of which this method is an instance.
/// </summary>
IMethodReference GetGenericMethod(EmitContext context);
// ^ ensures result.ResolvedMethod.IsGeneric;
}
/// <summary>
/// Represents a global field in symbol table.
/// </summary>
internal interface IGlobalFieldDefinition : IFieldDefinition
{
}
/// <summary>
/// Represents a global method in symbol table.
/// </summary>
internal interface IGlobalMethodDefinition : IMethodDefinition
{
/// <summary>
/// The name of the method.
/// </summary>
new string Name { get; }
}
internal static class Extensions
{
internal static bool HasBody(this IMethodDefinition methodDef)
{
// Method definition has body if it is a non-abstract, non-extern method.
// Additionally, methods within COM types have no body.
return !methodDef.IsAbstract && !methodDef.IsExternal &&
(methodDef.ContainingTypeDefinition == null || !methodDef.ContainingTypeDefinition.IsComObject);
}
/// <summary>
/// When emitting ref assemblies, some members will not be included.
/// </summary>
public static bool ShouldInclude(this ITypeDefinitionMember member, EmitContext context)
{
if (context.IncludePrivateMembers)
{
return true;
}
var method = member as IMethodDefinition;
if (method != null && method.IsVirtual)
{
return true;
}
switch (member.Visibility)
{
case TypeMemberVisibility.Private:
return context.IncludePrivateMembers;
case TypeMemberVisibility.Assembly:
case TypeMemberVisibility.FamilyAndAssembly:
return context.IncludePrivateMembers || context.Module.SourceAssemblyOpt?.InternalsAreVisible == true;
}
return true;
}
}
}
| 38.513007 | 181 | 0.616114 | [
"MIT"
] | BertanAygun/roslyn | src/Compilers/Core/Portable/PEWriter/Members.cs | 37,013 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace MICore
{
public class LocalUnixTerminalTransport : StreamTransport
{
private string _dbgStdInName;
private string _dbgStdOutName;
private int _debuggerPid = -1;
private ProcessMonitor _shellProcessMonitor;
private CancellationTokenSource _streamReadPidCancellationTokenSource = new CancellationTokenSource();
public override void InitStreams(LaunchOptions options, out StreamReader reader, out StreamWriter writer)
{
LocalLaunchOptions localOptions = (LocalLaunchOptions)options;
// Default working directory is next to the app
string debuggeeDir;
if (Path.IsPathRooted(options.ExePath) && File.Exists(options.ExePath))
{
debuggeeDir = Path.GetDirectoryName(options.ExePath);
}
else
{
// If we don't know where the app is, default to HOME, and if we somehow can't get that, go with the root directory.
debuggeeDir = Environment.GetEnvironmentVariable("HOME");
if (string.IsNullOrEmpty(debuggeeDir))
debuggeeDir = "/";
}
_dbgStdInName = UnixUtilities.MakeFifo(Logger);
_dbgStdOutName = UnixUtilities.MakeFifo(Logger);
string pidFifo = UnixUtilities.MakeFifo(Logger);
// Used for testing
Logger?.WriteLine(string.Concat("TempFile=", _dbgStdInName));
Logger?.WriteLine(string.Concat("TempFile=", _dbgStdOutName));
Logger?.WriteLine(string.Concat("TempFile=", pidFifo));
// Setup the streams on the fifos as soon as possible.
FileStream dbgStdInStream = new FileStream(_dbgStdInName, FileMode.Open);
FileStream dbgStdOutStream = new FileStream(_dbgStdOutName, FileMode.Open);
FileStream pidStream = new FileStream(pidFifo, FileMode.Open);
string debuggerCmd = UnixUtilities.GetDebuggerCommand(localOptions);
string launchDebuggerCommand = UnixUtilities.LaunchLocalDebuggerCommand(
debuggeeDir,
_dbgStdInName,
_dbgStdOutName,
pidFifo,
debuggerCmd);
// Only pass the environment to launch clrdbg. For other modes, there are commands that set the environment variables
// directly for the debuggee.
ReadOnlyCollection<EnvironmentEntry> environmentForDebugger = localOptions.DebuggerMIMode == MIMode.Clrdbg ?
localOptions.Environment :
new ReadOnlyCollection<EnvironmentEntry>(new EnvironmentEntry[] { }); ;
TerminalLauncher terminal = TerminalLauncher.MakeTerminal("DebuggerTerminal", launchDebuggerCommand, localOptions.Environment);
terminal.Launch(debuggeeDir);
int shellPid = -1;
using (StreamReader pidReader = new StreamReader(pidStream, Encoding.UTF8, true, UnixUtilities.StreamBufferSize))
{
Task<string> readShellPidTask = pidReader.ReadLineAsync();
if (readShellPidTask.Wait(TimeSpan.FromSeconds(10)))
{
shellPid = int.Parse(readShellPidTask.Result, CultureInfo.InvariantCulture);
// Used for testing
Logger?.WriteLine(string.Concat("ShellPid=", shellPid));
}
else
{
// Something is wrong because we didn't get the pid of shell
ForceDisposeStreamReader(pidReader);
Close();
throw new TimeoutException(MICoreResources.Error_LocalUnixTerminalDebuggerInitializationFailed);
}
_shellProcessMonitor = new ProcessMonitor(shellPid);
_shellProcessMonitor.ProcessExited += ShellExited;
_shellProcessMonitor.Start();
Task<string> readDebuggerPidTask = pidReader.ReadLineAsync();
try
{
readDebuggerPidTask.Wait(_streamReadPidCancellationTokenSource.Token);
_debuggerPid = int.Parse(readDebuggerPidTask.Result, CultureInfo.InvariantCulture);
}
catch (OperationCanceledException)
{
// Something is wrong because we didn't get the pid of the debugger
ForceDisposeStreamReader(pidReader);
Close();
throw new OperationCanceledException(MICoreResources.Error_LocalUnixTerminalDebuggerInitializationFailed);
}
}
// The in/out names are confusing in this case as they are relative to gdb.
// What that means is the names are backwards wrt miengine hence the reader
// being the writer and vice-versa
// Mono seems to hang when the debugger sends a large response unless we specify a larger buffer here
writer = new StreamWriter(dbgStdInStream, new UTF8Encoding(false, true), UnixUtilities.StreamBufferSize);
reader = new StreamReader(dbgStdOutStream, Encoding.UTF8, true, UnixUtilities.StreamBufferSize);
}
private void ShellExited(object sender, EventArgs e)
{
_shellProcessMonitor.ProcessExited -= ShellExited;
Logger?.WriteLine("Shell exited, stop debugging");
this.Callback.OnDebuggerProcessExit(null);
}
public override int DebuggerPid
{
get
{
return _debuggerPid;
}
}
protected override string GetThreadName()
{
return "MI.LocalUnixTerminalTransport";
}
public override void Close()
{
base.Close();
_shellProcessMonitor?.Dispose();
_streamReadPidCancellationTokenSource.Cancel();
_streamReadPidCancellationTokenSource.Dispose();
}
public override int ExecuteSyncCommand(string commandDescription, string commandText, int timeout, out string output, out string error)
{
throw new NotImplementedException();
}
public override bool CanExecuteCommand()
{
return false;
}
}
}
| 42.541401 | 143 | 0.622099 | [
"MIT"
] | benmcmorran/MIEngine | src/MICore/Transports/LocalUnixTerminalTransport.cs | 6,681 | C# |
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.IO;
using System.Security.Claims;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using AssistiveRobot.Web.Service.Controllers;
using AssistiveRobot.Web.Service.Core;
using AssistiveRobot.Web.Service.Domains;
using AssistiveRobot.Web.Service.Extensions;
using AssistiveRobot.Web.Service.Models.OAuth;
using AssistiveRobot.Web.Service.Models.Response;
using AssistiveRobot.Web.Service.Repositories;
using AssistiveRobot.Web.Service.Request;
using AssistiveRobot.Web.Service.Response;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
namespace AssistiveRobot.Web.Service.Services
{
public class AuthenService : IAuthenService
{
private readonly IUserTokenRepository _userTokenRepository;
private readonly IUserRepository _userRepository;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly AppSettings _appSettings;
public AuthenService(IUserTokenRepository userTokenRepository,
IUserRepository userRepository,
IWebHostEnvironment hostingEnvironment,
IOptions<AppSettings> appSettings)
{
_userTokenRepository = userTokenRepository;
_userRepository = userRepository;
_hostingEnvironment = hostingEnvironment;
_appSettings = appSettings.Value;
}
public async Task<OpenidConfiguration> WellKnow()
{
string filePath = _hostingEnvironment.ContentRootPath;
filePath = Path.Join(filePath, "Config", "openid-configuration.json");
string json = await System.IO.File.ReadAllTextAsync(filePath);
json = json.Replace("{issuer_endpoint}", $"{_appSettings.OAuth.Issuer}/api/v1/authen");
return JsonSerializer.Deserialize<OpenidConfiguration>(json);
}
public IActionResult Login(BaseController baseController, LoginRequest model)
{
User user;
if (model.Username == null || model.Password == null)
{
return baseController.GetResultBadRequest(new ErrorResponse("invalid_request", "The request is missing a required parameter."));
}
user = _userRepository.Get(model.Username, model.Password);
if (user == null)
{
return baseController.GetResultBadRequest(new ErrorResponse("invalid_grant", "The username or password is incorrect."));
}
long userId = user.UserId;
string userRole = user.Role;
return baseController.Ok(GenerateAccessTokenResponse(_userTokenRepository, _appSettings.OAuth, userId, userRole, user.Username));
}
public IActionResult RefreshToken(BaseController baseController, RefreshTokenRequest model)
{
if (model.RefreshToken == null)
{
return baseController.GetResultBadRequest(new ErrorResponse("invalid_request", "The request is missing a required parameter, includes an unsupported parameter value (other than grant type)."));
}
UserToken existsRefreshToken = _userTokenRepository.Get(refreshToken: model.RefreshToken);
if (existsRefreshToken == null)
{
return baseController.GetResultBadRequest(new ErrorResponse("invalid_grant", "Invalid refresh_token or expired."));
}
User user = _userRepository.Get(existsRefreshToken.UserId);
string username = user.Username;
string userRole = user.Role;
if (existsRefreshToken.CheckSum != (existsRefreshToken.RefreshToken + username).GetSHA256HashString())
{
return baseController.GetResultBadRequest(new ErrorResponse("invalid_grant", "Invalid refresh_token."));
}
if (existsRefreshToken.Expires.CompareTo(DateTime.Now) < 0)
{
return baseController.GetResultBadRequest(new ErrorResponse("invalid_grant", "The refresh_token has expired."));
}
// Remove old refresh token
_userTokenRepository.Remove(model.RefreshToken);
return baseController.Ok(GenerateAccessTokenResponse(_userTokenRepository, _appSettings.OAuth, existsRefreshToken.UserId, userRole, username));
}
private static string GenerateAccessToken(long userId, string userRole, string nonce, string secretKey, string issuer, int expiresAfter)
{
SymmetricSecurityKey key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secretKey));
SigningCredentials signingCredentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
List<Claim> claims = new List<Claim>
{
new Claim(ClaimTypes.Role, userRole)
};
JwtSecurityToken token = new JwtSecurityToken(
issuer: issuer,
audience: issuer,
claims: claims,
expires: DateTime.Now.AddSeconds(expiresAfter),
signingCredentials: signingCredentials)
{
Payload =
{
["sub"] = userId,
["iat"] = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
["nonce"] = nonce
}
};
return new JwtSecurityTokenHandler().WriteToken(token);
}
private static string GenerateRefreshToken()
{
string token = Guid.NewGuid().ToString("n");
return token;
}
private static string GenerateNonce()
{
string nonce = Guid.NewGuid().ToString("n");
return nonce;
}
private static TokenResponse GenerateAccessTokenResponse(IUserTokenRepository userTokenRepository, IOAuth appSettingsOAuth, long userId, string userRole, string username)
{
string nonce = GenerateNonce();
string accessToken = GenerateAccessToken(
userId: userId,
userRole: userRole,
nonce: nonce,
secretKey: appSettingsOAuth.SecretKey,
issuer: appSettingsOAuth.Issuer,
expiresAfter: appSettingsOAuth.AccessTokenExpires);
string refreshToken = GenerateRefreshToken();
string checksum = (refreshToken + username).GetSHA256HashString();
userTokenRepository.Add(refreshToken, userId, nonce, appSettingsOAuth.RefreshTokenExpires, checksum);
userTokenRepository.RemoveExpired();
return new TokenResponse
{
AccessToken = accessToken,
TokenType = "bearer",
ExpiresIn = appSettingsOAuth.AccessTokenExpires,
RefreshToken = refreshToken
};
}
}
} | 41.180233 | 209 | 0.643654 | [
"MIT"
] | chatreejs/assistiverobot-web-service | Assistiverobot.Web.Service/Services/AuthenService.cs | 7,083 | C# |
// <auto-generated />
namespace EmpMan.Data.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class AddmorecolumnsonTargettable : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddmorecolumnsonTargettable));
string IMigrationMetadata.Id
{
get { return "201707060715421_Add more columns on Target table"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
| 28.966667 | 110 | 0.636364 | [
"Apache-2.0"
] | hoa-nx/empman-webapi | EmpMan.Data/Migrations/201707060715421_Add more columns on Target table.Designer.cs | 869 | C# |
using Ryujinx.HLE.HOS.Services.SurfaceFlinger.Types;
using System;
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
class ConsumerBase : IConsumerListener
{
public class Slot
{
public AndroidStrongPointer<GraphicBuffer> GraphicBuffer;
public AndroidFence Fence;
public ulong FrameNumber;
public Slot()
{
GraphicBuffer = new AndroidStrongPointer<GraphicBuffer>();
}
}
protected Slot[] Slots = new Slot[BufferSlotArray.NumBufferSlots];
protected bool IsAbandoned;
protected BufferQueueConsumer Consumer;
protected readonly object Lock = new object();
private IConsumerListener _listener;
public ConsumerBase(BufferQueueConsumer consumer, bool controlledByApp, IConsumerListener listener)
{
for (int i = 0; i < Slots.Length; i++)
{
Slots[i] = new Slot();
}
IsAbandoned = false;
Consumer = consumer;
_listener = listener;
Status connectStatus = consumer.Connect(this, controlledByApp);
if (connectStatus != Status.Success)
{
throw new InvalidOperationException();
}
}
public virtual void OnBuffersReleased()
{
lock (Lock)
{
if (IsAbandoned)
{
return;
}
Consumer.GetReleasedBuffers(out ulong slotMask);
for (int i = 0; i < Slots.Length; i++)
{
if ((slotMask & (1UL << i)) != 0)
{
FreeBufferLocked(i);
}
}
}
}
public virtual void OnFrameAvailable(ref BufferItem item)
{
_listener?.OnFrameAvailable(ref item);
}
public virtual void OnFrameReplaced(ref BufferItem item)
{
_listener?.OnFrameReplaced(ref item);
}
protected virtual void FreeBufferLocked(int slotIndex)
{
Slots[slotIndex].GraphicBuffer.Reset();
Slots[slotIndex].Fence = AndroidFence.NoFence;
Slots[slotIndex].FrameNumber = 0;
}
public void Abandon()
{
lock (Lock)
{
if (!IsAbandoned)
{
AbandonLocked();
IsAbandoned = true;
}
}
}
protected virtual void AbandonLocked()
{
for (int i = 0; i < Slots.Length; i++)
{
FreeBufferLocked(i);
}
Consumer.Disconnect();
}
protected virtual Status AcquireBufferLocked(out BufferItem bufferItem, ulong expectedPresent)
{
Status acquireStatus = Consumer.AcquireBuffer(out bufferItem, expectedPresent);
if (acquireStatus != Status.Success)
{
return acquireStatus;
}
if (!bufferItem.GraphicBuffer.IsNull)
{
Slots[bufferItem.Slot].GraphicBuffer.Set(bufferItem.GraphicBuffer.Object);
}
Slots[bufferItem.Slot].FrameNumber = bufferItem.FrameNumber;
Slots[bufferItem.Slot].Fence = bufferItem.Fence;
return Status.Success;
}
protected virtual Status AddReleaseFenceLocked(int slot, ref AndroidStrongPointer<GraphicBuffer> graphicBuffer, ref AndroidFence fence)
{
if (!StillTracking(slot, ref graphicBuffer))
{
return Status.Success;
}
Slots[slot].Fence = fence;
return Status.Success;
}
protected virtual Status ReleaseBufferLocked(int slot, ref AndroidStrongPointer<GraphicBuffer> graphicBuffer)
{
if (!StillTracking(slot, ref graphicBuffer))
{
return Status.Success;
}
Status result = Consumer.ReleaseBuffer(slot, Slots[slot].FrameNumber, ref Slots[slot].Fence);
if (result == Status.StaleBufferSlot)
{
FreeBufferLocked(slot);
}
Slots[slot].Fence = AndroidFence.NoFence;
return result;
}
protected virtual bool StillTracking(int slotIndex, ref AndroidStrongPointer<GraphicBuffer> graphicBuffer)
{
if (slotIndex < 0 || slotIndex >= Slots.Length)
{
return false;
}
Slot slot = Slots[slotIndex];
// TODO: Check this. On Android, this checks the "handle". I assume NvMapHandle is the handle, but it might not be.
return !slot.GraphicBuffer.IsNull && slot.GraphicBuffer.Object.Buffer.Surfaces[0].NvMapHandle == graphicBuffer.Object.Buffer.Surfaces[0].NvMapHandle;
}
}
}
| 28.965909 | 161 | 0.527854 | [
"MIT"
] | 0MrDarn0/Ryujinx | Ryujinx.HLE/HOS/Services/SurfaceFlinger/ConsumerBase.cs | 5,100 | 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("IpsPatcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IpsPatcher")]
[assembly: AssemblyCopyright("Copyright © Pharap 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0a069d06-c7d0-4153-90c0-a5977754084d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 38.783784 | 85 | 0.726829 | [
"Apache-2.0"
] | Pharap/SimpleIpsPatcher | IpsPatcher/IpsPatcher/Properties/AssemblyInfo.cs | 1,438 | C# |
using System;
namespace BlazorDemo.Data
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; }
}
}
| 19.4375 | 70 | 0.575563 | [
"MIT"
] | myvas/AspNetCore.TencentCos | samples/BlazorServerDemo/Data/WeatherForecast.cs | 311 | C# |
using Serious.IO;
namespace UnitTests.Fakes
{
public abstract class FakeFileSystemInfo : IFileSystemInfo
{
protected FakeFileSystemInfo(string path)
{
FullName = path;
}
public bool Hidden { get; private set; }
public void Hide()
{
Hidden = true;
}
public bool Exists { get; set; }
public string FullName { get; }
public override string ToString() => FullName;
}
} | 20.541667 | 62 | 0.551724 | [
"MIT"
] | aseriousbiz/abbot-cli | tests/TestFakes/FakeFileSystemItem.cs | 493 | C# |
using UnityEngine;
using System.Collections;
// VR用
public class WarpStereo : WarpBase {
const int kNumEyes = 2;
// encoded warp maps, [0] for left eye and [1] for right eye.
// (the warp map: tablet's pixel position -> camera's pixel position)
// Because the number of pixels exceed 256, when saving as picture, I encoded the x,y pixel
// coordinates as RGBA channels.
public Texture2D[] encodedMaps = new Texture2D[kNumEyes];
Texture2D[] decodedMaps;
// Use this for initialization
protected void Start () {
Debug.Assert(encodedMaps.Length == kNumEyes);
decodedMaps = new Texture2D[kNumEyes];
material = GetComponent<Renderer>().material;
for (int e = 0; e < kNumEyes; ++e)
ConvertRGBATexture2Map(encodedMaps[e], mapDiv, out decodedMaps[e]);
material.SetTexture("_MapTexL", decodedMaps[0]);
material.SetTexture("_MapTexR", decodedMaps[1]);
}
// Update is called once per frame
// LateUpdate is called after update but before rendering
protected void LateUpdate () {
// although the texture's rotating eulerZ degree, the uv needs to rotate -eulerZ
Quaternion rot = Quaternion.Euler (0, 0, -RotationManager.RotationAngle);
Matrix4x4 m = Matrix4x4.Scale(new Vector3(1.0f/tabletScreenScale.x, 1.0f/tabletScreenScale.y, 1f))
* Matrix4x4.TRS (Vector3.zero, rot, tabletScreenScale);
//material.SetMatrix ("_TextureRotation", m);
material.SetVector("_TexRotationVec", new Vector4(m[0,0], m[0,1], m[1,0], m[1,1]));
material.SetFloat ("_power", power);
material.SetFloat ("_alpha", alpha);
}
} | 41.621622 | 101 | 0.722727 | [
"BSD-3-Clause"
] | hzuika/Pepper-s-Cone-Unity | Assets/Scripts/WarpStereo.cs | 1,544 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LowPowerEnemy : Enemy
{
public LowPowerEnemy()
{
this.attPow = 1;
this.health = 1;
this.score = 100;
this.tag = "Low Power Enemy";
}
public override int getAttPow()
{
return this.attPow;
}
public override int getHealth()
{
return this.health;
}
public override string getTag()
{
return this.tag;
}
public override int getScore()
{
return this.score;
}
}
| 18.451613 | 37 | 0.58042 | [
"MIT"
] | NikoSilveira/Civilization-Rush | Assets/Scripts/AbstractFactory/LP_Enemy.cs | 574 | C# |
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using Newtonsoft.Json;
namespace InventoryKamera
{
public class InventoryKamera
{
[JsonProperty]
public List<Character> Characters { get; private set; }
[JsonProperty]
public Inventory Inventory { get; private set; }
private static List<Artifact> equippedArtifacts;
private static List<Weapon> equippedWeapons;
private static HashSet<Material> Materials;
public static Queue<OCRImage> workerQueue;
private static List<Thread> ImageProcessors;
private static volatile bool b_threadCancel = false;
private static int maxProcessors = 2; // TODO: Add support for more processors
// TODO add language option
public InventoryKamera()
{
Characters = new List<Character>();
Inventory = new Inventory();
equippedArtifacts = new List<Artifact>();
equippedWeapons = new List<Weapon>();
Materials = new HashSet<Material>();
ImageProcessors = new List<Thread>();
workerQueue = new Queue<OCRImage>();
}
public void StopImageProcessorWorkers()
{
b_threadCancel = true;
AwaitProcessors();
workerQueue = new Queue<OCRImage>();
}
public List<Character> GetCharacters()
{
return Characters;
}
public void GatherData(bool[] formats, bool[] checkbox)
{
// Initize Image Processors
for (int i = 0; i < maxProcessors; i++)
{
Thread processor = new Thread(ImageProcessorWorker){ IsBackground = true };
processor.Start();
ImageProcessors.Add(processor);
}
Debug.WriteLine($"Added {ImageProcessors.Count} workers");
Scraper.RestartEngines();
// Scan Main character Name
string mainCharacterName = CharacterScraper.ScanMainCharacterName();
Scraper.AssignTravelerName(mainCharacterName);
Scraper.b_AssignedTravelerName = true;
if (formats[0])
{
if (checkbox[0])
{
// Get Weapons
Navigation.InventoryScreen();
Navigation.SelectWeaponInventory();
WeaponScraper.ScanWeapons();
//inventory.AssignWeapons(ref equippedWeapons);
Navigation.MainMenuScreen();
}
if (checkbox[1])
{
// Get Artifacts
Navigation.InventoryScreen();
Navigation.SelectArtifactInventory();
ArtifactScraper.ScanArtifacts();
//inventory.AssignArtifacts(ref equippedArtifacts);
Navigation.MainMenuScreen();
}
workerQueue.Enqueue(new OCRImage(null, "END", 0));
if (checkbox[2])
{
// Get characters
Navigation.CharacterScreen();
Characters = new List<Character>();
Characters = CharacterScraper.ScanCharacters();
Navigation.MainMenuScreen();
}
// Wait for Image Processors to finish
AwaitProcessors();
if (checkbox[2])
{
// Assign Artifacts to Characters
if (checkbox[1])
AssignArtifacts();
if (checkbox[0])
AssignWeapons();
}
}
if (formats[1])
{
// Scan Character Development Items
if (checkbox[3])
{
// Get Materials
Navigation.InventoryScreen();
Navigation.SelectCharacterDevelopmentInventory();
HashSet<Material> devItems = MaterialScraper.Scan_Materials(InventorySection.CharacterDevelopmentItems);
Inventory.AddDevItems(ref devItems);
Navigation.MainMenuScreen();
}
// Scan Materials
if (checkbox[4])
{
// Get Materials
Navigation.InventoryScreen();
Navigation.SelectMaterialInventory();
HashSet<Material> materials = MaterialScraper.Scan_Materials(InventorySection.Materials);
Inventory.AddMaterials(ref materials);
Navigation.MainMenuScreen();
}
}
}
private void AwaitProcessors()
{
while (ImageProcessors.Count > 0)
{
ImageProcessors.RemoveAll(process => !process.IsAlive);
}
b_threadCancel = false;
}
public void ImageProcessorWorker()
{
Debug.WriteLine($"Thread #{Thread.CurrentThread.ManagedThreadId} priority: {Thread.CurrentThread.Priority}");
while (true)
{
if (b_threadCancel)
{
workerQueue.Clear();
break;
}
if (workerQueue.TryDequeue(out OCRImage image))
{
if (image.type != "END" && image.bm != null)
{
if (image.type == "weapon")
{
if (!WeaponScraper.IsEnhancementOre(image.bm[0]))
{
// Scan as weapon
Weapon w = WeaponScraper.CatalogueFromBitmaps(image.bm, image.id);
if (w.Rarity >= 3) // TODO: Add options for choosing rarities
{
if (w.IsValid())
{
UserInterface.IncrementWeaponCount();
Inventory.Add(w);
UserInterface.SetGear(image.bm[4], w);
if (!string.IsNullOrWhiteSpace(w.EquippedCharacter))
equippedWeapons.Add(w);
}
else
{
UserInterface.AddError($"Unable to validate information for weapon #{image.id}");
// Maybe save bitmaps in some directory to see what an issue might be
}
}
}
}
else if (image.type == "artifact")
{
// Scan as artifact
Artifact artifact = ArtifactScraper.CatalogueFromBitmapsAsync(image.bm, image.id).Result;
if (artifact.Rarity >= 4) // TODO: Add options for choosing rarities
{
if (artifact.IsValid())
{
UserInterface.IncrementArtifactCount();
Inventory.Add(artifact);
UserInterface.SetGear(image.bm[7], artifact);
if (!string.IsNullOrWhiteSpace(artifact.EquippedCharacter))
equippedArtifacts.Add(artifact);
}
else
{
UserInterface.AddError($"Unable to validate information for artifact #{image.id}");
// Maybe save bitmaps in some directory to see what an issue might be
}
}
}
else // not supposed to happen
{
Form1.UnexpectedError("Unknown Image type for Image Processor");
}
// Dispose of everything
image.bm.ForEach(b => b.Dispose());
}
else
{
b_threadCancel = true;
}
}
else
{
// Wait for more images to process
Thread.Sleep(250);
}
}
Debug.WriteLine($"Thread {Thread.CurrentThread.ManagedThreadId} exit");
}
public void AssignArtifacts()
{
foreach (Artifact artifact in equippedArtifacts)
{
foreach (Character character in Characters)
{
if (artifact.EquippedCharacter == character.Name)
{
Debug.WriteLine($"Assigned {artifact.GearSlot} to {character.Name}");
character.AssignArtifact(artifact); // Do we even need to do this?
break;
}
}
}
}
public void AssignWeapons()
{
foreach (Character character in Characters)
{
foreach (Weapon weapon in equippedWeapons)
{
if (weapon.EquippedCharacter == character.Name)
{
Debug.WriteLine($"Assigned {weapon.Name} to {character.Name}");
character.AssignWeapon(weapon);
break;
}
}
if (character.Weapon is null)
{
Inventory.Add(new Weapon(character.WeaponType, character.Name));
}
}
}
}
} | 26.212687 | 112 | 0.645267 | [
"MIT"
] | Christalyum/Inventory_Kamera | InventoryKamera/InventoryKamera.cs | 7,027 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.bliztafree.Services.Locations.API
{
public class LocationSettings
{
public string ExternalCatalogBaseUrl { get; set; }
public string EventBusConnection { get; set; }
public string ConnectionString { get; set; }
public string Database { get; set; }
}
}
| 25.9375 | 58 | 0.701205 | [
"MIT"
] | bliztafree/webdev | src/Services/Location/Locations.API/LocationSettings.cs | 417 | C# |
using System.ComponentModel.DataAnnotations;
namespace PostalCodeApi.Resources
{
/// <summary>
/// Country iso for the GeoNames import
/// </summary>
public class ImportGeoNamesResource
{
[Required]
[MinLength(2)]
[MaxLength(2)]
public string CountryIso { get; set; }
}
} | 21.933333 | 46 | 0.620061 | [
"MIT"
] | malain96/PostalCodeApi | PostalCodeApi/Resources/ImportGeoNamesResource.cs | 331 | C# |
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Thrift;
using Thrift.Collections;
using System.Runtime.Serialization;
using Thrift.Protocol;
using Thrift.Transport;
namespace ThriftSharp.Benchmarking.Models.Thrift
{
public partial class TimePeriod : TBase
{
public long From { get; set; }
public long To { get; set; }
public bool Available { get; set; }
public TimePeriod() {
}
public TimePeriod(long from, long to, bool available) : this() {
this.From = from;
this.To = to;
this.Available = available;
}
public void Read (TProtocol iprot)
{
bool isset_from = false;
bool isset_to = false;
bool isset_available = false;
TField field;
iprot.ReadStructBegin();
while (true)
{
field = iprot.ReadFieldBegin();
if (field.Type == TType.Stop) {
break;
}
switch (field.ID)
{
case 1:
if (field.Type == TType.I64) {
From = iprot.ReadI64();
isset_from = true;
} else {
TProtocolUtil.Skip(iprot, field.Type);
}
break;
case 2:
if (field.Type == TType.I64) {
To = iprot.ReadI64();
isset_to = true;
} else {
TProtocolUtil.Skip(iprot, field.Type);
}
break;
case 3:
if (field.Type == TType.Bool) {
Available = iprot.ReadBool();
isset_available = true;
} else {
TProtocolUtil.Skip(iprot, field.Type);
}
break;
default:
TProtocolUtil.Skip(iprot, field.Type);
break;
}
iprot.ReadFieldEnd();
}
iprot.ReadStructEnd();
if (!isset_from)
throw new TProtocolException(TProtocolException.INVALID_DATA);
if (!isset_to)
throw new TProtocolException(TProtocolException.INVALID_DATA);
if (!isset_available)
throw new TProtocolException(TProtocolException.INVALID_DATA);
}
public void Write(TProtocol oprot) {
TStruct struc = new TStruct("TimePeriod");
oprot.WriteStructBegin(struc);
TField field = new TField();
field.Name = "from";
field.Type = TType.I64;
field.ID = 1;
oprot.WriteFieldBegin(field);
oprot.WriteI64(From);
oprot.WriteFieldEnd();
field.Name = "to";
field.Type = TType.I64;
field.ID = 2;
oprot.WriteFieldBegin(field);
oprot.WriteI64(To);
oprot.WriteFieldEnd();
field.Name = "available";
field.Type = TType.Bool;
field.ID = 3;
oprot.WriteFieldBegin(field);
oprot.WriteBool(Available);
oprot.WriteFieldEnd();
oprot.WriteFieldStop();
oprot.WriteStructEnd();
}
public override string ToString() {
StringBuilder __sb = new StringBuilder("TimePeriod(");
__sb.Append(", From: ");
__sb.Append(From);
__sb.Append(", To: ");
__sb.Append(To);
__sb.Append(", Available: ");
__sb.Append(Available);
__sb.Append(")");
return __sb.ToString();
}
}
}
| 26.462687 | 71 | 0.544557 | [
"MIT"
] | SolalPirelli/ThriftSharp | benchmarks/Models/Thrift/TimePeriod.cs | 3,546 | C# |
using System;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Consoles.ChannelF
{
/// <summary>
/// Disassembler
/// </summary>
public sealed partial class F3850 : IDisassemblable
{
static string Result(string format, Func<ushort, byte> read, ref ushort addr)
{
//d immediately succeeds the opcode
//n immediate succeeds the opcode and the displacement (if present)
//nn immediately succeeds the opcode and the displacement (if present)
if (format.IndexOf("nn") != -1)
{
format = format.Replace("nn", read(addr++)
.ToString("X2") + read(addr++)
.ToString("X2") + "h"); // MSB is read first
}
if (format.IndexOf("n") != -1) format = format.Replace("n", $"{read(addr++):X2}h");
if (format.IndexOf("+d") != -1) format = format.Replace("+d", "d");
if (format.IndexOf("d") != -1)
{
var b = unchecked((sbyte)read(addr++));
format = format.Replace("d", $"{(b < 0 ? '-' : '+')}{(b < 0 ? -b : b):X2}h");
}
return format;
}
static readonly string[] mnemonics = new string[]
{
"LR A, KU", // 0x00
"LR A, KL", // 0x01
"LR A, QU", // 0x02
"LR A, QL", // 0x03
"LR KU, A", // 0x04
"LR KL, A", // 0x05
"LR QU, A", // 0x06
"LR QL, A", // 0x07
"LR K, P", // 0x08
"LR P, K", // 0x09
"LR A, IS", // 0x0A
"LR IS, A", // 0x0B
"PK", // 0x0C
"LR P0, Q", // 0x0D
"LR Q, DC", // 0x0E
"LR DC, Q", // 0x0F
"LR DC, H", // 0x10
"LR H, DC", // 0x11
"SR 1", // 0x12
"SL 1", // 0x13
"SR 4", // 0x14
"SL 4", // 0x15
"LM", // 0x16
"ST", // 0x17
"COM", // 0x18
"LNK", // 0x19
"DI", // 0x1A
"EI", // 0x1B
"POP", // 0x1C
"LR W, J", // 0x1D
"LR J, W", // 0x1E
"INC", // 0x1F
"LI n", // 0x20
"NI n", // 0x21
"OI n", // 0x22
"XI n", // 0x23
"AI n", // 0x24
"CI n", // 0x25
"IN n", // 0x26
"OUT n", // 0x27
"PI nn", // 0x28
"JMP nn", // 0x29
"DCI nn", // 0x2A
"NOP", // 0x2B
"XDC", // 0x2C
"ILLEGAL", // 0x2D
"ILLEGAL", // 0x2E
"ILLEGAL", // 0x2F
"DS r00", // 0x30
"DS r01", // 0x31
"DS r02", // 0x32
"DS r03", // 0x33
"DS r04", // 0x34
"DS r05", // 0x35
"DS r06", // 0x36
"DS r07", // 0x37
"DS r08", // 0x38
"DS r09", // 0x39
"DS r10", // 0x3A
"DS r11", // 0x3B
"DS ISAR", // 0x3C
"DS ISAR INC", // 0x3D
"DS ISAR DEC", // 0x3E
"ILLEGAL", // 0x3F
"LR A, r00", // 0x40
"LR A, r01", // 0x41
"LR A, r02", // 0x42
"LR A, r03", // 0x43
"LR A, r04", // 0x44
"LR A, r05", // 0x45
"LR A, r06", // 0x46
"LR A, r07", // 0x47
"LR A, r08", // 0x48
"LR A, r09", // 0x49
"LR A, r10", // 0x4A
"LR A, r11", // 0x4B
"LR A, (ISAR)", // 0x4C
"LR A, (ISAR) INC", // 0x4D
"LR A, (ISAR) DEC", // 0x4E
"ILLEGAL", // 0x4F
"LR r00, A", // 0x50
"LR r01, A", // 0x51
"LR r02, A", // 0x52
"LR r03, A", // 0x53
"LR r04, A", // 0x54
"LR r05, A", // 0x55
"LR r06, A", // 0x56
"LR r07, A", // 0x57
"LR r08, A", // 0x58
"LR r09, A", // 0x59
"LR r10, A", // 0x5A
"LR r11, A", // 0x5B
"LR ((ISAR)), A", // 0x5C
"LR (ISAR), A INC", // 0x5D
"LR (ISAR), A DEC", // 0x5E
"ILLEGAL", // 0x5F
"LISU 0", // 0x60
"LISU 1", // 0x61
"LISU 2", // 0x62
"LISU 3", // 0x63
"LISU 4", // 0x64
"LISU 5", // 0x65
"LISU 6", // 0x66
"LISU 7", // 0x67
"LISL 0", // 0x68
"LISL 1", // 0x69
"LISL 2", // 0x6A
"LISL 3", // 0x6B
"LISL 4", // 0x6C
"LISL 5", // 0x6D
"LISL 6", // 0x6E
"LISL 7", // 0x6F
"LIS 0", // 0x70
"LIS 1", // 0x71
"LIS 2", // 0x72
"LIS 3", // 0x73
"LIS 4", // 0x74
"LIS 5", // 0x75
"LIS 6", // 0x76
"LIS 7", // 0x77
"LIS 8", // 0x78
"LIS 9", // 0x79
"LIS A", // 0x7A
"LIS B", // 0x7B
"LIS C", // 0x7C
"LIS D", // 0x7D
"LIS E", // 0x7E
"LIS F", // 0x7F
"BT NOBRANCH", // 0x80
"BP d", // 0x81
"BC d", // 0x82
"BP or C d", // 0x83
"BZ d", // 0x84
"BP d", // 0x85
"BZ or C d", // 0x86
"BP or C d", // 0x87
"AM", // 0x88
"AMD", // 0x89
"NM", // 0x8A
"OM", // 0x8B
"XM", // 0x8C
"CM", // 0x8D
"ADC", // 0x8E
"BR7 n", // 0x8F
"BF UNCON d", // 0x90
"BN d", // 0x91
"BNC d", // 0x92
"BNC & deg d", // 0x93
"BNZ d", // 0x94
"BN d", // 0x95
"BNC & dZ d", // 0x96
"BNC & deg d", // 0x97
"BNO d", // 0x98
"BN & dO d", // 0x99
"BNO & dC d", // 0x9A
"BNO & dC & deg d", // 0x9B
"BNO & dZ d", // 0x9C
"BN & dO d", // 0x9D
"BNO & dC & dZ d", // 0x9E
"BNO & dC & deg d", // 0x9F
"INS 0", // 0xA0
"INS 1", // 0xA1
"ILLEGAL", // 0xA2
"ILLEGAL", // 0xA3
"INS 4", // 0xA4
"INS 5", // 0xA5
"INS 6", // 0xA6
"INS 7", // 0xA7
"INS 8", // 0xA8
"INS 9", // 0xA9
"INS 10", // 0xAA
"INS 11", // 0xAB
"INS 12", // 0xAC
"INS 13", // 0xAD
"INS 14", // 0xAE
"INS 16", // 0xAF
"OUTS 0", // 0xB0
"OUTS 1", // 0xB1
"ILLEGAL", // 0xB2
"ILLEGAL", // 0xB3
"OUTS 4", // 0xB4
"OUTS 5", // 0xB5
"OUTS 6", // 0xB6
"OUTS 7", // 0xB7
"OUTS 8", // 0xB8
"OUTS 9", // 0xB9
"OUTS 10", // 0xBA
"OUTS 11", // 0xBB
"OUTS 12", // 0xBC
"OUTS 13", // 0xBD
"OUTS 14", // 0xBE
"OUTS 15", // 0xBF
"AS r00", // 0xC0
"AS r01", // 0xC1
"AS r02", // 0xC2
"AS r03", // 0xC3
"AS r04", // 0xC4
"AS r05", // 0xC5
"AS r06", // 0xC6
"AS r07", // 0xC7
"AS r08", // 0xC8
"AS r09", // 0xC9
"AS r10", // 0xCA
"AS r11", // 0xCB
"AS ISAR", // 0xCC
"AS ISAR INC", // 0xCD
"AS ISAR DEC", // 0xCE
"ILLEGAL", // 0xCF
"ASD r00", // 0xD0
"ASD r01", // 0xD1
"ASD r02", // 0xD2
"ASD r03", // 0xD3
"ASD r04", // 0xD4
"ASD r05", // 0xD5
"ASD r06", // 0xD6
"ASD r07", // 0xD7
"ASD r08", // 0xD8
"ASD r09", // 0xD9
"ASD r10", // 0xDA
"ASD r11", // 0xDB
"ASD ISAR", // 0xDC
"ASD ISAR INC", // 0xDD
"ASD ISAR DEC", // 0xDE
"ILLEGAL", // 0xDF
"XS r00", // 0xE0
"XS r01", // 0xE1
"XS r02", // 0xE2
"XS r03", // 0xE3
"XS r04", // 0xE4
"XS r05", // 0xE5
"XS r06", // 0xE6
"XS r07", // 0xE7
"XS r08", // 0xE8
"XS r09", // 0xE9
"XS r10", // 0xEA
"XS r11", // 0xEB
"XS ISAR", // 0xEC
"XS ISAR INC", // 0xED
"XS ISAR DEC", // 0xEE
"ILLEGAL", // 0xEF
"NS r00", // 0xF0
"NS r01", // 0xF1
"NS r02", // 0xF2
"NS r03", // 0xF3
"NS r04", // 0xF4
"NS r05", // 0xF5
"NS r06", // 0xF6
"NS r07", // 0xF7
"NS r08", // 0xF8
"NS r09", // 0xF9
"NS r10", // 0xFA
"NS r11", // 0xFB
"NS ISAR", // 0xFC
"NS ISAR INC", // 0xFD
"NS ISAR DEC", // 0xFE
"ILLEGAL", // 0xFF
};
public string Disassemble(ushort addr, Func<ushort, byte> read, out int size)
{
ushort start_addr = addr;
ushort extra_inc = 0;
byte A = read(addr++);
string format;
format = mnemonics[A];
string temp = Result(format, read, ref addr);
size = addr - start_addr;
if (addr < start_addr)
{
size = (0x10000 + addr) - start_addr;
}
return temp;
}
#region IDisassemblable
#endregion
public string Cpu
{
get => "F3850";
set { }
}
public string PCRegisterName => "PC";
public IEnumerable<string> AvailableCpus
{
get { yield return "F3850"; }
}
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
string ret = Disassemble((ushort)addr, a => m.PeekByte(a), out length);
return ret;
}
}
}
| 23.313783 | 86 | 0.444906 | [
"MIT"
] | Gorialis/BizHawk | BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/F8/F3850.Disassembler.cs | 7,952 | 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("JO.DateRange")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JO.DateRange")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[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("25e7d264-1ced-4d04-94c7-7368d22f7b1c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 37.621622 | 84 | 0.746408 | [
"MIT"
] | jjowens/DateRange | DateRange/DateRange/DateRange/Properties/AssemblyInfo.cs | 1,395 | C# |
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Pitstop.InvoiceManagementAPI.Repositories;
namespace Pitstop.Application.CustomerManagementAPI.Controllers
{
[Route("/api/[controller]")]
public class RenterController : Controller
{
IRentersRepository _renterRepo;
public RenterController(IRentersRepository repo)
{
_renterRepo = repo;
}
[HttpGet]
public async Task<IActionResult> GetAllAsync()
{
var renters = await _renterRepo.GetRentersAsync();
if (renters == null)
{
return NotFound();
}
return Ok(renters);
}
}
}
| 25.25 | 63 | 0.60396 | [
"Apache-2.0"
] | TselmegGa/AirSupport | src/InvoiceManagementAPI/Controllers/RenterController.cs | 709 | 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 neptune-2014-10-31.normal.json service model.
*/
using System;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Net;
using Amazon.Neptune.Model;
using Amazon.Neptune.Model.Internal.MarshallTransformations;
using Amazon.Neptune.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.Neptune
{
/// <summary>
/// Implementation for accessing Neptune
///
/// Amazon Neptune
/// <para>
/// Amazon Neptune is a fast, reliable, fully-managed graph database service that makes
/// it easy to build and run applications that work with highly connected datasets. The
/// core of Amazon Neptune is a purpose-built, high-performance graph database engine
/// optimized for storing billions of relationships and querying the graph with milliseconds
/// latency. Amazon Neptune supports popular graph models Property Graph and W3C's RDF,
/// and their respective query languages Apache TinkerPop Gremlin and SPARQL, allowing
/// you to easily build queries that efficiently navigate highly connected datasets. Neptune
/// powers graph use cases such as recommendation engines, fraud detection, knowledge
/// graphs, drug discovery, and network security.
/// </para>
///
/// <para>
/// This interface reference for Amazon Neptune contains documentation for a programming
/// or command line interface you can use to manage Amazon Neptune. Note that Amazon Neptune
/// is asynchronous, which means that some interfaces might require techniques such as
/// polling or callback functions to determine when a command has been applied. In this
/// reference, the parameter descriptions indicate whether a command is applied immediately,
/// on the next instance reboot, or during the maintenance window. The reference structure
/// is as follows, and we list following some related topics from the user guide.
/// </para>
/// </summary>
public partial class AmazonNeptuneClient : AmazonServiceClient, IAmazonNeptune
{
private static IServiceMetadata serviceMetadata = new AmazonNeptuneMetadata();
#region Constructors
/// <summary>
/// Constructs AmazonNeptuneClient 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 AmazonNeptuneClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonNeptuneConfig()) { }
/// <summary>
/// Constructs AmazonNeptuneClient 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 AmazonNeptuneClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonNeptuneConfig{RegionEndpoint = region}) { }
/// <summary>
/// Constructs AmazonNeptuneClient 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 AmazonNeptuneClient Configuration Object</param>
public AmazonNeptuneClient(AmazonNeptuneConfig config)
: base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary>
/// Constructs AmazonNeptuneClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
public AmazonNeptuneClient(AWSCredentials credentials)
: this(credentials, new AmazonNeptuneConfig())
{
}
/// <summary>
/// Constructs AmazonNeptuneClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="region">The region to connect.</param>
public AmazonNeptuneClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonNeptuneConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonNeptuneClient with AWS Credentials and an
/// AmazonNeptuneClient Configuration object.
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="clientConfig">The AmazonNeptuneClient Configuration Object</param>
public AmazonNeptuneClient(AWSCredentials credentials, AmazonNeptuneConfig clientConfig)
: base(credentials, clientConfig)
{
}
/// <summary>
/// Constructs AmazonNeptuneClient 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 AmazonNeptuneClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonNeptuneConfig())
{
}
/// <summary>
/// Constructs AmazonNeptuneClient 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 AmazonNeptuneClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonNeptuneConfig() {RegionEndpoint=region})
{
}
/// <summary>
/// Constructs AmazonNeptuneClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonNeptuneClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="clientConfig">The AmazonNeptuneClient Configuration Object</param>
public AmazonNeptuneClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonNeptuneConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
/// <summary>
/// Constructs AmazonNeptuneClient 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 AmazonNeptuneClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonNeptuneConfig())
{
}
/// <summary>
/// Constructs AmazonNeptuneClient 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 AmazonNeptuneClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonNeptuneConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonNeptuneClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonNeptuneClient 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 AmazonNeptuneClient Configuration Object</param>
public AmazonNeptuneClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonNeptuneConfig 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 AddRoleToDBCluster
/// <summary>
/// Associates an Identity and Access Management (IAM) role from an Neptune DB cluster.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddRoleToDBCluster service method.</param>
///
/// <returns>The response from the AddRoleToDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterRoleAlreadyExistsException">
/// The specified IAM role Amazon Resource Name (ARN) is already associated with the specified
/// DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterRoleQuotaExceededException">
/// You have exceeded the maximum number of IAM roles that can be associated with the
/// specified DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/AddRoleToDBCluster">REST API Reference for AddRoleToDBCluster Operation</seealso>
public virtual AddRoleToDBClusterResponse AddRoleToDBCluster(AddRoleToDBClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddRoleToDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddRoleToDBClusterResponseUnmarshaller.Instance;
return Invoke<AddRoleToDBClusterResponse>(request, options);
}
/// <summary>
/// Associates an Identity and Access Management (IAM) role from an Neptune DB cluster.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddRoleToDBCluster service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the AddRoleToDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterRoleAlreadyExistsException">
/// The specified IAM role Amazon Resource Name (ARN) is already associated with the specified
/// DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterRoleQuotaExceededException">
/// You have exceeded the maximum number of IAM roles that can be associated with the
/// specified DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/AddRoleToDBCluster">REST API Reference for AddRoleToDBCluster Operation</seealso>
public virtual Task<AddRoleToDBClusterResponse> AddRoleToDBClusterAsync(AddRoleToDBClusterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = AddRoleToDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddRoleToDBClusterResponseUnmarshaller.Instance;
return InvokeAsync<AddRoleToDBClusterResponse>(request, options, cancellationToken);
}
#endregion
#region AddSourceIdentifierToSubscription
/// <summary>
/// Adds a source identifier to an existing event notification subscription.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddSourceIdentifierToSubscription service method.</param>
///
/// <returns>The response from the AddSourceIdentifierToSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.SourceNotFoundException">
/// The source could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/AddSourceIdentifierToSubscription">REST API Reference for AddSourceIdentifierToSubscription Operation</seealso>
public virtual AddSourceIdentifierToSubscriptionResponse AddSourceIdentifierToSubscription(AddSourceIdentifierToSubscriptionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddSourceIdentifierToSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddSourceIdentifierToSubscriptionResponseUnmarshaller.Instance;
return Invoke<AddSourceIdentifierToSubscriptionResponse>(request, options);
}
/// <summary>
/// Adds a source identifier to an existing event notification subscription.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddSourceIdentifierToSubscription service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the AddSourceIdentifierToSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.SourceNotFoundException">
/// The source could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/AddSourceIdentifierToSubscription">REST API Reference for AddSourceIdentifierToSubscription Operation</seealso>
public virtual Task<AddSourceIdentifierToSubscriptionResponse> AddSourceIdentifierToSubscriptionAsync(AddSourceIdentifierToSubscriptionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = AddSourceIdentifierToSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddSourceIdentifierToSubscriptionResponseUnmarshaller.Instance;
return InvokeAsync<AddSourceIdentifierToSubscriptionResponse>(request, options, cancellationToken);
}
#endregion
#region AddTagsToResource
/// <summary>
/// Adds metadata tags to an Amazon Neptune resource. These tags can also be used with
/// cost allocation reporting to track cost associated with Amazon Neptune resources,
/// or used in a Condition statement in an IAM policy for Amazon Neptune.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddTagsToResource service method.</param>
///
/// <returns>The response from the AddTagsToResource service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotNotFoundException">
/// <i>DBSnapshotIdentifier</i> does not refer to an existing DB snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/AddTagsToResource">REST API Reference for AddTagsToResource Operation</seealso>
public virtual AddTagsToResourceResponse AddTagsToResource(AddTagsToResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddTagsToResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddTagsToResourceResponseUnmarshaller.Instance;
return Invoke<AddTagsToResourceResponse>(request, options);
}
/// <summary>
/// Adds metadata tags to an Amazon Neptune resource. These tags can also be used with
/// cost allocation reporting to track cost associated with Amazon Neptune resources,
/// or used in a Condition statement in an IAM policy for Amazon Neptune.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddTagsToResource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the AddTagsToResource service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotNotFoundException">
/// <i>DBSnapshotIdentifier</i> does not refer to an existing DB snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/AddTagsToResource">REST API Reference for AddTagsToResource Operation</seealso>
public virtual Task<AddTagsToResourceResponse> AddTagsToResourceAsync(AddTagsToResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = AddTagsToResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddTagsToResourceResponseUnmarshaller.Instance;
return InvokeAsync<AddTagsToResourceResponse>(request, options, cancellationToken);
}
#endregion
#region ApplyPendingMaintenanceAction
/// <summary>
/// Applies a pending maintenance action to a resource (for example, to a DB instance).
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ApplyPendingMaintenanceAction service method.</param>
///
/// <returns>The response from the ApplyPendingMaintenanceAction service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.ResourceNotFoundException">
/// The specified resource ID was not found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ApplyPendingMaintenanceAction">REST API Reference for ApplyPendingMaintenanceAction Operation</seealso>
public virtual ApplyPendingMaintenanceActionResponse ApplyPendingMaintenanceAction(ApplyPendingMaintenanceActionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ApplyPendingMaintenanceActionRequestMarshaller.Instance;
options.ResponseUnmarshaller = ApplyPendingMaintenanceActionResponseUnmarshaller.Instance;
return Invoke<ApplyPendingMaintenanceActionResponse>(request, options);
}
/// <summary>
/// Applies a pending maintenance action to a resource (for example, to a DB instance).
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ApplyPendingMaintenanceAction service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ApplyPendingMaintenanceAction service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.ResourceNotFoundException">
/// The specified resource ID was not found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ApplyPendingMaintenanceAction">REST API Reference for ApplyPendingMaintenanceAction Operation</seealso>
public virtual Task<ApplyPendingMaintenanceActionResponse> ApplyPendingMaintenanceActionAsync(ApplyPendingMaintenanceActionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ApplyPendingMaintenanceActionRequestMarshaller.Instance;
options.ResponseUnmarshaller = ApplyPendingMaintenanceActionResponseUnmarshaller.Instance;
return InvokeAsync<ApplyPendingMaintenanceActionResponse>(request, options, cancellationToken);
}
#endregion
#region CopyDBClusterParameterGroup
/// <summary>
/// Copies the specified DB cluster parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CopyDBClusterParameterGroup service method.</param>
///
/// <returns>The response from the CopyDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupAlreadyExistsException">
/// A DB parameter group with the same name exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB parameter groups.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CopyDBClusterParameterGroup">REST API Reference for CopyDBClusterParameterGroup Operation</seealso>
public virtual CopyDBClusterParameterGroupResponse CopyDBClusterParameterGroup(CopyDBClusterParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CopyDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CopyDBClusterParameterGroupResponseUnmarshaller.Instance;
return Invoke<CopyDBClusterParameterGroupResponse>(request, options);
}
/// <summary>
/// Copies the specified DB cluster parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CopyDBClusterParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CopyDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupAlreadyExistsException">
/// A DB parameter group with the same name exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB parameter groups.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CopyDBClusterParameterGroup">REST API Reference for CopyDBClusterParameterGroup Operation</seealso>
public virtual Task<CopyDBClusterParameterGroupResponse> CopyDBClusterParameterGroupAsync(CopyDBClusterParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CopyDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CopyDBClusterParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<CopyDBClusterParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region CopyDBClusterSnapshot
/// <summary>
/// Copies a snapshot of a DB cluster.
///
///
/// <para>
/// To copy a DB cluster snapshot from a shared manual DB cluster snapshot, <code>SourceDBClusterSnapshotIdentifier</code>
/// must be the Amazon Resource Name (ARN) of the shared DB cluster snapshot.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CopyDBClusterSnapshot service method.</param>
///
/// <returns>The response from the CopyDBClusterSnapshot service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotAlreadyExistsException">
/// User already has a DB cluster snapshot with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SnapshotQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB snapshots.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CopyDBClusterSnapshot">REST API Reference for CopyDBClusterSnapshot Operation</seealso>
public virtual CopyDBClusterSnapshotResponse CopyDBClusterSnapshot(CopyDBClusterSnapshotRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CopyDBClusterSnapshotRequestMarshaller.Instance;
options.ResponseUnmarshaller = CopyDBClusterSnapshotResponseUnmarshaller.Instance;
return Invoke<CopyDBClusterSnapshotResponse>(request, options);
}
/// <summary>
/// Copies a snapshot of a DB cluster.
///
///
/// <para>
/// To copy a DB cluster snapshot from a shared manual DB cluster snapshot, <code>SourceDBClusterSnapshotIdentifier</code>
/// must be the Amazon Resource Name (ARN) of the shared DB cluster snapshot.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CopyDBClusterSnapshot service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CopyDBClusterSnapshot service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotAlreadyExistsException">
/// User already has a DB cluster snapshot with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SnapshotQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB snapshots.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CopyDBClusterSnapshot">REST API Reference for CopyDBClusterSnapshot Operation</seealso>
public virtual Task<CopyDBClusterSnapshotResponse> CopyDBClusterSnapshotAsync(CopyDBClusterSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CopyDBClusterSnapshotRequestMarshaller.Instance;
options.ResponseUnmarshaller = CopyDBClusterSnapshotResponseUnmarshaller.Instance;
return InvokeAsync<CopyDBClusterSnapshotResponse>(request, options, cancellationToken);
}
#endregion
#region CopyDBParameterGroup
/// <summary>
/// Copies the specified DB parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CopyDBParameterGroup service method.</param>
///
/// <returns>The response from the CopyDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupAlreadyExistsException">
/// A DB parameter group with the same name exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB parameter groups.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CopyDBParameterGroup">REST API Reference for CopyDBParameterGroup Operation</seealso>
public virtual CopyDBParameterGroupResponse CopyDBParameterGroup(CopyDBParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CopyDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CopyDBParameterGroupResponseUnmarshaller.Instance;
return Invoke<CopyDBParameterGroupResponse>(request, options);
}
/// <summary>
/// Copies the specified DB parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CopyDBParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CopyDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupAlreadyExistsException">
/// A DB parameter group with the same name exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB parameter groups.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CopyDBParameterGroup">REST API Reference for CopyDBParameterGroup Operation</seealso>
public virtual Task<CopyDBParameterGroupResponse> CopyDBParameterGroupAsync(CopyDBParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CopyDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CopyDBParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<CopyDBParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region CreateDBCluster
/// <summary>
/// Creates a new Amazon Neptune DB cluster.
///
///
/// <para>
/// You can use the <code>ReplicationSourceIdentifier</code> parameter to create the DB
/// cluster as a Read Replica of another DB cluster or Amazon Neptune DB instance.
/// </para>
///
/// <para>
/// Note that when you create a new cluster using <code>CreateDBCluster</code> directly,
/// deletion protection is disabled by default (when you create a new production cluster
/// in the console, deletion protection is enabled by default). You can only delete a
/// DB cluster if its <code>DeletionProtection</code> field is set to <code>false</code>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBCluster service method.</param>
///
/// <returns>The response from the CreateDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterAlreadyExistsException">
/// User already has a DB cluster with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterParameterGroupNotFoundException">
/// <i>DBClusterParameterGroupName</i> does not refer to an existing DB Cluster parameter
/// group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterQuotaExceededException">
/// User attempted to create a new DB cluster and the user has already reached the maximum
/// allowed DB cluster quota.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupDoesNotCoverEnoughAZsException">
/// Subnets in the DB subnet group should cover at least two Availability Zones unless
/// there is only one Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientStorageClusterCapacityException">
/// There is insufficient storage available for the current action. You may be able to
/// resolve this error by updating your subnet group to use different Availability Zones
/// that have more storage available.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSubnetGroupStateException">
/// The DB subnet group cannot be deleted because it is in use.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBCluster">REST API Reference for CreateDBCluster Operation</seealso>
public virtual CreateDBClusterResponse CreateDBCluster(CreateDBClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBClusterResponseUnmarshaller.Instance;
return Invoke<CreateDBClusterResponse>(request, options);
}
/// <summary>
/// Creates a new Amazon Neptune DB cluster.
///
///
/// <para>
/// You can use the <code>ReplicationSourceIdentifier</code> parameter to create the DB
/// cluster as a Read Replica of another DB cluster or Amazon Neptune DB instance.
/// </para>
///
/// <para>
/// Note that when you create a new cluster using <code>CreateDBCluster</code> directly,
/// deletion protection is disabled by default (when you create a new production cluster
/// in the console, deletion protection is enabled by default). You can only delete a
/// DB cluster if its <code>DeletionProtection</code> field is set to <code>false</code>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBCluster service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterAlreadyExistsException">
/// User already has a DB cluster with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterParameterGroupNotFoundException">
/// <i>DBClusterParameterGroupName</i> does not refer to an existing DB Cluster parameter
/// group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterQuotaExceededException">
/// User attempted to create a new DB cluster and the user has already reached the maximum
/// allowed DB cluster quota.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupDoesNotCoverEnoughAZsException">
/// Subnets in the DB subnet group should cover at least two Availability Zones unless
/// there is only one Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientStorageClusterCapacityException">
/// There is insufficient storage available for the current action. You may be able to
/// resolve this error by updating your subnet group to use different Availability Zones
/// that have more storage available.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSubnetGroupStateException">
/// The DB subnet group cannot be deleted because it is in use.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBCluster">REST API Reference for CreateDBCluster Operation</seealso>
public virtual Task<CreateDBClusterResponse> CreateDBClusterAsync(CreateDBClusterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBClusterResponseUnmarshaller.Instance;
return InvokeAsync<CreateDBClusterResponse>(request, options, cancellationToken);
}
#endregion
#region CreateDBClusterParameterGroup
/// <summary>
/// Creates a new DB cluster parameter group.
///
///
/// <para>
/// Parameters in a DB cluster parameter group apply to all of the instances in a DB cluster.
/// </para>
///
/// <para>
/// A DB cluster parameter group is initially created with the default parameters for
/// the database engine used by instances in the DB cluster. To provide custom values
/// for any of the parameters, you must modify the group after creating it using <a>ModifyDBClusterParameterGroup</a>.
/// Once you've created a DB cluster parameter group, you need to associate it with your
/// DB cluster using <a>ModifyDBCluster</a>. When you associate a new DB cluster parameter
/// group with a running DB cluster, you need to reboot the DB instances in the DB cluster
/// without failover for the new DB cluster parameter group and associated settings to
/// take effect.
/// </para>
/// <important>
/// <para>
/// After you create a DB cluster parameter group, you should wait at least 5 minutes
/// before creating your first DB cluster that uses that DB cluster parameter group as
/// the default parameter group. This allows Amazon Neptune to fully complete the create
/// action before the DB cluster parameter group is used as the default for a new DB cluster.
/// This is especially important for parameters that are critical when creating the default
/// database for a DB cluster, such as the character set for the default database defined
/// by the <code>character_set_database</code> parameter. You can use the <i>Parameter
/// Groups</i> option of the <a href="https://console.aws.amazon.com/rds/">Amazon Neptune
/// console</a> or the <a>DescribeDBClusterParameters</a> command to verify that your
/// DB cluster parameter group has been created or modified.
/// </para>
/// </important>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBClusterParameterGroup service method.</param>
///
/// <returns>The response from the CreateDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupAlreadyExistsException">
/// A DB parameter group with the same name exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB parameter groups.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBClusterParameterGroup">REST API Reference for CreateDBClusterParameterGroup Operation</seealso>
public virtual CreateDBClusterParameterGroupResponse CreateDBClusterParameterGroup(CreateDBClusterParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBClusterParameterGroupResponseUnmarshaller.Instance;
return Invoke<CreateDBClusterParameterGroupResponse>(request, options);
}
/// <summary>
/// Creates a new DB cluster parameter group.
///
///
/// <para>
/// Parameters in a DB cluster parameter group apply to all of the instances in a DB cluster.
/// </para>
///
/// <para>
/// A DB cluster parameter group is initially created with the default parameters for
/// the database engine used by instances in the DB cluster. To provide custom values
/// for any of the parameters, you must modify the group after creating it using <a>ModifyDBClusterParameterGroup</a>.
/// Once you've created a DB cluster parameter group, you need to associate it with your
/// DB cluster using <a>ModifyDBCluster</a>. When you associate a new DB cluster parameter
/// group with a running DB cluster, you need to reboot the DB instances in the DB cluster
/// without failover for the new DB cluster parameter group and associated settings to
/// take effect.
/// </para>
/// <important>
/// <para>
/// After you create a DB cluster parameter group, you should wait at least 5 minutes
/// before creating your first DB cluster that uses that DB cluster parameter group as
/// the default parameter group. This allows Amazon Neptune to fully complete the create
/// action before the DB cluster parameter group is used as the default for a new DB cluster.
/// This is especially important for parameters that are critical when creating the default
/// database for a DB cluster, such as the character set for the default database defined
/// by the <code>character_set_database</code> parameter. You can use the <i>Parameter
/// Groups</i> option of the <a href="https://console.aws.amazon.com/rds/">Amazon Neptune
/// console</a> or the <a>DescribeDBClusterParameters</a> command to verify that your
/// DB cluster parameter group has been created or modified.
/// </para>
/// </important>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBClusterParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupAlreadyExistsException">
/// A DB parameter group with the same name exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB parameter groups.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBClusterParameterGroup">REST API Reference for CreateDBClusterParameterGroup Operation</seealso>
public virtual Task<CreateDBClusterParameterGroupResponse> CreateDBClusterParameterGroupAsync(CreateDBClusterParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBClusterParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<CreateDBClusterParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region CreateDBClusterSnapshot
/// <summary>
/// Creates a snapshot of a DB cluster.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBClusterSnapshot service method.</param>
///
/// <returns>The response from the CreateDBClusterSnapshot service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotAlreadyExistsException">
/// User already has a DB cluster snapshot with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SnapshotQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB snapshots.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBClusterSnapshot">REST API Reference for CreateDBClusterSnapshot Operation</seealso>
public virtual CreateDBClusterSnapshotResponse CreateDBClusterSnapshot(CreateDBClusterSnapshotRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBClusterSnapshotRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBClusterSnapshotResponseUnmarshaller.Instance;
return Invoke<CreateDBClusterSnapshotResponse>(request, options);
}
/// <summary>
/// Creates a snapshot of a DB cluster.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBClusterSnapshot service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateDBClusterSnapshot service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotAlreadyExistsException">
/// User already has a DB cluster snapshot with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SnapshotQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB snapshots.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBClusterSnapshot">REST API Reference for CreateDBClusterSnapshot Operation</seealso>
public virtual Task<CreateDBClusterSnapshotResponse> CreateDBClusterSnapshotAsync(CreateDBClusterSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBClusterSnapshotRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBClusterSnapshotResponseUnmarshaller.Instance;
return InvokeAsync<CreateDBClusterSnapshotResponse>(request, options, cancellationToken);
}
#endregion
#region CreateDBInstance
/// <summary>
/// Creates a new DB instance.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBInstance service method.</param>
///
/// <returns>The response from the CreateDBInstance service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.AuthorizationNotFoundException">
/// Specified CIDRIP or EC2 security group is not authorized for the specified DB security
/// group.
///
///
/// <para>
/// Neptune may not also be authorized via IAM to perform necessary actions on your behalf.
/// </para>
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceAlreadyExistsException">
/// User already has a DB instance with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSecurityGroupNotFoundException">
/// <i>DBSecurityGroupName</i> does not refer to an existing DB security group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupDoesNotCoverEnoughAZsException">
/// Subnets in the DB subnet group should cover at least two Availability Zones unless
/// there is only one Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DomainNotFoundException">
/// <i>Domain</i> does not refer to an existing Active Directory Domain.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InstanceQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB instances.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientDBInstanceCapacityException">
/// Specified DB instance class is not available in the specified Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.OptionGroupNotFoundException">
/// The designated option group could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.ProvisionedIopsNotAvailableInAZException">
/// Provisioned IOPS not available in the specified Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageTypeNotSupportedException">
/// <i>StorageType</i> specified cannot be associated with the DB Instance.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBInstance">REST API Reference for CreateDBInstance Operation</seealso>
public virtual CreateDBInstanceResponse CreateDBInstance(CreateDBInstanceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBInstanceResponseUnmarshaller.Instance;
return Invoke<CreateDBInstanceResponse>(request, options);
}
/// <summary>
/// Creates a new DB instance.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBInstance service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateDBInstance service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.AuthorizationNotFoundException">
/// Specified CIDRIP or EC2 security group is not authorized for the specified DB security
/// group.
///
///
/// <para>
/// Neptune may not also be authorized via IAM to perform necessary actions on your behalf.
/// </para>
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceAlreadyExistsException">
/// User already has a DB instance with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSecurityGroupNotFoundException">
/// <i>DBSecurityGroupName</i> does not refer to an existing DB security group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupDoesNotCoverEnoughAZsException">
/// Subnets in the DB subnet group should cover at least two Availability Zones unless
/// there is only one Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DomainNotFoundException">
/// <i>Domain</i> does not refer to an existing Active Directory Domain.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InstanceQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB instances.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientDBInstanceCapacityException">
/// Specified DB instance class is not available in the specified Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.OptionGroupNotFoundException">
/// The designated option group could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.ProvisionedIopsNotAvailableInAZException">
/// Provisioned IOPS not available in the specified Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageTypeNotSupportedException">
/// <i>StorageType</i> specified cannot be associated with the DB Instance.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBInstance">REST API Reference for CreateDBInstance Operation</seealso>
public virtual Task<CreateDBInstanceResponse> CreateDBInstanceAsync(CreateDBInstanceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBInstanceResponseUnmarshaller.Instance;
return InvokeAsync<CreateDBInstanceResponse>(request, options, cancellationToken);
}
#endregion
#region CreateDBParameterGroup
/// <summary>
/// Creates a new DB parameter group.
///
///
/// <para>
/// A DB parameter group is initially created with the default parameters for the database
/// engine used by the DB instance. To provide custom values for any of the parameters,
/// you must modify the group after creating it using <i>ModifyDBParameterGroup</i>. Once
/// you've created a DB parameter group, you need to associate it with your DB instance
/// using <i>ModifyDBInstance</i>. When you associate a new DB parameter group with a
/// running DB instance, you need to reboot the DB instance without failover for the new
/// DB parameter group and associated settings to take effect.
/// </para>
/// <important>
/// <para>
/// After you create a DB parameter group, you should wait at least 5 minutes before creating
/// your first DB instance that uses that DB parameter group as the default parameter
/// group. This allows Amazon Neptune to fully complete the create action before the parameter
/// group is used as the default for a new DB instance. This is especially important for
/// parameters that are critical when creating the default database for a DB instance,
/// such as the character set for the default database defined by the <code>character_set_database</code>
/// parameter. You can use the <i>Parameter Groups</i> option of the Amazon Neptune console
/// or the <i>DescribeDBParameters</i> command to verify that your DB parameter group
/// has been created or modified.
/// </para>
/// </important>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBParameterGroup service method.</param>
///
/// <returns>The response from the CreateDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupAlreadyExistsException">
/// A DB parameter group with the same name exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB parameter groups.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBParameterGroup">REST API Reference for CreateDBParameterGroup Operation</seealso>
public virtual CreateDBParameterGroupResponse CreateDBParameterGroup(CreateDBParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBParameterGroupResponseUnmarshaller.Instance;
return Invoke<CreateDBParameterGroupResponse>(request, options);
}
/// <summary>
/// Creates a new DB parameter group.
///
///
/// <para>
/// A DB parameter group is initially created with the default parameters for the database
/// engine used by the DB instance. To provide custom values for any of the parameters,
/// you must modify the group after creating it using <i>ModifyDBParameterGroup</i>. Once
/// you've created a DB parameter group, you need to associate it with your DB instance
/// using <i>ModifyDBInstance</i>. When you associate a new DB parameter group with a
/// running DB instance, you need to reboot the DB instance without failover for the new
/// DB parameter group and associated settings to take effect.
/// </para>
/// <important>
/// <para>
/// After you create a DB parameter group, you should wait at least 5 minutes before creating
/// your first DB instance that uses that DB parameter group as the default parameter
/// group. This allows Amazon Neptune to fully complete the create action before the parameter
/// group is used as the default for a new DB instance. This is especially important for
/// parameters that are critical when creating the default database for a DB instance,
/// such as the character set for the default database defined by the <code>character_set_database</code>
/// parameter. You can use the <i>Parameter Groups</i> option of the Amazon Neptune console
/// or the <i>DescribeDBParameters</i> command to verify that your DB parameter group
/// has been created or modified.
/// </para>
/// </important>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupAlreadyExistsException">
/// A DB parameter group with the same name exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB parameter groups.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBParameterGroup">REST API Reference for CreateDBParameterGroup Operation</seealso>
public virtual Task<CreateDBParameterGroupResponse> CreateDBParameterGroupAsync(CreateDBParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<CreateDBParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region CreateDBSubnetGroup
/// <summary>
/// Creates a new DB subnet group. DB subnet groups must contain at least one subnet in
/// at least two AZs in the AWS Region.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBSubnetGroup service method.</param>
///
/// <returns>The response from the CreateDBSubnetGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupAlreadyExistsException">
/// <i>DBSubnetGroupName</i> is already used by an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupDoesNotCoverEnoughAZsException">
/// Subnets in the DB subnet group should cover at least two Availability Zones unless
/// there is only one Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB subnet groups.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetQuotaExceededException">
/// Request would result in user exceeding the allowed number of subnets in a DB subnet
/// groups.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBSubnetGroup">REST API Reference for CreateDBSubnetGroup Operation</seealso>
public virtual CreateDBSubnetGroupResponse CreateDBSubnetGroup(CreateDBSubnetGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBSubnetGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBSubnetGroupResponseUnmarshaller.Instance;
return Invoke<CreateDBSubnetGroupResponse>(request, options);
}
/// <summary>
/// Creates a new DB subnet group. DB subnet groups must contain at least one subnet in
/// at least two AZs in the AWS Region.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDBSubnetGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateDBSubnetGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupAlreadyExistsException">
/// <i>DBSubnetGroupName</i> is already used by an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupDoesNotCoverEnoughAZsException">
/// Subnets in the DB subnet group should cover at least two Availability Zones unless
/// there is only one Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB subnet groups.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetQuotaExceededException">
/// Request would result in user exceeding the allowed number of subnets in a DB subnet
/// groups.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateDBSubnetGroup">REST API Reference for CreateDBSubnetGroup Operation</seealso>
public virtual Task<CreateDBSubnetGroupResponse> CreateDBSubnetGroupAsync(CreateDBSubnetGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateDBSubnetGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateDBSubnetGroupResponseUnmarshaller.Instance;
return InvokeAsync<CreateDBSubnetGroupResponse>(request, options, cancellationToken);
}
#endregion
#region CreateEventSubscription
/// <summary>
/// Creates an event notification subscription. This action requires a topic ARN (Amazon
/// Resource Name) created by either the Neptune console, the SNS console, or the SNS
/// API. To obtain an ARN with SNS, you must create a topic in Amazon SNS and subscribe
/// to the topic. The ARN is displayed in the SNS console.
///
///
/// <para>
/// You can specify the type of source (SourceType) you want to be notified of, provide
/// a list of Neptune sources (SourceIds) that triggers the events, and provide a list
/// of event categories (EventCategories) for events you want to be notified of. For example,
/// you can specify SourceType = db-instance, SourceIds = mydbinstance1, mydbinstance2
/// and EventCategories = Availability, Backup.
/// </para>
///
/// <para>
/// If you specify both the SourceType and SourceIds, such as SourceType = db-instance
/// and SourceIdentifier = myDBInstance1, you are notified of all the db-instance events
/// for the specified source. If you specify a SourceType but do not specify a SourceIdentifier,
/// you receive notice of the events for that source type for all your Neptune sources.
/// If you do not specify either the SourceType nor the SourceIdentifier, you are notified
/// of events generated from all Neptune sources belonging to your customer account.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateEventSubscription service method.</param>
///
/// <returns>The response from the CreateEventSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.EventSubscriptionQuotaExceededException">
/// You have exceeded the number of events you can subscribe to.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSInvalidTopicException">
/// The SNS topic is invalid.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSNoAuthorizationException">
/// There is no SNS authorization.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSTopicArnNotFoundException">
/// The ARN of the SNS topic could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SourceNotFoundException">
/// The source could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionAlreadyExistException">
/// This subscription already exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionCategoryNotFoundException">
/// The designated subscription category could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateEventSubscription">REST API Reference for CreateEventSubscription Operation</seealso>
public virtual CreateEventSubscriptionResponse CreateEventSubscription(CreateEventSubscriptionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateEventSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateEventSubscriptionResponseUnmarshaller.Instance;
return Invoke<CreateEventSubscriptionResponse>(request, options);
}
/// <summary>
/// Creates an event notification subscription. This action requires a topic ARN (Amazon
/// Resource Name) created by either the Neptune console, the SNS console, or the SNS
/// API. To obtain an ARN with SNS, you must create a topic in Amazon SNS and subscribe
/// to the topic. The ARN is displayed in the SNS console.
///
///
/// <para>
/// You can specify the type of source (SourceType) you want to be notified of, provide
/// a list of Neptune sources (SourceIds) that triggers the events, and provide a list
/// of event categories (EventCategories) for events you want to be notified of. For example,
/// you can specify SourceType = db-instance, SourceIds = mydbinstance1, mydbinstance2
/// and EventCategories = Availability, Backup.
/// </para>
///
/// <para>
/// If you specify both the SourceType and SourceIds, such as SourceType = db-instance
/// and SourceIdentifier = myDBInstance1, you are notified of all the db-instance events
/// for the specified source. If you specify a SourceType but do not specify a SourceIdentifier,
/// you receive notice of the events for that source type for all your Neptune sources.
/// If you do not specify either the SourceType nor the SourceIdentifier, you are notified
/// of events generated from all Neptune sources belonging to your customer account.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateEventSubscription service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateEventSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.EventSubscriptionQuotaExceededException">
/// You have exceeded the number of events you can subscribe to.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSInvalidTopicException">
/// The SNS topic is invalid.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSNoAuthorizationException">
/// There is no SNS authorization.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSTopicArnNotFoundException">
/// The ARN of the SNS topic could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SourceNotFoundException">
/// The source could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionAlreadyExistException">
/// This subscription already exists.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionCategoryNotFoundException">
/// The designated subscription category could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/CreateEventSubscription">REST API Reference for CreateEventSubscription Operation</seealso>
public virtual Task<CreateEventSubscriptionResponse> CreateEventSubscriptionAsync(CreateEventSubscriptionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateEventSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateEventSubscriptionResponseUnmarshaller.Instance;
return InvokeAsync<CreateEventSubscriptionResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteDBCluster
/// <summary>
/// The DeleteDBCluster action deletes a previously provisioned DB cluster. When you delete
/// a DB cluster, all automated backups for that DB cluster are deleted and can't be recovered.
/// Manual DB cluster snapshots of the specified DB cluster are not deleted.
///
///
/// <para>
/// Note that the DB Cluster cannot be deleted if deletion protection is enabled. To delete
/// it, you must first set its <code>DeletionProtection</code> field to <code>False</code>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBCluster service method.</param>
///
/// <returns>The response from the DeleteDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotAlreadyExistsException">
/// User already has a DB cluster snapshot with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SnapshotQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB snapshots.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBCluster">REST API Reference for DeleteDBCluster Operation</seealso>
public virtual DeleteDBClusterResponse DeleteDBCluster(DeleteDBClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBClusterResponseUnmarshaller.Instance;
return Invoke<DeleteDBClusterResponse>(request, options);
}
/// <summary>
/// The DeleteDBCluster action deletes a previously provisioned DB cluster. When you delete
/// a DB cluster, all automated backups for that DB cluster are deleted and can't be recovered.
/// Manual DB cluster snapshots of the specified DB cluster are not deleted.
///
///
/// <para>
/// Note that the DB Cluster cannot be deleted if deletion protection is enabled. To delete
/// it, you must first set its <code>DeletionProtection</code> field to <code>False</code>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBCluster service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotAlreadyExistsException">
/// User already has a DB cluster snapshot with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SnapshotQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB snapshots.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBCluster">REST API Reference for DeleteDBCluster Operation</seealso>
public virtual Task<DeleteDBClusterResponse> DeleteDBClusterAsync(DeleteDBClusterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBClusterResponseUnmarshaller.Instance;
return InvokeAsync<DeleteDBClusterResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteDBClusterParameterGroup
/// <summary>
/// Deletes a specified DB cluster parameter group. The DB cluster parameter group to
/// be deleted can't be associated with any DB clusters.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBClusterParameterGroup service method.</param>
///
/// <returns>The response from the DeleteDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBClusterParameterGroup">REST API Reference for DeleteDBClusterParameterGroup Operation</seealso>
public virtual DeleteDBClusterParameterGroupResponse DeleteDBClusterParameterGroup(DeleteDBClusterParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBClusterParameterGroupResponseUnmarshaller.Instance;
return Invoke<DeleteDBClusterParameterGroupResponse>(request, options);
}
/// <summary>
/// Deletes a specified DB cluster parameter group. The DB cluster parameter group to
/// be deleted can't be associated with any DB clusters.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBClusterParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBClusterParameterGroup">REST API Reference for DeleteDBClusterParameterGroup Operation</seealso>
public virtual Task<DeleteDBClusterParameterGroupResponse> DeleteDBClusterParameterGroupAsync(DeleteDBClusterParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBClusterParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<DeleteDBClusterParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteDBClusterSnapshot
/// <summary>
/// Deletes a DB cluster snapshot. If the snapshot is being copied, the copy operation
/// is terminated.
///
/// <note>
/// <para>
/// The DB cluster snapshot must be in the <code>available</code> state to be deleted.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBClusterSnapshot service method.</param>
///
/// <returns>The response from the DeleteDBClusterSnapshot service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBClusterSnapshot">REST API Reference for DeleteDBClusterSnapshot Operation</seealso>
public virtual DeleteDBClusterSnapshotResponse DeleteDBClusterSnapshot(DeleteDBClusterSnapshotRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBClusterSnapshotRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBClusterSnapshotResponseUnmarshaller.Instance;
return Invoke<DeleteDBClusterSnapshotResponse>(request, options);
}
/// <summary>
/// Deletes a DB cluster snapshot. If the snapshot is being copied, the copy operation
/// is terminated.
///
/// <note>
/// <para>
/// The DB cluster snapshot must be in the <code>available</code> state to be deleted.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBClusterSnapshot service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteDBClusterSnapshot service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBClusterSnapshot">REST API Reference for DeleteDBClusterSnapshot Operation</seealso>
public virtual Task<DeleteDBClusterSnapshotResponse> DeleteDBClusterSnapshotAsync(DeleteDBClusterSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBClusterSnapshotRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBClusterSnapshotResponseUnmarshaller.Instance;
return InvokeAsync<DeleteDBClusterSnapshotResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteDBInstance
/// <summary>
/// The DeleteDBInstance action deletes a previously provisioned DB instance. When you
/// delete a DB instance, all automated backups for that instance are deleted and can't
/// be recovered. Manual DB snapshots of the DB instance to be deleted by <code>DeleteDBInstance</code>
/// are not deleted.
///
///
/// <para>
/// If you request a final DB snapshot the status of the Amazon Neptune DB instance is
/// <code>deleting</code> until the DB snapshot is created. The API action <code>DescribeDBInstance</code>
/// is used to monitor the status of this operation. The action can't be canceled or reverted
/// once submitted.
/// </para>
///
/// <para>
/// Note that when a DB instance is in a failure state and has a status of <code>failed</code>,
/// <code>incompatible-restore</code>, or <code>incompatible-network</code>, you can only
/// delete it when the <code>SkipFinalSnapshot</code> parameter is set to <code>true</code>.
/// </para>
///
/// <para>
/// You can't delete a DB instance if it is the only instance in the DB cluster, or if
/// it has deletion protection enabled.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBInstance service method.</param>
///
/// <returns>The response from the DeleteDBInstance service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotAlreadyExistsException">
/// <i>DBSnapshotIdentifier</i> is already used by an existing snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SnapshotQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB snapshots.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBInstance">REST API Reference for DeleteDBInstance Operation</seealso>
public virtual DeleteDBInstanceResponse DeleteDBInstance(DeleteDBInstanceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBInstanceResponseUnmarshaller.Instance;
return Invoke<DeleteDBInstanceResponse>(request, options);
}
/// <summary>
/// The DeleteDBInstance action deletes a previously provisioned DB instance. When you
/// delete a DB instance, all automated backups for that instance are deleted and can't
/// be recovered. Manual DB snapshots of the DB instance to be deleted by <code>DeleteDBInstance</code>
/// are not deleted.
///
///
/// <para>
/// If you request a final DB snapshot the status of the Amazon Neptune DB instance is
/// <code>deleting</code> until the DB snapshot is created. The API action <code>DescribeDBInstance</code>
/// is used to monitor the status of this operation. The action can't be canceled or reverted
/// once submitted.
/// </para>
///
/// <para>
/// Note that when a DB instance is in a failure state and has a status of <code>failed</code>,
/// <code>incompatible-restore</code>, or <code>incompatible-network</code>, you can only
/// delete it when the <code>SkipFinalSnapshot</code> parameter is set to <code>true</code>.
/// </para>
///
/// <para>
/// You can't delete a DB instance if it is the only instance in the DB cluster, or if
/// it has deletion protection enabled.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBInstance service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteDBInstance service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotAlreadyExistsException">
/// <i>DBSnapshotIdentifier</i> is already used by an existing snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SnapshotQuotaExceededException">
/// Request would result in user exceeding the allowed number of DB snapshots.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBInstance">REST API Reference for DeleteDBInstance Operation</seealso>
public virtual Task<DeleteDBInstanceResponse> DeleteDBInstanceAsync(DeleteDBInstanceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBInstanceResponseUnmarshaller.Instance;
return InvokeAsync<DeleteDBInstanceResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteDBParameterGroup
/// <summary>
/// Deletes a specified DBParameterGroup. The DBParameterGroup to be deleted can't be
/// associated with any DB instances.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBParameterGroup service method.</param>
///
/// <returns>The response from the DeleteDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBParameterGroup">REST API Reference for DeleteDBParameterGroup Operation</seealso>
public virtual DeleteDBParameterGroupResponse DeleteDBParameterGroup(DeleteDBParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBParameterGroupResponseUnmarshaller.Instance;
return Invoke<DeleteDBParameterGroupResponse>(request, options);
}
/// <summary>
/// Deletes a specified DBParameterGroup. The DBParameterGroup to be deleted can't be
/// associated with any DB instances.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBParameterGroup">REST API Reference for DeleteDBParameterGroup Operation</seealso>
public virtual Task<DeleteDBParameterGroupResponse> DeleteDBParameterGroupAsync(DeleteDBParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<DeleteDBParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteDBSubnetGroup
/// <summary>
/// Deletes a DB subnet group.
///
/// <note>
/// <para>
/// The specified database subnet group must not be associated with any DB instances.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBSubnetGroup service method.</param>
///
/// <returns>The response from the DeleteDBSubnetGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSubnetGroupStateException">
/// The DB subnet group cannot be deleted because it is in use.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSubnetStateException">
/// The DB subnet is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBSubnetGroup">REST API Reference for DeleteDBSubnetGroup Operation</seealso>
public virtual DeleteDBSubnetGroupResponse DeleteDBSubnetGroup(DeleteDBSubnetGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBSubnetGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBSubnetGroupResponseUnmarshaller.Instance;
return Invoke<DeleteDBSubnetGroupResponse>(request, options);
}
/// <summary>
/// Deletes a DB subnet group.
///
/// <note>
/// <para>
/// The specified database subnet group must not be associated with any DB instances.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDBSubnetGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteDBSubnetGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSubnetGroupStateException">
/// The DB subnet group cannot be deleted because it is in use.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSubnetStateException">
/// The DB subnet is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteDBSubnetGroup">REST API Reference for DeleteDBSubnetGroup Operation</seealso>
public virtual Task<DeleteDBSubnetGroupResponse> DeleteDBSubnetGroupAsync(DeleteDBSubnetGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteDBSubnetGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteDBSubnetGroupResponseUnmarshaller.Instance;
return InvokeAsync<DeleteDBSubnetGroupResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteEventSubscription
/// <summary>
/// Deletes an event notification subscription.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteEventSubscription service method.</param>
///
/// <returns>The response from the DeleteEventSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.InvalidEventSubscriptionStateException">
/// The event subscription is in an invalid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteEventSubscription">REST API Reference for DeleteEventSubscription Operation</seealso>
public virtual DeleteEventSubscriptionResponse DeleteEventSubscription(DeleteEventSubscriptionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteEventSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteEventSubscriptionResponseUnmarshaller.Instance;
return Invoke<DeleteEventSubscriptionResponse>(request, options);
}
/// <summary>
/// Deletes an event notification subscription.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteEventSubscription service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteEventSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.InvalidEventSubscriptionStateException">
/// The event subscription is in an invalid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DeleteEventSubscription">REST API Reference for DeleteEventSubscription Operation</seealso>
public virtual Task<DeleteEventSubscriptionResponse> DeleteEventSubscriptionAsync(DeleteEventSubscriptionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteEventSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteEventSubscriptionResponseUnmarshaller.Instance;
return InvokeAsync<DeleteEventSubscriptionResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBClusterParameterGroups
/// <summary>
/// Returns a list of <code>DBClusterParameterGroup</code> descriptions. If a <code>DBClusterParameterGroupName</code>
/// parameter is specified, the list will contain only the description of the specified
/// DB cluster parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusterParameterGroups service method.</param>
///
/// <returns>The response from the DescribeDBClusterParameterGroups service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusterParameterGroups">REST API Reference for DescribeDBClusterParameterGroups Operation</seealso>
public virtual DescribeDBClusterParameterGroupsResponse DescribeDBClusterParameterGroups(DescribeDBClusterParameterGroupsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClusterParameterGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClusterParameterGroupsResponseUnmarshaller.Instance;
return Invoke<DescribeDBClusterParameterGroupsResponse>(request, options);
}
/// <summary>
/// Returns a list of <code>DBClusterParameterGroup</code> descriptions. If a <code>DBClusterParameterGroupName</code>
/// parameter is specified, the list will contain only the description of the specified
/// DB cluster parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusterParameterGroups service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBClusterParameterGroups service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusterParameterGroups">REST API Reference for DescribeDBClusterParameterGroups Operation</seealso>
public virtual Task<DescribeDBClusterParameterGroupsResponse> DescribeDBClusterParameterGroupsAsync(DescribeDBClusterParameterGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClusterParameterGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClusterParameterGroupsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBClusterParameterGroupsResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBClusterParameters
/// <summary>
/// Returns the detailed parameter list for a particular DB cluster parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusterParameters service method.</param>
///
/// <returns>The response from the DescribeDBClusterParameters service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusterParameters">REST API Reference for DescribeDBClusterParameters Operation</seealso>
public virtual DescribeDBClusterParametersResponse DescribeDBClusterParameters(DescribeDBClusterParametersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClusterParametersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClusterParametersResponseUnmarshaller.Instance;
return Invoke<DescribeDBClusterParametersResponse>(request, options);
}
/// <summary>
/// Returns the detailed parameter list for a particular DB cluster parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusterParameters service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBClusterParameters service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusterParameters">REST API Reference for DescribeDBClusterParameters Operation</seealso>
public virtual Task<DescribeDBClusterParametersResponse> DescribeDBClusterParametersAsync(DescribeDBClusterParametersRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClusterParametersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClusterParametersResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBClusterParametersResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBClusters
/// <summary>
/// Returns information about provisioned DB clusters, and supports pagination.
///
/// <note>
/// <para>
/// This operation can also return information for Amazon RDS clusters and Amazon DocDB
/// clusters.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusters service method.</param>
///
/// <returns>The response from the DescribeDBClusters service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusters">REST API Reference for DescribeDBClusters Operation</seealso>
public virtual DescribeDBClustersResponse DescribeDBClusters(DescribeDBClustersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClustersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClustersResponseUnmarshaller.Instance;
return Invoke<DescribeDBClustersResponse>(request, options);
}
/// <summary>
/// Returns information about provisioned DB clusters, and supports pagination.
///
/// <note>
/// <para>
/// This operation can also return information for Amazon RDS clusters and Amazon DocDB
/// clusters.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusters service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBClusters service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusters">REST API Reference for DescribeDBClusters Operation</seealso>
public virtual Task<DescribeDBClustersResponse> DescribeDBClustersAsync(DescribeDBClustersRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClustersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClustersResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBClustersResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBClusterSnapshotAttributes
/// <summary>
/// Returns a list of DB cluster snapshot attribute names and values for a manual DB cluster
/// snapshot.
///
///
/// <para>
/// When sharing snapshots with other AWS accounts, <code>DescribeDBClusterSnapshotAttributes</code>
/// returns the <code>restore</code> attribute and a list of IDs for the AWS accounts
/// that are authorized to copy or restore the manual DB cluster snapshot. If <code>all</code>
/// is included in the list of values for the <code>restore</code> attribute, then the
/// manual DB cluster snapshot is public and can be copied or restored by all AWS accounts.
/// </para>
///
/// <para>
/// To add or remove access for an AWS account to copy or restore a manual DB cluster
/// snapshot, or to make the manual DB cluster snapshot public or private, use the <a>ModifyDBClusterSnapshotAttribute</a>
/// API action.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusterSnapshotAttributes service method.</param>
///
/// <returns>The response from the DescribeDBClusterSnapshotAttributes service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusterSnapshotAttributes">REST API Reference for DescribeDBClusterSnapshotAttributes Operation</seealso>
public virtual DescribeDBClusterSnapshotAttributesResponse DescribeDBClusterSnapshotAttributes(DescribeDBClusterSnapshotAttributesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClusterSnapshotAttributesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClusterSnapshotAttributesResponseUnmarshaller.Instance;
return Invoke<DescribeDBClusterSnapshotAttributesResponse>(request, options);
}
/// <summary>
/// Returns a list of DB cluster snapshot attribute names and values for a manual DB cluster
/// snapshot.
///
///
/// <para>
/// When sharing snapshots with other AWS accounts, <code>DescribeDBClusterSnapshotAttributes</code>
/// returns the <code>restore</code> attribute and a list of IDs for the AWS accounts
/// that are authorized to copy or restore the manual DB cluster snapshot. If <code>all</code>
/// is included in the list of values for the <code>restore</code> attribute, then the
/// manual DB cluster snapshot is public and can be copied or restored by all AWS accounts.
/// </para>
///
/// <para>
/// To add or remove access for an AWS account to copy or restore a manual DB cluster
/// snapshot, or to make the manual DB cluster snapshot public or private, use the <a>ModifyDBClusterSnapshotAttribute</a>
/// API action.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusterSnapshotAttributes service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBClusterSnapshotAttributes service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusterSnapshotAttributes">REST API Reference for DescribeDBClusterSnapshotAttributes Operation</seealso>
public virtual Task<DescribeDBClusterSnapshotAttributesResponse> DescribeDBClusterSnapshotAttributesAsync(DescribeDBClusterSnapshotAttributesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClusterSnapshotAttributesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClusterSnapshotAttributesResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBClusterSnapshotAttributesResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBClusterSnapshots
/// <summary>
/// Returns information about DB cluster snapshots. This API action supports pagination.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusterSnapshots service method.</param>
///
/// <returns>The response from the DescribeDBClusterSnapshots service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusterSnapshots">REST API Reference for DescribeDBClusterSnapshots Operation</seealso>
public virtual DescribeDBClusterSnapshotsResponse DescribeDBClusterSnapshots(DescribeDBClusterSnapshotsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClusterSnapshotsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClusterSnapshotsResponseUnmarshaller.Instance;
return Invoke<DescribeDBClusterSnapshotsResponse>(request, options);
}
/// <summary>
/// Returns information about DB cluster snapshots. This API action supports pagination.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBClusterSnapshots service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBClusterSnapshots service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBClusterSnapshots">REST API Reference for DescribeDBClusterSnapshots Operation</seealso>
public virtual Task<DescribeDBClusterSnapshotsResponse> DescribeDBClusterSnapshotsAsync(DescribeDBClusterSnapshotsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBClusterSnapshotsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBClusterSnapshotsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBClusterSnapshotsResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBEngineVersions
/// <summary>
/// Returns a list of the available DB engines.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBEngineVersions service method.</param>
///
/// <returns>The response from the DescribeDBEngineVersions service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBEngineVersions">REST API Reference for DescribeDBEngineVersions Operation</seealso>
public virtual DescribeDBEngineVersionsResponse DescribeDBEngineVersions(DescribeDBEngineVersionsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBEngineVersionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBEngineVersionsResponseUnmarshaller.Instance;
return Invoke<DescribeDBEngineVersionsResponse>(request, options);
}
/// <summary>
/// Returns a list of the available DB engines.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBEngineVersions service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBEngineVersions service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBEngineVersions">REST API Reference for DescribeDBEngineVersions Operation</seealso>
public virtual Task<DescribeDBEngineVersionsResponse> DescribeDBEngineVersionsAsync(DescribeDBEngineVersionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBEngineVersionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBEngineVersionsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBEngineVersionsResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBInstances
/// <summary>
/// Returns information about provisioned instances, and supports pagination.
///
/// <note>
/// <para>
/// This operation can also return information for Amazon RDS instances and Amazon DocDB
/// instances.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBInstances service method.</param>
///
/// <returns>The response from the DescribeDBInstances service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBInstances">REST API Reference for DescribeDBInstances Operation</seealso>
public virtual DescribeDBInstancesResponse DescribeDBInstances(DescribeDBInstancesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBInstancesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBInstancesResponseUnmarshaller.Instance;
return Invoke<DescribeDBInstancesResponse>(request, options);
}
/// <summary>
/// Returns information about provisioned instances, and supports pagination.
///
/// <note>
/// <para>
/// This operation can also return information for Amazon RDS instances and Amazon DocDB
/// instances.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBInstances service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBInstances service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBInstances">REST API Reference for DescribeDBInstances Operation</seealso>
public virtual Task<DescribeDBInstancesResponse> DescribeDBInstancesAsync(DescribeDBInstancesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBInstancesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBInstancesResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBInstancesResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBParameterGroups
/// <summary>
/// Returns a list of <code>DBParameterGroup</code> descriptions. If a <code>DBParameterGroupName</code>
/// is specified, the list will contain only the description of the specified DB parameter
/// group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBParameterGroups service method.</param>
///
/// <returns>The response from the DescribeDBParameterGroups service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBParameterGroups">REST API Reference for DescribeDBParameterGroups Operation</seealso>
public virtual DescribeDBParameterGroupsResponse DescribeDBParameterGroups(DescribeDBParameterGroupsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBParameterGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBParameterGroupsResponseUnmarshaller.Instance;
return Invoke<DescribeDBParameterGroupsResponse>(request, options);
}
/// <summary>
/// Returns a list of <code>DBParameterGroup</code> descriptions. If a <code>DBParameterGroupName</code>
/// is specified, the list will contain only the description of the specified DB parameter
/// group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBParameterGroups service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBParameterGroups service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBParameterGroups">REST API Reference for DescribeDBParameterGroups Operation</seealso>
public virtual Task<DescribeDBParameterGroupsResponse> DescribeDBParameterGroupsAsync(DescribeDBParameterGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBParameterGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBParameterGroupsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBParameterGroupsResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBParameters
/// <summary>
/// Returns the detailed parameter list for a particular DB parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBParameters service method.</param>
///
/// <returns>The response from the DescribeDBParameters service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBParameters">REST API Reference for DescribeDBParameters Operation</seealso>
public virtual DescribeDBParametersResponse DescribeDBParameters(DescribeDBParametersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBParametersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBParametersResponseUnmarshaller.Instance;
return Invoke<DescribeDBParametersResponse>(request, options);
}
/// <summary>
/// Returns the detailed parameter list for a particular DB parameter group.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBParameters service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBParameters service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBParameters">REST API Reference for DescribeDBParameters Operation</seealso>
public virtual Task<DescribeDBParametersResponse> DescribeDBParametersAsync(DescribeDBParametersRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBParametersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBParametersResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBParametersResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeDBSubnetGroups
/// <summary>
/// Returns a list of DBSubnetGroup descriptions. If a DBSubnetGroupName is specified,
/// the list will contain only the descriptions of the specified DBSubnetGroup.
///
///
/// <para>
/// For an overview of CIDR ranges, go to the <a href="http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Wikipedia
/// Tutorial</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBSubnetGroups service method.</param>
///
/// <returns>The response from the DescribeDBSubnetGroups service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBSubnetGroups">REST API Reference for DescribeDBSubnetGroups Operation</seealso>
public virtual DescribeDBSubnetGroupsResponse DescribeDBSubnetGroups(DescribeDBSubnetGroupsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBSubnetGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBSubnetGroupsResponseUnmarshaller.Instance;
return Invoke<DescribeDBSubnetGroupsResponse>(request, options);
}
/// <summary>
/// Returns a list of DBSubnetGroup descriptions. If a DBSubnetGroupName is specified,
/// the list will contain only the descriptions of the specified DBSubnetGroup.
///
///
/// <para>
/// For an overview of CIDR ranges, go to the <a href="http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Wikipedia
/// Tutorial</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDBSubnetGroups service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDBSubnetGroups service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeDBSubnetGroups">REST API Reference for DescribeDBSubnetGroups Operation</seealso>
public virtual Task<DescribeDBSubnetGroupsResponse> DescribeDBSubnetGroupsAsync(DescribeDBSubnetGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeDBSubnetGroupsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeDBSubnetGroupsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeDBSubnetGroupsResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeEngineDefaultClusterParameters
/// <summary>
/// Returns the default engine and system parameter information for the cluster database
/// engine.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEngineDefaultClusterParameters service method.</param>
///
/// <returns>The response from the DescribeEngineDefaultClusterParameters service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEngineDefaultClusterParameters">REST API Reference for DescribeEngineDefaultClusterParameters Operation</seealso>
public virtual DescribeEngineDefaultClusterParametersResponse DescribeEngineDefaultClusterParameters(DescribeEngineDefaultClusterParametersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEngineDefaultClusterParametersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEngineDefaultClusterParametersResponseUnmarshaller.Instance;
return Invoke<DescribeEngineDefaultClusterParametersResponse>(request, options);
}
/// <summary>
/// Returns the default engine and system parameter information for the cluster database
/// engine.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEngineDefaultClusterParameters service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeEngineDefaultClusterParameters service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEngineDefaultClusterParameters">REST API Reference for DescribeEngineDefaultClusterParameters Operation</seealso>
public virtual Task<DescribeEngineDefaultClusterParametersResponse> DescribeEngineDefaultClusterParametersAsync(DescribeEngineDefaultClusterParametersRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEngineDefaultClusterParametersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEngineDefaultClusterParametersResponseUnmarshaller.Instance;
return InvokeAsync<DescribeEngineDefaultClusterParametersResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeEngineDefaultParameters
/// <summary>
/// Returns the default engine and system parameter information for the specified database
/// engine.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEngineDefaultParameters service method.</param>
///
/// <returns>The response from the DescribeEngineDefaultParameters service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEngineDefaultParameters">REST API Reference for DescribeEngineDefaultParameters Operation</seealso>
public virtual DescribeEngineDefaultParametersResponse DescribeEngineDefaultParameters(DescribeEngineDefaultParametersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEngineDefaultParametersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEngineDefaultParametersResponseUnmarshaller.Instance;
return Invoke<DescribeEngineDefaultParametersResponse>(request, options);
}
/// <summary>
/// Returns the default engine and system parameter information for the specified database
/// engine.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEngineDefaultParameters service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeEngineDefaultParameters service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEngineDefaultParameters">REST API Reference for DescribeEngineDefaultParameters Operation</seealso>
public virtual Task<DescribeEngineDefaultParametersResponse> DescribeEngineDefaultParametersAsync(DescribeEngineDefaultParametersRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEngineDefaultParametersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEngineDefaultParametersResponseUnmarshaller.Instance;
return InvokeAsync<DescribeEngineDefaultParametersResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeEventCategories
/// <summary>
/// Displays a list of categories for all event source types, or, if specified, for a
/// specified source type.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEventCategories service method.</param>
///
/// <returns>The response from the DescribeEventCategories service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEventCategories">REST API Reference for DescribeEventCategories Operation</seealso>
public virtual DescribeEventCategoriesResponse DescribeEventCategories(DescribeEventCategoriesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventCategoriesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventCategoriesResponseUnmarshaller.Instance;
return Invoke<DescribeEventCategoriesResponse>(request, options);
}
/// <summary>
/// Displays a list of categories for all event source types, or, if specified, for a
/// specified source type.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEventCategories service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeEventCategories service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEventCategories">REST API Reference for DescribeEventCategories Operation</seealso>
public virtual Task<DescribeEventCategoriesResponse> DescribeEventCategoriesAsync(DescribeEventCategoriesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventCategoriesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventCategoriesResponseUnmarshaller.Instance;
return InvokeAsync<DescribeEventCategoriesResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeEvents
/// <summary>
/// Returns events related to DB instances, DB security groups, DB snapshots, and DB parameter
/// groups for the past 14 days. Events specific to a particular DB instance, DB security
/// group, database snapshot, or DB parameter group can be obtained by providing the name
/// as a parameter. By default, the past hour of events are returned.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEvents service method.</param>
///
/// <returns>The response from the DescribeEvents service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEvents">REST API Reference for DescribeEvents Operation</seealso>
public virtual DescribeEventsResponse DescribeEvents(DescribeEventsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventsResponseUnmarshaller.Instance;
return Invoke<DescribeEventsResponse>(request, options);
}
/// <summary>
/// Returns events related to DB instances, DB security groups, DB snapshots, and DB parameter
/// groups for the past 14 days. Events specific to a particular DB instance, DB security
/// group, database snapshot, or DB parameter group can be obtained by providing the name
/// as a parameter. By default, the past hour of events are returned.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEvents service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeEvents service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEvents">REST API Reference for DescribeEvents Operation</seealso>
public virtual Task<DescribeEventsResponse> DescribeEventsAsync(DescribeEventsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeEventsResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeEventSubscriptions
/// <summary>
/// Lists all the subscription descriptions for a customer account. The description for
/// a subscription includes SubscriptionName, SNSTopicARN, CustomerID, SourceType, SourceID,
/// CreationTime, and Status.
///
///
/// <para>
/// If you specify a SubscriptionName, lists the description for that subscription.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEventSubscriptions service method.</param>
///
/// <returns>The response from the DescribeEventSubscriptions service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEventSubscriptions">REST API Reference for DescribeEventSubscriptions Operation</seealso>
public virtual DescribeEventSubscriptionsResponse DescribeEventSubscriptions(DescribeEventSubscriptionsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventSubscriptionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventSubscriptionsResponseUnmarshaller.Instance;
return Invoke<DescribeEventSubscriptionsResponse>(request, options);
}
/// <summary>
/// Lists all the subscription descriptions for a customer account. The description for
/// a subscription includes SubscriptionName, SNSTopicARN, CustomerID, SourceType, SourceID,
/// CreationTime, and Status.
///
///
/// <para>
/// If you specify a SubscriptionName, lists the description for that subscription.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEventSubscriptions service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeEventSubscriptions service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeEventSubscriptions">REST API Reference for DescribeEventSubscriptions Operation</seealso>
public virtual Task<DescribeEventSubscriptionsResponse> DescribeEventSubscriptionsAsync(DescribeEventSubscriptionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventSubscriptionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventSubscriptionsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeEventSubscriptionsResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeOrderableDBInstanceOptions
/// <summary>
/// Returns a list of orderable DB instance options for the specified engine.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeOrderableDBInstanceOptions service method.</param>
///
/// <returns>The response from the DescribeOrderableDBInstanceOptions service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeOrderableDBInstanceOptions">REST API Reference for DescribeOrderableDBInstanceOptions Operation</seealso>
public virtual DescribeOrderableDBInstanceOptionsResponse DescribeOrderableDBInstanceOptions(DescribeOrderableDBInstanceOptionsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeOrderableDBInstanceOptionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeOrderableDBInstanceOptionsResponseUnmarshaller.Instance;
return Invoke<DescribeOrderableDBInstanceOptionsResponse>(request, options);
}
/// <summary>
/// Returns a list of orderable DB instance options for the specified engine.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeOrderableDBInstanceOptions service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeOrderableDBInstanceOptions service method, as returned by Neptune.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeOrderableDBInstanceOptions">REST API Reference for DescribeOrderableDBInstanceOptions Operation</seealso>
public virtual Task<DescribeOrderableDBInstanceOptionsResponse> DescribeOrderableDBInstanceOptionsAsync(DescribeOrderableDBInstanceOptionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeOrderableDBInstanceOptionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeOrderableDBInstanceOptionsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeOrderableDBInstanceOptionsResponse>(request, options, cancellationToken);
}
#endregion
#region DescribePendingMaintenanceActions
/// <summary>
/// Returns a list of resources (for example, DB instances) that have at least one pending
/// maintenance action.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribePendingMaintenanceActions service method.</param>
///
/// <returns>The response from the DescribePendingMaintenanceActions service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.ResourceNotFoundException">
/// The specified resource ID was not found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribePendingMaintenanceActions">REST API Reference for DescribePendingMaintenanceActions Operation</seealso>
public virtual DescribePendingMaintenanceActionsResponse DescribePendingMaintenanceActions(DescribePendingMaintenanceActionsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribePendingMaintenanceActionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribePendingMaintenanceActionsResponseUnmarshaller.Instance;
return Invoke<DescribePendingMaintenanceActionsResponse>(request, options);
}
/// <summary>
/// Returns a list of resources (for example, DB instances) that have at least one pending
/// maintenance action.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribePendingMaintenanceActions service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribePendingMaintenanceActions service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.ResourceNotFoundException">
/// The specified resource ID was not found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribePendingMaintenanceActions">REST API Reference for DescribePendingMaintenanceActions Operation</seealso>
public virtual Task<DescribePendingMaintenanceActionsResponse> DescribePendingMaintenanceActionsAsync(DescribePendingMaintenanceActionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribePendingMaintenanceActionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribePendingMaintenanceActionsResponseUnmarshaller.Instance;
return InvokeAsync<DescribePendingMaintenanceActionsResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeValidDBInstanceModifications
/// <summary>
/// You can call <a>DescribeValidDBInstanceModifications</a> to learn what modifications
/// you can make to your DB instance. You can use this information when you call <a>ModifyDBInstance</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeValidDBInstanceModifications service method.</param>
///
/// <returns>The response from the DescribeValidDBInstanceModifications service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeValidDBInstanceModifications">REST API Reference for DescribeValidDBInstanceModifications Operation</seealso>
public virtual DescribeValidDBInstanceModificationsResponse DescribeValidDBInstanceModifications(DescribeValidDBInstanceModificationsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeValidDBInstanceModificationsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeValidDBInstanceModificationsResponseUnmarshaller.Instance;
return Invoke<DescribeValidDBInstanceModificationsResponse>(request, options);
}
/// <summary>
/// You can call <a>DescribeValidDBInstanceModifications</a> to learn what modifications
/// you can make to your DB instance. You can use this information when you call <a>ModifyDBInstance</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeValidDBInstanceModifications service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeValidDBInstanceModifications service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/DescribeValidDBInstanceModifications">REST API Reference for DescribeValidDBInstanceModifications Operation</seealso>
public virtual Task<DescribeValidDBInstanceModificationsResponse> DescribeValidDBInstanceModificationsAsync(DescribeValidDBInstanceModificationsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeValidDBInstanceModificationsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeValidDBInstanceModificationsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeValidDBInstanceModificationsResponse>(request, options, cancellationToken);
}
#endregion
#region FailoverDBCluster
/// <summary>
/// Forces a failover for a DB cluster.
///
///
/// <para>
/// A failover for a DB cluster promotes one of the Read Replicas (read-only instances)
/// in the DB cluster to be the primary instance (the cluster writer).
/// </para>
///
/// <para>
/// Amazon Neptune will automatically fail over to a Read Replica, if one exists, when
/// the primary instance fails. You can force a failover when you want to simulate a failure
/// of a primary instance for testing. Because each instance in a DB cluster has its own
/// endpoint address, you will need to clean up and re-establish any existing connections
/// that use those endpoint addresses when the failover is complete.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the FailoverDBCluster service method.</param>
///
/// <returns>The response from the FailoverDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/FailoverDBCluster">REST API Reference for FailoverDBCluster Operation</seealso>
public virtual FailoverDBClusterResponse FailoverDBCluster(FailoverDBClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = FailoverDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = FailoverDBClusterResponseUnmarshaller.Instance;
return Invoke<FailoverDBClusterResponse>(request, options);
}
/// <summary>
/// Forces a failover for a DB cluster.
///
///
/// <para>
/// A failover for a DB cluster promotes one of the Read Replicas (read-only instances)
/// in the DB cluster to be the primary instance (the cluster writer).
/// </para>
///
/// <para>
/// Amazon Neptune will automatically fail over to a Read Replica, if one exists, when
/// the primary instance fails. You can force a failover when you want to simulate a failure
/// of a primary instance for testing. Because each instance in a DB cluster has its own
/// endpoint address, you will need to clean up and re-establish any existing connections
/// that use those endpoint addresses when the failover is complete.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the FailoverDBCluster service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the FailoverDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/FailoverDBCluster">REST API Reference for FailoverDBCluster Operation</seealso>
public virtual Task<FailoverDBClusterResponse> FailoverDBClusterAsync(FailoverDBClusterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = FailoverDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = FailoverDBClusterResponseUnmarshaller.Instance;
return InvokeAsync<FailoverDBClusterResponse>(request, options, cancellationToken);
}
#endregion
#region ListTagsForResource
/// <summary>
/// Lists all tags on an Amazon Neptune 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 Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotNotFoundException">
/// <i>DBSnapshotIdentifier</i> does not refer to an existing DB snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/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>
/// Lists all tags on an Amazon Neptune resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListTagsForResource service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotNotFoundException">
/// <i>DBSnapshotIdentifier</i> does not refer to an existing DB snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual Task<ListTagsForResourceResponse> ListTagsForResourceAsync(ListTagsForResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return InvokeAsync<ListTagsForResourceResponse>(request, options, cancellationToken);
}
#endregion
#region ModifyDBCluster
/// <summary>
/// Modify a setting for a DB cluster. You can change one or more database configuration
/// parameters by specifying these parameters and the new values in the request.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBCluster service method.</param>
///
/// <returns>The response from the ModifyDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterAlreadyExistsException">
/// User already has a DB cluster with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterParameterGroupNotFoundException">
/// <i>DBClusterParameterGroupName</i> does not refer to an existing DB Cluster parameter
/// group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSecurityGroupStateException">
/// The state of the DB security group does not allow deletion.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSubnetGroupStateException">
/// The DB subnet group cannot be deleted because it is in use.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBCluster">REST API Reference for ModifyDBCluster Operation</seealso>
public virtual ModifyDBClusterResponse ModifyDBCluster(ModifyDBClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBClusterResponseUnmarshaller.Instance;
return Invoke<ModifyDBClusterResponse>(request, options);
}
/// <summary>
/// Modify a setting for a DB cluster. You can change one or more database configuration
/// parameters by specifying these parameters and the new values in the request.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBCluster service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ModifyDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterAlreadyExistsException">
/// User already has a DB cluster with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterParameterGroupNotFoundException">
/// <i>DBClusterParameterGroupName</i> does not refer to an existing DB Cluster parameter
/// group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSecurityGroupStateException">
/// The state of the DB security group does not allow deletion.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSubnetGroupStateException">
/// The DB subnet group cannot be deleted because it is in use.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBCluster">REST API Reference for ModifyDBCluster Operation</seealso>
public virtual Task<ModifyDBClusterResponse> ModifyDBClusterAsync(ModifyDBClusterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBClusterResponseUnmarshaller.Instance;
return InvokeAsync<ModifyDBClusterResponse>(request, options, cancellationToken);
}
#endregion
#region ModifyDBClusterParameterGroup
/// <summary>
/// Modifies the parameters of a DB cluster parameter group. To modify more than one
/// parameter, submit a list of the following: <code>ParameterName</code>, <code>ParameterValue</code>,
/// and <code>ApplyMethod</code>. A maximum of 20 parameters can be modified in a single
/// request.
///
/// <note>
/// <para>
/// Changes to dynamic parameters are applied immediately. Changes to static parameters
/// require a reboot without failover to the DB cluster associated with the parameter
/// group before the change can take effect.
/// </para>
/// </note> <important>
/// <para>
/// After you create a DB cluster parameter group, you should wait at least 5 minutes
/// before creating your first DB cluster that uses that DB cluster parameter group as
/// the default parameter group. This allows Amazon Neptune to fully complete the create
/// action before the parameter group is used as the default for a new DB cluster. This
/// is especially important for parameters that are critical when creating the default
/// database for a DB cluster, such as the character set for the default database defined
/// by the <code>character_set_database</code> parameter. You can use the <i>Parameter
/// Groups</i> option of the Amazon Neptune console or the <a>DescribeDBClusterParameters</a>
/// command to verify that your DB cluster parameter group has been created or modified.
/// </para>
/// </important>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBClusterParameterGroup service method.</param>
///
/// <returns>The response from the ModifyDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBClusterParameterGroup">REST API Reference for ModifyDBClusterParameterGroup Operation</seealso>
public virtual ModifyDBClusterParameterGroupResponse ModifyDBClusterParameterGroup(ModifyDBClusterParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBClusterParameterGroupResponseUnmarshaller.Instance;
return Invoke<ModifyDBClusterParameterGroupResponse>(request, options);
}
/// <summary>
/// Modifies the parameters of a DB cluster parameter group. To modify more than one
/// parameter, submit a list of the following: <code>ParameterName</code>, <code>ParameterValue</code>,
/// and <code>ApplyMethod</code>. A maximum of 20 parameters can be modified in a single
/// request.
///
/// <note>
/// <para>
/// Changes to dynamic parameters are applied immediately. Changes to static parameters
/// require a reboot without failover to the DB cluster associated with the parameter
/// group before the change can take effect.
/// </para>
/// </note> <important>
/// <para>
/// After you create a DB cluster parameter group, you should wait at least 5 minutes
/// before creating your first DB cluster that uses that DB cluster parameter group as
/// the default parameter group. This allows Amazon Neptune to fully complete the create
/// action before the parameter group is used as the default for a new DB cluster. This
/// is especially important for parameters that are critical when creating the default
/// database for a DB cluster, such as the character set for the default database defined
/// by the <code>character_set_database</code> parameter. You can use the <i>Parameter
/// Groups</i> option of the Amazon Neptune console or the <a>DescribeDBClusterParameters</a>
/// command to verify that your DB cluster parameter group has been created or modified.
/// </para>
/// </important>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBClusterParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ModifyDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBClusterParameterGroup">REST API Reference for ModifyDBClusterParameterGroup Operation</seealso>
public virtual Task<ModifyDBClusterParameterGroupResponse> ModifyDBClusterParameterGroupAsync(ModifyDBClusterParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBClusterParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<ModifyDBClusterParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region ModifyDBClusterSnapshotAttribute
/// <summary>
/// Adds an attribute and values to, or removes an attribute and values from, a manual
/// DB cluster snapshot.
///
///
/// <para>
/// To share a manual DB cluster snapshot with other AWS accounts, specify <code>restore</code>
/// as the <code>AttributeName</code> and use the <code>ValuesToAdd</code> parameter to
/// add a list of IDs of the AWS accounts that are authorized to restore the manual DB
/// cluster snapshot. Use the value <code>all</code> to make the manual DB cluster snapshot
/// public, which means that it can be copied or restored by all AWS accounts. Do not
/// add the <code>all</code> value for any manual DB cluster snapshots that contain private
/// information that you don't want available to all AWS accounts. If a manual DB cluster
/// snapshot is encrypted, it can be shared, but only by specifying a list of authorized
/// AWS account IDs for the <code>ValuesToAdd</code> parameter. You can't use <code>all</code>
/// as a value for that parameter in this case.
/// </para>
///
/// <para>
/// To view which AWS accounts have access to copy or restore a manual DB cluster snapshot,
/// or whether a manual DB cluster snapshot public or private, use the <a>DescribeDBClusterSnapshotAttributes</a>
/// API action.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBClusterSnapshotAttribute service method.</param>
///
/// <returns>The response from the ModifyDBClusterSnapshotAttribute service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SharedSnapshotQuotaExceededException">
/// You have exceeded the maximum number of accounts that you can share a manual DB snapshot
/// with.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBClusterSnapshotAttribute">REST API Reference for ModifyDBClusterSnapshotAttribute Operation</seealso>
public virtual ModifyDBClusterSnapshotAttributeResponse ModifyDBClusterSnapshotAttribute(ModifyDBClusterSnapshotAttributeRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBClusterSnapshotAttributeRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBClusterSnapshotAttributeResponseUnmarshaller.Instance;
return Invoke<ModifyDBClusterSnapshotAttributeResponse>(request, options);
}
/// <summary>
/// Adds an attribute and values to, or removes an attribute and values from, a manual
/// DB cluster snapshot.
///
///
/// <para>
/// To share a manual DB cluster snapshot with other AWS accounts, specify <code>restore</code>
/// as the <code>AttributeName</code> and use the <code>ValuesToAdd</code> parameter to
/// add a list of IDs of the AWS accounts that are authorized to restore the manual DB
/// cluster snapshot. Use the value <code>all</code> to make the manual DB cluster snapshot
/// public, which means that it can be copied or restored by all AWS accounts. Do not
/// add the <code>all</code> value for any manual DB cluster snapshots that contain private
/// information that you don't want available to all AWS accounts. If a manual DB cluster
/// snapshot is encrypted, it can be shared, but only by specifying a list of authorized
/// AWS account IDs for the <code>ValuesToAdd</code> parameter. You can't use <code>all</code>
/// as a value for that parameter in this case.
/// </para>
///
/// <para>
/// To view which AWS accounts have access to copy or restore a manual DB cluster snapshot,
/// or whether a manual DB cluster snapshot public or private, use the <a>DescribeDBClusterSnapshotAttributes</a>
/// API action.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBClusterSnapshotAttribute service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ModifyDBClusterSnapshotAttribute service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SharedSnapshotQuotaExceededException">
/// You have exceeded the maximum number of accounts that you can share a manual DB snapshot
/// with.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBClusterSnapshotAttribute">REST API Reference for ModifyDBClusterSnapshotAttribute Operation</seealso>
public virtual Task<ModifyDBClusterSnapshotAttributeResponse> ModifyDBClusterSnapshotAttributeAsync(ModifyDBClusterSnapshotAttributeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBClusterSnapshotAttributeRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBClusterSnapshotAttributeResponseUnmarshaller.Instance;
return InvokeAsync<ModifyDBClusterSnapshotAttributeResponse>(request, options, cancellationToken);
}
#endregion
#region ModifyDBInstance
/// <summary>
/// Modifies settings for a DB instance. You can change one or more database configuration
/// parameters by specifying these parameters and the new values in the request. To learn
/// what modifications you can make to your DB instance, call <a>DescribeValidDBInstanceModifications</a>
/// before you call <a>ModifyDBInstance</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBInstance service method.</param>
///
/// <returns>The response from the ModifyDBInstance service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.AuthorizationNotFoundException">
/// Specified CIDRIP or EC2 security group is not authorized for the specified DB security
/// group.
///
///
/// <para>
/// Neptune may not also be authorized via IAM to perform necessary actions on your behalf.
/// </para>
/// </exception>
/// <exception cref="Amazon.Neptune.Model.CertificateNotFoundException">
/// <i>CertificateIdentifier</i> does not refer to an existing certificate.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceAlreadyExistsException">
/// User already has a DB instance with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSecurityGroupNotFoundException">
/// <i>DBSecurityGroupName</i> does not refer to an existing DB security group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBUpgradeDependencyFailureException">
/// The DB upgrade failed because a resource the DB depends on could not be modified.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DomainNotFoundException">
/// <i>Domain</i> does not refer to an existing Active Directory Domain.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientDBInstanceCapacityException">
/// Specified DB instance class is not available in the specified Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSecurityGroupStateException">
/// The state of the DB security group does not allow deletion.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.OptionGroupNotFoundException">
/// The designated option group could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.ProvisionedIopsNotAvailableInAZException">
/// Provisioned IOPS not available in the specified Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageTypeNotSupportedException">
/// <i>StorageType</i> specified cannot be associated with the DB Instance.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBInstance">REST API Reference for ModifyDBInstance Operation</seealso>
public virtual ModifyDBInstanceResponse ModifyDBInstance(ModifyDBInstanceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBInstanceResponseUnmarshaller.Instance;
return Invoke<ModifyDBInstanceResponse>(request, options);
}
/// <summary>
/// Modifies settings for a DB instance. You can change one or more database configuration
/// parameters by specifying these parameters and the new values in the request. To learn
/// what modifications you can make to your DB instance, call <a>DescribeValidDBInstanceModifications</a>
/// before you call <a>ModifyDBInstance</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBInstance service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ModifyDBInstance service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.AuthorizationNotFoundException">
/// Specified CIDRIP or EC2 security group is not authorized for the specified DB security
/// group.
///
///
/// <para>
/// Neptune may not also be authorized via IAM to perform necessary actions on your behalf.
/// </para>
/// </exception>
/// <exception cref="Amazon.Neptune.Model.CertificateNotFoundException">
/// <i>CertificateIdentifier</i> does not refer to an existing certificate.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceAlreadyExistsException">
/// User already has a DB instance with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSecurityGroupNotFoundException">
/// <i>DBSecurityGroupName</i> does not refer to an existing DB security group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBUpgradeDependencyFailureException">
/// The DB upgrade failed because a resource the DB depends on could not be modified.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DomainNotFoundException">
/// <i>Domain</i> does not refer to an existing Active Directory Domain.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientDBInstanceCapacityException">
/// Specified DB instance class is not available in the specified Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSecurityGroupStateException">
/// The state of the DB security group does not allow deletion.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.OptionGroupNotFoundException">
/// The designated option group could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.ProvisionedIopsNotAvailableInAZException">
/// Provisioned IOPS not available in the specified Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageTypeNotSupportedException">
/// <i>StorageType</i> specified cannot be associated with the DB Instance.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBInstance">REST API Reference for ModifyDBInstance Operation</seealso>
public virtual Task<ModifyDBInstanceResponse> ModifyDBInstanceAsync(ModifyDBInstanceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBInstanceResponseUnmarshaller.Instance;
return InvokeAsync<ModifyDBInstanceResponse>(request, options, cancellationToken);
}
#endregion
#region ModifyDBParameterGroup
/// <summary>
/// Modifies the parameters of a DB parameter group. To modify more than one parameter,
/// submit a list of the following: <code>ParameterName</code>, <code>ParameterValue</code>,
/// and <code>ApplyMethod</code>. A maximum of 20 parameters can be modified in a single
/// request.
///
/// <note>
/// <para>
/// Changes to dynamic parameters are applied immediately. Changes to static parameters
/// require a reboot without failover to the DB instance associated with the parameter
/// group before the change can take effect.
/// </para>
/// </note> <important>
/// <para>
/// After you modify a DB parameter group, you should wait at least 5 minutes before creating
/// your first DB instance that uses that DB parameter group as the default parameter
/// group. This allows Amazon Neptune to fully complete the modify action before the parameter
/// group is used as the default for a new DB instance. This is especially important for
/// parameters that are critical when creating the default database for a DB instance,
/// such as the character set for the default database defined by the <code>character_set_database</code>
/// parameter. You can use the <i>Parameter Groups</i> option of the Amazon Neptune console
/// or the <i>DescribeDBParameters</i> command to verify that your DB parameter group
/// has been created or modified.
/// </para>
/// </important>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBParameterGroup service method.</param>
///
/// <returns>The response from the ModifyDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBParameterGroup">REST API Reference for ModifyDBParameterGroup Operation</seealso>
public virtual ModifyDBParameterGroupResponse ModifyDBParameterGroup(ModifyDBParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBParameterGroupResponseUnmarshaller.Instance;
return Invoke<ModifyDBParameterGroupResponse>(request, options);
}
/// <summary>
/// Modifies the parameters of a DB parameter group. To modify more than one parameter,
/// submit a list of the following: <code>ParameterName</code>, <code>ParameterValue</code>,
/// and <code>ApplyMethod</code>. A maximum of 20 parameters can be modified in a single
/// request.
///
/// <note>
/// <para>
/// Changes to dynamic parameters are applied immediately. Changes to static parameters
/// require a reboot without failover to the DB instance associated with the parameter
/// group before the change can take effect.
/// </para>
/// </note> <important>
/// <para>
/// After you modify a DB parameter group, you should wait at least 5 minutes before creating
/// your first DB instance that uses that DB parameter group as the default parameter
/// group. This allows Amazon Neptune to fully complete the modify action before the parameter
/// group is used as the default for a new DB instance. This is especially important for
/// parameters that are critical when creating the default database for a DB instance,
/// such as the character set for the default database defined by the <code>character_set_database</code>
/// parameter. You can use the <i>Parameter Groups</i> option of the Amazon Neptune console
/// or the <i>DescribeDBParameters</i> command to verify that your DB parameter group
/// has been created or modified.
/// </para>
/// </important>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ModifyDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBParameterGroup">REST API Reference for ModifyDBParameterGroup Operation</seealso>
public virtual Task<ModifyDBParameterGroupResponse> ModifyDBParameterGroupAsync(ModifyDBParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<ModifyDBParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region ModifyDBSubnetGroup
/// <summary>
/// Modifies an existing DB subnet group. DB subnet groups must contain at least one subnet
/// in at least two AZs in the AWS Region.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBSubnetGroup service method.</param>
///
/// <returns>The response from the ModifyDBSubnetGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupDoesNotCoverEnoughAZsException">
/// Subnets in the DB subnet group should cover at least two Availability Zones unless
/// there is only one Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetQuotaExceededException">
/// Request would result in user exceeding the allowed number of subnets in a DB subnet
/// groups.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubnetAlreadyInUseException">
/// The DB subnet is already in use in the Availability Zone.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBSubnetGroup">REST API Reference for ModifyDBSubnetGroup Operation</seealso>
public virtual ModifyDBSubnetGroupResponse ModifyDBSubnetGroup(ModifyDBSubnetGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBSubnetGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBSubnetGroupResponseUnmarshaller.Instance;
return Invoke<ModifyDBSubnetGroupResponse>(request, options);
}
/// <summary>
/// Modifies an existing DB subnet group. DB subnet groups must contain at least one subnet
/// in at least two AZs in the AWS Region.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyDBSubnetGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ModifyDBSubnetGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupDoesNotCoverEnoughAZsException">
/// Subnets in the DB subnet group should cover at least two Availability Zones unless
/// there is only one Availability Zone.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetQuotaExceededException">
/// Request would result in user exceeding the allowed number of subnets in a DB subnet
/// groups.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubnetAlreadyInUseException">
/// The DB subnet is already in use in the Availability Zone.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyDBSubnetGroup">REST API Reference for ModifyDBSubnetGroup Operation</seealso>
public virtual Task<ModifyDBSubnetGroupResponse> ModifyDBSubnetGroupAsync(ModifyDBSubnetGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyDBSubnetGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyDBSubnetGroupResponseUnmarshaller.Instance;
return InvokeAsync<ModifyDBSubnetGroupResponse>(request, options, cancellationToken);
}
#endregion
#region ModifyEventSubscription
/// <summary>
/// Modifies an existing event notification subscription. Note that you can't modify the
/// source identifiers using this call; to change source identifiers for a subscription,
/// use the <a>AddSourceIdentifierToSubscription</a> and <a>RemoveSourceIdentifierFromSubscription</a>
/// calls.
///
///
/// <para>
/// You can see a list of the event categories for a given SourceType by using the <b>DescribeEventCategories</b>
/// action.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyEventSubscription service method.</param>
///
/// <returns>The response from the ModifyEventSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.EventSubscriptionQuotaExceededException">
/// You have exceeded the number of events you can subscribe to.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSInvalidTopicException">
/// The SNS topic is invalid.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSNoAuthorizationException">
/// There is no SNS authorization.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSTopicArnNotFoundException">
/// The ARN of the SNS topic could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionCategoryNotFoundException">
/// The designated subscription category could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyEventSubscription">REST API Reference for ModifyEventSubscription Operation</seealso>
public virtual ModifyEventSubscriptionResponse ModifyEventSubscription(ModifyEventSubscriptionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyEventSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyEventSubscriptionResponseUnmarshaller.Instance;
return Invoke<ModifyEventSubscriptionResponse>(request, options);
}
/// <summary>
/// Modifies an existing event notification subscription. Note that you can't modify the
/// source identifiers using this call; to change source identifiers for a subscription,
/// use the <a>AddSourceIdentifierToSubscription</a> and <a>RemoveSourceIdentifierFromSubscription</a>
/// calls.
///
///
/// <para>
/// You can see a list of the event categories for a given SourceType by using the <b>DescribeEventCategories</b>
/// action.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ModifyEventSubscription service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ModifyEventSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.EventSubscriptionQuotaExceededException">
/// You have exceeded the number of events you can subscribe to.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSInvalidTopicException">
/// The SNS topic is invalid.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSNoAuthorizationException">
/// There is no SNS authorization.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SNSTopicArnNotFoundException">
/// The ARN of the SNS topic could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionCategoryNotFoundException">
/// The designated subscription category could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ModifyEventSubscription">REST API Reference for ModifyEventSubscription Operation</seealso>
public virtual Task<ModifyEventSubscriptionResponse> ModifyEventSubscriptionAsync(ModifyEventSubscriptionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ModifyEventSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = ModifyEventSubscriptionResponseUnmarshaller.Instance;
return InvokeAsync<ModifyEventSubscriptionResponse>(request, options, cancellationToken);
}
#endregion
#region PromoteReadReplicaDBCluster
/// <summary>
/// Not supported.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PromoteReadReplicaDBCluster service method.</param>
///
/// <returns>The response from the PromoteReadReplicaDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/PromoteReadReplicaDBCluster">REST API Reference for PromoteReadReplicaDBCluster Operation</seealso>
public virtual PromoteReadReplicaDBClusterResponse PromoteReadReplicaDBCluster(PromoteReadReplicaDBClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PromoteReadReplicaDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = PromoteReadReplicaDBClusterResponseUnmarshaller.Instance;
return Invoke<PromoteReadReplicaDBClusterResponse>(request, options);
}
/// <summary>
/// Not supported.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PromoteReadReplicaDBCluster service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the PromoteReadReplicaDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/PromoteReadReplicaDBCluster">REST API Reference for PromoteReadReplicaDBCluster Operation</seealso>
public virtual Task<PromoteReadReplicaDBClusterResponse> PromoteReadReplicaDBClusterAsync(PromoteReadReplicaDBClusterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = PromoteReadReplicaDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = PromoteReadReplicaDBClusterResponseUnmarshaller.Instance;
return InvokeAsync<PromoteReadReplicaDBClusterResponse>(request, options, cancellationToken);
}
#endregion
#region RebootDBInstance
/// <summary>
/// You might need to reboot your DB instance, usually for maintenance reasons. For example,
/// if you make certain modifications, or if you change the DB parameter group associated
/// with the DB instance, you must reboot the instance for the changes to take effect.
///
///
/// <para>
/// Rebooting a DB instance restarts the database engine service. Rebooting a DB instance
/// results in a momentary outage, during which the DB instance status is set to rebooting.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RebootDBInstance service method.</param>
///
/// <returns>The response from the RebootDBInstance service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RebootDBInstance">REST API Reference for RebootDBInstance Operation</seealso>
public virtual RebootDBInstanceResponse RebootDBInstance(RebootDBInstanceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RebootDBInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = RebootDBInstanceResponseUnmarshaller.Instance;
return Invoke<RebootDBInstanceResponse>(request, options);
}
/// <summary>
/// You might need to reboot your DB instance, usually for maintenance reasons. For example,
/// if you make certain modifications, or if you change the DB parameter group associated
/// with the DB instance, you must reboot the instance for the changes to take effect.
///
///
/// <para>
/// Rebooting a DB instance restarts the database engine service. Rebooting a DB instance
/// results in a momentary outage, during which the DB instance status is set to rebooting.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RebootDBInstance service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RebootDBInstance service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RebootDBInstance">REST API Reference for RebootDBInstance Operation</seealso>
public virtual Task<RebootDBInstanceResponse> RebootDBInstanceAsync(RebootDBInstanceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RebootDBInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = RebootDBInstanceResponseUnmarshaller.Instance;
return InvokeAsync<RebootDBInstanceResponse>(request, options, cancellationToken);
}
#endregion
#region RemoveRoleFromDBCluster
/// <summary>
/// Disassociates an Identity and Access Management (IAM) role from a DB cluster.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveRoleFromDBCluster service method.</param>
///
/// <returns>The response from the RemoveRoleFromDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterRoleNotFoundException">
/// The specified IAM role Amazon Resource Name (ARN) is not associated with the specified
/// DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RemoveRoleFromDBCluster">REST API Reference for RemoveRoleFromDBCluster Operation</seealso>
public virtual RemoveRoleFromDBClusterResponse RemoveRoleFromDBCluster(RemoveRoleFromDBClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveRoleFromDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveRoleFromDBClusterResponseUnmarshaller.Instance;
return Invoke<RemoveRoleFromDBClusterResponse>(request, options);
}
/// <summary>
/// Disassociates an Identity and Access Management (IAM) role from a DB cluster.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveRoleFromDBCluster service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RemoveRoleFromDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterRoleNotFoundException">
/// The specified IAM role Amazon Resource Name (ARN) is not associated with the specified
/// DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RemoveRoleFromDBCluster">REST API Reference for RemoveRoleFromDBCluster Operation</seealso>
public virtual Task<RemoveRoleFromDBClusterResponse> RemoveRoleFromDBClusterAsync(RemoveRoleFromDBClusterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveRoleFromDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveRoleFromDBClusterResponseUnmarshaller.Instance;
return InvokeAsync<RemoveRoleFromDBClusterResponse>(request, options, cancellationToken);
}
#endregion
#region RemoveSourceIdentifierFromSubscription
/// <summary>
/// Removes a source identifier from an existing event notification subscription.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveSourceIdentifierFromSubscription service method.</param>
///
/// <returns>The response from the RemoveSourceIdentifierFromSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.SourceNotFoundException">
/// The source could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RemoveSourceIdentifierFromSubscription">REST API Reference for RemoveSourceIdentifierFromSubscription Operation</seealso>
public virtual RemoveSourceIdentifierFromSubscriptionResponse RemoveSourceIdentifierFromSubscription(RemoveSourceIdentifierFromSubscriptionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveSourceIdentifierFromSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveSourceIdentifierFromSubscriptionResponseUnmarshaller.Instance;
return Invoke<RemoveSourceIdentifierFromSubscriptionResponse>(request, options);
}
/// <summary>
/// Removes a source identifier from an existing event notification subscription.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveSourceIdentifierFromSubscription service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RemoveSourceIdentifierFromSubscription service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.SourceNotFoundException">
/// The source could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.SubscriptionNotFoundException">
/// The designated subscription could not be found.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RemoveSourceIdentifierFromSubscription">REST API Reference for RemoveSourceIdentifierFromSubscription Operation</seealso>
public virtual Task<RemoveSourceIdentifierFromSubscriptionResponse> RemoveSourceIdentifierFromSubscriptionAsync(RemoveSourceIdentifierFromSubscriptionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveSourceIdentifierFromSubscriptionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveSourceIdentifierFromSubscriptionResponseUnmarshaller.Instance;
return InvokeAsync<RemoveSourceIdentifierFromSubscriptionResponse>(request, options, cancellationToken);
}
#endregion
#region RemoveTagsFromResource
/// <summary>
/// Removes metadata tags from an Amazon Neptune resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveTagsFromResource service method.</param>
///
/// <returns>The response from the RemoveTagsFromResource service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotNotFoundException">
/// <i>DBSnapshotIdentifier</i> does not refer to an existing DB snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RemoveTagsFromResource">REST API Reference for RemoveTagsFromResource Operation</seealso>
public virtual RemoveTagsFromResourceResponse RemoveTagsFromResource(RemoveTagsFromResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveTagsFromResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveTagsFromResourceResponseUnmarshaller.Instance;
return Invoke<RemoveTagsFromResourceResponse>(request, options);
}
/// <summary>
/// Removes metadata tags from an Amazon Neptune resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveTagsFromResource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RemoveTagsFromResource service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBInstanceNotFoundException">
/// <i>DBInstanceIdentifier</i> does not refer to an existing DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotNotFoundException">
/// <i>DBSnapshotIdentifier</i> does not refer to an existing DB snapshot.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RemoveTagsFromResource">REST API Reference for RemoveTagsFromResource Operation</seealso>
public virtual Task<RemoveTagsFromResourceResponse> RemoveTagsFromResourceAsync(RemoveTagsFromResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveTagsFromResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveTagsFromResourceResponseUnmarshaller.Instance;
return InvokeAsync<RemoveTagsFromResourceResponse>(request, options, cancellationToken);
}
#endregion
#region ResetDBClusterParameterGroup
/// <summary>
/// Modifies the parameters of a DB cluster parameter group to the default value. To
/// reset specific parameters submit a list of the following: <code>ParameterName</code>
/// and <code>ApplyMethod</code>. To reset the entire DB cluster parameter group, specify
/// the <code>DBClusterParameterGroupName</code> and <code>ResetAllParameters</code> parameters.
///
///
/// <para>
/// When resetting the entire group, dynamic parameters are updated immediately and static
/// parameters are set to <code>pending-reboot</code> to take effect on the next DB instance
/// restart or <a>RebootDBInstance</a> request. You must call <a>RebootDBInstance</a>
/// for every DB instance in your DB cluster that you want the updated static parameter
/// to apply to.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ResetDBClusterParameterGroup service method.</param>
///
/// <returns>The response from the ResetDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ResetDBClusterParameterGroup">REST API Reference for ResetDBClusterParameterGroup Operation</seealso>
public virtual ResetDBClusterParameterGroupResponse ResetDBClusterParameterGroup(ResetDBClusterParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ResetDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ResetDBClusterParameterGroupResponseUnmarshaller.Instance;
return Invoke<ResetDBClusterParameterGroupResponse>(request, options);
}
/// <summary>
/// Modifies the parameters of a DB cluster parameter group to the default value. To
/// reset specific parameters submit a list of the following: <code>ParameterName</code>
/// and <code>ApplyMethod</code>. To reset the entire DB cluster parameter group, specify
/// the <code>DBClusterParameterGroupName</code> and <code>ResetAllParameters</code> parameters.
///
///
/// <para>
/// When resetting the entire group, dynamic parameters are updated immediately and static
/// parameters are set to <code>pending-reboot</code> to take effect on the next DB instance
/// restart or <a>RebootDBInstance</a> request. You must call <a>RebootDBInstance</a>
/// for every DB instance in your DB cluster that you want the updated static parameter
/// to apply to.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ResetDBClusterParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ResetDBClusterParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ResetDBClusterParameterGroup">REST API Reference for ResetDBClusterParameterGroup Operation</seealso>
public virtual Task<ResetDBClusterParameterGroupResponse> ResetDBClusterParameterGroupAsync(ResetDBClusterParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ResetDBClusterParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ResetDBClusterParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<ResetDBClusterParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region ResetDBParameterGroup
/// <summary>
/// Modifies the parameters of a DB parameter group to the engine/system default value.
/// To reset specific parameters, provide a list of the following: <code>ParameterName</code>
/// and <code>ApplyMethod</code>. To reset the entire DB parameter group, specify the
/// <code>DBParameterGroup</code> name and <code>ResetAllParameters</code> parameters.
/// When resetting the entire group, dynamic parameters are updated immediately and static
/// parameters are set to <code>pending-reboot</code> to take effect on the next DB instance
/// restart or <code>RebootDBInstance</code> request.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ResetDBParameterGroup service method.</param>
///
/// <returns>The response from the ResetDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ResetDBParameterGroup">REST API Reference for ResetDBParameterGroup Operation</seealso>
public virtual ResetDBParameterGroupResponse ResetDBParameterGroup(ResetDBParameterGroupRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ResetDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ResetDBParameterGroupResponseUnmarshaller.Instance;
return Invoke<ResetDBParameterGroupResponse>(request, options);
}
/// <summary>
/// Modifies the parameters of a DB parameter group to the engine/system default value.
/// To reset specific parameters, provide a list of the following: <code>ParameterName</code>
/// and <code>ApplyMethod</code>. To reset the entire DB parameter group, specify the
/// <code>DBParameterGroup</code> name and <code>ResetAllParameters</code> parameters.
/// When resetting the entire group, dynamic parameters are updated immediately and static
/// parameters are set to <code>pending-reboot</code> to take effect on the next DB instance
/// restart or <code>RebootDBInstance</code> request.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ResetDBParameterGroup service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ResetDBParameterGroup service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBParameterGroupNotFoundException">
/// <i>DBParameterGroupName</i> does not refer to an existing DB parameter group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBParameterGroupStateException">
/// The DB parameter group is in use or is in an invalid state. If you are attempting
/// to delete the parameter group, you cannot delete it when the parameter group is in
/// this state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/ResetDBParameterGroup">REST API Reference for ResetDBParameterGroup Operation</seealso>
public virtual Task<ResetDBParameterGroupResponse> ResetDBParameterGroupAsync(ResetDBParameterGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ResetDBParameterGroupRequestMarshaller.Instance;
options.ResponseUnmarshaller = ResetDBParameterGroupResponseUnmarshaller.Instance;
return InvokeAsync<ResetDBParameterGroupResponse>(request, options, cancellationToken);
}
#endregion
#region RestoreDBClusterFromSnapshot
/// <summary>
/// Creates a new DB cluster from a DB snapshot or DB cluster snapshot.
///
///
/// <para>
/// If a DB snapshot is specified, the target DB cluster is created from the source DB
/// snapshot with a default configuration and default security group.
/// </para>
///
/// <para>
/// If a DB cluster snapshot is specified, the target DB cluster is created from the source
/// DB cluster restore point with the same configuration as the original source DB cluster,
/// except that the new DB cluster is created with the default security group.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RestoreDBClusterFromSnapshot service method.</param>
///
/// <returns>The response from the RestoreDBClusterFromSnapshot service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterAlreadyExistsException">
/// User already has a DB cluster with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterParameterGroupNotFoundException">
/// <i>DBClusterParameterGroupName</i> does not refer to an existing DB Cluster parameter
/// group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterQuotaExceededException">
/// User attempted to create a new DB cluster and the user has already reached the maximum
/// allowed DB cluster quota.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotNotFoundException">
/// <i>DBSnapshotIdentifier</i> does not refer to an existing DB snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientDBClusterCapacityException">
/// The DB cluster does not have enough capacity for the current operation.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientStorageClusterCapacityException">
/// There is insufficient storage available for the current action. You may be able to
/// resolve this error by updating your subnet group to use different Availability Zones
/// that have more storage available.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSnapshotStateException">
/// The state of the DB snapshot does not allow deletion.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidRestoreException">
/// Cannot restore from vpc backup to non-vpc DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.OptionGroupNotFoundException">
/// The designated option group could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RestoreDBClusterFromSnapshot">REST API Reference for RestoreDBClusterFromSnapshot Operation</seealso>
public virtual RestoreDBClusterFromSnapshotResponse RestoreDBClusterFromSnapshot(RestoreDBClusterFromSnapshotRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RestoreDBClusterFromSnapshotRequestMarshaller.Instance;
options.ResponseUnmarshaller = RestoreDBClusterFromSnapshotResponseUnmarshaller.Instance;
return Invoke<RestoreDBClusterFromSnapshotResponse>(request, options);
}
/// <summary>
/// Creates a new DB cluster from a DB snapshot or DB cluster snapshot.
///
///
/// <para>
/// If a DB snapshot is specified, the target DB cluster is created from the source DB
/// snapshot with a default configuration and default security group.
/// </para>
///
/// <para>
/// If a DB cluster snapshot is specified, the target DB cluster is created from the source
/// DB cluster restore point with the same configuration as the original source DB cluster,
/// except that the new DB cluster is created with the default security group.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RestoreDBClusterFromSnapshot service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RestoreDBClusterFromSnapshot service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterAlreadyExistsException">
/// User already has a DB cluster with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterParameterGroupNotFoundException">
/// <i>DBClusterParameterGroupName</i> does not refer to an existing DB Cluster parameter
/// group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterQuotaExceededException">
/// User attempted to create a new DB cluster and the user has already reached the maximum
/// allowed DB cluster quota.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSnapshotNotFoundException">
/// <i>DBSnapshotIdentifier</i> does not refer to an existing DB snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientDBClusterCapacityException">
/// The DB cluster does not have enough capacity for the current operation.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientStorageClusterCapacityException">
/// There is insufficient storage available for the current action. You may be able to
/// resolve this error by updating your subnet group to use different Availability Zones
/// that have more storage available.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSnapshotStateException">
/// The state of the DB snapshot does not allow deletion.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidRestoreException">
/// Cannot restore from vpc backup to non-vpc DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.OptionGroupNotFoundException">
/// The designated option group could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RestoreDBClusterFromSnapshot">REST API Reference for RestoreDBClusterFromSnapshot Operation</seealso>
public virtual Task<RestoreDBClusterFromSnapshotResponse> RestoreDBClusterFromSnapshotAsync(RestoreDBClusterFromSnapshotRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RestoreDBClusterFromSnapshotRequestMarshaller.Instance;
options.ResponseUnmarshaller = RestoreDBClusterFromSnapshotResponseUnmarshaller.Instance;
return InvokeAsync<RestoreDBClusterFromSnapshotResponse>(request, options, cancellationToken);
}
#endregion
#region RestoreDBClusterToPointInTime
/// <summary>
/// Restores a DB cluster to an arbitrary point in time. Users can restore to any point
/// in time before <code>LatestRestorableTime</code> for up to <code>BackupRetentionPeriod</code>
/// days. The target DB cluster is created from the source DB cluster with the same configuration
/// as the original DB cluster, except that the new DB cluster is created with the default
/// DB security group.
///
/// <note>
/// <para>
/// This action only restores the DB cluster, not the DB instances for that DB cluster.
/// You must invoke the <a>CreateDBInstance</a> action to create DB instances for the
/// restored DB cluster, specifying the identifier of the restored DB cluster in <code>DBClusterIdentifier</code>.
/// You can create DB instances only after the <code>RestoreDBClusterToPointInTime</code>
/// action has completed and the DB cluster is available.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RestoreDBClusterToPointInTime service method.</param>
///
/// <returns>The response from the RestoreDBClusterToPointInTime service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterAlreadyExistsException">
/// User already has a DB cluster with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterParameterGroupNotFoundException">
/// <i>DBClusterParameterGroupName</i> does not refer to an existing DB Cluster parameter
/// group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterQuotaExceededException">
/// User attempted to create a new DB cluster and the user has already reached the maximum
/// allowed DB cluster quota.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientDBClusterCapacityException">
/// The DB cluster does not have enough capacity for the current operation.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientStorageClusterCapacityException">
/// There is insufficient storage available for the current action. You may be able to
/// resolve this error by updating your subnet group to use different Availability Zones
/// that have more storage available.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSnapshotStateException">
/// The state of the DB snapshot does not allow deletion.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidRestoreException">
/// Cannot restore from vpc backup to non-vpc DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.OptionGroupNotFoundException">
/// The designated option group could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RestoreDBClusterToPointInTime">REST API Reference for RestoreDBClusterToPointInTime Operation</seealso>
public virtual RestoreDBClusterToPointInTimeResponse RestoreDBClusterToPointInTime(RestoreDBClusterToPointInTimeRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RestoreDBClusterToPointInTimeRequestMarshaller.Instance;
options.ResponseUnmarshaller = RestoreDBClusterToPointInTimeResponseUnmarshaller.Instance;
return Invoke<RestoreDBClusterToPointInTimeResponse>(request, options);
}
/// <summary>
/// Restores a DB cluster to an arbitrary point in time. Users can restore to any point
/// in time before <code>LatestRestorableTime</code> for up to <code>BackupRetentionPeriod</code>
/// days. The target DB cluster is created from the source DB cluster with the same configuration
/// as the original DB cluster, except that the new DB cluster is created with the default
/// DB security group.
///
/// <note>
/// <para>
/// This action only restores the DB cluster, not the DB instances for that DB cluster.
/// You must invoke the <a>CreateDBInstance</a> action to create DB instances for the
/// restored DB cluster, specifying the identifier of the restored DB cluster in <code>DBClusterIdentifier</code>.
/// You can create DB instances only after the <code>RestoreDBClusterToPointInTime</code>
/// action has completed and the DB cluster is available.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RestoreDBClusterToPointInTime service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RestoreDBClusterToPointInTime service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterAlreadyExistsException">
/// User already has a DB cluster with the given identifier.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterParameterGroupNotFoundException">
/// <i>DBClusterParameterGroupName</i> does not refer to an existing DB Cluster parameter
/// group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterQuotaExceededException">
/// User attempted to create a new DB cluster and the user has already reached the maximum
/// allowed DB cluster quota.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBClusterSnapshotNotFoundException">
/// <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.DBSubnetGroupNotFoundException">
/// <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientDBClusterCapacityException">
/// The DB cluster does not have enough capacity for the current operation.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InsufficientStorageClusterCapacityException">
/// There is insufficient storage available for the current action. You may be able to
/// resolve this error by updating your subnet group to use different Availability Zones
/// that have more storage available.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterSnapshotStateException">
/// The supplied value is not a valid DB cluster snapshot state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBSnapshotStateException">
/// The state of the DB snapshot does not allow deletion.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidRestoreException">
/// Cannot restore from vpc backup to non-vpc DB instance.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidSubnetException">
/// The requested subnet is invalid, or multiple subnets were requested that are not all
/// in a common VPC.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidVPCNetworkStateException">
/// DB subnet group does not cover all Availability Zones after it is created because
/// users' change.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.KMSKeyNotAccessibleException">
/// Error accessing KMS key.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.OptionGroupNotFoundException">
/// The designated option group could not be found.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.StorageQuotaExceededException">
/// Request would result in user exceeding the allowed amount of storage available across
/// all DB instances.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/RestoreDBClusterToPointInTime">REST API Reference for RestoreDBClusterToPointInTime Operation</seealso>
public virtual Task<RestoreDBClusterToPointInTimeResponse> RestoreDBClusterToPointInTimeAsync(RestoreDBClusterToPointInTimeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RestoreDBClusterToPointInTimeRequestMarshaller.Instance;
options.ResponseUnmarshaller = RestoreDBClusterToPointInTimeResponseUnmarshaller.Instance;
return InvokeAsync<RestoreDBClusterToPointInTimeResponse>(request, options, cancellationToken);
}
#endregion
#region StartDBCluster
/// <summary>
/// Starts an Amazon Neptune DB cluster that was stopped using the AWS console, the AWS
/// CLI stop-db-cluster command, or the StopDBCluster API.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StartDBCluster service method.</param>
///
/// <returns>The response from the StartDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/StartDBCluster">REST API Reference for StartDBCluster Operation</seealso>
public virtual StartDBClusterResponse StartDBCluster(StartDBClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = StartDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = StartDBClusterResponseUnmarshaller.Instance;
return Invoke<StartDBClusterResponse>(request, options);
}
/// <summary>
/// Starts an Amazon Neptune DB cluster that was stopped using the AWS console, the AWS
/// CLI stop-db-cluster command, or the StopDBCluster API.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StartDBCluster service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the StartDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/StartDBCluster">REST API Reference for StartDBCluster Operation</seealso>
public virtual Task<StartDBClusterResponse> StartDBClusterAsync(StartDBClusterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = StartDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = StartDBClusterResponseUnmarshaller.Instance;
return InvokeAsync<StartDBClusterResponse>(request, options, cancellationToken);
}
#endregion
#region StopDBCluster
/// <summary>
/// Stops an Amazon Neptune DB cluster. When you stop a DB cluster, Neptune retains the
/// DB cluster's metadata, including its endpoints and DB parameter groups.
///
///
/// <para>
/// Neptune also retains the transaction logs so you can do a point-in-time restore if
/// necessary.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StopDBCluster service method.</param>
///
/// <returns>The response from the StopDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/StopDBCluster">REST API Reference for StopDBCluster Operation</seealso>
public virtual StopDBClusterResponse StopDBCluster(StopDBClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = StopDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = StopDBClusterResponseUnmarshaller.Instance;
return Invoke<StopDBClusterResponse>(request, options);
}
/// <summary>
/// Stops an Amazon Neptune DB cluster. When you stop a DB cluster, Neptune retains the
/// DB cluster's metadata, including its endpoints and DB parameter groups.
///
///
/// <para>
/// Neptune also retains the transaction logs so you can do a point-in-time restore if
/// necessary.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StopDBCluster service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the StopDBCluster service method, as returned by Neptune.</returns>
/// <exception cref="Amazon.Neptune.Model.DBClusterNotFoundException">
/// <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBClusterStateException">
/// The DB cluster is not in a valid state.
/// </exception>
/// <exception cref="Amazon.Neptune.Model.InvalidDBInstanceStateException">
/// The specified DB instance is not in the <i>available</i> state.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/neptune-2014-10-31/StopDBCluster">REST API Reference for StopDBCluster Operation</seealso>
public virtual Task<StopDBClusterResponse> StopDBClusterAsync(StopDBClusterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = StopDBClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = StopDBClusterResponseUnmarshaller.Instance;
return InvokeAsync<StopDBClusterResponse>(request, options, cancellationToken);
}
#endregion
}
} | 58.854037 | 257 | 0.680144 | [
"Apache-2.0"
] | NGL321/aws-sdk-net | sdk/src/Services/Neptune/Generated/_bcl45/AmazonNeptuneClient.cs | 284,265 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210
{
using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell;
/// <summary>The properties of the Failover Process Server request.</summary>
[System.ComponentModel.TypeConverter(typeof(FailoverProcessServerRequestPropertiesTypeConverter))]
public partial class FailoverProcessServerRequestProperties
{
/// <summary>
/// <c>AfterDeserializeDictionary</c> will be called after the deserialization has finished, allowing customization of the
/// object before it is returned. Implement this method in a partial class to enable this behavior
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
/// <summary>
/// <c>AfterDeserializePSObject</c> will be called after the deserialization has finished, allowing customization of the object
/// before it is returned. Implement this method in a partial class to enable this behavior
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
/// <summary>
/// <c>BeforeDeserializeDictionary</c> will be called before the deserialization has commenced, allowing complete customization
/// of the object before it is deserialized.
/// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
/// Implement this method in a partial class to enable this behavior.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
/// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
/// instantly.</param>
partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
/// <summary>
/// <c>BeforeDeserializePSObject</c> will be called before the deserialization has commenced, allowing complete customization
/// of the object before it is deserialized.
/// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
/// Implement this method in a partial class to enable this behavior.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
/// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
/// instantly.</param>
partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
/// <summary>
/// Deserializes a <see cref="global::System.Collections.IDictionary" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.FailoverProcessServerRequestProperties"
/// />.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
/// <returns>
/// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestProperties"
/// />.
/// </returns>
public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestProperties DeserializeFromDictionary(global::System.Collections.IDictionary content)
{
return new FailoverProcessServerRequestProperties(content);
}
/// <summary>
/// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.FailoverProcessServerRequestProperties"
/// />.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
/// <returns>
/// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestProperties"
/// />.
/// </returns>
public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
{
return new FailoverProcessServerRequestProperties(content);
}
/// <summary>
/// Deserializes a <see cref="global::System.Collections.IDictionary" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.FailoverProcessServerRequestProperties"
/// />.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
internal FailoverProcessServerRequestProperties(global::System.Collections.IDictionary content)
{
bool returnNow = false;
BeforeDeserializeDictionary(content, ref returnNow);
if (returnNow)
{
return;
}
// actually deserialize
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).ContainerName, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).SourceProcessServerId = (string) content.GetValueForProperty("SourceProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).SourceProcessServerId, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).TargetProcessServerId = (string) content.GetValueForProperty("TargetProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).TargetProcessServerId, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).VmsToMigrate = (string[]) content.GetValueForProperty("VmsToMigrate",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).VmsToMigrate, __y => TypeConverterExtensions.SelectToArray<string>(__y, global::System.Convert.ToString));
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).UpdateType = (string) content.GetValueForProperty("UpdateType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).UpdateType, global::System.Convert.ToString);
AfterDeserializeDictionary(content);
}
/// <summary>
/// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.FailoverProcessServerRequestProperties"
/// />.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
internal FailoverProcessServerRequestProperties(global::System.Management.Automation.PSObject content)
{
bool returnNow = false;
BeforeDeserializePSObject(content, ref returnNow);
if (returnNow)
{
return;
}
// actually deserialize
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).ContainerName = (string) content.GetValueForProperty("ContainerName",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).ContainerName, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).SourceProcessServerId = (string) content.GetValueForProperty("SourceProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).SourceProcessServerId, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).TargetProcessServerId = (string) content.GetValueForProperty("TargetProcessServerId",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).TargetProcessServerId, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).VmsToMigrate = (string[]) content.GetValueForProperty("VmsToMigrate",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).VmsToMigrate, __y => TypeConverterExtensions.SelectToArray<string>(__y, global::System.Convert.ToString));
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).UpdateType = (string) content.GetValueForProperty("UpdateType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestPropertiesInternal)this).UpdateType, global::System.Convert.ToString);
AfterDeserializePSObject(content);
}
/// <summary>
/// Creates a new instance of <see cref="FailoverProcessServerRequestProperties" />, deserializing the content from a json
/// string.
/// </summary>
/// <param name="jsonText">a string containing a JSON serialized instance of this model.</param>
/// <returns>an instance of the <see cref="className" /> model class.</returns>
public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20210210.IFailoverProcessServerRequestProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText));
/// <summary>Serializes this instance to a json string.</summary>
/// <returns>a <see cref="System.String" /> containing this model serialized to JSON text.</returns>
public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString();
}
/// The properties of the Failover Process Server request.
[System.ComponentModel.TypeConverter(typeof(FailoverProcessServerRequestPropertiesTypeConverter))]
public partial interface IFailoverProcessServerRequestProperties
{
}
} | 81.653061 | 424 | 0.738232 | [
"MIT"
] | Agazoth/azure-powershell | src/Migrate/generated/api/Models/Api20210210/FailoverProcessServerRequestProperties.PowerShell.cs | 11,857 | C# |
using System.Threading.Tasks;
namespace sfa.Tl.Marketing.Communication.SearchPipeline
{
public interface ISearchStep
{
Task Execute(ISearchContext searchContext);
}
}
| 18.9 | 55 | 0.73545 | [
"MIT"
] | SkillsFundingAgency/tl-marketing-and-communication | sfa.Tl.Marketing.Communication/SearchPipeline/ISearchStep.cs | 191 | C# |
// Copyright (c) 2020 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/
// Licensed under MIT license. See License.txt in the project root for license information.
using System.ComponentModel.DataAnnotations;
namespace DataLayer.BookApp.EfClasses
{
public class PriceOffer
{
public const int PromotionalTextLength = 200;
public int PriceOfferId { get; set; }
public decimal NewPrice { get; set; }
[Required]
[MaxLength(PromotionalTextLength)]
public string PromotionalText { get; set; }
//-----------------------------------------------
//Relationships
public int BookId { get; set; }
}
} | 29.333333 | 97 | 0.620739 | [
"MIT"
] | ErikEJ/EfCore.SchemaCompare | DataLayer/BookApp/EfClasses/PriceOffer.cs | 706 | C# |
using VA.Blazor.CleanArchitecture.Application.Enums;
using VA.Blazor.CleanArchitecture.Infrastructure.Models.Audit;
using VA.Blazor.CleanArchitecture.Infrastructure.Models.Identity;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace VA.Blazor.CleanArchitecture.Infrastructure.Contexts
{
public abstract class AuditableContext : IdentityDbContext<BlazorHeroUser, BlazorHeroRole, string, IdentityUserClaim<string>, IdentityUserRole<string>, IdentityUserLogin<string>, BlazorHeroRoleClaim, IdentityUserToken<string>>
{
public AuditableContext(DbContextOptions options) : base(options)
{
}
public DbSet<Audit> AuditTrails { get; set; }
public virtual async Task<int> SaveChangesAsync(string userId = null)
{
var auditEntries = OnBeforeSaveChanges(userId);
var result = await base.SaveChangesAsync();
await OnAfterSaveChanges(auditEntries);
return result;
}
private List<AuditEntry> OnBeforeSaveChanges(string userId)
{
ChangeTracker.DetectChanges();
var auditEntries = new List<AuditEntry>();
foreach (var entry in ChangeTracker.Entries())
{
if (entry.Entity is Audit || entry.State == EntityState.Detached || entry.State == EntityState.Unchanged)
continue;
var auditEntry = new AuditEntry(entry)
{
TableName = entry.Entity.GetType().Name,
UserId = userId
};
auditEntries.Add(auditEntry);
foreach (var property in entry.Properties)
{
if (property.IsTemporary)
{
auditEntry.TemporaryProperties.Add(property);
continue;
}
string propertyName = property.Metadata.Name;
if (property.Metadata.IsPrimaryKey())
{
auditEntry.KeyValues[propertyName] = property.CurrentValue;
continue;
}
switch (entry.State)
{
case EntityState.Added:
auditEntry.AuditType = AuditType.Create;
auditEntry.NewValues[propertyName] = property.CurrentValue;
break;
case EntityState.Deleted:
auditEntry.AuditType = AuditType.Delete;
auditEntry.OldValues[propertyName] = property.OriginalValue;
break;
case EntityState.Modified:
if (property.IsModified)
{
auditEntry.ChangedColumns.Add(propertyName);
auditEntry.AuditType = AuditType.Update;
auditEntry.OldValues[propertyName] = property.OriginalValue;
auditEntry.NewValues[propertyName] = property.CurrentValue;
}
break;
}
}
}
foreach (var auditEntry in auditEntries.Where(_ => !_.HasTemporaryProperties))
{
AuditTrails.Add(auditEntry.ToAudit());
}
return auditEntries.Where(_ => _.HasTemporaryProperties).ToList();
}
private Task OnAfterSaveChanges(List<AuditEntry> auditEntries)
{
if (auditEntries == null || auditEntries.Count == 0)
return Task.CompletedTask;
foreach (var auditEntry in auditEntries)
{
foreach (var prop in auditEntry.TemporaryProperties)
{
if (prop.Metadata.IsPrimaryKey())
{
auditEntry.KeyValues[prop.Metadata.Name] = prop.CurrentValue;
}
else
{
auditEntry.NewValues[prop.Metadata.Name] = prop.CurrentValue;
}
}
AuditTrails.Add(auditEntry.ToAudit());
}
return SaveChangesAsync();
}
}
} | 40.39823 | 230 | 0.529025 | [
"MIT"
] | vinaykarora/BlazorCleanArchitecture | src/VA.Blazor.CleanArchitecture.Infrastructure/Contexts/AuditableContext.cs | 4,567 | C# |
/*******************************************************************************
* Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* *****************************************************************************
*
* AWS Tools for Windows (TM) PowerShell (TM)
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using Amazon.PowerShell.Common;
using Amazon.Runtime;
using Amazon.Rekognition;
using Amazon.Rekognition.Model;
namespace Amazon.PowerShell.Cmdlets.REK
{
/// <summary>
/// Starts asynchronous detection of labels in a stored video.
///
///
/// <para>
/// Amazon Rekognition Video can detect labels in a video. Labels are instances of real-world
/// entities. This includes objects like flower, tree, and table; events like wedding,
/// graduation, and birthday party; concepts like landscape, evening, and nature; and
/// activities like a person getting out of a car or a person skiing.
/// </para><para>
/// The video must be stored in an Amazon S3 bucket. Use <a>Video</a> to specify the bucket
/// name and the filename of the video. <code>StartLabelDetection</code> returns a job
/// identifier (<code>JobId</code>) which you use to get the results of the operation.
/// When label detection is finished, Amazon Rekognition Video publishes a completion
/// status to the Amazon Simple Notification Service topic that you specify in <code>NotificationChannel</code>.
/// </para><para>
/// To get the results of the label detection operation, first check that the status value
/// published to the Amazon SNS topic is <code>SUCCEEDED</code>. If so, call <a>GetLabelDetection</a>
/// and pass the job identifier (<code>JobId</code>) from the initial call to <code>StartLabelDetection</code>.
/// </para>
/// </summary>
[Cmdlet("Start", "REKLabelDetection", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType("System.String")]
[AWSCmdlet("Calls the Amazon Rekognition StartLabelDetection API operation.", Operation = new[] {"StartLabelDetection"}, SelectReturnType = typeof(Amazon.Rekognition.Model.StartLabelDetectionResponse))]
[AWSCmdletOutput("System.String or Amazon.Rekognition.Model.StartLabelDetectionResponse",
"This cmdlet returns a System.String object.",
"The service call response (type Amazon.Rekognition.Model.StartLabelDetectionResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class StartREKLabelDetectionCmdlet : AmazonRekognitionClientCmdlet, IExecutor
{
#region Parameter ClientRequestToken
/// <summary>
/// <para>
/// <para>Idempotent token used to identify the start request. If you use the same token with
/// multiple <code>StartLabelDetection</code> requests, the same <code>JobId</code> is
/// returned. Use <code>ClientRequestToken</code> to prevent the same job from being accidently
/// started more than once. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String ClientRequestToken { get; set; }
#endregion
#region Parameter JobTag
/// <summary>
/// <para>
/// <para>An identifier you specify that's returned in the completion notification that's published
/// to your Amazon Simple Notification Service topic. For example, you can use <code>JobTag</code>
/// to group related jobs and identify them in the completion notification.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String JobTag { get; set; }
#endregion
#region Parameter MinConfidence
/// <summary>
/// <para>
/// <para>Specifies the minimum confidence that Amazon Rekognition Video must have in order
/// to return a detected label. Confidence represents how certain Amazon Rekognition is
/// that a label is correctly identified.0 is the lowest confidence. 100 is the highest
/// confidence. Amazon Rekognition Video doesn't return any labels with a confidence level
/// lower than this specified value.</para><para>If you don't specify <code>MinConfidence</code>, the operation returns labels with
/// confidence values greater than or equal to 50 percent.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Single? MinConfidence { get; set; }
#endregion
#region Parameter NotificationChannel_RoleArn
/// <summary>
/// <para>
/// <para>The ARN of an IAM role that gives Amazon Rekognition publishing permissions to the
/// Amazon SNS topic. </para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String NotificationChannel_RoleArn { get; set; }
#endregion
#region Parameter NotificationChannel_SNSTopicArn
/// <summary>
/// <para>
/// <para>The Amazon SNS topic to which Amazon Rekognition to posts the completion status.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String NotificationChannel_SNSTopicArn { get; set; }
#endregion
#region Parameter Video
/// <summary>
/// <para>
/// <para>The video in which you want to detect labels. The video must be stored in an Amazon
/// S3 bucket.</para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public Amazon.Rekognition.Model.Video Video { get; set; }
#endregion
#region Parameter Select
/// <summary>
/// Use the -Select parameter to control the cmdlet output. The default value is 'JobId'.
/// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.Rekognition.Model.StartLabelDetectionResponse).
/// Specifying the name of a property of type Amazon.Rekognition.Model.StartLabelDetectionResponse will result in that property being returned.
/// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public string Select { get; set; } = "JobId";
#endregion
#region Parameter Force
/// <summary>
/// This parameter overrides confirmation prompts to force
/// the cmdlet to continue its operation. This parameter should always
/// be used with caution.
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter Force { get; set; }
#endregion
protected override void ProcessRecord()
{
base.ProcessRecord();
var resourceIdentifiersText = string.Empty;
if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Start-REKLabelDetection (StartLabelDetection)"))
{
return;
}
var context = new CmdletContext();
// allow for manipulation of parameters prior to loading into context
PreExecutionContextLoad(context);
if (ParameterWasBound(nameof(this.Select)))
{
context.Select = CreateSelectDelegate<Amazon.Rekognition.Model.StartLabelDetectionResponse, StartREKLabelDetectionCmdlet>(Select) ??
throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
}
context.ClientRequestToken = this.ClientRequestToken;
context.JobTag = this.JobTag;
context.MinConfidence = this.MinConfidence;
context.NotificationChannel_RoleArn = this.NotificationChannel_RoleArn;
context.NotificationChannel_SNSTopicArn = this.NotificationChannel_SNSTopicArn;
context.Video = this.Video;
#if MODULAR
if (this.Video == null && ParameterWasBound(nameof(this.Video)))
{
WriteWarning("You are passing $null as a value for parameter Video which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
// allow further manipulation of loaded context prior to processing
PostExecutionContextLoad(context);
var output = Execute(context) as CmdletOutput;
ProcessOutput(output);
}
#region IExecutor Members
public object Execute(ExecutorContext context)
{
var cmdletContext = context as CmdletContext;
// create request
var request = new Amazon.Rekognition.Model.StartLabelDetectionRequest();
if (cmdletContext.ClientRequestToken != null)
{
request.ClientRequestToken = cmdletContext.ClientRequestToken;
}
if (cmdletContext.JobTag != null)
{
request.JobTag = cmdletContext.JobTag;
}
if (cmdletContext.MinConfidence != null)
{
request.MinConfidence = cmdletContext.MinConfidence.Value;
}
// populate NotificationChannel
var requestNotificationChannelIsNull = true;
request.NotificationChannel = new Amazon.Rekognition.Model.NotificationChannel();
System.String requestNotificationChannel_notificationChannel_RoleArn = null;
if (cmdletContext.NotificationChannel_RoleArn != null)
{
requestNotificationChannel_notificationChannel_RoleArn = cmdletContext.NotificationChannel_RoleArn;
}
if (requestNotificationChannel_notificationChannel_RoleArn != null)
{
request.NotificationChannel.RoleArn = requestNotificationChannel_notificationChannel_RoleArn;
requestNotificationChannelIsNull = false;
}
System.String requestNotificationChannel_notificationChannel_SNSTopicArn = null;
if (cmdletContext.NotificationChannel_SNSTopicArn != null)
{
requestNotificationChannel_notificationChannel_SNSTopicArn = cmdletContext.NotificationChannel_SNSTopicArn;
}
if (requestNotificationChannel_notificationChannel_SNSTopicArn != null)
{
request.NotificationChannel.SNSTopicArn = requestNotificationChannel_notificationChannel_SNSTopicArn;
requestNotificationChannelIsNull = false;
}
// determine if request.NotificationChannel should be set to null
if (requestNotificationChannelIsNull)
{
request.NotificationChannel = null;
}
if (cmdletContext.Video != null)
{
request.Video = cmdletContext.Video;
}
CmdletOutput output;
// issue call
var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
try
{
var response = CallAWSServiceOperation(client, request);
object pipelineOutput = null;
pipelineOutput = cmdletContext.Select(response, this);
output = new CmdletOutput
{
PipelineOutput = pipelineOutput,
ServiceResponse = response
};
}
catch (Exception e)
{
output = new CmdletOutput { ErrorResponse = e };
}
return output;
}
public ExecutorContext CreateContext()
{
return new CmdletContext();
}
#endregion
#region AWS Service Operation Call
private Amazon.Rekognition.Model.StartLabelDetectionResponse CallAWSServiceOperation(IAmazonRekognition client, Amazon.Rekognition.Model.StartLabelDetectionRequest request)
{
Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Rekognition", "StartLabelDetection");
try
{
#if DESKTOP
return client.StartLabelDetection(request);
#elif CORECLR
return client.StartLabelDetectionAsync(request).GetAwaiter().GetResult();
#else
#error "Unknown build edition"
#endif
}
catch (AmazonServiceException exc)
{
var webException = exc.InnerException as System.Net.WebException;
if (webException != null)
{
throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
}
throw;
}
}
#endregion
internal partial class CmdletContext : ExecutorContext
{
public System.String ClientRequestToken { get; set; }
public System.String JobTag { get; set; }
public System.Single? MinConfidence { get; set; }
public System.String NotificationChannel_RoleArn { get; set; }
public System.String NotificationChannel_SNSTopicArn { get; set; }
public Amazon.Rekognition.Model.Video Video { get; set; }
public System.Func<Amazon.Rekognition.Model.StartLabelDetectionResponse, StartREKLabelDetectionCmdlet, object> Select { get; set; } =
(response, cmdlet) => response.JobId;
}
}
}
| 47.285276 | 276 | 0.627506 | [
"Apache-2.0"
] | 5u5hma/aws-tools-for-powershell | modules/AWSPowerShell/Cmdlets/Rekognition/Basic/Start-REKLabelDetection-Cmdlet.cs | 15,415 | C# |
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AspNetCore.Identity.Mongo.Model;
using Microsoft.AspNetCore.Identity;
namespace AspNetCore.Identity.Mongo.Stores
{
public class RoleStore<TRole> : IQueryableRoleStore<TRole> where TRole : MongoRole
{
private readonly IIdentityRoleCollection<TRole> _collection;
public RoleStore(IIdentityRoleCollection<TRole> collection)
{
_collection = collection;
}
IQueryable<TRole> IQueryableRoleStore<TRole>.Roles => _collection.GetAllAsync().Result.AsQueryable();
async Task<IdentityResult> IRoleStore<TRole>.CreateAsync(TRole role, CancellationToken cancellationToken)
{
var found = await _collection.FindByNameAsync(role.NormalizedName);
if (found == null) await _collection.CreateAsync(role);
return IdentityResult.Success;
}
async Task<IdentityResult> IRoleStore<TRole>.UpdateAsync(TRole role, CancellationToken cancellationToken)
{
await _collection.UpdateAsync(role);
return IdentityResult.Success;
}
async Task<IdentityResult> IRoleStore<TRole>.DeleteAsync(TRole role, CancellationToken cancellationToken)
{
await _collection.DeleteAsync(role);
return IdentityResult.Success;
}
async Task<string> IRoleStore<TRole>.GetRoleIdAsync(TRole role, CancellationToken cancellationToken)
{
return (await Task.FromResult(role.Id)).ToString();
}
async Task<string> IRoleStore<TRole>.GetRoleNameAsync(TRole role, CancellationToken cancellationToken)
{
return await Task.FromResult(role.Name);
}
async Task IRoleStore<TRole>.SetRoleNameAsync(TRole role, string roleName, CancellationToken cancellationToken)
{
role.Name = roleName;
await _collection.UpdateAsync(role);
}
async Task<string> IRoleStore<TRole>.GetNormalizedRoleNameAsync(TRole role, CancellationToken cancellationToken)
{
return await Task.FromResult(role.NormalizedName);
}
async Task IRoleStore<TRole>.SetNormalizedRoleNameAsync(TRole role, string normalizedName,
CancellationToken cancellationToken)
{
role.NormalizedName = normalizedName;
await _collection.UpdateAsync(role);
}
async Task<TRole> IRoleStore<TRole>.FindByIdAsync(string roleId, CancellationToken cancellationToken)
{
return await _collection.FindByIdAsync(roleId);
}
async Task<TRole> IRoleStore<TRole>.FindByNameAsync(string normalizedRoleName, CancellationToken cancellationToken)
{
return await _collection.FindByNameAsync(normalizedRoleName);
}
void IDisposable.Dispose()
{
}
}
} | 30.97561 | 117 | 0.783071 | [
"MIT"
] | artem-kovalev/AspNetCore.Identity.Mongo | AspNetCore.Identity.Mongo/Stores/RoleStore.cs | 2,542 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp.Structure;
using Microsoft.CodeAnalysis.CSharp.Structure.MetadataAsSource;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Structure;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Structure.MetadataAsSource
{
public class EnumMemberDeclarationStructureTests : AbstractCSharpSyntaxNodeStructureTests<EnumMemberDeclarationSyntax>
{
protected override string WorkspaceKind => CodeAnalysis.WorkspaceKind.MetadataAsSource;
internal override AbstractSyntaxStructureProvider CreateProvider() => new MetadataEnumMemberDeclarationStructureProvider();
[Fact, Trait(Traits.Feature, Traits.Features.MetadataAsSource)]
public async Task NoCommentsOrAttributes()
{
const string code = @"
enum E
{
$$Goo,
Bar
}";
await VerifyNoBlockSpansAsync(code);
}
[Fact, Trait(Traits.Feature, Traits.Features.MetadataAsSource)]
public async Task WithAttributes()
{
const string code = @"
enum E
{
{|hint:{|textspan:[Blah]
|}$$Goo|},
Bar
}";
await VerifyBlockSpansAsync(code,
Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}
[Fact, Trait(Traits.Feature, Traits.Features.MetadataAsSource)]
public async Task WithCommentsAndAttributes()
{
const string code = @"
enum E
{
{|hint:{|textspan:// Summary:
// This is a summary.
[Blah]
|}$$Goo|},
Bar
}";
await VerifyBlockSpansAsync(code,
Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}
}
}
| 30.90625 | 161 | 0.685541 | [
"Apache-2.0"
] | 20chan/roslyn | src/EditorFeatures/CSharpTest/Structure/MetadataAsSource/EnumMemberDeclarationStructureTests.cs | 1,980 | C# |
/******************************************************************************
* Spine Runtimes Software License v2.5
*
* Copyright (c) 2013-2016, Esoteric Software
* All rights reserved.
*
* You are granted a perpetual, non-exclusive, non-sublicensable, and
* non-transferable license to use, install, execute, and perform the Spine
* Runtimes software and derivative works solely for personal or internal
* use. Without the written permission of Esoteric Software (see Section 2 of
* the Spine Software License Agreement), you may not (a) modify, translate,
* adapt, or develop new applications using the Spine Runtimes or otherwise
* create derivative works or improvements of the Spine Runtimes or (b) remove,
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
* or other intellectual property or proprietary rights notices on or in the
* Software, including any copy thereof. Redistributions in binary or source
* form must include this license and terms.
*
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
* USE, DATA, OR PROFITS) 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 UnityEngine;
namespace Spine.Unity {
[RequireComponent(typeof(SkeletonUtilityBone)), ExecuteInEditMode]
public abstract class SkeletonUtilityConstraint : MonoBehaviour {
protected SkeletonUtilityBone bone;
protected SkeletonUtility hierarchy;
protected virtual void OnEnable () {
bone = GetComponent<SkeletonUtilityBone>();
hierarchy = transform.GetComponentInParent<SkeletonUtility>();
hierarchy.RegisterConstraint(this);
}
protected virtual void OnDisable () {
hierarchy.UnregisterConstraint(this);
}
public abstract void DoUpdate ();
}
}
| 45.622642 | 81 | 0.722498 | [
"MIT"
] | lantis-of-china/UnityFramework | ClientFramework/QiPai/Assets/OtherCompoments/Spine/Runtime/spine-unity/SkeletonUtility/SkeletonUtilityConstraint.cs | 2,418 | C# |
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using System.Text;
using System.Web;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Formatting;
namespace LocalisationAnalyser.Localisation
{
/// <summary>
/// <see cref="SyntaxNode"/> generators for use with a <see cref="LocalisationFile"/>.
/// </summary>
internal static class SyntaxGenerators
{
/// <summary>
/// Generates the full class syntax, including the namespace, all leading/trailing members, and the localisation members.
/// </summary>
/// <returns>The syntax.</returns>
public static SyntaxNode GenerateClassSyntax(Workspace workspace, LocalisationFile localisationFile)
=> SyntaxFactory.ParseCompilationUnit(SyntaxTemplates.FILE_HEADER_SIGNATURE)
.AddMembers(
SyntaxFactory.NamespaceDeclaration(
SyntaxFactory.IdentifierName(localisationFile.Namespace))
.WithMembers(
SyntaxFactory.SingletonList<MemberDeclarationSyntax>(
SyntaxFactory.ClassDeclaration(localisationFile.Name)
.WithMembers(SyntaxFactory.List(
localisationFile.Members
.Select(m => m.Parameters.Length == 0 ? GeneratePropertySyntax(m) : GenerateMethodSyntax(workspace, m))
.Prepend(GeneratePrefixSyntax(localisationFile))
.Append(GenerateGetKeySyntax())))
.WithModifiers(
new SyntaxTokenList(
SyntaxFactory.Token(SyntaxKind.PublicKeyword),
SyntaxFactory.Token(SyntaxKind.StaticKeyword))))));
/// <summary>
/// Generates the syntax for a property member.
/// </summary>
public static MemberDeclarationSyntax GeneratePropertySyntax(LocalisationMember member)
=> SyntaxFactory.ParseMemberDeclaration(
string.Format(SyntaxTemplates.PROPERTY_MEMBER_TEMPLATE,
member.Name,
member.Key,
convertToVerbatim(member.EnglishText),
EncodeXmlDoc(member.EnglishText)))!;
/// <summary>
/// Generates the syntax for a method member.
/// </summary>
public static MemberDeclarationSyntax GenerateMethodSyntax(Workspace workspace, LocalisationMember member)
{
var paramList = SyntaxFactory.ParameterList(
SyntaxFactory.SeparatedList(
member.Parameters.Select(param => SyntaxFactory.Parameter(
GenerateIdentifier(param.Name))
.WithType(
SyntaxFactory.IdentifierName(param.Type)))));
var argList = SyntaxFactory.ArgumentList(
SyntaxFactory.SeparatedList(
member.Parameters.Select(param => SyntaxFactory.Argument(
GenerateIdentifierName(param.Name)))));
return SyntaxFactory.ParseMemberDeclaration(
string.Format(SyntaxTemplates.METHOD_MEMBER_TEMPLATE,
member.Name,
Formatter.Format(paramList, workspace).ToFullString(),
member.Key,
convertToVerbatim(member.EnglishText),
trimParens(Formatter.Format(argList, workspace).ToFullString()), // The entire string minus the parens
EncodeXmlDoc(member.EnglishText)))!;
static string trimParens(string input) => input.Substring(1, input.Length - 2);
}
/// <summary>
/// Generates the syntax for accessing the member.
/// </summary>
public static MemberAccessExpressionSyntax GenerateMemberAccessSyntax(LocalisationFile localisationFile, LocalisationMember member)
=> SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
SyntaxFactory.IdentifierName(localisationFile.Name),
SyntaxFactory.IdentifierName(member.Name));
/// <summary>
/// Generates the syntax for the prefix constant.
/// </summary>
public static MemberDeclarationSyntax GeneratePrefixSyntax(LocalisationFile localisationFile)
=> SyntaxFactory.ParseMemberDeclaration(string.Format(SyntaxTemplates.PREFIX_CONST_TEMPLATE, localisationFile.Prefix))!;
/// <summary>
/// Generates the syntax for the getKey() method.
/// </summary>
public static MemberDeclarationSyntax GenerateGetKeySyntax()
=> SyntaxFactory.ParseMemberDeclaration(SyntaxTemplates.GET_KEY_METHOD_TEMPLATE)!;
/// <summary>
/// Generates an identifier <see cref="SyntaxToken"/> from a string, taking into account reserved language keywords.
/// </summary>
/// <param name="name">The string to generate an identifier for.</param>
public static SyntaxToken GenerateIdentifier(string name)
{
if (SyntaxFacts.IsReservedKeyword(SyntaxFacts.GetKeywordKind(name)))
name = $"@{name}";
return SyntaxFactory.Identifier(name);
}
/// <summary>
/// Generates an <see cref="IdentifierNameSyntax"/> from a string, taking into account reserved language keywords.
/// </summary>
/// <param name="name">The string to generate an identifier for.</param>
public static IdentifierNameSyntax GenerateIdentifierName(string name)
{
if (SyntaxFacts.IsReservedKeyword(SyntaxFacts.GetKeywordKind(name)))
name = $"@{name}";
return SyntaxFactory.IdentifierName(name);
}
public static string EncodeXmlDoc(string xmlDoc)
{
var lines = xmlDoc.Split('\n');
for (int i = 0; i < lines.Length; i++)
{
var sb = new StringBuilder();
sb.Append("/// ");
if (i == 0)
sb.Append("\"");
sb.Append(HttpUtility.HtmlEncode(lines[i]));
if (i == lines.Length - 1)
sb.Append("\"");
lines[i] = sb.ToString();
}
return string.Join(Environment.NewLine, lines);
}
/// <summary>
/// Converts a string literal to its verbatim representation. Assumes that the string is already non-verbatim.
/// </summary>
/// <param name="input">The non-verbatim string.</param>
/// <returns>The verbatim replacement.</returns>
private static string convertToVerbatim(string input)
{
var result = new StringBuilder();
foreach (var c in input)
{
result.Append(c);
if (c == '"')
result.Append(c);
}
return result.ToString();
}
}
}
| 46.823529 | 189 | 0.543467 | [
"MIT"
] | frenzibyte/osu-localisation-analyser | LocalisationAnalyser/Localisation/SyntaxGenerators.cs | 7,960 | C# |
//<unit_header>
//----------------------------------------------------------------
//
// Martin Korneffel: IT Beratung/Softwareentwicklung
// Stuttgart, den
//
// Projekt.......: mko.NaLisp
// Name..........: Pipe.cs
// Aufgabe/Fkt...: Hintereinanderschaltung von Funktionen. Vereinfachte Syntax.
// Pipe(f1(...), f2(....)) -> f2(f1(....)....)
//
//
//
//
//
//<unit_environment>
//------------------------------------------------------------------
// Zielmaschine..: PC
// Betriebssystem: Windows 7 mit .NET 4.5
// Werkzeuge.....: Visual Studio 2013
// Autor.........: Martin Korneffel (mko)
// Version 1.0...:
//
// </unit_environment>
//
//<unit_history>
//------------------------------------------------------------------
//
// Version.......: 1.1
// Autor.........: Martin Korneffel (mko)
// Datum.........:
// Änderungen....:
//
//</unit_history>
//</unit_header>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace mko.NaLisp.Control
{
/// <summary>
/// Hintereinanderschalten von Funktionen: f(a) | b | c => c(b(f(a)))
/// </summary>
public class Pipe : Core.NaLispNonTerminal
{
public Pipe(params Core.INaLisp[] Elements)
{
this.Elements = Elements;
}
public override Core.Inspector.ProtocolEntry Validate(Core.NaLispStack Stack, Core.Inspector.ProtocolEntry[] ElemValidationResult)
{
if (Stack.ParentIs(typeof(Pipe)))
{
if (Elements.Length < 1)
return new Core.Inspector.ProtocolEntry(this, false, SubTreeValid(ElemValidationResult), null, "Pipe- Operator innerhalb eines Pipe- Operators muss mindestens 1 Argument haben");
if (!(Elements.All(e => e is Core.NaLispNonTerminal)))
return new Core.Inspector.ProtocolEntry(this, false, SubTreeValid(ElemValidationResult), ElemValidationResult.Last().TypeOfEvaluated, "Pipe- Operator innerhalb eines Pipe- Operators darf nur aus NaLispNonTerminal Elementes bestehen.");
}
else
{
if (Elements.Length < 2)
return new Core.Inspector.ProtocolEntry(this, false, SubTreeValid(ElemValidationResult), null, "Pipe- Operator muss mindestens 2 Argumente haben");
if (!(Elements.Skip(1).All(e => e is Core.NaLispNonTerminal)))
return new Core.Inspector.ProtocolEntry(this, false, SubTreeValid(ElemValidationResult), ElemValidationResult.Last().TypeOfEvaluated, "Pipe- Operator darf bis auf das Erste nur aus NaLispNonTerminal Elemente bestehen.");
}
return new Core.Inspector.ProtocolEntry(this, true, SubTreeValid(ElemValidationResult), ElemValidationResult.Last().TypeOfEvaluated, ToString());
}
/// <summary>
/// Wandelt einen Pipe- Term f(a) | g um in g(f(a), ...)
/// </summary>
/// <returns></returns>
public Core.NaLispNonTerminal Transform()
{
var f = Elements[0];
foreach (Core.NaLispNonTerminal g in Elements.Skip(1))
{
// f(a) | g -> g(f(a), ...)
// Nur Kopfinformation clonen
var gf = (Core.NaLispNonTerminal)g.Clone(false);
// Elementliste aus f und der Elementliste von g zusammensetzen
gf.Elements = (new Core.INaLisp[] { f }).Concat(g.Elements).ToArray();
f = gf;
}
return (Core.NaLispNonTerminal)f;
}
public override Core.INaLisp Eval(Core.INaLisp[] EvaluatedElements, Core.NaLispStack StackInstance, bool DebugOn)
{
throw new NotImplementedException();
}
protected override Core.INaLisp Create(Core.INaLisp[] Elements)
{
return new Pipe(Elements);
}
//public override Core.NaLisp Clone(bool deep)
//{
// if (deep)
// return new Pipe(Elements.Select(r => r.Clone()).ToArray());
// else
// return new Pipe(Elements);
//}
}
}
| 36.672414 | 255 | 0.550071 | [
"MIT"
] | mk-prg-net/mk-prg-net.lib | mko.NaLisp/Control/Pipe.cs | 4,257 | C# |
using Harmonic.Networking.Flv;
using Harmonic.Networking.Rtmp;
using Harmonic.Networking.WebSocket;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Threading.Tasks;
namespace Harmonic.Controllers
{
public abstract class WebSocketController
{
public string StreamName { get; internal set; }
public NameValueCollection Query { get; internal set; }
public WebSocketSession Session { get; internal set; }
private FlvMuxer _flvMuxer = null;
private FlvDemuxer _flvDemuxer = null;
public FlvMuxer FlvMuxer
{
get
{
if (_flvMuxer == null)
{
_flvMuxer = new FlvMuxer();
}
return _flvMuxer;
}
}
public FlvDemuxer FlvDemuxer
{
get
{
if (_flvDemuxer == null)
{
_flvDemuxer = new FlvDemuxer(Session.Options.MessageFactories);
}
return _flvDemuxer;
}
}
public abstract Task OnConnect();
public abstract void OnMessage(string msg);
}
}
| 26.617021 | 83 | 0.561151 | [
"MIT"
] | CoreDX9/Harmonic | Harmonic/Controllers/WebSocketController.cs | 1,253 | C# |
using System.Collections.Generic;
using System.Text;
using Torch.API;
using Torch.API.Managers;
using Torch.API.Plugins;
namespace Torch.Commands
{
public class ConsoleCommandContext : CommandContext
{
public List<TorchChatMessage> Responses = new List<TorchChatMessage>();
private bool _flag;
/// <inheritdoc />
public ConsoleCommandContext(ITorchBase torch, ITorchPlugin plugin, ulong steamIdSender, string rawArgs = null, List<string> args = null)
: base(torch, plugin, steamIdSender, rawArgs, args) { }
/// <inheritdoc />
public override void Respond(string message, string sender = null, string font = null)
{
if (sender == "Server")
{
sender = null;
font = null;
}
Responses.Add(new TorchChatMessage(sender ?? TorchBase.Instance.Config.ChatName, message, font ?? TorchBase.Instance.Config.ChatColor));
}
}
} | 33.533333 | 148 | 0.619284 | [
"Apache-2.0"
] | biscuitWizard/Torch | Torch/Commands/ConsoleCommandContext.cs | 1,006 | C# |
using D2SLib.IO;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace D2SLib.Model.Save
{
public class QuestsSection
{
//0x014b [unk = 0x1, 0x0, 0x0, 0x0]
public UInt32? Magic { get; set; }
//0x014f [quests header identifier = 0x57, 0x6f, 0x6f, 0x21 "Woo!"]
public UInt32? Header { get; set; }
//0x0153 [version = 0x6, 0x0, 0x0, 0x0]
public UInt32? Version { get; set; }
//0x0153 [quests header length = 0x2a, 0x1]
public UInt16? Length { get; set; }
public QuestsDifficulty Normal { get; set; }
public QuestsDifficulty Nightmare { get; set; }
public QuestsDifficulty Hell { get; set; }
public static QuestsSection Read(byte[] bytes)
{
QuestsSection questSection = new QuestsSection();
using (BitReader reader = new BitReader(bytes))
{
questSection.Magic = reader.ReadUInt32();
questSection.Header = reader.ReadUInt32();
questSection.Version = reader.ReadUInt32();
questSection.Length = reader.ReadUInt16();
var skippedProperties = new string[]{ "Magic", "Header", "Version", "Length" };
foreach (var property in typeof(QuestsSection).GetProperties())
{
if (skippedProperties.Contains(property.Name)) continue;
property.SetValue(questSection, QuestsDifficulty.Read(reader.ReadBytes(96)));
}
return questSection;
}
}
public static byte[] Write(QuestsSection questSection)
{
using (BitWriter writer = new BitWriter())
{
writer.WriteUInt32(questSection.Magic ?? 0x1);
writer.WriteUInt32(questSection.Header ?? 0x216F6F57);
writer.WriteUInt32(questSection.Version ?? 0x6);
writer.WriteUInt16(questSection.Length ?? (UInt16)0x12A);
var skippedProperties = new string[] { "Magic", "Header", "Version", "Length" };
foreach (var property in typeof(QuestsSection).GetProperties())
{
if (skippedProperties.Contains(property.Name)) continue;
QuestsDifficulty questsDifficulty = (QuestsDifficulty)property.GetValue(questSection);
writer.WriteBytes(QuestsDifficulty.Write(questsDifficulty));
}
return writer.ToArray();
}
}
}
public class QuestsDifficulty
{
public ActIQuests ActI { get; set; }
public ActIIQuests ActII { get; set; }
public ActIIIQuests ActIII { get; set; }
public ActIVQuests ActIV { get; set; }
public ActVQuests ActV { get; set; }
public static QuestsDifficulty Read(byte[] bytes)
{
QuestsDifficulty questsDifficulty = new QuestsDifficulty();
using (BitReader reader = new BitReader(bytes))
{
Type questsDifficultyType = typeof(QuestsDifficulty);
foreach (var questsDifficultyProperty in questsDifficultyType.GetProperties())
{
Type type = questsDifficultyProperty.PropertyType;
var quests = Activator.CreateInstance(type);
foreach (var property in type.GetProperties())
{
Quest quest = new Quest();
property.SetValue(quests, Quest.Read(reader.ReadBytes(2)));
}
questsDifficultyProperty.SetValue(questsDifficulty, quests);
}
return questsDifficulty;
}
}
public static byte[] Write(QuestsDifficulty questsDifficulty)
{
using (BitWriter writer = new BitWriter())
{
Type questsDifficultyType = typeof(QuestsDifficulty);
foreach (var questsDifficultyProperty in questsDifficultyType.GetProperties())
{
Type type = questsDifficultyProperty.PropertyType;
var quests = questsDifficultyProperty.GetValue(questsDifficulty);
foreach (var property in type.GetProperties())
{
Quest quest = (Quest)property.GetValue(quests);
writer.WriteBytes(Quest.Write(quest));
}
}
//Debug.Assert(writer.Position == 96 * 8);
return writer.ToArray();
}
}
}
public class Quest
{
public bool RewardGranted { get; set; }
public bool RewardPending { get; set; }
public bool Started { get; set; }
public bool LeftTown { get; set; }
public bool EnterArea { get; set; }
public bool Custom1 { get; set; }
public bool Custom2 { get; set; }
public bool Custom3 { get; set; }
public bool Custom4 { get; set; }
public bool Custom5 { get; set; }
public bool Custom6 { get; set; }
public bool Custom7 { get; set; }
public bool QuestLog { get; set; }
public bool PrimaryGoalAchieved { get; set; }
public bool CompletedNow { get; set; }
public bool CompletedBefore { get; set; }
public static Quest Read(byte[] bytes)
{
BitArray bits = new BitArray(bytes);
Quest quest = new Quest();
int i = 0;
foreach (var questProperty in typeof(Quest).GetProperties())
{
questProperty.SetValue(quest, bits[i++]);
}
return quest;
}
public static byte[] Write(Quest quest)
{
using (BitWriter writer = new BitWriter())
{
UInt16 flags = 0x0;
UInt16 i = 1;
foreach (var questProperty in typeof(Quest).GetProperties())
{
if((bool)questProperty.GetValue(quest))
{
flags |= i;
}
i <<= 1;
}
writer.WriteUInt16(flags);
return writer.ToArray();
}
}
}
public class ActIQuests
{
public Quest Introduction { get; set; }
public Quest DenOfEvil { get; set; }
public Quest SistersBurialGrounds { get; set; }
public Quest ToolsOfTheTrade { get; set; }
public Quest TheSearchForCain { get; set; }
public Quest TheForgottenTower { get; set; }
public Quest SistersToTheSlaughter { get; set; }
public Quest Completion { get; set; }
}
public class ActIIQuests
{
public Quest Introduction { get; set; }
public Quest RadamentsLair { get; set; }
public Quest TheHoradricStaff { get; set; }
public Quest TaintedSun { get; set; }
public Quest ArcaneSanctuary { get; set; }
public Quest TheSummoner { get; set; }
public Quest TheSevenTombs { get; set; }
public Quest Completion { get; set; }
}
public class ActIIIQuests
{
public Quest Introduction { get; set; }
public Quest LamEsensTome { get; set; }
public Quest KhalimsWill { get; set; }
public Quest BladeOfTheOldReligion { get; set; }
public Quest TheGoldenBird { get; set; }
public Quest TheBlackenedTemple { get; set; }
public Quest TheGuardian { get; set; }
public Quest Completion { get; set; }
}
public class ActIVQuests
{
public Quest Introduction { get; set; }
public Quest TheFallenAngel { get; set; }
public Quest TerrorsEnd { get; set; }
public Quest Hellforge { get; set; }
public Quest Completion { get; set; }
//3 shorts at the end of ActIV completion. presumably for extra quests never used.
public Quest Extra1 { get; set; }
public Quest Extra2 { get; set; }
public Quest Extra3 { get; set; }
}
public class ActVQuests
{
public Quest Introduction { get; set; }
//2 shorts after ActV introduction. presumably for extra quests never used.
public Quest Extra1 { get; set; }
public Quest Extra2 { get; set; }
public Quest SiegeOnHarrogath { get; set; }
public Quest RescueOnMountArreat { get; set; }
public Quest PrisonOfIce { get; set; }
public Quest BetrayalOfHarrogath { get; set; }
public Quest RiteOfPassage { get; set; }
public Quest EveOfDestruction { get; set; }
public Quest Completion { get; set; }
//6 shorts after ActV completion. presumably for extra quests never used.
public Quest Extra3 { get; set; }
public Quest Extra4 { get; set; }
public Quest Extra5 { get; set; }
public Quest Extra6 { get; set; }
public Quest Extra7 { get; set; }
public Quest Extra8 { get; set; }
}
}
| 39.227273 | 107 | 0.545981 | [
"MIT"
] | BetweenWalls/PD2-Converter | src/Model/Save/Quests.cs | 9,254 | C# |
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated code. DO NOT EDIT!
using gax = Google.Api.Gax;
using gcgv = Google.Cloud.GkeHub.V1Beta1;
using sys = System;
namespace Google.Cloud.GkeHub.V1Beta1
{
/// <summary>Resource name for the <c>Membership</c> resource.</summary>
public sealed partial class MembershipName : gax::IResourceName, sys::IEquatable<MembershipName>
{
/// <summary>The possible contents of <see cref="MembershipName"/>.</summary>
public enum ResourceNameType
{
/// <summary>An unparsed resource name.</summary>
Unparsed = 0,
/// <summary>
/// A resource name with pattern <c>projects/{project}/locations/{location}/memberships/{membership}</c>.
/// </summary>
ProjectLocationMembership = 1,
}
private static gax::PathTemplate s_projectLocationMembership = new gax::PathTemplate("projects/{project}/locations/{location}/memberships/{membership}");
/// <summary>Creates a <see cref="MembershipName"/> containing an unparsed resource name.</summary>
/// <param name="unparsedResourceName">The unparsed resource name. Must not be <c>null</c>.</param>
/// <returns>
/// A new instance of <see cref="MembershipName"/> containing the provided
/// <paramref name="unparsedResourceName"/>.
/// </returns>
public static MembershipName FromUnparsed(gax::UnparsedResourceName unparsedResourceName) =>
new MembershipName(ResourceNameType.Unparsed, gax::GaxPreconditions.CheckNotNull(unparsedResourceName, nameof(unparsedResourceName)));
/// <summary>
/// Creates a <see cref="MembershipName"/> with the pattern
/// <c>projects/{project}/locations/{location}/memberships/{membership}</c>.
/// </summary>
/// <param name="projectId">The <c>Project</c> ID. Must not be <c>null</c> or empty.</param>
/// <param name="locationId">The <c>Location</c> ID. Must not be <c>null</c> or empty.</param>
/// <param name="membershipId">The <c>Membership</c> ID. Must not be <c>null</c> or empty.</param>
/// <returns>A new instance of <see cref="MembershipName"/> constructed from the provided ids.</returns>
public static MembershipName FromProjectLocationMembership(string projectId, string locationId, string membershipId) =>
new MembershipName(ResourceNameType.ProjectLocationMembership, projectId: gax::GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId)), locationId: gax::GaxPreconditions.CheckNotNullOrEmpty(locationId, nameof(locationId)), membershipId: gax::GaxPreconditions.CheckNotNullOrEmpty(membershipId, nameof(membershipId)));
/// <summary>
/// Formats the IDs into the string representation of this <see cref="MembershipName"/> with pattern
/// <c>projects/{project}/locations/{location}/memberships/{membership}</c>.
/// </summary>
/// <param name="projectId">The <c>Project</c> ID. Must not be <c>null</c> or empty.</param>
/// <param name="locationId">The <c>Location</c> ID. Must not be <c>null</c> or empty.</param>
/// <param name="membershipId">The <c>Membership</c> ID. Must not be <c>null</c> or empty.</param>
/// <returns>
/// The string representation of this <see cref="MembershipName"/> with pattern
/// <c>projects/{project}/locations/{location}/memberships/{membership}</c>.
/// </returns>
public static string Format(string projectId, string locationId, string membershipId) =>
FormatProjectLocationMembership(projectId, locationId, membershipId);
/// <summary>
/// Formats the IDs into the string representation of this <see cref="MembershipName"/> with pattern
/// <c>projects/{project}/locations/{location}/memberships/{membership}</c>.
/// </summary>
/// <param name="projectId">The <c>Project</c> ID. Must not be <c>null</c> or empty.</param>
/// <param name="locationId">The <c>Location</c> ID. Must not be <c>null</c> or empty.</param>
/// <param name="membershipId">The <c>Membership</c> ID. Must not be <c>null</c> or empty.</param>
/// <returns>
/// The string representation of this <see cref="MembershipName"/> with pattern
/// <c>projects/{project}/locations/{location}/memberships/{membership}</c>.
/// </returns>
public static string FormatProjectLocationMembership(string projectId, string locationId, string membershipId) =>
s_projectLocationMembership.Expand(gax::GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId)), gax::GaxPreconditions.CheckNotNullOrEmpty(locationId, nameof(locationId)), gax::GaxPreconditions.CheckNotNullOrEmpty(membershipId, nameof(membershipId)));
/// <summary>Parses the given resource name string into a new <see cref="MembershipName"/> instance.</summary>
/// <remarks>
/// To parse successfully, the resource name must be formatted as one of the following:
/// <list type="bullet">
/// <item>
/// <description><c>projects/{project}/locations/{location}/memberships/{membership}</c></description>
/// </item>
/// </list>
/// </remarks>
/// <param name="membershipName">The resource name in string form. Must not be <c>null</c>.</param>
/// <returns>The parsed <see cref="MembershipName"/> if successful.</returns>
public static MembershipName Parse(string membershipName) => Parse(membershipName, false);
/// <summary>
/// Parses the given resource name string into a new <see cref="MembershipName"/> instance; optionally allowing
/// an unparseable resource name.
/// </summary>
/// <remarks>
/// To parse successfully, the resource name must be formatted as one of the following:
/// <list type="bullet">
/// <item>
/// <description><c>projects/{project}/locations/{location}/memberships/{membership}</c></description>
/// </item>
/// </list>
/// Or may be in any format if <paramref name="allowUnparsed"/> is <c>true</c>.
/// </remarks>
/// <param name="membershipName">The resource name in string form. Must not be <c>null</c>.</param>
/// <param name="allowUnparsed">
/// If <c>true</c> will successfully store an unparseable resource name into the <see cref="UnparsedResource"/>
/// property; otherwise will throw an <see cref="sys::ArgumentException"/> if an unparseable resource name is
/// specified.
/// </param>
/// <returns>The parsed <see cref="MembershipName"/> if successful.</returns>
public static MembershipName Parse(string membershipName, bool allowUnparsed) =>
TryParse(membershipName, allowUnparsed, out MembershipName result) ? result : throw new sys::ArgumentException("The given resource-name matches no pattern.");
/// <summary>
/// Tries to parse the given resource name string into a new <see cref="MembershipName"/> instance.
/// </summary>
/// <remarks>
/// To parse successfully, the resource name must be formatted as one of the following:
/// <list type="bullet">
/// <item>
/// <description><c>projects/{project}/locations/{location}/memberships/{membership}</c></description>
/// </item>
/// </list>
/// </remarks>
/// <param name="membershipName">The resource name in string form. Must not be <c>null</c>.</param>
/// <param name="result">
/// When this method returns, the parsed <see cref="MembershipName"/>, or <c>null</c> if parsing failed.
/// </param>
/// <returns><c>true</c> if the name was parsed successfully; <c>false</c> otherwise.</returns>
public static bool TryParse(string membershipName, out MembershipName result) =>
TryParse(membershipName, false, out result);
/// <summary>
/// Tries to parse the given resource name string into a new <see cref="MembershipName"/> instance; optionally
/// allowing an unparseable resource name.
/// </summary>
/// <remarks>
/// To parse successfully, the resource name must be formatted as one of the following:
/// <list type="bullet">
/// <item>
/// <description><c>projects/{project}/locations/{location}/memberships/{membership}</c></description>
/// </item>
/// </list>
/// Or may be in any format if <paramref name="allowUnparsed"/> is <c>true</c>.
/// </remarks>
/// <param name="membershipName">The resource name in string form. Must not be <c>null</c>.</param>
/// <param name="allowUnparsed">
/// If <c>true</c> will successfully store an unparseable resource name into the <see cref="UnparsedResource"/>
/// property; otherwise will throw an <see cref="sys::ArgumentException"/> if an unparseable resource name is
/// specified.
/// </param>
/// <param name="result">
/// When this method returns, the parsed <see cref="MembershipName"/>, or <c>null</c> if parsing failed.
/// </param>
/// <returns><c>true</c> if the name was parsed successfully; <c>false</c> otherwise.</returns>
public static bool TryParse(string membershipName, bool allowUnparsed, out MembershipName result)
{
gax::GaxPreconditions.CheckNotNull(membershipName, nameof(membershipName));
gax::TemplatedResourceName resourceName;
if (s_projectLocationMembership.TryParseName(membershipName, out resourceName))
{
result = FromProjectLocationMembership(resourceName[0], resourceName[1], resourceName[2]);
return true;
}
if (allowUnparsed)
{
if (gax::UnparsedResourceName.TryParse(membershipName, out gax::UnparsedResourceName unparsedResourceName))
{
result = FromUnparsed(unparsedResourceName);
return true;
}
}
result = null;
return false;
}
private MembershipName(ResourceNameType type, gax::UnparsedResourceName unparsedResourceName = null, string locationId = null, string membershipId = null, string projectId = null)
{
Type = type;
UnparsedResource = unparsedResourceName;
LocationId = locationId;
MembershipId = membershipId;
ProjectId = projectId;
}
/// <summary>
/// Constructs a new instance of a <see cref="MembershipName"/> class from the component parts of pattern
/// <c>projects/{project}/locations/{location}/memberships/{membership}</c>
/// </summary>
/// <param name="projectId">The <c>Project</c> ID. Must not be <c>null</c> or empty.</param>
/// <param name="locationId">The <c>Location</c> ID. Must not be <c>null</c> or empty.</param>
/// <param name="membershipId">The <c>Membership</c> ID. Must not be <c>null</c> or empty.</param>
public MembershipName(string projectId, string locationId, string membershipId) : this(ResourceNameType.ProjectLocationMembership, projectId: gax::GaxPreconditions.CheckNotNullOrEmpty(projectId, nameof(projectId)), locationId: gax::GaxPreconditions.CheckNotNullOrEmpty(locationId, nameof(locationId)), membershipId: gax::GaxPreconditions.CheckNotNullOrEmpty(membershipId, nameof(membershipId)))
{
}
/// <summary>The <see cref="ResourceNameType"/> of the contained resource name.</summary>
public ResourceNameType Type { get; }
/// <summary>
/// The contained <see cref="gax::UnparsedResourceName"/>. Only non-<c>null</c> if this instance contains an
/// unparsed resource name.
/// </summary>
public gax::UnparsedResourceName UnparsedResource { get; }
/// <summary>
/// The <c>Location</c> ID. Will not be <c>null</c>, unless this instance contains an unparsed resource name.
/// </summary>
public string LocationId { get; }
/// <summary>
/// The <c>Membership</c> ID. Will not be <c>null</c>, unless this instance contains an unparsed resource name.
/// </summary>
public string MembershipId { get; }
/// <summary>
/// The <c>Project</c> ID. Will not be <c>null</c>, unless this instance contains an unparsed resource name.
/// </summary>
public string ProjectId { get; }
/// <summary>Whether this instance contains a resource name with a known pattern.</summary>
public bool IsKnownPattern => Type != ResourceNameType.Unparsed;
/// <summary>The string representation of the resource name.</summary>
/// <returns>The string representation of the resource name.</returns>
public override string ToString()
{
switch (Type)
{
case ResourceNameType.Unparsed: return UnparsedResource.ToString();
case ResourceNameType.ProjectLocationMembership: return s_projectLocationMembership.Expand(ProjectId, LocationId, MembershipId);
default: throw new sys::InvalidOperationException("Unrecognized resource-type.");
}
}
/// <summary>Returns a hash code for this resource name.</summary>
public override int GetHashCode() => ToString().GetHashCode();
/// <inheritdoc/>
public override bool Equals(object obj) => Equals(obj as MembershipName);
/// <inheritdoc/>
public bool Equals(MembershipName other) => ToString() == other?.ToString();
/// <inheritdoc/>
public static bool operator ==(MembershipName a, MembershipName b) => ReferenceEquals(a, b) || (a?.Equals(b) ?? false);
/// <inheritdoc/>
public static bool operator !=(MembershipName a, MembershipName b) => !(a == b);
}
public partial class Membership
{
/// <summary>
/// <see cref="gcgv::MembershipName"/>-typed view over the <see cref="Name"/> resource name property.
/// </summary>
public gcgv::MembershipName MembershipName
{
get => string.IsNullOrEmpty(Name) ? null : gcgv::MembershipName.Parse(Name, allowUnparsed: true);
set => Name = value?.ToString() ?? "";
}
}
}
| 55.135036 | 402 | 0.637387 | [
"Apache-2.0"
] | AlexandrTrf/google-cloud-dotnet | apis/Google.Cloud.GkeHub.V1Beta1/Google.Cloud.GkeHub.V1Beta1/MembershipResourceNames.g.cs | 15,107 | C# |
using Core.Interfaces.Repositories;
using System;
using System.Collections.Generic;
using System.Text;
namespace Core.Interfaces.Services
{
public interface IProcessService
{
}
}
| 14.384615 | 36 | 0.786096 | [
"MIT"
] | yasharvc/FLower | src/business/Core/Interfaces/Services/IProcessService.cs | 189 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class GameStarted : MonoBehaviour
{
public int currentMap = 1;
Sprite map1Logo;
Sprite map2Logo;
// Start is called before the first frame update
void Start()
{
map1Logo = Resources.Load<Sprite>("map1");
map2Logo = Resources.Load<Sprite>("map2");
}
// Update is called once per frame
void Update()
{
GameObject levelName = GameObject.Find("LevelName");
GameObject levelStatus = GameObject.Find("LevelStatus");
GameObject mapImage = GameObject.Find("MapImage");
DontDestroy test = gameObject.GetComponent<DontDestroy>();
if (currentMap == 1){
levelName.GetComponent<TMPro.TextMeshProUGUI>().text = "1. Dusk Castle";
mapImage.GetComponent<Image>().sprite = map1Logo;
}else if (currentMap == 2){
levelName.GetComponent<TMPro.TextMeshProUGUI>().text = "2. Skyward Castle";
mapImage.GetComponent<Image>().sprite = map2Logo;
}
if (test.mapStatus[currentMap - 1]){
levelStatus.GetComponent<TMPro.TextMeshProUGUI>().text = "Chapter Cleared";
}else{
levelStatus.GetComponent<TMPro.TextMeshProUGUI>().text = "";
}
}
public void NextMap () {
if (currentMap == 1) {
currentMap = 2;
}
}
public void PrevMap () {
if (currentMap == 2) {
currentMap = 1;
}
}
public void PlayRound () {
StaticClass.scene = currentMap;
SceneManager.LoadScene("LoadScreen");
}
public void QuitGame () {
Application.Quit();
}
}
| 22.320988 | 87 | 0.59292 | [
"MIT"
] | sagar5534/Ilsa-Journey | Ilsa's Journey/Assets/GameStarted.cs | 1,810 | C# |
namespace diyou计算器
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.zuz = new System.Windows.Forms.Button();
this.sz = new System.Windows.Forms.GroupBox();
this.tiuge = new System.Windows.Forms.Button();
this.dian = new System.Windows.Forms.Button();
this.to2 = new System.Windows.Forms.RadioButton();
this.to1 = new System.Windows.Forms.RadioButton();
this.s0 = new System.Windows.Forms.Button();
this.s9 = new System.Windows.Forms.Button();
this.s8 = new System.Windows.Forms.Button();
this.s7 = new System.Windows.Forms.Button();
this.s6 = new System.Windows.Forms.Button();
this.s5 = new System.Windows.Forms.Button();
this.s4 = new System.Windows.Forms.Button();
this.s3 = new System.Windows.Forms.Button();
this.s2 = new System.Windows.Forms.Button();
this.s1 = new System.Windows.Forms.Button();
this.jsf = new System.Windows.Forms.GroupBox();
this.ayh = new System.Windows.Forms.Button();
this.mod = new System.Windows.Forms.Button();
this.yu = new System.Windows.Forms.Button();
this.chu = new System.Windows.Forms.Button();
this.cheng = new System.Windows.Forms.Button();
this.jian = new System.Windows.Forms.Button();
this.jia = new System.Windows.Forms.Button();
this.su1 = new System.Windows.Forms.TextBox();
this.su2 = new System.Windows.Forms.TextBox();
this.w1 = new System.Windows.Forms.Label();
this.w2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.wd = new System.Windows.Forms.Label();
this.jg = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.lj1 = new System.Windows.Forms.LinkLabel();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.sz.SuspendLayout();
this.jsf.SuspendLayout();
this.SuspendLayout();
//
// zuz
//
this.zuz.Location = new System.Drawing.Point(16, 15);
this.zuz.Margin = new System.Windows.Forms.Padding(4);
this.zuz.Name = "zuz";
this.zuz.Size = new System.Drawing.Size(100, 29);
this.zuz.TabIndex = 0;
this.zuz.Text = "制作者";
this.zuz.UseVisualStyleBackColor = true;
this.zuz.Click += new System.EventHandler(this.zuz_Click);
//
// sz
//
this.sz.Controls.Add(this.tiuge);
this.sz.Controls.Add(this.dian);
this.sz.Controls.Add(this.to2);
this.sz.Controls.Add(this.to1);
this.sz.Controls.Add(this.s0);
this.sz.Controls.Add(this.s9);
this.sz.Controls.Add(this.s8);
this.sz.Controls.Add(this.s7);
this.sz.Controls.Add(this.s6);
this.sz.Controls.Add(this.s5);
this.sz.Controls.Add(this.s4);
this.sz.Controls.Add(this.s3);
this.sz.Controls.Add(this.s2);
this.sz.Controls.Add(this.s1);
this.sz.Location = new System.Drawing.Point(16, 181);
this.sz.Margin = new System.Windows.Forms.Padding(4);
this.sz.Name = "sz";
this.sz.Padding = new System.Windows.Forms.Padding(4);
this.sz.Size = new System.Drawing.Size(345, 169);
this.sz.TabIndex = 2;
this.sz.TabStop = false;
this.sz.Text = "数字输入";
//
// tiuge
//
this.tiuge.Location = new System.Drawing.Point(309, 32);
this.tiuge.Name = "tiuge";
this.tiuge.Size = new System.Drawing.Size(29, 23);
this.tiuge.TabIndex = 14;
this.tiuge.Text = "退";
this.tiuge.UseVisualStyleBackColor = true;
this.tiuge.Click += new System.EventHandler(this.tiuge_Click);
//
// dian
//
this.dian.Location = new System.Drawing.Point(309, 86);
this.dian.Name = "dian";
this.dian.Size = new System.Drawing.Size(29, 23);
this.dian.TabIndex = 13;
this.dian.Text = ".";
this.dian.UseVisualStyleBackColor = true;
this.dian.Click += new System.EventHandler(this.dian_Click);
//
// to2
//
this.to2.AutoSize = true;
this.to2.Location = new System.Drawing.Point(235, 141);
this.to2.Margin = new System.Windows.Forms.Padding(4);
this.to2.Name = "to2";
this.to2.Size = new System.Drawing.Size(96, 19);
this.to2.TabIndex = 12;
this.to2.Text = "输入数字2";
this.to2.UseVisualStyleBackColor = true;
//
// to1
//
this.to1.AutoSize = true;
this.to1.Checked = true;
this.to1.Location = new System.Drawing.Point(9, 141);
this.to1.Margin = new System.Windows.Forms.Padding(4);
this.to1.Name = "to1";
this.to1.Size = new System.Drawing.Size(96, 19);
this.to1.TabIndex = 11;
this.to1.TabStop = true;
this.to1.Text = "输入数字1";
this.to1.UseVisualStyleBackColor = true;
//
// s0
//
this.s0.Location = new System.Drawing.Point(263, 80);
this.s0.Margin = new System.Windows.Forms.Padding(4);
this.s0.Name = "s0";
this.s0.Size = new System.Drawing.Size(31, 29);
this.s0.TabIndex = 10;
this.s0.Text = "0";
this.s0.UseVisualStyleBackColor = true;
this.s0.Click += new System.EventHandler(this.s0_Click);
//
// s9
//
this.s9.Location = new System.Drawing.Point(196, 80);
this.s9.Margin = new System.Windows.Forms.Padding(4);
this.s9.Name = "s9";
this.s9.Size = new System.Drawing.Size(31, 29);
this.s9.TabIndex = 9;
this.s9.Text = "9";
this.s9.UseVisualStyleBackColor = true;
this.s9.Click += new System.EventHandler(this.s9_Click);
//
// s8
//
this.s8.Location = new System.Drawing.Point(132, 80);
this.s8.Margin = new System.Windows.Forms.Padding(4);
this.s8.Name = "s8";
this.s8.Size = new System.Drawing.Size(31, 29);
this.s8.TabIndex = 8;
this.s8.Text = "8";
this.s8.UseVisualStyleBackColor = true;
this.s8.Click += new System.EventHandler(this.s8_Click);
//
// s7
//
this.s7.Location = new System.Drawing.Point(69, 80);
this.s7.Margin = new System.Windows.Forms.Padding(4);
this.s7.Name = "s7";
this.s7.Size = new System.Drawing.Size(31, 29);
this.s7.TabIndex = 7;
this.s7.Text = "7";
this.s7.UseVisualStyleBackColor = true;
this.s7.Click += new System.EventHandler(this.s7_Click);
//
// s6
//
this.s6.Location = new System.Drawing.Point(9, 80);
this.s6.Margin = new System.Windows.Forms.Padding(4);
this.s6.Name = "s6";
this.s6.Size = new System.Drawing.Size(31, 29);
this.s6.TabIndex = 6;
this.s6.Text = "6";
this.s6.UseVisualStyleBackColor = true;
this.s6.Click += new System.EventHandler(this.s6_Click);
//
// s5
//
this.s5.Location = new System.Drawing.Point(263, 26);
this.s5.Margin = new System.Windows.Forms.Padding(4);
this.s5.Name = "s5";
this.s5.Size = new System.Drawing.Size(31, 29);
this.s5.TabIndex = 5;
this.s5.Text = "5";
this.s5.UseVisualStyleBackColor = true;
this.s5.Click += new System.EventHandler(this.s5_Click);
//
// s4
//
this.s4.Location = new System.Drawing.Point(196, 26);
this.s4.Margin = new System.Windows.Forms.Padding(4);
this.s4.Name = "s4";
this.s4.Size = new System.Drawing.Size(31, 29);
this.s4.TabIndex = 4;
this.s4.Text = "4";
this.s4.UseVisualStyleBackColor = true;
this.s4.Click += new System.EventHandler(this.s4_Click);
//
// s3
//
this.s3.Location = new System.Drawing.Point(132, 26);
this.s3.Margin = new System.Windows.Forms.Padding(4);
this.s3.Name = "s3";
this.s3.Size = new System.Drawing.Size(31, 29);
this.s3.TabIndex = 2;
this.s3.Text = "3";
this.s3.UseVisualStyleBackColor = true;
this.s3.Click += new System.EventHandler(this.s3_Click);
//
// s2
//
this.s2.Location = new System.Drawing.Point(69, 26);
this.s2.Margin = new System.Windows.Forms.Padding(4);
this.s2.Name = "s2";
this.s2.Size = new System.Drawing.Size(31, 29);
this.s2.TabIndex = 1;
this.s2.Text = "2";
this.s2.UseVisualStyleBackColor = true;
this.s2.Click += new System.EventHandler(this.s2_Click);
//
// s1
//
this.s1.Location = new System.Drawing.Point(9, 26);
this.s1.Margin = new System.Windows.Forms.Padding(4);
this.s1.Name = "s1";
this.s1.Size = new System.Drawing.Size(31, 29);
this.s1.TabIndex = 0;
this.s1.Text = "1";
this.s1.UseVisualStyleBackColor = true;
this.s1.Click += new System.EventHandler(this.s1_Click);
//
// jsf
//
this.jsf.Controls.Add(this.ayh);
this.jsf.Controls.Add(this.mod);
this.jsf.Controls.Add(this.yu);
this.jsf.Controls.Add(this.chu);
this.jsf.Controls.Add(this.cheng);
this.jsf.Controls.Add(this.jian);
this.jsf.Controls.Add(this.jia);
this.jsf.Location = new System.Drawing.Point(369, 181);
this.jsf.Margin = new System.Windows.Forms.Padding(4);
this.jsf.Name = "jsf";
this.jsf.Padding = new System.Windows.Forms.Padding(4);
this.jsf.Size = new System.Drawing.Size(267, 169);
this.jsf.TabIndex = 3;
this.jsf.TabStop = false;
this.jsf.Text = "运算符";
//
// ayh
//
this.ayh.Location = new System.Drawing.Point(235, 69);
this.ayh.Margin = new System.Windows.Forms.Padding(4);
this.ayh.Name = "ayh";
this.ayh.Size = new System.Drawing.Size(23, 24);
this.ayh.TabIndex = 6;
this.ayh.Text = "?";
this.ayh.UseVisualStyleBackColor = true;
this.ayh.Click += new System.EventHandler(this.ayh_Click);
//
// mod
//
this.mod.Location = new System.Drawing.Point(177, 80);
this.mod.Margin = new System.Windows.Forms.Padding(4);
this.mod.Name = "mod";
this.mod.Size = new System.Drawing.Size(59, 29);
this.mod.TabIndex = 5;
this.mod.Text = "异或";
this.mod.UseVisualStyleBackColor = true;
this.mod.Click += new System.EventHandler(this.mod_Click);
//
// yu
//
this.yu.Location = new System.Drawing.Point(88, 80);
this.yu.Margin = new System.Windows.Forms.Padding(4);
this.yu.Name = "yu";
this.yu.Size = new System.Drawing.Size(59, 29);
this.yu.TabIndex = 4;
this.yu.Text = "取余";
this.yu.UseVisualStyleBackColor = true;
this.yu.Click += new System.EventHandler(this.yu_Click);
//
// chu
//
this.chu.Location = new System.Drawing.Point(8, 80);
this.chu.Margin = new System.Windows.Forms.Padding(4);
this.chu.Name = "chu";
this.chu.Size = new System.Drawing.Size(59, 29);
this.chu.TabIndex = 3;
this.chu.Text = "/";
this.chu.UseVisualStyleBackColor = true;
this.chu.Click += new System.EventHandler(this.chu_Click);
//
// cheng
//
this.cheng.Location = new System.Drawing.Point(177, 25);
this.cheng.Margin = new System.Windows.Forms.Padding(4);
this.cheng.Name = "cheng";
this.cheng.Size = new System.Drawing.Size(59, 29);
this.cheng.TabIndex = 2;
this.cheng.Text = "*";
this.cheng.UseVisualStyleBackColor = true;
this.cheng.Click += new System.EventHandler(this.cheng_Click);
//
// jian
//
this.jian.Location = new System.Drawing.Point(88, 25);
this.jian.Margin = new System.Windows.Forms.Padding(4);
this.jian.Name = "jian";
this.jian.Size = new System.Drawing.Size(59, 29);
this.jian.TabIndex = 1;
this.jian.Text = "-";
this.jian.UseVisualStyleBackColor = true;
this.jian.Click += new System.EventHandler(this.jian_Click);
//
// jia
//
this.jia.Location = new System.Drawing.Point(8, 26);
this.jia.Margin = new System.Windows.Forms.Padding(4);
this.jia.Name = "jia";
this.jia.Size = new System.Drawing.Size(59, 29);
this.jia.TabIndex = 0;
this.jia.Text = "+";
this.jia.UseVisualStyleBackColor = true;
this.jia.Click += new System.EventHandler(this.jia_Click);
//
// su1
//
this.su1.AcceptsTab = true;
this.su1.AllowDrop = true;
this.su1.Location = new System.Drawing.Point(25, 109);
this.su1.Margin = new System.Windows.Forms.Padding(4);
this.su1.MaxLength = 100;
this.su1.Multiline = true;
this.su1.Name = "su1";
this.su1.ReadOnly = true;
this.su1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.su1.Size = new System.Drawing.Size(167, 25);
this.su1.TabIndex = 4;
this.su1.TabStop = false;
//
// su2
//
this.su2.AcceptsTab = true;
this.su2.AllowDrop = true;
this.su2.Location = new System.Drawing.Point(268, 109);
this.su2.Margin = new System.Windows.Forms.Padding(4);
this.su2.MaxLength = 100;
this.su2.Name = "su2";
this.su2.ReadOnly = true;
this.su2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.su2.Size = new System.Drawing.Size(167, 25);
this.su2.TabIndex = 5;
this.su2.TabStop = false;
//
// w1
//
this.w1.AutoSize = true;
this.w1.Location = new System.Drawing.Point(83, 82);
this.w1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.w1.Name = "w1";
this.w1.Size = new System.Drawing.Size(45, 15);
this.w1.TabIndex = 6;
this.w1.Text = "数字1";
//
// w2
//
this.w2.AutoSize = true;
this.w2.Location = new System.Drawing.Point(332, 82);
this.w2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.w2.Name = "w2";
this.w2.Size = new System.Drawing.Size(45, 15);
this.w2.TabIndex = 7;
this.w2.Text = "数字2";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(444, 112);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(15, 15);
this.label1.TabIndex = 8;
this.label1.Text = "=";
//
// wd
//
this.wd.AutoSize = true;
this.wd.Location = new System.Drawing.Point(201, 112);
this.wd.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.wd.Name = "wd";
this.wd.Size = new System.Drawing.Size(15, 15);
this.wd.TabIndex = 9;
this.wd.Text = "+";
//
// jg
//
this.jg.AutoSize = true;
this.jg.Location = new System.Drawing.Point(484, 112);
this.jg.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.jg.Name = "jg";
this.jg.Size = new System.Drawing.Size(15, 15);
this.jg.TabIndex = 10;
this.jg.Text = "0";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(13, 400);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(82, 15);
this.label4.TabIndex = 11;
this.label4.Text = "开源地址:";
//
// lj1
//
this.lj1.AutoSize = true;
this.lj1.Cursor = System.Windows.Forms.Cursors.Hand;
this.lj1.Location = new System.Drawing.Point(83, 400);
this.lj1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lj1.Name = "lj1";
this.lj1.Size = new System.Drawing.Size(383, 15);
this.lj1.TabIndex = 12;
this.lj1.TabStop = true;
this.lj1.Text = "https://github.com/diyou-diyou/diyou-Calculator";
this.lj1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lj1_LinkClicked);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(237, 374);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(187, 15);
this.label2.TabIndex = 13;
this.label2.Text = "异或计算会抛弃小数部分!";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 440);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(145, 15);
this.label3.TabIndex = 14;
this.label3.Text = "diyou计算器 最终版";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(657, 466);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.lj1);
this.Controls.Add(this.label4);
this.Controls.Add(this.jg);
this.Controls.Add(this.wd);
this.Controls.Add(this.label1);
this.Controls.Add(this.w2);
this.Controls.Add(this.w1);
this.Controls.Add(this.su2);
this.Controls.Add(this.su1);
this.Controls.Add(this.jsf);
this.Controls.Add(this.sz);
this.Controls.Add(this.zuz);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.ImeMode = System.Windows.Forms.ImeMode.Disable;
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "Form1";
this.Text = "diyou计算器";
this.sz.ResumeLayout(false);
this.sz.PerformLayout();
this.jsf.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button zuz;
private System.Windows.Forms.GroupBox sz;
private System.Windows.Forms.Button s1;
private System.Windows.Forms.Button s2;
private System.Windows.Forms.Button s3;
private System.Windows.Forms.Button s5;
private System.Windows.Forms.Button s4;
private System.Windows.Forms.Button s0;
private System.Windows.Forms.Button s9;
private System.Windows.Forms.Button s8;
private System.Windows.Forms.Button s7;
private System.Windows.Forms.Button s6;
private System.Windows.Forms.GroupBox jsf;
private System.Windows.Forms.Button jia;
private System.Windows.Forms.Button jian;
private System.Windows.Forms.Button cheng;
private System.Windows.Forms.Button mod;
private System.Windows.Forms.Button yu;
private System.Windows.Forms.Button chu;
private System.Windows.Forms.TextBox su1;
private System.Windows.Forms.TextBox su2;
private System.Windows.Forms.Label w1;
private System.Windows.Forms.Label w2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label wd;
private System.Windows.Forms.Label jg;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.LinkLabel lj1;
private System.Windows.Forms.RadioButton to2;
private System.Windows.Forms.RadioButton to1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button ayh;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button tiuge;
private System.Windows.Forms.Button dian;
}
}
| 43.436364 | 138 | 0.519255 | [
"MIT"
] | diyou-diyou/diyou-Calculator | Chinese/code/diyou计算器/diyou计算器/Form1.Designer.cs | 24,160 | C# |
// ===========================================================
// Copyright (c) 2014-2015, Enrico Da Ros/kendar.org
// 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.
//
// 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.Threading;
using ConcurrencyHelpers.Interfaces;
using ConcurrencyHelpers.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ConcurrencyHelpers.Test.Utils
{
[TestClass]
public class ThreadingTimerTest
{
private int _elapsedCount;
private ThreadingTimer _t;
private void TimerElapsed(object sender, ElapsedTimerEventArgs e)
{
_elapsedCount++;
}
private void TimerElapsed100(object sender, ElapsedTimerEventArgs e)
{
Thread.Sleep(100);
_elapsedCount++;
}
[TestInitialize]
public void TestInitialize()
{
_elapsedCount = 0;
}
[TestCleanup]
public void TestCleanup()
{
_t.Dispose();
}
[TestMethod]
public void ThreadingTimerDelayTimerStart()
{
_t = new ThreadingTimer(100, 100);
_t.Elapsed += TimerElapsed;
_t.Start();
Thread.Sleep(90);
Assert.AreEqual(0, _elapsedCount);
Thread.Sleep(220);
Assert.AreEqual(2, _elapsedCount);
}
[TestMethod]
[Ignore]
public void ThreadingTimerDelayTimerStartChangingTimers()
{
_t = new ThreadingTimer(1, 1);
_t.Elapsed += TimerElapsed;
_t.Start(100, 100);
Thread.Sleep(90);
Assert.AreEqual(0, _elapsedCount);
Thread.Sleep(220);
Assert.AreEqual(2, _elapsedCount);
Assert.AreEqual(_t.TimesRun, _elapsedCount);
}
[TestMethod]
[Ignore]
public void ThreadingTimerRemoveElapsed()
{
_t = new ThreadingTimer(1, 1);
_t.Elapsed += TimerElapsed;
_t.Start(100, 100);
Thread.Sleep(90);
Assert.AreEqual(0, _elapsedCount);
Thread.Sleep(120);
_t.Stop();
var elapsed = _elapsedCount;
_t.Elapsed -= TimerElapsed;
_t.Start(100, 100);
Thread.Sleep(90);
Assert.AreEqual(elapsed, _elapsedCount);
Thread.Sleep(220);
_t.Stop();
Assert.AreEqual(elapsed, _elapsedCount);
Assert.AreNotEqual(_t.TimesRun, _elapsedCount);
}
[TestMethod]
[Ignore]
public void ThreadingTimerRunGivenTimes()
{
_t = new ThreadingTimer(100, 10);
_t.Elapsed += TimerElapsed;
_t.Start();
Thread.Sleep(240);
Assert.IsTrue(_t.Running);
_t.Stop();
Assert.AreEqual(3, _elapsedCount);
Assert.IsFalse(_t.Running);
}
[TestMethod]
public void ThreadingTimerInitialization()
{
_t = new ThreadingTimer(15, 101);
Assert.AreEqual(15, _t.Period);
_t.Start();
_t.Dispose();
_t = new ThreadingTimer(15);
}
[TestMethod]
public void ThreadingTimerZeroWait()
{
_t = new ThreadingTimer(50);
_t.Elapsed += TimerElapsed;
_t.Start();
Thread.Sleep(265);
Assert.AreEqual(5, _elapsedCount);
}
[TestMethod]
public void ThreadingTimerNoOverlap()
{
_t = new ThreadingTimer(50);
_t.Elapsed += TimerElapsed100;
_t.Start();
Thread.Sleep(350);
_t.Stop();
Assert.IsTrue(_elapsedCount >= 2);
}
[TestMethod]
public void ThreadingTimerStop()
{
_t = new ThreadingTimer(50);
_t.Elapsed += TimerElapsed;
_t.Start();
Thread.Sleep(265);
Assert.AreEqual(5, _elapsedCount);
_t.Stop();
Thread.Sleep(265);
Assert.AreEqual(5, _elapsedCount);
}
}
}
| 27.242775 | 82 | 0.665818 | [
"BSD-2-Clause"
] | endaroza/ConcurrencyHelpers | ConcurrencyHelpers/test/ConcurrencyHelpers.Test/Utils/ThreadingTimerTest.cs | 4,713 | C# |
namespace FinalBoostrapIntro.Models
{
public class Book
{
public int Id { get; set; }
public int AuthorId { get; set; }
public string Title { get; set; }
public string Isbn { get; set; }
public string Synopsis { get; set; }
public string Description { get; set; }
public string ImageUrl { get; set; }
public virtual Author Author { get; set; }
}
}
| 28.666667 | 50 | 0.569767 | [
"MIT"
] | swordz36/FinalBootstrap | FinalBoostrapIntro/Models/Book.cs | 432 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
namespace LodeRunner.Core.Models
{
/// <summary>
/// ClientStatus is primarily for conveying the current status, time of that status, and the LoadClient settings to consuming apps.
/// </summary>
public class ClientStatus : BaseEntityModel
{
/// <summary>
/// Gets or sets the last updated.
/// </summary>
/// <value>
/// The last updated.
/// </value>
public DateTime LastUpdated { get; set; }
/// <summary>
/// Gets or sets the duration of the status.
/// </summary>
/// <value>
/// The duration of the status.
/// </value>
public int StatusDuration { get; set; }
/// <summary>
/// Gets or sets the status.
/// </summary>
/// <value>
/// The status.
/// </value>
public ClientStatusType Status { get; set; }
/// <summary>
/// Gets or sets the message.
/// </summary>
/// <value>
/// The message.
/// </value>
public string Message { get; set; }
/// <summary>
/// Gets or sets the load client.
/// </summary>
/// <value>
/// The load client.
/// </value>
public LoadClient LoadClient { get; set; }
/// <summary>
/// Gets or sets the Time to live in seconds.
/// </summary>
/// <value>
/// The TTL.
/// </value>
public int Ttl { get; set; } = SystemConstants.ClientStatusExpirationTime;
}
}
| 27.870968 | 137 | 0.518519 | [
"MIT"
] | cloudatx/loderunner | src/LodeRunner.Core/Models/ClientStatus.cs | 1,730 | C# |
using Newtonsoft.Json;
namespace Kinvey
{
/// <summary>
/// Represents JSON object with information about an error.
/// </summary>
[JsonObject(MemberSerialization.OptIn)]
public class Error
{
/// <summary>
/// An index of an entity in the collection <see cref="Kinvey.KinveyMultiInsertResponse{T}.Entities"/>.
/// </summary>
[JsonProperty]
public int Index { get; set; }
/// <summary>
/// Error code./>
/// </summary>
[JsonProperty]
public int Code { get; set; }
/// <summary>
/// Error message./>
/// </summary>
[JsonProperty]
public string Errmsg { get; set; }
}
}
| 23.4 | 105 | 0.549858 | [
"Apache-2.0"
] | alexislom/dotnet-sdk | Kinvey.Shared/Model/Error.cs | 704 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Models.NorthwindIB.EDMX_2012
{
using System;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class NorthwindIBContext_EDMX_2012 : DbContext
{
public NorthwindIBContext_EDMX_2012()
: base("name=NorthwindIBContext_EDMX_2012")
{
}
public NorthwindIBContext_EDMX_2012(DbConnection connection)
: base(connection, false) {
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public DbSet<Category> Categories { get; set; }
public DbSet<Customer> Customers { get; set; }
public DbSet<Employee> Employees { get; set; }
public DbSet<EmployeeTerritory> EmployeeTerritories { get; set; }
public DbSet<InternationalOrder> InternationalOrders { get; set; }
public DbSet<NextId> NextIds { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<OrderDetail> OrderDetails { get; set; }
public DbSet<PreviousEmployee> PreviousEmployees { get; set; }
public DbSet<Product> Products { get; set; }
public DbSet<Region> Regions { get; set; }
public DbSet<Supplier> Suppliers { get; set; }
public DbSet<Territory> Territories { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<UserRole> UserRoles { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<TimeGroup> TimeGroups { get; set; }
public DbSet<Geospatial> Geospatials { get; set; }
public DbSet<UnusualDate> UnusualDates { get; set; }
public DbSet<TimeLimit> TimeLimits { get; set; }
public DbSet<Comment> Comments { get; set; }
}
}
| 41.607143 | 85 | 0.587983 | [
"MIT"
] | rmarmer1/Breeze | _Internal/Model_NorthwindIB_EDMX_2012/NorthwindIB_2012.Context.cs | 2,332 | C# |
using System;
namespace ViceIO.Data.Common.Models
{
public interface IAuditInfo
{
DateTime CreatedOn { get; set; }
DateTime? ModifiedOn { get; set; }
}
}
| 15.416667 | 42 | 0.616216 | [
"MIT"
] | Magicianred/ViceIO | ViceIO/Data/ViceIO.Data.Common/Models/IAuditInfo.cs | 187 | C# |
namespace G1Tool.IO
{
public enum StringBinaryFormat
{
Unknown,
NullTerminated,
FixedLength,
PrefixedLength8,
PrefixedLength16,
PrefixedLength32,
}
}
| 16.230769 | 34 | 0.587678 | [
"MIT"
] | Raytwo/G1Tool | IO/StringBinaryFormat.cs | 213 | C# |
using System;
namespace LinqToDB.Interceptors
{
interface IEntityServiceInterceptable
{
AggregatedInterceptor<IEntityServiceInterceptor>? Interceptors { get; }
}
}
| 18 | 74 | 0.761111 | [
"MIT"
] | BearerPipelineTest/linq2db | Source/LinqToDB/Interceptors/IEntityServiceInterceptable.cs | 173 | C# |
using Nameless.Flareon.Yggdrasil;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nameless.Flareon.Runtime
{
/// <summary>
/// Defines the collection of commands that the Addin use
/// </summary>
public class Commands : NamelessObject
{
/// <summary>
/// The application
/// </summary>
public static AppSettings App;
}
}
| 21.761905 | 61 | 0.658643 | [
"MIT"
] | ANamelessWolf/autocad_cc_table | autocad_cc_table/Addin/Runtime/Commands.cs | 459 | C# |
using System;
using NetOffice;
namespace NetOffice.WordApi.Enums
{
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
///<remarks> MSDN Online Documentation: http://msdn.microsoft.com/en-us/en-us/library/office/ff839379.aspx </remarks>
[SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)]
[EntityTypeAttribute(EntityType.IsEnum)]
public enum WdPrintOutItem
{
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>0</remarks>
[SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)]
wdPrintDocumentContent = 0,
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>1</remarks>
[SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)]
wdPrintProperties = 1,
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>2</remarks>
[SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)]
wdPrintComments = 2,
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>3</remarks>
[SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)]
wdPrintStyles = 3,
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>4</remarks>
[SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)]
wdPrintAutoTextEntries = 4,
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>5</remarks>
[SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)]
wdPrintKeyAssignments = 5,
/// <summary>
/// SupportByVersion Word 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>6</remarks>
[SupportByVersionAttribute("Word", 9,10,11,12,14,15,16)]
wdPrintEnvelope = 6,
/// <summary>
/// SupportByVersion Word 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>2</remarks>
[SupportByVersionAttribute("Word", 10,11,12,14,15,16)]
wdPrintMarkup = 2,
/// <summary>
/// SupportByVersion Word 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks>7</remarks>
[SupportByVersionAttribute("Word", 10,11,12,14,15,16)]
wdPrintDocumentWithMarkup = 7
}
} | 29.631579 | 119 | 0.620337 | [
"MIT"
] | Engineerumair/NetOffice | Source/Word/Enums/WdPrintOutItem.cs | 2,252 | C# |
namespace Consumption.Shared.Common.Collections
{
using System;
using System.Collections.Generic;
/// <summary>
/// Provides some extension methods for <see cref="IEnumerable{T}"/> to provide paging capability.
/// 提供一些扩展方法来提供分页功能
/// </summary>
public static class IEnumerablePagedListExtensions
{
/// <summary>
/// Converts the specified source to <see cref="IPagedList{T}"/> by the specified <paramref name="pageIndex"/> and <paramref name="pageSize"/>.
/// 通过起始页和页大小把数据转换成页集合
/// </summary>
/// <typeparam name="T">The type of the source.源的类型</typeparam>
/// <param name="source">The source to paging.分页的源</param>
/// <param name="pageIndex">The index of the page.起始页</param>
/// <param name="pageSize">The size of the page.页大小</param>
/// <param name="indexFrom">The start index value.开始索引值</param>
/// <returns>An instance of the inherited from <see cref="IPagedList{T}"/> interface.接口继承的实例</returns>
public static IPagedList<T> ToPagedList<T>(this IEnumerable<T> source, int pageIndex, int pageSize, int indexFrom = 0) => new PagedList<T>(source, pageIndex, pageSize, indexFrom);
/// <summary>
/// Converts the specified source to <see cref="IPagedList{T}"/> by the specified <paramref name="converter"/>, <paramref name="pageIndex"/> and <paramref name="pageSize"/>
/// 通过转换器,起始页和页大小把数据转换成页集合
/// </summary>
/// <typeparam name="TSource">The type of the source.源的类型</typeparam>
/// <typeparam name="TResult">The type of the result.反馈的类型</typeparam>
/// <param name="source">The source to convert.要转换的源</param>
/// <param name="converter">The converter to change the <typeparamref name="TSource"/> to <typeparamref name="TResult"/>.转换器来改变源到反馈</param>
/// <param name="pageIndex">The page index.起始页</param>
/// <param name="pageSize">The page size.页大小</param>
/// <param name="indexFrom">The start index value.开始索引值</param>
/// <returns>An instance of the inherited from <see cref="IPagedList{T}"/> interface.接口继承的实例</returns>
public static IPagedList<TResult> ToPagedList<TSource, TResult>(this IEnumerable<TSource> source, Func<IEnumerable<TSource>, IEnumerable<TResult>> converter, int pageIndex, int pageSize, int indexFrom = 0) => new PagedList<TSource, TResult>(source, converter, pageIndex, pageSize, indexFrom);
}
}
| 60.073171 | 300 | 0.665855 | [
"MIT"
] | JasonYJ90/WPF-Xamarin-Blazor-Examples | src/Consumption/Consumption.Shared/Common/Collections/IEnumerablePagedListExtensions.cs | 2,711 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web.Http;
using TheIdentityHub;
namespace AccessTokenMvcApiService.Controllers
{
public class ValuesController : ApiController
{
// DELETE api/values/5
[Authorize]
public void Delete(int id)
{
}
// GET api/values
[Authorize]
public IEnumerable<string> Get()
{
return new string[] { "IdentityId:" + this.User.Name(), "Roles:" + string.Join(" ", this.User.Roles()), "DisplayName:" + this.User.DisplayName() };
}
// GET api/values/5
[Authorize]
public string Get(int id)
{
return "value";
}
// POST api/values
[Authorize]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[Authorize]
public void Put(int id, [FromBody]string value)
{
}
}
} | 22.522727 | 159 | 0.54995 | [
"MIT"
] | TheIdentityHub/theidentityhub-demo | AspNetMvcApiWcfServices/AccessTokenMvcApiService/Controllers/ValuesController.cs | 993 | C# |
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Xml.Linq;
namespace Microsoft.Toolkit.Parsers
{
/// <summary>
/// Parser for Atom endpoints.
/// </summary>
internal class AtomParser : BaseRssParser
{
/// <summary>
/// Atom reader implementation to parse Atom content.
/// </summary>
/// <param name="doc">XDocument to parse.</param>
/// <returns>Strong typed response.</returns>
public override IEnumerable<RssSchema> LoadFeed(XDocument doc)
{
Collection<RssSchema> feed = new Collection<RssSchema>();
if (doc.Root == null)
{
return feed;
}
var items = doc.Root.Elements(doc.Root.GetDefaultNamespace() + "entry").Select(item => GetRssSchema(item)).ToList<RssSchema>();
feed = new Collection<RssSchema>(items);
return feed;
}
/// <summary>
/// Retieves strong type for passed item.
/// </summary>
/// <param name="item">XElement to parse.</param>
/// <returns>Strong typed object.</returns>
private static RssSchema GetRssSchema(XElement item)
{
RssSchema rssItem = new RssSchema
{
Author = GetItemAuthor(item),
Title = item.GetSafeElementString("title").Trim().DecodeHtml(),
ImageUrl = GetItemImage(item),
PublishDate = item.GetSafeElementDate("published"),
FeedUrl = item.GetLink("alternate"),
};
var content = GetItemContent(item);
// Removes scripts from html
if (!string.IsNullOrEmpty(content))
{
rssItem.Summary = ProcessHtmlSummary(content);
rssItem.Content = ProcessHtmlContent(content);
}
string id = item.GetSafeElementString("guid").Trim();
if (string.IsNullOrEmpty(id))
{
id = item.GetSafeElementString("id").Trim();
if (string.IsNullOrEmpty(id))
{
id = rssItem.FeedUrl;
}
}
rssItem.InternalID = id;
return rssItem;
}
/// <summary>
/// Retrieves item author from XElement.
/// </summary>
/// <param name="item">XElement item.</param>
/// <returns>String of Item Author.</returns>
private static string GetItemAuthor(XElement item)
{
var content = string.Empty;
if (item != null && item.Element(item.GetDefaultNamespace() + "author") != null)
{
content = item.Element(item.GetDefaultNamespace() + "author").GetSafeElementString("name");
}
if (string.IsNullOrEmpty(content))
{
content = item.GetSafeElementString("author");
}
return content;
}
/// <summary>
/// Returns item image from XElement item.
/// </summary>
/// <param name="item">XElement item.</param>
/// <returns>String pointing to item image.</returns>
private static string GetItemImage(XElement item)
{
if (!string.IsNullOrEmpty(item.GetSafeElementString("image")))
{
return item.GetSafeElementString("image");
}
return item.GetImage();
}
/// <summary>
/// Returns item content from XElement item.
/// </summary>
/// <param name="item">XElement item.</param>
/// <returns>String of item content.</returns>
private static string GetItemContent(XElement item)
{
var content = item.GetSafeElementString("description");
if (string.IsNullOrEmpty(content))
{
content = item.GetSafeElementString("content");
}
if (string.IsNullOrEmpty(content))
{
content = item.GetSafeElementString("summary");
}
return content;
}
}
}
| 31.742424 | 139 | 0.53222 | [
"MIT"
] | gopikrishnareddy93/blazor-rss-reader | src/BlazorRssReader/RssParser/AtomParser.cs | 4,192 | C# |
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Management.Synapse.Models
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// IP firewall rule
/// </summary>
[Rest.Serialization.JsonTransformation]
public partial class IpFirewallRuleInfo : IResource
{
/// <summary>
/// Initializes a new instance of the IpFirewallRuleInfo class.
/// </summary>
public IpFirewallRuleInfo()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the IpFirewallRuleInfo class.
/// </summary>
/// <param name="endIpAddress">The end IP address of the firewall rule.
/// Must be IPv4 format. Must be greater than or equal to
/// startIpAddress</param>
/// <param name="provisioningState">Resource provisioning state.
/// Possible values include: 'Provisioning', 'Succeeded', 'Deleting',
/// 'Failed', 'DeleteError'</param>
/// <param name="startIpAddress">The start IP address of the firewall
/// rule. Must be IPv4 format</param>
public IpFirewallRuleInfo(string endIpAddress = default(string), string provisioningState = default(string), string startIpAddress = default(string))
{
EndIpAddress = endIpAddress;
ProvisioningState = provisioningState;
StartIpAddress = startIpAddress;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets the end IP address of the firewall rule. Must be IPv4
/// format. Must be greater than or equal to startIpAddress
/// </summary>
[JsonProperty(PropertyName = "properties.endIpAddress")]
public string EndIpAddress { get; set; }
/// <summary>
/// Gets resource provisioning state. Possible values include:
/// 'Provisioning', 'Succeeded', 'Deleting', 'Failed', 'DeleteError'
/// </summary>
[JsonProperty(PropertyName = "properties.provisioningState")]
public string ProvisioningState { get; private set; }
/// <summary>
/// Gets or sets the start IP address of the firewall rule. Must be
/// IPv4 format
/// </summary>
[JsonProperty(PropertyName = "properties.startIpAddress")]
public string StartIpAddress { get; set; }
}
}
| 37 | 157 | 0.631757 | [
"MIT"
] | 0rland0Wats0n/azure-sdk-for-net | sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IpFirewallRuleInfo.cs | 2,960 | C# |
#region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
namespace Newtonsoft.Json.Tests.TestObjects
{
public class ClassConverterPrecedenceClassConverter : ConverterPrecedenceClassConverter
{
public override string ConverterType
{
get { return "Class"; }
}
}
}
| 39.027778 | 91 | 0.743772 | [
"MIT"
] | belav/Newtonsoft.Json | Src/Newtonsoft.Json.Tests/TestObjects/ClassConverterPrecedenceClassConverter.cs | 1,405 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SineBounce : MonoBehaviour {
public float period = 0.5f;
public float amplitude = .5f;
private float time = 0f;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
time += Time.deltaTime;
time %= period;
var position = transform.localPosition;
position.y = amplitude * Mathf.Sin(time / period * Mathf.PI * 2);
transform.localPosition = position;
}
}
| 20.034483 | 73 | 0.626506 | [
"Apache-2.0"
] | p-dahlback/ld-42 | Assets/Scripts/Utilities/SineBounce.cs | 583 | C# |
// Copyright 2019 ProximaX
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using Org.BouncyCastle.Crypto.Digests;
using Org.BouncyCastle.Security;
using ProximaX.Sirius.Chain.Sdk.Crypto.Core.Chaso.NaCl;
using ProximaX.Sirius.Chain.Sdk.Crypto.Core.Chaso.NaCl.Internal.Ed25519ref10;
using ProximaX.Sirius.Chain.Sdk.Utils;
namespace ProximaX.Sirius.Chain.Sdk.Crypto.Core
{
public static class CryptoUtils
{
/// <summary>
/// Hash an array of bytes using Sha3 512 algorithm.
/// </summary>
/// <param name="bytes">The bytes.</param>
/// <returns>System.Byte[].</returns>
public static byte[] Sha3_512(byte[] bytes)
{
var temp = new byte[64];
var digest = new Sha3Digest(512);
digest.BlockUpdate(bytes, 0, bytes.Length);
digest.DoFinal(temp, 0);
return temp;
}
/// <summary>
/// Hash an array of bytes using Sha3 256 algorithm.
/// </summary>
/// <param name="bytes">The bytes.</param>
/// <returns>System.Byte[].</returns>
public static byte[] Sha3_256(byte[] bytes)
{
var temp = new byte[32];
var digest = new Sha3Digest(256);
digest.BlockUpdate(bytes, 0, bytes.Length);
digest.DoFinal(temp, 0);
return temp;
}
/// <summary>
/// Encrypt a private key for mobile apps (AES_PBKF2)
/// </summary>
/// <param name="password">The password.</param>
/// <param name="privateKey">The private key.</param>
/// <returns>System.String.</returns>
public static string ToMobileKey(string password, string privateKey)
{
var random = new SecureRandom();
var salt = new byte[256 / 8];
random.NextBytes(salt);
var maker = new Rfc2898DeriveBytes(password, salt, 2000);
var key = maker.GetBytes(256 / 8);
var ivData = new byte[16];
random.NextBytes(ivData);
return salt.ToHexLower() + AesEncryptor(key, ivData, privateKey);
}
/// <summary>
/// Decrypt a private key for mobile apps (AES_PBKF2)
/// </summary>
/// <param name="payload">The payload.</param>
/// <param name="password">The password.</param>
/// <returns>System.String.</returns>
public static string FromMobileKey(string payload, string password)
{
var salt = payload.FromHex().Take(32).ToArray();
var iv = payload.FromHex().Take(32, 16);
var cypher = payload.FromHex().Take(48, payload.FromHex().Length - 48);
var maker = new Rfc2898DeriveBytes(password, salt, 2000);
var key = maker.GetBytes(256 / 8);
return AesDecryptor(key, iv, cypher).ToUpper();
}
/// <summary>
/// Encodes the specified text.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="secretKey">The secret key.</param>
/// <param name="publicKey">The public key.</param>
/// <returns>System.String.</returns>
public static string Encode(string text, string secretKey, string publicKey)
{
var random = new SecureRandom();
var salt = new byte[32];
random.NextBytes(salt);
var ivData = new byte[16];
random.NextBytes(ivData);
return _Encode(
secretKey.FromHex(),
publicKey.FromHex(),
text,
ivData,
salt);
}
/// <summary>
/// Decodes the specified text.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="secretKey">The secret key.</param>
/// <param name="publicKey">The public key.</param>
/// <returns>System.String.</returns>
public static string Decode(string text, string secretKey, string publicKey)
{
return _Decode(
secretKey.FromHex(),
publicKey.FromHex(),
text.FromHex());
}
/// <summary>
/// Derive a private key from a password using count iterations of SHA3-256
/// </summary>
/// <param name="password">The password.</param>
/// <param name="count">The count.</param>
/// <returns>System.String.</returns>
/// <exception cref="ArgumentNullException">password</exception>
/// <exception cref="ArgumentOutOfRangeException">count - must be positive</exception>
internal static string DerivePassSha(byte[] password, int count)
{
if (password == null) throw new ArgumentNullException(nameof(password));
if (count <= 0) throw new ArgumentOutOfRangeException(nameof(count), "must be positive");
var sha3Hasher = new KeccakDigest(256);
var hash = new byte[32];
sha3Hasher.BlockUpdate(password, 0, password.Length);
sha3Hasher.DoFinal(hash, 0);
for (var i = 0; i < count - 1; ++i)
{
sha3Hasher.Reset();
sha3Hasher.BlockUpdate(hash, 0, hash.Length);
sha3Hasher.DoFinal(hash, 0);
}
return hash.ToHexUpper();
}
/// <summary>
/// Encodes the specified private key.
/// </summary>
/// <param name="privateKey">The private key.</param>
/// <param name="publicKey">The pub key.</param>
/// <param name="msg">The MSG.</param>
/// <param name="iv">The iv.</param>
/// <param name="salt">The salt.</param>
/// <returns>System.String.</returns>
internal static string _Encode(byte[] privateKey, byte[] publicKey, string msg, byte[] iv, byte[] salt)
{
var shared = new byte[32];
Ed25519Operations.key_derive(
shared,
salt,
privateKey,
publicKey);
return salt.ToHexLower() + AesEncryptor(shared, iv, msg);
}
/// <summary>
/// Decodes the specified private key.
/// </summary>
/// <param name="privateKey">The private key.</param>
/// <param name="publicKey">The pub key.</param>
/// <param name="data">The data.</param>
/// <returns>System.String.</returns>
internal static string _Decode(byte[] privateKey, byte[] publicKey, byte[] data)
{
var salt = data.Take(0, 32).ToArray();
var iv = data.Take(32, 16);
var payload = data.Take(48, data.Length - 48);
var shared = new byte[32];
Ed25519Operations.key_derive(
shared,
salt,
privateKey,
publicKey);
return AesDecryptor(shared, iv, payload);
}
internal static string AesEncryptor(byte[] key, byte[] iv, string msg)
{
using (var aesAlg = Aes.Create())
{
aesAlg.Key = key;
aesAlg.IV = iv;
aesAlg.Mode = CipherMode.CBC;
var encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
using (var msEncrypt = new MemoryStream())
{
using (var csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
{
using (var swEncrypt = new StreamWriter(csEncrypt))
{
swEncrypt.Write(msg);
}
return iv.ToHexLower() + msEncrypt.ToArray().ToHexLower();
}
}
}
}
internal static string AesDecryptor(byte[] key, byte[] iv, byte[] payload)
{
using (var aesAlg = Aes.Create())
{
aesAlg.Key = key;
aesAlg.IV = iv;
aesAlg.Mode = CipherMode.CBC;
aesAlg.Padding = PaddingMode.PKCS7;
var decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
using (var msDecrypt = new MemoryStream(payload))
{
using (var csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
{
using (var srDecrypt = new StreamReader(csDecrypt))
{
var a = srDecrypt.ReadToEnd();
return a;
}
}
}
}
}
}
} | 34.918216 | 111 | 0.533163 | [
"Apache-2.0"
] | proximax-storage/csharp-xpx-chain-sdk | src/ProximaX.Sirius.Chain.Sdk/Crypto/Core/CryptoUtils.cs | 9,395 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;
namespace Azure.Search.Documents.Indexes.Models
{
internal partial class ListIndexesResult
{
internal static ListIndexesResult DeserializeListIndexesResult(JsonElement element)
{
IReadOnlyList<SearchIndex> value = default;
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("value"))
{
List<SearchIndex> array = new List<SearchIndex>();
foreach (var item in property.Value.EnumerateArray())
{
array.Add(SearchIndex.DeserializeSearchIndex(item));
}
value = array;
continue;
}
}
return new ListIndexesResult(value);
}
}
}
| 29.166667 | 91 | 0.568571 | [
"MIT"
] | 0rland0Wats0n/azure-sdk-for-net | sdk/search/Azure.Search.Documents/src/Generated/Models/ListIndexesResult.Serialization.cs | 1,050 | C# |
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;
class Result
{
/*
* Complete the 'diagonalDifference' function below.
*
* The function is expected to return an INTEGER.
* The function accepts 2D_INTEGER_ARRAY arr as parameter.
*/
public static int diagonalDifference(List<List<int>> arr)
{
// values to store diagonal sums
int leftDiag = 0;
int rightDiag = 0;
// iterate through matrix
for (int i = 0; i < arr.Count; i++)
{
for (int j = 0; j < arr.Count; j++)
{
// if value is in left diagonal, add it
if (j == i)
{
leftDiag += arr[i][j];
}
// if value is in right diagonal, add it
if (j == arr.Count - 1 - i)
{
rightDiag += arr[i][j];
}
}
}
// find the absolute value of the difference
return Math.Abs(leftDiag - rightDiag);
}
}
class Solution
{
public static void Main(string[] args)
{
TextWriter textWriter = new StreamWriter(@System.Environment.GetEnvironmentVariable("OUTPUT_PATH"), true);
int n = Convert.ToInt32(Console.ReadLine().Trim());
List<List<int>> arr = new List<List<int>>();
for (int i = 0; i < n; i++)
{
arr.Add(Console.ReadLine().TrimEnd().Split(' ').ToList().Select(arrTemp => Convert.ToInt32(arrTemp)).ToList());
}
int result = Result.diagonalDifference(arr);
textWriter.WriteLine(result);
textWriter.Flush();
textWriter.Close();
}
} | 26.236842 | 123 | 0.569208 | [
"MIT"
] | CrutchTheClutch/HackerRank | Solutions/1 Week Preparation Kit/Day 2/Diagonal Difference/Solution.cs | 1,994 | C# |
using System;
namespace Skribble {
public sealed class UnexpectedTokenException : Exception {
internal UnexpectedTokenException(Type expected, IToken actual) : base($"Expected {expected} but got {actual}") {
}
internal UnexpectedTokenException(IToken token, int position) : base($"{token} was not expected at position {position}") {
}
}
} | 34.545455 | 130 | 0.686842 | [
"Apache-2.0"
] | k-boyle/Skribble | src/Skribble.Interpreter/UnexpectedTokenException.cs | 380 | C# |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Kafka.Client.Producers.Partitioning
{
/// <summary>
/// User-defined partitioner
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
public interface IPartitioner<TKey>
{
/// <summary>
/// Uses the key to calculate a partition bucket id for routing
/// the data to the appropriate broker partition
/// </summary>
/// <param name="key">The key.</param>
/// <param name="numPartitions">The num partitions.</param>
/// <returns>ID between 0 and numPartitions-1</returns>
int Partition(TKey key, int numPartitions);
}
}
| 40.138889 | 75 | 0.691349 | [
"Apache-2.0"
] | Bhaskers-Blu-Org2/CSharpClient-for-Kafka | src/KafkaNET.Library/Producers/Partitioning/IPartitioner.cs | 1,447 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace PackageTrackingApp.Extensions
{
public static class StringExtensions
{
private static Regex PhoneNumberRegex = new Regex(@"^([0-9]{9})$");
private static Regex containsUpperChar = new Regex(@"[A-Z]+");
public static bool IsEmail(this string email)
=> email != null && new EmailAddressAttribute().IsValid(email);
public static bool IsValidPassword(this string password)
=> containsUpperChar.IsMatch(password);
public static bool IsPhoneNumber(this string number)
=> PhoneNumberRegex.IsMatch(number);
public static string FirstCharToUpper(this string input)
=> input switch
{
null => throw new ArgumentNullException($"{nameof(input)} can not be null."),
"" => throw new ArgumentException($"{nameof(input)} cannot be empty"),
_ => string.Concat(input[0].ToString().ToUpper(), input.AsSpan(1))
};
}
}
| 35.088235 | 93 | 0.651299 | [
"MIT"
] | Shrest7/PackageTrackingApp | PackageTrackingApp.Extensions/StringExtensions.cs | 1,195 | C# |
using Storage.Classes.Models.Chat;
using UWPX_UI_Context.Classes.DataTemplates.Dialogs;
namespace UWPX_UI_Context.Classes.DataContext.Dialogs
{
public sealed class DeleteChatConfirmDialogContext
{
//--------------------------------------------------------Attributes:-----------------------------------------------------------------\\
#region --Attributes--
public readonly DeleteChatConfirmDialogDataTemplate MODEL;
#endregion
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\
#region --Constructors--
public DeleteChatConfirmDialogContext(ChatModel chat)
{
MODEL = new DeleteChatConfirmDialogDataTemplate(chat);
}
#endregion
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
#region --Set-, Get- Methods--
#endregion
//--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
#region --Misc Methods (Public)--
public void Confirm()
{
MODEL.Confirmed = true;
}
public void Cancel()
{
MODEL.Confirmed = false;
}
#endregion
#region --Misc Methods (Private)--
#endregion
#region --Misc Methods (Protected)--
#endregion
//--------------------------------------------------------Events:---------------------------------------------------------------------\\
#region --Events--
#endregion
}
}
| 30.982143 | 144 | 0.371182 | [
"MPL-2.0"
] | LibreHacker/UWPX-Client | UWPX_UI_Context/Classes/DataContext/Dialogs/DeleteChatConfirmDialogContext.cs | 1,737 | C# |
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SIPSorcery.CRM;
using SIPSorcery.SIP.App;
using SIPSorcery.SIPSorceryProvisioningClient;
namespace SIPSorcery.Persistence
{
public delegate void MethodInvokerDelegate();
public delegate void IsAliveCompleteDelegate(IsAliveCompletedEventArgs e);
public delegate void CheckInviteCodeCompleteDelegate(CheckInviteCodeCompletedEventArgs e);
public delegate void TestExceptionCompleteDelegate(AsyncCompletedEventArgs e);
public delegate void AreNewAccountsEnabledCompleteDelegate(AreNewAccountsEnabledCompletedEventArgs e);
public delegate void LoginCompleteDelegate(LoginCompletedEventArgs e);
public delegate void LogoutCompleteDelegate(AsyncCompletedEventArgs e);
public delegate void GetCustomerCompleteDelegate(GetCustomerCompletedEventArgs e);
public delegate void UpdateCustomerCompleteDelegate(AsyncCompletedEventArgs e);
public delegate void UpdateCustomerPasswordCompleteDelegate(AsyncCompletedEventArgs e);
public delegate void GetSIPAccountsCountCompleteDelegate(GetSIPAccountsCountCompletedEventArgs e);
public delegate void GetSIPAccountsCompleteDelegate(GetSIPAccountsCompletedEventArgs e);
public delegate void AddSIPAccountCompleteDelegate(AddSIPAccountCompletedEventArgs e);
public delegate void UpdateSIPAccountCompleteDelegate(UpdateSIPAccountCompletedEventArgs e);
public delegate void DeleteSIPAccountCompleteDelegate(DeleteSIPAccountCompletedEventArgs e);
public delegate void GetDialPlansCountCompleteDelegate(GetDialPlansCountCompletedEventArgs e);
public delegate void GetDialPlansCompleteDelegate(GetDialPlansCompletedEventArgs e);
public delegate void DeleteDialPlanCompleteDelegate(DeleteDialPlanCompletedEventArgs e);
public delegate void AddDialPlanCompleteDelegate(AddDialPlanCompletedEventArgs e);
public delegate void UpdateDialPlanCompleteDelegate(UpdateDialPlanCompletedEventArgs e);
public delegate void GetSIPProvidersCountCompleteDelegate(GetSIPProvidersCountCompletedEventArgs e);
public delegate void GetSIPProvidersCompleteDelegate(GetSIPProvidersCompletedEventArgs e);
public delegate void DeleteSIPProviderCompleteDelegate(DeleteSIPProviderCompletedEventArgs e);
public delegate void AddSIPProviderCompleteDelegate(AddSIPProviderCompletedEventArgs e);
public delegate void UpdateSIPProviderCompleteDelegate(UpdateSIPProviderCompletedEventArgs e);
public delegate void GetSIPDomainsCompleteDelegate(GetSIPDomainsCompletedEventArgs e);
public delegate void GetRegistrarBindingsCompleteDelegate(GetSIPRegistrarBindingsCompletedEventArgs e);
public delegate void GetRegistrarBindingsCountCompleteDelegate(GetSIPRegistrarBindingsCountCompletedEventArgs e);
public delegate void GetSIPProviderBindingsCompleteDelegate(GetSIPProviderBindingsCompletedEventArgs e);
public delegate void GetSIPProviderBindingsCountCompleteDelegate(GetSIPProviderBindingsCountCompletedEventArgs e);
public delegate void GetCallsCountCompleteDelegate(GetCallsCountCompletedEventArgs e);
public delegate void GetCallsCompleteDelegate(GetCallsCompletedEventArgs e);
public delegate void GetCDRsCountCompleteDelegate(GetCDRsCountCompletedEventArgs e);
public delegate void GetCDRsCompleteDelegate(GetCDRsCompletedEventArgs e);
public delegate void CreateCustomerCompleteDelegate(AsyncCompletedEventArgs e);
public delegate void DeleteCustomerCompleteDelegate(AsyncCompletedEventArgs e);
public delegate void GetTimeZoneOffsetMinutesCompleteDelegate(GetTimeZoneOffsetMinutesCompletedEventArgs e);
public delegate void ExtendSessionCompleteDelegate(AsyncCompletedEventArgs e);
public enum SIPPersistorTypesEnum
{
Unknown = 0,
GUITest = 1, // Persistor that does not require any external communications and uses dummy asset lists. Allows the GUI to be worked on in isolation.
WebService = 2,
//HTTP = 3,
}
public class SIPSorceryPersistorFactory
{
public static SIPSorceryPersistor CreateSIPSorceryPersistor(SIPPersistorTypesEnum persistorType, string persistorConnStr, string authToken)
{
switch (persistorType)
{
case SIPPersistorTypesEnum.GUITest:
return new SIPSorceryGUITestPersistor();
case SIPPersistorTypesEnum.WebService:
return new SIPSorceryWebServicePersistor(persistorConnStr, authToken);
default:
throw new ArgumentException("Persistor type " + persistorType + " is not supported by the SIPSorcery persistor factory.");
}
}
}
public abstract class SIPSorceryPersistor
{
public abstract event IsAliveCompleteDelegate IsAliveComplete;
public abstract event TestExceptionCompleteDelegate TestExceptionComplete;
public abstract event AreNewAccountsEnabledCompleteDelegate AreNewAccountsEnabledComplete;
public abstract event CheckInviteCodeCompleteDelegate CheckInviteCodeComplete;
public abstract event LoginCompleteDelegate LoginComplete;
public abstract event LogoutCompleteDelegate LogoutComplete;
public abstract event GetCustomerCompleteDelegate GetCustomerComplete;
public abstract event UpdateCustomerCompleteDelegate UpdateCustomerComplete;
public abstract event UpdateCustomerPasswordCompleteDelegate UpdateCustomerPasswordComplete;
public abstract event GetSIPAccountsCountCompleteDelegate GetSIPAccountsCountComplete;
public abstract event GetSIPAccountsCompleteDelegate GetSIPAccountsComplete;
public abstract event AddSIPAccountCompleteDelegate AddSIPAccountComplete;
public abstract event UpdateSIPAccountCompleteDelegate UpdateSIPAccountComplete;
public abstract event DeleteSIPAccountCompleteDelegate DeleteSIPAccountComplete;
public abstract event GetDialPlansCountCompleteDelegate GetDialPlansCountComplete;
public abstract event GetDialPlansCompleteDelegate GetDialPlansComplete;
public abstract event DeleteDialPlanCompleteDelegate DeleteDialPlanComplete;
public abstract event AddDialPlanCompleteDelegate AddDialPlanComplete;
public abstract event UpdateDialPlanCompleteDelegate UpdateDialPlanComplete;
public abstract event GetSIPProvidersCountCompleteDelegate GetSIPProvidersCountComplete;
public abstract event GetSIPProvidersCompleteDelegate GetSIPProvidersComplete;
public abstract event DeleteSIPProviderCompleteDelegate DeleteSIPProviderComplete;
public abstract event AddSIPProviderCompleteDelegate AddSIPProviderComplete;
public abstract event UpdateSIPProviderCompleteDelegate UpdateSIPProviderComplete;
public abstract event GetSIPDomainsCompleteDelegate GetSIPDomainsComplete;
public abstract event GetRegistrarBindingsCompleteDelegate GetRegistrarBindingsComplete;
public abstract event GetRegistrarBindingsCountCompleteDelegate GetRegistrarBindingsCountComplete;
public abstract event GetSIPProviderBindingsCompleteDelegate GetSIPProviderBindingsComplete;
public abstract event GetSIPProviderBindingsCountCompleteDelegate GetSIPProviderBindingsCountComplete;
public abstract event GetCallsCountCompleteDelegate GetCallsCountComplete;
public abstract event GetCallsCompleteDelegate GetCallsComplete;
public abstract event GetCDRsCountCompleteDelegate GetCDRsCountComplete;
public abstract event GetCDRsCompleteDelegate GetCDRsComplete;
public abstract event CreateCustomerCompleteDelegate CreateCustomerComplete;
public abstract event DeleteCustomerCompleteDelegate DeleteCustomerComplete;
public abstract event GetTimeZoneOffsetMinutesCompleteDelegate GetTimeZoneOffsetMinutesComplete;
public abstract event ExtendSessionCompleteDelegate ExtendSessionComplete;
public abstract event MethodInvokerDelegate SessionExpired;
public abstract void IsAliveAsync();
public abstract void TestExceptionAsync();
public abstract void AreNewAccountsEnabledAsync();
public abstract void CheckInviteCodeAsync(string inviteCode);
public abstract void LoginAsync(string username, string password);
public abstract void LogoutAsync();
public abstract void GetCustomerAsync(string username);
public abstract void UpdateCustomerAsync(Customer customer);
public abstract void UpdateCustomerPassword(string username, string oldPassword, string newPassword);
public abstract void GetSIPAccountsCountAsync(string where);
public abstract void GetSIPAccountsAsync(string where, int offset, int count);
public abstract void AddSIPAccountAsync(SIPAccount sipAccount);
public abstract void UpdateSIPAccount(SIPAccount sipAccount);
public abstract void DeleteSIPAccount(SIPAccount sipAccount);
public abstract void GetDialPlansCountAsync(string where);
public abstract void GetDialPlansAsync(string where, int offset, int count);
public abstract void DeleteDialPlanAsync(SIPDialPlan dialPlan);
public abstract void UpdateDialPlanAsync(SIPDialPlan dialPlan);
public abstract void AddDialPlanAsync(SIPDialPlan dialPlan);
public abstract void GetSIPProvidersCountAsync(string where);
public abstract void GetSIPProvidersAsync(string where, int offset, int count);
public abstract void DeleteSIPProviderAsync(SIPProvider sipProvider);
public abstract void UpdateSIPProviderAsync(SIPProvider sipProvider);
public abstract void AddSIPProviderAsync(SIPProvider sipProvider);
public abstract void GetSIPDomainsAsync(string where, int offset, int count);
public abstract void GetRegistrarBindingsAsync(string where, int offset, int count);
public abstract void GetRegistrarBindingsCountAsync(string whereExpression);
public abstract void GetSIPProviderBindingsAsync(string where, int offset, int count);
public abstract void GetSIPProviderBindingsCountAsync(string whereExpression);
public abstract void GetCallsCountAsync(string whereExpression);
public abstract void GetCallsAsync(string whereExpressionn, int offset, int count);
public abstract void GetCDRsCountAsync(string whereExpression);
public abstract void GetCDRsAsync(string whereExpressionn, int offset, int count);
public abstract void CreateCustomerAsync(Customer customer);
public abstract void DeleteCustomerAsync(string customerUsername);
public abstract void GetTimeZoneOffsetMinutesAsync();
public abstract void ExtendSessionAsync(int minutes);
}
}
| 67.951807 | 164 | 0.797518 | [
"BSD-3-Clause"
] | Rehan-Mirza/sipsorcery | sipsorcery-silverlight/SIPSorcery.GUI/Services/SIPSorceryPersistor.cs | 11,282 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.ResourceManager.Core;
namespace Azure.ResourceManager.Network
{
internal partial class VpnServerConfigurationsAssociatedWithVirtualWanRestOperations
{
private string subscriptionId;
private Uri endpoint;
private string apiVersion;
private ClientDiagnostics _clientDiagnostics;
private HttpPipeline _pipeline;
private readonly string _userAgent;
/// <summary> Initializes a new instance of VpnServerConfigurationsAssociatedWithVirtualWanRestOperations. </summary>
/// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
/// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
/// <param name="options"> The client options used to construct the current client. </param>
/// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. </param>
/// <param name="endpoint"> server parameter. </param>
/// <param name="apiVersion"> Api Version. </param>
/// <exception cref="ArgumentNullException"> <paramref name="subscriptionId"/> or <paramref name="apiVersion"/> is null. </exception>
public VpnServerConfigurationsAssociatedWithVirtualWanRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-02-01")
{
this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId));
this.endpoint = endpoint ?? new Uri("https://management.azure.com");
this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion));
_clientDiagnostics = clientDiagnostics;
_pipeline = pipeline;
_userAgent = HttpMessageUtilities.GetUserAgentName(this, options);
}
internal HttpMessage CreateListRequest(string resourceGroupName, string virtualWANName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Post;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
uri.AppendPath(subscriptionId, true);
uri.AppendPath("/resourceGroups/", false);
uri.AppendPath(resourceGroupName, true);
uri.AppendPath("/providers/Microsoft.Network/virtualWans/", false);
uri.AppendPath(virtualWANName, true);
uri.AppendPath("/vpnServerConfigurations", false);
uri.AppendQuery("api-version", apiVersion, true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
message.SetProperty("UserAgentOverride", _userAgent);
return message;
}
/// <summary> Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. </summary>
/// <param name="resourceGroupName"> The resource group name. </param>
/// <param name="virtualWANName"> The name of the VirtualWAN whose associated VpnServerConfigurations is needed. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="virtualWANName"/> is null. </exception>
public async Task<Response> ListAsync(string resourceGroupName, string virtualWANName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (virtualWANName == null)
{
throw new ArgumentNullException(nameof(virtualWANName));
}
using var message = CreateListRequest(resourceGroupName, virtualWANName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
case 202:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
/// <summary> Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. </summary>
/// <param name="resourceGroupName"> The resource group name. </param>
/// <param name="virtualWANName"> The name of the VirtualWAN whose associated VpnServerConfigurations is needed. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="virtualWANName"/> is null. </exception>
public Response List(string resourceGroupName, string virtualWANName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (virtualWANName == null)
{
throw new ArgumentNullException(nameof(virtualWANName));
}
using var message = CreateListRequest(resourceGroupName, virtualWANName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
case 202:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}
}
| 50.926829 | 237 | 0.658206 | [
"MIT"
] | DiskRP-Swagger/azure-sdk-for-net | sdk/network/Azure.ResourceManager.Network/src/Generated/RestOperations/VpnServerConfigurationsAssociatedWithVirtualWanRestOperations.cs | 6,264 | C# |
namespace Nacos
{
using System.Collections.Generic;
public class ListInstancesResult
{
public string Dom { get; set; }
public string Name { get; set; }
public int CacheMillis { get; set; }
public string UseSpecifiedURL { get; set; }
public List<Host> Hosts { get; set; }
public string Checksum { get; set; }
public long LastRefTime { get; set; }
public string Env { get; set; }
public string Clusters { get; set; }
}
}
| 19.884615 | 51 | 0.580271 | [
"Apache-2.0"
] | SwingZhang/nacos-sdk-csharp | src/Nacos/Naming/Result/ListInstancesResult.cs | 519 | C# |
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Management.Network
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// CustomIPPrefixesOperations operations.
/// </summary>
internal partial class CustomIPPrefixesOperations : IServiceOperations<NetworkManagementClient>, ICustomIPPrefixesOperations
{
/// <summary>
/// Initializes a new instance of the CustomIPPrefixesOperations class.
/// </summary>
/// <param name='client'>
/// Reference to the service client.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
internal CustomIPPrefixesOperations(NetworkManagementClient client)
{
if (client == null)
{
throw new System.ArgumentNullException("client");
}
Client = client;
}
/// <summary>
/// Gets a reference to the NetworkManagementClient
/// </summary>
public NetworkManagementClient Client { get; private set; }
/// <summary>
/// Deletes the specified custom IP prefix.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='customIpPrefixName'>
/// The name of the CustomIpPrefix.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse> DeleteWithHttpMessagesAsync(string resourceGroupName, string customIpPrefixName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, customIpPrefixName, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Gets the specified custom IP prefix in a specified resource group.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='customIpPrefixName'>
/// The name of the custom IP prefix.
/// </param>
/// <param name='expand'>
/// Expands referenced resources.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<CustomIpPrefix>> GetWithHttpMessagesAsync(string resourceGroupName, string customIpPrefixName, string expand = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (customIpPrefixName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "customIpPrefixName");
}
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
string apiVersion = "2021-08-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("customIpPrefixName", customIpPrefixName);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("expand", expand);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{customIpPrefixName}", System.Uri.EscapeDataString(customIpPrefixName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (expand != null)
{
_queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<CustomIpPrefix>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<CustomIpPrefix>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Creates or updates a custom IP prefix.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='customIpPrefixName'>
/// The name of the custom IP prefix.
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the create or update custom IP prefix operation.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse<CustomIpPrefix>> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string customIpPrefixName, CustomIpPrefix parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
AzureOperationResponse<CustomIpPrefix> _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, customIpPrefixName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Updates custom IP prefix tags.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='customIpPrefixName'>
/// The name of the custom IP prefix.
/// </param>
/// <param name='parameters'>
/// Parameters supplied to update custom IP prefix tags.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<CustomIpPrefix>> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string customIpPrefixName, TagsObject parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (customIpPrefixName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "customIpPrefixName");
}
if (parameters == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
string apiVersion = "2021-08-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("customIpPrefixName", customIpPrefixName);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{customIpPrefixName}", System.Uri.EscapeDataString(customIpPrefixName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("PATCH");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<CustomIpPrefix>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<CustomIpPrefix>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Gets all the custom IP prefixes in a subscription.
/// </summary>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<CustomIpPrefix>>> ListAllWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
string apiVersion = "2021-08-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IPage<CustomIpPrefix>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<CustomIpPrefix>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Gets all custom IP prefixes in a resource group.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<CustomIpPrefix>>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
string apiVersion = "2021-08-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IPage<CustomIpPrefix>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<CustomIpPrefix>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Deletes the specified custom IP prefix.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='customIpPrefixName'>
/// The name of the CustomIpPrefix.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string customIpPrefixName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (customIpPrefixName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "customIpPrefixName");
}
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
string apiVersion = "2021-08-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("customIpPrefixName", customIpPrefixName);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{customIpPrefixName}", System.Uri.EscapeDataString(customIpPrefixName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("DELETE");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Creates or updates a custom IP prefix.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='customIpPrefixName'>
/// The name of the custom IP prefix.
/// </param>
/// <param name='parameters'>
/// Parameters supplied to the create or update custom IP prefix operation.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<CustomIpPrefix>> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string customIpPrefixName, CustomIpPrefix parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (customIpPrefixName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "customIpPrefixName");
}
if (parameters == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
string apiVersion = "2021-08-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("customIpPrefixName", customIpPrefixName);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{customIpPrefixName}", System.Uri.EscapeDataString(customIpPrefixName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("PUT");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200 && (int)_statusCode != 201)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<CustomIpPrefix>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<CustomIpPrefix>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
// Deserialize Response
if ((int)_statusCode == 201)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<CustomIpPrefix>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Gets all the custom IP prefixes in a subscription.
/// </summary>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<CustomIpPrefix>>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters);
}
// Construct URL
string _url = "{nextLink}";
_url = _url.Replace("{nextLink}", nextPageLink);
List<string> _queryParameters = new List<string>();
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IPage<CustomIpPrefix>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<CustomIpPrefix>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Gets all custom IP prefixes in a resource group.
/// </summary>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<CustomIpPrefix>>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
}
// Construct URL
string _url = "{nextLink}";
_url = _url.Replace("{nextLink}", nextPageLink);
List<string> _queryParameters = new List<string>();
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IPage<CustomIpPrefix>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<CustomIpPrefix>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
}
}
| 46.47466 | 307 | 0.5639 | [
"MIT"
] | ChenTanyi/azure-sdk-for-net | sdk/network/Microsoft.Azure.Management.Network/src/Generated/CustomIPPrefixesOperations.cs | 75,196 | C# |
using OpenQA.Selenium;
namespace WebAddressBookTests
{
public class NavigationHelper : HelperBase
{
private string baseURL;
public NavigationHelper(ApplicationManager manager, string baseURL)
:base(manager)
{
this.baseURL = baseURL;
}
public void GoToHomePage()
{
if(driver.Url == baseURL)
{
return;
}
driver.Navigate().GoToUrl(baseURL);
}
public void GoToGroupsPage()
{
if (driver.Url == baseURL + "group.php"
&& IsElementPresent(By.Name("new")))
{
return;
}
driver.FindElement(By.LinkText("groups")).Click();
}
public void GoToContactPage()
{
driver.FindElement(By.LinkText("add new")).Click();
}
}
}
| 22.625 | 75 | 0.496133 | [
"Apache-2.0"
] | AnastasiaLitv/csharp_training | addressbook-web-tests/addressbook-web-tests/appmanager/NavigationHelper.cs | 907 | C# |
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using System.Collections;
public class UIManager : MonoBehaviour
{
private bool visibleStart;
private bool visibleRestart;
private RawImage background;
private CanvasGroup canvas;
private RawImage shadow;
[SerializeField] private Text ctaStart;
[SerializeField] private Text ctaRestart;
[SerializeField] private TitleManager title;
[SerializeField] private ScoreManager score;
[Header("On \"Tap To Start\" game event:")]
[SerializeField] private UnityEvent start = new UnityEvent();
[Header("On \"Tap To Restart\" game event:")]
[SerializeField] private UnityEvent restart = new UnityEvent();
private void Awake()
{
background = transform.GetChild(0).GetComponent<RawImage>();
shadow = transform.GetChild(1).GetComponent<RawImage>();
canvas = transform.GetComponent<CanvasGroup>();
ctaRestart.color = ColorManager.TRANSPARENT;
ctaStart.color = ColorManager.TRANSPARENT;
Texture2D texture = new Texture2D(1, 2);
texture.SetPixels(new Color[] {
ColorManager.SOLID_BLACK,
ColorManager.TRANSPARENT
});
texture.Apply();
shadow.texture = texture;
shadow.texture.wrapMode = TextureWrapMode.Clamp;
shadow.texture.filterMode = FilterMode.Bilinear;
}
private void Start()
{
StartCoroutine(Initialize());
}
public IEnumerator Initialize()
{
StartCoroutine(title.Initialize());
yield return new WaitForSeconds(2.5f);
background.CrossFadeAlpha(0.0f, 1.0f, false);
shadow.CrossFadeAlpha(0.0f, 0.0f, true);
StartCoroutine(ShowStart(true));
}
private void Update()
{
if (canvas.interactable && Input.GetMouseButtonDown(0))
{
if (visibleStart)
{
StartCoroutine(HideStart());
}
else if (visibleRestart)
{
HideRestart();
}
}
}
private IEnumerator ShowStart(bool initial = false)
{
yield return new WaitForSeconds(
1.0f + System.Convert.ToInt32(!initial) * 0.5f
);
StartCoroutine(FadeCTA(ctaStart));
if (!initial) title.FadeIn();
canvas.interactable = true;
visibleStart = true;
}
public void OnGameOver()
{
StartCoroutine(ShowRestart());
}
private IEnumerator ShowRestart()
{
yield return new WaitForSeconds(0.5f);
shadow.CrossFadeAlpha(1.0f, 0.5f, false);
StartCoroutine(FadeCTA(ctaRestart));
score.ShowBest();
yield return new WaitForSeconds(0.5f);
canvas.interactable = true;
visibleRestart = true;
}
private IEnumerator HideStart()
{
title.FadeOut();
visibleStart = false;
canvas.interactable = false;
StartCoroutine(FadeCTA(ctaStart, false));
yield return new WaitForSeconds(1.0f);
score.ShowCurrent();
start.Invoke();
}
private void HideRestart()
{
visibleRestart = false;
canvas.interactable = false;
StartCoroutine(FadeCTA(ctaRestart, false));
shadow.CrossFadeAlpha(0.0f, 0.5f, false);
StartCoroutine(ShowStart(false));
restart.Invoke();
score.Hide();
}
private IEnumerator FadeCTA(Text cta, bool visible = true, float duration = 0.5f)
{
float startTime = Time.time;
float endTime = Time.time + duration;
Color32 target = visible ? ColorManager.SOLID_WHITE : ColorManager.TRANSPARENT;
Color32 current = visible ? ColorManager.TRANSPARENT : ColorManager.SOLID_WHITE;
while (Time.time < endTime)
{
float time = (Time.time - startTime) / duration;
cta.color = Color32.Lerp(current, target, time);
yield return null;
}
cta.color = target;
}
}
| 25.852564 | 88 | 0.612447 | [
"MIT"
] | UstymUkhman/Stack | Assets/Scripts/UIManager.cs | 4,033 | C# |
#region Copyright notice and license
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using Grpc.Core;
using Grpc.Core.Utils;
using Grpc.Core.Profiling;
namespace Grpc.Core.Internal
{
/// <summary>
/// grpc_call from <c>grpc/grpc.h</c>
/// </summary>
[UnityEngine.Scripting.Preserve]
internal class CallSafeHandle : SafeHandleZeroIsInvalid, INativeCall
{
public static readonly CallSafeHandle NullInstance = new CallSafeHandle();
static readonly NativeMethods Native = NativeMethods.Get();
const uint GRPC_WRITE_BUFFER_HINT = 1;
CompletionQueueSafeHandle completionQueue;
public CallSafeHandle()
{
}
public void Initialize(CompletionQueueSafeHandle completionQueue)
{
this.completionQueue = completionQueue;
}
public void SetCredentials(CallCredentialsSafeHandle credentials)
{
Native.grpcsharp_call_set_credentials(this, credentials).CheckOk();
}
public void StartUnary(UnaryResponseClientHandler callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags)
.CheckOk();
}
}
public void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
{
Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags)
.CheckOk();
}
public void StartClientStreaming(UnaryResponseClientHandler callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
Native.grpcsharp_call_start_client_streaming(this, ctx, metadataArray, callFlags).CheckOk();
}
}
public void StartServerStreaming(ReceivedStatusOnClientHandler callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient()));
Native.grpcsharp_call_start_server_streaming(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, metadataArray, callFlags).CheckOk();
}
}
public void StartDuplexStreaming(ReceivedStatusOnClientHandler callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient()));
Native.grpcsharp_call_start_duplex_streaming(this, ctx, metadataArray, callFlags).CheckOk();
}
}
public void StartSendMessage(SendCompletionHandler callback, byte[] payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
Native.grpcsharp_call_send_message(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, sendEmptyInitialMetadata).CheckOk();
}
}
public void StartSendCloseFromClient(SendCompletionHandler callback)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
Native.grpcsharp_call_send_close_from_client(this, ctx).CheckOk();
}
}
public void StartSendStatusFromServer(SendCompletionHandler callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata,
byte[] optionalPayload, WriteFlags writeFlags)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
var optionalPayloadLength = optionalPayload != null ? new UIntPtr((ulong)optionalPayload.Length) : UIntPtr.Zero;
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
var statusDetailBytes = MarshalUtils.GetBytesUTF8(status.Detail);
Native.grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, statusDetailBytes, new UIntPtr((ulong)statusDetailBytes.Length), metadataArray, sendEmptyInitialMetadata,
optionalPayload, optionalPayloadLength, writeFlags).CheckOk();
}
}
public void StartReceiveMessage(ReceivedMessageHandler callback)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedMessage()));
Native.grpcsharp_call_recv_message(this, ctx).CheckOk();
}
}
public void StartReceiveInitialMetadata(ReceivedResponseHeadersHandler callback)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedInitialMetadata()));
Native.grpcsharp_call_recv_initial_metadata(this, ctx).CheckOk();
}
}
public void StartServerSide(ReceivedCloseOnServerHandler callback)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedCloseOnServerCancelled()));
Native.grpcsharp_call_start_serverside(this, ctx).CheckOk();
}
}
public void StartSendInitialMetadata(SendCompletionHandler callback, MetadataArraySafeHandle metadataArray)
{
using (completionQueue.NewScope())
{
var ctx = BatchContextSafeHandle.Create();
completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
Native.grpcsharp_call_send_initial_metadata(this, ctx, metadataArray).CheckOk();
}
}
public void Cancel()
{
Native.grpcsharp_call_cancel(this).CheckOk();
}
public void CancelWithStatus(Status status)
{
Native.grpcsharp_call_cancel_with_status(this, status.StatusCode, status.Detail).CheckOk();
}
public string GetPeer()
{
using (var cstring = Native.grpcsharp_call_get_peer(this))
{
return cstring.GetValue();
}
}
public AuthContextSafeHandle GetAuthContext()
{
return Native.grpcsharp_call_auth_context(this);
}
protected override bool ReleaseHandle()
{
Native.grpcsharp_call_destroy(handle);
return true;
}
private static uint GetFlags(bool buffered)
{
return buffered ? 0 : GRPC_WRITE_BUFFER_HINT;
}
}
}
| 46.214286 | 226 | 0.675811 | [
"MIT"
] | Bplotka/unity-grpc | lib/gRPC/Core/Internal/CallSafeHandle.cs | 10,352 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("HardcoreMonumentsPlugin")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("HardcoreMonumentsPlugin")]
[assembly: System.Reflection.AssemblyTitleAttribute("HardcoreMonumentsPlugin")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
| 42.458333 | 81 | 0.660451 | [
"Apache-2.0"
] | Wujaszkun/HardcoreMonuments | obj/Debug/netstandard2.0/HardcoreMonumentsPlugin.AssemblyInfo.cs | 1,019 | C# |
// MIT License
// Copyright (c) 2016 Geometry Gym Pty Ltd
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial
// portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using GeometryGym.STEP;
namespace GeometryGym.Ifc
{
[Serializable]
public partial class IfcTable : BaseClassIfc, IfcMetricValueSelect, IfcObjectReferenceSelect, NamedObjectIfc
{
internal string mName = "$"; //: OPTIONAL IfcLabel;
private List<int> mRows = new List<int>();// OPTIONAL LIST [1:?] OF IfcTableRow;
private List<int> mColumns = new List<int>();// : OPTIONAL LIST [1:?] OF IfcTableColumn;
public string Name { get { return (mName == "$" ? "" : ParserIfc.Decode(mName)); } set { mName = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public ReadOnlyCollection<IfcTableRow> Rows { get { return new ReadOnlyCollection<IfcTableRow>(mRows.ConvertAll(x => mDatabase[x] as IfcTableRow)); } }
public ReadOnlyCollection<IfcTableColumn> Columns { get { return new ReadOnlyCollection<IfcTableColumn>(mColumns.ConvertAll(x => mDatabase[x] as IfcTableColumn)); } }
internal IfcTable() : base() { }
public IfcTable(DatabaseIfc db) : base(db) { }
internal IfcTable(DatabaseIfc db, IfcTable t) : base(db) { mName = t.mName; t.Rows.ToList().ForEach(x => addRow(db.Factory.Duplicate(t) as IfcTableRow)); t.Columns.ToList().ForEach(x => addColumn(db.Factory.Duplicate(x) as IfcTableColumn)); }
public IfcTable(string name, List<IfcTableRow> rows, List<IfcTableColumn> cols) : base(rows == null || rows.Count == 0 ? cols[0].mDatabase : rows[0].mDatabase)
{
Name = name.Replace("'", "");
rows.ForEach(x => addRow(x));
cols.ForEach(x => addColumn(x));
}
internal void addRow(IfcTableRow row) { mRows.Add(row.mIndex); }
internal void addColumn(IfcTableColumn column) { mColumns.Add(column.mIndex); }
}
[Serializable]
public partial class IfcTableColumn : BaseClassIfc, NamedObjectIfc
{
internal string mIdentifier = "$";// : OPTIONAL IfcIdentifier;
internal string mName = "$";// : OPTIONAL IfcLabel;
internal string mDescription = "$";// : OPTIONAL IfcText;
internal int mUnit;// : OPTIONAL IfcUnit;
private int mReferencePath;// : OPTIONAL IfcReference;
public string Identifier { get { return (mIdentifier == "$" ? "" : ParserIfc.Decode(mIdentifier)); } set { mIdentifier = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public string Name { get { return (mName == "$" ? "" : ParserIfc.Decode(mName)); } set { mName = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public string Description { get { return (mDescription == "$" ? "" : ParserIfc.Decode(mDescription)); } set { mDescription = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public IfcUnit Unit { get { return mDatabase[mUnit] as IfcUnit; } set { mUnit = (value == null ? 0 : value.Index); } }
public IfcReference ReferencePath { get { return mDatabase[mReferencePath] as IfcReference; } set { mReferencePath = (value == null ? 0 : value.mIndex); } }
internal IfcTableColumn() : base() { }
public IfcTableColumn(DatabaseIfc db) : base(db) { }
internal IfcTableColumn(DatabaseIfc db, IfcTableColumn c) : base(db, c) { mIdentifier = c.mIdentifier; mName = c.mName; mDescription = c.mDescription; if (c.mUnit > 0) Unit = db.Factory.Duplicate(c.mDatabase[c.mUnit]) as IfcUnit; if (c.mReferencePath > 0) ReferencePath = db.Factory.Duplicate(c.ReferencePath) as IfcReference; }
}
[Serializable]
public partial class IfcTableRow : BaseClassIfc
{
internal List<IfcValue> mRowCells = new List<IfcValue>();// : OPTIONAL LIST [1:?] OF IfcValue;
internal bool mIsHeading = false; //: : OPTIONAL BOOLEAN;
public ReadOnlyCollection<IfcValue> RowCells { get { return new ReadOnlyCollection<IfcValue>(mRowCells); } }
public bool IsHeading { get { return mIsHeading; } set { mIsHeading = value; } }
internal IfcTableRow() : base() { }
internal IfcTableRow(DatabaseIfc db, IfcTableRow r) : base(db, r) { mRowCells = r.mRowCells; mIsHeading = r.mIsHeading; }
public IfcTableRow(DatabaseIfc db, IfcValue val) : this(db, new List<IfcValue>() { val }, false) { }
public IfcTableRow(DatabaseIfc db, List<IfcValue> vals, bool isHeading) : base(db)
{
mRowCells.AddRange(vals);
mIsHeading = isHeading;
}
}
[Serializable]
public partial class IfcTank : IfcFlowStorageDevice //IFC4
{
internal IfcTankTypeEnum mPredefinedType = IfcTankTypeEnum.NOTDEFINED;// OPTIONAL : IfcTankTypeEnum;
public IfcTankTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTank() : base() { }
internal IfcTank(DatabaseIfc db, IfcTank t, DuplicateOptions options) : base(db, t, options) { mPredefinedType = t.mPredefinedType; }
public IfcTank(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation, IfcDistributionSystem system) : base(host, placement, representation, system) { }
}
[Serializable]
public partial class IfcTankType : IfcFlowStorageDeviceType
{
internal IfcTankTypeEnum mPredefinedType = IfcTankTypeEnum.NOTDEFINED;// : IfcDuctFittingTypeEnum;
public IfcTankTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTankType() : base() { }
internal IfcTankType(DatabaseIfc db, IfcTankType t, DuplicateOptions options) : base(db, t, options) { mPredefinedType = t.mPredefinedType; }
public IfcTankType(DatabaseIfc db, string name, IfcTankTypeEnum t) : base(db) { Name = name; mPredefinedType = t; }
}
[Serializable]
public partial class IfcTask : IfcProcess //SUPERTYPE OF (ONEOF(IfcMove,IfcOrderAction) both DEPRECATED IFC4)
{
//internal string mTaskId; // : IfcIdentifier; IFC4 midentification at IfcProcess
private string mStatus = "";// : OPTIONAL IfcLabel;
internal string mWorkMethod = "";// : OPTIONAL IfcLabel;
internal bool mIsMilestone = false;// : BOOLEAN
internal int mPriority;// : OPTIONAL INTEGER IFC4
internal int mTaskTime;// : OPTIONAL IfcTaskTime; IFC4
internal IfcTaskTypeEnum mPredefinedType = IfcTaskTypeEnum.NOTDEFINED;// : OPTIONAL IfcTaskTypeEnum IFC4
//INVERSE
internal List<IfcRelAssignsTasks> mOwningControls = new List<IfcRelAssignsTasks>(); //gg
public string Status { get { return mStatus; } set { mStatus = value; } }
public string WorkMethod { get { return mWorkMethod; } set { mWorkMethod = value; } }
public bool IsMilestone { get { return mIsMilestone; } set { mIsMilestone = value; } }
public int Priority { get { return mPriority; } set { mPriority = value; } }
internal IfcTaskTime TaskTime { get { return mDatabase[mTaskTime] as IfcTaskTime; } set { mTaskTime = value == null ? 0 : value.mIndex; } }
public IfcTaskTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTask() : base() { }
internal IfcTask(DatabaseIfc db, IfcTask t, DuplicateOptions options) : base(db, t, options)
{
mStatus = t.mStatus;
mWorkMethod = t.mWorkMethod;
mIsMilestone = t.mIsMilestone;
mPriority = t.mPriority;
if (t.mTaskTime > 0)
TaskTime = db.Factory.Duplicate(t.TaskTime) as IfcTaskTime;
mPredefinedType = t.mPredefinedType;
}
public IfcTask(DatabaseIfc db) : base(db) { }
public IfcTask(IfcTask task) : base(task)
{
mStatus = task.mStatus;
mWorkMethod = task.mWorkMethod;
mIsMilestone = task.mIsMilestone;
mPriority = task.mPriority;
mTaskTime = task.mTaskTime;
mPredefinedType = task.mPredefinedType;
}
}
[Serializable]
public partial class IfcTaskTime : IfcSchedulingTime //IFC4
{
internal IfcTaskDurationEnum mDurationType = IfcTaskDurationEnum.NOTDEFINED; // : OPTIONAL IfcTaskDurationEnum;
internal string mScheduleDuration = "$";// : OPTIONAL IfcDuration;
internal DateTime mScheduleStart = DateTime.MinValue, mScheduleFinish = DateTime.MinValue, mEarlyStart = DateTime.MinValue, mEarlyFinish = DateTime.MinValue, mLateStart = DateTime.MinValue, mLateFinish = DateTime.MinValue; //: OPTIONAL IfcDateTime;
internal string mFreeFloat = "$", mTotalFloat = "$";// : OPTIONAL IfcDuration;
internal bool mIsCritical;// : OPTIONAL BOOLEAN;
internal DateTime mStatusTime = DateTime.MinValue;// : OPTIONAL IfcDateTime;
internal string mActualDuration = "$";// : OPTIONAL IfcDuration;
internal DateTime mActualStart = DateTime.MinValue, mActualFinish = DateTime.MinValue;// : OPTIONAL IfcDateTime;
internal string mRemainingTime = "$";// : OPTIONAL IfcDuration;
internal double mCompletion = double.NaN;// : OPTIONAL IfcPositiveRatioMeasure;
public IfcTaskDurationEnum DurationType { get { return mDurationType; } set { mDurationType = value; } }
public IfcDuration ScheduleDuration { get { return IfcDuration.Convert(mScheduleDuration); } set { mScheduleDuration = IfcDuration.Convert(value); } }
public DateTime ScheduleStart { get { return mScheduleStart; } set { mScheduleStart = value; } }
public DateTime ScheduleFinish { get { return mScheduleFinish; } set { mScheduleFinish = value; } }
public DateTime EarlyStart { get { return mEarlyStart; } set { mEarlyStart = value; } }
public DateTime EarlyFinish { get { return mEarlyFinish; } set { mEarlyFinish = value; } }
public DateTime LateStart { get { return mLateStart; } set { mLateStart = value; } }
public DateTime LateFinish { get { return mLateFinish; } set { mLateFinish = value; } }
public IfcDuration FreeFloat { get { return IfcDuration.Convert(mFreeFloat); } set { mFreeFloat = IfcDuration.Convert(value); } }
public IfcDuration TotalFloat { get { return IfcDuration.Convert(mTotalFloat); } set { mTotalFloat = IfcDuration.Convert(value); } }
public bool IsCritical { get { return mIsCritical; } set { mIsCritical = value; } }
public DateTime StatusTime { get { return mStatusTime; } set { mStatusTime = value; } }
public IfcDuration ActualDuration { get { return IfcDuration.Convert(mActualDuration); } set { mActualDuration = IfcDuration.Convert(value); } }
public DateTime ActualStart { get { return mActualStart; } set { mActualStart = value; } }
public DateTime ActualFinish { get { return mActualFinish; } set { mActualFinish = value; } }
public IfcDuration RemainingTime { get { return IfcDuration.Convert(mRemainingTime); } set { mRemainingTime = IfcDuration.Convert(value); } }
public double Completion { get { return mCompletion; } set { mCompletion = value; } }
internal IfcTaskTime() : base() { }
internal IfcTaskTime(DatabaseIfc db, IfcTaskTime t) : base(db, t)
{
mDurationType = t.mDurationType; mScheduleDuration = t.mScheduleDuration; mScheduleStart = t.mScheduleStart; mScheduleFinish = t.mScheduleFinish;
mEarlyStart = t.mEarlyStart; mEarlyFinish = t.mEarlyFinish; mLateStart = t.mLateStart; mLateFinish = t.mLateFinish; mFreeFloat = t.mFreeFloat; mTotalFloat = t.mTotalFloat;
mIsCritical = t.mIsCritical; mStatusTime = t.mStatusTime; mActualDuration = t.mActualDuration; mActualStart = t.mActualStart; mActualFinish = t.mActualFinish;
mRemainingTime = t.mRemainingTime; mCompletion = t.mCompletion;
}
public IfcTaskTime(DatabaseIfc db) : base(db) { }
}
[Serializable]
public partial class IfcTaskTimeRecurring : IfcTaskTime
{
private IfcRecurrencePattern mRecurrence = null; //: IfcRecurrencePattern;
public IfcRecurrencePattern Recurrence { get { return mRecurrence; } set { mRecurrence = value; } }
public IfcTaskTimeRecurring() : base() { }
public IfcTaskTimeRecurring(IfcRecurrencePattern recurrence)
: base(recurrence.Database) { Recurrence = recurrence; }
}
[Serializable]
public partial class IfcTaskType : IfcTypeProcess //IFC4
{
internal IfcTaskTypeEnum mPredefinedType = IfcTaskTypeEnum.NOTDEFINED;// : IfcTaskTypeEnum;
private string mWorkMethod = "$";// : OPTIONAL IfcLabel;
public IfcTaskTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
public string WorkMethod { get { return (mWorkMethod == "$" ? "" : ParserIfc.Decode(mWorkMethod)); } set { mWorkMethod = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
internal IfcTaskType() : base() { }
internal IfcTaskType(DatabaseIfc db, IfcTaskType t, DuplicateOptions options) : base(db, t, options) { mPredefinedType = t.mPredefinedType; mWorkMethod = t.mWorkMethod; }
public IfcTaskType(DatabaseIfc m, string name, IfcTaskTypeEnum t) : base(m) { Name = name; mPredefinedType = t; }
}
[Serializable]
public partial class IfcTelecomAddress : IfcAddress
{
internal LIST<string> mTelephoneNumbers = new LIST<string>();// : OPTIONAL LIST [1:?] OF IfcLabel;
internal LIST<string> mFacsimileNumbers = new LIST<string>();// : OPTIONAL LIST [1:?] OF IfcLabel;
internal string mPagerNumber = "";// :OPTIONAL IfcLabel;
internal LIST<string> mElectronicMailAddresses = new LIST<string>();// : OPTIONAL LIST [1:?] OF IfcLabel;
internal string mWWWHomePageURL = "";// : OPTIONAL IfcLabel;
internal LIST<string> mMessagingIDs = new LIST<string>();// : OPTIONAL LIST [1:?] OF IfcURIReference //IFC4
public LIST<string> TelephoneNumbers { get { return mTelephoneNumbers; } }
public LIST<string> FacsimileNumbers { get { return mFacsimileNumbers; } }
public string PagerNumber { get { return mPagerNumber; } set { mPagerNumber = value; } }
public LIST<string> ElectronicMailAddresses { get { return mElectronicMailAddresses; } }
public string WWWHomePageURL { get { return mWWWHomePageURL; } set { mWWWHomePageURL = value; } }
public LIST<string> MessagingIDs { get { return mMessagingIDs; } }
internal IfcTelecomAddress() : base() { }
internal IfcTelecomAddress(DatabaseIfc db, IfcTelecomAddress a) : base(db, a) { mTelephoneNumbers.AddRange(a.mTelephoneNumbers); mFacsimileNumbers.AddRange(a.mFacsimileNumbers); mPagerNumber = a.mPagerNumber; mElectronicMailAddresses.AddRange(a.mElectronicMailAddresses); mWWWHomePageURL = a.mWWWHomePageURL; mMessagingIDs.AddRange(a.mMessagingIDs); }
public IfcTelecomAddress(DatabaseIfc db) : base(db) { }
}
[Serializable]
public partial class IfcTendon : IfcReinforcingElement
{
internal IfcTendonTypeEnum mPredefinedType = IfcTendonTypeEnum.NOTDEFINED;// : IfcTendonTypeEnum;//
internal double mNominalDiameter;// : IfcPositiveLengthMeasure;
internal double mCrossSectionArea;// : IfcAreaMeasure;
internal double mTensionForce;// : OPTIONAL IfcForceMeasure;
internal double mPreStress;// : OPTIONAL IfcPressureMeasure;
internal double mFrictionCoefficient;// //: OPTIONAL IfcNormalisedRatioMeasure;
internal double mAnchorageSlip;// : OPTIONAL IfcPositiveLengthMeasure;
internal double mMinCurvatureRadius;// : OPTIONAL IfcPositiveLengthMeasure;
public IfcTendonTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTendon() : base() { }
internal IfcTendon(DatabaseIfc db, IfcTendon t, DuplicateOptions options) : base(db, t, options)
{
mPredefinedType = t.mPredefinedType;
mNominalDiameter = t.mNominalDiameter;
mCrossSectionArea = t.mCrossSectionArea;
mTensionForce = t.mTensionForce;
mPreStress = t.mPreStress;
mFrictionCoefficient = t.mFrictionCoefficient;
mAnchorageSlip = t.mAnchorageSlip;
mMinCurvatureRadius = t.mMinCurvatureRadius;
}
public IfcTendon(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation) : base(host, placement, representation) { }
public IfcTendon(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation, double diam, double area)
: base(host, placement, representation)
{
mNominalDiameter = diam;
mCrossSectionArea = area;
}
}
[Serializable]
public partial class IfcTendonAnchor : IfcReinforcingElement
{
internal IfcTendonAnchorTypeEnum mPredefinedType = IfcTendonAnchorTypeEnum.NOTDEFINED;// : OPTIONAL IfcTendonAnchorTypeEnum;
public IfcTendonAnchorTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTendonAnchor() : base() { }
internal IfcTendonAnchor(DatabaseIfc db, IfcTendonAnchor a, DuplicateOptions options) : base(db, a, options) { mPredefinedType = a.mPredefinedType; }
public IfcTendonAnchor(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation) : base(host, placement, representation) { }
}
[Serializable]
public partial class IfcTendonAnchorType : IfcReinforcingElementType
{
private IfcTendonAnchorTypeEnum mPredefinedType = IfcTendonAnchorTypeEnum.NOTDEFINED; //: IfcTendonAnchorTypeEnum;
public IfcTendonAnchorTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
public IfcTendonAnchorType() : base() { }
public IfcTendonAnchorType(DatabaseIfc db, string name, IfcTendonAnchorTypeEnum predefinedType)
: base(db) { Name = name; PredefinedType = predefinedType; }
}
[Serializable]
public partial class IfcTendonConduit : IfcReinforcingElement
{
private IfcTendonConduitTypeEnum mPredefinedType = IfcTendonConduitTypeEnum.NOTDEFINED; //: IfcTendonConduitTypeEnum;
public IfcTendonConduitTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
public IfcTendonConduit() : base() { }
public IfcTendonConduit(DatabaseIfc db, IfcTendonConduitTypeEnum predefinedType)
: base(db) { PredefinedType = predefinedType; }
public IfcTendonConduit(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation) : base(host, placement, representation) { }
}
[Serializable]
public partial class IfcTendonConduitType : IfcReinforcingElementType
{
private IfcTendonConduitTypeEnum mPredefinedType = IfcTendonConduitTypeEnum.NOTDEFINED; //: IfcTendonConduitTypeEnum;
public IfcTendonConduitTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
public IfcTendonConduitType() : base() { }
public IfcTendonConduitType(DatabaseIfc db, string name, IfcTendonConduitTypeEnum predefinedType)
: base(db, name) { PredefinedType = predefinedType; }
}
[Serializable]
public partial class IfcTendonType : IfcReinforcingElementType //IFC4
{
internal IfcTendonTypeEnum mPredefinedType = IfcTendonTypeEnum.NOTDEFINED;// : IfcTendonType; //IFC4
private double mNominalDiameter;// : IfcPositiveLengthMeasure; IFC4 OPTIONAL
internal double mCrossSectionArea;// : IfcAreaMeasure; IFC4 OPTIONAL
internal double mSheathDiameter;// : OPTIONAL IfcPositiveLengthMeasure;
public IfcTendonTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
public double NominalDiameter { get { return mNominalDiameter; } set { mNominalDiameter = value; } }
internal IfcTendonType() : base() { }
internal IfcTendonType(DatabaseIfc db, IfcTendonType t, DuplicateOptions options) : base(db, t, options)
{
mPredefinedType = t.mPredefinedType;
mNominalDiameter = t.mNominalDiameter;
mCrossSectionArea = t.mCrossSectionArea;
mSheathDiameter = t.mSheathDiameter;
}
public IfcTendonType(DatabaseIfc db, string name, IfcTendonTypeEnum type)
: base(db) { Name = name; mPredefinedType = type; }
}
[Obsolete("DEPRECATED IFC4", false)]
[Serializable]
public partial class IfcTerminatorSymbol : IfcAnnotationSymbolOccurrence // DEPRECATED IFC4
{
internal int mAnnotatedCurve;// : IfcAnnotationCurveOccurrence;
internal IfcTerminatorSymbol() : base() { }
//internal IfcTerminatorSymbol(IfcTerminatorSymbol i) : base(i) { mAnnotatedCurve = i.mAnnotatedCurve; }
}
[Serializable]
public abstract partial class IfcTessellatedFaceSet : IfcTessellatedItem, IfcBooleanOperand //ABSTRACT SUPERTYPE OF(IfcTriangulatedFaceSet, IfcPolygonalFaceSet )
{
internal IfcCartesianPointList mCoordinates;// : IfcCartesianPointList;
// INVERSE
internal IfcIndexedColourMap mHasColours = null;// : SET [0:1] OF IfcIndexedColourMap FOR MappedTo;
internal List<IfcIndexedTextureMap> mHasTextures = new List<IfcIndexedTextureMap>();// : SET [0:?] OF IfcIndexedTextureMap FOR MappedTo;
public IfcCartesianPointList Coordinates { get { return mCoordinates; } set { mCoordinates = value; } }
public IfcIndexedColourMap HasColours { get { return mHasColours; } set { mHasColours = value; } }
public ReadOnlyCollection<IfcIndexedTextureMap> HasTextures { get { return new ReadOnlyCollection<IfcIndexedTextureMap>(mHasTextures); } }
protected IfcTessellatedFaceSet() : base() { }
protected IfcTessellatedFaceSet(DatabaseIfc db, IfcTessellatedFaceSet s, DuplicateOptions options) : base(db, s, options) { Coordinates = db.Factory.Duplicate(s.Coordinates) as IfcCartesianPointList; }
protected IfcTessellatedFaceSet(IfcCartesianPointList pl) : base(pl.mDatabase) { Coordinates = pl; }
}
[Serializable]
public abstract partial class IfcTessellatedItem : IfcGeometricRepresentationItem //IFC4
{
protected IfcTessellatedItem() : base() { }
protected IfcTessellatedItem(DatabaseIfc db, IfcTessellatedItem i, DuplicateOptions options) : base(db, i, options) { }
protected IfcTessellatedItem(DatabaseIfc db) : base(db) { }
}
public interface IfcTextFontSelect : IBaseClassIfc { } // SELECT(IfcPreDefinedTextFont, IfcExternallyDefinedTextFont);
[Serializable]
public partial class IfcTextLiteral : IfcGeometricRepresentationItem //SUPERTYPE OF (IfcTextLiteralWithExtent)
{
internal string mLiteral = "";// : IfcPresentableText;
internal int mPlacement;// : IfcAxis2Placement;
internal IfcTextPath mPath;// : IfcTextPath;
public string Literal { get { return ParserIfc.Decode(mLiteral); } set { mLiteral = ParserIfc.Encode(value); } }
public IfcAxis2Placement Placement { get { return mDatabase[mPlacement] as IfcAxis2Placement; } }
public IfcTextPath Path { get { return mPath; } set { mPath = value; } }
internal IfcTextLiteral() : base() { }
internal IfcTextLiteral(DatabaseIfc db, IfcTextLiteral l, DuplicateOptions options) : base(db, l, options) { mLiteral = l.mLiteral; mPlacement = db.Factory.Duplicate(l.mDatabase[l.mPlacement]).mIndex; mPath = l.mPath; }
}
[Serializable]
public partial class IfcTextLiteralWithExtent : IfcTextLiteral
{
internal int mExtent;// : IfcPlanarExtent;
internal string mBoxAlignment;// : IfcBoxAlignment;
public IfcPlanarExtent Extent { get { return mDatabase[mExtent] as IfcPlanarExtent; } }
internal IfcTextLiteralWithExtent() : base() { }
//internal IfcTextLiteralWithExtent(IfcTextLiteralWithExtent o) : base(o) { mExtent = o.mExtent; mBoxAlignment = o.mBoxAlignment; }
}
[Serializable]
public partial class IfcTextStyle : IfcPresentationStyle, IfcPresentationStyleSelect
{
internal int mTextCharacterAppearance;// : OPTIONAL IfcCharacterStyleSelect;
internal int mTextStyle;// : OPTIONAL IfcTextStyleSelect;
internal int mTextFontStyle;// : IfcTextFontSelect;
internal bool mModelOrDraughting = true;// : OPTIONAL BOOLEAN; IFC4CHANGE
internal IfcTextStyle() : base() { }
// internal IfcTextStyle(IfcTextStyle v) : base(v) { mTextCharacterAppearance = v.mTextCharacterAppearance; mTextStyle = v.mTextStyle; mTextFontStyle = v.mTextFontStyle; mModelOrDraughting = v.mModelOrDraughting; }
}
[Serializable]
public partial class IfcTextStyleFontModel : IfcPreDefinedTextFont
{
internal List<string> mFontFamily = new List<string>(1);// : OPTIONAL LIST [1:?] OF IfcTextFontName;
internal string mFontStyle = "$";// : OPTIONAL IfcFontStyle; ['normal','italic','oblique'];
internal string mFontVariant = "$";// : OPTIONAL IfcFontVariant; ['normal','small-caps'];
internal string mFontWeight = "$";// : OPTIONAL IfcFontWeight; // ['normal','small-caps','100','200','300','400','500','600','700','800','900'];
internal string mFontSize;// : IfcSizeSelect; IfcSizeSelect = SELECT (IfcRatioMeasure ,IfcLengthMeasure ,IfcDescriptiveMeasure ,IfcPositiveLengthMeasure ,IfcNormalisedRatioMeasure ,IfcPositiveRatioMeasure);
internal IfcTextStyleFontModel() : base() { }
internal IfcTextStyleFontModel(DatabaseIfc db, IfcTextStyleFontModel m) : base(db, m)
{
// mFontFamily = new List<string>(i.mFontFamily.ToArray());
mFontStyle = m.mFontStyle;
mFontVariant = m.mFontVariant;
mFontWeight = m.mFontWeight;
mFontSize = m.mFontSize;
}
}
[Serializable]
public partial class IfcTextStyleForDefinedFont : IfcPresentationItem
{
internal int mColour;// : IfcColour;
internal int mBackgroundColour;// : OPTIONAL IfcColour;
internal IfcTextStyleForDefinedFont() : base() { }
// internal IfcTextStyleForDefinedFont(IfcTextStyleForDefinedFont o) : base() { mColour = o.mColour; mBackgroundColour = o.mBackgroundColour; }
}
[Serializable]
public partial class IfcTextStyleTextModel : IfcPresentationItem
{
private IfcSizeSelect mTextIndent = null; //: OPTIONAL IfcSizeSelect;
private string mTextAlign = ""; //: OPTIONAL IfcTextAlignment;
private string mTextDecoration = ""; //: OPTIONAL IfcTextDecoration;
private IfcSizeSelect mLetterSpacing = null; //: OPTIONAL IfcSizeSelect;
private IfcSizeSelect mWordSpacing = null; //: OPTIONAL IfcSizeSelect;
private string mTextTransform = ""; //: OPTIONAL IfcTextTransformation;
private IfcSizeSelect mLineHeight = null; //: OPTIONAL IfcSizeSelect;
public IfcSizeSelect TextIndent { get { return mTextIndent; } set { mTextIndent = value; } }
public string TextAlign { get { return mTextAlign; } set { mTextAlign = value; } }
public string TextDecoration { get { return mTextDecoration; } set { mTextDecoration = value; } }
public IfcSizeSelect LetterSpacing { get { return mLetterSpacing; } set { mLetterSpacing = value; } }
public IfcSizeSelect WordSpacing { get { return mWordSpacing; } set { mWordSpacing = value; } }
public string TextTransform { get { return mTextTransform; } set { mTextTransform = value; } }
public IfcSizeSelect LineHeight { get { return mLineHeight; } set { mLineHeight = value; } }
public IfcTextStyleTextModel() : base() { }
public IfcTextStyleTextModel(DatabaseIfc db) : base(db) { }
}
//[Obsolete("DEPRECATED IFC4", false)]
//ENTITY IfcTextStyleWithBoxCharacteristics; // DEPRECATED IFC4
[Serializable]
public abstract partial class IfcTextureCoordinate : IfcPresentationItem //ABSTRACT SUPERTYPE OF(ONEOF(IfcIndexedTextureMap, IfcTextureCoordinateGenerator, IfcTextureMap))
{
internal List<int> mMaps = new List<int>();// : LIST [1:?] OF IfcSurfaceTexture
public ReadOnlyCollection<IfcSurfaceTexture> Maps { get { return new ReadOnlyCollection<IfcSurfaceTexture>(mMaps.ConvertAll(x => mDatabase[x] as IfcSurfaceTexture)); } }
internal IfcTextureCoordinate() : base() { }
internal IfcTextureCoordinate(DatabaseIfc db, IfcTextureCoordinate c) : base(db, c) { c.Maps.ToList().ForEach(x => addMap(db.Factory.Duplicate(x) as IfcSurfaceTexture)); }
public IfcTextureCoordinate(IEnumerable<IfcSurfaceTexture> maps) : base(maps.First().Database) { mMaps.AddRange(maps.Select(x => x.mIndex)); }
internal void addMap(IfcSurfaceTexture map) { mMaps.Add(map.mIndex); }
}
[Serializable]
public partial class IfcTextureCoordinateGenerator : IfcTextureCoordinate
{
private string mMode = ""; //: IfcLabel;
private LIST<double> mParameter = new LIST<double>(); //: OPTIONAL LIST[1:?] OF IfcReal;
public string Mode { get { return mMode; } set { mMode = value; } }
public LIST<double> Parameter { get { return mParameter; } set { mParameter = value; } }
public IfcTextureCoordinateGenerator() : base() { }
public IfcTextureCoordinateGenerator(IEnumerable<IfcSurfaceTexture> maps, string mode)
: base(maps) { Mode = mode; }
}
[Serializable]
public partial class IfcTextureMap : IfcTextureCoordinate
{
private LIST<IfcTextureVertex> mVertices = new LIST<IfcTextureVertex>(); //: LIST[3:?] OF IfcTextureVertex;
private IfcFace mMappedTo = null; //: IfcFace;
public LIST<IfcTextureVertex> Vertices { get { return mVertices; } set { mVertices = value; } }
public IfcFace MappedTo { get { return mMappedTo; } set { mMappedTo = value; } }
public IfcTextureMap() : base() { }
public IfcTextureMap(IEnumerable<IfcSurfaceTexture> maps, IEnumerable<IfcTextureVertex> vertices, IfcFace mappedTo)
: base(maps)
{
Vertices.AddRange(vertices);
MappedTo = mappedTo;
}
}
[Serializable]
public partial class IfcTextureVertex : IfcPresentationItem
{
private LIST<double> mCoordinates = new LIST<double>(); //: LIST[2:2] OF IfcParameterValue;
public LIST<double> Coordinates { get { return mCoordinates; } set { mCoordinates = value; } }
public IfcTextureVertex() : base() { }
public IfcTextureVertex(DatabaseIfc db, IEnumerable<double> coordinates)
: base(db) { Coordinates.AddRange(coordinates); }
}
[Serializable]
public partial class IfcTextureVertexList : IfcPresentationItem
{
internal double[][] mTexCoordsList = new double[0][];// : LIST [1:?] OF IfcSurfaceTexture
internal IfcTextureVertexList() : base() { }
internal IfcTextureVertexList(DatabaseIfc db, IfcTextureVertexList l) : base(db, l) { mTexCoordsList = l.mTexCoordsList; }
public IfcTextureVertexList(DatabaseIfc m, IEnumerable<Tuple<double, double>> coords) : base(m) { mTexCoordsList = coords.Select(x => new double[] { x.Item1, x.Item2 }).ToArray(); }
}
[Obsolete("DEPRECATED IFC4", false)]
[Serializable]
public partial class IfcThermalMaterialProperties : IfcMaterialProperties // DEPRECATED IFC4
{
internal double mSpecificHeatCapacity = double.NaN;// : OPTIONAL IfcSpecificHeatCapacityMeasure;
internal double mBoilingPoint = double.NaN;// : OPTIONAL IfcThermodynamicTemperatureMeasure;
internal double mFreezingPoint = double.NaN;// : OPTIONAL IfcThermodynamicTemperatureMeasure;
internal double mThermalConductivity = double.NaN;// : OPTIONAL IfcThermalConductivityMeasure;
internal IfcThermalMaterialProperties() : base() { }
internal IfcThermalMaterialProperties(DatabaseIfc db, IfcThermalMaterialProperties p, DuplicateOptions options) : base(db, p, options) { mSpecificHeatCapacity = p.mSpecificHeatCapacity; mBoilingPoint = p.mBoilingPoint; mFreezingPoint = p.mFreezingPoint; mThermalConductivity = p.mThermalConductivity; }
}
public interface IfcTimeOrRatioSelect { } // IFC4 IfcRatioMeasure, IfcDuration
[Serializable]
public partial class IfcTimePeriod : BaseClassIfc // IFC4
{
internal string mStart; //: IfcTime;
internal string mFinish; //: IfcTime;
internal IfcTimePeriod() : base() { }
internal IfcTimePeriod(IfcTimePeriod m) : base() { mStart = m.mStart; mFinish = m.mFinish; }
public IfcTimePeriod(DatabaseIfc m, DateTime start, DateTime finish) : base(m) { mStart = IfcTime.convert(start); mFinish = IfcTime.convert(finish); }
}
[Serializable]
public abstract partial class IfcTimeSeries : BaseClassIfc, IfcMetricValueSelect, IfcObjectReferenceSelect, IfcResourceObjectSelect, NamedObjectIfc
{ // ABSTRACT SUPERTYPE OF (ONEOF(IfcIrregularTimeSeries,IfcRegularTimeSeries));
internal string mName = "$";// : OPTIONAL IfcLabel;
internal string mDescription;// : OPTIONAL IfcText;
internal int mStartTime;// : IfcDateTimeSelect;
internal int mEndTime;// : IfcDateTimeSelect;
internal IfcTimeSeriesDataTypeEnum mTimeSeriesDataType = IfcTimeSeriesDataTypeEnum.NOTDEFINED;// : IfcTimeSeriesDataTypeEnum;
internal IfcDataOriginEnum mDataOrigin = IfcDataOriginEnum.NOTDEFINED;// : IfcDataOriginEnum;
internal string mUserDefinedDataOrigin = "$";// : OPTIONAL IfcLabel;
internal int mUnit;// : OPTIONAL IfcUnit;
//INVERSE
private SET<IfcExternalReferenceRelationship> mHasExternalReference = new SET<IfcExternalReferenceRelationship>(); //IFC4 SET [0:?] OF IfcExternalReferenceRelationship FOR RelatedResourceObjects;
internal List<IfcResourceConstraintRelationship> mHasConstraintRelationships = new List<IfcResourceConstraintRelationship>(); //gg
public string Name { get { return (mName == "$" ? "" : ParserIfc.Decode(mName)); } set { mName = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public SET<IfcExternalReferenceRelationship> HasExternalReference { get { return mHasExternalReference; } set { mHasExternalReference.Clear(); if (value != null) { mHasExternalReference.CollectionChanged -= mHasExternalReference_CollectionChanged; mHasExternalReference = value; mHasExternalReference.CollectionChanged += mHasExternalReference_CollectionChanged; } } }
public ReadOnlyCollection<IfcResourceConstraintRelationship> HasConstraintRelationships { get { return new ReadOnlyCollection<IfcResourceConstraintRelationship>(mHasConstraintRelationships); } }
protected IfcTimeSeries() : base() { }
//protected IfcTimeSeries(DatabaseIfc db, IfcTimeSeries i)
// : base(db,i)
//{
// mName = i.mName;
// mDescription = i.mDescription;
// mStartTime = i.mStartTime;
// mEndTime = i.mEndTime;
// mTimeSeriesDataType = i.mTimeSeriesDataType;
// mDataOrigin = i.mDataOrigin;
// mUserDefinedDataOrigin = i.mUserDefinedDataOrigin;
// mUnit = i.mUnit;
//}
protected IfcTimeSeries(DatabaseIfc db) : base(db) { }
protected IfcTimeSeries(DatabaseIfc db, string name, DateTime startTime, DateTime endTime, IfcTimeSeriesDataTypeEnum timeSeriesDataType, IfcDataOriginEnum dataOrigin)
: base(db)
{
Name = name;
//mStartTime = startTime;
//mEndTime = endTime;
#warning TODO
mTimeSeriesDataType = timeSeriesDataType;
mDataOrigin = dataOrigin;
}
protected override void initialize()
{
base.initialize();
mHasExternalReference.CollectionChanged += mHasExternalReference_CollectionChanged;
}
private void mHasExternalReference_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (mDatabase != null && mDatabase.IsDisposed())
return;
if (e.NewItems != null)
{
foreach (IfcExternalReferenceRelationship r in e.NewItems)
{
if (!r.RelatedResourceObjects.Contains(this))
r.RelatedResourceObjects.Add(this);
}
}
if (e.OldItems != null)
{
foreach (IfcExternalReferenceRelationship r in e.OldItems)
r.RelatedResourceObjects.Remove(this);
}
}
public void AddConstraintRelationShip(IfcResourceConstraintRelationship constraintRelationship) { mHasConstraintRelationships.Add(constraintRelationship); }
}
//[Obsolete("DEPRECATED IFC4", false)]
//ENTITY IfcTimeSeriesReferenceRelationship; // DEPRECATED IFC4
//[Obsolete("DEPRECATED IFC4", false)]
//ENTITY IfcTimeSeriesSchedule // DEPRECATED IFC4
[Serializable]
public partial class IfcTimeSeriesValue : BaseClassIfc
{
private LIST<IfcValue> mListValues = new LIST<IfcValue>(); //: LIST[1:?] OF IfcValue;
public LIST<IfcValue> ListValues { get { return mListValues; } set { mListValues = value; } }
public IfcTimeSeriesValue() : base() { }
public IfcTimeSeriesValue(DatabaseIfc db, IEnumerable<IfcValue> listValues)
: base(db)
{
ListValues.AddRange(listValues);
}
}
[Serializable]
public abstract partial class IfcTopologicalRepresentationItem : IfcRepresentationItem /*(IfcConnectedFaceSet,IfcEdge,IfcFace,IfcFaceBound,IfcLoop,IfcPath,IfcVertex))*/
{
protected IfcTopologicalRepresentationItem() : base() { }
protected IfcTopologicalRepresentationItem(DatabaseIfc db) : base(db) { }
protected IfcTopologicalRepresentationItem(DatabaseIfc db, IfcTopologicalRepresentationItem i, DuplicateOptions options) : base(db, i, options) { }
}
[Serializable]
public partial class IfcTopologyRepresentation : IfcShapeModel
{
internal IfcTopologyRepresentation() : base() { }
internal IfcTopologyRepresentation(DatabaseIfc db, IfcTopologyRepresentation r, DuplicateOptions options) : base(db, r, options) { }
public IfcTopologyRepresentation(IfcGeometricRepresentationContext context, IfcConnectedFaceSet fs) : base(context, fs) { RepresentationType = "FaceSet"; }
public IfcTopologyRepresentation(IfcGeometricRepresentationContext context, IfcEdge e) : base(context, e) { RepresentationType = "Edge"; }
public IfcTopologyRepresentation(IfcGeometricRepresentationContext context, IfcFace fs) : base(context, fs) { RepresentationType = "Face"; }
public IfcTopologyRepresentation(IfcGeometricRepresentationContext context, IfcVertex v) : base(context, v) { RepresentationType = "Vertex"; }
internal static IfcTopologyRepresentation getRepresentation(IfcGeometricRepresentationContext context, IfcTopologicalRepresentationItem item)
{
IfcConnectedFaceSet cfs = item as IfcConnectedFaceSet;
if (cfs != null)
return new IfcTopologyRepresentation(context, cfs);
IfcEdge e = item as IfcEdge;
if (e != null)
return new IfcTopologyRepresentation(context, e);
IfcFace f = item as IfcFace;
if (f != null)
return new IfcTopologyRepresentation(context, f);
IfcVertex v = item as IfcVertex;
if (v != null)
return new IfcTopologyRepresentation(context, v);
return null;
}
}
[Serializable]
public partial class IfcToroidalSurface : IfcElementarySurface //IFC4.2
{
internal double mMajorRadius;// : IfcPositiveLengthMeasure;
internal double mMinorRadius;// : IfcPositiveLengthMeasure;
public double MajorRadius { get { return mMajorRadius; } set { mMajorRadius = value; } }
public double MinorRadius { get { return mMinorRadius; } set { mMinorRadius = value; } }
internal IfcToroidalSurface() : base() { }
internal IfcToroidalSurface(DatabaseIfc db, IfcToroidalSurface s, DuplicateOptions options) : base(db, s, options) { mMajorRadius = s.mMajorRadius; mMinorRadius = s.mMinorRadius; }
public IfcToroidalSurface(IfcAxis2Placement3D placement, double majorRadius, double minorRadius) : base(placement) { MajorRadius = majorRadius; MinorRadius = minorRadius; }
}
[Serializable]
public partial class IfcTrackElement : IfcBuiltElement
{
private IfcTrackElementTypeEnum mPredefinedType = IfcTrackElementTypeEnum.NOTDEFINED; //: OPTIONAL IfcTrackElementTypeEnum;
public IfcTrackElementTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
public IfcTrackElement() : base() { }
public IfcTrackElement(DatabaseIfc db) : base(db) { }
public IfcTrackElement(DatabaseIfc db, IfcTrackElement trackElement, DuplicateOptions options) : base(db, trackElement, options) { PredefinedType = trackElement.PredefinedType; }
public IfcTrackElement(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation) : base(host, placement, representation) { }
}
[Serializable]
public partial class IfcTrackElementType : IfcBuiltElementType
{
private IfcTrackElementTypeEnum mPredefinedType = IfcTrackElementTypeEnum.NOTDEFINED; //: IfcTrackElementTypeEnum;
public IfcTrackElementTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
public IfcTrackElementType() : base() { }
public IfcTrackElementType(DatabaseIfc db, IfcTrackElementType trackElementType, DuplicateOptions options) : base(db, trackElementType, options) { PredefinedType = trackElementType.PredefinedType; }
public IfcTrackElementType(DatabaseIfc db, string name, IfcTrackElementTypeEnum predefinedType)
: base(db, name) { PredefinedType = predefinedType; }
}
[Serializable]
public partial class IfcTransformer : IfcEnergyConversionDevice //IFC4
{
internal IfcTransformerTypeEnum mPredefinedType = IfcTransformerTypeEnum.NOTDEFINED;// OPTIONAL : IfcTransformerTypeEnum;
public IfcTransformerTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTransformer() : base() { }
internal IfcTransformer(DatabaseIfc db, IfcTransformer t, DuplicateOptions options) : base(db, t, options) { mPredefinedType = t.mPredefinedType; }
public IfcTransformer(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation, IfcDistributionSystem system) : base(host, placement, representation, system) { }
}
[Serializable]
public partial class IfcTransformerType : IfcEnergyConversionDeviceType
{
internal IfcTransformerTypeEnum mPredefinedType = IfcTransformerTypeEnum.NOTDEFINED;// : IfcTransformerEnum;
public IfcTransformerTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTransformerType() : base() { }
internal IfcTransformerType(DatabaseIfc db, IfcTransformerType t, DuplicateOptions options) : base(db, t, options) { mPredefinedType = t.mPredefinedType; }
public IfcTransformerType(DatabaseIfc m, string name, IfcTransformerTypeEnum type) : base(m) { Name = name; mPredefinedType = type; }
}
[Obsolete("DEPRECATED IFC4X3", false)]
[Serializable]
public partial class IfcTransitionCurveSegment2D : IfcCurveSegment2D //IFC4x1
{
private double mStartRadius = double.PositiveInfinity;// OPTIONAL IfcPositiveLengthMeasure;
private double mEndRadius = double.PositiveInfinity;// OPTIONAL IfcPositiveLengthMeasure;
private bool mIsStartRadiusCCW;// : IfcBoolean;
private bool mIsEndRadiusCCW;// : IfcBoolean;
private IfcTransitionCurveType mTransitionCurveType = IfcTransitionCurveType.CLOTHOIDCURVE;
public double StartRadius { get { return double.IsNaN(mStartRadius) ? double.PositiveInfinity : mStartRadius; } set { mStartRadius = ((double.IsInfinity(value) || value < 1e-8) ? double.NaN : value); } }
public double EndRadius { get { return double.IsNaN(mEndRadius) ? double.PositiveInfinity : mEndRadius; } set { mEndRadius = ((double.IsInfinity(value) || value < 1e-8) ? double.NaN : value); } }
public bool IsStartRadiusCCW { get { return mIsStartRadiusCCW; } set { mIsStartRadiusCCW = value; } }
public bool IsEndRadiusCCW { get { return mIsEndRadiusCCW; } set { mIsEndRadiusCCW = value; } }
public IfcTransitionCurveType TransitionCurveType { get { return mTransitionCurveType; } set { mTransitionCurveType = value; } }
internal IfcTransitionCurveSegment2D() : base() { }
public IfcTransitionCurveSegment2D(IfcCartesianPoint start, double startDirection, double length, double startRadius, double endRadius, bool isStartCCW, bool isEndCCW, IfcTransitionCurveType curveType)
: base(start, startDirection, length)
{
mStartRadius = startRadius;
mEndRadius = endRadius;
mIsStartRadiusCCW = isStartCCW;
mIsEndRadiusCCW = isEndCCW;
mTransitionCurveType = curveType;
}
internal IfcTransitionCurveSegment2D(DatabaseIfc db, IfcTransitionCurveSegment2D s, DuplicateOptions options) : base(db, s, options) { mStartRadius = s.mStartRadius; mEndRadius = s.mEndRadius; mIsStartRadiusCCW = s.mIsStartRadiusCCW; mIsEndRadiusCCW = s.mIsEndRadiusCCW; mTransitionCurveType = s.mTransitionCurveType; }
}
[Serializable]
public partial class IfcTranslationalStiffnessSelect
{
internal bool mRigid = false;
internal IfcLinearStiffnessMeasure mStiffness = null;
public bool Rigid { get { return mRigid; } }
public IfcLinearStiffnessMeasure Stiffness { get { return mStiffness; } }
public IfcTranslationalStiffnessSelect(bool fix) { mRigid = fix; }
public IfcTranslationalStiffnessSelect(double stiff) { mStiffness = new IfcLinearStiffnessMeasure(stiff); }
public IfcTranslationalStiffnessSelect(IfcLinearStiffnessMeasure stiff) { mStiffness = stiff; }
}
[Serializable]
public partial class IfcTransportElement : IfcElement
{
internal IfcTransportElementTypeSelect mPredefinedType = null;// : OPTIONAL IfcTransportElementTypeSelect;
internal double mCapacityByWeight = double.NaN;// : OPTIONAL IfcMassMeasure;
internal double mCapacityByNumber = double.NaN;// : OPTIONAL IfcCountMeasure;
public IfcTransportElementTypeSelect PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
//public double CapacityByWeight { get { return mCapacityByWeight; } set { mCapacityByWeight = value; } }
//public double CapacityByNumber { get { return CapacityByNumber; } set { mCapacityByNumber = value; } }
internal IfcTransportElement() : base() { }
internal IfcTransportElement(DatabaseIfc db, IfcTransportElement e, DuplicateOptions options) : base(db, e, options) { }
public IfcTransportElement(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation) : base(host, placement, representation) { }
}
[Serializable]
public partial class IfcTransportElementType : IfcElementType
{
internal IfcTransportElementTypeSelect mPredefinedType = new IfcTransportElementTypeSelect(IfcTransportElementFixedTypeEnum.NOTDEFINED);// IfcTransportElementTypeEnum;
public IfcTransportElementTypeSelect PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTransportElementType() : base() { }
internal IfcTransportElementType(DatabaseIfc db, IfcTransportElementType t, DuplicateOptions options) : base(db, t, options) { mPredefinedType = t.mPredefinedType; }
public IfcTransportElementType(DatabaseIfc m, string name, IfcTransportElementTypeSelect type) : base(m) { Name = name; mPredefinedType = type; }
}
[Serializable]
public partial class IfcTrapeziumProfileDef : IfcParameterizedProfileDef
{
internal double mBottomXDim;// : IfcPositiveLengthMeasure;
internal double mTopXDim;// : IfcPositiveLengthMeasure;
internal double mYDim;// : IfcPositiveLengthMeasure;
internal double mTopXOffset;// : IfcPositiveLengthMeasure;
public double BottomXDim { get { return mBottomXDim; } set { mBottomXDim = value; } }
public double TopXDim { get { return mTopXDim; } set { mTopXDim = value; } }
public double YDim { get { return mYDim; } set { mYDim = value; } }
public double TopXOffset { get { return mTopXOffset; } set { mTopXOffset = value; } }
internal IfcTrapeziumProfileDef() : base() { }
internal IfcTrapeziumProfileDef(DatabaseIfc db, IfcTrapeziumProfileDef p, DuplicateOptions options) : base(db, p, options) { mBottomXDim = p.mBottomXDim; mTopXDim = p.mTopXDim; mYDim = p.mYDim; mTopXOffset = p.mTopXOffset; }
public IfcTrapeziumProfileDef(DatabaseIfc db, string name, double bottomXDim, double topXDim, double yDim, double topXOffset) : base(db, name)
{
if (mDatabase.mModelView != ModelView.Ifc4NotAssigned && mDatabase.mModelView != ModelView.Ifc2x3NotAssigned)
throw new Exception("Invalid Model View for IfcTrapeziumProfileDef : " + db.ModelView.ToString());
mBottomXDim = bottomXDim;
mTopXDim = topXDim;
mYDim = yDim;
mTopXOffset = topXOffset;
}
}
[Serializable]
public partial class IfcTriangulatedFaceSet : IfcTessellatedFaceSet
{
internal double[][] mNormals = new double[0][];// : OPTIONAL LIST [1:?] OF LIST [3:3] OF IfcParameterValue;
internal IfcLogicalEnum mClosed = IfcLogicalEnum.UNKNOWN; // OPTIONAL BOOLEAN;
internal Tuple<int, int, int>[] mCoordIndex = new Tuple<int, int, int>[0];// : LIST [1:?] OF LIST [3:3] OF INTEGER;
internal Tuple<int, int, int>[] mNormalIndex = new Tuple<int, int, int>[0];// : OPTIONAL LIST [1:?] OF LIST [3:3] OF INTEGER;
internal List<int> mPnIndex = new List<int>(); // : OPTIONAL LIST [1:?] OF IfcPositiveInteger;
public double[][] Normals { get { return mNormals; } set { mNormals = value; } }
public bool Closed { get { return mClosed == IfcLogicalEnum.TRUE; } set { mClosed = value ? IfcLogicalEnum.TRUE : IfcLogicalEnum.FALSE; } }
public ReadOnlyCollection<Tuple<int, int, int>> CoordIndex { get { return new ReadOnlyCollection<Tuple<int, int, int>>(mCoordIndex); } }
public ReadOnlyCollection<Tuple<int, int, int>> NormalIndex { get { return new ReadOnlyCollection<Tuple<int, int, int>>(mNormalIndex); } }
public ReadOnlyCollection<int> PnIndex { get { return new ReadOnlyCollection<int>(mPnIndex); } }
internal IfcTriangulatedFaceSet() : base() { }
internal IfcTriangulatedFaceSet(DatabaseIfc db, IfcTriangulatedFaceSet s, DuplicateOptions options) : base(db, s, options)
{
if (s.mNormals.Length > 0)
mNormals = s.mNormals.ToArray();
mClosed = s.mClosed;
mCoordIndex = s.mCoordIndex.ToArray();
if (s.mNormalIndex.Length > 0)
mNormalIndex = s.mNormalIndex.ToArray();
}
public IfcTriangulatedFaceSet(IfcCartesianPointList3D pl, IEnumerable<Tuple<int, int, int>> coords)
: base(pl) { setCoordIndex(coords); }
internal void setCoordIndex(IEnumerable<Tuple<int, int, int>> coords) { mCoordIndex = coords.ToArray(); }
}
[Serializable]
public partial class IfcTriangulatedIrregularNetwork : IfcTriangulatedFaceSet
{
internal List<int> mFlags = new List<int>(); // : LIST [1:?] OF IfcInteger;
public List<int> Flags { get { return mFlags; } }
internal IfcTriangulatedIrregularNetwork() : base() { }
internal IfcTriangulatedIrregularNetwork(DatabaseIfc db, IfcTriangulatedIrregularNetwork s, DuplicateOptions options) : base(db, s, options)
{
mFlags.AddRange(s.mFlags);
}
public IfcTriangulatedIrregularNetwork(IfcCartesianPointList3D pl, IEnumerable<Tuple<int, int, int>> coords, List<int> flags)
: base(pl, coords) { mFlags.AddRange(flags); }
}
[Serializable]
public partial class IfcTrimmedCurve : IfcBoundedCurve
{
private IfcCurve mBasisCurve;//: IfcCurve;
internal IfcTrimmingSelect mTrim1;// : SET [1:2] OF IfcTrimmingSelect;
internal IfcTrimmingSelect mTrim2;//: SET [1:2] OF IfcTrimmingSelect;
private bool mSenseAgreement = false;// : BOOLEAN;
internal IfcTrimmingPreference mMasterRepresentation = IfcTrimmingPreference.UNSPECIFIED;// : IfcTrimmingPreference;
public IfcCurve BasisCurve { get { return mBasisCurve; } set { mBasisCurve = value; } }
public IfcTrimmingSelect Trim1 { get { return mTrim1; } set { mTrim1 = value; } }
public IfcTrimmingSelect Trim2 { get { return mTrim2; } set { mTrim2 = value; } }
public bool SenseAgreement { get { return mSenseAgreement; } set { mSenseAgreement = value; } }
public IfcTrimmingPreference MasterRepresentation { get { return mMasterRepresentation; } set { mMasterRepresentation = value; } }
internal IfcTrimmedCurve() : base() { }
internal IfcTrimmedCurve(DatabaseIfc db) : base(db) { }
internal IfcTrimmedCurve(DatabaseIfc db, IfcTrimmedCurve c, DuplicateOptions options) : base(db, c, options)
{
BasisCurve = db.Factory.Duplicate(c.BasisCurve) as IfcCurve;
mTrim1 = new IfcTrimmingSelect(c.mTrim1.mIfcParameterValue);
mTrim2 = new IfcTrimmingSelect(c.mTrim2.mIfcParameterValue);
if (c.mTrim1.mIfcCartesianPoint > 0)
mTrim1.mIfcCartesianPoint = db.Factory.Duplicate(c.mDatabase[c.mTrim1.mIfcCartesianPoint]).mIndex;
if (c.mTrim2.mIfcCartesianPoint > 0)
mTrim2.mIfcCartesianPoint = db.Factory.Duplicate(c.mDatabase[c.mTrim2.mIfcCartesianPoint]).mIndex;
mSenseAgreement = c.mSenseAgreement;
mMasterRepresentation = c.mMasterRepresentation;
}
public IfcTrimmedCurve(IfcConic basis, IfcTrimmingSelect start, IfcTrimmingSelect end, bool senseAgreement, IfcTrimmingPreference tp)
: this(basis.mDatabase, start,end, senseAgreement,tp) { BasisCurve = basis; }
public IfcTrimmedCurve(IfcLine basis, IfcTrimmingSelect start, IfcTrimmingSelect end, bool senseAgreement, IfcTrimmingPreference tp)
: this(basis.mDatabase, start, end, senseAgreement, tp) { BasisCurve = basis; }
public IfcTrimmedCurve(IfcSeriesParameterCurve basis, IfcTrimmingSelect start, IfcTrimmingSelect end, bool senseAgreement, IfcTrimmingPreference tp)
: this(basis.Database, start, end, senseAgreement, tp) { BasisCurve = basis; }
public IfcTrimmedCurve(IfcClothoid basis, IfcTrimmingSelect start, IfcTrimmingSelect end, bool senseAgreement, IfcTrimmingPreference tp)
: this(basis.Database, start, end, senseAgreement, tp) { BasisCurve = basis; }
private IfcTrimmedCurve(DatabaseIfc db, IfcTrimmingSelect start, IfcTrimmingSelect end, bool senseAgreement, IfcTrimmingPreference tp) : base(db)
{
mTrim1 = start;
mTrim2 = end;
mSenseAgreement = senseAgreement;
mMasterRepresentation = tp;
}
internal IfcTrimmedCurve(IfcCartesianPoint start, Tuple<double, double> arcInteriorPoint, IfcCartesianPoint end) : base(start.mDatabase)
{
LIST<double> pt1 = start.Coordinates, pt3 = end.Coordinates;
DatabaseIfc db = start.mDatabase;
double xDelta_a = arcInteriorPoint.Item1 - pt1[0];
double yDelta_a = arcInteriorPoint.Item2 - pt1[1];
double xDelta_b = pt3[0] - arcInteriorPoint.Item1;
double yDelta_b = pt3[1] - arcInteriorPoint.Item2;
double x = 0, y = 0;
double tol = 1e-9;
if (Math.Abs(xDelta_a) < tol && Math.Abs(yDelta_b) < tol)
{
x = (arcInteriorPoint.Item1 + pt3[0]) / 2;
y = (pt1[1] + arcInteriorPoint.Item2) / 2;
}
else
{
double aSlope = yDelta_a / xDelta_a; //
double bSlope = yDelta_b / xDelta_b;
if (Math.Abs(aSlope - bSlope) < tol)
{ // points are colinear
// line curve
BasisCurve = new IfcPolyline(start, end);
mTrim1 = new IfcTrimmingSelect(0);
mTrim2 = new IfcTrimmingSelect(1);
MasterRepresentation = IfcTrimmingPreference.PARAMETER;
return;
}
// calc center
x = (aSlope * bSlope * (pt1[1] - pt3[1]) + bSlope * (pt1[0] + arcInteriorPoint.Item1)
- aSlope * (arcInteriorPoint.Item1 + pt3[0])) / (2 * (bSlope - aSlope));
y = -1 * (x - (pt1[0] + arcInteriorPoint.Item1) / 2) / aSlope + (pt1[1] + arcInteriorPoint.Item2) / 2;
}
double radius = Math.Sqrt(Math.Pow(pt1[0] - x, 2) + Math.Pow(pt1[1] - y, 2));
BasisCurve = new IfcCircle(new IfcAxis2Placement2D(new IfcCartesianPoint(db, x, y)) { RefDirection = new IfcDirection(db, pt1[0]-x, pt1[1]-y) }, radius);
mTrim1 = new IfcTrimmingSelect(0, start);
mSenseAgreement = (((arcInteriorPoint.Item1 - pt1[0]) * (pt3[1] - arcInteriorPoint.Item2)) - ((arcInteriorPoint.Item2 - pt1[1]) * (pt3[0] - arcInteriorPoint.Item1))) > 0;
double t3 = Math.Atan2(pt3[1] - y, pt3[0] - x), t1 = Math.Atan2(pt1[1] - y, pt1[0] - x);
if (t3 < 0)
t3 = 2 * Math.PI + t3;
mTrim2 = new IfcTrimmingSelect((t3 - t1 ) / db.mContext.UnitsInContext.ScaleSI(IfcUnitEnum.PLANEANGLEUNIT), end );
mMasterRepresentation = IfcTrimmingPreference.PARAMETER;
}
}
[Serializable]
public partial class IfcTrimmingSelect
{
public IfcTrimmingSelect() { }
public IfcTrimmingSelect(IfcCartesianPoint cp)
{
mIfcParameterValue = double.NaN;
mIfcCartesianPoint = (cp != null ? cp.mIndex : 0);
}
public IfcTrimmingSelect(double param) { mIfcParameterValue = param; }
public IfcTrimmingSelect(double param, IfcCartesianPoint cp) : this(cp) { mIfcParameterValue = param; }
internal double mIfcParameterValue = double.NaN;
public double IfcParameterValue { get { return mIfcParameterValue; } }
internal int mIfcCartesianPoint;
public int IfcCartesianPoint { get { return mIfcCartesianPoint; } }
}
[Serializable]
public partial class IfcTShapeProfileDef : IfcParameterizedProfileDef
{
internal double mDepth, mFlangeWidth, mWebThickness, mFlangeThickness;// : IfcPositiveLengthMeasure;
internal double mFilletRadius = double.NaN, mFlangeEdgeRadius = double.NaN, mWebEdgeRadius = double.NaN;// : OPTIONAL IfcPositiveLengthMeasure;
internal double mWebSlope = double.NaN, mFlangeSlope = double.NaN;// : OPTIONAL IfcPlaneAngleMeasure;
internal double mCentreOfGravityInX = double.NaN;// : OPTIONAL IfcPositiveLengthMeasure
public double Depth { get { return mDepth; } set { mDepth = value; } }
public double FlangeWidth { get { return mFlangeWidth; } set { mFlangeWidth = value; } }
public double WebThickness { get { return mWebThickness; } set { mWebThickness = value; } }
public double FlangeThickness { get { return mFlangeThickness; } set { mFlangeThickness = value; } }
public double FilletRadius { get { return mFilletRadius; } set { mFilletRadius = value; } }
public double FlangeEdgeRadius { get { return mFlangeEdgeRadius; } set { mFlangeEdgeRadius = value; } }
public double WebEdgeRadius { get { return mWebEdgeRadius; } set { mWebEdgeRadius = value; } }
public double WebSlope { get { return mWebSlope; } set { mWebSlope = value; } }
public double FlangeSlope { get { return mFlangeSlope; } set { mFlangeSlope = value; } }
internal IfcTShapeProfileDef() : base() { }
internal IfcTShapeProfileDef(DatabaseIfc db, IfcTShapeProfileDef p, DuplicateOptions options) : base(db, p, options)
{
mDepth = p.mDepth;
mFlangeWidth = p.mFlangeWidth;
mWebThickness = p.mWebThickness;
mFlangeThickness = p.mFlangeThickness;
mFilletRadius = p.mFilletRadius;
mFlangeEdgeRadius = p.mFlangeEdgeRadius;
mWebEdgeRadius = p.mWebEdgeRadius;
mWebSlope = p.mWebSlope;
mFlangeSlope = p.mFlangeSlope;
}
public IfcTShapeProfileDef(DatabaseIfc db, string name, double depth, double flangeWidth, double webThickness, double flangeThickness)
: base(db,name)
{
mDepth = depth;
mFlangeWidth = flangeWidth;
mWebThickness = webThickness;
mFlangeThickness = flangeThickness;
}
}
[Serializable]
public partial class IfcTubeBundle : IfcEnergyConversionDevice //IFC4
{
internal IfcTubeBundleTypeEnum mPredefinedType = IfcTubeBundleTypeEnum.NOTDEFINED;// OPTIONAL : IfcTubeBundleTypeEnum;
public IfcTubeBundleTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTubeBundle() : base() { }
internal IfcTubeBundle(DatabaseIfc db, IfcTubeBundle b, DuplicateOptions options) : base(db, b, options) { mPredefinedType = b.mPredefinedType; }
public IfcTubeBundle(IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation, IfcDistributionSystem system) : base(host, placement, representation, system) { }
}
[Serializable]
public partial class IfcTubeBundleType : IfcEnergyConversionDeviceType
{
internal IfcTubeBundleTypeEnum mPredefinedType = IfcTubeBundleTypeEnum.NOTDEFINED;// : IfcTubeBundleEnum;
public IfcTubeBundleTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = value; } }
internal IfcTubeBundleType() : base() { }
internal IfcTubeBundleType(DatabaseIfc db, IfcTubeBundleType t, DuplicateOptions options) : base(db, t, options) { mPredefinedType = t.mPredefinedType; }
public IfcTubeBundleType(DatabaseIfc m, string name, IfcTubeBundleTypeEnum t) : base(m) { Name = name; PredefinedType = t; }
}
[Obsolete("DEPRECATED IFC4", false)]
[Serializable]
public partial class IfcTwoDirectionRepeatFactor : IfcOneDirectionRepeatFactor // DEPRECATED IFC4
{
internal int mSecondRepeatFactor;// : IfcVector
public IfcVector SecondRepeatFactor { get { return mDatabase[mSecondRepeatFactor] as IfcVector; } set { mSecondRepeatFactor = value.mIndex; } }
internal IfcTwoDirectionRepeatFactor() : base() { }
internal IfcTwoDirectionRepeatFactor(DatabaseIfc db, IfcTwoDirectionRepeatFactor f, DuplicateOptions options) : base(db, f, options) { SecondRepeatFactor = db.Factory.Duplicate(f.SecondRepeatFactor) as IfcVector; }
}
[Serializable]
public partial class IfcTypeObject : IfcObjectDefinition //(IfcTypeProcess, IfcTypeProduct, IfcTypeResource) IFC4 ABSTRACT
{
internal string mApplicableOccurrence = "$";// : OPTIONAL IfcLabel;
internal SET<IfcPropertySetDefinition> mHasPropertySets = new SET<IfcPropertySetDefinition>();// : OPTIONAL SET [1:?] OF IfcPropertySetDefinition
//INVERSE
internal IfcRelDefinesByType mObjectTypeOf = null;
public string ApplicableOccurrence { get { return (mApplicableOccurrence == "$" ? "" : ParserIfc.Decode(mApplicableOccurrence)); } set { mApplicableOccurrence = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public SET<IfcPropertySetDefinition> HasPropertySets { get { return mHasPropertySets; } set { mHasPropertySets.Clear(); if (value != null) { mHasPropertySets.CollectionChanged -= mHasPropertySets_CollectionChanged; mHasPropertySets = value; mHasPropertySets.CollectionChanged += mHasPropertySets_CollectionChanged; } } }
public IfcRelDefinesByType ObjectTypeOf { get { return mObjectTypeOf; } }
//GeomGym
internal IfcMaterialProfileSet mTapering = null;
public new string Name { get { return base.Name; } set { base.Name = string.IsNullOrEmpty( value) ? "NameNotAssigned" : value; } }
protected IfcTypeObject() : base() { Name = "NameNotAssigned"; }
protected IfcTypeObject(IfcTypeObject basis) : base(basis, false) { mApplicableOccurrence = basis.mApplicableOccurrence; mHasPropertySets = basis.mHasPropertySets; mObjectTypeOf = basis.mObjectTypeOf; }
protected IfcTypeObject(DatabaseIfc db, IfcTypeObject t, DuplicateOptions options) : base(db, t, options)
{
mApplicableOccurrence = t.mApplicableOccurrence;
foreach(IfcPropertySetDefinition pset in t.HasPropertySets)
{
IfcPropertySetDefinition duplicatePset = db.Factory.DuplicatePropertySet(pset, options);
if (duplicatePset != null)
HasPropertySets.Add(duplicatePset);
}
}
[Obsolete("DEPRECATED IFC4", false)]
public IfcTypeObject(DatabaseIfc db) : base(db) { Name = "NameNotAssigned"; IfcRelDefinesByType rdt = new IfcRelDefinesByType(this) { Name = Name }; }
protected override void initialize()
{
base.initialize();
mHasPropertySets.CollectionChanged += mHasPropertySets_CollectionChanged;
}
private void mHasPropertySets_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (mDatabase != null && mDatabase.IsDisposed())
return;
if (e.NewItems != null)
{
foreach (IfcPropertySetDefinition s in e.NewItems)
{
if (!s.mDefinesType.Contains(this))
s.mDefinesType.Add(this);
}
}
if (e.OldItems != null)
{
foreach (IfcPropertySetDefinition s in e.OldItems)
s.mDefinesType.Remove(this);
}
}
protected override List<T> Extract<T>(Type type)
{
List<T> result = base.Extract<T>(type);
foreach (IfcPropertySetDefinition psd in HasPropertySets)
result.AddRange(psd.Extract<T>());
return result;
}
public override IfcProperty FindProperty(string name)
{
foreach (IfcPropertySet pset in HasPropertySets.OfType<IfcPropertySet>())
{
if(pset != null)
{
IfcProperty property = pset[name];
if (property != null)
return property;
}
}
return null;
}
public override void RemoveProperty(IfcProperty property)
{
foreach(IfcPropertySet pset in HasPropertySets.OfType<IfcPropertySet>().ToList())
{
foreach(IfcProperty p in pset.HasProperties.Values)
{
if(p == property)
{
if(pset.DefinesType.Count == 1 && pset.DefinesOccurrence == null)
{
if (pset.HasProperties.Count == 1)
pset.Dispose(true);
else
property.Dispose(true);
}
else
{
HasPropertySets.Remove(pset);
HasPropertySets.Add(new IfcPropertySet(pset.Name, pset.HasProperties.Values.Where(x => x != property)));
}
return;
}
}
}
}
public override IfcPropertySetDefinition FindPropertySet(string name)
{
IfcPropertySetDefinition pset = HasPropertySets.FirstOrDefault(x => string.Compare(x.Name, name, true) == 0);
if (pset != null)
return pset;
return null;
}
public IfcProfileProperties ProfileProperties()
{
IEnumerable<IfcRelAssociatesProfileProperties> associates = HasAssociations.OfType<IfcRelAssociatesProfileProperties>();
return associates.Count() <= 0 ? null : associates.First().RelatingProfileProperties;
}
internal void MaterialProfile(out IfcMaterial material, out IfcProfileDef profile)
{
material = null;
profile = null;
foreach (IfcRelAssociates associates in mHasAssociations)
{
IfcRelAssociatesMaterial associatesMaterial = associates as IfcRelAssociatesMaterial;
if (associatesMaterial != null)
{
IfcMaterialSelect ms = associatesMaterial.RelatingMaterial;
IfcMaterialProfile mp = ms as IfcMaterialProfile;
if (mp == null)
{
IfcMaterialProfileSet mps = ms as IfcMaterialProfileSet;
if (mps != null)
mp = mps.MaterialProfiles[0];
else
{
IfcMaterialProfileSetUsage mpu = ms as IfcMaterialProfileSetUsage;
if (mpu != null)
mp = mpu.ForProfileSet.MaterialProfiles[0];
}
}
if (mp != null)
{
material = mp.Material;
profile = mp.Profile;
return;
}
IfcMaterial m = ms as IfcMaterial;
if (m != null)
material = m;
}
IfcRelAssociatesProfileProperties associatesProfileProperties = associates as IfcRelAssociatesProfileProperties;
if (associatesProfileProperties != null)
{
IfcProfileProperties profileProperties = associatesProfileProperties.RelatingProfileProperties;
if (profileProperties != null)
profile = profileProperties.ProfileDefinition;
}
}
}
internal override List<IBaseClassIfc> retrieveReference(IfcReference r)
{
IfcReference ir = r.InnerReference;
List<IBaseClassIfc> result = new List<IBaseClassIfc>();
if (ir == null)
{
return null;
}
if (string.Compare(r.mAttributeIdentifier, "HasPropertySets", true) == 0)
{
SET<IfcPropertySetDefinition> psets = HasPropertySets;
if (r.mListPositions.Count == 0)
{
string name = r.InstanceName;
if (string.IsNullOrEmpty(name))
{
foreach (IfcPropertySetDefinition pset in psets)
result.AddRange(pset.retrieveReference(r.InnerReference));
}
else
{
foreach (IfcPropertySetDefinition pset in psets)
{
if (string.Compare(name, pset.Name) == 0)
result.AddRange(pset.retrieveReference(r.InnerReference));
}
}
}
else
{
List<IfcPropertySetDefinition> list = psets.ToList();
foreach (int i in r.mListPositions)
result.AddRange(list[i - 1].retrieveReference(ir));
}
return result;
}
return base.retrieveReference(r);
}
internal void IsolateObject(string filename, bool relatedObjects)
{
DatabaseIfc db = new DatabaseIfc(mDatabase);
IfcTypeObject typeObject = db.Factory.Duplicate(this, new DuplicateOptions(db.Tolerance) { DuplicateDownstream = true }) as IfcTypeObject;
if (relatedObjects)
{
if (mObjectTypeOf != null)
{
foreach (IfcObject o in mObjectTypeOf.RelatedObjects)
db.Factory.Duplicate(o);
}
if (HasContext != null)
(db.Factory.Duplicate(mDatabase.Context, new DuplicateOptions(db.Tolerance) { DuplicateDownstream = false }) as IfcContext).AddDeclared(typeObject);
}
else
{
if (HasContext != null)
{
IfcContext context = mDatabase.Context;
if (db.Release > ReleaseVersion.IFC2x3)
{
IfcProjectLibrary library = new IfcProjectLibrary(db, context.Name) { LongName = context.LongName, GlobalId = context.GlobalId, UnitsInContext = db.Factory.Duplicate(context.UnitsInContext, new DuplicateOptions(db.Tolerance) { DuplicateDownstream = true }) as IfcUnitAssignment };
library.AddDeclared(typeObject);
}
else
(db.Factory.Duplicate(mDatabase.Context, new DuplicateOptions(db.Tolerance) { DuplicateDownstream = false }) as IfcContext).AddDeclared(typeObject);
}
}
IfcProject project = db.Project;
if (project != null)
{
IfcSite site = db.Project.RootElement() as IfcSite;
if (site != null)
{
IfcProductDefinitionShape pr = site.Representation;
if (pr != null)
{
site.Representation = null;
pr.Dispose(true);
}
}
}
db.WriteFile(filename);
}
}
[Serializable]
public abstract partial class IfcTypeProcess : IfcTypeObject, IfcProcessSelect //ABSTRACT SUPERTYPE OF(ONEOF(IfcEventType, IfcProcedureType, IfcTaskType))
{
private string mIdentification = "$";// : OPTIONAL IfcIdentifier;
private string mLongDescription = "$";// : OPTIONAL IfcText;
private string mProcessType = "$";// : OPTIONAL IfcLabel;
//INVERSE
internal SET<IfcRelAssignsToProcess> mOperatesOn = new SET<IfcRelAssignsToProcess>();// : SET [0:?] OF IfcRelAssignsToProcess FOR RelatingProcess;
public string Identification { get { return (mIdentification == "$" ? "" : ParserIfc.Decode(mIdentification)); } set { mIdentification = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public string LongDescription { get { return (mLongDescription == "$" ? "" : ParserIfc.Decode(mLongDescription)); } set { mLongDescription = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public string ProcessType { get { return (mProcessType == "$" ? "" : ParserIfc.Decode(mProcessType)); } set { mProcessType = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
//INVERSE
public SET<IfcRelAssignsToProcess> OperatesOn { get { return mOperatesOn; } }
protected IfcTypeProcess() : base() { }
protected IfcTypeProcess(DatabaseIfc db, IfcTypeProcess t, DuplicateOptions options) : base(db, t, options) { mIdentification = t.mIdentification; mLongDescription = t.mLongDescription; mProcessType = t.mProcessType; }
protected IfcTypeProcess(DatabaseIfc db) : base(db) { }
}
[Serializable]
public partial class IfcTypeProduct : IfcTypeObject, IfcProductSelect //SUPERTYPE OF (ONEOF (IfcDoorStyle ,IfcElementType ,IfcSpatialElementType ,IfcWindowStyle))
{
internal LIST<IfcRepresentationMap> mRepresentationMaps = new LIST<IfcRepresentationMap>();// : OPTIONAL LIST [1:?] OF UNIQUE IfcRepresentationMap;
private string mTag = "$";// : OPTIONAL IfcLabel
//INVERSE
internal SET<IfcRelAssignsToProduct> mReferencedBy = new SET<IfcRelAssignsToProduct>();// : SET OF IfcRelAssignsToProduct FOR RelatingProduct;
public LIST<IfcRepresentationMap> RepresentationMaps { get { return mRepresentationMaps; } set { mRepresentationMaps.Clear(); if (value != null) { mRepresentationMaps.CollectionChanged -= mRepresentationMaps_CollectionChanged; mRepresentationMaps = value; mRepresentationMaps.CollectionChanged += mRepresentationMaps_CollectionChanged; } } }
public string Tag { get { return (mTag == "$" ? "" : mTag); } set { mTag = (string.IsNullOrEmpty(value) ? "$" : value); } }
public SET<IfcRelAssignsToProduct> ReferencedBy { get { return mReferencedBy; } }
protected IfcTypeProduct() : base() { }
protected IfcTypeProduct(IfcTypeProduct basis) : base(basis)
{
mRepresentationMaps = basis.mRepresentationMaps;
mTag = basis.mTag;
}
protected IfcTypeProduct(DatabaseIfc db, IfcTypeProduct t, DuplicateOptions options) : base(db, t, options)
{
RepresentationMaps.AddRange(t.RepresentationMaps.ConvertAll(x=> db.Factory.Duplicate(x) as IfcRepresentationMap));
mTag = t.mTag;
}
public IfcTypeProduct(DatabaseIfc db) : base(db) { }
protected override void initialize()
{
base.initialize();
RelatedMaterial();
mRepresentationMaps.CollectionChanged += mRepresentationMaps_CollectionChanged;
mReferencedBy.CollectionChanged += mReferencedBy_CollectionChanged;
}
private void mRepresentationMaps_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (mDatabase != null && mDatabase.IsDisposed())
return;
if (e.NewItems != null)
{
foreach (IfcRepresentationMap m in e.NewItems)
{
if (!m.mRepresents.Contains(this))
m.mRepresents.Add(this);
}
}
if (e.OldItems != null)
{
foreach (IfcRepresentationMap m in e.OldItems)
m.mRepresents.Remove(this);
}
}
private void mReferencedBy_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (mDatabase != null && mDatabase.IsDisposed())
return;
if (e.NewItems != null)
{
foreach (IfcRelAssignsToProduct r in e.NewItems)
{
if (r.RelatingProduct != this)
r.RelatingProduct = this;
}
}
if (e.OldItems != null)
{
foreach (IfcRelAssignsToProduct r in e.OldItems)
{
if (r.RelatingProduct == this)
r.RelatingProduct = null;
}
}
}
internal IfcElement genMappedItemElement(IfcProduct host, IfcAxis2Placement3D relativePlacement)
{
DatabaseIfc db = host.Database;
string typename = this.GetType().Name;
typename = typename.Substring(0, typename.Length - 4);
IfcShapeRepresentation sr = new IfcShapeRepresentation(new IfcMappedItem(RepresentationMaps[0], db.Factory.XYPlaneTransformation));
IfcProductDefinitionShape pds = new IfcProductDefinitionShape(sr);
IfcElement element = db.Factory.ConstructElement(typename, host, new IfcLocalPlacement(host.ObjectPlacement, relativePlacement), pds);
element.setRelatingType(this);
foreach (IfcRelNests nests in IsNestedBy)
{
foreach (IfcObjectDefinition od in nests.RelatedObjects)
{
IfcDistributionPort port = od as IfcDistributionPort;
if (port != null)
{
IfcDistributionPort newPort = new IfcDistributionPort(element) { FlowDirection = port.FlowDirection, PredefinedType = port.PredefinedType, SystemType = port.SystemType };
newPort.ObjectPlacement = new IfcLocalPlacement(element.ObjectPlacement, (port.ObjectPlacement as IfcLocalPlacement).RelativePlacement);
foreach (IfcRelDefinesByProperties rdp in port.mIsDefinedBy)
rdp.RelatedObjects.Add(newPort);
}
}
}
foreach(IfcPropertySetDefinition pset in HasPropertySets)
{
if (pset.IsInstancePropertySet)
pset.RelateObjectDefinition(element);
}
return element;
}
internal static IfcTypeProduct constructType(DatabaseIfc db, string className, string name)
{
string str = className, definedType = "";
if (!string.IsNullOrEmpty(str))
{
string[] fields = str.Split(".".ToCharArray());
if (fields.Length > 1)
{
str = fields[0];
definedType = fields[1];
}
}
if (!str.ToLower().EndsWith("Type"))
str = str + "Type";
IfcTypeProduct result = null;
Type type = Type.GetType("GeometryGym.Ifc." + str);
if (type != null)
{
Type enumType = Type.GetType("GeometryGym.Ifc." + type.Name + "Enum");
ConstructorInfo ctor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new[] { typeof(DatabaseIfc), typeof(string) }, null);
if (ctor == null)
{
ctor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new[] { typeof(DatabaseIfc), typeof(string), enumType }, null);
if (ctor == null)
throw new Exception("XXX Unrecognized Ifc Constructor for " + className);
else
{
object predefined = Enum.Parse(enumType, "NOTDEFINED");
result = ctor.Invoke(new object[] { db, name,predefined }) as IfcTypeProduct;
}
}
else
result = ctor.Invoke(new object[] { db, name }) as IfcTypeProduct;
if (result != null && !string.IsNullOrEmpty(definedType))
{
IfcElementType et = result as IfcElementType;
type = result.GetType();
PropertyInfo pi = type.GetProperty("PredefinedType");
if (pi != null)
{
if (enumType != null)
{
FieldInfo fi = enumType.GetField(definedType);
if (fi == null)
{
if (et != null)
{
et.ElementType = definedType;
fi = enumType.GetField("NOTDEFINED");
}
}
if (fi != null)
{
int i = (int)fi.GetValue(enumType);
object newEnumValue = Enum.ToObject(enumType, i);
pi.SetValue(result, newEnumValue, null);
}
else if (et != null)
et.ElementType = definedType;
}
else if (et != null)
et.ElementType = definedType;
}
}
}
return result;
}
}
[Serializable]
public abstract partial class IfcTypeResource : IfcTypeObject, IfcResourceSelect //ABSTRACT SUPERTYPE OF(IfcConstructionResourceType)
{
internal string mIdentification = "$";// : OPTIONAL IfcIdentifier;
internal string mLongDescription = "$";// : OPTIONAL IfcText;
internal string mResourceType = "$";// : OPTIONAL IfcLabel;
//INVERSE
internal SET<IfcRelAssignsToResource> mResourceOf = new SET<IfcRelAssignsToResource>();// : SET [0:?] OF IfcRelAssignsToResource FOR RelatingResource;
public string Identification { get { return (mIdentification == "$" ? "" : ParserIfc.Decode(mIdentification)); } set { mIdentification = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public string LongDescription { get { return (mLongDescription == "$" ? "" : ParserIfc.Decode(mLongDescription)); } set { mLongDescription = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
public string ResourceType { get { return (mResourceType == "$" ? "" : ParserIfc.Decode(mResourceType)); } set { mResourceType = (string.IsNullOrEmpty(value) ? "$" : ParserIfc.Encode(value)); } }
//INVERSE
public SET<IfcRelAssignsToResource> ResourceOf { get { return mResourceOf; } }
protected IfcTypeResource() : base() { }
protected IfcTypeResource(DatabaseIfc db, IfcTypeResource t, DuplicateOptions options) : base(db, t, options) { mIdentification = t.mIdentification; mLongDescription = t.mLongDescription; mResourceType = t.mResourceType; }
protected IfcTypeResource(DatabaseIfc db) : base(db) { }
}
}
| 52.885346 | 370 | 0.742191 | [
"MIT"
] | seb-esser/GeometryGymIFC | Core/IFC/IFC T.cs | 77,953 | C# |
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Dapper;
using DotNetCore.CAP.Dashboard;
using DotNetCore.CAP.Dashboard.Monitoring;
using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Models;
namespace DotNetCore.CAP.MySql
{
internal class MySqlMonitoringApi : IMonitoringApi
{
private readonly string _prefix;
private readonly MySqlStorage _storage;
public MySqlMonitoringApi(IStorage storage, MySqlOptions options)
{
_storage = storage as MySqlStorage ?? throw new ArgumentNullException(nameof(storage));
_prefix = options?.TableNamePrefix ?? throw new ArgumentNullException(nameof(options));
}
public StatisticsDto GetStatistics()
{
var sql = string.Format(@"
set transaction isolation level read committed;
select count(Id) from `{0}.published` where StatusName = N'Succeeded';
select count(Id) from `{0}.received` where StatusName = N'Succeeded';
select count(Id) from `{0}.published` where StatusName = N'Failed';
select count(Id) from `{0}.received` where StatusName = N'Failed';
select count(Id) from `{0}.published` where StatusName in (N'Processing',N'Scheduled',N'Enqueued');
select count(Id) from `{0}.received` where StatusName in (N'Processing',N'Scheduled',N'Enqueued');", _prefix);
var statistics = UseConnection(connection =>
{
var stats = new StatisticsDto();
using (var multi = connection.QueryMultiple(sql))
{
stats.PublishedSucceeded = multi.ReadSingle<int>();
stats.ReceivedSucceeded = multi.ReadSingle<int>();
stats.PublishedFailed = multi.ReadSingle<int>();
stats.ReceivedFailed = multi.ReadSingle<int>();
stats.PublishedProcessing = multi.ReadSingle<int>();
stats.ReceivedProcessing = multi.ReadSingle<int>();
}
return stats;
});
return statistics;
}
public IDictionary<DateTime, int> HourlyFailedJobs(MessageType type)
{
var tableName = type == MessageType.Publish ? "published" : "received";
return UseConnection(connection =>
GetHourlyTimelineStats(connection, tableName, StatusName.Failed));
}
public IDictionary<DateTime, int> HourlySucceededJobs(MessageType type)
{
var tableName = type == MessageType.Publish ? "published" : "received";
return UseConnection(connection =>
GetHourlyTimelineStats(connection, tableName, StatusName.Succeeded));
}
public IList<MessageDto> Messages(MessageQueryDto queryDto)
{
var tableName = queryDto.MessageType == MessageType.Publish ? "published" : "received";
var where = string.Empty;
if (!string.IsNullOrEmpty(queryDto.StatusName))
if (string.Equals(queryDto.StatusName, StatusName.Processing,
StringComparison.CurrentCultureIgnoreCase))
where += " and StatusName in (N'Processing',N'Scheduled',N'Enqueued')";
else
where += " and StatusName=@StatusName";
if (!string.IsNullOrEmpty(queryDto.Name))
where += " and Name=@Name";
if (!string.IsNullOrEmpty(queryDto.Group))
where += " and Group=@Group";
if (!string.IsNullOrEmpty(queryDto.Content))
where += " and Content like '%@Content%'";
var sqlQuery =
$"select * from `{_prefix}.{tableName}` where 1=1 {where} order by Added desc limit @Limit offset @Offset";
return UseConnection(conn => conn.Query<MessageDto>(sqlQuery, new
{
queryDto.StatusName,
queryDto.Group,
queryDto.Name,
queryDto.Content,
Offset = queryDto.CurrentPage * queryDto.PageSize,
Limit = queryDto.PageSize
}).ToList());
}
public int PublishedFailedCount()
{
return UseConnection(conn => GetNumberOfMessage(conn, "published", StatusName.Failed));
}
public int PublishedProcessingCount()
{
return UseConnection(conn => GetNumberOfMessage(conn, "published", StatusName.Processing));
}
public int PublishedSucceededCount()
{
return UseConnection(conn => GetNumberOfMessage(conn, "published", StatusName.Succeeded));
}
public int ReceivedFailedCount()
{
return UseConnection(conn => GetNumberOfMessage(conn, "received", StatusName.Failed));
}
public int ReceivedProcessingCount()
{
return UseConnection(conn => GetNumberOfMessage(conn, "received", StatusName.Processing));
}
public int ReceivedSucceededCount()
{
return UseConnection(conn => GetNumberOfMessage(conn, "received", StatusName.Succeeded));
}
private int GetNumberOfMessage(IDbConnection connection, string tableName, string statusName)
{
var sqlQuery = statusName == StatusName.Processing
? $"select count(Id) from `{_prefix}.{tableName}` where StatusName in (N'Processing',N'Scheduled',N'Enqueued')"
: $"select count(Id) from `{_prefix}.{tableName}` where StatusName = @state";
var count = connection.ExecuteScalar<int>(sqlQuery, new {state = statusName});
return count;
}
private T UseConnection<T>(Func<IDbConnection, T> action)
{
return _storage.UseConnection(action);
}
private Dictionary<DateTime, int> GetHourlyTimelineStats(IDbConnection connection, string tableName,
string statusName)
{
var endDate = DateTime.Now;
var dates = new List<DateTime>();
for (var i = 0; i < 24; i++)
{
dates.Add(endDate);
endDate = endDate.AddHours(-1);
}
var keyMaps = dates.ToDictionary(x => x.ToString("yyyy-MM-dd-HH"), x => x);
return GetTimelineStats(connection, tableName, statusName, keyMaps);
}
private Dictionary<DateTime, int> GetTimelineStats(
IDbConnection connection,
string tableName,
string statusName,
IDictionary<string, DateTime> keyMaps)
{
var sqlQuery =
$@"
select aggr.* from (
select date_format(`Added`,'%Y-%m-%d-%H') as `Key`,
count(id) `Count`
from `{_prefix}.{tableName}`
where StatusName = @statusName
group by date_format(`Added`,'%Y-%m-%d-%H')
) aggr where `Key` in @keys;";
var valuesMap = connection.Query(
sqlQuery,
new {keys = keyMaps.Keys, statusName})
.ToDictionary(x => (string) x.Key, x => (int) x.Count);
foreach (var key in keyMaps.Keys)
if (!valuesMap.ContainsKey(key)) valuesMap.Add(key, 0);
var result = new Dictionary<DateTime, int>();
for (var i = 0; i < keyMaps.Count; i++)
{
var value = valuesMap[keyMaps.ElementAt(i).Key];
result.Add(keyMaps.ElementAt(i).Value, value);
}
return result;
}
}
} | 38.881443 | 127 | 0.588758 | [
"MIT"
] | hybirdtheory/CAP | src/DotNetCore.CAP.MySql/MySqlMonitoringApi.cs | 7,545 | C# |
using System;
using Newtonsoft.Json;
using Orleans.GrainDirectory;
namespace Orleans.Runtime
{
[Serializable]
internal class ActivationAddress
{
public GrainId Grain { get; private set; }
public ActivationId Activation { get; private set; }
public SiloAddress Silo { get; private set; }
public bool IsComplete
{
get { return Grain != null && Activation != null && Silo != null; }
}
[JsonConstructor]
private ActivationAddress(SiloAddress silo, GrainId grain, ActivationId activation)
{
Silo = silo;
Grain = grain;
Activation = activation;
}
public static ActivationAddress NewActivationAddress(SiloAddress silo, GrainId grain)
{
var activation = ActivationId.NewId();
return GetAddress(silo, grain, activation);
}
public static ActivationAddress GetAddress(SiloAddress silo, GrainId grain, ActivationId activation)
{
// Silo part is not mandatory
if (grain == null) throw new ArgumentNullException("grain");
return new ActivationAddress(silo, grain, activation);
}
public override bool Equals(object obj)
{
var other = obj as ActivationAddress;
return other != null && Equals(Silo, other.Silo) && Equals(Grain, other.Grain) && Equals(Activation, other.Activation);
}
public override int GetHashCode()
{
return (Silo != null ? Silo.GetHashCode() : 0) ^
(Grain != null ? Grain.GetHashCode() : 0) ^
(Activation != null ? Activation.GetHashCode() : 0);
}
public override string ToString()
{
return String.Format("{0}{1}{2}", Silo, Grain, Activation);
}
public string ToFullString()
{
return
String.Format(
"[ActivationAddress: {0}, Full GrainId: {1}, Full ActivationId: {2}]",
this.ToString(), // 0
this.Grain.ToFullString(), // 1
this.Activation.ToFullString()); // 2
}
public bool Matches(ActivationAddress other)
{
return Equals(Grain, other.Grain) && Equals(Activation, other.Activation);
}
}
}
| 32.28 | 131 | 0.553077 | [
"MIT"
] | Horusiath/orleans | src/Orleans/IDs/ActivationAddress.cs | 2,421 | C# |
namespace P04.Hospital
{
using System;
using System.Collections.Generic;
using System.Linq;
public class Hospital
{
public static void Main()
{
var hospitalData = FillHospitalData();
PrintOutput(hospitalData);
}
private static List<string> FillHospitalData()
{
var hospitalData = new List<string>();
while (true)
{
var hospitalInfo = Console.ReadLine();
if (hospitalInfo == "Output")
{
break;
}
hospitalData.Add(hospitalInfo);
}
return hospitalData;
}
private static void PrintOutput(List<string> hospitalData)
{
while (true)
{
var commandLine = Console.ReadLine();
if (commandLine == "End")
{
break;
}
var commandTokens = commandLine.Split();
if (commandTokens.Length == 1)
{
PrintGivenDepartmentPatients(hospitalData, commandTokens);
}
else if (char.IsDigit(commandTokens[1][0]))
{
PrintPatientsInGivenDepartmentRoom(hospitalData, commandTokens);
}
else
{
PrintGivenDoctorPatients(hospitalData, commandLine);
}
}
}
private static void PrintGivenDepartmentPatients(List<string> hospitalData, string[] commandTokens)
{
var department = commandTokens[0];
hospitalData.Where(s => s.StartsWith(department))
.Select(s => s.Split().Last())
.ToList()
.ForEach(Console.WriteLine);
}
private static void PrintPatientsInGivenDepartmentRoom(List<string> hospitalData, string[] commandTokens)
{
var department = commandTokens[0];
var room = int.Parse(commandTokens[1]);
hospitalData.Where(s => s.StartsWith(department))
.Select(s => s.Split().Last())
.Skip((room - 1) * 3)
.Take(3)
.OrderBy(s => s)
.ToList()
.ForEach(Console.WriteLine);
}
private static void PrintGivenDoctorPatients(List<string> hospitalData, string doctor)
{
hospitalData.Where(s => s.Contains(doctor))
.Select(s => s.Split().Last())
.OrderBy(s => s)
.ToList()
.ForEach(Console.WriteLine);
}
}
} | 28.572917 | 113 | 0.481225 | [
"MIT"
] | ViktorAleksandrov/SoftUni--CSharp-Fundamentals | 1. CSharp Advanced/5.1. Exam Preparation 1 - CSharp Advanced Exam - 25 June 2017/P04.Hospital/Hospital.cs | 2,745 | C# |
using Dasync.ValueContainer;
namespace Dasync.Serialization
{
public interface IObjectDecomposer
{
IValueContainer Decompose(object value);
}
}
| 16.6 | 48 | 0.722892 | [
"Apache-2.0"
] | Dasync/Dasync | src/Data/Serialization/IObjectDecomposer.cs | 168 | C# |
//----------------------------------------------------------------------------
// Copyright (C) 2004-2016 by EMGU Corporation. All rights reserved.
//----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using System.IO;
using Emgu.Util;
namespace Emgu.CV.Cuda
{
/// <summary>
/// This class wraps the functional calls to the opencv_gpu module
/// </summary>
public static partial class CudaInvoke
{
static CudaInvoke()
{
//Dummy code to make sure the static constructor of CvInvoke has been called and the error handler has been registered.
CvInvoke.CheckLibraryLoaded();
/*
#if !IOS
String[] modules = new String[]
{
CvInvoke.ExternCudaLibrary
};
String formatString = CvInvoke.GetModuleFormatString();
for (int i = 0; i < modules.Length; ++i)
{
modules[i] = String.Format(formatString, modules[i]);
}
CvInvoke.LoadUnmanagedModules(null, modules);
#endif */
}
#region device info
#region HasCuda
private static bool _testedCuda = false;
private static bool _hasCuda = false;
/// <summary>
/// Return true if Cuda is found on the system
/// </summary>
public static bool HasCuda
{
get
{
#if IOS
return _hasCuda;
#else
if (_testedCuda)
return _hasCuda;
else
{
_testedCuda = true;
try
{
_hasCuda = GetCudaEnabledDeviceCount() > 0;
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(String.Format("unable to retrieve cuda device count: {0}", e.Message));
}
return _hasCuda;
}
#endif
}
}
#endregion
/// <summary>
/// Get the opencl platform summary as a string
/// </summary>
/// <returns>An opencl platfor summary</returns>
public static String GetCudaDevicesSummary()
{
StringBuilder builder = new StringBuilder();
if (HasCuda)
{
builder.Append(String.Format("Has cuda: true{0}", Environment.NewLine));
int deviceCount = GetCudaEnabledDeviceCount();
builder.Append(String.Format("Cuda devices: {0}{1}", deviceCount, Environment.NewLine));
for (int i = 0; i < deviceCount; i++)
{
using (CudaDeviceInfo deviceInfo = new CudaDeviceInfo(i))
{
builder.Append(String.Format(" Device {0}: {1}{2}", i, deviceInfo.Name, Environment.NewLine));
}
}
return builder.ToString();
}
else
{
return "Has cuda: false";
}
}
/// <summary>
/// Get the number of Cuda enabled devices
/// </summary>
/// <returns>The number of Cuda enabled devices</returns>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "cudaGetCudaEnabledDeviceCount")]
public static extern int GetCudaEnabledDeviceCount();
/// <summary>
/// Set the current Gpu Device
/// </summary>
/// <param name="deviceId">The id of the device to be setted as current</param>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "cudaSetDevice")]
public static extern void SetDevice(int deviceId);
/// <summary>
/// Get the current Cuda device id
/// </summary>
/// <returns>The current Cuda device id</returns>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "cudaGetDevice")]
public static extern int GetDevice();
#endregion
/// <summary>
/// Create a GpuMat from the specific region of <paramref name="gpuMat"/>. The data is shared between the two GpuMat.
/// </summary>
/// <param name="gpuMat">The gpuMat to extract regions from.</param>
/// <param name="colRange">The column range. Use MCvSlice.WholeSeq for all columns.</param>
/// <param name="rowRange">The row range. Use MCvSlice.WholeSeq for all rows.</param>
/// <returns>Pointer to the GpuMat</returns>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "gpuMatGetRegion")]
public static extern IntPtr GetRegion(IntPtr gpuMat, ref Range rowRange, ref Range colRange);
/// <summary>
/// Resize the GpuMat
/// </summary>
/// <param name="src">The input GpuMat</param>
/// <param name="dst">The resulting GpuMat</param>
/// <param name="interpolation">The interpolation type</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or IntPtr.Zero to call the function synchronously (blocking).</param>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "gpuMatResize")]
public static extern void GpuMatResize(IntPtr src, IntPtr dst, CvEnum.Inter interpolation, IntPtr stream);
/// <summary>
/// gpuMatReshape the src GpuMat
/// </summary>
/// <param name="src">The source GpuMat</param>
/// <param name="dst">The resulting GpuMat, as input it should be an empty GpuMat.</param>
/// <param name="cn">The new number of channels</param>
/// <param name="rows">The new number of rows</param>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "gpuMatReshape")]
public static extern void GpuMatReshape(IntPtr src, IntPtr dst, int cn, int rows);
/// <summary>
/// Returns header, corresponding to a specified rectangle of the input GpuMat. In other words, it allows the user to treat a rectangular part of input array as a stand-alone array.
/// </summary>
/// <param name="mat">Input GpuMat</param>
/// <param name="rect">Zero-based coordinates of the rectangle of interest.</param>
/// <returns>Pointer to the resultant sub-array header.</returns>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "gpuMatGetSubRect")]
public static extern IntPtr GetSubRect(IntPtr mat, ref Rectangle rect);
#region arithmatic
/// <summary>
/// Shifts a matrix to the left (c = a << scalar)
/// </summary>
/// <param name="a">The matrix to be shifted.</param>
/// <param name="scalar">The scalar to shift by.</param>
/// <param name="c">The result of the shift</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or IntPtr.Zero to call the function synchronously (blocking).</param>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "cudaLShift")]
public static extern void LShift(IntPtr a, ref MCvScalar scalar, IntPtr c, IntPtr stream);
/// <summary>
/// Shifts a matrix to the right (c = a >> scalar)
/// </summary>
/// <param name="a">The matrix to be shifted.</param>
/// <param name="scalar">The scalar to shift by.</param>
/// <param name="c">The result of the shift</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or IntPtr.Zero to call the function synchronously (blocking).</param>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention, EntryPoint = "cudaRShift")]
public static extern void RShift(IntPtr a, ref MCvScalar scalar, IntPtr c, IntPtr stream);
/// <summary>
/// Adds one matrix to another (c = a + b).
/// </summary>
/// <param name="a">The first matrix to be added.</param>
/// <param name="b">The second matrix to be added.</param>
/// <param name="c">The sum of the two matrix</param>
/// <param name="mask">The optional mask that is used to select a subarray. Use null if not needed</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
/// <param name="depthType">Optional depth of the output array.</param>
public static void Add(IInputArray a, IInputArray b, IOutputArray c, IInputArray mask = null, DepthType depthType = DepthType.Default, Stream stream = null)
{
using (InputArray iaA = a.GetInputArray())
using (InputArray iaB = b.GetInputArray())
using (OutputArray oaC = c.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaAdd(iaA, iaB, oaC, iaMask, depthType, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaAdd(IntPtr a, IntPtr b, IntPtr c, IntPtr mask, DepthType depthType, IntPtr stream);
/// <summary>
/// Subtracts one matrix from another (c = a - b).
/// </summary>
/// <param name="a">The matrix where subtraction take place</param>
/// <param name="b">The matrix to be substracted</param>
/// <param name="c">The result of a - b</param>
/// <param name="mask">The optional mask that is used to select a subarray. Use null if not needed</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
/// <param name="depthType">Optional depth of the output array.</param>
public static void Subtract(IInputArray a, IInputArray b, IOutputArray c, IInputArray mask = null, DepthType depthType = DepthType.Default, Stream stream = null)
{
using (InputArray iaA = a.GetInputArray())
using (InputArray iaB = b.GetInputArray())
using (OutputArray oaC = c.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaSubtract(iaA, iaB, oaC, iaMask, depthType, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaSubtract(IntPtr a, IntPtr b, IntPtr c, IntPtr mask, DepthType depthType, IntPtr stream);
/// <summary>
/// Computes element-wise product of the two GpuMat: c = scale * a * b.
/// </summary>
/// <param name="a">The first GpuMat to be element-wise multiplied.</param>
/// <param name="b">The second GpuMat to be element-wise multiplied.</param>
/// <param name="c">The element-wise multiplication of the two GpuMat</param>
/// <param name="scale">The scale</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
/// <param name="depthType">Optional depth of the output array.</param>
public static void Multiply(IInputArray a, IInputArray b, IOutputArray c, double scale = 1.0, DepthType depthType = DepthType.Default, Stream stream = null)
{
using (InputArray iaA = a.GetInputArray())
using (InputArray iaB = b.GetInputArray())
using (OutputArray oaC = c.GetOutputArray())
cudaMultiply(iaA, iaB, oaC, scale, depthType, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMultiply(IntPtr a, IntPtr b, IntPtr c, double scale, DepthType depthType, IntPtr stream);
/// <summary>
/// Computes element-wise quotient of the two GpuMat (c = scale * a / b).
/// </summary>
/// <param name="a">The first GpuMat</param>
/// <param name="b">The second GpuMat</param>
/// <param name="c">The element-wise quotient of the two GpuMat</param>
/// <param name="scale">The scale</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
/// <param name="depthType">Optional depth of the output array.</param>
public static void Divide(IInputArray a, IInputArray b, IOutputArray c, double scale = 1.0, DepthType depthType = DepthType.Default, Stream stream = null)
{
using (InputArray iaA = a.GetInputArray())
using (InputArray iaB = b.GetInputArray())
using (OutputArray oaC = c.GetOutputArray())
cudaDivide(iaA, iaB, oaC, scale, depthType, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaDivide(IntPtr a, IntPtr b, IntPtr c, double scale, DepthType depthType, IntPtr stream);
/// <summary>
/// Computes the weighted sum of two arrays (dst = alpha*src1 + beta*src2 + gamma)
/// </summary>
/// <param name="src1">The first source GpuMat</param>
/// <param name="alpha">The weight for <paramref name="src1"/></param>
/// <param name="src2">The second source GpuMat</param>
/// <param name="beta">The weight for <paramref name="src2"/></param>
/// <param name="gamma">The constant to be added</param>
/// <param name="dst">The result</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
/// <param name="depthType">Optional depth of the output array.</param>
public static void AddWeighted(IInputArray src1, double alpha, IInputArray src2, double beta, double gamma, IOutputArray dst, DepthType depthType = DepthType.Default, Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaAddWeighted(iaSrc1, alpha, iaSrc2, beta, gamma, oaDst, depthType, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaAddWeighted(IntPtr src1, double alpha, IntPtr src2, double beta, double gamma, IntPtr dst, DepthType depthType, IntPtr stream);
/// <summary>
/// Computes element-wise absolute difference of two GpuMats (c = abs(a - b)).
/// </summary>
/// <param name="a">The first GpuMat</param>
/// <param name="b">The second GpuMat</param>
/// <param name="c">The result of the element-wise absolute difference.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Absdiff(IInputArray a, IInputArray b, IOutputArray c, Stream stream = null)
{
using (InputArray iaA = a.GetInputArray())
using (InputArray iaB = b.GetInputArray())
using (OutputArray oaC = c.GetOutputArray())
cudaAbsdiff(iaA, iaB, oaC, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaAbsdiff(IntPtr a, IntPtr b, IntPtr c, IntPtr stream);
/// <summary>
/// Computes absolute value of each pixel in an image
/// </summary>
/// <param name="src">The source GpuMat, support depth of Int16 and float.</param>
/// <param name="dst">The resulting GpuMat</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Abs(IInputArray src, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaAbs(iaSrc, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaAbs(IntPtr src, IntPtr dst, IntPtr stream);
/// <summary>
/// Computes square of each pixel in an image
/// </summary>
/// <param name="src">The source GpuMat, support depth of byte, UInt16, Int16 and float.</param>
/// <param name="dst">The resulting GpuMat</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Sqr(IInputArray src, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaSqr(iaSrc, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaSqr(IntPtr src, IntPtr dst, IntPtr stream);
/// <summary>
/// Computes square root of each pixel in an image
/// </summary>
/// <param name="src">The source GpuMat, support depth of byte, UInt16, Int16 and float.</param>
/// <param name="dst">The resulting GpuMat</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Sqrt(IInputArray src, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaSqrt(iaSrc, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaSqrt(IntPtr src, IntPtr dst, IntPtr stream);
/// <summary>
/// Transposes a matrix.
/// </summary>
/// <param name="src">Source matrix. 1-, 4-, 8-byte element sizes are supported for now.</param>
/// <param name="dst">Destination matrix.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Transpose(IInputArray src, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaTranspose(iaSrc, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaTranspose(IntPtr src, IntPtr dst, IntPtr stream);
#endregion
/// <summary>
/// Compares elements of two GpuMats (c = a <cmpop> b).
/// Supports CV_8UC4, CV_32FC1 types
/// </summary>
/// <param name="a">The first GpuMat</param>
/// <param name="b">The second GpuMat</param>
/// <param name="c">The result of the comparison.</param>
/// <param name="cmpop">The type of comparison</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Compare(IInputArray a, IInputArray b, IOutputArray c, CvEnum.CmpType cmpop, Stream stream = null)
{
using (InputArray iaA = a.GetInputArray())
using (InputArray iaB = b.GetInputArray())
using (OutputArray oaC = c.GetOutputArray())
cudaCompare(iaA, iaB, oaC, cmpop, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaCompare(IntPtr a, IntPtr b, IntPtr c, CvEnum.CmpType cmpop, IntPtr stream);
/// <summary>
/// Resizes the image.
/// </summary>
/// <param name="src">The source image. Has to be GpuMat<Byte>. If stream is used, the GpuMat has to be either single channel or 4 channels.</param>
/// <param name="dst">The destination image.</param>
/// <param name="interpolation">The interpolation type. Supports INTER_NEAREST, INTER_LINEAR.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
/// <param name="fx">Scale factor along the horizontal axis. If it is zero, it is computed as: (double)dsize.width/src.cols</param>
/// <param name="fy">Scale factor along the vertical axis. If it is zero, it is computed as: (double)dsize.height/src.rows</param>
/// <param name="dsize">Destination image size. If it is zero, it is computed as: dsize = Size(round(fx* src.cols), round(fy* src.rows)). Either dsize or both fx and fy must be non-zero.</param>
public static void Resize(IInputArray src, IOutputArray dst, Size dsize, double fx = 0, double fy = 0, CvEnum.Inter interpolation = Inter.Linear, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaResize(iaSrc, oaDst, ref dsize, fx, fy, interpolation, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaResize(IntPtr src, IntPtr dst, ref Size dsize, double fx, double fy, CvEnum.Inter interpolation, IntPtr stream);
/// <summary>
/// Copies each plane of a multi-channel GpuMat to a dedicated GpuMat
/// </summary>
/// <param name="src">The multi-channel gpuMat</param>
/// <param name="dstArray">Pointer to an array of single channel GpuMat pointers</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or IntPtr.Zero to call the function synchronously (blocking).</param>
public static void Split(IInputArray src, VectorOfGpuMat dstArray, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
cudaSplit(iaSrc, dstArray, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaSplit(IntPtr src, IntPtr dstArray, IntPtr stream);
/// <summary>
/// Makes multi-channel GpuMat out of several single-channel GpuMats
/// </summary>
/// <param name="srcArr">Pointer to an array of single channel GpuMat pointers</param>
/// <param name="dst">The multi-channel gpuMat</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or IntPtr.Zero to call the function synchronously (blocking).</param>
public static void Merge(VectorOfGpuMat srcArr, IOutputArray dst, Stream stream = null)
{
using (OutputArray oaDst = dst.GetOutputArray())
cudaMerge(srcArr, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMerge(IntPtr srcArr, IntPtr dst, IntPtr stream);
/// <summary>
/// Computes exponent of each matrix element (b = exp(a))
/// </summary>
/// <param name="src">The source GpuMat. Supports Byte, UInt16, Int16 and float type.</param>
/// <param name="dst">The resulting GpuMat</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Exp(IInputArray src, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaExp(iaSrc, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaExp(IntPtr src, IntPtr dst, IntPtr stream);
/// <summary>
/// Computes power of each matrix element:
/// (dst(i,j) = pow( src(i,j) , power), if src.type() is integer;
/// (dst(i,j) = pow(fabs(src(i,j)), power), otherwise.
/// supports all, except depth == CV_64F
/// </summary>
/// <param name="src">The source GpuMat</param>
/// <param name="power">The power</param>
/// <param name="dst">The resulting GpuMat</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Pow(IInputArray src, double power, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaPow(iaSrc, power, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaPow(IntPtr src, double power, IntPtr dst, IntPtr stream);
/// <summary>
/// Computes natural logarithm of absolute value of each matrix element: b = log(abs(a))
/// </summary>
/// <param name="src">The source GpuMat. Supports Byte, UInt16, Int16 and float type.</param>
/// <param name="dst">The resulting GpuMat</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Log(IInputArray src, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaLog(iaSrc, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaLog(IntPtr src, IntPtr dst, IntPtr stream);
/// <summary>
/// Computes magnitude of each (x(i), y(i)) vector
/// </summary>
/// <param name="x">The source GpuMat. Supports only floating-point type</param>
/// <param name="y">The source GpuMat. Supports only floating-point type</param>
/// <param name="magnitude">The destination GpuMat. Supports only floating-point type</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Magnitude(IInputArray x, IInputArray y, IOutputArray magnitude, Stream stream = null)
{
using (InputArray iaX = x.GetInputArray())
using (InputArray iaY = y.GetInputArray())
using (OutputArray oaMagnitude = magnitude.GetOutputArray())
cudaMagnitude(iaX, iaY, oaMagnitude, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMagnitude(IntPtr x, IntPtr y, IntPtr magnitude, IntPtr stream);
/// <summary>
/// Computes squared magnitude of each (x(i), y(i)) vector
/// </summary>
/// <param name="x">The source GpuMat. Supports only floating-point type</param>
/// <param name="y">The source GpuMat. Supports only floating-point type</param>
/// <param name="magnitude">The destination GpuMat. Supports only floating-point type</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void MagnitudeSqr(IInputArray x, IInputArray y, IOutputArray magnitude, Stream stream = null)
{
using (InputArray iaX = x.GetInputArray())
using (InputArray iaY = y.GetInputArray())
using (OutputArray oaMagnitude = magnitude.GetOutputArray())
cudaMagnitudeSqr(iaX, iaY, oaMagnitude, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMagnitudeSqr(IntPtr x, IntPtr y, IntPtr magnitude, IntPtr stream);
/// <summary>
/// Computes angle (angle(i)) of each (x(i), y(i)) vector
/// </summary>
/// <param name="x">The source GpuMat. Supports only floating-point type</param>
/// <param name="y">The source GpuMat. Supports only floating-point type</param>
/// <param name="angle">The destination GpuMat. Supports only floating-point type</param>
/// <param name="angleInDegrees">If true, the output angle is in degrees, otherwise in radian</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Phase(IInputArray x, IInputArray y, IOutputArray angle, bool angleInDegrees = false, Stream stream = null)
{
using (InputArray iaX = x.GetInputArray())
using (InputArray iaY = y.GetInputArray())
using (OutputArray oaAngle = angle.GetOutputArray())
cudaPhase(iaX, iaY, oaAngle, angleInDegrees, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaPhase(
IntPtr x, IntPtr y, IntPtr angle,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool angleInDegrees, IntPtr stream);
/// <summary>
/// Converts Cartesian coordinates to polar
/// </summary>
/// <param name="x">The source GpuMat. Supports only floating-point type</param>
/// <param name="y">The source GpuMat. Supports only floating-point type</param>
/// <param name="magnitude">The destination GpuMat. Supports only floating-point type</param>
/// <param name="angle">The destination GpuMat. Supports only floating-point type</param>
/// <param name="angleInDegrees">If true, the output angle is in degrees, otherwise in radian</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void CartToPolar(IInputArray x, IInputArray y, IOutputArray magnitude, IOutputArray angle, bool angleInDegrees = false, Stream stream = null)
{
using (InputArray iaX = x.GetInputArray())
using (InputArray iaY = y.GetInputArray())
using (OutputArray oaMagnitude = magnitude.GetOutputArray())
using (OutputArray oaAngle = angle.GetOutputArray())
cudaCartToPolar(iaX, iaY, oaMagnitude, oaAngle, angleInDegrees, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaCartToPolar(
IntPtr x, IntPtr y, IntPtr magnitude, IntPtr angle,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool angleInDegrees, IntPtr stream);
/// <summary>
/// Converts polar coordinates to Cartesian
/// </summary>
/// <param name="magnitude">The source GpuMat. Supports only floating-point type</param>
/// <param name="angle">The source GpuMat. Supports only floating-point type</param>
/// <param name="x">The destination GpuMat. Supports only floating-point type</param>
/// <param name="y">The destination GpuMat. Supports only floating-point type</param>
/// <param name="angleInDegrees">If true, the input angle is in degrees, otherwise in radian</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void PolarToCart(IInputArray magnitude, IInputArray angle, IOutputArray x, IOutputArray y, bool angleInDegrees = false, Stream stream = null)
{
using (InputArray iaMagnitude = magnitude.GetInputArray())
using (InputArray iaAngle = angle.GetInputArray())
using (OutputArray oaX = x.GetOutputArray())
using (OutputArray oaY = y.GetOutputArray())
cudaPolarToCart(iaMagnitude, iaAngle, oaX, oaY, angleInDegrees, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaPolarToCart(
IntPtr magnitude, IntPtr angle, IntPtr x, IntPtr y,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool angleInDegrees, IntPtr stream);
/// <summary>
/// Finds minimum and maximum element values and their positions. The extremums are searched over the whole GpuMat or, if mask is not IntPtr.Zero, in the specified GpuMat region.
/// </summary>
/// <param name="gpuMat">The source GpuMat, single-channel</param>
/// <param name="minVal">Pointer to returned minimum value</param>
/// <param name="maxVal">Pointer to returned maximum value</param>
/// <param name="minLoc">Pointer to returned minimum location</param>
/// <param name="maxLoc">Pointer to returned maximum location</param>
/// <param name="mask">The optional mask that is used to select a subarray. Use null if not needed</param>
public static void MinMaxLoc(IInputArray gpuMat, ref double minVal, ref double maxVal, ref Point minLoc, ref Point maxLoc, IInputArray mask = null)
{
using (InputArray iaMat = gpuMat.GetInputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaMinMaxLoc(iaMat, ref minVal, ref maxVal, ref minLoc, ref maxLoc, iaMask);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMinMaxLoc(IntPtr gpuMat, ref double minVal, ref double maxVal, ref Point minLoc, ref Point maxLoc, IntPtr mask);
/// <summary>
/// Finds global minimum and maximum matrix elements and returns their values with locations.
/// </summary>
/// <param name="src">Single-channel source image.</param>
/// <param name="minMaxVals">The output min and max values</param>
/// <param name="loc">The ouput min and max locations</param>
/// <param name="mask">Optional mask to select a sub-matrix.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void FindMinMaxLoc(IInputArray src, IOutputArray minMaxVals, IOutputArray loc,
IInputArray mask = null, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaMinMaxVals = minMaxVals.GetOutputArray())
using (OutputArray oaLoc = loc.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
{
cudaFindMinMaxLoc(iaSrc, oaMinMaxVals, oaLoc, iaMask, stream);
}
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaFindMinMaxLoc(IntPtr src, IntPtr minMaxVals, IntPtr loc, IntPtr mask, IntPtr stream);
/// <summary>
/// Performs downsampling step of Gaussian pyramid decomposition.
/// </summary>
/// <param name="src">The source CudaImage.</param>
/// <param name="dst">The destination CudaImage, should have 2x smaller width and height than the source.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void PyrDown(IInputArray src, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaPyrDown(iaSrc, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaPyrDown(IntPtr src, IntPtr dst, IntPtr stream);
/// <summary>
/// Performs up-sampling step of Gaussian pyramid decomposition.
/// </summary>
/// <param name="src">The source CudaImage.</param>
/// <param name="dst">The destination image, should have 2x smaller width and height than the source.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void PyrUp(IInputArray src, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaPyrUp(iaSrc, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaPyrUp(IntPtr src, IntPtr dst, IntPtr stream);
/// <summary>
/// Computes mean value and standard deviation
/// </summary>
/// <param name="mtx">The GpuMat. Supports only CV_8UC1 type</param>
/// <param name="mean">The mean value</param>
/// <param name="stddev">The standard deviation</param>
public static void MeanStdDev(IInputArray mtx, ref MCvScalar mean, ref MCvScalar stddev)
{
using (InputArray iaMtx = mtx.GetInputArray())
cudaMeanStdDev(iaMtx, ref mean, ref stddev);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMeanStdDev(IntPtr mtx, ref MCvScalar mean, ref MCvScalar stddev);
/// <summary>
/// Computes norm of the difference between two GpuMats
/// </summary>
/// <param name="src1">The GpuMat. Supports only CV_8UC1 type</param>
/// <param name="src2">If IntPtr.Zero, norm operation is apply to <paramref name="src1"/> only. Otherwise, this is the GpuMat of type CV_8UC1</param>
/// <param name="normType">The norm type. Supports NORM_INF, NORM_L1, NORM_L2.</param>
/// <returns>The norm of the <paramref name="src1"/> if <paramref name="src2"/> is IntPtr.Zero. Otherwise the norm of the difference between two GpuMats.</returns>
public static double Norm(IInputArray src1, IInputArray src2, Emgu.CV.CvEnum.NormType normType = NormType.L2)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2 == null ? InputArray.GetEmpty() : src2.GetInputArray())
return cudaNorm2(iaSrc1, iaSrc2, normType);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern double cudaNorm2(IntPtr src1, IntPtr src2, Emgu.CV.CvEnum.NormType normType);
/// <summary>
/// Returns the norm of a matrix.
/// </summary>
/// <param name="src">Source matrix. Any matrices except 64F are supported.</param>
/// <param name="normType">Norm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.</param>
/// <param name="mask">optional operation mask; it must have the same size as src1 and CV_8UC1 type.</param>
/// <returns>The norm of a matrix</returns>
public static double Norm(IInputArray src, Emgu.CV.CvEnum.NormType normType, IInputArray mask = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
return cudaNorm1(iaSrc, normType, iaMask);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern double cudaNorm1(IntPtr src1, Emgu.CV.CvEnum.NormType normType, IntPtr mask);
/// <summary>
/// Returns the norm of a matrix.
/// </summary>
/// <param name="src">Source matrix. Any matrices except 64F are supported.</param>
/// <param name="dst">The GpuMat to store the result</param>
/// <param name="normType">Norm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.</param>
/// <param name="mask">optional operation mask; it must have the same size as src1 and CV_8UC1 type.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void CalcNorm(IInputArray src, IOutputArray dst, NormType normType = NormType.L2, IInputArray mask = null,
Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaCalcNorm(iaSrc, oaDst, normType, iaMask, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaCalcNorm(IntPtr src, IntPtr dst, NormType normType, IntPtr mask, IntPtr stream);
/// <summary>
/// Returns the difference of two matrices.
/// </summary>
/// <param name="src1">Source matrix. Any matrices except 64F are supported.</param>
/// <param name="src2">Second source matrix (if any) with the same size and type as src1.</param>
/// <param name="dst">The GpuMat where the result will be stored in</param>
/// <param name="normType">Norm type. NORM_L1 , NORM_L2 , and NORM_INF are supported for now.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void CalcNormDiff(IInputArray src1, IInputArray src2, IOutputArray dst, NormType normType = NormType.L2,
Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaCalcNormDiff(iaSrc1, iaSrc2, oaDst, normType, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaCalcNormDiff(IntPtr src1, IntPtr src2, IntPtr dst, NormType normType, IntPtr stream);
/// <summary>
/// Returns the sum of absolute values for matrix elements.
/// </summary>
/// <param name="src">Source image of any depth except for CV_64F.</param>
/// <param name="mask">optional operation mask; it must have the same size as src and CV_8UC1 type.</param>
/// <returns>The sum of absolute values for matrix elements.</returns>
public static MCvScalar AbsSum(IInputArray src, IInputArray mask = null)
{
MCvScalar result = new MCvScalar();
using (InputArray iaSrc = src.GetInputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaAbsSum(iaSrc, ref result, iaMask);
return result;
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaAbsSum(IntPtr src, ref MCvScalar sum, IntPtr mask);
/// <summary>
/// Returns the sum of absolute values for matrix elements.
/// </summary>
/// <param name="src">Source image of any depth except for CV_64F.</param>
/// <param name="dst">The GpuMat where the result will be stored.</param>
/// <param name="mask">optional operation mask; it must have the same size as src1 and CV_8UC1 type.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void CalcAbsSum(IInputArray src, IOutputArray dst, IInputArray mask = null, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaCalcAbsSum(iaSrc, oaDst, iaMask, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaCalcAbsSum(IntPtr src, IntPtr dst, IntPtr mask, IntPtr stream);
/// <summary>
/// Returns the squared sum of matrix elements.
/// </summary>
/// <param name="src">Source image of any depth except for CV_64F.</param>
/// <param name="mask">optional operation mask; it must have the same size as src1 and CV_8UC1 type.</param>
/// <returns>The squared sum of matrix elements.</returns>
public static MCvScalar SqrSum(IInputArray src, IInputArray mask = null)
{
MCvScalar result = new MCvScalar();
using (InputArray iaSrc = src.GetInputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaSqrSum(iaSrc, ref result, iaMask);
return result;
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaSqrSum(IntPtr src, ref MCvScalar sqrSum, IntPtr mask);
/// <summary>
/// Returns the squared sum of matrix elements.
/// </summary>
/// <param name="src">Source image of any depth except for CV_64F.</param>
/// <param name="dst">The GpuMat where the result will be stored</param>
/// <param name="mask">optional operation mask; it must have the same size as src1 and CV_8UC1 type.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void CalcSqrSum(IInputArray src, IOutputArray dst, IInputArray mask = null, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaCalcSqrSum(iaSrc, oaDst, iaMask, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaCalcSqrSum(IntPtr src, IntPtr dst, IntPtr mask, IntPtr stream);
/// <summary>
/// Counts non-zero array elements
/// </summary>
/// <param name="src">Single-channel source image.</param>
/// <returns>The number of non-zero GpuMat elements</returns>
public static int CountNonZero(IInputArray src)
{
using (InputArray iaSrc = src.GetInputArray())
return cudaCountNonZero1(iaSrc);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern int cudaCountNonZero1(IntPtr src);
/// <summary>
/// Counts non-zero array elements
/// </summary>
/// <param name="src">Single-channel source image.</param>
/// <param name="dst">A Gpu mat to hold the result</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void CountNonZero(IInputArray src, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaCountNonZero2(iaSrc, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaCountNonZero2(IntPtr src, IntPtr dst, IntPtr stream);
/// <summary>
/// Normalizes the norm or value range of an array.
/// </summary>
/// <param name="src">Input array.</param>
/// <param name="dst">Output array of the same size as src .</param>
/// <param name="alpha">Norm value to normalize to or the lower range boundary in case of the range normalization.</param>
/// <param name="beta">Upper range boundary in case of the range normalization; it is not used for the norm normalization.</param>
/// <param name="normType">Normalization type ( NORM_MINMAX , NORM_L2 , NORM_L1 or NORM_INF ).</param>
/// <param name="depthType">Optional depth of the output array.</param>
/// <param name="mask">Optional operation mask.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Normalize(IInputArray src, IOutputArray dst, double alpha, double beta, NormType normType,
CvEnum.DepthType depthType, IInputArray mask = null, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
{
cudaNormalize(iaSrc, oaDst, alpha, beta, normType, depthType, iaMask, stream);
}
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaNormalize(IntPtr src, IntPtr dst, double alpha, double beta,
NormType normType, CvEnum.DepthType dtype, IntPtr mask, IntPtr stream);
/// <summary>
/// Reduces GpuMat to a vector by treating the GpuMat rows/columns as a set of 1D vectors and performing the specified operation on the vectors until a single row/column is obtained.
/// </summary>
/// <param name="mtx">The input GpuMat</param>
/// <param name="vec">Destination vector. Its size and type is defined by dim and dtype parameters</param>
/// <param name="dim">Dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row. 1 means that the matrix is reduced to a single column.</param>
/// <param name="reduceOp">The reduction operation type</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
/// <param name="dType">Optional depth of the output array.</param>
public static void Reduce(IInputArray mtx, IOutputArray vec, CvEnum.ReduceDimension dim, CvEnum.ReduceType reduceOp, DepthType dType = DepthType.Default, Stream stream = null)
{
using (InputArray iaMtx = mtx.GetInputArray())
using (OutputArray oaVec = vec.GetOutputArray())
cudaReduce(iaMtx, oaVec, dim, reduceOp, dType, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaReduce(IntPtr mtx, IntPtr vec, CvEnum.ReduceDimension dim, CvEnum.ReduceType reduceOp, DepthType dType, IntPtr stream);
/// <summary>
/// Flips the GpuMat in one of different 3 ways (row and column indices are 0-based):
/// dst(i,j)=src(rows(src)-i-1,j) if flip_mode = 0
/// dst(i,j)=src(i,cols(src1)-j-1) if flip_mode > 0
/// dst(i,j)=src(rows(src)-i-1,cols(src)-j-1) if flip_mode < 0
/// </summary>
/// <param name="src">Source GpuMat.</param>
/// <param name="dst">Destination GpuMat.</param>
/// <param name="flipMode">
/// Specifies how to flip the GpuMat.
/// flip_mode = 0 means flipping around x-axis,
/// flip_mode > 0 (e.g. 1) means flipping around y-axis and
/// flip_mode < 0 (e.g. -1) means flipping around both axises.
///</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or IntPtr.Zero to call the function synchronously (blocking).</param>
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaFlip(IntPtr src, IntPtr dst, int flipMode, IntPtr stream);
/// <summary>
/// Flips the GpuMat<Byte> in one of different 3 ways (row and column indices are 0-based).
/// </summary>
/// <param name="src">The source GpuMat. supports 1, 3 and 4 channels GpuMat with Byte, UInt16, int or float depth</param>
/// <param name="dst">Destination GpuMat. The same source and type as <paramref name="src"/></param>
/// <param name="flipType">Specifies how to flip the GpuMat.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Flip(IInputArray src, IOutputArray dst, CvEnum.FlipType flipType, Stream stream = null)
{
int flipMode =
//-1 indicates vertical and horizontal flip
flipType == (Emgu.CV.CvEnum.FlipType.Horizontal | Emgu.CV.CvEnum.FlipType.Vertical) ? -1 :
//1 indicates horizontal flip only
flipType == Emgu.CV.CvEnum.FlipType.Horizontal ? 1 :
//0 indicates vertical flip only
0;
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaFlip(iaSrc, oaDst, flipMode, stream);
}
#region Logical operators
/// <summary>
/// Calculates per-element bit-wise logical conjunction of two GpuMats:
/// dst(I)=src1(I)^src2(I) if mask(I)!=0
/// In the case of floating-point GpuMats their bit representations are used for the operation. All the GpuMats must have the same type, except the mask, and the same size
/// </summary>
/// <param name="src1">The first source GpuMat</param>
/// <param name="src2">The second source GpuMat</param>
/// <param name="dst">The destination GpuMat</param>
/// <param name="mask">Mask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void BitwiseXor(IInputArray src1, IInputArray src2, IOutputArray dst, IInputArray mask = null, Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaBitwiseXor(iaSrc1, iaSrc2, oaDst, iaMask, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaBitwiseXor(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask, IntPtr stream);
/// <summary>
/// Calculates per-element bit-wise logical or of two GpuMats:
/// dst(I)=src1(I) | src2(I) if mask(I)!=0
/// In the case of floating-point GpuMats their bit representations are used for the operation. All the GpuMats must have the same type, except the mask, and the same size
/// </summary>
/// <param name="src1">The first source GpuMat</param>
/// <param name="src2">The second source GpuMat</param>
/// <param name="dst">The destination GpuMat</param>
/// <param name="mask">Mask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void BitwiseOr(IInputArray src1, IInputArray src2, IOutputArray dst, IInputArray mask = null, Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaBitwiseOr(iaSrc1, iaSrc2, oaDst, iaMask, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaBitwiseOr(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask, IntPtr stream);
/// <summary>
/// Calculates per-element bit-wise logical and of two GpuMats:
/// dst(I)=src1(I) & src2(I) if mask(I)!=0
/// In the case of floating-point GpuMats their bit representations are used for the operation. All the GpuMats must have the same type, except the mask, and the same size
/// </summary>
/// <param name="src1">The first source GpuMat</param>
/// <param name="src2">The second source GpuMat</param>
/// <param name="dst">The destination GpuMat</param>
/// <param name="mask">Mask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void BitwiseAnd(IInputArray src1, IInputArray src2, IOutputArray dst, IInputArray mask = null, Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaBitwiseAnd(iaSrc1, iaSrc2, oaDst, iaMask, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaBitwiseAnd(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr mask, IntPtr stream);
/// <summary>
/// Calculates per-element bit-wise logical not
/// dst(I)=~src(I) if mask(I)!=0
/// In the case of floating-point GpuMats their bit representations are used for the operation. All the GpuMats must have the same type, except the mask, and the same size
/// </summary>
/// <param name="src">The source GpuMat</param>
/// <param name="dst">The destination GpuMat</param>
/// <param name="mask">Mask, 8-bit single channel GpuMat; specifies elements of destination GpuMat to be changed. Use IntPtr.Zero if not needed.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void BitwiseNot(IInputArray src, IOutputArray dst, IInputArray mask = null, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaMask = mask == null ? InputArray.GetEmpty() : mask.GetInputArray())
cudaBitwiseNot(iaSrc, oaDst, iaMask, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaBitwiseNot(IntPtr src, IntPtr dst, IntPtr mask, IntPtr stream);
#endregion
/// <summary>
/// Computes per-element minimum of two GpuMats (dst = min(src1, src2))
/// </summary>
/// <param name="src1">The first GpuMat</param>
/// <param name="src2">The second GpuMat</param>
/// <param name="dst">The result GpuMat</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Min(IInputArray src1, IInputArray src2, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaMin(iaSrc1, iaSrc2, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMin(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr stream);
/// <summary>
/// Computes per-element maximum of two GpuMats (dst = max(src1, src2))
/// </summary>
/// <param name="src1">The first GpuMat</param>
/// <param name="src2">The second GpuMat</param>
/// <param name="dst">The result GpuMat</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Max(IInputArray src1, IInputArray src2, IOutputArray dst, Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaMax(iaSrc1, iaSrc2, oaDst, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMax(IntPtr src1, IntPtr src2, IntPtr dst, IntPtr stream);
/// <summary>
/// Applies fixed-level thresholding to single-channel array. The function is typically used to get bi-level (binary) image out of grayscale image or for removing a noise, i.e. filtering out pixels with too small or too large values. There are several types of thresholding the function supports that are determined by thresholdType
/// </summary>
/// <param name="src">Source array (single-channel, 8-bit of 32-bit floating point). </param>
/// <param name="dst">Destination array; must be either the same type as src or 8-bit. </param>
/// <param name="threshold">Threshold value</param>
/// <param name="maxValue">Maximum value to use with CV_THRESH_BINARY and CV_THRESH_BINARY_INV thresholding types</param>
/// <param name="thresholdType">Thresholding type</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static double Threshold(IInputArray src, IOutputArray dst, double threshold, double maxValue, CvEnum.ThresholdType thresholdType, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
return cudaThreshold(iaSrc, oaDst, threshold, maxValue, thresholdType, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern double cudaThreshold(IntPtr src, IntPtr dst, double threshold, double maxValue, CvEnum.ThresholdType thresholdType, IntPtr stream);
/// <summary>
/// Performs generalized matrix multiplication:
/// dst = alpha*op(src1)*op(src2) + beta*op(src3), where op(X) is X or XT
/// </summary>
/// <param name="src1">The first source array. </param>
/// <param name="src2">The second source array. </param>
/// <param name="alpha">The scalar</param>
/// <param name="src3">The third source array (shift). Can be IntPtr.Zero, if there is no shift.</param>
/// <param name="beta">The scalar</param>
/// <param name="dst">The destination array.</param>
/// <param name="tABC">The gemm operation type</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Gemm(
IInputArray src1,
IInputArray src2,
double alpha,
IInputArray src3,
double beta,
IOutputArray dst,
CvEnum.GemmType tABC = GemmType.Default,
Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (InputArray iaSrc3 = src3 == null ? InputArray.GetEmpty() : src3.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaGemm(iaSrc1, iaSrc2, alpha, iaSrc3, beta, oaDst, tABC, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaGemm(
IntPtr src1,
IntPtr src2,
double alpha,
IntPtr src3,
double beta,
IntPtr dst,
CvEnum.GemmType tABC,
IntPtr stream);
/// <summary>
/// Warps the image using affine transformation
/// </summary>
/// <param name="src">The source GpuMat</param>
/// <param name="dst">The destination GpuMat</param>
/// <param name="M">The 2x3 transformation matrix (pointer to CvArr)</param>
/// <param name="flags">Supports NN, LINEAR, CUBIC</param>
/// <param name="borderMode">The border mode, use BORDER_TYPE.CONSTANT for default.</param>
/// <param name="borderValue">The border value, use new MCvScalar() for default.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
/// <param name="dSize">The size of the destination image</param>
public static void WarpAffine(IInputArray src, IOutputArray dst, IInputArray M, Size dSize, CvEnum.Inter flags = Inter.Linear, CvEnum.BorderType borderMode = BorderType.Constant, MCvScalar borderValue = new MCvScalar(), Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaM = M.GetInputArray())
cudaWarpAffine(iaSrc, oaDst, iaM, ref dSize, flags, borderMode, ref borderValue, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaWarpAffine(IntPtr src, IntPtr dst, IntPtr M, ref Size dSize, CvEnum.Inter flags, CvEnum.BorderType borderMode, ref MCvScalar borderValue, IntPtr stream);
/// <summary>
/// Warps the image using perspective transformation
/// </summary>
/// <param name="src">The source GpuMat</param>
/// <param name="dst">The destination GpuMat</param>
/// <param name="M">The 2x3 transformation matrix (pointer to CvArr)</param>
/// <param name="flags">Supports NN, LINEAR, CUBIC</param>
/// <param name="borderMode">The border mode, use BORDER_TYPE.CONSTANT for default.</param>
/// <param name="borderValue">The border value, use new MCvScalar() for default.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
/// <param name="dSize">The size of the destination image</param>
public static void WarpPerspective(IInputArray src, IOutputArray dst, IInputArray M, Size dSize, CvEnum.Inter flags = Inter.Linear, CvEnum.BorderType borderMode = BorderType.Constant, MCvScalar borderValue = new MCvScalar(), Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaM = M.GetInputArray())
cudaWarpPerspective(iaSrc, oaDst, iaM, ref dSize, flags, borderMode, ref borderValue, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaWarpPerspective(IntPtr src, IntPtr dst, IntPtr M, ref Size dSize, CvEnum.Inter flags, CvEnum.BorderType borderMode, ref MCvScalar borderValue, IntPtr stream);
/// <summary>
/// DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation.
/// </summary>
/// <param name="src">The source GpuMat. Supports CV_8UC1, CV_8UC3 source types. </param>
/// <param name="dst">The dstination GpuMat. Supports CV_8UC1, CV_8UC3 source types. </param>
/// <param name="xmap">The xmap. Supports CV_32FC1 map type.</param>
/// <param name="ymap">The ymap. Supports CV_32FC1 map type.</param>
/// <param name="interpolation">Interpolation type.</param>
/// <param name="borderMode">Border mode. Use BORDER_CONSTANT for default.</param>
/// <param name="borderValue">The value of the border.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Remap(IInputArray src, IOutputArray dst, IInputArray xmap, IInputArray ymap, CvEnum.Inter interpolation, CvEnum.BorderType borderMode = BorderType.Constant, MCvScalar borderValue = new MCvScalar(), Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
using (InputArray iaXmap = xmap.GetInputArray())
using (InputArray iaYmap = ymap.GetInputArray())
cudaRemap(iaSrc, oaDst, iaXmap, iaYmap, interpolation, borderMode, ref borderValue, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaRemap(IntPtr src, IntPtr dst, IntPtr xmap, IntPtr ymap, CvEnum.Inter interpolation, CvEnum.BorderType borderMode, ref MCvScalar borderValue, IntPtr stream);
/// <summary>
/// Rotates an image around the origin (0,0) and then shifts it.
/// </summary>
/// <param name="src">Source image. Supports 1, 3 or 4 channels images with Byte, UInt16 or float depth</param>
/// <param name="dst">Destination image with the same type as src. Must be pre-allocated</param>
/// <param name="angle">Angle of rotation in degrees</param>
/// <param name="xShift">Shift along the horizontal axis</param>
/// <param name="yShift">Shift along the verticle axis</param>
/// <param name="dSize">The size of the destination image</param>
/// <param name="interpolation">Interpolation method. Only INTER_NEAREST, INTER_LINEAR, and INTER_CUBIC are supported.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Rotate(IInputArray src, IOutputArray dst, Size dSize, double angle, double xShift = 0, double yShift = 0, CvEnum.Inter interpolation = Inter.Linear, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaRotate(iaSrc, oaDst, ref dSize, angle, xShift, yShift, interpolation, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaRotate(IntPtr src, IntPtr dst, ref Size dSize, double angle, double xShift, double yShift, CvEnum.Inter interpolation, IntPtr stream);
/// <summary>
/// Copies a 2D array to a larger destination array and pads borders with the given constant.
/// </summary>
/// <param name="src">Source image.</param>
/// <param name="dst">Destination image with the same type as src. The size is Size(src.cols+left+right, src.rows+top+bottom).</param>
/// <param name="top">Number of pixels in each direction from the source image rectangle to extrapolate.</param>
/// <param name="bottom">Number of pixels in each direction from the source image rectangle to extrapolate.</param>
/// <param name="left">Number of pixels in each direction from the source image rectangle to extrapolate.</param>
/// <param name="right">Number of pixels in each direction from the source image rectangle to extrapolate.</param>
/// <param name="borderType">Border Type</param>
/// <param name="value">Border value.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void CopyMakeBorder(IInputArray src, IOutputArray dst, int top, int bottom, int left, int right, CvEnum.BorderType borderType, MCvScalar value = new MCvScalar(), Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaCopyMakeBorder(iaSrc, oaDst, top, bottom, left, right, borderType, ref value, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaCopyMakeBorder(IntPtr src, IntPtr dst, int top, int bottom, int left, int right, CvEnum.BorderType borderType, ref MCvScalar value, IntPtr stream);
/// <summary>
/// Computes the integral image and integral for the squared image
/// </summary>
/// <param name="src">The source GpuMat, supports only CV_8UC1 source type</param>
/// <param name="sum">The sum GpuMat, supports only CV_32S source type, but will contain unsigned int values</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Integral(IInputArray src, IOutputArray sum, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaSum = sum.GetOutputArray())
cudaIntegral(iaSrc, oaSum, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaIntegral(IntPtr src, IntPtr sum, IntPtr stream);
/// <summary>
/// Computes squared integral image
/// </summary>
/// <param name="src">The source GpuMat, supports only CV_8UC1 source type</param>
/// <param name="sqsum">The sqsum GpuMat, supports only CV32F source type.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void SqrIntegral(IInputArray src, IOutputArray sqsum, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaSqsum = sqsum.GetOutputArray())
cudaSqrIntegral(iaSrc, oaSqsum, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaSqrIntegral(IntPtr src, IntPtr sqsum, IntPtr stream);
/// <summary>
/// Performs a forward or inverse discrete Fourier transform (1D or 2D) of floating point matrix.
/// Param dft_size is the size of DFT transform.
///
/// If the source matrix is not continous, then additional copy will be done,
/// so to avoid copying ensure the source matrix is continous one. If you want to use
/// preallocated output ensure it is continuous too, otherwise it will be reallocated.
///
/// Being implemented via CUFFT real-to-complex transform result contains only non-redundant values
/// in CUFFT's format. Result as full complex matrix for such kind of transform cannot be retrieved.
///
/// For complex-to-real transform it is assumed that the source matrix is packed in CUFFT's format.
/// </summary>
/// <param name="src">The source GpuMat</param>
/// <param name="dst">The resulting GpuMat of the DST, must be pre-allocated and continious. If single channel, the result is real. If double channel, the result is complex</param>
/// <param name="dftSize">Size of a discrete Fourier transform.</param>
/// <param name="flags">DFT flags</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void Dft(IInputArray src, IOutputArray dst, Size dftSize, CvEnum.DxtType flags = DxtType.Forward, Stream stream = null)
{
using (InputArray iaSrc = src.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaDft(iaSrc, oaDst, ref dftSize, flags, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaDft(IntPtr src, IntPtr dst, ref Size dftSize, CvEnum.DxtType flags, IntPtr stream);
/// <summary>
/// Performs a per-element multiplication of two Fourier spectrums and scales the result.
/// </summary>
/// <param name="src1">First spectrum.</param>
/// <param name="src2">Second spectrum with the same size and type.</param>
/// <param name="dst">Destination spectrum.</param>
/// <param name="flags">Mock parameter used for CPU/CUDA interfaces similarity, simply add a 0 value.</param>
/// <param name="scale">Scale constant.</param>
/// <param name="conjB">Optional flag to specify if the second spectrum needs to be conjugated before the multiplication.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void MulAndScaleSpectrums(IInputArray src1, IInputArray src2, IOutputArray dst, int flags, float scale, bool conjB = false, Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaMulAndScaleSpectrums(iaSrc1, iaSrc2, oaDst, flags, scale, conjB, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMulAndScaleSpectrums(
IntPtr src1, IntPtr src2, IntPtr dst, int flags, float scale,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool conjB,
IntPtr stream);
/// <summary>
/// Performs a per-element multiplication of two Fourier spectrums.
/// </summary>
/// <param name="src1">First spectrum.</param>
/// <param name="src2">Second spectrum with the same size and type.</param>
/// <param name="dst">Destination spectrum.</param>
/// <param name="flags">Mock parameter used for CPU/CUDA interfaces similarity.</param>
/// <param name="conjB">Optional flag to specify if the second spectrum needs to be conjugated before the multiplication.</param>
/// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
public static void MulSpectrums(IInputArray src1, IInputArray src2, IOutputArray dst, int flags,
bool conjB = false, Stream stream = null)
{
using (InputArray iaSrc1 = src1.GetInputArray())
using (InputArray iaSrc2 = src2.GetInputArray())
using (OutputArray oaDst = dst.GetOutputArray())
cudaMulSpectrums(iaSrc1, iaSrc2, oaDst, flags, conjB, stream);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaMulSpectrums(IntPtr src1, IntPtr src2, IntPtr dst, int flags,
[MarshalAs(CvInvoke.BoolMarshalType)]
bool conjB,
IntPtr stream);
/*
/// <summary>
/// Draw the optical flow needle map
/// </summary>
/// <param name="u"></param>
/// <param name="v"></param>
/// <param name="vertex"></param>
/// <param name="colors"></param>
public static void CreateOpticalFlowNeedleMap(GpuMat u, GpuMat v, GpuMat vertex, GpuMat colors)
{
cudaCreateOpticalFlowNeedleMap(u, v, vertex, colors);
}
[DllImport(CvInvoke.ExternCudaLibrary, CallingConvention = CvInvoke.CvCallingConvention)]
private static extern void cudaCreateOpticalFlowNeedleMap(IntPtr u, IntPtr v, IntPtr vertex, IntPtr colors);
*/
}
}
| 61.131321 | 338 | 0.672379 | [
"MIT"
] | rlabrecque/RLSolitaireBot | Emgu.CV/Emgu.CV.Cuda/CudaInvoke.cs | 80,999 | C# |
using BrewLib.Data;
using ManagedBass;
using System;
using System.Diagnostics;
namespace BrewLib.Audio
{
public class AudioSample
{
private const int MaxSimultaneousPlayBacks = 8;
private int sample;
public readonly AudioManager Manager;
public string Path { get; }
internal AudioSample(AudioManager audioManager, string path, ResourceContainer resourceContainer)
{
Manager = audioManager;
Path = path;
sample = Bass.SampleLoad(path, 0, 0, MaxSimultaneousPlayBacks, BassFlags.SampleOverrideLongestPlaying);
if (sample != 0) return;
var bytes = resourceContainer?.GetBytes(path, ResourceSource.Embedded);
if (bytes != null)
{
sample = Bass.SampleLoad(bytes, 0, bytes.Length, MaxSimultaneousPlayBacks, BassFlags.SampleOverrideLongestPlaying);
if (sample != 0) return;
}
Trace.WriteLine($"Failed to load audio sample ({path}): {Bass.LastError}");
}
public void Play(float volume = 1, float pitch = 1, float pan = 0)
{
if (sample == 0) return;
var channel = new AudioChannel(Manager, Bass.SampleGetChannel(sample), true)
{
Volume = volume,
Pitch = pitch,
Pan = pan,
};
Manager.RegisterChannel(channel);
channel.Playing = true;
}
#region IDisposable Support
private bool disposedValue = false;
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
}
if (sample != 0)
{
Bass.SampleFree(sample);
sample = 0;
}
disposedValue = true;
}
}
~AudioSample()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
}
}
| 26.753086 | 131 | 0.517305 | [
"MIT"
] | Coosu/brewlib | Audio/AudioSample.cs | 2,169 | C# |
// Copyright (c) MOSA Project. Licensed under the New BSD License.
// This code was generated by an automated template.
using Mosa.Compiler.Framework;
namespace Mosa.Platform.x64.Instructions
{
/// <summary>
/// Mov64
/// </summary>
/// <seealso cref="Mosa.Platform.x64.X64Instruction" />
public sealed class Mov64 : X64Instruction
{
public override int ID { get { return 439; } }
internal Mov64()
: base(1, 1)
{
}
public override void Emit(InstructionNode node, BaseCodeEmitter emitter)
{
System.Diagnostics.Debug.Assert(node.ResultCount == 1);
System.Diagnostics.Debug.Assert(node.OperandCount == 1);
if (node.Operand1.IsCPURegister)
{
emitter.OpcodeEncoder.AppendByte(0x8B);
emitter.OpcodeEncoder.Append2Bits(0b11);
emitter.OpcodeEncoder.Append3Bits(node.Result.Register.RegisterCode);
emitter.OpcodeEncoder.Append3Bits(node.Operand1.Register.RegisterCode);
return;
}
if (node.Operand1.IsConstant)
{
emitter.OpcodeEncoder.AppendByte(0xC7);
emitter.OpcodeEncoder.Append2Bits(0b11);
emitter.OpcodeEncoder.Append3Bits(0b000);
emitter.OpcodeEncoder.Append3Bits(node.Result.Register.RegisterCode);
emitter.OpcodeEncoder.Append32BitImmediate(node.Operand1);
return;
}
throw new Compiler.Common.Exceptions.CompilerException("Invalid Opcode");
}
}
}
| 26.96 | 76 | 0.731454 | [
"BSD-3-Clause"
] | robot9706/MOSA-Project | Source/Mosa.Platform.x64/Instructions/Mov64.cs | 1,348 | C# |
public class ArrayCreator
{
public static T[] Create<T>(int lenght, T item)
{
T[] array = new T[lenght];
return array;
}
} | 18.875 | 51 | 0.556291 | [
"MIT"
] | IvelinMarinov/SoftUni | 06. OOP Advanced - Jul2017/02. Generics - Lab/02. Array Creator/ArrayCreator.cs | 153 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DLaB.Xrm.Entities
{
[System.Runtime.Serialization.DataContractAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "9.0.0.9154")]
public enum Organization_DateFormatCode
{
}
} | 31.777778 | 80 | 0.520979 | [
"MIT"
] | ScottColson/XrmUnitTest | DLaB.Xrm.Entities/OptionSets/Organization_DateFormatCode.cs | 572 | 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 BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Extensions;
using MicroBenchmarks;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace System.Collections
{
[BenchmarkCategory(Categories.Libraries, Categories.Collections, Categories.GenericCollections)]
[GenericTypeArguments(typeof(int))] // value type
[GenericTypeArguments(typeof(string))] // reference type
public class CreateAddAndClear<T>
{
[Params(Utils.DefaultCollectionSize)]
public int Size;
private T[] _uniqueValues;
[GlobalSetup]
public void Setup() => _uniqueValues = ValuesGenerator.ArrayOfUniqueValues<T>(Size);
[BenchmarkCategory(Categories.Runtime)]
[Benchmark]
public T[] Array()
{
T[] array = new T[_uniqueValues.Length];
for (int i = 0; i < _uniqueValues.Length; i++)
{
array[i] = _uniqueValues[i];
}
System.Array.Clear(array, 0, array.Length);
return array;
}
[BenchmarkCategory(Categories.Runtime, Categories.Span)]
[Benchmark]
public Span<T> Span()
{
Span<T> span = new T[_uniqueValues.Length];
for (int i = 0; i < _uniqueValues.Length; i++)
{
span[i] = _uniqueValues[i];
}
span.Clear();
return span;
}
[Benchmark]
public List<T> List()
{
List<T> list = new List<T>();
foreach (T value in _uniqueValues)
{
list.Add(value);
}
list.Clear();
return list;
}
[Benchmark]
[BenchmarkCategory(Categories.Runtime, Categories.Virtual)]
public ICollection<T> ICollection() => ICollection(new List<T>());
[MethodImpl(MethodImplOptions.NoInlining)] // we want to prevent from inlining this particular method to make sure that JIT does not find out that ICollection is always List
private ICollection<T> ICollection(ICollection<T> collection)
{
foreach (T value in _uniqueValues)
{
collection.Add(value);
}
collection.Clear();
return collection;
}
[Benchmark]
public LinkedList<T> LinkedList()
{
LinkedList<T> linkedList = new LinkedList<T>();
foreach (T value in _uniqueValues)
{
linkedList.AddLast(value);
}
linkedList.Clear();
return linkedList;
}
[Benchmark]
public HashSet<T> HashSet()
{
HashSet<T> hashSet = new HashSet<T>();
foreach (T value in _uniqueValues)
{
hashSet.Add(value);
}
hashSet.Clear();
return hashSet;
}
[Benchmark]
public Dictionary<T, T> Dictionary()
{
Dictionary<T, T> dictionary = new Dictionary<T, T>();
foreach (T value in _uniqueValues)
{
dictionary.Add(value, value);
}
dictionary.Clear();
return dictionary;
}
[Benchmark]
[BenchmarkCategory(Categories.Runtime, Categories.Virtual)]
public IDictionary<T, T> IDictionary() => IDictionary(new Dictionary<T, T>());
[MethodImpl(MethodImplOptions.NoInlining)]
private IDictionary<T, T> IDictionary(IDictionary<T, T> dictionary)
{
foreach (T value in _uniqueValues)
{
dictionary.Add(value, value);
}
dictionary.Clear();
return dictionary;
}
[Benchmark]
public SortedList<T, T> SortedList()
{
SortedList<T, T> sortedList = new SortedList<T, T>();
foreach (T value in _uniqueValues)
{
sortedList.Add(value, value);
}
sortedList.Clear();
return sortedList;
}
[Benchmark]
public SortedSet<T> SortedSet()
{
SortedSet<T> sortedSet = new SortedSet<T>();
foreach (T value in _uniqueValues)
{
sortedSet.Add(value);
}
sortedSet.Clear();
return sortedSet;
}
[Benchmark]
public SortedDictionary<T, T> SortedDictionary()
{
SortedDictionary<T, T> sortedDictionary = new SortedDictionary<T, T>();
foreach (T value in _uniqueValues)
{
sortedDictionary.Add(value, value);
}
sortedDictionary.Clear();
return sortedDictionary;
}
[Benchmark]
public ConcurrentDictionary<T, T> ConcurrentDictionary()
{
ConcurrentDictionary<T, T> concurrentDictionary = new ConcurrentDictionary<T, T>();
foreach (T value in _uniqueValues)
{
concurrentDictionary.TryAdd(value, value);
}
concurrentDictionary.Clear();
return concurrentDictionary;
}
[Benchmark]
public Stack<T> Stack()
{
Stack<T> stack = new Stack<T>();
foreach (T value in _uniqueValues)
{
stack.Push(value);
}
stack.Clear();
return stack;
}
[Benchmark]
public ConcurrentStack<T> ConcurrentStack()
{
ConcurrentStack<T> stack = new ConcurrentStack<T>();
foreach (T value in _uniqueValues)
{
stack.Push(value);
}
stack.Clear();
return stack;
}
[Benchmark]
public Queue<T> Queue()
{
Queue<T> queue = new Queue<T>();
foreach (T value in _uniqueValues)
{
queue.Enqueue(value);
}
queue.Clear();
return queue;
}
#if !NETFRAMEWORK // API added in .NET Core 2.0
[Benchmark]
public ConcurrentQueue<T> ConcurrentQueue()
{
ConcurrentQueue<T> concurrentQueue = new ConcurrentQueue<T>();
foreach (T value in _uniqueValues)
{
concurrentQueue.Enqueue(value);
}
concurrentQueue.Clear();
return concurrentQueue;
}
[Benchmark]
public ConcurrentBag<T> ConcurrentBag()
{
ConcurrentBag<T> concurrentBag = new ConcurrentBag<T>();
foreach (T value in _uniqueValues)
{
concurrentBag.Add(value);
}
concurrentBag.Clear();
return concurrentBag;
}
#endif
}
} | 29.605809 | 181 | 0.526559 | [
"MIT"
] | 333fred/performance | src/benchmarks/micro/libraries/System.Collections/CreateAddAndClear.cs | 7,137 | C# |
#pragma checksum "C:\Users\User-PC\Desktop\Web-App_1\WebApplication1\WebApplication1\Views\Home\About.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "f5989146c20e297d05361cc87bf290b8b98e9284"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_Home_About), @"mvc.1.0.view", @"/Views/Home/About.cshtml")]
[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/Views/Home/About.cshtml", typeof(AspNetCore.Views_Home_About))]
namespace AspNetCore
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
#line 1 "C:\Users\User-PC\Desktop\Web-App_1\WebApplication1\WebApplication1\Views\_ViewImports.cshtml"
using WebApplication1;
#line default
#line hidden
#line 2 "C:\Users\User-PC\Desktop\Web-App_1\WebApplication1\WebApplication1\Views\_ViewImports.cshtml"
using WebApplication1.Models;
#line default
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"f5989146c20e297d05361cc87bf290b8b98e9284", @"/Views/Home/About.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"729efaa87342638aecfe1a972ce9f9f8dff55b4c", @"/Views/_ViewImports.cshtml")]
public class Views_Home_About : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#pragma warning disable 1998
public async override global::System.Threading.Tasks.Task ExecuteAsync()
{
#line 1 "C:\Users\User-PC\Desktop\Web-App_1\WebApplication1\WebApplication1\Views\Home\About.cshtml"
ViewData["Title"] = "About";
#line default
#line hidden
BeginContext(41, 4, true);
WriteLiteral("<h2>");
EndContext();
BeginContext(46, 17, false);
#line 4 "C:\Users\User-PC\Desktop\Web-App_1\WebApplication1\WebApplication1\Views\Home\About.cshtml"
Write(ViewData["Title"]);
#line default
#line hidden
EndContext();
BeginContext(63, 11, true);
WriteLiteral("</h2>\r\n<h3>");
EndContext();
BeginContext(75, 19, false);
#line 5 "C:\Users\User-PC\Desktop\Web-App_1\WebApplication1\WebApplication1\Views\Home\About.cshtml"
Write(ViewData["Message"]);
#line default
#line hidden
EndContext();
BeginContext(94, 66, true);
WriteLiteral("</h3>\r\n\r\n<p>Use this area to provide additional information.</p>\r\n");
EndContext();
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}
#pragma warning restore 1591
| 48.961039 | 194 | 0.71618 | [
"MIT"
] | Gastebal9/WebappASP.netMVC | Debug/netcoreapp2.1/Razor/Views/Home/About.g.cshtml.cs | 3,770 | C# |
/*
Copyright (C) 2009 Philippe Real ([email protected])
This file is part of QLNet Project https://github.com/amaggiulli/qlnet
QLNet is free software: you can redistribute it and/or modify it
under the terms of the QLNet license. You should have received a
copy of the license along with this program; if not, license is
available at <https://github.com/amaggiulli/QLNet/blob/develop/LICENSE>.
QLNet is a based on QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
The QuantLib license is available online at http://quantlib.org/license.shtml.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
using System;
namespace QLNet
{
public class LfmCovarianceProxy : LfmCovarianceParameterization
{
public LmVolatilityModel volaModel { get; set; }
public LmCorrelationModel corrModel { get; set; }
public LmVolatilityModel volaModel_ { get; set; }
public LmCorrelationModel corrModel_ { get; set; }
public LfmCovarianceProxy(LmVolatilityModel volaModel,
LmCorrelationModel corrModel)
: base(corrModel.size(), corrModel.factors())
{
volaModel_ = volaModel;
corrModel_ = corrModel ;
Utils.QL_REQUIRE(volaModel_.size() == corrModel_.size(), () =>
"different size for the volatility (" + volaModel_.size() + ") and correlation (" + corrModel_.size() + ") models");
}
public LmVolatilityModel volatilityModel()
{
return volaModel_;
}
public LmCorrelationModel correlationModel()
{
return corrModel_;
}
public override Matrix diffusion(double t)
{
return diffusion(t, null);
}
public override Matrix diffusion(double t, Vector x)
{
Matrix pca = corrModel_.pseudoSqrt(t, x);
Vector vol = volaModel_.volatility(t, x);
for (int i = 0; i < size_; ++i)
{
for (int j = 0; j < size_; ++j)
pca[i, j] = pca[i, j] * vol[i];
}
return pca;
}
public override Matrix covariance(double t, Vector x)
{
Vector volatility = volaModel_.volatility(t, x);
Matrix correlation = corrModel_.correlation(t, x);
Matrix tmp = new Matrix(size_, size_);
for (int i = 0; i < size_; ++i)
{
for (int j = 0; j < size_; ++j)
{
tmp[i, j] = volatility[i] * correlation[i, j] * volatility[j];
}
}
return tmp;
}
public double integratedCovariance(int i, int j, double t)
{
return integratedCovariance(i, j, t, new Vector());
}
public double integratedCovariance(int i, int j, double t, Vector x)
{
if (corrModel_.isTimeIndependent())
{
try
{
// if all objects support these methods
// thats by far the fastest way to get the
// integrated covariance
return corrModel_.correlation(i, j, 0.0, x)
* volaModel_.integratedVariance(j, i, t, x);
//verifier la methode integratedVariance, qui bdoit etre implémenté
}
catch (System.Exception)
{
// okay proceed with the
// slow numerical integration routine
}
}
try
{
Utils.QL_REQUIRE(x.empty() != false, () => "can not handle given x here");
}
catch //OK x empty
{
}
double tmp = 0.0;
VarProxy_Helper helper = new VarProxy_Helper(this, i, j);
GaussKronrodAdaptive integrator = new GaussKronrodAdaptive(1e-10, 10000);
for (int k = 0; k < 64; ++k)
{
tmp += integrator.value(helper.value, k * t / 64.0, (k + 1) * t / 64.0);
}
return tmp;
}
}
public class VarProxy_Helper
{
private int i_, j_;
public LmVolatilityModel volaModel_ { get; set; }
public LmCorrelationModel corrModel_ { get; set; }
public VarProxy_Helper(LfmCovarianceProxy proxy, int i, int j)
{
i_ = i;
j_ = j;
volaModel_ = proxy.volaModel_;
corrModel_ = proxy.corrModel_;
}
public double value(double t)
{
double v1, v2;
if (i_ == j_)
{
v1 = v2 = volaModel_.volatility(i_, t, null);
}
else
{
v1 = volaModel_.volatility(i_, t, null);
v2 = volaModel_.volatility(j_, t, null);
}
return v1 * corrModel_.correlation(i_, j_, t, null) * v2;
}
}
}
| 31.132075 | 142 | 0.567677 | [
"BSD-3-Clause"
] | SalmonTie/QLNet | src/QLNet/legacy/libormarketmodels/LfmCovarianceProxy.cs | 4,954 | C# |
using Unity.Entities;
namespace Plugins.ECSEntityBuilder.Components
{
public struct DebugEnabled : IComponentData
{
}
} | 16.625 | 47 | 0.736842 | [
"MIT"
] | actionk/ECSEntityBuilder | Components/DebugEnabled.cs | 135 | C# |
#if NETCOREAPP
using System;
using Microsoft.Diagnostics.NETCore.Client;
namespace StackExchange.Metrics.Infrastructure
{
/// <summary>
/// Exposes methods used to hook up diagnostics collection from the runtime
/// in .NET Core.
/// </summary>
public interface IDiagnosticsCollector
{
/// <summary>
/// Adds a source of diagnostic event data.
/// </summary>
/// <param name="source">
/// An <see cref="EventPipeProvider" /> representing a source of diagnostic events.
/// </param>
void AddSource(EventPipeProvider source);
/// <summary>
/// Adds a callback used to handle counter data for a diagnostic event of the specified name.
/// </summary>
/// <param name="provider">
/// Name of the diagnostic event's provider.
/// </param>
/// <param name="name">
/// Name of a diagnostic event.
/// </param>
/// <param name="action">
/// A callback used to increment a counter.
/// </param>
void AddCounterCallback(string provider, string name, Action<long> action);
/// <summary>
/// Adds a callback used to handle gauge data for a diagnostic event of the specified name.
/// </summary>
/// <param name="provider">
/// Name of the diagnostic event's provider.
/// </param>
/// <param name="name">
/// Name of a diagnostic event.
/// </param>
/// <param name="action">
/// A callback used to record a gauge value.
/// </param>
void AddGaugeCallback(string provider, string name, Action<double> action);
}
}
#endif
| 33.411765 | 101 | 0.577465 | [
"MIT"
] | StackExchange/BosunReporter | src/StackExchange.Metrics/Infrastructure/IDiagnosticsCollector.cs | 1,706 | C# |
// <copyright file="ScriptHost.cs" company="Bau contributors">
// Copyright (c) Bau contributors. ([email protected])
// </copyright>
namespace BauCore.Test.Component.Support
{
using global::ScriptCs.Contracts;
public static class ScriptHost
{
public static T Require<T>(params string[] scriptArgs) where T : Bau
{
var scriptPack = new BauScriptPack();
scriptPack.Initialize(new ScriptPackSession(scriptArgs));
return (T)scriptPack.Context;
}
private class ScriptPackSession : IScriptPackSession
{
private readonly string[] scriptArgs;
public ScriptPackSession(params string[] scriptArgs)
{
this.scriptArgs = scriptArgs;
}
public string[] ScriptArgs
{
get { return this.scriptArgs; }
}
public void AddReference(string assemblyDisplayNameOrPath)
{
}
public void ImportNamespace(string @namespace)
{
}
}
}
}
| 27.309524 | 77 | 0.549259 | [
"MIT"
] | adamralph-archive/bau | src/test/Bau.Test.Component/Support/ScriptHost.cs | 1,149 | C# |
namespace ICSharpCode.SharpZipLib.Zip.Compression
{
/// <summary>
/// This class is general purpose class for writing data to a buffer.
///
/// It allows you to write bits as well as bytes
/// Based on DeflaterPending.java
///
/// author of the original java version : Jochen Hoenicke
/// </summary>
public class PendingBuffer
{
#region Instance Fields
/// <summary>
/// Internal work buffer
/// </summary>
private readonly byte[] buffer;
private int start;
private int end;
private uint bits;
private int bitCount;
#endregion Instance Fields
#region Constructors
/// <summary>
/// construct instance using default buffer size of 4096
/// </summary>
public PendingBuffer() : this(4096)
{
}
/// <summary>
/// construct instance using specified buffer size
/// </summary>
/// <param name="bufferSize">
/// size to use for internal buffer
/// </param>
public PendingBuffer(int bufferSize)
{
buffer = new byte[bufferSize];
}
#endregion Constructors
/// <summary>
/// Clear internal state/buffers
/// </summary>
public void Reset()
{
start = end = bitCount = 0;
}
/// <summary>
/// Write a byte to buffer
/// </summary>
/// <param name="value">
/// The value to write
/// </param>
public void WriteByte(int value)
{
#if DebugDeflation
if (DeflaterConstants.DEBUGGING && (start != 0) )
{
throw new SharpZipBaseException("Debug check: start != 0");
}
#endif
buffer[end++] = unchecked((byte)value);
}
/// <summary>
/// Write a short value to buffer LSB first
/// </summary>
/// <param name="value">
/// The value to write.
/// </param>
public void WriteShort(int value)
{
#if DebugDeflation
if (DeflaterConstants.DEBUGGING && (start != 0) )
{
throw new SharpZipBaseException("Debug check: start != 0");
}
#endif
buffer[end++] = unchecked((byte)value);
buffer[end++] = unchecked((byte)(value >> 8));
}
/// <summary>
/// write an integer LSB first
/// </summary>
/// <param name="value">The value to write.</param>
public void WriteInt(int value)
{
#if DebugDeflation
if (DeflaterConstants.DEBUGGING && (start != 0) )
{
throw new SharpZipBaseException("Debug check: start != 0");
}
#endif
buffer[end++] = unchecked((byte)value);
buffer[end++] = unchecked((byte)(value >> 8));
buffer[end++] = unchecked((byte)(value >> 16));
buffer[end++] = unchecked((byte)(value >> 24));
}
/// <summary>
/// Write a block of data to buffer
/// </summary>
/// <param name="block">data to write</param>
/// <param name="offset">offset of first byte to write</param>
/// <param name="length">number of bytes to write</param>
public void WriteBlock(byte[] block, int offset, int length)
{
#if DebugDeflation
if (DeflaterConstants.DEBUGGING && (start != 0) )
{
throw new SharpZipBaseException("Debug check: start != 0");
}
#endif
System.Array.Copy(block, offset, buffer, end, length);
end += length;
}
/// <summary>
/// The number of bits written to the buffer
/// </summary>
public int BitCount
{
get
{
return bitCount;
}
}
/// <summary>
/// Align internal buffer on a byte boundary
/// </summary>
public void AlignToByte()
{
#if DebugDeflation
if (DeflaterConstants.DEBUGGING && (start != 0) )
{
throw new SharpZipBaseException("Debug check: start != 0");
}
#endif
if (bitCount > 0)
{
buffer[end++] = unchecked((byte)bits);
if (bitCount > 8)
{
buffer[end++] = unchecked((byte)(bits >> 8));
}
}
bits = 0;
bitCount = 0;
}
/// <summary>
/// Write bits to internal buffer
/// </summary>
/// <param name="b">source of bits</param>
/// <param name="count">number of bits to write</param>
public void WriteBits(int b, int count)
{
#if DebugDeflation
if (DeflaterConstants.DEBUGGING && (start != 0) )
{
throw new SharpZipBaseException("Debug check: start != 0");
}
// if (DeflaterConstants.DEBUGGING) {
// //Console.WriteLine("writeBits("+b+","+count+")");
// }
#endif
bits |= (uint)(b << bitCount);
bitCount += count;
if (bitCount >= 16)
{
buffer[end++] = unchecked((byte)bits);
buffer[end++] = unchecked((byte)(bits >> 8));
bits >>= 16;
bitCount -= 16;
}
}
/// <summary>
/// Write a short value to internal buffer most significant byte first
/// </summary>
/// <param name="s">value to write</param>
public void WriteShortMSB(int s)
{
#if DebugDeflation
if (DeflaterConstants.DEBUGGING && (start != 0) )
{
throw new SharpZipBaseException("Debug check: start != 0");
}
#endif
buffer[end++] = unchecked((byte)(s >> 8));
buffer[end++] = unchecked((byte)s);
}
/// <summary>
/// Indicates if buffer has been flushed
/// </summary>
public bool IsFlushed
{
get
{
return end == 0;
}
}
/// <summary>
/// Flushes the pending buffer into the given output array. If the
/// output array is to small, only a partial flush is done.
/// </summary>
/// <param name="output">The output array.</param>
/// <param name="offset">The offset into output array.</param>
/// <param name="length">The maximum number of bytes to store.</param>
/// <returns>The number of bytes flushed.</returns>
public int Flush(byte[] output, int offset, int length)
{
if (bitCount >= 8)
{
buffer[end++] = unchecked((byte)bits);
bits >>= 8;
bitCount -= 8;
}
if (length > end - start)
{
length = end - start;
System.Array.Copy(buffer, start, output, offset, length);
start = 0;
end = 0;
}
else
{
System.Array.Copy(buffer, start, output, offset, length);
start += length;
}
return length;
}
/// <summary>
/// Convert internal buffer to byte array.
/// Buffer is empty on completion
/// </summary>
/// <returns>
/// The internal buffer contents converted to a byte array.
/// </returns>
public byte[] ToByteArray()
{
AlignToByte();
byte[] result = new byte[end - start];
System.Array.Copy(buffer, start, result, 0, result.Length);
start = 0;
end = 0;
return result;
}
}
}
| 24.018587 | 73 | 0.583191 | [
"BSD-3-Clause",
"Apache-2.0",
"MIT"
] | datadiode/ReoGrid | SharpZipLib/Zip/Compression/PendingBuffer.cs | 6,461 | C# |
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NUnit.Framework;
namespace LineCommander.Tests
{
public class ExampleTests
{
private ExampleCommand _command;
private ExampleExitCommand _exitCommand;
private FakeConsole _console;
private Commander _commander;
[SetUp]
public void Setup()
{
_console = new FakeConsole();
_command = new ExampleCommand();
_exitCommand = new ExampleExitCommand();
_commander = new Commander(_console);
}
[Test]
public async Task TestExampleCommand()
{
var cmds = await _commander.AddCommands(new List<BaseCommand>() { _command, _exitCommand });
_console.StageCommands(new List<string>() { "nothing", "none", "example", "ExaMpLe", "EXAMPLE", "quit"});
var cmdLog = await _commander.ListenForCommands();
Assert.AreEqual(3, cmdLog.Count());
}
[Test]
public async Task TestNoCommands()
{
var cmds = await _commander.AddCommands(new List<BaseCommand>() { _command, _exitCommand });
_console.StageCommands(new List<string>() { "nothing", "none", "one", "two", "three", "quit"});
var cmdLog = await _commander.ListenForCommands();
Assert.AreEqual(0, cmdLog.Count());
}
[Test]
public async Task TestExitCommand()
{
var cmds = await _commander.AddCommands(new List<BaseCommand>() { _command, _exitCommand });
_console.StageCommands(new List<string>() { "nothing", "none", "one", "exit", "three", "exit"});
var cmdLog = await _commander.ListenForCommands();
Assert.AreEqual(1, cmdLog.Count());
}
}
} | 35.865385 | 117 | 0.587131 | [
"MIT"
] | peppajoke/linecommander | LineCommander.Tests/ExampleTests.cs | 1,865 | C# |
using System ;
using System.Collections.Generic ;
using JetBrains.Annotations ;
using Selkie.DefCon.One.Common ;
namespace Selkie.DefCon.One.Interfaces
{
public interface ICallingInformationProvider
: IEnumerable < CallingInformation >
{
CallingInformation this [ int index ] { get ; }
int ConstructorsToTest { get ; }
[ NotNull ] Type InstanceType { get ; }
void Find ( ) ;
void SetType ( [ NotNull ] Type type ) ;
}
} | 23.095238 | 55 | 0.645361 | [
"MIT"
] | tschroedter/Selkie.DefCon | src/Selkie.DefCon.One/Interfaces/ICallingInformationProvider.cs | 487 | C# |
using System.Text.Json.Serialization;
namespace Horizon.Payment.Alipay.Response
{
/// <summary>
/// AlipayCommerceTransportMessageSendResponse.
/// </summary>
public class AlipayCommerceTransportMessageSendResponse : AlipayResponse
{
/// <summary>
/// 请求失败时返回的子错误码信息
/// </summary>
[JsonPropertyName("error_code")]
public string ErrorCode { get; set; }
/// <summary>
/// 请求失败时的错误信息
/// </summary>
[JsonPropertyName("error_message")]
public string ErrorMessage { get; set; }
/// <summary>
/// 失败的支付宝用户id列表。
/// </summary>
[JsonPropertyName("failed_user_ids")]
public string FailedUserIds { get; set; }
}
}
| 25.965517 | 76 | 0.589641 | [
"Apache-2.0"
] | bluexray/Horizon.Sample | Horizon.Payment.Alipay/Response/AlipayCommerceTransportMessageSendResponse.cs | 825 | C# |
using System.Collections.Generic;
using System.Windows.Forms;
namespace Exercise_Analyzer {
public partial class MultiChoiceListDialog : Form {
private List<string> fileList;
public List<string> SelectedList { get; set; }
public MultiChoiceListDialog(List<string> fileList) {
this.fileList = fileList;
InitializeComponent();
populateList();
}
private void populateList() {
listBoxFiles.DataSource = null;
List<string> items = new List<string>();
foreach (string fileName in fileList) {
items.Add(fileName);
}
listBoxFiles.DataSource = items;
}
private void onOkClick(object sender, System.EventArgs e) {
SelectedList = new List<string>();
foreach (object item in listBoxFiles.SelectedItems) {
SelectedList.Add(item.ToString());
}
this.DialogResult = DialogResult.OK;
Close();
}
private void onCancelClick(object sender, System.EventArgs e) {
SelectedList = null;
this.DialogResult = DialogResult.Cancel;
Close();
}
}
}
| 28.227273 | 71 | 0.574074 | [
"MIT"
] | KennethEvans/VS-Exercise-Analyzer | Exercise Analyzer/MultiChoiceListDialog.cs | 1,244 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using Grillber.C2.App_Start;
namespace Grillber.C2
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
MappingRegistrations.BuildRegistrations();
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
| 24.814815 | 62 | 0.598507 | [
"MIT"
] | PercyODI/Grillber.C2 | Grillber.C2/App_Start/WebApiConfig.cs | 672 | C# |
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Replicator {
/// <summary>Asset representing and providing a pool of GameObjects.</summary>
[CreateAssetMenu(menuName = Strings.PoolMenuName, fileName = Strings.PoolFileName, order = 203)]
public class ObjectPool : ScriptableObject {
[SerializeField, Tooltip(Strings.PrefabTooltip)]
private GameObject prefab = null;
[SerializeField, Tooltip(Strings.CapacityTooltip)]
private ushort capacity = 0;
[SerializeField, Tooltip(Strings.PreLoadTooltip)]
private ushort preLoad = ushort.MaxValue; // Using this is a bit of a hack to signify 'unedited' but negates the need for another serialized field
[SerializeField, Tooltip(Strings.GrowTooltip)]
private GrowthStrategy growth = GrowthStrategy.None;
[SerializeField, Tooltip(Strings.HideUnspawedTooltip)]
internal bool HideUnspawned = true;
private ushort activeObjectCount;
private Stack<PooledObject> pool;
internal event Action OnDisablePool;
protected virtual bool CanSpawn => activeObjectCount + pool.Count < capacity;
protected virtual bool CanGrow => growth != GrowthStrategy.None;
/// <summary>
/// Create a new <see cref="ObjectPool" /> with the given parameters.
/// </summary>
public static ObjectPool Create(GameObject prefab, ushort capacity = 0, ushort preLoad = 0, GrowthStrategy growth = 0) {
ObjectPool newPool = CreateInstance<ObjectPool>();
newPool.Initialise(prefab, capacity, preLoad, growth);
newPool.OnEnable();
return newPool;
}
internal virtual void Initialise(GameObject prefab, ushort capacity, ushort preLoad, GrowthStrategy growth) {
this.prefab = prefab;
this.capacity = capacity;
this.preLoad = preLoad;
this.growth = growth;
}
protected virtual void OnEnable() { // Check if can be initialised, work around
if(prefab == null) return;
preLoad = preLoad == ushort.MaxValue ? capacity : preLoad;
InitialisePool();
RegisterSelf();
SceneManager.sceneLoaded += onSceneLoaded;
}
protected virtual void OnDisable() {
DeregisterSelf();
OnDisablePool?.Invoke();
}
protected virtual void OnValidate() => preLoad = capacity > preLoad ? preLoad : capacity;
private void onSceneLoaded(Scene scene, LoadSceneMode mode) {
if(preLoad > 0) AddNewObjects(preLoad);
}
/// <summary>Spawn a GameObject from the pool, if one is available.</summary>
/// <param name="position">Position of the spawned GameObject</param>
/// <param name="rotation">Rotation of the spawned GameObject</param>
/// <param name="parent">(optional) Parent of the spawned GameObject</param>
public GameObject Spawn(Vector3 position, Quaternion rotation, Transform parent = null) {
if(CanSpawn && !HasAvailableSpawnees()) Expand(GrowthStrategy.Single);
else if(CanGrow && !CanSpawn) Expand(growth);
GameObject spawned = GetObjectToSpawn();
if(spawned == null) {
Debug.Log(Strings.UnableToSpawn);
return null;
}
spawned.transform.SetParent(parent);
spawned.transform.position = position;
spawned.transform.rotation = rotation;
spawned.gameObject.SetActive(true);
TriggerSpawnHandlers(spawned);
activeObjectCount++;
return spawned.gameObject;
}
/// <summary>Recycle the <paramref name="gameObject"/> if it belongs to this pool.</summary>
public void Recycle(GameObject gameObject) {
PooledObject pooledObject = gameObject.GetComponent<PooledObject>();
if(pooledObject == null) {
logUnableToRecycle(Strings.NotPooled);
}
else {
Recycle(pooledObject);
}
}
internal void Recycle(PooledObject pooledObject) {
if(!pooledObject.BelongsTo(this)) {
throw new InvalidOperationException(Strings.NotInPool);
}
else {
resetPooledObject(pooledObject);
TriggerRecycleHandlers(pooledObject.gameObject);
reclaimRecycledObject(pooledObject);
activeObjectCount--;
}
}
private protected virtual void reclaimRecycledObject(PooledObject recycled) => pool.Push(recycled);
protected virtual void InitialisePool() => pool = new Stack<PooledObject>();
protected virtual void RegisterSelf() {
if(prefab != null) PoolRegistry.Pools.Add(prefab, this);
}
protected virtual void DeregisterSelf() {
if(prefab != null) PoolRegistry.Pools.Remove(prefab);
}
protected virtual bool HasAvailableSpawnees() => pool.Count > 0;
protected virtual void Expand(GrowthStrategy strategy) {
int growAmount = 0;
if(strategy == GrowthStrategy.Single) growAmount = 1;
else if(strategy == GrowthStrategy.Tenth) growAmount = capacity / 10;
else if(strategy == GrowthStrategy.Quarter) growAmount = capacity / 4;
else if(strategy == GrowthStrategy.Half) growAmount = capacity / 2;
else if(strategy == GrowthStrategy.Double) growAmount = capacity * 2;
AddNewObjects(growAmount);
}
protected virtual GameObject GetObjectToSpawn() => pool.Pop().gameObject;
protected virtual void AddNewObjects(int amountToAdd) {
for(int i = 0; i < Mathf.Min(amountToAdd, capacity); i++) {
pool.Push(newPooledObjectInstance());
}
}
private protected PooledObject newPooledObjectInstance() {
GameObject instance = InstantiateInactive(prefab);
return instance.GetComponent<PooledObject>();
}
protected static void TriggerSpawnHandlers(GameObject target) {
ISpawned[] spawnHandlers = target.GetComponentsInChildren<ISpawned>();
foreach(ISpawned spawnHandler in spawnHandlers) {
spawnHandler.OnSpawn();
}
}
protected static void TriggerRecycleHandlers(GameObject target) {
IRecycled[] recycleHandlers = target.GetComponentsInChildren<IRecycled>();
foreach(IRecycled recycleHandler in recycleHandlers) {
recycleHandler.OnRecycle();
}
}
protected GameObject InstantiateInactive(GameObject source) {
GameObject instance = Instantiate(source);
instance.SetActive(false);
#if UNITY_EDITOR
if(HideUnspawned) instance.hideFlags |= HideFlags.HideInHierarchy;
#endif
PooledObject pooledObject = instance.GetComponent<PooledObject>() ?? instance.AddComponent<PooledObject>();
pooledObject.SetOwner(this);
return instance;
}
private static void resetPooledObject(PooledObject pooledObject) {
pooledObject.gameObject.SetActive(false);
pooledObject.transform.SetParent(null);
}
private static void logUnableToRecycle(string reason) => Debug.LogFormat(Strings.CantRecycleFormat, reason);
}
}
| 35.955307 | 148 | 0.742076 | [
"MIT"
] | ettmetal/Replicator | Assets/Replicator/ObjectPool.cs | 6,436 | C# |
using Dfc.CourseDirectory.Models.Enums;
using System;
using System.Collections.Generic;
using System.Text;
namespace Dfc.CourseDirectory.Models.Interfaces.Apprenticeships
{
public interface IFramework
{
Guid id { get; set; } // Cosmos DB id
// Framework specific properties. First three form composite primary key
int FrameworkCode { get; set; }
int ProgType { get; set; } // FK
Guid ProgTypeId { get; set; } // ???
int PathwayCode { get; set; }
string PathwayName { get; set; }
string NasTitle { get; set; }
DateTime? EffectiveFrom { get; set; }
DateTime? EffectiveTo { get; set; }
decimal? SectorSubjectAreaTier1 { get; set; } // FK
Guid? SectorSubjectAreaTier1Id { get; set; } // ??
decimal? SectorSubjectAreaTier2 { get; set; } // FK
Guid? SectorSubjectAreaTier2Id { get; set; } // ??
// Standard auditing properties
RecordStatus RecordStatus { get; set; }
DateTime CreatedDate { get; set; }
string CreatedBy { get; set; }
DateTime? UpdatedDate { get; set; }
string UpdatedBy { get; set; }
}
}
| 33.628571 | 80 | 0.611725 | [
"MIT"
] | SkillsFundingAgency/dfc-providerportal-migrationconsole | src/Dfc.CourseDirectory.Models/Interfaces/Apprenticeships/IFramework.cs | 1,179 | C# |
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Web.Http.Description;
using System.Xml.Linq;
using Newtonsoft.Json;
namespace CORS.Areas.HelpPage
{
/// <summary>
/// This class will generate the samples for the help page.
/// </summary>
public class HelpPageSampleGenerator
{
/// <summary>
/// Initializes a new instance of the <see cref="HelpPageSampleGenerator"/> class.
/// </summary>
public HelpPageSampleGenerator()
{
ActualHttpMessageTypes = new Dictionary<HelpPageSampleKey, Type>();
ActionSamples = new Dictionary<HelpPageSampleKey, object>();
SampleObjects = new Dictionary<Type, object>();
SampleObjectFactories = new List<Func<HelpPageSampleGenerator, Type, object>>
{
DefaultSampleObjectFactory,
};
}
/// <summary>
/// Gets CLR types that are used as the content of <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/>.
/// </summary>
public IDictionary<HelpPageSampleKey, Type> ActualHttpMessageTypes { get; internal set; }
/// <summary>
/// Gets the objects that are used directly as samples for certain actions.
/// </summary>
public IDictionary<HelpPageSampleKey, object> ActionSamples { get; internal set; }
/// <summary>
/// Gets the objects that are serialized as samples by the supported formatters.
/// </summary>
public IDictionary<Type, object> SampleObjects { get; internal set; }
/// <summary>
/// Gets factories for the objects that the supported formatters will serialize as samples. Processed in order,
/// stopping when the factory successfully returns a non-<see langref="null"/> object.
/// </summary>
/// <remarks>
/// Collection includes just <see cref="ObjectGenerator.GenerateObject(Type)"/> initially. Use
/// <code>SampleObjectFactories.Insert(0, func)</code> to provide an override and
/// <code>SampleObjectFactories.Add(func)</code> to provide a fallback.</remarks>
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
Justification = "This is an appropriate nesting of generic types")]
public IList<Func<HelpPageSampleGenerator, Type, object>> SampleObjectFactories { get; private set; }
/// <summary>
/// Gets the request body samples for a given <see cref="ApiDescription"/>.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <returns>The samples keyed by media type.</returns>
public IDictionary<MediaTypeHeaderValue, object> GetSampleRequests(ApiDescription api)
{
return GetSample(api, SampleDirection.Request);
}
/// <summary>
/// Gets the response body samples for a given <see cref="ApiDescription"/>.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <returns>The samples keyed by media type.</returns>
public IDictionary<MediaTypeHeaderValue, object> GetSampleResponses(ApiDescription api)
{
return GetSample(api, SampleDirection.Response);
}
/// <summary>
/// Gets the request or response body samples.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <param name="sampleDirection">The value indicating whether the sample is for a request or for a response.</param>
/// <returns>The samples keyed by media type.</returns>
public virtual IDictionary<MediaTypeHeaderValue, object> GetSample(ApiDescription api, SampleDirection sampleDirection)
{
if (api == null)
{
throw new ArgumentNullException("api");
}
string controllerName = api.ActionDescriptor.ControllerDescriptor.ControllerName;
string actionName = api.ActionDescriptor.ActionName;
IEnumerable<string> parameterNames = api.ParameterDescriptions.Select(p => p.Name);
Collection<MediaTypeFormatter> formatters;
Type type = ResolveType(api, controllerName, actionName, parameterNames, sampleDirection, out formatters);
var samples = new Dictionary<MediaTypeHeaderValue, object>();
// Use the samples provided directly for actions
var actionSamples = GetAllActionSamples(controllerName, actionName, parameterNames, sampleDirection);
foreach (var actionSample in actionSamples)
{
samples.Add(actionSample.Key.MediaType, WrapSampleIfString(actionSample.Value));
}
// Do the sample generation based on formatters only if an action doesn't return an HttpResponseMessage.
// Here we cannot rely on formatters because we don't know what's in the HttpResponseMessage, it might not even use formatters.
if (type != null && !typeof(HttpResponseMessage).IsAssignableFrom(type))
{
object sampleObject = GetSampleObject(type);
foreach (var formatter in formatters)
{
foreach (MediaTypeHeaderValue mediaType in formatter.SupportedMediaTypes)
{
if (!samples.ContainsKey(mediaType))
{
object sample = GetActionSample(controllerName, actionName, parameterNames, type, formatter, mediaType, sampleDirection);
// If no sample found, try generate sample using formatter and sample object
if (sample == null && sampleObject != null)
{
sample = WriteSampleObjectUsingFormatter(formatter, sampleObject, type, mediaType);
}
samples.Add(mediaType, WrapSampleIfString(sample));
}
}
}
}
return samples;
}
/// <summary>
/// Search for samples that are provided directly through <see cref="ActionSamples"/>.
/// </summary>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
/// <param name="type">The CLR type.</param>
/// <param name="formatter">The formatter.</param>
/// <param name="mediaType">The media type.</param>
/// <param name="sampleDirection">The value indicating whether the sample is for a request or for a response.</param>
/// <returns>The sample that matches the parameters.</returns>
public virtual object GetActionSample(string controllerName, string actionName, IEnumerable<string> parameterNames, Type type, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, SampleDirection sampleDirection)
{
object sample;
// First, try to get the sample provided for the specified mediaType, sampleDirection, controllerName, actionName and parameterNames.
// If not found, try to get the sample provided for the specified mediaType, sampleDirection, controllerName and actionName regardless of the parameterNames.
// If still not found, try to get the sample provided for the specified mediaType and type.
// Finally, try to get the sample provided for the specified mediaType.
if (ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, parameterNames), out sample) ||
ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, new[] { "*" }), out sample) ||
ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, type), out sample) ||
ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType), out sample))
{
return sample;
}
return null;
}
/// <summary>
/// Gets the sample object that will be serialized by the formatters.
/// First, it will look at the <see cref="SampleObjects"/>. If no sample object is found, it will try to create
/// one using <see cref="DefaultSampleObjectFactory"/> (which wraps an <see cref="ObjectGenerator"/>) and other
/// factories in <see cref="SampleObjectFactories"/>.
/// </summary>
/// <param name="type">The type.</param>
/// <returns>The sample object.</returns>
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
Justification = "Even if all items in SampleObjectFactories throw, problem will be visible as missing sample.")]
public virtual object GetSampleObject(Type type)
{
object sampleObject;
if (!SampleObjects.TryGetValue(type, out sampleObject))
{
// No specific object available, try our factories.
foreach (Func<HelpPageSampleGenerator, Type, object> factory in SampleObjectFactories)
{
if (factory == null)
{
continue;
}
try
{
sampleObject = factory(this, type);
if (sampleObject != null)
{
break;
}
}
catch
{
// Ignore any problems encountered in the factory; go on to the next one (if any).
}
}
}
return sampleObject;
}
/// <summary>
/// Resolves the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> passed to the <see cref="System.Net.Http.HttpRequestMessage"/> in an action.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <returns>The type.</returns>
public virtual Type ResolveHttpRequestMessageType(ApiDescription api)
{
string controllerName = api.ActionDescriptor.ControllerDescriptor.ControllerName;
string actionName = api.ActionDescriptor.ActionName;
IEnumerable<string> parameterNames = api.ParameterDescriptions.Select(p => p.Name);
Collection<MediaTypeFormatter> formatters;
return ResolveType(api, controllerName, actionName, parameterNames, SampleDirection.Request, out formatters);
}
/// <summary>
/// Resolves the type of the action parameter or return value when <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/> is used.
/// </summary>
/// <param name="api">The <see cref="ApiDescription"/>.</param>
/// <param name="controllerName">Name of the controller.</param>
/// <param name="actionName">Name of the action.</param>
/// <param name="parameterNames">The parameter names.</param>
/// <param name="sampleDirection">The value indicating whether the sample is for a request or a response.</param>
/// <param name="formatters">The formatters.</param>
[SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", Justification = "This is only used in advanced scenarios.")]
public virtual Type ResolveType(ApiDescription api, string controllerName, string actionName, IEnumerable<string> parameterNames, SampleDirection sampleDirection, out Collection<MediaTypeFormatter> formatters)
{
if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection))
{
throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection));
}
if (api == null)
{
throw new ArgumentNullException("api");
}
Type type;
if (ActualHttpMessageTypes.TryGetValue(new HelpPageSampleKey(sampleDirection, controllerName, actionName, parameterNames), out type) ||
ActualHttpMessageTypes.TryGetValue(new HelpPageSampleKey(sampleDirection, controllerName, actionName, new[] { "*" }), out type))
{
// Re-compute the supported formatters based on type
Collection<MediaTypeFormatter> newFormatters = new Collection<MediaTypeFormatter>();
foreach (var formatter in api.ActionDescriptor.Configuration.Formatters)
{
if (IsFormatSupported(sampleDirection, formatter, type))
{
newFormatters.Add(formatter);
}
}
formatters = newFormatters;
}
else
{
switch (sampleDirection)
{
case SampleDirection.Request:
ApiParameterDescription requestBodyParameter = api.ParameterDescriptions.FirstOrDefault(p => p.Source == ApiParameterSource.FromBody);
type = requestBodyParameter == null ? null : requestBodyParameter.ParameterDescriptor.ParameterType;
formatters = api.SupportedRequestBodyFormatters;
break;
case SampleDirection.Response:
default:
type = api.ResponseDescription.ResponseType ?? api.ResponseDescription.DeclaredType;
formatters = api.SupportedResponseFormatters;
break;
}
}
return type;
}
/// <summary>
/// Writes the sample object using formatter.
/// </summary>
/// <param name="formatter">The formatter.</param>
/// <param name="value">The value.</param>
/// <param name="type">The type.</param>
/// <param name="mediaType">Type of the media.</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "The exception is recorded as InvalidSample.")]
public virtual object WriteSampleObjectUsingFormatter(MediaTypeFormatter formatter, object value, Type type, MediaTypeHeaderValue mediaType)
{
if (formatter == null)
{
throw new ArgumentNullException("formatter");
}
if (mediaType == null)
{
throw new ArgumentNullException("mediaType");
}
object sample = String.Empty;
MemoryStream ms = null;
HttpContent content = null;
try
{
if (formatter.CanWriteType(type))
{
ms = new MemoryStream();
content = new ObjectContent(type, value, formatter, mediaType);
formatter.WriteToStreamAsync(type, value, ms, content, null).Wait();
ms.Position = 0;
StreamReader reader = new StreamReader(ms);
string serializedSampleString = reader.ReadToEnd();
if (mediaType.MediaType.ToUpperInvariant().Contains("XML"))
{
serializedSampleString = TryFormatXml(serializedSampleString);
}
else if (mediaType.MediaType.ToUpperInvariant().Contains("JSON"))
{
serializedSampleString = TryFormatJson(serializedSampleString);
}
sample = new TextSample(serializedSampleString);
}
else
{
sample = new InvalidSample(String.Format(
CultureInfo.CurrentCulture,
"Failed to generate the sample for media type '{0}'. Cannot use formatter '{1}' to write type '{2}'.",
mediaType,
formatter.GetType().Name,
type.Name));
}
}
catch (Exception e)
{
sample = new InvalidSample(String.Format(
CultureInfo.CurrentCulture,
"An exception has occurred while using the formatter '{0}' to generate sample for media type '{1}'. Exception message: {2}",
formatter.GetType().Name,
mediaType.MediaType,
UnwrapException(e).Message));
}
finally
{
if (ms != null)
{
ms.Dispose();
}
if (content != null)
{
content.Dispose();
}
}
return sample;
}
internal static Exception UnwrapException(Exception exception)
{
AggregateException aggregateException = exception as AggregateException;
if (aggregateException != null)
{
return aggregateException.Flatten().InnerException;
}
return exception;
}
// Default factory for sample objects
private static object DefaultSampleObjectFactory(HelpPageSampleGenerator sampleGenerator, Type type)
{
// Try to create a default sample object
ObjectGenerator objectGenerator = new ObjectGenerator();
return objectGenerator.GenerateObject(type);
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")]
private static string TryFormatJson(string str)
{
try
{
object parsedJson = JsonConvert.DeserializeObject(str);
return JsonConvert.SerializeObject(parsedJson, Formatting.Indented);
}
catch
{
// can't parse JSON, return the original string
return str;
}
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")]
private static string TryFormatXml(string str)
{
try
{
XDocument xml = XDocument.Parse(str);
return xml.ToString();
}
catch
{
// can't parse XML, return the original string
return str;
}
}
private static bool IsFormatSupported(SampleDirection sampleDirection, MediaTypeFormatter formatter, Type type)
{
switch (sampleDirection)
{
case SampleDirection.Request:
return formatter.CanReadType(type);
case SampleDirection.Response:
return formatter.CanWriteType(type);
}
return false;
}
private IEnumerable<KeyValuePair<HelpPageSampleKey, object>> GetAllActionSamples(string controllerName, string actionName, IEnumerable<string> parameterNames, SampleDirection sampleDirection)
{
HashSet<string> parameterNamesSet = new HashSet<string>(parameterNames, StringComparer.OrdinalIgnoreCase);
foreach (var sample in ActionSamples)
{
HelpPageSampleKey sampleKey = sample.Key;
if (String.Equals(controllerName, sampleKey.ControllerName, StringComparison.OrdinalIgnoreCase) &&
String.Equals(actionName, sampleKey.ActionName, StringComparison.OrdinalIgnoreCase) &&
(sampleKey.ParameterNames.SetEquals(new[] { "*" }) || parameterNamesSet.SetEquals(sampleKey.ParameterNames)) &&
sampleDirection == sampleKey.SampleDirection)
{
yield return sample;
}
}
}
private static object WrapSampleIfString(object sample)
{
string stringSample = sample as string;
if (stringSample != null)
{
return new TextSample(stringSample);
}
return sample;
}
}
} | 47.193694 | 229 | 0.586332 | [
"MIT"
] | mauricedb/mwd-2016-09-26 | mod10/CORS/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs | 20,954 | C# |
using GitHubHelper.Model;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace GitHubHelper
{
public class MilestoneComparer : IComparer<Milestone>
{
private bool _issuesAreClosed;
public MilestoneComparer(bool issuesAreClosed)
{
_issuesAreClosed = issuesAreClosed;
}
public virtual int Compare(
[AllowNull]
Milestone left,
[AllowNull]
Milestone right)
{
if (left == right)
{
return 0;
}
if (left == null)
{
return 1;
}
if (right == null)
{
return -1;
}
if (left.IsClosed
&& right.IsClosed)
{
return DateTime.Compare(left.ClosedLocal, right.ClosedLocal);
}
if (left.IsDue
&& right.IsDue)
{
return DateTime.Compare(left.DueOnLocal, right.DueOnLocal);
}
if (left.IsDue
&& !right.IsDue)
{
return 1;
}
if (!left.IsDue
&& right.IsDue)
{
return -1;
}
return string.Compare(left.Title, right.Title);
}
}
} | 21.907692 | 77 | 0.441011 | [
"MIT"
] | lbugnion/GitHubHelper | src/GitHubHelper/MilestoneComparer.cs | 1,426 | 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/d3d10_1shader.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
namespace TerraFX.Interop.DirectX;
public partial struct D3D10_SHADER_DEBUG_VAR_INFO
{
public uint TokenId;
[NativeTypeName("D3D10_SHADER_VARIABLE_TYPE")]
public D3D_SHADER_VARIABLE_TYPE Type;
public uint Register;
public uint Component;
public uint ScopeVar;
public uint ScopeVarOffset;
}
| 26.782609 | 145 | 0.766234 | [
"MIT"
] | JeremyKuhne/terrafx.interop.windows | sources/Interop/Windows/DirectX/um/d3d10_1shader/D3D10_SHADER_DEBUG_VAR_INFO.cs | 618 | C# |
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
namespace Joinrpg.Web.Identity
{
public partial class MyUserStore : IUserStore<JoinIdentityUser>
{
async Task<IdentityResult> IUserStore<JoinIdentityUser>.CreateAsync(JoinIdentityUser user, CancellationToken ct)
{
await CreateImpl(user, ct);
return IdentityResult.Success;
}
Task<IdentityResult> IUserStore<JoinIdentityUser>.DeleteAsync(JoinIdentityUser user, CancellationToken ct) => throw new NotSupportedException();
async Task<JoinIdentityUser?> IUserStore<JoinIdentityUser>.FindByIdAsync(string userId, CancellationToken ct)
{
if (int.TryParse(userId, out var intId))
{
var dbUser = await LoadUser(intId, ct);
return dbUser?.ToIdentityUser();
}
else
{
return null;
}
}
async Task<JoinIdentityUser?> IUserStore<JoinIdentityUser>.FindByNameAsync(string normalizedUserName, CancellationToken ct)
{
var dbUser = await LoadUser(normalizedUserName, ct);
return dbUser?.ToIdentityUser();
}
Task<string> IUserStore<JoinIdentityUser>.GetNormalizedUserNameAsync(JoinIdentityUser user, CancellationToken ct)
=> Task.FromResult(user.UserName.ToUpperInvariant());
Task<string> IUserStore<JoinIdentityUser>.GetUserIdAsync(JoinIdentityUser user, CancellationToken ct)
=> Task.FromResult(user.Id.ToString());
Task<string> IUserStore<JoinIdentityUser>.GetUserNameAsync(JoinIdentityUser user, CancellationToken ct)
=> Task.FromResult(user.UserName);
Task IUserStore<JoinIdentityUser>.SetNormalizedUserNameAsync(JoinIdentityUser user, string normalizedName, CancellationToken ct)
{
//TODO persist it and start searching by it
return Task.CompletedTask;
}
async Task IUserStore<JoinIdentityUser>.SetUserNameAsync(JoinIdentityUser user, string userName, CancellationToken ct)
=> await SetUserNameImpl(user, userName, ct);
async Task<IdentityResult> IUserStore<JoinIdentityUser>.UpdateAsync(JoinIdentityUser user, CancellationToken ct)
{
await UpdateImpl(user, ct);
return IdentityResult.Success;
}
}
}
| 38.109375 | 152 | 0.674457 | [
"MIT"
] | Jeidoz/joinrpg-net | src/Joinrpg.Web.Identity/AspNetCore/MyUserStore.IUserStore.cs | 2,439 | C# |
using System;
using Xamarin.Forms;
namespace AppBar.Sample.Views
{
public partial class MainView : ContentPage
{
public MainView()
{
InitializeComponent();
}
void OnBasicAppBarBtnClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new BasicAppBarGallery());
}
void OnAddRemoveToolBarItemsBtnClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new AddRemoveToolBarItemsGallery());
}
void OnEnableDisableToolBarItemsBtnClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new EnableDisableToolBarItemsGallery());
}
void OnUpdateToolBarItemBtnClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new UpdateToolBarItemGallery());
}
void OnAppBarEventsBtnClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new AppBarEventsGallery());
}
void OnAppBarHeightBtnClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new AppBarHeightGallery());
}
void OnAppBarBackgroundImageBtnClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new BackgroundImageGallery());
}
void OnTitleViewBtnClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new TitleViewGallery());
}
void OnScrollBehaviorBtnClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new ScrollBehaviorGallery());
}
}
} | 27.672414 | 78 | 0.626168 | [
"MIT"
] | jsuarezruiz/Xamarin.Forms.AppBar | src/AppBar.Sample/Views/MainView.xaml.cs | 1,607 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.
namespace Microsoft.Data.Entity.Design.Model
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Xml.Linq;
using Microsoft.Data.Entity.Design.VersioningFacade;
/// <summary>
/// Instantiated via an XElement and a version, this class will retrieve
/// all annotations under the XElement given an annotation namespace.
/// </summary>
internal class AnnotationManager
{
private XElement _xElement;
private HashSet<string> _reservedNamespaces;
internal AnnotationManager(XElement xelement, Version version)
{
Load(xelement, version);
}
internal void Load(XElement xelement, Version version)
{
_reservedNamespaces = new HashSet<string>();
_xElement = xelement;
foreach (var n in SchemaManager.GetAllNamespacesForVersion(version))
{
_reservedNamespaces.Add(n);
}
}
internal void UpdateAttributeName(string namespaceName, string oldName, string newName)
{
Debug.Assert(!String.IsNullOrEmpty(oldName), "Attribute name for AnnotationManager.UpdateAttributeName is null or empty");
if (!String.IsNullOrEmpty(oldName))
{
var xattr = GetAnnotation<XAttribute>(namespaceName, oldName);
if (xattr != null)
{
var parent = xattr.Parent;
if (parent != null)
{
var existingNs = xattr.Name.Namespace;
var existingvalue = xattr.Value;
xattr.Remove();
parent.Add(new XAttribute(existingNs + newName, existingvalue));
}
}
}
}
/// <summary>
/// Update, Create, or Delete an annotation that is represented by an attribute.
/// This also handles defaults.
/// </summary>
/// <param name="namespaceName"></param>
/// <param name="name"></param>
/// <param name="newValue">Pass in null to delete</param>
/// <param name="isDefault"></param>
internal void UpdateAttributeValue(string namespaceName, string name, string newValue, bool isDefault)
{
Debug.Assert(!String.IsNullOrEmpty(name), "Attribute name for AnnotationManager.UpdateAttributeValue is null or empty");
if (!String.IsNullOrEmpty(name))
{
var xattr = GetAnnotation<XAttribute>(namespaceName, name);
if (xattr != null)
{
if (newValue == null || isDefault)
{
xattr.Remove();
}
else if (xattr.Value != newValue)
{
xattr.Value = newValue;
}
}
else if (!isDefault
&& newValue != null)
{
xattr = new XAttribute(XName.Get(name, namespaceName), newValue);
_xElement.Add(xattr);
}
}
}
internal void RemoveAttribute(string namespaceName, string name)
{
Debug.Assert(!String.IsNullOrEmpty(name), "Attribute name for AnnotationManager.RemoveAttribute is null or empty");
if (!String.IsNullOrEmpty(name))
{
var xattr = GetAnnotation<XAttribute>(namespaceName, name);
if (xattr != null)
{
xattr.Remove();
}
}
}
internal IEnumerable<XObject> GetAnnotations()
{
foreach (var xa in _xElement.Attributes())
{
// EFRuntime doesn't namespace-qualify most of their attributes, so we just skip them here
if (xa.Name != null
&& String.IsNullOrEmpty(xa.Name.NamespaceName) == false)
{
if (_reservedNamespaces.Contains(xa.Name.NamespaceName) == false)
{
yield return xa;
}
}
}
foreach (var xe in _xElement.Elements())
{
if (xe.Name.NamespaceName != null
&& _reservedNamespaces.Contains(xe.Name.NamespaceName) == false)
{
yield return xe;
}
}
}
internal IEnumerable<T> GetAnnotations<T>(string namespaceName) where T : XObject
{
return GetAnnotations().OfType<T>().Where(
xo =>
{
var xa = xo as XAttribute;
var xe = xo as XElement;
if (xa != null)
{
return xa.Name.NamespaceName == namespaceName;
}
if (xe != null)
{
return xe.Name.NamespaceName == namespaceName;
}
return false;
});
}
internal T GetAnnotation<T>(string namespaceName, string name) where T : XObject
{
return GetAnnotations<T>(namespaceName).Where(
xo =>
{
var xa = xo as XAttribute;
var xe = xo as XElement;
if (xa != null)
{
return xa.Name.LocalName == name;
}
if (xe != null)
{
return xe.Name.LocalName == name;
}
return false;
}).SingleOrDefault();
}
internal void RemoveAnnotations<T>(string namespaceName) where T : XObject
{
IEnumerable<T> annotations = new List<T>(GetAnnotations<T>(namespaceName));
foreach (var annotation in annotations.OfType<XAttribute>())
{
annotation.Remove();
}
foreach (var annotation in annotations.OfType<XElement>())
{
annotation.Remove();
}
}
}
}
| 36.626374 | 145 | 0.478698 | [
"MIT"
] | dotnet/ef6tools | src/EFTools/EntityDesignModel/AnnotationManager.cs | 6,668 | C# |
Subsets and Splits