content
stringlengths 5
1.04M
| avg_line_length
float64 1.75
12.9k
| max_line_length
int64 2
244k
| alphanum_fraction
float64 0
0.98
| licenses
list | repository_name
stringlengths 7
92
| path
stringlengths 3
249
| size
int64 5
1.04M
| lang
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
namespace Microsoft.EntityFrameworkCore.Benchmarks.Models.AdventureWorks
{
public class SalesPerson
{
public SalesPerson()
{
SalesOrderHeader = new HashSet<SalesOrderHeader>();
SalesPersonQuotaHistory = new HashSet<SalesPersonQuotaHistory>();
SalesTerritoryHistory = new HashSet<SalesTerritoryHistory>();
Store = new HashSet<Store>();
}
public int BusinessEntityID { get; set; }
public decimal Bonus { get; set; }
public decimal CommissionPct { get; set; }
public DateTime ModifiedDate { get; set; }
#pragma warning disable IDE1006 // Naming Styles
public Guid rowguid { get; set; }
#pragma warning restore IDE1006 // Naming Styles
public decimal SalesLastYear { get; set; }
public decimal? SalesQuota { get; set; }
public decimal SalesYTD { get; set; }
public int? TerritoryID { get; set; }
public virtual ICollection<SalesOrderHeader> SalesOrderHeader { get; set; }
public virtual ICollection<SalesPersonQuotaHistory> SalesPersonQuotaHistory { get; set; }
public virtual ICollection<SalesTerritoryHistory> SalesTerritoryHistory { get; set; }
public virtual ICollection<Store> Store { get; set; }
public virtual Employee BusinessEntity { get; set; }
public virtual SalesTerritory Territory { get; set; }
}
}
| 41.846154 | 111 | 0.68076 |
[
"Apache-2.0"
] |
0b01/efcore
|
benchmark/EFCore.Benchmarks/Models/AdventureWorks/SalesPerson.cs
| 1,632 |
C#
|
// ------------------------------------------------------------------------------
// <auto-generated>
// Generated by Xsd2Code. Version 3.4.0.18239 Microsoft Reciprocal License (Ms-RL)
// <NameSpace>Dms.Ambulance.V2100</NameSpace><Collection>Array</Collection><codeType>CSharp</codeType><EnableDataBinding>False</EnableDataBinding><EnableLazyLoading>False</EnableLazyLoading><TrackingChangesEnable>False</TrackingChangesEnable><GenTrackingClasses>False</GenTrackingClasses><HidePrivateFieldInIDE>False</HidePrivateFieldInIDE><EnableSummaryComment>True</EnableSummaryComment><VirtualProp>False</VirtualProp><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenBaseClass>False</GenBaseClass><GenerateCloneMethod>True</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net35</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>True</GenerateXMLAttributes><OrderXMLAttrib>False</OrderXMLAttrib><EnableEncoding>False</EnableEncoding><AutomaticProperties>False</AutomaticProperties><GenerateShouldSerialize>False</GenerateShouldSerialize><DisableDebug>False</DisableDebug><PropNameSpecified>Default</PropNameSpecified><Encoder>UTF8</Encoder><CustomUsings></CustomUsings><ExcludeIncludedTypes>True</ExcludeIncludedTypes><EnableInitializeFields>False</EnableInitializeFields>
// </auto-generated>
// ------------------------------------------------------------------------------
namespace Dms.Ambulance.V2100 {
using System;
using System.Diagnostics;
using System.Xml.Serialization;
using System.Collections;
using System.Xml.Schema;
using System.ComponentModel;
using System.IO;
using System.Text;
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.4.0.18239")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(TypeName="COCD_TP146036UK04.PatientRole", Namespace="urn:hl7-org:v3")]
public partial class COCD_TP146036UK04PatientRole {
private IINPfIToidmandatory idField;
private COCD_TP146036UK04PatientRoleTemplateId templateIdField;
private string nullFlavorField;
private cs_UpdateMode updateModeField;
private bool updateModeFieldSpecified;
private string classCodeField;
private static System.Xml.Serialization.XmlSerializer serializer;
public COCD_TP146036UK04PatientRole() {
this.classCodeField = "PAT";
}
public IINPfIToidmandatory id {
get {
return this.idField;
}
set {
this.idField = value;
}
}
public COCD_TP146036UK04PatientRoleTemplateId templateId {
get {
return this.templateIdField;
}
set {
this.templateIdField = value;
}
}
[System.Xml.Serialization.XmlAttributeAttribute()]
public string nullFlavor {
get {
return this.nullFlavorField;
}
set {
this.nullFlavorField = value;
}
}
[System.Xml.Serialization.XmlAttributeAttribute()]
public cs_UpdateMode updateMode {
get {
return this.updateModeField;
}
set {
this.updateModeField = value;
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool updateModeSpecified {
get {
return this.updateModeFieldSpecified;
}
set {
this.updateModeFieldSpecified = value;
}
}
[System.Xml.Serialization.XmlAttributeAttribute(DataType="token")]
public string classCode {
get {
return this.classCodeField;
}
set {
this.classCodeField = value;
}
}
private static System.Xml.Serialization.XmlSerializer Serializer {
get {
if ((serializer == null)) {
serializer = new System.Xml.Serialization.XmlSerializer(typeof(COCD_TP146036UK04PatientRole));
}
return serializer;
}
}
#region Serialize/Deserialize
/// <summary>
/// Serializes current COCD_TP146036UK04PatientRole object into an XML document
/// </summary>
/// <returns>string XML value</returns>
public virtual string Serialize() {
System.IO.StreamReader streamReader = null;
System.IO.MemoryStream memoryStream = null;
try {
memoryStream = new System.IO.MemoryStream();
Serializer.Serialize(memoryStream, this);
memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
streamReader = new System.IO.StreamReader(memoryStream);
return streamReader.ReadToEnd();
}
finally {
if ((streamReader != null)) {
streamReader.Dispose();
}
if ((memoryStream != null)) {
memoryStream.Dispose();
}
}
}
/// <summary>
/// Deserializes workflow markup into an COCD_TP146036UK04PatientRole object
/// </summary>
/// <param name="xml">string workflow markup to deserialize</param>
/// <param name="obj">Output COCD_TP146036UK04PatientRole object</param>
/// <param name="exception">output Exception value if deserialize failed</param>
/// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
public static bool Deserialize(string xml, out COCD_TP146036UK04PatientRole obj, out System.Exception exception) {
exception = null;
obj = default(COCD_TP146036UK04PatientRole);
try {
obj = Deserialize(xml);
return true;
}
catch (System.Exception ex) {
exception = ex;
return false;
}
}
public static bool Deserialize(string xml, out COCD_TP146036UK04PatientRole obj) {
System.Exception exception = null;
return Deserialize(xml, out obj, out exception);
}
public static COCD_TP146036UK04PatientRole Deserialize(string xml) {
System.IO.StringReader stringReader = null;
try {
stringReader = new System.IO.StringReader(xml);
return ((COCD_TP146036UK04PatientRole)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader))));
}
finally {
if ((stringReader != null)) {
stringReader.Dispose();
}
}
}
/// <summary>
/// Serializes current COCD_TP146036UK04PatientRole object into file
/// </summary>
/// <param name="fileName">full path of outupt xml file</param>
/// <param name="exception">output Exception value if failed</param>
/// <returns>true if can serialize and save into file; otherwise, false</returns>
public virtual bool SaveToFile(string fileName, out System.Exception exception) {
exception = null;
try {
SaveToFile(fileName);
return true;
}
catch (System.Exception e) {
exception = e;
return false;
}
}
public virtual void SaveToFile(string fileName) {
System.IO.StreamWriter streamWriter = null;
try {
string xmlString = Serialize();
System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName);
streamWriter = xmlFile.CreateText();
streamWriter.WriteLine(xmlString);
streamWriter.Close();
}
finally {
if ((streamWriter != null)) {
streamWriter.Dispose();
}
}
}
/// <summary>
/// Deserializes xml markup from file into an COCD_TP146036UK04PatientRole object
/// </summary>
/// <param name="fileName">string xml file to load and deserialize</param>
/// <param name="obj">Output COCD_TP146036UK04PatientRole object</param>
/// <param name="exception">output Exception value if deserialize failed</param>
/// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
public static bool LoadFromFile(string fileName, out COCD_TP146036UK04PatientRole obj, out System.Exception exception) {
exception = null;
obj = default(COCD_TP146036UK04PatientRole);
try {
obj = LoadFromFile(fileName);
return true;
}
catch (System.Exception ex) {
exception = ex;
return false;
}
}
public static bool LoadFromFile(string fileName, out COCD_TP146036UK04PatientRole obj) {
System.Exception exception = null;
return LoadFromFile(fileName, out obj, out exception);
}
public static COCD_TP146036UK04PatientRole LoadFromFile(string fileName) {
System.IO.FileStream file = null;
System.IO.StreamReader sr = null;
try {
file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read);
sr = new System.IO.StreamReader(file);
string xmlString = sr.ReadToEnd();
sr.Close();
file.Close();
return Deserialize(xmlString);
}
finally {
if ((file != null)) {
file.Dispose();
}
if ((sr != null)) {
sr.Dispose();
}
}
}
#endregion
#region Clone method
/// <summary>
/// Create a clone of this COCD_TP146036UK04PatientRole object
/// </summary>
public virtual COCD_TP146036UK04PatientRole Clone() {
return ((COCD_TP146036UK04PatientRole)(this.MemberwiseClone()));
}
#endregion
}
}
| 41.509506 | 1,368 | 0.577173 |
[
"MIT"
] |
Kusnaditjung/MimDms
|
src/Dms.Ambulance.V2100/Generated/COCD_TP146036UK04PatientRole.cs
| 10,917 |
C#
|
//-----------------------------------------------------------------------------
// Filename: Program.cs
//
// Description: A console application to load test the WebRTC data channel
// send message API.
//
// Author(s):
// Aaron Clauson ([email protected])
//
// History:
// 06 Aug 2020 Aaron Clauson Created based on example from @Terricide.
// 10 Apr 2021 Aaron Clauson Adjusted for new SCTP stack.
//
// License:
// BSD 3-Clause "New" or "Revised" License, see included LICENSE.md file.
//-----------------------------------------------------------------------------
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Serilog;
using Serilog.Extensions.Logging;
using SIPSorcery.Net;
using SIPSorcery.Sys;
namespace SIPSorcery.Demo
{
/// <summary>
/// The test mechanism is:
/// - Create a series of WebRTC peer connection peers. Each pair has one data channel created by default.
/// - Create any additional data channels required.
/// - Do N number of sends on each data channel. Each send involves:
/// - Create a random byte buffer, take a sha256 hash of it and send. Wait X seconds for a response.
/// - On the receiving data channel hash the random buffer and ensure it matches the supplied sha256.
/// Send string response back to sender with the send number.
/// - Upon receiving response on the original sending channel commence the next send.
/// </summary>
class Program
{
/// <summary>
/// The number of WebRTC peer connection pairs to use for the test. Each pair creates two
/// peer connections and establishes a DTLS connection. A single data channel is created at
/// connection time. If the TEST_DATACHANNELS_PER_PEER_CONNECTION is larger than 1 then
/// additional data channels will be created after the peer connection is established.
/// Recommended values are between 1 and 10.
/// </summary>
const int TEST_PEER_CONNECTIONS_COUNT = 10;
/// <summary>
/// The number of data channels to establish between each WebRTC peer connection pair. At
/// least one connection is always created.
/// Recommended values are between 1 and 10.
/// </summary>
const int TEST_DATACHANNELS_PER_PEER_CONNECTION = 3;
/// <summary>
/// The maximum data payload to set on the messages sent for each data channel test. The message
/// size for a data channel send is limited by RTCSctpTransport.SCTP_DEFAULT_MAX_MESSAGE_SIZE of 262144.
/// 68 bytes are required for the SCTP fields and 69 byes are required for an integer and string field
/// so the maximum this can be set at is 262007.
/// Recommended values are between 1 and 262007.
/// </summary>
const int TEST_MAX_DATA_PAYLOAD = 262007;
/// <summary>
/// The number of test sends to do on each data channel. The total number of sends carried out is:
/// peer connection pairs x data channels per pair x data channel sends
/// Recommended values are between 1 and 1000.
/// </summary>
const int TEST_DATACHANNEL_SENDS = 100;
/// <summary>
/// The amount of time to wait for a data channel send to finish before timing
/// out and assuming it failed.
/// </summary>
const int TEST_DATACHANNEL_SEND_TIMEOUT_SEONDS = 2;
private static Microsoft.Extensions.Logging.ILogger logger = NullLogger.Instance;
private static List<PeerConnectionPair> connectionPairs = new List<PeerConnectionPair>();
static void Main()
{
Console.WriteLine("WebRTC Data Channel Load Test Program");
Console.WriteLine("Press ctrl-c to exit.");
RunCommand().Wait();
}
private static async Task RunCommand()
{
AddConsoleLogger();
// Connect the peer connection pairs.
Stopwatch connectSW = Stopwatch.StartNew();
List<Task> connectPairsTasks = new List<Task>();
for (int i = 0; i < TEST_PEER_CONNECTIONS_COUNT; i++)
{
int id = i;
var t = Task.Run(async () =>
{
var pair = new PeerConnectionPair(id);
connectionPairs.Add(pair);
await pair.Connect();
});
connectPairsTasks.Add(t);
}
await Task.WhenAll(connectPairsTasks);
connectSW.Stop();
Console.WriteLine($"Data channel open tasks completed in {connectSW.ElapsedMilliseconds:0.##}ms.");
foreach (var pair in connectionPairs)
{
Console.WriteLine($"PC pair {pair.Name} src datachannel {pair.DC.readyState} streamid {pair.DC.id}, " +
$"dst datachannel {pair.PCDst.DataChannels.Single().readyState} streamid {pair.PCDst.DataChannels.Single().id}.");
char a = 'a';
for (int j = 1; j < TEST_DATACHANNELS_PER_PEER_CONNECTION; j++)
{
char dcid = (char)((int)a + j);
var dstdcB = await pair.PCDst.createDataChannel($"{PeerConnectionPair.DATACHANNEL_LABEL_PREFIX}-{pair.ID}-{dcid}");
}
}
foreach (var pair in connectionPairs)
{
Console.WriteLine($"Data channels for peer connection pair {pair.Name}:");
foreach (var srcdc in pair.PCSrc.DataChannels)
{
var dstdc = pair.PCDst.DataChannels.SingleOrDefault(x => x.id == srcdc.id);
Console.WriteLine($" {srcdc.label}: src status {srcdc.readyState} streamid {srcdc.id} <-> " +
$"dst status {dstdc.readyState} streamid {dstdc.id}.");
srcdc.onmessage += OnData;
dstdc.onmessage += OnData;
}
}
// Do the data channel sends on each peer connection pair.
Stopwatch sendSW = Stopwatch.StartNew();
var taskList = new List<Task>();
foreach (var pair in connectionPairs)
{
foreach (var dc in pair.PCSrc.DataChannels)
{
taskList.Add(Task.Run(() =>
{
var sw = Stopwatch.StartNew();
for (int i = 0; i < TEST_DATACHANNEL_SENDS; i++)
{
var sendConfirmedSig = pair.StreamSendConfirmed[dc.id.Value];
sendConfirmedSig.Reset();
var packetNum = new Message();
packetNum.Num = i;
packetNum.Data = new byte[TEST_MAX_DATA_PAYLOAD];
Crypto.GetRandomBytes(packetNum.Data);
packetNum.SHA256 = Crypto.GetSHA256Hash(packetNum.Data);
Console.WriteLine($"{dc.label}: stream id {dc.id}, send {i}.");
//Console.WriteLine($"Send {i} from dc {dc.label}, sha256 {packetNum.SHA256}.");
dc.send(packetNum.ToData());
if (!sendConfirmedSig.Wait(TEST_DATACHANNEL_SEND_TIMEOUT_SEONDS * 1000))
{
throw new ApplicationException($"Data channel send on {dc.label} timed out waiting for confirmation on send {i}.");
}
}
Console.WriteLine($"{dc.label} data channel sends finished in {sw.ElapsedMilliseconds/1000:0.##}s.");
}));
}
}
await Task.WhenAll(taskList.ToArray());
Console.WriteLine($"Done in {sendSW.ElapsedMilliseconds}ms");
Console.WriteLine("Press any key to exit.");
Console.ReadLine();
foreach (var pair in connectionPairs)
{
pair.PCSrc.Close("normal");
pair.PCDst.Close("normal");
}
}
private static void OnData(RTCDataChannel dc, DataChannelPayloadProtocols proto, byte[] data)
{
if (proto == DataChannelPayloadProtocols.WebRTC_String)
{
Console.WriteLine($"{dc.label}: return recv stream id {dc.id}, send# {Encoding.UTF8.GetString(data)}");
int pairID = int.Parse(Regex.Match(dc.label, @".*-(?<id>\d+)-.*").Result("${id}"));
connectionPairs.Single(x => x.ID == pairID).StreamSendConfirmed[dc.id.Value].Set();
}
else if (proto == DataChannelPayloadProtocols.WebRTC_Binary)
{
var packet = BytesToStructure<Message>(data);
var sha256 = Crypto.GetSHA256Hash(packet.Data);
Console.WriteLine($"{dc.label}: recv stream id {dc.id}, send# {packet.Num}.");
//Console.WriteLine($"{dc.label}: recv {packet.Num}, sha256 {sha256}.");
if (sha256 != packet.SHA256)
{
throw new ApplicationException($"Data channel message sha256 hash {sha256} did not match expected hash {packet.SHA256}.");
}
dc.send(packet.Num.ToString());
}
}
static T BytesToStructure<T>(byte[] bytes)
{
int size = Marshal.SizeOf(typeof(T));
if (bytes.Length < size)
{
throw new Exception("Invalid parameter");
}
IntPtr ptr = Marshal.AllocHGlobal(size);
try
{
Marshal.Copy(bytes, 0, ptr, size);
return (T)Marshal.PtrToStructure(ptr, typeof(T));
}
finally
{
Marshal.FreeHGlobal(ptr);
}
}
/// <summary>
/// Adds a console logger.
/// </summary>
private static void AddConsoleLogger()
{
var seriLogger = new LoggerConfiguration()
.Enrich.FromLogContext()
.MinimumLevel.Is(Serilog.Events.LogEventLevel.Debug)
.WriteTo.Console()
.CreateLogger();
var factory = new SerilogLoggerFactory(seriLogger);
SIPSorcery.LogFactory.Set(factory);
logger = factory.CreateLogger<Program>();
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
struct Message
{
public int Num;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)]
public string SHA256;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TEST_MAX_DATA_PAYLOAD)]
public byte[] Data;
public byte[] ToData()
{
int total = Marshal.SizeOf(typeof(Message));//Get size of struct data
byte[] buf = new byte[total];//byte array & its size
IntPtr ptr = Marshal.AllocHGlobal(total);//pointer to byte array
Marshal.StructureToPtr(this, ptr, true);
Marshal.Copy(ptr, buf, 0, total);
Marshal.FreeHGlobal(ptr);
return buf;
}
}
}
class PeerConnectionPair
{
public const string DATACHANNEL_LABEL_PREFIX = "dc";
public string Name;
public RTCPeerConnection PCSrc;
public RTCPeerConnection PCDst;
public RTCDataChannel DC;
public int ID { get; private set; }
public ConcurrentDictionary<ushort, ManualResetEventSlim> StreamSendConfirmed =
new ConcurrentDictionary<ushort, ManualResetEventSlim>();
public PeerConnectionPair(int id)
{
ID = id;
Name = $"PC{ID}";
PCSrc = new RTCPeerConnection();
PCDst = new RTCPeerConnection();
PCSrc.onconnectionstatechange += (state) => Console.WriteLine($"Peer connection pair {Name} state changed to {state}.");
PCSrc.ondatachannel += (dc) => StreamSendConfirmed.TryAdd(dc.id.Value, new ManualResetEventSlim());
}
public async Task Connect()
{
TaskCompletionSource<bool> dcAOpened = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
DC = await PCSrc.createDataChannel($"{DATACHANNEL_LABEL_PREFIX}-{ID}-a");
DC.onopen += () =>
{
Console.WriteLine($"Peer connection pair {Name} A data channel opened.");
StreamSendConfirmed.TryAdd(DC.id.Value, new ManualResetEventSlim());
dcAOpened.TrySetResult(true);
};
var offer = PCSrc.createOffer();
await PCSrc.setLocalDescription(offer);
if (PCDst.setRemoteDescription(offer) != SetDescriptionResultEnum.OK)
{
throw new ApplicationException($"SDP negotiation failed for peer connection pair {Name}.");
}
var answer = PCDst.createAnswer();
await PCDst.setLocalDescription(answer);
if (PCSrc.setRemoteDescription(answer) != SetDescriptionResultEnum.OK)
{
throw new ApplicationException($"SDP negotiation failed for peer connection pair {Name}.");
}
await Task.WhenAll(dcAOpened.Task);
}
}
}
| 41.133333 | 148 | 0.548799 |
[
"Apache-2.0"
] |
Ali-Russell/sipsorcery
|
examples/WebRTCScenarios/DataChannelStressTest/Program.cs
| 14,193 |
C#
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace NicoV5.Mvvm.WorkSpaces
{
/// <summary>
/// SearchMylistWindow.xaml の相互作用ロジック
/// </summary>
public partial class SearchMylistWindow : UserControl
{
public SearchMylistWindow()
{
InitializeComponent();
}
}
}
| 22.428571 | 57 | 0.719745 |
[
"MIT"
] |
twinbird827/NicoV5
|
Mvvm/WorkSpaces/SearchMylistWindow.xaml.cs
| 648 |
C#
|
using System;
using System.ComponentModel;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Linq;
using STEP;
namespace IFC
{
/// <summary>
/// <see href="http://www.buildingsmart-tech.org/ifc/IFC4/final/html/link/ifcrelcontainedinspatialstructure.htm"/>
/// </summary>
public partial class IfcRelContainedInSpatialStructure : IfcRelConnects
{
public List<IfcProduct> RelatedElements{get;set;}
public IfcSpatialElement RelatingStructure{get;set;}
/// <summary>
/// Construct a IfcRelContainedInSpatialStructure with all required attributes.
/// </summary>
public IfcRelContainedInSpatialStructure(IfcGloballyUniqueId globalId,List<IfcProduct> relatedElements,IfcSpatialElement relatingStructure):base(globalId)
{
RelatedElements = relatedElements;
RelatingStructure = relatingStructure;
}
/// <summary>
/// Construct a IfcRelContainedInSpatialStructure with required and optional attributes.
/// </summary>
[JsonConstructor]
public IfcRelContainedInSpatialStructure(IfcGloballyUniqueId globalId,IfcOwnerHistory ownerHistory,IfcLabel name,IfcText description,List<IfcProduct> relatedElements,IfcSpatialElement relatingStructure):base(globalId,ownerHistory,name,description)
{
RelatedElements = relatedElements;
RelatingStructure = relatingStructure;
}
public static new IfcRelContainedInSpatialStructure FromJSON(string json){ return JsonConvert.DeserializeObject<IfcRelContainedInSpatialStructure>(json); }
public override string GetStepParameters()
{
var parameters = new List<string>();
parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$");
parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$");
parameters.Add(Name != null ? Name.ToStepValue() : "$");
parameters.Add(Description != null ? Description.ToStepValue() : "$");
parameters.Add(RelatedElements != null ? RelatedElements.ToStepValue() : "$");
parameters.Add(RelatingStructure != null ? RelatingStructure.ToStepValue() : "$");
return string.Join(", ", parameters.ToArray());
}
}
}
| 36.603448 | 249 | 0.749882 |
[
"MIT"
] |
Gytaco/IFC-gen
|
lang/csharp/src/IFC/IfcRelContainedInSpatialStructure.g.cs
| 2,123 |
C#
|
using System;
using d60.Cirqus.Commands;
using Exchanger.Model;
namespace Exchanger.Commands
{
public class Pull : ExecutableCommand
{
readonly StoreFactory storeFactory;
readonly Func<string> idFactory;
public Pull(StoreFactory storeFactory, Func<string> idFactory)
{
this.storeFactory = storeFactory;
this.idFactory = idFactory;
}
public string CalendarId { get; set; }
public string RemoteId { get; set; }
public override void Execute(ICommandContext context)
{
var local = context.Load<LocalCalendar>(CalendarId);
local.Pull(storeFactory, idFactory, RemoteId).Wait();
}
}
}
| 27.703704 | 71 | 0.610963 |
[
"MIT"
] |
asgerhallas/Exchanger
|
src/Exchanger/Commands/Pull.cs
| 750 |
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("ESCP_Spriggan")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ESCP_Spriggan")]
[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("0dbbaae7-447e-4533-ac7c-a59f4a5ebf68")]
// 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.675676 | 84 | 0.748207 |
[
"MIT"
] |
SirMashedPotato/ESCP-Spriggan
|
1.3/Source/ESCP_Spriggan/ESCP_Spriggan/Properties/AssemblyInfo.cs
| 1,397 |
C#
|
using RestSharp;
using SACModuleBase;
using SACModuleBase.Enums.Captcha;
using SACModuleBase.Models;
using SACModuleBase.Models.Capcha;
using SteamAccCreator.Models;
using System;
using System.Text.RegularExpressions;
namespace SteamAccCreator.Web.Captcha.Handlers
{
public class CaptchaSolutionsHandler : ISACHandlerCaptcha, ISACHandlerReCaptcha
{
public static Uri Domain = new Uri("http://api.captchasolutions.com/");
public bool ModuleEnabled { get; set; } = true;
public void ModuleInitialize(SACInitialize initialize) { /* It will not be called inside creator */ }
private CaptchaSolutionsConfig Config;
private RestClient HttpClient;
public CaptchaSolutionsHandler(Configuration configuration)
{
Config = configuration.Captcha.CaptchaSolutions;
HttpClient = new RestClient(Domain)
{
Timeout = (int)TimeSpan.FromSeconds(40).TotalMilliseconds,
UserAgent = Defaults.Web.USER_AGENT
};
HttpClient.AddDefaultParameter("key", Config.ApiKey);
HttpClient.AddDefaultParameter("secret", Config.ApiSecret);
HttpClient.AddDefaultParameter("out", "txt");
}
public CaptchaResponse Solve(CaptchaRequest captcha)
{
var request = new RestRequest("solve", Method.POST);
request.AddParameter("p", "base64");
request.AddParameter("captcha", $"data:image/jpg;base64,{captcha.CaptchaImage}");
return Solve(request);
}
public CaptchaResponse Solve(ReCaptchaRequest captcha)
{
var request = new RestRequest("solve", Method.POST);
request.AddParameter("p", "nocaptcha");
request.AddParameter("googlekey", captcha.SiteKey);
request.AddParameter("pageurl", captcha.Url);
return Solve(request);
}
private CaptchaResponse Solve(IRestRequest captcha)
{
var response = HttpClient.Execute(captcha);
if (!response.IsSuccessful)
return new CaptchaResponse(CaptchaStatus.RetryAvailable, ErrorMessages.CaptchaSolutions.REQUEST_FAILED);
if (Regex.IsMatch(response.Content ?? "", @"Error:\s(.+)", RegexOptions.IgnoreCase))
{
Logger.Warn($"Captchasolutions error:\n{response.Content}\n====== END ======");
return new CaptchaResponse(CaptchaStatus.RetryAvailable, response.Content);
}
var solution = Regex.Replace(response.Content ?? "", @"\t|\n|\r", "");
Logger.Debug($"CaptchaSolutions: {solution}");
return new CaptchaResponse(solution);
}
}
}
| 38.069444 | 120 | 0.636629 |
[
"MIT"
] |
karutaXkun/steam-account-generator
|
SteamAccCreator/Web/Captcha/Handlers/CaptchaSolutionsHandler.cs
| 2,743 |
C#
|
/***********************************************************************************************************************************
* GOD First *
* Author: Dustin Ledbetter *
* Release Date: 11-19-2018 *
* Last Edited: 01-29-2019 *
* Version: 1.0 *
* Purpose: Called when a logging event has been setup in other methods for actions occurring while the code is running *
************************************************************************************************************************************/
using System;
using System.IO;
namespace SFTP_Process
{
class LogMessageToFile
{
#region |--This Method is used to write all of our logs to a txt file--|
public void LogMessagesToFile(string logPath, string msg)
{
// Get the Date and time stamps as desired
string currentLogDate = DateTime.Now.ToString("MMddyyyy");
string currentLogTimeInsertMain = DateTime.Now.ToString("HH:mm:ss tt");
// Setup Message to display in .txt file
msg = string.Format("Time: {0:G}: Message: {1}{2}", currentLogTimeInsertMain, msg, Environment.NewLine);
// Add message to the file
File.AppendAllText(logPath + "SFTP_Process_Logs_" + currentLogDate + ".txt", msg);
}
#endregion
} // End of the class: LogMessageToFile
} // End of file
| 51.736842 | 134 | 0.359105 |
[
"MIT"
] |
DustinLedbetter/SFTP-Project
|
LogMessageToFile.cs
| 1,968 |
C#
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace LoraKeysManagerFacade
{
using System;
using System.Collections.Generic;
using System.Text;
public class DevAddrCacheInfo : IoTHubDeviceInfo, IComparable
{
public string GatewayId { get; set; }
public DateTime LastUpdatedTwins { get; set; }
public string NwkSKey { get; set; }
public int CompareTo(object obj)
{
if (obj is DevAddrCacheInfo)
{
var oldElement = (DevAddrCacheInfo)obj;
if (this.GatewayId == oldElement.GatewayId
&& this.NwkSKey == oldElement.NwkSKey
&& this.DevAddr == oldElement.DevAddr
&& this.DevEUI == oldElement.DevEUI
&& this.LastUpdatedTwins == oldElement.LastUpdatedTwins)
{
return 0;
}
}
return 1;
}
}
}
| 29.135135 | 101 | 0.558442 |
[
"MIT"
] |
LauraDamianTNA/iotedge-lorawan-starterkit
|
LoRaEngine/LoraKeysManagerFacade/DevAddrCacheInfo.cs
| 1,080 |
C#
|
using System;
using System.Runtime.InteropServices;
namespace SimConnect
{
public class RecvEvent : Recv
{
internal RecvEvent (uint dwSize, uint dwVersion, uint dwID, uint uGroupID, uint uEventID, uint dwData) : base (dwSize, dwVersion, dwID)
{
GroupId = uGroupID;
EventId = uEventID;
Data = dwData;
}
internal RecvEvent (SIMCONNECT_RECV_EVENT sRecvEvent) : this (sRecvEvent.dwSize, sRecvEvent.dwVersion, sRecvEvent.dwID, sRecvEvent.uGroupID, sRecvEvent.uEventID, sRecvEvent.dwData) { }
internal new static RecvEvent FromMemory (IntPtr pData)
{
return new RecvEvent (Marshal.PtrToStructure<SIMCONNECT_RECV_EVENT> (pData));
}
public uint GroupId { get; private set; }
public uint EventId { get; private set; }
public uint Data { get; private set; }
}
}
| 29.333333 | 186 | 0.737374 |
[
"MIT"
] |
bholmes/NiteWorks
|
FlightWork/ManagedSimConnect/RecvEvent.cs
| 794 |
C#
|
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AwsNative.OpsWorks.Outputs
{
[OutputType]
public sealed class InstanceTimeBasedAutoScaling
{
public readonly object? Friday;
public readonly object? Monday;
public readonly object? Saturday;
public readonly object? Sunday;
public readonly object? Thursday;
public readonly object? Tuesday;
public readonly object? Wednesday;
[OutputConstructor]
private InstanceTimeBasedAutoScaling(
object? friday,
object? monday,
object? saturday,
object? sunday,
object? thursday,
object? tuesday,
object? wednesday)
{
Friday = friday;
Monday = monday;
Saturday = saturday;
Sunday = sunday;
Thursday = thursday;
Tuesday = tuesday;
Wednesday = wednesday;
}
}
}
| 24.84 | 81 | 0.60628 |
[
"Apache-2.0"
] |
AaronFriel/pulumi-aws-native
|
sdk/dotnet/OpsWorks/Outputs/InstanceTimeBasedAutoScaling.cs
| 1,242 |
C#
|
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Pacman.GraphStuff;
using System.Collections.Generic;
using System.IO;
namespace Pacman
{
public class Game1 : Game
{
public enum GameStates
{
TitleScreen,
MapEditor,
MainGame,
Options
}
public static GameStates currentScreen = GameStates.TitleScreen;
GameStates prevScreen;
public static Dictionary<GameStates, Screen> screens = new Dictionary<GameStates, Screen>();
public static float MasterVolume = .5f;
public static float SFXVolume = .5f;
public static float MusicVolume = .5f;
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
KeyboardState prevKeyboardState = Keyboard.GetState();
public static string WindowText = "";
public void ChangeResolution(int width, int height)
{
_graphics.PreferredBackBufferWidth = width;
_graphics.PreferredBackBufferHeight = height;
_graphics.ApplyChanges();
}
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = true;
}
protected override void Initialize()
{
// TODO: Add your initialization logic here
ChangeResolution(800, 800);
base.Initialize();
}
protected override void LoadContent()
{
_spriteBatch = new SpriteBatch(GraphicsDevice);
screens.Add(GameStates.TitleScreen, new TitleScreen((800, 800), new Vector2(0), _graphics));
screens.Add(GameStates.MapEditor, new MapEditor((1600, 1000), new Vector2(0), _graphics));
screens.Add(GameStates.Options, new Options((800, 800), new Vector2(0), _graphics));
foreach (var screen in screens)
{
screen.Value.LoadContent(Content);
}
}
protected override void Update(GameTime gameTime)
{
//if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
//Exit();
// TODO: Add your update logic here
MouseState ms = Mouse.GetState();
if (Keyboard.GetState().IsKeyDown(Keys.Escape) && prevKeyboardState != Keyboard.GetState())
{
#region debug stuff
//Color[] colors = new Color[GraphicsDevice.Viewport.Width * GraphicsDevice.Viewport.Height];
//GraphicsDevice.GetBackBufferData(colors);
//Texture2D ss = new Texture2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
//ss.SetData(colors);
//Debug for saving to file
//using (FileStream memory = new FileStream("ss.png", FileMode.OpenOrCreate))
//{
// ss.SaveAsPng(memory, ss.Width, ss.Height);
//}
#endregion
if (currentScreen != GameStates.Options)
{
prevScreen = currentScreen;
Options.SetUpScreen();
}
else
{
currentScreen = prevScreen;
}
}
screens[currentScreen].Update(gameTime);
prevKeyboardState = Keyboard.GetState();
//Window.Title = Game1.WindowText;
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
// TODO: Add your drawing code here
_spriteBatch.Begin();
screens[currentScreen].Draw(_spriteBatch);
_spriteBatch.End();
base.Draw(gameTime);
}
}
}
| 30.503759 | 134 | 0.566182 |
[
"MIT"
] |
Santiago-G/Pacman
|
Pacman/Pacman/Game1.cs
| 4,059 |
C#
|
using System;
using System.Collections.Generic;
using Daikin.DotNetLib.MsTeams;
using Daikin.DotNetLib.MsTeams.Models;
using Xunit;
namespace Daikin.DotNetLib.Core.Tests
{
public class Teams
{
#region Fields
private readonly Config _configuration;
#endregion
#region Constructors
public Teams()
{
_configuration = Config.GetConfiguration();
}
#endregion
#region Methods
[Fact]
public void Send()
{
var request = new WebHookRequest
{
Summary = "Daikin.DotNetLib.MsTeams Test",
Title = "Send Unit Test",
ThemeColor = "#00a0e3",
Text = "General message of item being communicated."
};
var section = new Section
{
Text = "Section of information, allowing multiple sections within a single message.",
Facts = new List<Fact>
{
new Fact {Name = "Start Date: ", Value = DateTime.Now.ToLongDateString()},
new Fact {Name = "Start Time: ", Value = DateTime.Now.ToLongTimeString()},
new Fact {Name = "User: ", Value = Environment.UserDomainName + "\\" + Environment.UserName},
new Fact {Name = "Computer: ", Value = Environment.MachineName}
}
};
request.Sections.Add(section);
var (isSuccessful, response) = Notification.Send(
webHookUrl: _configuration.TeamsWebHookUrl,
request: request
);
Assert.True(isSuccessful);
request = new WebHookRequest
{
Summary = "Daikin.DotNetLib.MsTeams Test",
Title = "Send Unit Test Response",
ThemeColor = "#00a0e3",
Text = response
};
(isSuccessful, _) = Notification.Send(
webHookUrl: _configuration.TeamsWebHookUrl,
request: request
);
Assert.True(isSuccessful);
}
#endregion
}
}
| 31.114286 | 113 | 0.520661 |
[
"MIT"
] |
daikinapplied/DotNetLib
|
Daikin.DotNetLib.Core.Tests/Teams.cs
| 2,180 |
C#
|
#region License
// The MIT License (MIT)
//
// Copyright (c) 2016 Alberto Rodríguez Orozco & LiveCharts contributors
//
// 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
#region
using LiveCharts.Core.Charts;
using LiveCharts.Core.Dimensions;
using LiveCharts.Core.Drawing;
using LiveCharts.Core.Drawing.Styles;
#endregion
namespace LiveCharts.Core.Interaction.Events
{
/// <summary>
/// The Cartesian Axis Separator Arguments.
/// </summary>
public class CartesianAxisSectionArgs
{
/// <summary>
/// Gets or sets the index of the z.
/// </summary>
/// <value>
/// The index of the z.
/// </value>
public int ZIndex { get; internal set; }
/// <summary>
/// Gets a value indicating whether this <see cref="CartesianAxisSectionArgs"/> is draggable.
/// </summary>
/// <value>
/// <c>true</c> if draggable; otherwise, <c>false</c>.
/// </value>
public bool Draggable { get; internal set; }
/// <summary>
/// Gets or sets from.
/// </summary>
/// <value>
/// From.
/// </value>
public RectangleViewModel Rectangle { get; internal set; }
/// <summary>
/// Gets or sets the axis label model.
/// </summary>
/// <value>
/// The axis label model.
/// </value>
public AxisSectionViewModel Label { get; internal set; }
/// <summary>
/// Gets the plane.
/// </summary>
/// <value>
/// The plane.
/// </value>
public Plane Plane { get; internal set; }
/// <summary>
/// Gets a value indicating whether this <see cref="CartesianAxisSectionArgs"/> is disposing.
/// </summary>
/// <value>
/// <c>true</c> if disposing; otherwise, <c>false</c>.
/// </value>
public bool Disposing { get; internal set; }
/// <summary>
/// Gets the plane.
/// </summary>
/// <value>
/// The plane.
/// </value>
public ShapeStyle Style { get; internal set; }
/// <summary>
/// Gets the section.
/// </summary>
/// <value>
/// The section.
/// </value>
public Section Section { get; internal set; }
/// <summary>
/// Gets the chart view.
/// </summary>
/// <value>
/// The chart view.
/// </value>
public IChartView ChartView { get; internal set; }
}
}
| 31.692982 | 101 | 0.58594 |
[
"MIT"
] |
18720989200/Live-Charts
|
src/LiveCharts.Core/Interaction/Events/CartesianAxisSeparatorArgs.cs
| 3,616 |
C#
|
using Dibware.Template.Core.Domain.Contracts.Services;
using Dibware.Template.Presentation.Web.Controllers.Base;
using Dibware.Template.Presentation.Web.Helpers;
using Dibware.Template.Presentation.Web.Models.Home;
using Dibware.Template.Presentation.Web.Resources;
using Ninject;
using System;
using System.Web.Mvc;
namespace Dibware.Template.Presentation.Web.Controllers
{
public class HomeController : BaseControllerWithDataLookup
{
#region Private Members
//private ITermAndConditionService _termAndConditionService;
#endregion
#region Properties
/// <summary>
/// Gets or sets the term and condition service.
/// </summary>
/// <value>
/// The term and condition service.
/// </value>
[Inject]
public ITermAndConditionService TermAndConditionService { get; set; }
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="AccountController"/> class.
/// </summary>
/// <param name="lookupService">The lookup service.</param>
public HomeController(ILookupService lookupService)
: base(lookupService) { }
////TODO: swap constructors when all service code is complete...
////
///// <summary>
///// Initializes a new instance of the <see cref="AccountController"/> class.
///// </summary>
///// <param name="lookupService">The lookup service.</param>
//public HomeController(ILookupService lookupService,
// ITermAndConditionService termAndConditionService)
// : base(lookupService)
//{
// _termAndConditionService = termAndConditionService;
//}
#endregion
#region Actions
//
// GET: /About/
// No authorisation, anyone can view this.
[HttpGet]
[AllowAnonymous]
public ActionResult About()
{
var model = new AboutViewModel();
return View(ViewNames.About, model);
}
//
// GET: /Contact/
// No authorisation, anyone can view this.
[HttpGet]
[AllowAnonymous]
public ActionResult Contact()
{
var model = new ContactViewModel();
return View(ViewNames.Contact, model);
}
//
// POST: /Contact/
// No authorisation, anyone can view this.
[HttpPost]
[AllowAnonymous]
public ActionResult Contact(ContactViewModel model)
{
if (ModelState.IsValid)
{
// Send contact email to new registerant
EmailHelper.SendContactEmail(
model.Name,
model.EmailAddress,
model.Enquiry);
var sentModel = new ContactEmailSentViewModel();
return View(ViewNames.ContactEmailSent, sentModel);
}
// If we got this far, something failed, redisplay form
return View(ViewNames.Contact, model);
}
//
// GET: /Home/
// No authorisation, anyone can view this.
[HttpGet]
[AllowAnonymous]
public ActionResult Index()
{
var model = new IndexViewModel();
return View(ViewNames.Index, model);
}
//
// GET: /Status/
// No authorisation, anyone can view this.
[HttpGet]
[AllowAnonymous]
public ActionResult Status(String message)
{
var model = new StatusViewModel
{
Message = message
};
return View(ViewNames.Status, model);
}
//
// GET: /Terms/
// No authorisation, anyone can view this.
[HttpGet]
[AllowAnonymous]
public ActionResult Terms()
{
var model = new TermsViewModel()
{
CurrentTerms = TermAndConditionService.GetCurrent()
};
return View(ViewNames.Terms, model);
}
#endregion
}
}
| 29.958333 | 87 | 0.541261 |
[
"MIT"
] |
dibley1973/Dibware.Template.Presentation.Web
|
Dibware.Template.Presentation.Web/Controllers/HomeController.cs
| 4,316 |
C#
|
using System.ComponentModel.DataAnnotations;
namespace AbpDemoTwo.Users.Dto
{
public class ChangeUserLanguageDto
{
[Required]
public string LanguageName { get; set; }
}
}
| 19.9 | 48 | 0.688442 |
[
"MIT"
] |
YandongZhao/AbpDemoTwo
|
aspnet-core/src/AbpDemoTwo.Application/Users/Dto/ChangeUserLanguageDto.cs
| 199 |
C#
|
using System;
using System.Collections.Generic;
using Glass.Mapper.Sc.Fields;
namespace Glass.Mapper.Sc.Upgrade.Tests.Configuration.Fluent
{
public class BasicTemplate
{
#region SitecoreId
public virtual Guid Id { get; set; }
#endregion
#region Fields
#region Simple Types
public virtual bool Checkbox { get; set; }
public virtual DateTime Date { get; set; }
public virtual DateTime DateTime { get; set; }
public virtual File File { get; set; }
public virtual Image Image { get; set; }
public virtual int Integer { get; set; }
public virtual float Float { get; set; }
public virtual double Double { get; set; }
public virtual decimal Decimal { get; set; }
public virtual string MultiLineText { get; set; }
public virtual int Number { get; set; }
public virtual string Password { get; set; }
public virtual string RichText { get; set; }
public virtual string SingleLineText { get; set; }
#endregion
#region List Types
public virtual IEnumerable<SubClass> CheckList { get; set; }
public virtual TestEnum DropList { get; set; }
public virtual SubClass GroupedDropLink { get; set; }
public virtual TestEnum GroupedDropList { get; set; }
public virtual IEnumerable<SubClass> MultiList { get; set; }
public virtual IEnumerable<SubClass> Treelist { get; set; }
public virtual IEnumerable<SubClass> TreeListEx { get; set; }
#endregion
#region Link Types
public virtual SubClass DropLink { get; set; }
public virtual SubClass DropTree { get; set; }
public virtual Link GeneralLink { get; set; }
#endregion
#region Developer Types
public virtual string Icon { get; set; }
public virtual TriState TriState { get; set; }
#endregion
#region SystemType
public virtual System.IO.Stream Attachment { get; set; }
#endregion
#endregion
#region SitecoreInfo
public virtual string ContentPath { get; set; }
public virtual string DisplayName { get; set; }
public virtual string FullPath { get; set; }
public virtual string Key { get; set; }
public virtual string MediaUrl { get; set; }
public virtual string Path { get; set; }
public virtual Guid TemplateId { get; set; }
public virtual string TemplateName { get; set; }
public virtual string Url { get; set; }
public virtual int Version { get; set; }
#endregion
#region SitecoreChildren
public virtual IEnumerable<SubClass> Children { get; set; }
#endregion
#region SitecoreParent
public virtual SubClass Parent { get; set; }
#endregion
#region SitecoreQuery
public virtual IEnumerable<SubClass> Query { get; set; }
#endregion
}
public class SubClass
{
public virtual Guid Id { get; set; }
}
public enum TestEnum
{
Test1,
Test2,
Test3
}
}
| 26.705882 | 69 | 0.610447 |
[
"Apache-2.0"
] |
smithc/Glass.Mapper
|
Tests/Unit Tests/Glass.Mapper.Sc.Upgrade.Tests/Configuration/Fluent/BasicTemplate.cs
| 3,180 |
C#
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class InventoryRS : RuntimeSet<Item>
{
public GameEvent OnInventoryUpdate;
public override bool Add (Item t)
{
if (Items.Count < 8) {
base.Add (t);
OnInventoryUpdate.Raise ();
return true;
} else {
return false;
}
}
public Item[] GetItems ()
{
return Items.ToArray ();
}
public void ClearInv ()
{
Items.Clear ();
Items.Capacity = 8;
}
}
| 15 | 43 | 0.670833 |
[
"Apache-2.0"
] |
fezproof/polynova
|
Assets/UI/Inventory/InventoryRS.cs
| 482 |
C#
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
using System.ComponentModel;
using System.Security;
using System.Threading;
using Microsoft.DotNet.RemoteExecutor;
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
using Xunit;
namespace System.Diagnostics.Tests
{
public class ProcessStartInfoTests : ProcessTestBase
{
[Fact]
public void TestEnvironmentProperty()
{
Assert.NotEqual(0, new Process().StartInfo.Environment.Count);
ProcessStartInfo psi = new ProcessStartInfo();
// Creating a detached ProcessStartInfo will pre-populate the environment
// with current environmental variables.
IDictionary<string, string> environment = psi.Environment;
Assert.NotEqual(0, environment.Count);
int countItems = environment.Count;
environment.Add("NewKey", "NewValue");
environment.Add("NewKey2", "NewValue2");
Assert.Equal(countItems + 2, environment.Count);
environment.Remove("NewKey");
Assert.Equal(countItems + 1, environment.Count);
environment.Add("NewKey2", "NewValue2Overridden");
Assert.Equal("NewValue2Overridden", environment["NewKey2"]);
//Clear
environment.Clear();
Assert.Equal(0, environment.Count);
//ContainsKey
environment.Add("NewKey", "NewValue");
environment.Add("NewKey2", "NewValue2");
Assert.True(environment.ContainsKey("NewKey"));
Assert.Equal(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), environment.ContainsKey("newkey"));
Assert.False(environment.ContainsKey("NewKey99"));
//Iterating
string result = null;
int index = 0;
foreach (string e1 in environment.Values.OrderBy(p => p))
{
index++;
result += e1;
}
Assert.Equal(2, index);
Assert.Equal("NewValueNewValue2", result);
result = null;
index = 0;
foreach (string e1 in environment.Keys.OrderBy(p => p))
{
index++;
result += e1;
}
Assert.Equal("NewKeyNewKey2", result);
Assert.Equal(2, index);
result = null;
index = 0;
foreach (KeyValuePair<string, string> e1 in environment.OrderBy(p => p.Key))
{
index++;
result += e1.Key;
}
Assert.Equal("NewKeyNewKey2", result);
Assert.Equal(2, index);
//Contains
Assert.True(environment.Contains(new KeyValuePair<string, string>("NewKey", "NewValue")));
Assert.Equal(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), environment.Contains(new KeyValuePair<string, string>("nEwKeY", "NewValue")));
Assert.False(environment.Contains(new KeyValuePair<string, string>("NewKey99", "NewValue99")));
//Exception not thrown with invalid key
Assert.Throws<ArgumentNullException>(() => environment.Contains(new KeyValuePair<string, string>(null, "NewValue99")));
environment.Add(new KeyValuePair<string, string>("NewKey98", "NewValue98"));
//Indexed
string newIndexItem = environment["NewKey98"];
Assert.Equal("NewValue98", newIndexItem);
//TryGetValue
string stringout = null;
Assert.True(environment.TryGetValue("NewKey", out stringout));
Assert.Equal("NewValue", stringout);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Assert.True(environment.TryGetValue("NeWkEy", out stringout));
Assert.Equal("NewValue", stringout);
}
stringout = null;
Assert.False(environment.TryGetValue("NewKey99", out stringout));
Assert.Null(stringout);
//Exception not thrown with invalid key
Assert.Throws<ArgumentNullException>(() =>
{
string stringout1 = null;
environment.TryGetValue(null, out stringout1);
});
//Exception not thrown with invalid key
Assert.Throws<ArgumentNullException>(() => environment.Add(null, "NewValue2"));
environment.Add("NewKey2", "NewValue2OverriddenAgain");
Assert.Equal("NewValue2OverriddenAgain", environment["NewKey2"]);
//Remove Item
environment.Remove("NewKey98");
environment.Remove("NewKey98"); //2nd occurrence should not assert
//Exception not thrown with null key
Assert.Throws<ArgumentNullException>(() => { environment.Remove(null); });
//"Exception not thrown with null key"
Assert.Throws<KeyNotFoundException>(() => environment["1bB"]);
Assert.True(environment.Contains(new KeyValuePair<string, string>("NewKey2", "NewValue2OverriddenAgain")));
Assert.Equal(RuntimeInformation.IsOSPlatform(OSPlatform.Windows), environment.Contains(new KeyValuePair<string, string>("NEWKeY2", "NewValue2OverriddenAgain")));
Assert.False(environment.Contains(new KeyValuePair<string, string>("NewKey2", "newvalue2Overriddenagain")));
Assert.False(environment.Contains(new KeyValuePair<string, string>("newkey2", "newvalue2Overriddenagain")));
//Use KeyValuePair Enumerator
string[] results = new string[2];
var x = environment.GetEnumerator();
x.MoveNext();
results[0] = x.Current.Key + " " + x.Current.Value;
x.MoveNext();
results[1] = x.Current.Key + " " + x.Current.Value;
Assert.Equal(new string[] { "NewKey NewValue", "NewKey2 NewValue2OverriddenAgain" }, results.OrderBy(s => s));
//IsReadonly
Assert.False(environment.IsReadOnly);
environment.Add(new KeyValuePair<string, string>("NewKey3", "NewValue3"));
environment.Add(new KeyValuePair<string, string>("NewKey4", "NewValue4"));
//CopyTo - the order is undefined.
KeyValuePair<string, string>[] kvpa = new KeyValuePair<string, string>[10];
environment.CopyTo(kvpa, 0);
KeyValuePair<string, string>[] kvpaOrdered = kvpa.OrderByDescending(k => k.Value).ToArray();
Assert.Equal("NewKey4", kvpaOrdered[0].Key);
Assert.Equal("NewKey2", kvpaOrdered[2].Key);
environment.CopyTo(kvpa, 6);
Assert.Equal(default(KeyValuePair<string, string>), kvpa[5]);
Assert.StartsWith("NewKey", kvpa[6].Key);
Assert.NotEqual(kvpa[6].Key, kvpa[7].Key);
Assert.StartsWith("NewKey", kvpa[7].Key);
Assert.NotEqual(kvpa[7].Key, kvpa[8].Key);
Assert.StartsWith("NewKey", kvpa[8].Key);
//Exception not thrown with null key
Assert.Throws<ArgumentOutOfRangeException>(() => { environment.CopyTo(kvpa, -1); });
//Exception not thrown with null key
AssertExtensions.Throws<ArgumentException>(null, () => { environment.CopyTo(kvpa, 9); });
//Exception not thrown with null key
Assert.Throws<ArgumentNullException>(() =>
{
KeyValuePair<string, string>[] kvpanull = null;
environment.CopyTo(kvpanull, 0);
});
}
[Fact]
public void TestSetEnvironmentOnChildProcess()
{
const string name = "b5a715d3-d74f-465d-abb7-2abe844750c9";
Environment.SetEnvironmentVariable(name, "parent-process-value");
Process p = CreateProcess(() =>
{
if (Environment.GetEnvironmentVariable(name) != "child-process-value")
return 1;
return RemoteExecutor.SuccessExitCode;
});
p.StartInfo.Environment.Add(name, "child-process-value");
p.Start();
Assert.True(p.WaitForExit(WaitInMS));
Assert.Equal(RemoteExecutor.SuccessExitCode, p.ExitCode);
}
[Fact]
public void TestEnvironmentOfChildProcess()
{
const string ItemSeparator = "CAFF9451396B4EEF8A5155A15BDC2080"; // random string that shouldn't be in any env vars; used instead of newline to separate env var strings
const string ExtraEnvVar = "TestEnvironmentOfChildProcess_SpecialStuff";
Environment.SetEnvironmentVariable(ExtraEnvVar, "\x1234" + Environment.NewLine + "\x5678"); // ensure some Unicode characters and newlines are in the output
try
{
// Schedule a process to see what env vars it gets. Have it write out those variables
// to its output stream so we can read them.
Process p = CreateProcess(() =>
{
Console.Write(string.Join(ItemSeparator, Environment.GetEnvironmentVariables().Cast<DictionaryEntry>().Select(e => Convert.ToBase64String(Encoding.UTF8.GetBytes(e.Key + "=" + e.Value)))));
return RemoteExecutor.SuccessExitCode;
});
p.StartInfo.StandardOutputEncoding = Encoding.UTF8;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
string output = p.StandardOutput.ReadToEnd();
Assert.True(p.WaitForExit(WaitInMS));
// Parse the env vars from the child process
var actualEnv = new HashSet<string>(output.Split(new[] { ItemSeparator }, StringSplitOptions.None).Select(s => Encoding.UTF8.GetString(Convert.FromBase64String(s))));
// Validate against StartInfo.Environment.
var startInfoEnv = new HashSet<string>(p.StartInfo.Environment.Select(e => e.Key + "=" + e.Value));
Assert.True(startInfoEnv.SetEquals(actualEnv),
string.Format("Expected: {0}{1}Actual: {2}",
string.Join(", ", startInfoEnv.Except(actualEnv)),
Environment.NewLine,
string.Join(", ", actualEnv.Except(startInfoEnv))));
// Validate against current process. (Profilers / code coverage tools can add own environment variables
// but we start child process without them. Thus the set of variables from the child process could
// be a subset of variables from current process.)
var envEnv = new HashSet<string>(Environment.GetEnvironmentVariables().Cast<DictionaryEntry>().Select(e => e.Key + "=" + e.Value));
Assert.True(envEnv.IsSupersetOf(actualEnv),
string.Format("Expected: {0}{1}Actual: {2}",
string.Join(", ", envEnv.Except(actualEnv)),
Environment.NewLine,
string.Join(", ", actualEnv.Except(envEnv))));
}
finally
{
Environment.SetEnvironmentVariable(ExtraEnvVar, null);
}
}
[Fact]
public void TestUseShellExecuteProperty_SetAndGet()
{
ProcessStartInfo psi = new ProcessStartInfo();
Assert.False(psi.UseShellExecute);
psi.UseShellExecute = true;
Assert.True(psi.UseShellExecute);
psi.UseShellExecute = false;
Assert.False(psi.UseShellExecute);
}
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
public void TestUseShellExecuteProperty_Redirects_NotSupported(int std)
{
Process p = CreateProcessLong();
p.StartInfo.UseShellExecute = true;
switch (std)
{
case 0: p.StartInfo.RedirectStandardInput = true; break;
case 1: p.StartInfo.RedirectStandardOutput = true; break;
case 2: p.StartInfo.RedirectStandardError = true; break;
}
Assert.Throws<InvalidOperationException>(() => p.Start());
}
[Fact]
public void TestArgumentsProperty()
{
ProcessStartInfo psi = new ProcessStartInfo();
Assert.Equal(string.Empty, psi.Arguments);
psi = new ProcessStartInfo("filename", "-arg1 -arg2");
Assert.Equal("-arg1 -arg2", psi.Arguments);
psi.Arguments = "-arg3 -arg4";
Assert.Equal("-arg3 -arg4", psi.Arguments);
}
[Theory, InlineData(true), InlineData(false)]
public void TestCreateNoWindowProperty(bool value)
{
Process testProcess = CreateProcessLong();
try
{
testProcess.StartInfo.CreateNoWindow = value;
testProcess.Start();
Assert.Equal(value, testProcess.StartInfo.CreateNoWindow);
}
finally
{
testProcess.Kill();
Assert.True(testProcess.WaitForExit(WaitInMS));
}
}
[Fact]
public void TestWorkingDirectoryPropertyDefaultCase()
{
CreateDefaultProcess();
// check defaults
Assert.Equal(string.Empty, _process.StartInfo.WorkingDirectory);
}
[Fact]
public void TestWorkingDirectoryPropertyInChildProcess()
{
string workingDirectory = string.IsNullOrEmpty(Environment.SystemDirectory) ? TestDirectory : Environment.SystemDirectory ;
Assert.NotEqual(workingDirectory, Directory.GetCurrentDirectory());
var psi = new ProcessStartInfo { WorkingDirectory = workingDirectory };
RemoteExecutor.Invoke(wd =>
{
Assert.Equal(wd, Directory.GetCurrentDirectory());
return RemoteExecutor.SuccessExitCode;
}, workingDirectory, new RemoteInvokeOptions { StartInfo = psi }).Dispose();
}
[ActiveIssue("https://github.com/dotnet/corefx/issues/12696")]
[Fact, PlatformSpecific(TestPlatforms.Windows), OuterLoop] // Uses P/Invokes, Requires admin privileges
public void TestUserCredentialsPropertiesOnWindows()
{
string username = "test", password = "PassWord123!!";
try
{
Interop.NetUserAdd(username, password);
}
catch (Exception exc)
{
Console.Error.WriteLine("TestUserCredentialsPropertiesOnWindows: NetUserAdd failed: {0}", exc.Message);
return; // test is irrelevant if we can't add a user
}
bool hasStarted = false;
SafeProcessHandle handle = null;
Process p = null;
try
{
p = CreateProcessLong();
p.StartInfo.LoadUserProfile = true;
p.StartInfo.UserName = username;
p.StartInfo.PasswordInClearText = password;
hasStarted = p.Start();
if (Interop.OpenProcessToken(p.SafeHandle, 0x8u, out handle))
{
SecurityIdentifier sid;
if (Interop.ProcessTokenToSid(handle, out sid))
{
string actualUserName = sid.Translate(typeof(NTAccount)).ToString();
int indexOfDomain = actualUserName.IndexOf('\\');
if (indexOfDomain != -1)
actualUserName = actualUserName.Substring(indexOfDomain + 1);
bool isProfileLoaded = GetNamesOfUserProfiles().Any(profile => profile.Equals(username));
Assert.Equal(username, actualUserName);
Assert.True(isProfileLoaded);
}
}
}
finally
{
IEnumerable<uint> collection = new uint[] { 0 /* NERR_Success */, 2221 /* NERR_UserNotFound */ };
Assert.Contains<uint>(Interop.NetUserDel(null, username), collection);
if (handle != null)
handle.Dispose();
if (hasStarted)
{
p.Kill();
Assert.True(p.WaitForExit(WaitInMS));
}
}
}
private static List<string> GetNamesOfUserProfiles()
{
List<string> userNames = new List<string>();
string[] names = Registry.Users.GetSubKeyNames();
for (int i = 1; i < names.Length; i++)
{
try
{
SecurityIdentifier sid = new SecurityIdentifier(names[i]);
string userName = sid.Translate(typeof(NTAccount)).ToString();
int indexofDomain = userName.IndexOf('\\');
if (indexofDomain != -1)
{
userName = userName.Substring(indexofDomain + 1);
userNames.Add(userName);
}
}
catch (Exception) { }
}
return userNames;
}
[Fact]
public void TestEnvironmentVariables_Environment_DataRoundTrips()
{
ProcessStartInfo psi = new ProcessStartInfo();
// Creating a detached ProcessStartInfo will pre-populate the environment
// with current environmental variables.
psi.Environment.Clear();
psi.EnvironmentVariables.Add("NewKey", "NewValue");
psi.Environment.Add("NewKey2", "NewValue2");
Assert.Equal(psi.Environment["NewKey"], psi.EnvironmentVariables["NewKey"]);
Assert.Equal(psi.Environment["NewKey2"], psi.EnvironmentVariables["NewKey2"]);
Assert.Equal(2, psi.EnvironmentVariables.Count);
Assert.Equal(psi.Environment.Count, psi.EnvironmentVariables.Count);
AssertExtensions.Throws<ArgumentException>(null, () => psi.EnvironmentVariables.Add("NewKey2", "NewValue2"));
psi.EnvironmentVariables.Add("NewKey3", "NewValue3");
psi.Environment.Add("NewKey3", "NewValue3Overridden");
Assert.Equal("NewValue3Overridden", psi.Environment["NewKey3"]);
psi.EnvironmentVariables.Clear();
Assert.Equal(0, psi.Environment.Count);
psi.EnvironmentVariables.Add("NewKey", "NewValue");
psi.EnvironmentVariables.Add("NewKey2", "NewValue2");
// Environment and EnvironmentVariables should be equal, but have different enumeration types.
IEnumerable<KeyValuePair<string, string>> allEnvironment = psi.Environment.OrderBy(k => k.Key);
IEnumerable<DictionaryEntry> allDictionary = psi.EnvironmentVariables.Cast<DictionaryEntry>().OrderBy(k => k.Key);
Assert.Equal(allEnvironment.Select(k => new DictionaryEntry(k.Key, k.Value)), allDictionary);
psi.EnvironmentVariables.Add("NewKey3", "NewValue3");
KeyValuePair<string, string>[] kvpa = new KeyValuePair<string, string>[5];
psi.Environment.CopyTo(kvpa, 0);
KeyValuePair<string, string>[] kvpaOrdered = kvpa.OrderByDescending(k => k.Key).ToArray();
Assert.Equal("NewKey", kvpaOrdered[2].Key);
Assert.Equal("NewValue", kvpaOrdered[2].Value);
psi.EnvironmentVariables.Remove("NewKey3");
Assert.False(psi.Environment.Contains(new KeyValuePair<string, string>("NewKey3", "NewValue3")));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // Nano does not support these verbs
[PlatformSpecific(TestPlatforms.Windows)] // Test case is specific to Windows
public void Verbs_GetWithExeExtension_ReturnsExpected()
{
var psi = new ProcessStartInfo { FileName = $"{Process.GetCurrentProcess().ProcessName}.exe" };
Assert.Contains("open", psi.Verbs, StringComparer.OrdinalIgnoreCase);
Assert.Contains("runas", psi.Verbs, StringComparer.OrdinalIgnoreCase);
Assert.Contains("runasuser", psi.Verbs, StringComparer.OrdinalIgnoreCase);
Assert.DoesNotContain("printto", psi.Verbs, StringComparer.OrdinalIgnoreCase);
Assert.DoesNotContain("closed", psi.Verbs, StringComparer.OrdinalIgnoreCase);
}
[Theory]
[InlineData("")]
[InlineData("nofileextension")]
[PlatformSpecific(TestPlatforms.Windows)]
public void Verbs_GetWithNoExtension_ReturnsEmpty(string fileName)
{
var info = new ProcessStartInfo { FileName = fileName };
Assert.Empty(info.Verbs);
}
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void Verbs_GetWithNoRegisteredExtension_ReturnsEmpty()
{
var info = new ProcessStartInfo { FileName = "file.nosuchextension" };
Assert.Empty(info.Verbs);
}
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void Verbs_GetWithNoEmptyStringKey_ReturnsEmpty()
{
const string Extension = ".noemptykeyextension";
const string FileName = "file" + Extension;
using (TempRegistryKey tempKey = new TempRegistryKey(Registry.ClassesRoot, Extension))
{
if (tempKey.Key == null)
{
// Skip this test if the user doesn't have permission to
// modify the registry.
return;
}
var info = new ProcessStartInfo { FileName = FileName };
Assert.Empty(info.Verbs);
}
}
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void Verbs_GetWithEmptyStringValue_ReturnsEmpty()
{
const string Extension = ".emptystringextension";
const string FileName = "file" + Extension;
using (TempRegistryKey tempKey = new TempRegistryKey(Registry.ClassesRoot, Extension))
{
if (tempKey.Key == null)
{
// Skip this test if the user doesn't have permission to
// modify the registry.
return;
}
tempKey.Key.SetValue("", "");
var info = new ProcessStartInfo { FileName = FileName };
Assert.Empty(info.Verbs);
}
}
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void Verbs_GetWithNonStringValue_ReturnsEmpty()
{
const string Extension = ".nonstringextension";
const string FileName = "file" + Extension;
using (TempRegistryKey tempKey = new TempRegistryKey(Registry.ClassesRoot, Extension))
{
if (tempKey.Key == null)
{
// Skip this test if the user doesn't have permission to
// modify the registry.
return;
}
tempKey.Key.SetValue("", 123);
var info = new ProcessStartInfo { FileName = FileName };
Assert.Empty(info.Verbs);
}
}
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void Verbs_GetWithNoShellSubKey_ReturnsEmpty()
{
const string Extension = ".noshellsubkey";
const string FileName = "file" + Extension;
using (TempRegistryKey tempKey = new TempRegistryKey(Registry.ClassesRoot, Extension))
{
if (tempKey.Key == null)
{
// Skip this test if the user doesn't have permission to
// modify the registry.
return;
}
tempKey.Key.SetValue("", "nosuchshell");
var info = new ProcessStartInfo { FileName = FileName };
Assert.Empty(info.Verbs);
}
}
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void Verbs_GetWithSubkeys_ReturnsEmpty()
{
const string Extension = ".customregistryextension";
const string FileName = "file" + Extension;
const string SubKeyValue = "customregistryextensionshell";
using (TempRegistryKey extensionKey = new TempRegistryKey(Registry.ClassesRoot, Extension))
using (TempRegistryKey shellKey = new TempRegistryKey(Registry.ClassesRoot, SubKeyValue + "\\shell"))
{
if (extensionKey.Key == null)
{
// Skip this test if the user doesn't have permission to
// modify the registry.
return;
}
extensionKey.Key.SetValue("", SubKeyValue);
shellKey.Key.CreateSubKey("verb1");
shellKey.Key.CreateSubKey("NEW");
shellKey.Key.CreateSubKey("new");
shellKey.Key.CreateSubKey("verb2");
var info = new ProcessStartInfo { FileName = FileName };
Assert.Equal(new string[] { "verb1", "verb2" }, info.Verbs);
}
}
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void Verbs_GetUnix_ReturnsEmpty()
{
var info = new ProcessStartInfo();
Assert.Empty(info.Verbs);
}
[PlatformSpecific(TestPlatforms.AnyUnix)] // Test case is specific to Unix
[Fact]
public void TestEnvironmentVariablesPropertyUnix()
{
ProcessStartInfo psi = new ProcessStartInfo();
// Creating a detached ProcessStartInfo will pre-populate the environment
// with current environmental variables.
StringDictionary environmentVariables = psi.EnvironmentVariables;
Assert.NotEqual(0, environmentVariables.Count);
int CountItems = environmentVariables.Count;
environmentVariables.Add("NewKey", "NewValue");
environmentVariables.Add("NewKey2", "NewValue2");
Assert.Equal(CountItems + 2, environmentVariables.Count);
environmentVariables.Remove("NewKey");
Assert.Equal(CountItems + 1, environmentVariables.Count);
//Exception not thrown with invalid key
AssertExtensions.Throws<ArgumentException>(null, () => { environmentVariables.Add("NewKey2", "NewValue2"); });
Assert.False(environmentVariables.ContainsKey("NewKey"));
environmentVariables.Add("newkey2", "newvalue2");
Assert.True(environmentVariables.ContainsKey("newkey2"));
Assert.Equal("newvalue2", environmentVariables["newkey2"]);
Assert.Equal("NewValue2", environmentVariables["NewKey2"]);
environmentVariables.Clear();
Assert.Equal(0, environmentVariables.Count);
environmentVariables.Add("NewKey", "newvalue");
environmentVariables.Add("newkey2", "NewValue2");
Assert.False(environmentVariables.ContainsKey("newkey"));
Assert.False(environmentVariables.ContainsValue("NewValue"));
string result = null;
int index = 0;
foreach (string e1 in environmentVariables.Values)
{
index++;
result += e1;
}
Assert.Equal(2, index);
Assert.Equal("newvalueNewValue2", result);
result = null;
index = 0;
foreach (string e1 in environmentVariables.Keys)
{
index++;
result += e1;
}
Assert.Equal("NewKeynewkey2", result);
Assert.Equal(2, index);
result = null;
index = 0;
foreach (DictionaryEntry e1 in environmentVariables)
{
index++;
result += e1.Key;
}
Assert.Equal("NewKeynewkey2", result);
Assert.Equal(2, index);
//Key not found
Assert.Throws<KeyNotFoundException>(() =>
{
string stringout = environmentVariables["NewKey99"];
});
//Exception not thrown with invalid key
Assert.Throws<ArgumentNullException>(() =>
{
string stringout = environmentVariables[null];
});
//Exception not thrown with invalid key
Assert.Throws<ArgumentNullException>(() => environmentVariables.Add(null, "NewValue2"));
AssertExtensions.Throws<ArgumentException>(null, () => environmentVariables.Add("newkey2", "NewValue2"));
//Use DictionaryEntry Enumerator
var x = environmentVariables.GetEnumerator() as IEnumerator;
x.MoveNext();
var y1 = (DictionaryEntry)x.Current;
Assert.Equal("NewKey newvalue", y1.Key + " " + y1.Value);
x.MoveNext();
y1 = (DictionaryEntry)x.Current;
Assert.Equal("newkey2 NewValue2", y1.Key + " " + y1.Value);
environmentVariables.Add("newkey3", "newvalue3");
KeyValuePair<string, string>[] kvpa = new KeyValuePair<string, string>[10];
environmentVariables.CopyTo(kvpa, 0);
Assert.Equal("NewKey", kvpa[0].Key);
Assert.Equal("newkey3", kvpa[2].Key);
Assert.Equal("newvalue3", kvpa[2].Value);
string[] kvp = new string[10];
AssertExtensions.Throws<ArgumentException>(null, () => { environmentVariables.CopyTo(kvp, 6); });
environmentVariables.CopyTo(kvpa, 6);
Assert.Equal("NewKey", kvpa[6].Key);
Assert.Equal("newvalue", kvpa[6].Value);
Assert.Throws<ArgumentOutOfRangeException>(() => { environmentVariables.CopyTo(kvpa, -1); });
AssertExtensions.Throws<ArgumentException>(null, () => { environmentVariables.CopyTo(kvpa, 9); });
Assert.Throws<ArgumentNullException>(() =>
{
KeyValuePair<string, string>[] kvpanull = null;
environmentVariables.CopyTo(kvpanull, 0);
});
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("domain")]
[PlatformSpecific(TestPlatforms.Windows)]
public void Domain_SetWindows_GetReturnsExpected(string domain)
{
var info = new ProcessStartInfo { Domain = domain };
Assert.Equal(domain ?? string.Empty, info.Domain);
}
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)]
public void Domain_GetSetUnix_ThrowsPlatformNotSupportedException()
{
var info = new ProcessStartInfo();
Assert.Throws<PlatformNotSupportedException>(() => info.Domain);
Assert.Throws<PlatformNotSupportedException>(() => info.Domain = "domain");
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("filename")]
public void FileName_Set_GetReturnsExpected(string fileName)
{
var info = new ProcessStartInfo { FileName = fileName };
Assert.Equal(fileName ?? string.Empty, info.FileName);
}
[Theory]
[InlineData(true)]
[InlineData(false)]
[PlatformSpecific(TestPlatforms.Windows)]
public void LoadUserProfile_SetWindows_GetReturnsExpected(bool loadUserProfile)
{
var info = new ProcessStartInfo { LoadUserProfile = loadUserProfile };
Assert.Equal(loadUserProfile, info.LoadUserProfile);
}
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)]
public void LoadUserProfile_GetSetUnix_ThrowsPlatformNotSupportedException()
{
var info = new ProcessStartInfo();
Assert.Throws<PlatformNotSupportedException>(() => info.LoadUserProfile);
Assert.Throws<PlatformNotSupportedException>(() => info.LoadUserProfile = false);
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("passwordInClearText")]
[PlatformSpecific(TestPlatforms.Windows)]
public void PasswordInClearText_SetWindows_GetReturnsExpected(string passwordInClearText)
{
var info = new ProcessStartInfo { PasswordInClearText = passwordInClearText };
Assert.Equal(passwordInClearText, info.PasswordInClearText);
}
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)]
public void PasswordInClearText_GetSetUnix_ThrowsPlatformNotSupportedException()
{
var info = new ProcessStartInfo();
Assert.Throws<PlatformNotSupportedException>(() => info.PasswordInClearText);
Assert.Throws<PlatformNotSupportedException>(() => info.PasswordInClearText = "passwordInClearText");
}
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void Password_SetWindows_GetReturnsExpected()
{
using (SecureString password = new SecureString())
{
password.AppendChar('a');
var info = new ProcessStartInfo { Password = password };
Assert.Equal(password, info.Password);
}
}
[Fact]
[PlatformSpecific(TestPlatforms.AnyUnix)]
public void Password_GetSetUnix_ThrowsPlatformNotSupportedException()
{
var info = new ProcessStartInfo();
Assert.Throws<PlatformNotSupportedException>(() => info.Password);
Assert.Throws<PlatformNotSupportedException>(() => info.Password = new SecureString());
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("domain")]
public void UserName_Set_GetReturnsExpected(string userName)
{
var info = new ProcessStartInfo { UserName = userName };
Assert.Equal(userName ?? string.Empty, info.UserName);
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("verb")]
public void Verb_Set_GetReturnsExpected(string verb)
{
var info = new ProcessStartInfo { Verb = verb };
Assert.Equal(verb ?? string.Empty, info.Verb);
}
[Theory]
[InlineData(ProcessWindowStyle.Normal - 1)]
[InlineData(ProcessWindowStyle.Maximized + 1)]
public void WindowStyle_SetNoSuchWindowStyle_ThrowsInvalidEnumArgumentException(ProcessWindowStyle style)
{
var info = new ProcessStartInfo();
Assert.Throws<InvalidEnumArgumentException>(() => info.WindowStyle = style);
}
[Theory]
[InlineData(ProcessWindowStyle.Hidden)]
[InlineData(ProcessWindowStyle.Maximized)]
[InlineData(ProcessWindowStyle.Minimized)]
[InlineData(ProcessWindowStyle.Normal)]
public void WindowStyle_Set_GetReturnsExpected(ProcessWindowStyle style)
{
var info = new ProcessStartInfo { WindowStyle = style };
Assert.Equal(style, info.WindowStyle);
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("workingdirectory")]
public void WorkingDirectory_Set_GetReturnsExpected(string workingDirectory)
{
var info = new ProcessStartInfo { WorkingDirectory = workingDirectory };
Assert.Equal(workingDirectory ?? string.Empty, info.WorkingDirectory);
}
[Fact(Skip = "Manual test")]
[PlatformSpecific(TestPlatforms.Windows)]
public void StartInfo_WebPage()
{
ProcessStartInfo info = new ProcessStartInfo
{
UseShellExecute = true,
FileName = @"http://www.microsoft.com"
};
using (var p = Process.Start(info))
{
Assert.NotNull(p);
}
}
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // No Notepad on Nano
[MemberData(nameof(UseShellExecute))]
[OuterLoop("Launches notepad")]
[PlatformSpecific(TestPlatforms.Windows)]
public void StartInfo_NotepadWithContent(bool useShellExecute)
{
string tempFile = GetTestFilePath() + ".txt";
File.WriteAllText(tempFile, $"StartInfo_NotepadWithContent({useShellExecute})");
ProcessStartInfo info = new ProcessStartInfo
{
UseShellExecute = useShellExecute,
FileName = @"notepad.exe",
Arguments = tempFile,
WindowStyle = ProcessWindowStyle.Minimized
};
using (var process = Process.Start(info))
{
Assert.True(process != null, $"Could not start {info.FileName} {info.Arguments} UseShellExecute={info.UseShellExecute}");
try
{
process.WaitForInputIdle(); // Give the file a chance to load
Assert.Equal("notepad", process.ProcessName);
// On some Windows versions, the file extension is not included in the title
Assert.StartsWith(Path.GetFileNameWithoutExtension(tempFile), process.MainWindowTitle);
}
finally
{
process?.Kill();
}
}
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer), // Nano does not support UseShellExecute
nameof(PlatformDetection.IsNotWindows8x))] // https://github.com/dotnet/corefx/issues/20388
[OuterLoop("Launches notepad")]
[PlatformSpecific(TestPlatforms.Windows)]
public void StartInfo_TextFile_ShellExecute()
{
if (Thread.CurrentThread.CurrentCulture.ToString() != "en-US")
return; // [ActiveIssue(https://github.com/dotnet/corefx/issues/28953)]
string tempFile = GetTestFilePath() + ".txt";
File.WriteAllText(tempFile, $"StartInfo_TextFile_ShellExecute");
ProcessStartInfo info = new ProcessStartInfo
{
UseShellExecute = true,
FileName = tempFile,
WindowStyle = ProcessWindowStyle.Minimized
};
using (var process = Process.Start(info))
{
Assert.True(process != null, $"Could not start {info.FileName} UseShellExecute={info.UseShellExecute}\r\n{GetAssociationDetails()}");
try
{
process.WaitForInputIdle(); // Give the file a chance to load
Assert.Equal("notepad", process.ProcessName);
if (PlatformDetection.IsInAppContainer)
{
Assert.Throws<PlatformNotSupportedException>(() => process.MainWindowTitle);
}
else
{
// On some Windows versions, the file extension is not included in the title
Assert.StartsWith(Path.GetFileNameWithoutExtension(tempFile), process.MainWindowTitle);
}
}
finally
{
process?.Kill();
}
}
}
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
private static extern unsafe int AssocQueryStringW(
int flags,
int str,
string pszAssoc,
string pszExtra,
char* pszOut,
ref uint pcchOut);
private static unsafe string GetAssociationString(int flags, int str, string pszAssoc, string pszExtra)
{
uint count = 0;
int result = AssocQueryStringW(flags, str, pszAssoc, pszExtra, null, ref count);
if (result != 1)
return $"Didn't get expected HRESULT (1) when getting char count. HRESULT was 0x{result:x8}";
string value = new string((char)0, (int)count - 1);
fixed(char* s = value)
{
result = AssocQueryStringW(flags, str, pszAssoc, pszExtra, s, ref count);
}
if (result != 0)
return $"Didn't get expected HRESULT (0), when getting char count. HRESULT was 0x{result:x8}";
return value;
}
private static string GetAssociationDetails()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Association details for '.txt'");
sb.AppendLine("------------------------------");
string open = GetAssociationString(0, 1 /* ASSOCSTR_COMMAND */, ".txt", "open");
sb.AppendFormat("Open command: {0}", open);
sb.AppendLine();
string progId = GetAssociationString(0, 20 /* ASSOCSTR_PROGID */, ".txt", null);
sb.AppendFormat("ProgID: {0}", progId);
sb.AppendLine();
return sb.ToString();
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindowsNanoServer))]
public void ShellExecute_Nano_Fails_Start()
{
string tempFile = GetTestFilePath() + ".txt";
File.Create(tempFile).Dispose();
ProcessStartInfo info = new ProcessStartInfo
{
UseShellExecute = true,
FileName = tempFile
};
// Nano does not support either the STA apartment or ShellExecute.
// Since we try to start an STA thread for ShellExecute, we hit a ThreadStartException
// before we get to the PlatformNotSupportedException.
Assert.Throws<ThreadStartException>(() => Process.Start(info));
}
public static TheoryData<bool> UseShellExecute
{
get
{
TheoryData<bool> data = new TheoryData<bool> { false };
if ( !PlatformDetection.IsInAppContainer // https://github.com/dotnet/corefx/issues/20204
&& !PlatformDetection.IsWindowsNanoServer // By design
&& !PlatformDetection.IsWindowsIoTCore)
data.Add(true);
return data;
}
}
private const int ERROR_SUCCESS = 0x0;
private const int ERROR_FILE_NOT_FOUND = 0x2;
private const int ERROR_BAD_EXE_FORMAT = 0xC1;
[Theory]
[MemberData(nameof(UseShellExecute))]
[PlatformSpecific(TestPlatforms.Windows)]
public void StartInfo_BadVerb(bool useShellExecute)
{
ProcessStartInfo info = new ProcessStartInfo
{
UseShellExecute = useShellExecute,
FileName = @"foo.txt",
Verb = "Zlorp"
};
Assert.Equal(ERROR_FILE_NOT_FOUND, Assert.Throws<Win32Exception>(() => Process.Start(info)).NativeErrorCode);
}
[Theory]
[MemberData(nameof(UseShellExecute))]
[PlatformSpecific(TestPlatforms.Windows)]
public void StartInfo_BadExe(bool useShellExecute)
{
string tempFile = GetTestFilePath() + ".exe";
File.Create(tempFile).Dispose();
ProcessStartInfo info = new ProcessStartInfo
{
UseShellExecute = useShellExecute,
FileName = tempFile
};
int expected = ERROR_BAD_EXE_FORMAT;
// Windows Nano bug see #10290
if (PlatformDetection.IsWindowsNanoServer)
expected = ERROR_SUCCESS;
Assert.Equal(expected, Assert.Throws<Win32Exception>(() => Process.Start(info)).NativeErrorCode);
}
[Fact]
public void UnintializedArgumentList()
{
ProcessStartInfo psi = new ProcessStartInfo();
Assert.Equal(0, psi.ArgumentList.Count);
psi = new ProcessStartInfo("filename", "-arg1 -arg2");
Assert.Equal(0, psi.ArgumentList.Count);
}
[Fact]
public void InitializeWithArgumentList()
{
ProcessStartInfo psi = new ProcessStartInfo("filename");
psi.ArgumentList.Add("arg1");
psi.ArgumentList.Add("arg2");
Assert.Equal(2, psi.ArgumentList.Count);
Assert.Equal("arg1", psi.ArgumentList[0]);
Assert.Equal("arg2", psi.ArgumentList[1]);
}
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // No Notepad on Nano
[MemberData(nameof(UseShellExecute))]
[OuterLoop("Launches notepad")]
[PlatformSpecific(TestPlatforms.Windows)]
public void StartInfo_NotepadWithContent_withArgumentList(bool useShellExecute)
{
string tempFile = GetTestFilePath() + ".txt";
File.WriteAllText(tempFile, $"StartInfo_NotepadWithContent({useShellExecute})");
ProcessStartInfo info = new ProcessStartInfo
{
UseShellExecute = useShellExecute,
FileName = @"notepad.exe",
Arguments = null,
WindowStyle = ProcessWindowStyle.Minimized
};
info.ArgumentList.Add(tempFile);
using (var process = Process.Start(info))
{
Assert.True(process != null, $"Could not start {info.FileName} {info.Arguments} UseShellExecute={info.UseShellExecute}");
try
{
process.WaitForInputIdle(); // Give the file a chance to load
Assert.Equal("notepad", process.ProcessName);
// On some Windows versions, the file extension is not included in the title
Assert.StartsWith(Path.GetFileNameWithoutExtension(tempFile), process.MainWindowTitle);
}
finally
{
process?.Kill();
}
}
}
}
}
| 39.746193 | 208 | 0.576905 |
[
"MIT"
] |
AzureMentor/runtime
|
src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs
| 46,980 |
C#
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Threading;
using NuGet.Commands;
using NuGet.Common;
using NuGet.Configuration;
using NuGet.Frameworks;
using NuGet.PackageManagement;
using NuGet.PackageManagement.Telemetry;
using NuGet.PackageManagement.Utility;
using NuGet.PackageManagement.VisualStudio;
using NuGet.Packaging.Signing;
using NuGet.ProjectManagement;
using NuGet.ProjectManagement.Projects;
using NuGet.ProjectModel;
using NuGet.Protocol.Core.Types;
using NuGet.Shared;
using NuGet.VisualStudio;
using NuGet.VisualStudio.Telemetry;
using Task = System.Threading.Tasks.Task;
namespace NuGet.SolutionRestoreManager
{
/// <summary>
/// Implementation of solution restore operation as executed by the <see cref="SolutionRestoreWorker"/>.
/// Designed to be called only once during its lifetime.
/// </summary>
[Export(typeof(ISolutionRestoreJob))]
[PartCreationPolicy(CreationPolicy.NonShared)]
internal sealed class SolutionRestoreJob : ISolutionRestoreJob
{
private readonly IAsyncServiceProvider _asyncServiceProvider;
private readonly IPackageRestoreManager _packageRestoreManager;
private readonly IVsSolutionManager _solutionManager;
private readonly ISourceRepositoryProvider _sourceRepositoryProvider;
private readonly ISettings _settings;
private readonly IRestoreEventsPublisher _restoreEventsPublisher;
private readonly ISolutionRestoreChecker _solutionUpToDateChecker;
private RestoreOperationLogger _logger;
private INuGetProjectContext _nuGetProjectContext;
private PackageRestoreConsent _packageRestoreConsent;
private NuGetOperationStatus _status;
private int _packageCount;
private int _noOpProjectsCount;
private int _upToDateProjectCount;
private bool _isSolutionLoadRestore;
// relevant to packages.config restore only
private int _missingPackagesCount;
private int _currentCount;
/// <summary>
/// Restore end status. For testing purposes
/// </summary>
internal NuGetOperationStatus Status => _status;
[ImportingConstructor]
public SolutionRestoreJob(
IPackageRestoreManager packageRestoreManager,
IVsSolutionManager solutionManager,
ISourceRepositoryProvider sourceRepositoryProvider,
IRestoreEventsPublisher restoreEventsPublisher,
ISettings settings,
ISolutionRestoreChecker solutionRestoreChecker)
: this(AsyncServiceProvider.GlobalProvider,
packageRestoreManager,
solutionManager,
sourceRepositoryProvider,
restoreEventsPublisher,
settings,
solutionRestoreChecker
)
{ }
public SolutionRestoreJob(
IAsyncServiceProvider asyncServiceProvider,
IPackageRestoreManager packageRestoreManager,
IVsSolutionManager solutionManager,
ISourceRepositoryProvider sourceRepositoryProvider,
IRestoreEventsPublisher restoreEventsPublisher,
ISettings settings,
ISolutionRestoreChecker solutionRestoreChecker)
{
Assumes.Present(asyncServiceProvider);
Assumes.Present(packageRestoreManager);
Assumes.Present(solutionManager);
Assumes.Present(sourceRepositoryProvider);
Assumes.Present(restoreEventsPublisher);
Assumes.Present(settings);
Assumes.Present(solutionRestoreChecker);
_asyncServiceProvider = asyncServiceProvider;
_packageRestoreManager = packageRestoreManager;
_solutionManager = solutionManager;
_sourceRepositoryProvider = sourceRepositoryProvider;
_restoreEventsPublisher = restoreEventsPublisher;
_settings = settings;
_packageRestoreConsent = new PackageRestoreConsent(_settings);
_solutionUpToDateChecker = solutionRestoreChecker;
}
/// <summary>
/// Restore job entry point. Not re-entrant.
/// </summary>
public async Task<bool> ExecuteAsync(
SolutionRestoreRequest request,
SolutionRestoreJobContext jobContext,
RestoreOperationLogger logger,
bool isSolutionLoadRestore,
CancellationToken token)
{
if (request == null)
{
throw new ArgumentNullException(nameof(request));
}
if (jobContext == null)
{
throw new ArgumentNullException(nameof(jobContext));
}
if (logger == null)
{
throw new ArgumentNullException(nameof(logger));
}
_logger = logger;
// update instance attributes with the shared context values
_nuGetProjectContext = jobContext.NuGetProjectContext;
_nuGetProjectContext.OperationId = request.OperationId;
_isSolutionLoadRestore = isSolutionLoadRestore;
try
{
await RestoreAsync(request.ForceRestore, request.RestoreSource, token);
}
catch (OperationCanceledException)
{
}
catch (Exception e)
{
// Log the exception to the console and activity log
await _logger.LogExceptionAsync(e);
}
return _status == NuGetOperationStatus.NoOp || _status == NuGetOperationStatus.Succeeded;
}
private async Task RestoreAsync(bool forceRestore, RestoreOperationSource restoreSource, CancellationToken token)
{
var startTime = DateTimeOffset.Now;
_status = NuGetOperationStatus.NoOp;
// start timer for telemetry event
var stopWatch = Stopwatch.StartNew();
var intervalTracker = new IntervalTracker(RestoreTelemetryEvent.RestoreActionEventName);
var projects = Enumerable.Empty<NuGetProject>();
_packageRestoreManager.PackageRestoredEvent += PackageRestoreManager_PackageRestored;
_packageRestoreManager.PackageRestoreFailedEvent += PackageRestoreManager_PackageRestoreFailedEvent;
var sources = _sourceRepositoryProvider.GetRepositories();
using (var packageSourceTelemetry = new PackageSourceTelemetry(sources, _nuGetProjectContext.OperationId, PackageSourceTelemetry.TelemetryAction.Restore))
{
try
{
token.ThrowIfCancellationRequested();
string solutionDirectory;
bool isSolutionAvailable;
using (intervalTracker.Start(RestoreTelemetryEvent.RestoreOperationChecks))
{
solutionDirectory = _solutionManager.SolutionDirectory;
isSolutionAvailable = await _solutionManager.IsSolutionAvailableAsync();
// Get the projects from the SolutionManager
// Note that projects that are not supported by NuGet, will not show up in this list
projects = (await _solutionManager.GetNuGetProjectsAsync()).ToList();
if (projects.Any() && solutionDirectory == null)
{
_status = NuGetOperationStatus.Failed;
await _logger.ShowErrorAsync(Resources.SolutionIsNotSaved);
await _logger.WriteLineAsync(VerbosityLevel.Minimal, Resources.SolutionIsNotSaved);
return;
}
}
using (intervalTracker.Start(RestoreTelemetryEvent.PackagesConfigRestore))
{
// Check if there are any projects that are not INuGetIntegratedProject, that is,
// projects with packages.config. OR
// any of the deferred project is type of packages.config, If so, perform package restore on them
if (projects.Any(project => !(project is INuGetIntegratedProject)))
{
await RestorePackagesOrCheckForMissingPackagesAsync(
projects,
solutionDirectory,
isSolutionAvailable,
restoreSource,
token);
}
}
var dependencyGraphProjects = projects
.OfType<IDependencyGraphProject>()
.ToList();
await RestorePackageSpecProjectsAsync(
dependencyGraphProjects,
forceRestore,
isSolutionAvailable,
restoreSource,
intervalTracker,
token);
// TODO: To limit risk, we only publish the event when there is a cross-platform PackageReference
// project in the solution. Extending this behavior to all solutions is tracked here:
// NuGet/Home#4478
if (projects.OfType<CpsPackageReferenceProject>().Any())
{
_restoreEventsPublisher.OnSolutionRestoreCompleted(
new SolutionRestoredEventArgs(_status, solutionDirectory));
}
}
catch (OperationCanceledException)
{
_status = NuGetOperationStatus.Cancelled;
throw;
}
catch
{
_status = NuGetOperationStatus.Failed;
throw;
}
finally
{
_packageRestoreManager.PackageRestoredEvent -= PackageRestoreManager_PackageRestored;
_packageRestoreManager.PackageRestoreFailedEvent -= PackageRestoreManager_PackageRestoreFailedEvent;
await packageSourceTelemetry.SendTelemetryAsync();
stopWatch.Stop();
var duration = stopWatch.Elapsed;
// Do not log any restore message if user disabled restore.
if (_packageRestoreConsent.IsGranted)
{
await _logger.WriteSummaryAsync(_status, duration);
}
else
{
_logger.LogDebug(Resources.PackageRefNotRestoredBecauseOfNoConsent);
}
var protocolDiagnosticsTotals = packageSourceTelemetry.GetTotals();
// Emit telemetry event for restore operation
EmitRestoreTelemetryEvent(
projects,
forceRestore,
restoreSource,
startTime,
duration.TotalSeconds,
protocolDiagnosticsTotals,
intervalTracker);
}
}
}
private void EmitRestoreTelemetryEvent(IEnumerable<NuGetProject> projects,
bool forceRestore,
RestoreOperationSource source,
DateTimeOffset startTime,
double duration,
PackageSourceTelemetry.Totals protocolDiagnosticTotals,
IntervalTracker intervalTimingTracker)
{
var sortedProjects = projects.OrderBy(
project => project.GetMetadata<string>(NuGetProjectMetadataKeys.UniqueName));
var projectIds = sortedProjects.Select(
project => project.GetMetadata<string>(NuGetProjectMetadataKeys.ProjectId)).ToArray();
var projectDictionary = sortedProjects
.GroupBy(x => x.ProjectStyle)
.ToDictionary(x => x.Key, y => y.Count());
var restoreTelemetryEvent = new RestoreTelemetryEvent(
_nuGetProjectContext.OperationId.ToString(),
projectIds,
forceRestore,
source,
startTime,
_status,
packageCount: _packageCount,
noOpProjectsCount: _noOpProjectsCount,
upToDateProjectsCount: _upToDateProjectCount,
unknownProjectsCount: projectDictionary.GetValueOrDefault(ProjectStyle.Unknown, 0), // appears in DependencyGraphRestoreUtility
projectJsonProjectsCount: projectDictionary.GetValueOrDefault(ProjectStyle.ProjectJson, 0),
packageReferenceProjectsCount: projectDictionary.GetValueOrDefault(ProjectStyle.PackageReference, 0),
legacyPackageReferenceProjectsCount: sortedProjects.Where(x => x.ProjectStyle == ProjectStyle.PackageReference && x is LegacyPackageReferenceProject).Count(),
cpsPackageReferenceProjectsCount: sortedProjects.Where(x => x.ProjectStyle == ProjectStyle.PackageReference && x is CpsPackageReferenceProject).Count(),
dotnetCliToolProjectsCount: projectDictionary.GetValueOrDefault(ProjectStyle.DotnetCliTool, 0), // appears in DependencyGraphRestoreUtility
packagesConfigProjectsCount: projectDictionary.GetValueOrDefault(ProjectStyle.PackagesConfig, 0),
DateTimeOffset.Now,
duration,
isSolutionLoadRestore: _isSolutionLoadRestore,
intervalTimingTracker);
TelemetryActivity.EmitTelemetryEvent(restoreTelemetryEvent);
var sources = _sourceRepositoryProvider.PackageSourceProvider.LoadPackageSources().ToList();
var sourceEvent = SourceTelemetry.GetRestoreSourceSummaryEvent(_nuGetProjectContext.OperationId, sources, protocolDiagnosticTotals);
TelemetryActivity.EmitTelemetryEvent(sourceEvent);
}
private async Task RestorePackageSpecProjectsAsync(
List<IDependencyGraphProject> projects,
bool forceRestore,
bool isSolutionAvailable,
RestoreOperationSource restoreSource,
IntervalTracker intervalTracker,
CancellationToken token)
{
// Only continue if there are some build integrated type projects.
if (!(projects.Any(project => project is BuildIntegratedNuGetProject)))
{
return;
}
if (_packageRestoreConsent.IsGranted)
{
if (!isSolutionAvailable)
{
var globalPackagesFolder = SettingsUtility.GetGlobalPackagesFolder(_settings);
if (!Path.IsPathRooted(globalPackagesFolder))
{
var message = string.Format(
CultureInfo.CurrentCulture,
Resources.RelativeGlobalPackagesFolder,
globalPackagesFolder);
await _logger.WriteLineAsync(VerbosityLevel.Quiet, message);
// Cannot restore packages since globalPackagesFolder is a relative path
// and the solution is not available
return;
}
}
DependencyGraphCacheContext cacheContext;
DependencyGraphSpec originalDgSpec;
DependencyGraphSpec dgSpec;
IReadOnlyList<IAssetsLogMessage> additionalMessages;
using (intervalTracker.Start(RestoreTelemetryEvent.SolutionDependencyGraphSpecCreation))
{
// Cache p2ps discovered from DTE
cacheContext = new DependencyGraphCacheContext(_logger, _settings);
var pathContext = NuGetPathContext.Create(_settings);
// Get full dg spec
(originalDgSpec, additionalMessages) = await DependencyGraphRestoreUtility.GetSolutionRestoreSpecAndAdditionalMessages(_solutionManager, cacheContext);
}
using (intervalTracker.Start(RestoreTelemetryEvent.SolutionUpToDateCheck))
{
// Run solution based up to date check.
var projectsNeedingRestore = _solutionUpToDateChecker.PerformUpToDateCheck(originalDgSpec, _logger).AsList();
var specialReferencesCount = originalDgSpec.Projects
.Where(x => x.RestoreMetadata.ProjectStyle != ProjectStyle.PackageReference && x.RestoreMetadata.ProjectStyle != ProjectStyle.PackagesConfig && x.RestoreMetadata.ProjectStyle != ProjectStyle.ProjectJson)
.Count();
dgSpec = originalDgSpec;
// Only use the optimization results if the restore is not `force`.
// Still run the optimization check anyways to prep the cache.
if (!forceRestore)
{
// Update the dg spec.
dgSpec = originalDgSpec.WithoutRestores();
foreach (var uniqueProjectId in projectsNeedingRestore)
{
dgSpec.AddRestore(uniqueProjectId); // Fill DGSpec copy only with restore-needed projects
}
// Calculate the number of up to date projects
_upToDateProjectCount = originalDgSpec.Restore.Count - specialReferencesCount - projectsNeedingRestore.Count;
_noOpProjectsCount = _upToDateProjectCount;
}
}
using (intervalTracker.Start(RestoreTelemetryEvent.PackageReferenceRestoreDuration))
{
// Avoid restoring if all the projects are up to date, or the solution does not have build integrated projects.
if (DependencyGraphRestoreUtility.IsRestoreRequired(dgSpec))
{
// NOTE: During restore for build integrated projects,
// We might show the dialog even if there are no packages to restore
// When both currentStep and totalSteps are 0, we get a marquee on the dialog
await _logger.RunWithProgressAsync(
async (l, _, t) =>
{
// Display the restore opt out message if it has not been shown yet
await l.WriteHeaderAsync();
var sources = _sourceRepositoryProvider
.GetRepositories()
.ToList();
var providerCache = new RestoreCommandProvidersCache();
Action<SourceCacheContext> cacheModifier = (cache) => { };
var isRestoreOriginalAction = true;
var isRestoreSucceeded = true;
IReadOnlyList<RestoreSummary> restoreSummaries = null;
try
{
restoreSummaries = await DependencyGraphRestoreUtility.RestoreAsync(
_solutionManager,
dgSpec,
cacheContext,
providerCache,
cacheModifier,
sources,
_nuGetProjectContext.OperationId,
forceRestore,
isRestoreOriginalAction,
additionalMessages,
l,
t);
_packageCount += restoreSummaries.Select(summary => summary.InstallCount).Sum();
isRestoreSucceeded = restoreSummaries.All(summary => summary.Success == true);
_noOpProjectsCount += restoreSummaries.Where(summary => summary.NoOpRestore == true).Count();
_solutionUpToDateChecker.SaveRestoreStatus(restoreSummaries);
}
catch
{
isRestoreSucceeded = false;
throw;
}
finally
{
if (isRestoreSucceeded)
{
if (_noOpProjectsCount < restoreSummaries.Count)
{
_status = NuGetOperationStatus.Succeeded;
}
else
{
_status = NuGetOperationStatus.NoOp;
}
}
else
{
_status = NuGetOperationStatus.Failed;
}
}
},
token);
}
}
}
else if (restoreSource == RestoreOperationSource.Explicit)
{
await _logger.ShowErrorAsync(Resources.PackageRefNotRestoredBecauseOfNoConsent);
}
}
// This event could be raised from multiple threads. Only perform thread-safe operations
private void PackageRestoreManager_PackageRestored(
object sender,
PackageRestoredEventArgs args)
{
if (_status != NuGetOperationStatus.Cancelled && args.Restored)
{
var packageIdentity = args.Package;
Interlocked.Increment(ref _currentCount);
NuGetUIThreadHelper.JoinableTaskFactory.Run(async () =>
{
// capture current progress from the current execution context
var progress = RestoreOperationProgressUI.Current;
await progress?.ReportProgressAsync(
string.Format(
CultureInfo.CurrentCulture,
Resources.RestoredPackage,
packageIdentity),
(uint)_currentCount,
(uint)_missingPackagesCount);
});
}
}
private void PackageRestoreManager_PackageRestoreFailedEvent(
object sender,
PackageRestoreFailedEventArgs args)
{
if (_status == NuGetOperationStatus.Cancelled)
{
// If an operation is canceled, a single message gets shown in the summary
// that package restore has been canceled
// Do not report it as separate errors
return;
}
if (args.Exception is SignatureException ex)
{
_status = NuGetOperationStatus.Failed;
if (!string.IsNullOrEmpty(ex.Message))
{
_logger.Log(ex.AsLogMessage());
}
if (ex.Results != null)
{
ex.Results.SelectMany(p => p.Issues).ToList().ForEach(p => _logger.Log(p));
}
return;
}
if (args.ProjectNames.Any())
{
_status = NuGetOperationStatus.Failed;
NuGetUIThreadHelper.JoinableTaskFactory.Run(async () =>
{
foreach (var projectName in args.ProjectNames)
{
var exceptionMessage =
_logger.OutputVerbosity >= (int)VerbosityLevel.Detailed
? args.Exception.ToString()
: args.Exception.Message;
var message = string.Format(
CultureInfo.CurrentCulture,
Resources.PackageRestoreFailedForProject,
projectName,
exceptionMessage);
await _logger.WriteLineAsync(VerbosityLevel.Quiet, message);
await _logger.ShowErrorAsync(message);
await _logger.WriteLineAsync(VerbosityLevel.Normal, Resources.PackageRestoreFinishedForProject, projectName);
}
});
}
}
private async Task RestorePackagesOrCheckForMissingPackagesAsync(
IEnumerable<NuGetProject> allProjects,
string solutionDirectory,
bool isSolutionAvailable,
RestoreOperationSource restoreSource,
CancellationToken token)
{
if (string.IsNullOrEmpty(solutionDirectory))
{
// If the solution is closed, SolutionDirectory will be unavailable. Just return. Do nothing
return;
}
var packages = (await _packageRestoreManager.GetPackagesInSolutionAsync(
solutionDirectory, token)).ToList();
if (_packageRestoreConsent.IsGranted)
{
_currentCount = 0;
if (packages.Count == 0)
{
if (!isSolutionAvailable
&& await CheckPackagesConfigAsync())
{
await _logger.ShowErrorAsync(Resources.SolutionIsNotSaved);
await _logger.WriteLineAsync(VerbosityLevel.Quiet, Resources.SolutionIsNotSaved);
}
// Restore is not applicable, since, there is no project with installed packages
return;
}
_packageCount += packages.Count;
var missingPackagesList = packages.Where(p => p.IsMissing).ToList();
_missingPackagesCount = missingPackagesList.Count;
if (_missingPackagesCount > 0)
{
// Only show the wait dialog, when there are some packages to restore
await _logger.RunWithProgressAsync(
async (l, _, t) =>
{
// Display the restore opt out message if it has not been shown yet
await l.WriteHeaderAsync();
await RestoreMissingPackagesInSolutionAsync(solutionDirectory, packages, l, t);
},
token);
// Mark that work is being done during this restore
if (_status == NuGetOperationStatus.NoOp) // if there's any error, _status != NoOp
{
_status = NuGetOperationStatus.Succeeded;
}
}
ValidatePackagesConfigLockFiles(allProjects, token);
}
else if (restoreSource == RestoreOperationSource.Explicit)
{
// When the user consent is not granted, missing packages may not be restored.
// So, we just check for them, and report them as warning(s) on the error list window
await _logger.RunWithProgressAsync(
(_, __, ___) => CheckForMissingPackagesAsync(packages),
token);
}
await _packageRestoreManager.RaisePackagesMissingEventForSolutionAsync(
solutionDirectory,
token);
}
private void ValidatePackagesConfigLockFiles(IEnumerable<NuGetProject> allProjects, CancellationToken token)
{
var pcProjects = allProjects.Where(p => p.ProjectStyle == ProjectModel.ProjectStyle.PackagesConfig);
foreach (MSBuildNuGetProject project in pcProjects)
{
string projectFile = project.MSBuildProjectPath;
string pcFile = project.PackagesConfigNuGetProject.FullPath;
var projectName = (string)project.GetMetadataOrNull("Name");
var lockFileName = (string)project.GetMetadataOrNull("NuGetLockFilePath");
var restorePackagesWithLockFile = (string)project.GetMetadataOrNull("RestorePackagesWithLockFile");
var projectTfm = (NuGetFramework)project.GetMetadataOrNull("TargetFramework");
bool restoreLockedMode = MSBuildStringUtility.GetBooleanOrNull((string)project.GetMetadataOrNull("LockedMode")) ?? false;
IReadOnlyList<IRestoreLogMessage> validationLogs = PackagesConfigLockFileUtility.ValidatePackagesConfigLockFiles(
projectFile,
pcFile,
projectName,
lockFileName,
restorePackagesWithLockFile,
projectTfm,
project.FolderNuGetProject.Root,
restoreLockedMode,
token);
if (validationLogs != null)
{
foreach (var logItem in validationLogs)
{
_logger.Log(logItem);
}
}
}
}
/// <summary>
/// Checks if there are missing packages that should be restored. If so, a warning will
/// be added to the error list.
/// </summary>
private async Task CheckForMissingPackagesAsync(IEnumerable<PackageRestoreData> installedPackages)
{
var missingPackages = installedPackages.Where(p => p.IsMissing);
if (missingPackages.Any())
{
var errorText = string.Format(
CultureInfo.CurrentCulture,
Resources.PackageNotRestoredBecauseOfNoConsent,
string.Join(", ", missingPackages.Select(p => p.PackageReference.PackageIdentity.ToString())));
await _logger.ShowErrorAsync(errorText);
}
}
private async Task RestoreMissingPackagesInSolutionAsync(
string solutionDirectory,
IEnumerable<PackageRestoreData> packages,
ILogger logger,
CancellationToken token)
{
await TaskScheduler.Default;
using (var cacheContext = new SourceCacheContext())
{
var downloadContext = new PackageDownloadContext(cacheContext)
{
ParentId = _nuGetProjectContext.OperationId,
ClientPolicyContext = ClientPolicyContext.GetClientPolicy(_settings, logger)
};
await _packageRestoreManager.RestoreMissingPackagesAsync(
solutionDirectory,
packages,
_nuGetProjectContext,
downloadContext,
logger,
token);
}
}
private async Task<bool> CheckPackagesConfigAsync()
{
return await NuGetUIThreadHelper.JoinableTaskFactory.RunAsync(async () =>
{
await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
var dte = await _asyncServiceProvider.GetDTEAsync();
var projects = dte.Solution.Projects;
var succeeded = false;
foreach (var p in projects.OfType<EnvDTE.Project>())
{
var pi = new ProjectInfo(await p.GetFullPathAsync(), p.Name);
if (pi.CheckPackagesConfig())
{
succeeded = true;
break;
}
}
return succeeded;
});
}
private class ProjectInfo
{
public string ProjectPath { get; }
public string ProjectName { get; }
public ProjectInfo(string projectPath, string projectName)
{
ProjectPath = projectPath;
ProjectName = projectName;
}
public bool CheckPackagesConfig()
{
if (ProjectPath == null)
{
return false;
}
else
{
return File.Exists(Path.Combine(ProjectPath, "packages.config"))
|| File.Exists(Path.Combine(ProjectPath, $"packages.{ProjectName}.config"));
}
}
}
}
}
| 44.180285 | 227 | 0.547368 |
[
"Apache-2.0"
] |
Zastai/NuGet.Client
|
src/NuGet.Clients/NuGet.SolutionRestoreManager/SolutionRestoreJob.cs
| 34,063 |
C#
|
using System;
public class DisplayItemData
{
public int index;
public int key;
public long value;
public bool isEnd;
}
| 9.769231 | 28 | 0.732283 |
[
"MIT"
] |
corefan/tianqi_src
|
src/DisplayItemData.cs
| 127 |
C#
|
using Content.Client.Chat;
using Content.Client.Interfaces;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
namespace Content.Client.UserInterface
{
internal sealed class LobbyGui : Control
{
public Label ServerName { get; }
public Label StartTime { get; }
public Button ReadyButton { get; }
public Button ObserveButton { get; }
public Button LeaveButton { get; }
public ChatBox Chat { get; }
public ItemList OnlinePlayerItemList { get; }
public ServerInfo ServerInfo { get; }
public LobbyCharacterPreviewPanel CharacterPreview { get; }
public LobbyGui(IEntityManager entityManager,
IResourceCache resourceCache,
IClientPreferencesManager preferencesManager)
{
var margin = new MarginContainer
{
MarginBottomOverride = 20,
MarginLeftOverride = 20,
MarginRightOverride = 20,
MarginTopOverride = 20,
};
AddChild(margin);
var panelTex = resourceCache.GetTexture("/Nano/button.svg.96dpi.png");
var back = new StyleBoxTexture
{
Texture = panelTex,
Modulate = new Color(37, 37, 42),
};
back.SetPatchMargin(StyleBox.Margin.All, 10);
var panel = new PanelContainer
{
PanelOverride = back
};
margin.AddChild(panel);
var vBox = new VBoxContainer {SeparationOverride = 0};
margin.AddChild(vBox);
var topHBox = new HBoxContainer
{
CustomMinimumSize = (0, 40),
Children =
{
new MarginContainer
{
MarginLeftOverride = 8,
Children =
{
new Label
{
Text = Loc.GetString("Lobby"),
StyleClasses = {StyleNano.StyleClassLabelHeadingBigger},
/*MarginBottom = 40,
MarginLeft = 8,*/
VAlign = Label.VAlignMode.Center
}
}
},
(ServerName = new Label
{
StyleClasses = {StyleNano.StyleClassLabelHeadingBigger},
/*MarginBottom = 40,
GrowHorizontal = GrowDirection.Both,*/
VAlign = Label.VAlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter
}),
(LeaveButton = new Button
{
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
Text = Loc.GetString("Leave"),
StyleClasses = {StyleNano.StyleClassButtonBig},
//GrowHorizontal = GrowDirection.Begin
})
}
};
vBox.AddChild(topHBox);
vBox.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = StyleNano.NanoGold,
ContentMarginTopOverride = 2
},
});
var hBox = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SeparationOverride = 0
};
vBox.AddChild(hBox);
CharacterPreview = new LobbyCharacterPreviewPanel(
entityManager,
preferencesManager)
{
SizeFlagsHorizontal = SizeFlags.None
};
hBox.AddChild(new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SeparationOverride = 0,
Children =
{
CharacterPreview,
new StripeBack
{
Children =
{
new MarginContainer
{
MarginRightOverride = 3,
MarginLeftOverride = 3,
MarginTopOverride = 3,
MarginBottomOverride = 3,
Children =
{
new HBoxContainer
{
SeparationOverride = 6,
Children =
{
(ObserveButton = new Button
{
Text = Loc.GetString("Observe"),
StyleClasses = {StyleNano.StyleClassButtonBig}
}),
(StartTime = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Align = Label.AlignMode.Right,
FontColorOverride = Color.DarkGray,
StyleClasses = {StyleNano.StyleClassLabelBig}
}),
(ReadyButton = new Button
{
ToggleMode = true,
Text = Loc.GetString("Ready Up"),
StyleClasses = {StyleNano.StyleClassButtonBig}
}),
}
}
}
}
}
},
new MarginContainer
{
MarginRightOverride = 3,
MarginLeftOverride = 3,
MarginTopOverride = 3,
MarginBottomOverride = 3,
SizeFlagsVertical = SizeFlags.FillExpand,
Children =
{
(Chat = new ChatBox
{
Input = {PlaceHolder = Loc.GetString("Say something!")}
})
}
},
}
});
hBox.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat {BackgroundColor = StyleNano.NanoGold}, CustomMinimumSize = (2, 0)
});
{
hBox.AddChild(new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new NanoHeading
{
Text = Loc.GetString("Online Players"),
},
new MarginContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
MarginRightOverride = 3,
MarginLeftOverride = 3,
MarginTopOverride = 3,
MarginBottomOverride = 3,
Children =
{
(OnlinePlayerItemList = new ItemList())
}
},
new NanoHeading
{
Text = Loc.GetString("Server Info"),
},
new MarginContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
MarginRightOverride = 3,
MarginLeftOverride = 3,
MarginTopOverride = 3,
MarginBottomOverride = 2,
Children =
{
(ServerInfo = new ServerInfo())
}
},
}
});
}
}
}
}
| 38.48954 | 115 | 0.380585 |
[
"MIT"
] |
ComicIronic/space-station-14
|
Content.Client/UserInterface/LobbyGui.cs
| 9,199 |
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("NPython")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NPython")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("77f64bee-718d-4786-ad31-2dfb80c763c4")]
// 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.486486 | 84 | 0.743331 |
[
"MIT"
] |
omershelef/NPython
|
NPython/Properties/AssemblyInfo.cs
| 1,390 |
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 My.Demo.Client
{
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Net.Http;
using Newtonsoft.Json;
using Fonlow.Net.Http;
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AddAttributesToFindingsResponse
{
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItems FailedItems { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AddAttributesToFindingsRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Arn[] FindingArns { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Attribute[] Attributes { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class CreateAssessmentTargetResponse
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTargetArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class CreateAssessmentTargetRequest
{
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string AssessmentTargetName { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceGroupArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class CreateAssessmentTemplateResponse
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTemplateArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class CreateAssessmentTemplateRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTargetArn { get; set; }
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string AssessmentTemplateName { get; set; }
/// <summary>
/// Minimum: 180
/// Maximum: 86400
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(180, 86400)]
public int DurationInSeconds { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Arn[] RulesPackageArns { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Attribute[] UserAttributesForFindings { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class CreateExclusionsPreviewResponse
{
/// <summary>
/// Pattern: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public string PreviewToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class CreateExclusionsPreviewRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTemplateArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class CreateResourceGroupResponse
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceGroupArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class CreateResourceGroupRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public ResourceGroupTag[] ResourceGroupTags { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DeleteAssessmentRunRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentRunArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DeleteAssessmentTargetRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTargetArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DeleteAssessmentTemplateRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTemplateArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeAssessmentRunsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public AssessmentRun[] AssessmentRuns { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItems FailedItems { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeAssessmentRunsRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Arn[] AssessmentRunArns { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeAssessmentTargetsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public AssessmentTarget[] AssessmentTargets { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItems FailedItems { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeAssessmentTargetsRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Arn[] AssessmentTargetArns { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeAssessmentTemplatesResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public AssessmentTemplate[] AssessmentTemplates { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItems FailedItems { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeAssessmentTemplatesRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Arn[] AssessmentTemplateArns { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeCrossAccountAccessRoleResponse
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string RoleArn { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public bool Valid { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset RegisteredAt { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeExclusionsResponse
{
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public ExclusionMap Exclusions { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItems FailedItems { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeExclusionsRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 100
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public Arn[] ExclusionArns { get; set; }
[System.Runtime.Serialization.DataMember()]
public DescribeExclusionsRequestLocale Locale { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum DescribeExclusionsRequestLocale
{
[System.Runtime.Serialization.EnumMemberAttribute()]
EN_US = 0,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeFindingsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 100
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public Finding[] Findings { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItems FailedItems { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeFindingsRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Arn[] FindingArns { get; set; }
[System.Runtime.Serialization.DataMember()]
public DescribeFindingsRequestLocale Locale { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum DescribeFindingsRequestLocale
{
[System.Runtime.Serialization.EnumMemberAttribute()]
EN_US = 0,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeResourceGroupsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public ResourceGroup[] ResourceGroups { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItems FailedItems { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeResourceGroupsRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Arn[] ResourceGroupArns { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeRulesPackagesResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public RulesPackage[] RulesPackages { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItems FailedItems { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DescribeRulesPackagesRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Arn[] RulesPackageArns { get; set; }
[System.Runtime.Serialization.DataMember()]
public DescribeRulesPackagesRequestLocale Locale { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum DescribeRulesPackagesRequestLocale
{
[System.Runtime.Serialization.EnumMemberAttribute()]
EN_US = 0,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class GetAssessmentReportResponse
{
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public GetAssessmentReportResponseStatus Status { get; set; }
/// <summary>
/// Max length: 2048
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(2048)]
public string Url { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum GetAssessmentReportResponseStatus
{
[System.Runtime.Serialization.EnumMemberAttribute()]
WORK_IN_PROGRESS = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
FAILED = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED = 2,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class GetAssessmentReportRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentRunArn { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public GetAssessmentReportRequestReportFileFormat ReportFileFormat { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public GetAssessmentReportRequestReportType ReportType { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum GetAssessmentReportRequestReportFileFormat
{
[System.Runtime.Serialization.EnumMemberAttribute()]
HTML = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
PDF = 1,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum GetAssessmentReportRequestReportType
{
[System.Runtime.Serialization.EnumMemberAttribute()]
FINDING = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
FULL = 1,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class GetExclusionsPreviewResponse
{
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public GetExclusionsPreviewResponsePreviewStatus PreviewStatus { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 100
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public ExclusionPreview[] ExclusionPreviews { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum GetExclusionsPreviewResponsePreviewStatus
{
[System.Runtime.Serialization.EnumMemberAttribute()]
WORK_IN_PROGRESS = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED = 1,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class GetExclusionsPreviewRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTemplateArn { get; set; }
/// <summary>
/// Pattern: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public string PreviewToken { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
[System.Runtime.Serialization.DataMember()]
public GetExclusionsPreviewRequestLocale Locale { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum GetExclusionsPreviewRequestLocale
{
[System.Runtime.Serialization.EnumMemberAttribute()]
EN_US = 0,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class GetTelemetryMetadataResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 5000
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(5000)]
public TelemetryMetadata[] TelemetryMetadata { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class GetTelemetryMetadataRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentRunArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListAssessmentRunAgentsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 500
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(500)]
public AssessmentRunAgent[] AssessmentRunAgents { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListAssessmentRunAgentsRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentRunArn { get; set; }
/// <summary>
/// Contains information about an Amazon Inspector agent. This data type is used as a request parameter in the <a>ListAssessmentRunAgents</a> action.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public AgentFilter Filter { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListAssessmentRunsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 100
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public Arn[] AssessmentRunArns { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListAssessmentRunsRequest
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Arn[] AssessmentTemplateArns { get; set; }
/// <summary>
/// Used as the request parameter in the <a>ListAssessmentRuns</a> action.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public AssessmentRunFilter Filter { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListAssessmentTargetsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 100
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public Arn[] AssessmentTargetArns { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListAssessmentTargetsRequest
{
/// <summary>
/// Used as the request parameter in the <a>ListAssessmentTargets</a> action.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public AssessmentTargetFilter Filter { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListAssessmentTemplatesResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 100
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public Arn[] AssessmentTemplateArns { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListAssessmentTemplatesRequest
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Arn[] AssessmentTargetArns { get; set; }
/// <summary>
/// Used as the request parameter in the <a>ListAssessmentTemplates</a> action.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public AssessmentTemplateFilter Filter { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListEventSubscriptionsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Subscription[] Subscriptions { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListEventSubscriptionsRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceArn { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListExclusionsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 100
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public Arn[] ExclusionArns { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListExclusionsRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentRunArn { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListFindingsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 100
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public Arn[] FindingArns { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListFindingsRequest
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Arn[] AssessmentRunArns { get; set; }
/// <summary>
/// This data type is used as a request parameter in the <a>ListFindings</a> action.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public FindingFilter Filter { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListRulesPackagesResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 100
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public Arn[] RulesPackageArns { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListRulesPackagesRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListTagsForResourceResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Tag[] Tags { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ListTagsForResourceRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class PreviewAgentsResponse
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 100
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(100)]
public AgentPreview[] AgentPreviews { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class PreviewAgentsRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string PreviewAgentsArn { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string NextToken { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> MaxResults { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class RegisterCrossAccountAccessRoleRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string RoleArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class RemoveAttributesFromFindingsResponse
{
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItems FailedItems { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class RemoveAttributesFromFindingsRequest
{
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Arn[] FindingArns { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public AttributeKey[] AttributeKeys { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class SetTagsForResourceRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceArn { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Tag[] Tags { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class StartAssessmentRunResponse
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentRunArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class StartAssessmentRunRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTemplateArn { get; set; }
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string AssessmentRunName { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class StopAssessmentRunRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentRunArn { get; set; }
[System.Runtime.Serialization.DataMember()]
public StopAssessmentRunRequestStopAction StopAction { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum StopAssessmentRunRequestStopAction
{
[System.Runtime.Serialization.EnumMemberAttribute()]
START_EVALUATION = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
SKIP_EVALUATION = 1,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class SubscribeToEventRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceArn { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public SubscribeToEventRequestEvent Event { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string TopicArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum SubscribeToEventRequestEvent
{
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STARTED = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_COMPLETED = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STATE_CHANGED = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
FINDING_REPORTED = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
OTHER = 4,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class UnsubscribeFromEventRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceArn { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public UnsubscribeFromEventRequestEvent Event { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string TopicArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum UnsubscribeFromEventRequestEvent
{
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STARTED = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_COMPLETED = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STATE_CHANGED = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
FINDING_REPORTED = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
OTHER = 4,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class UpdateAssessmentTargetRequest
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTargetArn { get; set; }
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string AssessmentTargetName { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceGroupArn { get; set; }
}
/// <summary>
/// Contains information about an Amazon Inspector agent. This data type is used as a request parameter in the <a>ListAssessmentRunAgents</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AgentFilter
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public AgentHealth[] AgentHealths { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public AgentHealthCode[] AgentHealthCodes { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AgentHealth
{
[System.Runtime.Serialization.EnumMemberAttribute()]
HEALTHY = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNHEALTHY = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNKNOWN = 2,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AgentHealthCode
{
[System.Runtime.Serialization.EnumMemberAttribute()]
IDLE = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
RUNNING = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
SHUTDOWN = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNHEALTHY = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
THROTTLED = 4,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNKNOWN = 5,
}
/// <summary>
/// Used as a response element in the <a>PreviewAgents</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AgentPreview
{
/// <summary>
/// Max length: 256
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=0)]
public string Hostname { get; set; }
/// <summary>
/// Max length: 128
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=1)]
public string AgentId { get; set; }
/// <summary>
/// Max length: 256
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=1)]
public string AutoScalingGroup { get; set; }
[System.Runtime.Serialization.DataMember()]
public AgentPreviewAgentHealth AgentHealth { get; set; }
/// <summary>
/// Max length: 128
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=1)]
public string AgentVersion { get; set; }
/// <summary>
/// Max length: 256
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=1)]
public string OperatingSystem { get; set; }
/// <summary>
/// Max length: 128
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=1)]
public string KernelVersion { get; set; }
/// <summary>
/// Max length: 15
/// Min length: 7
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(15, MinimumLength=7)]
public string Ipv4Address { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AgentPreviewAgentHealth
{
[System.Runtime.Serialization.EnumMemberAttribute()]
HEALTHY = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNHEALTHY = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNKNOWN = 2,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AssessmentRunState
{
[System.Runtime.Serialization.EnumMemberAttribute()]
CREATED = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
START_DATA_COLLECTION_PENDING = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
START_DATA_COLLECTION_IN_PROGRESS = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
COLLECTING_DATA = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
STOP_DATA_COLLECTION_PENDING = 4,
[System.Runtime.Serialization.EnumMemberAttribute()]
DATA_COLLECTED = 5,
[System.Runtime.Serialization.EnumMemberAttribute()]
START_EVALUATING_RULES_PENDING = 6,
[System.Runtime.Serialization.EnumMemberAttribute()]
EVALUATING_RULES = 7,
[System.Runtime.Serialization.EnumMemberAttribute()]
FAILED = 8,
[System.Runtime.Serialization.EnumMemberAttribute()]
ERROR = 9,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED = 10,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED_WITH_ERRORS = 11,
[System.Runtime.Serialization.EnumMemberAttribute()]
CANCELED = 12,
}
/// <summary>
/// <p>A snapshot of an Amazon Inspector assessment run that contains the findings of the assessment run .</p> <p>Used as the response element in the <a>DescribeAssessmentRuns</a> action.</p>
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssessmentRun
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string Arn { get; set; }
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string Name { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTemplateArn { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public AssessmentRunState State { get; set; }
/// <summary>
/// Minimum: 180
/// Maximum: 86400
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(180, 86400)]
public int DurationInSeconds { get; set; }
/// <summary>
/// Minimum items: 1
/// Maximum items: 50
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Arn[] RulesPackageArns { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Attribute[] UserAttributesForFindings { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset CreatedAt { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.DateTimeOffset> StartedAt { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.DateTimeOffset> CompletedAt { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset StateChangedAt { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public bool DataCollected { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public AssessmentRunStateChange[] StateChanges { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public AssessmentRunNotification[] Notifications { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public AssessmentRunFindingCounts FindingCounts { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AssessmentRunState
{
[System.Runtime.Serialization.EnumMemberAttribute()]
CREATED = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
START_DATA_COLLECTION_PENDING = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
START_DATA_COLLECTION_IN_PROGRESS = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
COLLECTING_DATA = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
STOP_DATA_COLLECTION_PENDING = 4,
[System.Runtime.Serialization.EnumMemberAttribute()]
DATA_COLLECTED = 5,
[System.Runtime.Serialization.EnumMemberAttribute()]
START_EVALUATING_RULES_PENDING = 6,
[System.Runtime.Serialization.EnumMemberAttribute()]
EVALUATING_RULES = 7,
[System.Runtime.Serialization.EnumMemberAttribute()]
FAILED = 8,
[System.Runtime.Serialization.EnumMemberAttribute()]
ERROR = 9,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED = 10,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED_WITH_ERRORS = 11,
[System.Runtime.Serialization.EnumMemberAttribute()]
CANCELED = 12,
}
/// <summary>
/// Contains information about an Amazon Inspector agent. This data type is used as a response element in the <a>ListAssessmentRunAgents</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssessmentRunAgent
{
/// <summary>
/// Max length: 128
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=1)]
public string AgentId { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentRunArn { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public AssessmentRunAgentAgentHealth AgentHealth { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public AssessmentRunAgentAgentHealthCode AgentHealthCode { get; set; }
/// <summary>
/// Max length: 1000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(1000, MinimumLength=0)]
public string AgentHealthDetails { get; set; }
/// <summary>
/// Max length: 256
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=1)]
public string AutoScalingGroup { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 5000
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(5000)]
public TelemetryMetadata[] TelemetryMetadata { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AssessmentRunAgentAgentHealth
{
[System.Runtime.Serialization.EnumMemberAttribute()]
HEALTHY = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNHEALTHY = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNKNOWN = 2,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AssessmentRunAgentAgentHealthCode
{
[System.Runtime.Serialization.EnumMemberAttribute()]
IDLE = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
RUNNING = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
SHUTDOWN = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNHEALTHY = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
THROTTLED = 4,
[System.Runtime.Serialization.EnumMemberAttribute()]
UNKNOWN = 5,
}
/// <summary>
/// This data type is used in the <a>AssessmentTemplateFilter</a> data type.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class DurationRange
{
/// <summary>
/// Minimum: 180
/// Maximum: 86400
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(180, 86400)]
public System.Nullable<System.Int32> MinSeconds { get; set; }
/// <summary>
/// Minimum: 180
/// Maximum: 86400
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(180, 86400)]
public System.Nullable<System.Int32> MaxSeconds { get; set; }
}
/// <summary>
/// This data type is used in the <a>AssessmentRunFilter</a> data type.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class TimestampRange
{
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.DateTimeOffset> BeginDate { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.DateTimeOffset> EndDate { get; set; }
}
/// <summary>
/// Used as the request parameter in the <a>ListAssessmentRuns</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssessmentRunFilter
{
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string NamePattern { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public AssessmentRunState[] States { get; set; }
/// <summary>
/// This data type is used in the <a>AssessmentTemplateFilter</a> data type.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public DurationRange DurationRange { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Arn[] RulesPackageArns { get; set; }
/// <summary>
/// This data type is used in the <a>AssessmentRunFilter</a> data type.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public TimestampRange StartTimeRange { get; set; }
/// <summary>
/// This data type is used in the <a>AssessmentRunFilter</a> data type.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public TimestampRange CompletionTimeRange { get; set; }
/// <summary>
/// This data type is used in the <a>AssessmentRunFilter</a> data type.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public TimestampRange StateChangeTimeRange { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum InspectorEvent
{
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STARTED = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_COMPLETED = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STATE_CHANGED = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
FINDING_REPORTED = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
OTHER = 4,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AssessmentRunNotificationSnsStatusCode
{
[System.Runtime.Serialization.EnumMemberAttribute()]
SUCCESS = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
TOPIC_DOES_NOT_EXIST = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
ACCESS_DENIED = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
INTERNAL_ERROR = 3,
}
/// <summary>
/// Used as one of the elements of the <a>AssessmentRun</a> data type.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssessmentRunNotification
{
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset Date { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public AssessmentRunNotificationEvent Event { get; set; }
/// <summary>
/// Max length: 1000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(1000, MinimumLength=0)]
public string Message { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public bool Error { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string SnsTopicArn { get; set; }
[System.Runtime.Serialization.DataMember()]
public AssessmentRunNotificationSnsPublishStatusCode SnsPublishStatusCode { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AssessmentRunNotificationEvent
{
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STARTED = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_COMPLETED = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STATE_CHANGED = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
FINDING_REPORTED = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
OTHER = 4,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AssessmentRunNotificationSnsPublishStatusCode
{
[System.Runtime.Serialization.EnumMemberAttribute()]
SUCCESS = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
TOPIC_DOES_NOT_EXIST = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
ACCESS_DENIED = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
INTERNAL_ERROR = 3,
}
/// <summary>
/// Used as one of the elements of the <a>AssessmentRun</a> data type.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssessmentRunStateChange
{
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset StateChangedAt { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public AssessmentRunStateChangeState State { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AssessmentRunStateChangeState
{
[System.Runtime.Serialization.EnumMemberAttribute()]
CREATED = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
START_DATA_COLLECTION_PENDING = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
START_DATA_COLLECTION_IN_PROGRESS = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
COLLECTING_DATA = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
STOP_DATA_COLLECTION_PENDING = 4,
[System.Runtime.Serialization.EnumMemberAttribute()]
DATA_COLLECTED = 5,
[System.Runtime.Serialization.EnumMemberAttribute()]
START_EVALUATING_RULES_PENDING = 6,
[System.Runtime.Serialization.EnumMemberAttribute()]
EVALUATING_RULES = 7,
[System.Runtime.Serialization.EnumMemberAttribute()]
FAILED = 8,
[System.Runtime.Serialization.EnumMemberAttribute()]
ERROR = 9,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED = 10,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED_WITH_ERRORS = 11,
[System.Runtime.Serialization.EnumMemberAttribute()]
CANCELED = 12,
}
/// <summary>
/// Contains information about an Amazon Inspector application. This data type is used as the response element in the <a>DescribeAssessmentTargets</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssessmentTarget
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string Arn { get; set; }
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string Name { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceGroupArn { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset CreatedAt { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset UpdatedAt { get; set; }
}
/// <summary>
/// Used as the request parameter in the <a>ListAssessmentTargets</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssessmentTargetFilter
{
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string AssessmentTargetNamePattern { get; set; }
}
/// <summary>
/// Contains information about an Amazon Inspector assessment template. This data type is used as the response element in the <a>DescribeAssessmentTemplates</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssessmentTemplate
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string Arn { get; set; }
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string Name { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentTargetArn { get; set; }
/// <summary>
/// Minimum: 180
/// Maximum: 86400
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(180, 86400)]
public int DurationInSeconds { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Arn[] RulesPackageArns { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Attribute[] UserAttributesForFindings { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string LastAssessmentRunArn { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public int AssessmentRunCount { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset CreatedAt { get; set; }
}
/// <summary>
/// Used as the request parameter in the <a>ListAssessmentTemplates</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssessmentTemplateFilter
{
/// <summary>
/// Max length: 140
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(140, MinimumLength=1)]
public string NamePattern { get; set; }
/// <summary>
/// This data type is used in the <a>AssessmentTemplateFilter</a> data type.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public DurationRange DurationRange { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Arn[] RulesPackageArns { get; set; }
}
/// <summary>
/// A collection of attributes of the host from which the finding is generated.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class AssetAttributes
{
/// <summary>
/// Minimum: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(0, System.Int32.MaxValue)]
public int SchemaVersion { get; set; }
/// <summary>
/// Max length: 128
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=1)]
public string AgentId { get; set; }
/// <summary>
/// Max length: 256
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=1)]
public string AutoScalingGroup { get; set; }
/// <summary>
/// Max length: 256
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=0)]
public string AmiId { get; set; }
/// <summary>
/// Max length: 256
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=0)]
public string Hostname { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Ipv4Address[] Ipv4Addresses { get; set; }
[System.Runtime.Serialization.DataMember()]
public Tag[] Tags { get; set; }
[System.Runtime.Serialization.DataMember()]
public NetworkInterface[] NetworkInterfaces { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum AssetType
{
[System.Runtime.Serialization.EnumMemberAttribute()]
ec2-instance = 0,
}
/// <summary>
/// This data type is used as a request parameter in the <a>AddAttributesToFindings</a> and <a>CreateAssessmentTemplate</a> actions.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class Attribute
{
/// <summary>
/// Max length: 128
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=1)]
public string Key { get; set; }
/// <summary>
/// Max length: 256
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=1)]
public string Value { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum Locale
{
[System.Runtime.Serialization.EnumMemberAttribute()]
EN_US = 0,
}
/// <summary>
/// This data type is used in the <a>Subscription</a> data type.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class EventSubscription
{
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public EventSubscriptionEvent Event { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset SubscribedAt { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum EventSubscriptionEvent
{
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STARTED = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_COMPLETED = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
ASSESSMENT_RUN_STATE_CHANGED = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
FINDING_REPORTED = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
OTHER = 4,
}
/// <summary>
/// Contains information about what was excluded from an assessment run.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class Exclusion
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string Arn { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Title { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Description { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Recommendation { get; set; }
/// <summary>
/// Minimum items: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
public Scope[] Scopes { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Attribute[] Attributes { get; set; }
}
/// <summary>
/// Contains information about what is excluded from an assessment run given the current state of the assessment template.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ExclusionPreview
{
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Title { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Description { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Recommendation { get; set; }
/// <summary>
/// Minimum items: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
public Scope[] Scopes { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Attribute[] Attributes { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum FailedItemErrorCode
{
[System.Runtime.Serialization.EnumMemberAttribute()]
INVALID_ARN = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
DUPLICATE_ARN = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
ITEM_DOES_NOT_EXIST = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
ACCESS_DENIED = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
LIMIT_EXCEEDED = 4,
[System.Runtime.Serialization.EnumMemberAttribute()]
INTERNAL_ERROR = 5,
}
/// <summary>
/// Includes details about the failed items.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class FailedItemDetails
{
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public FailedItemDetailsFailureCode FailureCode { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public bool Retryable { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum FailedItemDetailsFailureCode
{
[System.Runtime.Serialization.EnumMemberAttribute()]
INVALID_ARN = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
DUPLICATE_ARN = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
ITEM_DOES_NOT_EXIST = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
ACCESS_DENIED = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
LIMIT_EXCEEDED = 4,
[System.Runtime.Serialization.EnumMemberAttribute()]
INTERNAL_ERROR = 5,
}
/// <summary>
/// This data type is used in the <a>Finding</a> data type.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class InspectorServiceAttributes
{
/// <summary>
/// Minimum: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(0, System.Int32.MaxValue)]
public int SchemaVersion { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string AssessmentRunArn { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string RulesPackageArn { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum Severity
{
[System.Runtime.Serialization.EnumMemberAttribute()]
Low = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
Medium = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
High = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
Informational = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
Undefined = 4,
}
/// <summary>
/// Contains information about an Amazon Inspector finding. This data type is used as the response element in the <a>DescribeFindings</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class Finding
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string Arn { get; set; }
/// <summary>
/// Minimum: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(0, System.Int32.MaxValue)]
public System.Nullable<System.Int32> SchemaVersion { get; set; }
/// <summary>
/// Max length: 128
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=0)]
public string Service { get; set; }
/// <summary>
/// This data type is used in the <a>Finding</a> data type.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public InspectorServiceAttributes ServiceAttributes { get; set; }
[System.Runtime.Serialization.DataMember()]
public FindingAssetType AssetType { get; set; }
/// <summary>
/// A collection of attributes of the host from which the finding is generated.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public AssetAttributes AssetAttributes { get; set; }
/// <summary>
/// Max length: 128
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=0)]
public string Id { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Title { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Description { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Recommendation { get; set; }
[System.Runtime.Serialization.DataMember()]
public FindingSeverity Severity { get; set; }
/// <summary>
/// Minimum: 0
/// Maximum: 10
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(0, 10)]
public System.Nullable<System.Double> NumericSeverity { get; set; }
/// <summary>
/// Minimum: 0
/// Maximum: 10
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.Range(0, 10)]
public System.Nullable<System.Int32> Confidence { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Boolean> IndicatorOfCompromise { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Attribute[] Attributes { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public Attribute[] UserAttributes { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset CreatedAt { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset UpdatedAt { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum FindingAssetType
{
[System.Runtime.Serialization.EnumMemberAttribute()]
ec2-instance = 0,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum FindingSeverity
{
[System.Runtime.Serialization.EnumMemberAttribute()]
Low = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
Medium = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
High = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
Informational = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
Undefined = 4,
}
/// <summary>
/// This data type is used as a request parameter in the <a>ListFindings</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class FindingFilter
{
/// <summary>
/// Minimum items: 0
/// Maximum items: 99
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(99)]
public AgentId[] AgentIds { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 20
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(20)]
public AutoScalingGroup[] AutoScalingGroups { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public RuleName[] RuleNames { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Severity[] Severities { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Arn[] RulesPackageArns { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Attribute[] Attributes { get; set; }
/// <summary>
/// Minimum items: 0
/// Maximum items: 50
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(0)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public Attribute[] UserAttributes { get; set; }
/// <summary>
/// This data type is used in the <a>AssessmentRunFilter</a> data type.
/// </summary>
[System.Runtime.Serialization.DataMember()]
public TimestampRange CreationTimeRange { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum ReportFileFormat
{
[System.Runtime.Serialization.EnumMemberAttribute()]
HTML = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
PDF = 1,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum ReportType
{
[System.Runtime.Serialization.EnumMemberAttribute()]
FINDING = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
FULL = 1,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum ReportStatus
{
[System.Runtime.Serialization.EnumMemberAttribute()]
WORK_IN_PROGRESS = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
FAILED = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED = 2,
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum PreviewStatus
{
[System.Runtime.Serialization.EnumMemberAttribute()]
WORK_IN_PROGRESS = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
COMPLETED = 1,
}
/// <summary>
/// Contains information about the network interfaces interacting with an EC2 instance. This data type is used as one of the elements of the <a>AssetAttributes</a> data type.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class NetworkInterface
{
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string NetworkInterfaceId { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string SubnetId { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string VpcId { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string PrivateDnsName { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string PrivateIpAddress { get; set; }
[System.Runtime.Serialization.DataMember()]
public PrivateIp[] PrivateIpAddresses { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string PublicDnsName { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string PublicIp { get; set; }
[System.Runtime.Serialization.DataMember()]
public Text[] Ipv6Addresses { get; set; }
[System.Runtime.Serialization.DataMember()]
public SecurityGroup[] SecurityGroups { get; set; }
}
/// <summary>
/// Contains information about a private IP address associated with a network interface. This data type is used as a response element in the <a>DescribeFindings</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class PrivateIp
{
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string PrivateDnsName { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string PrivateIpAddress { get; set; }
}
/// <summary>
/// Contains information about a resource group. The resource group defines a set of tags that, when queried, identify the AWS resources that make up the assessment target. This data type is used as the response element in the <a>DescribeResourceGroups</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ResourceGroup
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string Arn { get; set; }
/// <summary>
/// Minimum items: 1
/// Maximum items: 10
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(10)]
public ResourceGroupTag[] Tags { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public System.DateTimeOffset CreatedAt { get; set; }
}
/// <summary>
/// This data type is used as one of the elements of the <a>ResourceGroup</a> data type.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class ResourceGroupTag
{
/// <summary>
/// Max length: 128
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=1)]
public string Key { get; set; }
/// <summary>
/// Max length: 256
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=1)]
public string Value { get; set; }
}
/// <summary>
/// Contains information about an Amazon Inspector rules package. This data type is used as the response element in the <a>DescribeRulesPackages</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class RulesPackage
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string Arn { get; set; }
/// <summary>
/// Max length: 1000
/// Min length: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(1000, MinimumLength=0)]
public string Name { get; set; }
/// <summary>
/// Max length: 1000
/// Min length: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(1000, MinimumLength=0)]
public string Version { get; set; }
/// <summary>
/// Max length: 1000
/// Min length: 0
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(1000, MinimumLength=0)]
public string Provider { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string Description { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum ScopeType
{
[System.Runtime.Serialization.EnumMemberAttribute()]
INSTANCE_ID = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
RULES_PACKAGE_ARN = 1,
}
/// <summary>
/// This data type contains key-value pairs that identify various Amazon resources.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class Scope
{
[System.Runtime.Serialization.DataMember()]
public ScopeKey Key { get; set; }
[System.Runtime.Serialization.DataMember()]
public string Value { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum ScopeKey
{
[System.Runtime.Serialization.EnumMemberAttribute()]
INSTANCE_ID = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
RULES_PACKAGE_ARN = 1,
}
/// <summary>
/// Contains information about a security group associated with a network interface. This data type is used as one of the elements of the <a>NetworkInterface</a> data type.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class SecurityGroup
{
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string GroupName { get; set; }
/// <summary>
/// Max length: 20000
/// Min length: 0
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(20000, MinimumLength=0)]
public string GroupId { get; set; }
}
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public enum StopAction
{
[System.Runtime.Serialization.EnumMemberAttribute()]
START_EVALUATION = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
SKIP_EVALUATION = 1,
}
/// <summary>
/// This data type is used as a response element in the <a>ListEventSubscriptions</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class Subscription
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string ResourceArn { get; set; }
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string TopicArn { get; set; }
/// <summary>
/// Minimum items: 1
/// Maximum items: 50
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.MinLength(1)]
[System.ComponentModel.DataAnnotations.MaxLength(50)]
public EventSubscription[] EventSubscriptions { get; set; }
}
/// <summary>
/// A key and value pair. This data type is used as a request parameter in the <a>SetTagsForResource</a> action and a response element in the <a>ListTagsForResource</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class Tag
{
/// <summary>
/// Max length: 128
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(128, MinimumLength=1)]
public string Key { get; set; }
/// <summary>
/// Max length: 256
/// Min length: 1
/// </summary>
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(256, MinimumLength=1)]
public string Value { get; set; }
}
/// <summary>
/// The metadata about the Amazon Inspector application data metrics collected by the agent. This data type is used as the response element in the <a>GetTelemetryMetadata</a> action.
/// </summary>
[System.Runtime.Serialization.DataContract(Name="http://demo.domain/2020/03")]
public class TelemetryMetadata
{
/// <summary>
/// Max length: 300
/// Min length: 1
/// </summary>
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
[System.ComponentModel.DataAnnotations.StringLength(300, MinimumLength=1)]
public string MessageType { get; set; }
[System.ComponentModel.DataAnnotations.Required()]
[System.Runtime.Serialization.DataMember()]
public int Count { get; set; }
[System.Runtime.Serialization.DataMember()]
public System.Nullable<System.Int32> DataSize { get; set; }
}
public partial class DemoClient
{
private System.Net.Http.HttpClient client;
private JsonSerializerSettings jsonSerializerSettings;
public DemoClient(System.Net.Http.HttpClient client, JsonSerializerSettings jsonSerializerSettings=null)
{
if (client == null)
throw new ArgumentNullException("Null HttpClient.", "client");
if (client.BaseAddress == null)
throw new ArgumentNullException("HttpClient has no BaseAddress", "client");
this.client = client;
this.jsonSerializerSettings = jsonSerializerSettings;
}
/// <summary>
/// Assigns attributes (key and value pairs) to the findings that are specified by the ARNs of the findings.
/// AddAttributesToFindings /#X-Amz-Target=InspectorService.AddAttributesToFindings
/// </summary>
/// <returns>Success</returns>
public async Task<AddAttributesToFindingsResponse> AddAttributesToFindingsAsync(AddAttributesToFindingsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.AddAttributesToFindings";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<AddAttributesToFindingsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Creates a new assessment target using the ARN of the resource group that is generated by <a>CreateResourceGroup</a>. If resourceGroupArn is not specified, all EC2 instances in the current AWS account and region are included in the assessment target. If the <a href="https://docs.aws.amazon.com/inspector/latest/userguide/inspector_slr.html">service-linked role</a> isn’t already registered, this action also creates and registers a service-linked role to grant Amazon Inspector access to AWS Services needed to perform security assessments. You can create up to 50 assessment targets per AWS account. You can run up to 500 concurrent agents per AWS account. For more information, see <a href="https://docs.aws.amazon.com/inspector/latest/userguide/inspector_applications.html"> Amazon Inspector Assessment Targets</a>.
/// CreateAssessmentTarget /#X-Amz-Target=InspectorService.CreateAssessmentTarget
/// </summary>
/// <returns>Success</returns>
public async Task<CreateAssessmentTargetResponse> CreateAssessmentTargetAsync(CreateAssessmentTargetRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.CreateAssessmentTarget";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<CreateAssessmentTargetResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Creates an assessment template for the assessment target that is specified by the ARN of the assessment target. If the <a href="https://docs.aws.amazon.com/inspector/latest/userguide/inspector_slr.html">service-linked role</a> isn’t already registered, this action also creates and registers a service-linked role to grant Amazon Inspector access to AWS Services needed to perform security assessments.
/// CreateAssessmentTemplate /#X-Amz-Target=InspectorService.CreateAssessmentTemplate
/// </summary>
/// <returns>Success</returns>
public async Task<CreateAssessmentTemplateResponse> CreateAssessmentTemplateAsync(CreateAssessmentTemplateRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.CreateAssessmentTemplate";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<CreateAssessmentTemplateResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Starts the generation of an exclusions preview for the specified assessment template. The exclusions preview lists the potential exclusions (ExclusionPreview) that Inspector can detect before it runs the assessment.
/// CreateExclusionsPreview /#X-Amz-Target=InspectorService.CreateExclusionsPreview
/// </summary>
/// <returns>Success</returns>
public async Task<CreateExclusionsPreviewResponse> CreateExclusionsPreviewAsync(CreateExclusionsPreviewRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.CreateExclusionsPreview";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<CreateExclusionsPreviewResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target. For more information, see <a>CreateAssessmentTarget</a>.
/// CreateResourceGroup /#X-Amz-Target=InspectorService.CreateResourceGroup
/// </summary>
/// <returns>Success</returns>
public async Task<CreateResourceGroupResponse> CreateResourceGroupAsync(CreateResourceGroupRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.CreateResourceGroup";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<CreateResourceGroupResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Deletes the assessment run that is specified by the ARN of the assessment run.
/// DeleteAssessmentRun /#X-Amz-Target=InspectorService.DeleteAssessmentRun
/// </summary>
/// <returns>Success</returns>
public async Task DeleteAssessmentRunAsync(DeleteAssessmentRunRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DeleteAssessmentRun";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Deletes the assessment target that is specified by the ARN of the assessment target.
/// DeleteAssessmentTarget /#X-Amz-Target=InspectorService.DeleteAssessmentTarget
/// </summary>
/// <returns>Success</returns>
public async Task DeleteAssessmentTargetAsync(DeleteAssessmentTargetRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DeleteAssessmentTarget";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Deletes the assessment template that is specified by the ARN of the assessment template.
/// DeleteAssessmentTemplate /#X-Amz-Target=InspectorService.DeleteAssessmentTemplate
/// </summary>
/// <returns>Success</returns>
public async Task DeleteAssessmentTemplateAsync(DeleteAssessmentTemplateRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DeleteAssessmentTemplate";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Describes the assessment runs that are specified by the ARNs of the assessment runs.
/// DescribeAssessmentRuns /#X-Amz-Target=InspectorService.DescribeAssessmentRuns
/// </summary>
/// <returns>Success</returns>
public async Task<DescribeAssessmentRunsResponse> DescribeAssessmentRunsAsync(DescribeAssessmentRunsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DescribeAssessmentRuns";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<DescribeAssessmentRunsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Describes the assessment targets that are specified by the ARNs of the assessment targets.
/// DescribeAssessmentTargets /#X-Amz-Target=InspectorService.DescribeAssessmentTargets
/// </summary>
/// <returns>Success</returns>
public async Task<DescribeAssessmentTargetsResponse> DescribeAssessmentTargetsAsync(DescribeAssessmentTargetsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DescribeAssessmentTargets";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<DescribeAssessmentTargetsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Describes the assessment templates that are specified by the ARNs of the assessment templates.
/// DescribeAssessmentTemplates /#X-Amz-Target=InspectorService.DescribeAssessmentTemplates
/// </summary>
/// <returns>Success</returns>
public async Task<DescribeAssessmentTemplatesResponse> DescribeAssessmentTemplatesAsync(DescribeAssessmentTemplatesRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DescribeAssessmentTemplates";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<DescribeAssessmentTemplatesResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Describes the IAM role that enables Amazon Inspector to access your AWS account.
/// DescribeCrossAccountAccessRole /#X-Amz-Target=InspectorService.DescribeCrossAccountAccessRole
/// </summary>
/// <returns>Success</returns>
public async Task<DescribeCrossAccountAccessRoleResponse> DescribeCrossAccountAccessRoleAsync(Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DescribeCrossAccountAccessRole";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<DescribeCrossAccountAccessRoleResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
/// <summary>
/// Describes the exclusions that are specified by the exclusions' ARNs.
/// DescribeExclusions /#X-Amz-Target=InspectorService.DescribeExclusions
/// </summary>
/// <returns>Success</returns>
public async Task<DescribeExclusionsResponse> DescribeExclusionsAsync(DescribeExclusionsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DescribeExclusions";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<DescribeExclusionsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Describes the findings that are specified by the ARNs of the findings.
/// DescribeFindings /#X-Amz-Target=InspectorService.DescribeFindings
/// </summary>
/// <returns>Success</returns>
public async Task<DescribeFindingsResponse> DescribeFindingsAsync(DescribeFindingsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DescribeFindings";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<DescribeFindingsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Describes the resource groups that are specified by the ARNs of the resource groups.
/// DescribeResourceGroups /#X-Amz-Target=InspectorService.DescribeResourceGroups
/// </summary>
/// <returns>Success</returns>
public async Task<DescribeResourceGroupsResponse> DescribeResourceGroupsAsync(DescribeResourceGroupsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DescribeResourceGroups";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<DescribeResourceGroupsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Describes the rules packages that are specified by the ARNs of the rules packages.
/// DescribeRulesPackages /#X-Amz-Target=InspectorService.DescribeRulesPackages
/// </summary>
/// <returns>Success</returns>
public async Task<DescribeRulesPackagesResponse> DescribeRulesPackagesAsync(DescribeRulesPackagesRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.DescribeRulesPackages";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<DescribeRulesPackagesResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Produces an assessment report that includes detailed and comprehensive results of a specified assessment run.
/// GetAssessmentReport /#X-Amz-Target=InspectorService.GetAssessmentReport
/// </summary>
/// <returns>Success</returns>
public async Task<GetAssessmentReportResponse> GetAssessmentReportAsync(GetAssessmentReportRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.GetAssessmentReport";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<GetAssessmentReportResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Retrieves the exclusions preview (a list of ExclusionPreview objects) specified by the preview token. You can obtain the preview token by running the CreateExclusionsPreview API.
/// GetExclusionsPreview /#X-Amz-Target=InspectorService.GetExclusionsPreview
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<GetExclusionsPreviewResponse> GetExclusionsPreviewAsync(string maxResults, string nextToken, GetExclusionsPreviewRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.GetExclusionsPreview?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<GetExclusionsPreviewResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Information about the data that is collected for the specified assessment run.
/// GetTelemetryMetadata /#X-Amz-Target=InspectorService.GetTelemetryMetadata
/// </summary>
/// <returns>Success</returns>
public async Task<GetTelemetryMetadataResponse> GetTelemetryMetadataAsync(GetTelemetryMetadataRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.GetTelemetryMetadata";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<GetTelemetryMetadataResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Lists the agents of the assessment runs that are specified by the ARNs of the assessment runs.
/// ListAssessmentRunAgents /#X-Amz-Target=InspectorService.ListAssessmentRunAgents
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<ListAssessmentRunAgentsResponse> ListAssessmentRunAgentsAsync(string maxResults, string nextToken, ListAssessmentRunAgentsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.ListAssessmentRunAgents?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<ListAssessmentRunAgentsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Lists the assessment runs that correspond to the assessment templates that are specified by the ARNs of the assessment templates.
/// ListAssessmentRuns /#X-Amz-Target=InspectorService.ListAssessmentRuns
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<ListAssessmentRunsResponse> ListAssessmentRunsAsync(string maxResults, string nextToken, ListAssessmentRunsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.ListAssessmentRuns?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<ListAssessmentRunsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Lists the ARNs of the assessment targets within this AWS account. For more information about assessment targets, see <a href="https://docs.aws.amazon.com/inspector/latest/userguide/inspector_applications.html">Amazon Inspector Assessment Targets</a>.
/// ListAssessmentTargets /#X-Amz-Target=InspectorService.ListAssessmentTargets
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<ListAssessmentTargetsResponse> ListAssessmentTargetsAsync(string maxResults, string nextToken, ListAssessmentTargetsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.ListAssessmentTargets?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<ListAssessmentTargetsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Lists the assessment templates that correspond to the assessment targets that are specified by the ARNs of the assessment targets.
/// ListAssessmentTemplates /#X-Amz-Target=InspectorService.ListAssessmentTemplates
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<ListAssessmentTemplatesResponse> ListAssessmentTemplatesAsync(string maxResults, string nextToken, ListAssessmentTemplatesRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.ListAssessmentTemplates?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<ListAssessmentTemplatesResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Lists all the event subscriptions for the assessment template that is specified by the ARN of the assessment template. For more information, see <a>SubscribeToEvent</a> and <a>UnsubscribeFromEvent</a>.
/// ListEventSubscriptions /#X-Amz-Target=InspectorService.ListEventSubscriptions
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<ListEventSubscriptionsResponse> ListEventSubscriptionsAsync(string maxResults, string nextToken, ListEventSubscriptionsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.ListEventSubscriptions?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<ListEventSubscriptionsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// List exclusions that are generated by the assessment run.
/// ListExclusions /#X-Amz-Target=InspectorService.ListExclusions
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<ListExclusionsResponse> ListExclusionsAsync(string maxResults, string nextToken, ListExclusionsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.ListExclusions?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<ListExclusionsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Lists findings that are generated by the assessment runs that are specified by the ARNs of the assessment runs.
/// ListFindings /#X-Amz-Target=InspectorService.ListFindings
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<ListFindingsResponse> ListFindingsAsync(string maxResults, string nextToken, ListFindingsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.ListFindings?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<ListFindingsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Lists all available Amazon Inspector rules packages.
/// ListRulesPackages /#X-Amz-Target=InspectorService.ListRulesPackages
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<ListRulesPackagesResponse> ListRulesPackagesAsync(string maxResults, string nextToken, ListRulesPackagesRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.ListRulesPackages?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<ListRulesPackagesResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Lists all tags associated with an assessment template.
/// ListTagsForResource /#X-Amz-Target=InspectorService.ListTagsForResource
/// </summary>
/// <returns>Success</returns>
public async Task<ListTagsForResourceResponse> ListTagsForResourceAsync(ListTagsForResourceRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.ListTagsForResource";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<ListTagsForResourceResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Previews the agents installed on the EC2 instances that are part of the specified assessment target.
/// PreviewAgents /#X-Amz-Target=InspectorService.PreviewAgents
/// </summary>
/// <param name="maxResults">Pagination limit</param>
/// <param name="nextToken">Pagination token</param>
/// <returns>Success</returns>
public async Task<PreviewAgentsResponse> PreviewAgentsAsync(string maxResults, string nextToken, PreviewAgentsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.PreviewAgents?maxResults=" + (maxResults==null? "" : Uri.EscapeDataString(maxResults))+"&nextToken=" + (nextToken==null? "" : Uri.EscapeDataString(nextToken));
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<PreviewAgentsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Registers the IAM role that grants Amazon Inspector access to AWS Services needed to perform security assessments.
/// RegisterCrossAccountAccessRole /#X-Amz-Target=InspectorService.RegisterCrossAccountAccessRole
/// </summary>
/// <returns>Success</returns>
public async Task RegisterCrossAccountAccessRoleAsync(RegisterCrossAccountAccessRoleRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.RegisterCrossAccountAccessRole";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Removes entire attributes (key and value pairs) from the findings that are specified by the ARNs of the findings where an attribute with the specified key exists.
/// RemoveAttributesFromFindings /#X-Amz-Target=InspectorService.RemoveAttributesFromFindings
/// </summary>
/// <returns>Success</returns>
public async Task<RemoveAttributesFromFindingsResponse> RemoveAttributesFromFindingsAsync(RemoveAttributesFromFindingsRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.RemoveAttributesFromFindings";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<RemoveAttributesFromFindingsResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Sets tags (key and value pairs) to the assessment template that is specified by the ARN of the assessment template.
/// SetTagsForResource /#X-Amz-Target=InspectorService.SetTagsForResource
/// </summary>
/// <returns>Success</returns>
public async Task SetTagsForResourceAsync(SetTagsForResourceRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.SetTagsForResource";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Starts the assessment run specified by the ARN of the assessment template. For this API to function properly, you must not exceed the limit of running up to 500 concurrent agents per AWS account.
/// StartAssessmentRun /#X-Amz-Target=InspectorService.StartAssessmentRun
/// </summary>
/// <returns>Success</returns>
public async Task<StartAssessmentRunResponse> StartAssessmentRunAsync(StartAssessmentRunRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.StartAssessmentRun";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
var stream = await responseMessage.Content.ReadAsStreamAsync();
using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
{
var serializer = new JsonSerializer();
return serializer.Deserialize<StartAssessmentRunResponse>(jsonReader);
}
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Stops the assessment run that is specified by the ARN of the assessment run.
/// StopAssessmentRun /#X-Amz-Target=InspectorService.StopAssessmentRun
/// </summary>
/// <returns>Success</returns>
public async Task StopAssessmentRunAsync(StopAssessmentRunRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.StopAssessmentRun";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Enables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.
/// SubscribeToEvent /#X-Amz-Target=InspectorService.SubscribeToEvent
/// </summary>
/// <returns>Success</returns>
public async Task SubscribeToEventAsync(SubscribeToEventRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.SubscribeToEvent";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// Disables the process of sending Amazon Simple Notification Service (SNS) notifications about a specified event to a specified SNS topic.
/// UnsubscribeFromEvent /#X-Amz-Target=InspectorService.UnsubscribeFromEvent
/// </summary>
/// <returns>Success</returns>
public async Task UnsubscribeFromEventAsync(UnsubscribeFromEventRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.UnsubscribeFromEvent";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
}
/// <summary>
/// <p>Updates the assessment target that is specified by the ARN of the assessment target.</p> <p>If resourceGroupArn is not specified, all EC2 instances in the current AWS account and region are included in the assessment target.</p>
/// UpdateAssessmentTarget /#X-Amz-Target=InspectorService.UpdateAssessmentTarget
/// </summary>
/// <returns>Success</returns>
public async Task UpdateAssessmentTargetAsync(UpdateAssessmentTargetRequest requestBody, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "/#X-Amz-Target=InspectorService.UpdateAssessmentTarget";
using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri))
{
using (var requestWriter = new System.IO.StringWriter())
{
var requestSerializer = JsonSerializer.Create(jsonSerializerSettings);
requestSerializer.Serialize(requestWriter, requestBody);
var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json");
request.Content = content;
if (handleHeaders != null)
{
handleHeaders(request.Headers);
}
var responseMessage = await client.SendAsync(request);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
}
}
}
namespace Fonlow.Net.Http
{
using System.Net.Http;
public class WebApiRequestException : HttpRequestException
{
public System.Net.HttpStatusCode StatusCode { get; private set; }
public string Response { get; private set; }
public System.Net.Http.Headers.HttpResponseHeaders Headers { get; private set; }
public System.Net.Http.Headers.MediaTypeHeaderValue ContentType { get; private set; }
public WebApiRequestException(string message, System.Net.HttpStatusCode statusCode, string response, System.Net.Http.Headers.HttpResponseHeaders headers, System.Net.Http.Headers.MediaTypeHeaderValue contentType) : base(message)
{
StatusCode = statusCode;
Response = response;
Headers = headers;
ContentType = contentType;
}
}
public static class ResponseMessageExtensions
{
public static void EnsureSuccessStatusCodeEx(this HttpResponseMessage responseMessage)
{
if (!responseMessage.IsSuccessStatusCode)
{
var responseText = responseMessage.Content.ReadAsStringAsync().Result;
var contentType = responseMessage.Content.Headers.ContentType;
throw new WebApiRequestException(responseMessage.ReasonPhrase, responseMessage.StatusCode, responseText, responseMessage.Headers, contentType);
}
}
}
}
| 33.788625 | 824 | 0.727431 |
[
"MIT"
] |
zijianhuang/openapi-directory
|
APIs/amazonaws.com/inspector/csharp/DemoAuto.cs
| 163,372 |
C#
|
#nullable enable
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text.Json;
using System.Text.Json.Serialization;
using Azure.DigitalTwins.Core;
using Telstra.Twins.Attributes;
using Telstra.Twins.Core;
using Telstra.Twins.Models;
using Telstra.Twins.Services;
using Xunit;
using Xunit.Abstractions;
using FluentAssertions;
namespace Telstra.Twins.Test
{
public class SerializationTests
{
protected ITestOutputHelper TestOutput { get; }
protected DigitalTwinSerializer Serializer { get; }
public SerializationTests(ITestOutputHelper testOutputHelper)
{
var modelLibrary = new ModelLibrary();
Serializer = new DigitalTwinSerializer(modelLibrary);
TestOutput = testOutputHelper;
}
[Theory]
[MemberData(nameof(ModelTestData))]
public void ShouldSerialiseModelToDTDL(string expectedModel, Type twinType)
{
var model = Serializer.SerializeModel(twinType);
JsonAssert.Equal(expectedModel, model);
}
[Theory]
[MemberData(nameof(TwinTestData))]
public void ShouldSerialiseTwinToDTDL(string twinDTDL, object twinObject)
{
var expectedDTDL = Serializer.SerializeTwin(twinObject);
JsonAssert.Equal(twinDTDL, expectedDTDL);
}
public static IEnumerable<object[]> ModelTestData()
{
yield return new object[] {
DataGenerator.SimpleTwinModel,
DataGenerator.simpleTwin.GetType()
};
yield return new object[] {
DataGenerator.TwinWithAllAttributesModel,
DataGenerator.twinWithAllAttributes.GetType()
};
yield return new object[] {
DataGenerator.TwinWithNestedObjectModel,
DataGenerator.twinWithNestedObject.GetType()
};
yield return new object[] {
DataGenerator.TwinWithRelationshipModel,
DataGenerator.twinWithRelationship.GetType()
};
yield return new object[] {
DataGenerator.TwinWithMinMultiplicityModel,
typeof(TwinWithMinMultiplicity)
};
}
public static IEnumerable<object[]> TwinTestData()
{
yield return new object[] {
DataGenerator.SimpleTwinDTDL,
DataGenerator.simpleTwin
};
yield return new object[] {
DataGenerator.TwinWithAllAttributesDTDL,
DataGenerator.twinWithAllAttributes
};
yield return new object[] {
DataGenerator.TwinWithNestedObjectDTDL,
DataGenerator.twinWithNestedObject
};
yield return new object[] {
DataGenerator.TwinWithRelationshipDTDL,
DataGenerator.twinWithRelationship
};
}
}
}
| 32.793478 | 83 | 0.613855 |
[
"Apache-2.0"
] |
sgryphon/DigitalTwins-CodeFirst-dotnet
|
Tests/Telstra.Twins.Test/SerializationTests.cs
| 3,019 |
C#
|
using System;
using System.Linq;
using System.Linq.Expressions;
using DevExpress.Xpo;
using Fasterflect;
namespace Xpand.Extensions.XAF.Xpo.SessionExtensions {
public static partial class SessionExtensions {
public static T EnsureObject<T>(this Session session, Expression<Func<T, bool>> criteriaExpression,
Action<T> initialize,bool inTransaction=false) {
var query = session.Query<T>();
if (inTransaction) {
query = query.InTransaction();
}
var ensureObject = query.FirstOrDefault(criteriaExpression);
if (ensureObject != null) {
return ensureObject;
}
ensureObject = (T)typeof(T).CreateInstance(session);
initialize(ensureObject);
return ensureObject;
}
}
}
| 33.56 | 107 | 0.622169 |
[
"Apache-2.0"
] |
eXpandFramework/Packages
|
src/Extensions/Xpand.Extensions.XAF.Xpo/SessionExtensions/EnsureObject.cs
| 841 |
C#
|
using Lucene.Net.Support;
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
namespace Lucene.Net.Facet.Taxonomy
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using LruTaxonomyWriterCache = Lucene.Net.Facet.Taxonomy.WriterCache.LruTaxonomyWriterCache;
using NameHashInt32CacheLRU = Lucene.Net.Facet.Taxonomy.WriterCache.NameHashInt32CacheLRU;
/// <summary>
/// Holds a sequence of string components, specifying the hierarchical name of a
/// category.
///
/// @lucene.internal
/// </summary>
public class FacetLabel : IComparable<FacetLabel>
{
private static readonly int BYTE_BLOCK_SIZE = Lucene.Net.Util.ByteBlockPool.BYTE_BLOCK_SIZE;
/*
* copied from DocumentWriterPerThread -- if a FacetLabel is resolved to a
* drill-down term which is encoded to a larger term than that length, it is
* silently dropped! Therefore we limit the number of characters to MAX/4 to
* be on the safe side.
*/
/// <summary>
/// The maximum number of characters a <see cref="FacetLabel"/> can have.
/// </summary>
public static readonly int MAX_CATEGORY_PATH_LENGTH = (BYTE_BLOCK_SIZE - 2) / 4;
/// <summary>
/// The components of this <see cref="FacetLabel"/>. Note that this array may be
/// shared with other <see cref="FacetLabel"/> instances, e.g. as a result of
/// <see cref="Subpath(int)"/>, therefore you should traverse the array up to
/// <see cref="Length"/> for this path's components.
/// </summary>
[WritableArray]
[SuppressMessage("Microsoft.Performance", "CA1819", Justification = "Lucene's design requires some writable array properties")]
public string[] Components { get; private set; }
/// <summary>
/// The number of components of this <see cref="FacetLabel"/>.
/// </summary>
public int Length { get; private set; }
// Used by subpath
private FacetLabel(FacetLabel copyFrom, int prefixLen)
{
// while the code which calls this method is safe, at some point a test
// tripped on AIOOBE in toString, but we failed to reproduce. adding the
// assert as a safety check.
Debug.Assert(prefixLen >= 0 && prefixLen <= copyFrom.Components.Length, "prefixLen cannot be negative nor larger than the given components' length: prefixLen=" + prefixLen + " components.length=" + copyFrom.Components.Length);
this.Components = copyFrom.Components;
Length = prefixLen;
}
/// <summary>
/// Construct from the given path components.
/// </summary>
public FacetLabel(params string[] components)
{
this.Components = components;
Length = components.Length;
CheckComponents();
}
/// <summary>
/// Construct from the dimension plus the given path components.
/// </summary>
public FacetLabel(string dim, string[] path)
{
Components = new string[1 + path.Length];
Components[0] = dim;
Array.Copy(path, 0, Components, 1, path.Length);
Length = Components.Length;
CheckComponents();
}
private void CheckComponents()
{
long len = 0;
foreach (string comp in Components)
{
if (string.IsNullOrEmpty(comp))
{
throw new System.ArgumentException("empty or null components not allowed: " + Arrays.ToString(Components));
}
len += comp.Length;
}
len += Components.Length - 1; // add separators
if (len > MAX_CATEGORY_PATH_LENGTH)
{
throw new System.ArgumentException("category path exceeds maximum allowed path length: max=" + MAX_CATEGORY_PATH_LENGTH + " len=" + len + " path=" + Arrays.ToString(Components).Substring(0, 30) + "...");
}
}
/// <summary>
/// Compares this path with another <see cref="FacetLabel"/> for lexicographic
/// order.
/// </summary>
public virtual int CompareTo(FacetLabel other)
{
int len = Length < other.Length ? Length : other.Length;
for (int i = 0, j = 0; i < len; i++, j++)
{
int cmp = Components[i].CompareToOrdinal(other.Components[j]);
if (cmp < 0)
{
return -1; // this is 'before'
}
if (cmp > 0)
{
return 1; // this is 'after'
}
}
// one is a prefix of the other
return Length - other.Length;
}
public override bool Equals(object obj)
{
if (!(obj is FacetLabel))
{
return false;
}
FacetLabel other = (FacetLabel)obj;
if (Length != other.Length)
{
return false; // not same length, cannot be equal
}
// CategoryPaths are more likely to differ at the last components, so start
// from last-first
for (int i = Length - 1; i >= 0; i--)
{
if (!string.Equals(Components[i], other.Components[i]))
{
return false;
}
}
return true;
}
public override int GetHashCode()
{
if (Length == 0)
{
return 0;
}
int hash = Length;
for (int i = 0; i < Length; i++)
{
hash = hash * 31 + Components[i].GetHashCode();
}
return hash;
}
/// <summary>
/// Calculate a 64-bit hash function for this path. This
/// is necessary for <see cref="NameHashInt32CacheLRU"/> (the
/// default cache impl for <see cref="LruTaxonomyWriterCache"/>)
/// to reduce the chance of "silent but deadly" collisions.
/// <para/>
/// NOTE: This was longHashCode() in Lucene
/// </summary>
public virtual long Int64HashCode()
{
if (Length == 0)
{
return 0;
}
long hash = Length;
for (int i = 0; i < Length; i++)
{
hash = hash * 65599 + Components[i].GetHashCode();
}
return hash;
}
/// <summary>
/// Returns a sub-path of this path up to <paramref name="length"/> components.
/// </summary>
public virtual FacetLabel Subpath(int length)
{
if (length >= this.Length || length < 0)
{
return this;
}
else
{
return new FacetLabel(this, length);
}
}
/// <summary>
/// Returns a string representation of the path.
/// </summary>
public override string ToString()
{
if (Length == 0)
{
return "FacetLabel: []";
}
string[] parts = new string[Length];
Array.Copy(Components, 0, parts, 0, Length);
return "FacetLabel: [" + Arrays.ToString(parts) + "]";
}
}
}
| 36.295652 | 238 | 0.540249 |
[
"Apache-2.0"
] |
b9chris/lucenenet
|
src/Lucene.Net.Facet/Taxonomy/FacetLabel.cs
| 8,350 |
C#
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Speq.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute( "System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0" )]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute( "Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode" )]
internal Resources () {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute( global::System.ComponentModel.EditorBrowsableState.Advanced )]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if ( ( resourceMan == null ) ) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager( "Speq.Properties.Resources", typeof( Resources ).Assembly );
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute( global::System.ComponentModel.EditorBrowsableState.Advanced )]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
| 42.888889 | 174 | 0.6151 |
[
"MIT"
] |
team-unhinged/Speq
|
Speq/Properties/Resources.Designer.cs
| 2,704 |
C#
|
/*
Myrtille: A native HTML4/5 Remote Desktop Protocol client.
Copyright(c) 2014-2021 Cedric Coste
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.Web;
using System.Web.SessionState;
using Microsoft.Web.WebSockets;
namespace Myrtille.Web
{
public class AudioSocketHandler : IHttpHandler, IReadOnlySessionState
{
public void ProcessRequest(HttpContext context)
{
if (context.IsWebSocketRequest)
{
context.AcceptWebSocketRequest(
new RemoteSessionAudioSocketHandler(
context,
string.IsNullOrEmpty(context.Request["binary"]) ? true : context.Request["binary"] == "true"));
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
| 30.413043 | 119 | 0.63045 |
[
"Apache-2.0"
] |
Servitus-Nederland/myrtille
|
Myrtille.Web/handlers/AudioSocketHandler.ashx.cs
| 1,401 |
C#
|
using UnityEngine;
#if BIBCAM_HAS_UNITY_VIDEO
using UnityEngine.Video;
#endif
namespace Bibcam.Decoder {
sealed class BibcamVideoFeeder : MonoBehaviour
{
#if BIBCAM_HAS_UNITY_VIDEO
#region Scene object reference
[SerializeField] BibcamMetadataDecoder _decoder = null;
[SerializeField] BibcamTextureDemuxer _demuxer = null;
[SerializeField] bool _asynchronous = true;
#endregion
#region MonoBehaviour implementation
BibcamFrameFeeder _feeder;
void OnDestroy()
{
_feeder?.Dispose();
_feeder = null;
}
void Update()
{
var player = GetComponent<VideoPlayer>();
if (player.texture == null) return;
if (_asynchronous)
{
// Async mode: Use FrameFeeder.
_feeder = _feeder ?? new BibcamFrameFeeder(_decoder, _demuxer);
_feeder.AddFrame(player.texture);
_feeder.Update();
}
else
{
// Sync mode: Simply decode and demux.
_decoder.DecodeSync(player.texture);
_demuxer.Demux(player.texture, _decoder.Metadata);
return;
}
}
#endregion
#else
void OnValidate()
=> Debug.LogError("UnityEngine.Video is missing.");
#endif
}
} // namespace Bibcam.Decoder
| 20.854839 | 75 | 0.62645 |
[
"Unlicense"
] |
keijiro/Bibcam
|
Packages/jp.keijiro.bibcam/Decoder/Scripts/BibcamVideoFeeder.cs
| 1,293 |
C#
|
using System;
namespace com.opentrigger.distributord
{
public static class ConfigExtensions
{
public static Uri BuildButtonUri(this ButtonConfiguration buttonConfig) => buttonConfig.BuildUri(buttonConfig.ButtonPath);
public static Uri BuildLedUri(this ButtonConfiguration buttonConfig) => buttonConfig.BuildUri(buttonConfig.LedPath);
private static Uri BuildUri(this ButtonConfiguration buttonConfig, string path)
{
if (string.IsNullOrWhiteSpace(buttonConfig.BaseUri)) return null;
var ub = new UriBuilder(buttonConfig.BaseUri) { Path = path };
return ub.Uri;
}
}
}
| 38.588235 | 130 | 0.708841 |
[
"MIT"
] |
acolono/opentrigger-distributor
|
com.opentrigger.distributor/lib/ConfigExtensions.cs
| 658 |
C#
|
using System;
using System.Collections.Generic;
using System.Text;
namespace TeacherControl.Core.DTOs
{
public class QuestionnaireResultDTO
{
public string Title { get; set; }
public double QuestionnairePoints { get; set; }
public double UserPoints { get; set; }
public bool IsPassed { get; set; }
}
}
| 23.2 | 55 | 0.663793 |
[
"MIT"
] |
em-torres/teacher-control
|
TeacherControl/TeacherControl.Core/DTOs/QuestionnaireDTOs/QuestionnaireResultDTO.cs
| 350 |
C#
|
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace VinesMod.Items.Tools
{
public class FossilYellowHamaxe : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("FossilYellow Hamaxe");
}
public override void SetDefaults()
{
item.damage = 15;
item.melee = true;
item.width = 40;
item.height = 40;
item.useTime = 20;
item.useAnimation = 20;
item.axe = 20;
item.hammer = 55;
item.useStyle = 1;
item.knockBack = 6;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DesertFossil, 30);
recipe.AddIngredient(ItemID.Topaz, 5);
recipe.AddRecipeGroup("IronBar", 7);
recipe.AddRecipeGroup("Wood", 20);
recipe.AddIngredient(mod, "ShardRed", 15);
recipe.AddTile(mod.TileType("StarForge"));
recipe.SetResult(this);
recipe.AddRecipe();
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(10) == 0)
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("SparkleBlue"));
}
}
}
}
| 23.290909 | 119 | 0.68306 |
[
"CC0-1.0"
] |
vinesmsuic/Vines-Terraria-Mod
|
Items/Tools/FossilYellowHamaxe.cs
| 1,281 |
C#
|
using System;
using System.Windows.Forms;
namespace KaupischITC.Shared
{
/// <summary>
/// Eine Textbox, die schnelle Eingaben berücksichtigt und das TextChanged-Ereignis erst auslöst, wenn nach der letzten Eingabe eine bestimmte Zeit verstrichen ist
/// </summary>
public class DelayTextBox : TextBox
{
private Timer timer = new Timer(); // Timer, der nach einer bestimmten Zeit das OnTextChanged-Ereignis auslöst
/// <summary>
/// Die Zeitspanne (in ms), nach einer Texteingabe ohne erneute Eingabe vergehen muss, bis das OnTextChanged-Ereignis ausgelöst wird
/// </summary>
public int TextChangedDelay
{
get { return this.timer.Interval; }
set { this.timer.Interval = value; }
}
/// <summary>
/// Erstellt eine neue Textbox, die schnelle Eingaben berücksichtigt und das OnTextChanged-Ereignis erst auslöst, wenn nach der letzten Eingabe eine bestimmte Zeit verstrichen ist
/// </summary>
public DelayTextBox()
{
this.timer.Tick += this.OnTimerTick;
}
/// <summary>
/// Timerablauf, der das OnTextChanged-Event auslöst
/// </summary>
private void OnTimerTick(object sender,EventArgs e)
{
this.timer.Enabled = false;
base.OnTextChanged(new EventArgs());
}
/// <summary>
/// OnTextChanged abfangen und Timer (neu)starten
/// </summary>
protected override void OnTextChanged(EventArgs e)
{
if (this.Focused)
{
this.timer.Enabled = false;
this.timer.Enabled = true;
}
else
base.OnTextChanged(e);
}
/// <summary>
/// Vor dem Leave ggf. ein ausstehendes TextChanged auslösen
/// </summary>
protected override void OnLeave(EventArgs e)
{
if (this.timer.Enabled)
this.OnTimerTick(this,e);
base.OnLeave(e);
}
}
}
| 26.558824 | 182 | 0.668328 |
[
"MIT"
] |
Kaupisch-IT/KaupischIT.Shared
|
KaupischITC.Shared/Controls/DelayTextBox.cs
| 1,816 |
C#
|
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
using NMF.Collections.Generic;
using NMF.Collections.ObjectModel;
using NMF.Expressions;
using NMF.Expressions.Linq;
using NMF.Models;
using NMF.Models.Collections;
using NMF.Models.Expressions;
using NMF.Models.Meta;
using NMF.Models.Repository;
using NMF.Serialization;
using NMF.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
namespace NMF.SynchronizationsBenchmark.Runtime
{
/// <summary>
/// The public interface for TGGRuleMorphism
/// </summary>
[DefaultImplementationTypeAttribute(typeof(TGGRuleMorphism))]
[XmlDefaultImplementationTypeAttribute(typeof(TGGRuleMorphism))]
public interface ITGGRuleMorphism : NMF.Models.IModelElement
{
/// <summary>
/// The ruleName property
/// </summary>
string RuleName
{
get;
set;
}
/// <summary>
/// Gets fired before the RuleName property changes its value
/// </summary>
event System.EventHandler<ValueChangedEventArgs> RuleNameChanging;
/// <summary>
/// Gets fired when the RuleName property changed its value
/// </summary>
event System.EventHandler<ValueChangedEventArgs> RuleNameChanged;
}
}
| 29.265625 | 96 | 0.630005 |
[
"Apache-2.0"
] |
NMFCode/SynchronizationsBenchmark
|
Metamodels/eMoflonTGGRuntime/ITGGRuleMorphism.cs
| 1,875 |
C#
|
namespace Miracle.Common.Infrastructure
{
/// <summary>
/// 服务提供者访问器接口
/// </summary>
public interface IServiceProviderAccessor
{
IServiceProvider ServiceProvider { get; }
}
}
| 20.8 | 49 | 0.639423 |
[
"MIT"
] |
GardeningX/Miracle.Common
|
Miracle.Common/Infrastructure/IServiceProviderAccessor.cs
| 230 |
C#
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CacheTower.Providers.Redis;
using CacheTower.Tests.Utils;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using StackExchange.Redis;
namespace CacheTower.Tests.Providers.Redis
{
[TestClass]
public class RedisCacheLayerTests : BaseCacheLayerTests
{
[TestInitialize]
public void Setup()
{
RedisHelper.ResetState();
}
[TestMethod]
public async Task GetSetCache()
{
await AssertGetSetCacheAsync(new RedisCacheLayer(RedisHelper.GetConnection()));
}
[TestMethod]
public async Task IsCacheAvailable()
{
await AssertCacheAvailabilityAsync(new RedisCacheLayer(RedisHelper.GetConnection()), true);
var connectionMock = new Mock<IConnectionMultiplexer>();
var databaseMock = new Mock<IDatabase>();
connectionMock.Setup(cm => cm.GetDatabase(It.IsAny<int>(), It.IsAny<object>())).Returns(databaseMock.Object);
databaseMock.Setup(db => db.PingAsync(It.IsAny<CommandFlags>())).Throws<Exception>();
await AssertCacheAvailabilityAsync(new RedisCacheLayer(connectionMock.Object), false);
}
[TestMethod]
public async Task EvictFromCache()
{
await AssertCacheEvictionAsync(new RedisCacheLayer(RedisHelper.GetConnection()));
}
[TestMethod]
public async Task FlushFromCache()
{
await AssertCacheFlushAsync(new RedisCacheLayer(RedisHelper.GetConnection()));
}
[TestMethod]
public async Task CacheCleanup()
{
await AssertCacheCleanupAsync(new RedisCacheLayer(RedisHelper.GetConnection()));
}
[TestMethod]
public async Task CachingComplexTypes()
{
await AssertComplexTypeCachingAsync(new RedisCacheLayer(RedisHelper.GetConnection()));
}
}
}
| 26.253731 | 112 | 0.762365 |
[
"MIT"
] |
TurnerSoftware/CacheTower
|
tests/CacheTower.Tests/Providers/Redis/RedisCacheLayerTests.cs
| 1,761 |
C#
|
using System;
namespace NLog.Loki;
internal static class UnixDateTimeConverter
{
private static readonly DateTime UnixEpoch = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public static long ToUnixTimeNs(DateTime dateTime) => (dateTime.ToUniversalTime() - UnixEpoch).Ticks * 100;
}
| 29 | 111 | 0.748276 |
[
"BSD-3-Clause"
] |
corentinaltepe/nlog.loki
|
src/NLog.Loki/UnixDateTimeConverter.cs
| 290 |
C#
|
namespace java.nio.charset
{
[global::MonoJavaBridge.JavaClass()]
public partial class UnsupportedCharsetException : java.lang.IllegalArgumentException
{
internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
protected UnsupportedCharsetException(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
{
}
public new global::java.lang.String CharsetName
{
get
{
return getCharsetName();
}
}
private static global::MonoJavaBridge.MethodId _m0;
public virtual global::java.lang.String getCharsetName()
{
return global::MonoJavaBridge.JavaBridge.CallSealedClassObjectMethod<java.lang.String>(this, global::java.nio.charset.UnsupportedCharsetException.staticClass, "getCharsetName", "()Ljava/lang/String;", ref global::java.nio.charset.UnsupportedCharsetException._m0) as java.lang.String;
}
private static global::MonoJavaBridge.MethodId _m1;
public UnsupportedCharsetException(java.lang.String arg0) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
{
global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
if (global::java.nio.charset.UnsupportedCharsetException._m1.native == global::System.IntPtr.Zero)
global::java.nio.charset.UnsupportedCharsetException._m1 = @__env.GetMethodIDNoThrow(global::java.nio.charset.UnsupportedCharsetException.staticClass, "<init>", "(Ljava/lang/String;)V");
global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.nio.charset.UnsupportedCharsetException.staticClass, global::java.nio.charset.UnsupportedCharsetException._m1, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
Init(@__env, handle);
}
static UnsupportedCharsetException()
{
global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
global::java.nio.charset.UnsupportedCharsetException.staticClass = @__env.NewGlobalRef(@__env.FindClass("java/nio/charset/UnsupportedCharsetException"));
}
}
}
| 51.236842 | 286 | 0.789933 |
[
"MIT"
] |
JeroMiya/androidmono
|
MonoJavaBridge/android/generated/java/nio/charset/UnsupportedCharsetException.cs
| 1,947 |
C#
|
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace InternalFilters.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InternalApp.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Editor_16x {
get {
object obj = ResourceManager.GetObject("Editor_16x", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Editor_32x {
get {
object obj = ResourceManager.GetObject("Editor_32x", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
| 37.440476 | 177 | 0.570429 |
[
"MIT",
"BSD-3-Clause"
] |
netcharm/PhotoTools_AutoMaskFace
|
Addins/01_Apps/InternalApp/Properties/Resources.Designer.cs
| 3,539 |
C#
|
using AutoMapper;
using MediatR;
using Ordering.Application.Contracts.Persistence;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.Application.Features.Orders.Queries.GetOrdersList
{
public class GetOrdersListQueryHandler : IRequestHandler<GetOrdersListQuery, List<OrdersVm>>
{
private readonly IOrderRepository _orderRepository;
private readonly IMapper _mapper;
public GetOrdersListQueryHandler(IOrderRepository orderRepository, IMapper mapper)
{
_orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
}
public async Task<List<OrdersVm>> Handle(GetOrdersListQuery request,
CancellationToken cancellationToken)
{
var orderList = await _orderRepository.GetOrdersByUserName(request.UserName);
return _mapper.Map<List<OrdersVm>>(orderList);
}
}
}
| 35.6 | 107 | 0.731273 |
[
"MIT"
] |
ChiragPanchal1991/AspnetMicroservices
|
src/Services/Ordering/Ordering.Application/Features/Orders/Queries/GetOrdersList/GetOrdersListQueryHandler.cs
| 1,070 |
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("MvcAuthorization.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MvcAuthorization.Tests")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c5fd6f39-727c-457d-9f5b-bd25f5fac909")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 39.27027 | 85 | 0.728837 |
[
"MIT"
] |
simon-biber/mvcauthorization
|
Source/MvcAuthorization/MvcAuthorization.Tests/Properties/AssemblyInfo.cs
| 1,456 |
C#
|
using Microsoft.Rest;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Bot.Connector
{
public static class ErrorHandling
{
public static async Task HandleErrorAsync(this HttpOperationResponse<object> result)
{
if (!result.Response.IsSuccessStatusCode)
{
APIResponse errorMessage = result.Body as APIResponse;
string _requestContent = null;
if (result.Request != null && result.Request.Content != null)
{
try
{
_requestContent = await result.Request.Content.ReadAsStringAsync().ConfigureAwait(false);
}
catch (ObjectDisposedException)
{
//result.Request.Content is disposed.
_requestContent = null;
}
}
string _responseContent = null;
if (result.Response != null && result.Response.Content != null)
{
try
{
_responseContent = await result.Response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
catch (ObjectDisposedException)
{
_responseContent = null;
}
}
throw new HttpOperationException(String.IsNullOrEmpty(errorMessage?.Message) ? result.Response.ReasonPhrase : errorMessage.Message)
{
Request = new HttpRequestMessageWrapper(result.Request, _requestContent),
Response = new HttpResponseMessageWrapper(result.Response, _responseContent),
Body = result.Body
};
}
}
public static async Task<ObjectT> HandleErrorAsync<ObjectT>(this HttpOperationResponse<object> result)
{
if (!result.Response.IsSuccessStatusCode)
{
APIResponse errorMessage = result.Body as APIResponse;
string _requestContent = null;
if (result.Request != null && result.Request.Content != null)
{
try
{
_requestContent = await result.Request.Content.ReadAsStringAsync().ConfigureAwait(false);
}
catch (ObjectDisposedException)
{
//result.Request.Content is disposed.
_requestContent = null;
}
}
string _responseContent = null;
if (result.Response != null && result.Response.Content != null)
{
try
{
_responseContent = await result.Response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
catch (ObjectDisposedException)
{
_responseContent = null;
}
}
throw new HttpOperationException(String.IsNullOrEmpty(errorMessage?.Message) ? result.Response.ReasonPhrase : errorMessage.Message)
{
Request = new HttpRequestMessageWrapper(result.Request, _requestContent),
Response = new HttpResponseMessageWrapper(result.Response, _responseContent),
Body = result.Body
};
}
if (typeof(ObjectT).IsArray)
{
IList list = (IList)result.Body;
if (list == null)
{
return default(ObjectT);
}
IList array = (IList)Array.CreateInstance(typeof(ObjectT).GetElementType(), list.Count);
int i = 0;
foreach (var el in list)
array[i++] = el;
return (ObjectT)array;
}
return (ObjectT)result.Body;
}
}
}
| 38.297297 | 147 | 0.493766 |
[
"MIT"
] |
BhagiSivaganesh/ChatBots
|
CSharp/Library/Microsoft.Bot.Connector/ErrorHandling.cs
| 4,253 |
C#
|
// <auto-generated>
// 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 Gov.Jag.PillPressRegistry.Interfaces
{
using Microsoft.Rest;
using Models;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Complaints operations.
/// </summary>
public partial interface IComplaints
{
/// <summary>
/// Get entities from bcgov_complaints
/// </summary>
/// <param name='top'>
/// </param>
/// <param name='skip'>
/// </param>
/// <param name='search'>
/// </param>
/// <param name='filter'>
/// </param>
/// <param name='count'>
/// </param>
/// <param name='orderby'>
/// Order items by property values
/// </param>
/// <param name='select'>
/// Select properties to be returned
/// </param>
/// <param name='expand'>
/// Expand related entities
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="OdataerrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
Task<HttpOperationResponse<ComplaintsGetResponseModel>> GetWithHttpMessagesAsync(int? top = default(int?), int? skip = default(int?), string search = default(string), string filter = default(string), bool? count = default(bool?), IList<string> orderby = default(IList<string>), IList<string> select = default(IList<string>), IList<string> expand = default(IList<string>), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Add new entity to bcgov_complaints
/// </summary>
/// <param name='body'>
/// New entity
/// </param>
/// <param name='prefer'>
/// Required in order for the service to return a JSON representation
/// of the object.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="OdataerrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<HttpOperationResponse<MicrosoftDynamicsCRMbcgovComplaint>> CreateWithHttpMessagesAsync(MicrosoftDynamicsCRMbcgovComplaint body, string prefer = "return=representation", Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Get entity from bcgov_complaints by key
/// </summary>
/// <param name='bcgovComplaintid'>
/// key: bcgov_complaintid
/// </param>
/// <param name='select'>
/// Select properties to be returned
/// </param>
/// <param name='expand'>
/// Expand related entities
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="OdataerrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<HttpOperationResponse<MicrosoftDynamicsCRMbcgovComplaint>> GetByKeyWithHttpMessagesAsync(string bcgovComplaintid, IList<string> select = default(IList<string>), IList<string> expand = default(IList<string>), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Delete entity from bcgov_complaints
/// </summary>
/// <param name='bcgovComplaintid'>
/// key: bcgov_complaintid
/// </param>
/// <param name='ifMatch'>
/// ETag
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="OdataerrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<HttpOperationResponse> DeleteWithHttpMessagesAsync(string bcgovComplaintid, string ifMatch = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Update entity in bcgov_complaints
/// </summary>
/// <param name='bcgovComplaintid'>
/// key: bcgov_complaintid
/// </param>
/// <param name='body'>
/// New property values
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="OdataerrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<HttpOperationResponse> UpdateWithHttpMessagesAsync(string bcgovComplaintid, MicrosoftDynamicsCRMbcgovComplaint body, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
| 44.564103 | 501 | 0.608746 |
[
"Apache-2.0"
] |
WadeBarnes/jag-pill-press-registry
|
pill-press-interfaces/Dynamics-Autorest/IComplaints.cs
| 6,952 |
C#
|
namespace MVCProject.View.Inserir
{
partial class frmAddLivro
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.cbEdit = new System.Windows.Forms.ComboBox();
this.cbGenero = new System.Windows.Forms.ComboBox();
this.btAdicionar = new System.Windows.Forms.Button();
this.txtObs = new System.Windows.Forms.TextBox();
this.txtSinopse = new System.Windows.Forms.TextBox();
this.txtISBN = new System.Windows.Forms.TextBox();
this.txtTitulo = new System.Windows.Forms.TextBox();
this.txtReg = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// cbEdit
//
this.cbEdit.DisplayMember = "Nome";
this.cbEdit.FormattingEnabled = true;
this.cbEdit.Location = new System.Drawing.Point(116, 139);
this.cbEdit.Name = "cbEdit";
this.cbEdit.Size = new System.Drawing.Size(251, 24);
this.cbEdit.TabIndex = 31;
this.cbEdit.ValueMember = "Id";
//
// cbGenero
//
this.cbGenero.DisplayMember = "Tipo";
this.cbGenero.FormattingEnabled = true;
this.cbGenero.Location = new System.Drawing.Point(116, 109);
this.cbGenero.Name = "cbGenero";
this.cbGenero.Size = new System.Drawing.Size(251, 24);
this.cbGenero.TabIndex = 30;
this.cbGenero.ValueMember = "Id";
//
// btAdicionar
//
this.btAdicionar.Location = new System.Drawing.Point(68, 246);
this.btAdicionar.Name = "btAdicionar";
this.btAdicionar.Size = new System.Drawing.Size(252, 40);
this.btAdicionar.TabIndex = 29;
this.btAdicionar.Text = "Adicionar";
this.btAdicionar.UseVisualStyleBackColor = true;
//
// txtObs
//
this.txtObs.Location = new System.Drawing.Point(117, 204);
this.txtObs.Name = "txtObs";
this.txtObs.Size = new System.Drawing.Size(250, 22);
this.txtObs.TabIndex = 28;
//
// txtSinopse
//
this.txtSinopse.Location = new System.Drawing.Point(117, 172);
this.txtSinopse.Name = "txtSinopse";
this.txtSinopse.Size = new System.Drawing.Size(251, 22);
this.txtSinopse.TabIndex = 27;
//
// txtISBN
//
this.txtISBN.Location = new System.Drawing.Point(117, 76);
this.txtISBN.Name = "txtISBN";
this.txtISBN.Size = new System.Drawing.Size(251, 22);
this.txtISBN.TabIndex = 26;
//
// txtTitulo
//
this.txtTitulo.Location = new System.Drawing.Point(117, 44);
this.txtTitulo.Name = "txtTitulo";
this.txtTitulo.Size = new System.Drawing.Size(251, 22);
this.txtTitulo.TabIndex = 25;
//
// txtReg
//
this.txtReg.Location = new System.Drawing.Point(118, 12);
this.txtReg.Name = "txtReg";
this.txtReg.Size = new System.Drawing.Size(250, 22);
this.txtReg.TabIndex = 24;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(13, 209);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(96, 17);
this.label7.TabIndex = 23;
this.label7.Text = "Observações:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(13, 175);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(63, 17);
this.label6.TabIndex = 22;
this.label6.Text = "Sinopse:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(13, 144);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(53, 17);
this.label5.TabIndex = 21;
this.label5.Text = "Editora";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(13, 112);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(60, 17);
this.label4.TabIndex = 20;
this.label4.Text = "Genero:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(13, 79);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(43, 17);
this.label3.TabIndex = 19;
this.label3.Text = "ISBN:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 47);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(51, 17);
this.label2.TabIndex = 18;
this.label2.Text = "Titulo :";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 17);
this.label1.TabIndex = 17;
this.label1.Text = "Registro:";
//
// frmAddLivro
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(386, 310);
this.Controls.Add(this.cbEdit);
this.Controls.Add(this.cbGenero);
this.Controls.Add(this.btAdicionar);
this.Controls.Add(this.txtObs);
this.Controls.Add(this.txtSinopse);
this.Controls.Add(this.txtISBN);
this.Controls.Add(this.txtTitulo);
this.Controls.Add(this.txtReg);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "frmAddLivro";
this.Text = "Adicionar Livro";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ComboBox cbEdit;
private System.Windows.Forms.ComboBox cbGenero;
private System.Windows.Forms.Button btAdicionar;
private System.Windows.Forms.TextBox txtObs;
private System.Windows.Forms.TextBox txtSinopse;
private System.Windows.Forms.TextBox txtISBN;
private System.Windows.Forms.TextBox txtTitulo;
private System.Windows.Forms.TextBox txtReg;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
| 40.668182 | 107 | 0.544987 |
[
"MIT"
] |
AndersonAluiz12/GitC
|
05-08-19_09-08-19/MVCProject/MVCProject/View/Inserir/frmAddLivro.Designer.cs
| 8,951 |
C#
|
// Copyright (C) 2020 Road to Agility
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the
// Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110-1301, USA.
//
using System;
namespace AppFabric.Persistence.ReadModel
{
public class ActivityProjection
{
public ActivityProjection()
{
}
public ActivityProjection(string status, string description, Guid activityId, Guid projectId)
{
ActivityId = activityId;
Status = status;
Description = description;
ProjectId = projectId;
}
public Guid ActivityId { get; set; }
public string Status { get; set; }
public string Description { get; set; }
public Guid ProjectId { get; set; }
public static ActivityProjection Empty()
{
return new ActivityProjection(String.Empty, String.Empty, Guid.Empty, Guid.Empty);
}
}
}
| 32.061224 | 101 | 0.666454 |
[
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] |
roadtoagility/dflow
|
samples/DFlow.Samples.Persistence.EntityFramework/ReadModel/ActivityProjection.cs
| 1,571 |
C#
|
using System;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SplashBot.Services
{
public enum UnsplashChannelType
{
Collection, Search, Random
}
public class UnsplashChannel
{
public string Name { get; set; }
public UnsplashChannelType Type { get; set; }
public string Url { get; set; }
}
public class Wallpaper
{
public string id { get; set; }
public string title { get; set; }
public string Url { get; set; }
}
internal class UnsplashService
{
public async Task<Wallpaper> GetWallpaper(UnsplashChannel channel)
{
string screenWidth = Screen.PrimaryScreen.Bounds.Width.ToString();
string screenHeight = Screen.PrimaryScreen.Bounds.Height.ToString();
var resolution = $"{screenWidth}x{screenHeight}";
string url;
switch (channel.Type)
{
case UnsplashChannelType.Collection:
url = $@"https://source.unsplash.com/collection/{channel.Url}/{resolution}";
break;
case UnsplashChannelType.Search:
url = $@"https://source.unsplash.com/featured/{resolution}/?{channel.Url}";
break;
case UnsplashChannelType.Random:
url = @"https://source.unsplash.com/random";
break;
default:
throw new ArgumentOutOfRangeException();
}
return new Wallpaper { Url = url };
}
}
}
| 28.767857 | 96 | 0.556176 |
[
"MIT"
] |
RSchwoerer/SplashBot
|
source/Services/UnsplashService.cs
| 1,613 |
C#
|
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CreateAssetMenu(fileName = "ItemData", menuName = "Data/Item Data", order = 1)]
public class ItemData : ScriptableObject
{
public string itemName = "";
public string description = "";
public Sprite sprite = null;
}
| 25.230769 | 80 | 0.731707 |
[
"MIT"
] |
hsandt/LD44
|
Assets/Game/Scripts/Item/ItemData.cs
| 330 |
C#
|
#region Copyright (c) all rights reserved.
// <copyright file="AssemblyInfoVersion.cs">
// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// </copyright>
#endregion
using System.Reflection;
// This is modified every time the DittoEdw.Core.ServiceHost or DittoEdw.Etl.Core projects are built
// It is shared across all assemblies so they all increment together.
// You should commit changes to this file when you have been making changes to either the DittoEdw.Etl.Core
// project or any of the ServiceHost projects.
[assembly: AssemblyFileVersion("1.0.0.0")]
| 46 | 107 | 0.78125 |
[
"MIT"
] |
jsnape/ditto
|
shared/AssemblyInfoVersion.cs
| 736 |
C#
|
using System;
using System.Collections.Generic;
using System.Text;
using MediatR;
namespace SFA.DAS.Campaign.Application.Queries.Articles
{
public class GetArticleByHubAndSlugQuery : IRequest<GetArticleByHubAndSlugQueryResult>
{
public string Hub { get; set; }
public string Slug { get; set; }
}
}
| 23.428571 | 90 | 0.72561 |
[
"MIT"
] |
SkillsFundingAgency/das-apim-endpoints
|
src/SFA.DAS.Campaign/Application/Queries/Articles/GetArticleByHubAndSlugQuery.cs
| 330 |
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("primjer05")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("primjer05")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fe6e2dcf-7b82-4af6-add1-47052eb388b0")]
// 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.594595 | 84 | 0.744069 |
[
"Apache-2.0"
] |
jasarsoft/ipcs-primjeri
|
ipcs_40/primjer05/Properties/AssemblyInfo.cs
| 1,394 |
C#
|
namespace MNote.Services.Mapping
{
using AutoMapper;
public interface IHaveCustomMappings
{
void CreateMappings(IProfileExpression configuration);
}
}
| 17.7 | 62 | 0.717514 |
[
"MIT"
] |
todorovmartin/MNote
|
Services/MNote.Services.Mapping/IHaveCustomMappings.cs
| 179 |
C#
|
// Created by Ron 'Maxwolf' McDowell ([email protected])
// Timestamp 01/03/2016@1:50 AM
using WolfCurses.Window;
using WolfCurses.Window.Form;
namespace OregonTrailDotNet.Window.GameOver
{
/// <summary>
/// Fired when the simulation has determined the player has died. It specifically only attaches at this time. The flow
/// for death like this is to first show the player the failure state like this, then ask if they want to leave an
/// epitaph, process that decision, confirm it, and finally show the viewer that will also show the reason why the
/// player died using description attribute from an enumeration value that determines how they died.
/// </summary>
[ParentWindow(typeof(GameOver))]
public sealed class GameFail : Form<GameOverInfo>
{
/// <summary>
/// Initializes a new instance of the <see cref="GameFail" /> class.
/// This constructor will be used by the other one
/// </summary>
/// <param name="window">The window.</param>
// ReSharper disable once UnusedMember.Global
public GameFail(IWindow window) : base(window)
{
}
/// <summary>
/// Determines if user input is currently allowed to be typed and filled into the input buffer.
/// </summary>
/// <remarks>Default is FALSE. Setting to TRUE allows characters and input buffer to be read when submitted.</remarks>
public override bool InputFillsBuffer => false;
/// <summary>
/// Determines if this dialog state is allowed to receive any input at all, even empty line returns. This is useful for
/// preventing the player from leaving a particular dialog until you are ready or finished processing some data.
/// </summary>
public override bool AllowInput => false;
/// <summary>
/// Returns a text only representation of the current game Windows state. Could be a statement, information, question
/// waiting input, etc.
/// </summary>
/// <returns>
/// The <see cref="string" />.
/// </returns>
public override string OnRenderForm()
{
// Jump right to tombstone game window, it will reset the game.
GameSimulationApp.Instance.WindowManager.Add(typeof(Graveyard.Graveyard));
return string.Empty;
}
/// <summary>Fired when the game Windows current state is not null and input buffer does not match any known command.</summary>
/// <param name="input">Contents of the input buffer which didn't match any known command in parent game Windows.</param>
public override void OnInputBufferReturned(string input)
{
}
}
}
| 46.616667 | 135 | 0.642832 |
[
"MIT"
] |
Auropath/OregonTrail
|
src/Window/GameOver/GameFail.cs
| 2,799 |
C#
|
// -----------------------------------------------------------------------
// <copyright file="LeadSourceViewModel.cs" company="Nodine Legal, LLC">
// Licensed to Nodine Legal, LLC under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. Nodine Legal, LLC 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.
// </copyright>
// -----------------------------------------------------------------------
namespace OpenLawOffice.Web.ViewModels.Leads
{
using AutoMapper;
using Common.Models;
[MapMe]
public class LeadSourceViewModel : CoreViewModel
{
public int? Id { get; set; }
public LeadSourceTypeViewModel Type { get; set; }
public Contacts.ContactViewModel Contact { get; set; }
public string Title { get; set; }
public string AdditionalQuestion1 { get; set; }
public string AdditionalData1 { get; set; }
public string AdditionalQuestion2 { get; set; }
public string AdditionalData2 { get; set; }
public void BuildMappings()
{
Mapper.CreateMap<Common.Models.Leads.LeadSource, LeadSourceViewModel>()
.ForMember(dst => dst.IsStub, opt => opt.UseValue(false))
.ForMember(dst => dst.Created, opt => opt.MapFrom(src => src.Created))
.ForMember(dst => dst.Modified, opt => opt.MapFrom(src => src.Modified))
.ForMember(dst => dst.Disabled, opt => opt.MapFrom(src => src.Disabled))
.ForMember(dst => dst.CreatedBy, opt => opt.ResolveUsing(db =>
{
return new ViewModels.Account.UsersViewModel()
{
PId = db.CreatedBy.PId,
IsStub = true
};
}))
.ForMember(dst => dst.ModifiedBy, opt => opt.ResolveUsing(db =>
{
return new ViewModels.Account.UsersViewModel()
{
PId = db.ModifiedBy.PId,
IsStub = true
};
}))
.ForMember(dst => dst.DisabledBy, opt => opt.ResolveUsing(db =>
{
if (db.DisabledBy == null || !db.DisabledBy.PId.HasValue) return null;
return new ViewModels.Account.UsersViewModel()
{
PId = db.DisabledBy.PId.Value,
IsStub = true
};
}))
.ForMember(dst => dst.Id, opt => opt.MapFrom(src => src.Id))
.ForMember(dst => dst.Type, opt => opt.ResolveUsing(db =>
{
if (db.Type == null || !db.Type.Id.HasValue) return null;
return new ViewModels.Leads.LeadSourceTypeViewModel()
{
Id = db.Type.Id.Value,
IsStub = true
};
}))
.ForMember(dst => dst.Contact, opt => opt.ResolveUsing(db =>
{
if (db.Contact == null || !db.Contact.Id.HasValue) return null;
return new ViewModels.Contacts.ContactViewModel()
{
Id = db.Contact.Id.Value,
IsStub = true
};
}))
.ForMember(dst => dst.Title, opt => opt.MapFrom(src => src.Title))
.ForMember(dst => dst.AdditionalQuestion1, opt => opt.MapFrom(src => src.AdditionalQuestion1))
.ForMember(dst => dst.AdditionalData1, opt => opt.MapFrom(src => src.AdditionalData1))
.ForMember(dst => dst.AdditionalQuestion2, opt => opt.MapFrom(src => src.AdditionalQuestion2))
.ForMember(dst => dst.AdditionalData2, opt => opt.MapFrom(src => src.AdditionalData2));
Mapper.CreateMap<LeadSourceViewModel, Common.Models.Leads.LeadSource>()
.ForMember(dst => dst.Created, opt => opt.MapFrom(src => src.Created))
.ForMember(dst => dst.Modified, opt => opt.MapFrom(src => src.Modified))
.ForMember(dst => dst.Disabled, opt => opt.MapFrom(src => src.Disabled))
.ForMember(dst => dst.CreatedBy, opt => opt.ResolveUsing(x =>
{
if (x.CreatedBy == null || !x.CreatedBy.PId.HasValue)
return null;
return new ViewModels.Account.UsersViewModel()
{
PId = x.CreatedBy.PId
};
}))
.ForMember(dst => dst.ModifiedBy, opt => opt.ResolveUsing(x =>
{
if (x.CreatedBy == null || !x.CreatedBy.PId.HasValue)
return null;
return new ViewModels.Account.UsersViewModel()
{
PId = x.ModifiedBy.PId
};
}))
.ForMember(dst => dst.DisabledBy, opt => opt.ResolveUsing(x =>
{
if (x.DisabledBy == null || !x.DisabledBy.PId.HasValue)
return null;
return new ViewModels.Account.UsersViewModel()
{
PId = x.DisabledBy.PId.Value
};
}))
.ForMember(dst => dst.Id, opt => opt.MapFrom(src => src.Id))
.ForMember(dst => dst.Type, opt => opt.ResolveUsing(x =>
{
if (x.Type == null || !x.Type.Id.HasValue)
return null;
return new ViewModels.Leads.LeadSourceTypeViewModel()
{
Id = x.Type.Id.Value
};
}))
.ForMember(dst => dst.Contact, opt => opt.ResolveUsing(x =>
{
if (x.Contact == null || !x.Contact.Id.HasValue)
return null;
return new ViewModels.Contacts.ContactViewModel()
{
Id = x.Contact.Id.Value
};
}))
.ForMember(dst => dst.Title, opt => opt.MapFrom(src => src.Title))
.ForMember(dst => dst.AdditionalQuestion1, opt => opt.MapFrom(src => src.AdditionalQuestion1))
.ForMember(dst => dst.AdditionalData1, opt => opt.MapFrom(src => src.AdditionalData1))
.ForMember(dst => dst.AdditionalQuestion2, opt => opt.MapFrom(src => src.AdditionalQuestion2))
.ForMember(dst => dst.AdditionalData2, opt => opt.MapFrom(src => src.AdditionalData2));
}
}
}
| 47.2625 | 111 | 0.483999 |
[
"Apache-2.0"
] |
ozguryilmaz07/HUKUKOFIS
|
ViewModels/Leads/LeadSourceViewModel.cs
| 7,564 |
C#
|
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
class Example
{
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/console
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string authToken = "your_auth_token";
TwilioClient.Init(accountSid, authToken);
var calls = CallResource.Read(status: CallResource.StatusEnum.Completed,
startTimeAfter: new DateTime(2009, 07, 06));
foreach (var call in calls)
{
Console.WriteLine(call.To);
}
}
}
| 29.75 | 82 | 0.644258 |
[
"MIT"
] |
Abubakar672/api-snippets
|
rest/call/list-get-example-3/list-get-example-3.5.x.cs
| 714 |
C#
|
using ChameleonForms.Component;
using ChameleonForms.Component.Config;
using ChameleonForms.Enums;
using ChameleonForms.FieldGenerators;
using ChameleonForms.FieldGenerators.Handlers;
using ChameleonForms.Templates.TwitterBootstrap3;
using NSubstitute;
using NUnit.Framework;
namespace ChameleonForms.Tests.Templates.TwitterBootstrap3
{
public class PrepareFieldConfigurationTests_TwitterBootstrapTemplateShould
{
private readonly TwitterBootstrapFormTemplate _t = new TwitterBootstrapFormTemplate();
private IFieldConfiguration _fieldConfiguration;
public class TestViewModel { }
[SetUp]
public void Setup()
{
_fieldConfiguration = new FieldConfiguration();
}
private IReadonlyFieldConfiguration Act(FieldDisplayType displayType, FieldParent parent)
{
var fg = Substitute.For<IFieldGenerator<TestViewModel, string>>();
var fgh = Substitute.For<IFieldGeneratorHandler<TestViewModel, string>>();
fgh.GetDisplayType(Arg.Any<IReadonlyFieldConfiguration>()).Returns(displayType);
_t.PrepareFieldConfiguration(fg, fgh, _fieldConfiguration, parent);
return _fieldConfiguration.ToReadonly();
}
[Test]
public void Add_validation_class_of_help_block_when_in_section([Values(FieldParent.Form, FieldParent.Section)] FieldParent parent)
{
var config = Act(FieldDisplayType.SingleLineText, parent);
if (parent == FieldParent.Section)
Assert.That(config.ValidationClasses, Is.EqualTo("help-block"));
else
Assert.That(config.ValidationClasses, Is.Null);
}
[Test]
[Combinatorial]
public void Add_field_class_of_form_control_when_in_section_and_select_input_or_textarea([Values(FieldParent.Form, FieldParent.Section)] FieldParent parent, [Values(FieldDisplayType.SingleLineText, FieldDisplayType.MultiLineText, FieldDisplayType.DropDown)] FieldDisplayType displayType)
{
var config = Act(displayType, parent);
if (parent == FieldParent.Section)
Assert.That(config.HtmlAttributes["class"], Is.EqualTo("form-control"));
else
Assert.That(config.HtmlAttributes.ContainsKey("class"), Is.False);
}
[Test]
[Combinatorial]
public void Add_label_class_of_control_label_when_in_section_and_select_nonfileinput_or_textarea([Values(FieldParent.Form, FieldParent.Section)] FieldParent parent, [Values(FieldDisplayType.SingleLineText, FieldDisplayType.MultiLineText, FieldDisplayType.DropDown)] FieldDisplayType displayType)
{
var config = Act(displayType, parent);
if (parent == FieldParent.Section)
Assert.That(config.LabelClasses, Is.EqualTo("control-label"));
else
Assert.That(config.LabelClasses, Is.Null);
}
[Test]
[Combinatorial]
public void Dont_add_label_class_or_field_class_if_in_section_and_not_select_nonfileinput_or_textarea([Values(FieldDisplayType.Custom, FieldDisplayType.Checkbox, FieldDisplayType.List, FieldDisplayType.FileUpload, FieldDisplayType.Default)] FieldDisplayType displayType)
{
var config = Act(displayType, FieldParent.Section);
Assert.That(config.HtmlAttributes.ContainsKey("class"), Is.False);
Assert.That(config.LabelClasses, Is.Null);
}
[Test]
[Combinatorial]
public void Add_label_class_of_control_label_when_in_section_and_select_input_or_textarea([Values(FieldParent.Form, FieldParent.Section)] FieldParent parent, [Values(FieldDisplayType.SingleLineText, FieldDisplayType.MultiLineText, FieldDisplayType.DropDown)] FieldDisplayType displayType)
{
var config = Act(displayType, parent);
if (parent == FieldParent.Section)
Assert.That(config.LabelClasses, Is.EqualTo("control-label"));
else
Assert.That(config.LabelClasses, Is.Null);
}
[Test]
public void Hide_label_and_set_as_checkbox_control_if_checkbox_and_in_section()
{
_fieldConfiguration.Label("label");
var config = Act(FieldDisplayType.Checkbox, FieldParent.Section);
Assert.That(config.GetBagData<bool>("IsCheckboxControl"), Is.True);
Assert.That(config.LabelText.ToHtmlString(), Is.EqualTo(string.Empty));
Assert.That(config.HasLabel, Is.False);
}
[Test]
public void Leave_label_alone_and_dont_set_as_checkbox_control_if_checkbox_and_in_form()
{
_fieldConfiguration.Label("label");
var config = Act(FieldDisplayType.Checkbox, FieldParent.Form);
Assert.That(config.GetBagData<bool>("IsCheckboxControl"), Is.False);
Assert.That(config.LabelText.ToHtmlString(), Is.EqualTo("label"));
Assert.That(config.HasLabel, Is.True);
}
[Test]
public void Set_control_as_radio_list_if_radio_list_and_in_section([Values(FieldParent.Form, FieldParent.Section)] FieldParent parent)
{
var config = Act(FieldDisplayType.List, parent);
Assert.That(config.GetBagData<bool>("IsRadioOrCheckboxList"), Is.EqualTo(parent == FieldParent.Section));
}
}
}
| 45.073171 | 304 | 0.675144 |
[
"MIT"
] |
jason-roberts/ChameleonForms
|
ChameleonForms.Tests/Templates/TwitterBootstrap3/PrepareFieldConfigurationTests.cs
| 5,546 |
C#
|
using System;
using System.Xml.Serialization;
using System.ComponentModel.DataAnnotations;
using BroadWorksConnector.Ocip.Validation;
using System.Collections.Generic;
namespace BroadWorksConnector.Ocip.Models
{
/// <summary>
/// Response to SystemCallProcessingPolicyProfileCollaborateProfileGetRequest22V2.
/// The following elements are only used in AS data mode:
/// useMaxCallsPerSecond, value "false" is returned in XS data mode.
/// maxCallsPerSecond, value "1" is returned in XS data mode.
/// <see cref="SystemCallProcessingPolicyProfileCollaborateProfileGetRequest22V2"/>
/// </summary>
[Serializable]
[XmlRoot(Namespace = "")]
[Groups(@"[{""__type"":""Sequence:#BroadWorksConnector.Ocip.Validation"",""id"":""7f663d5135470c33ca64b0eed3c3aa0c:3563""}]")]
public class SystemCallProcessingPolicyProfileCollaborateProfileGetResponse22V2 : BroadWorksConnector.Ocip.Models.C.OCIDataResponse
{
private bool _useCLIDPolicy;
[XmlElement(ElementName = "useCLIDPolicy", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseCLIDPolicy
{
get => _useCLIDPolicy;
set
{
UseCLIDPolicySpecified = true;
_useCLIDPolicy = value;
}
}
[XmlIgnore]
protected bool UseCLIDPolicySpecified { get; set; }
private BroadWorksConnector.Ocip.Models.GroupCLIDPolicy _clidPolicy;
[XmlElement(ElementName = "clidPolicy", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public BroadWorksConnector.Ocip.Models.GroupCLIDPolicy ClidPolicy
{
get => _clidPolicy;
set
{
ClidPolicySpecified = true;
_clidPolicy = value;
}
}
[XmlIgnore]
protected bool ClidPolicySpecified { get; set; }
private BroadWorksConnector.Ocip.Models.GroupCLIDPolicy _emergencyClidPolicy;
[XmlElement(ElementName = "emergencyClidPolicy", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public BroadWorksConnector.Ocip.Models.GroupCLIDPolicy EmergencyClidPolicy
{
get => _emergencyClidPolicy;
set
{
EmergencyClidPolicySpecified = true;
_emergencyClidPolicy = value;
}
}
[XmlIgnore]
protected bool EmergencyClidPolicySpecified { get; set; }
private bool _allowAlternateNumbersForRedirectingIdentity;
[XmlElement(ElementName = "allowAlternateNumbersForRedirectingIdentity", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool AllowAlternateNumbersForRedirectingIdentity
{
get => _allowAlternateNumbersForRedirectingIdentity;
set
{
AllowAlternateNumbersForRedirectingIdentitySpecified = true;
_allowAlternateNumbersForRedirectingIdentity = value;
}
}
[XmlIgnore]
protected bool AllowAlternateNumbersForRedirectingIdentitySpecified { get; set; }
private bool _useGroupName;
[XmlElement(ElementName = "useGroupName", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseGroupName
{
get => _useGroupName;
set
{
UseGroupNameSpecified = true;
_useGroupName = value;
}
}
[XmlIgnore]
protected bool UseGroupNameSpecified { get; set; }
private bool _blockCallingNameForExternalCalls;
[XmlElement(ElementName = "blockCallingNameForExternalCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool BlockCallingNameForExternalCalls
{
get => _blockCallingNameForExternalCalls;
set
{
BlockCallingNameForExternalCallsSpecified = true;
_blockCallingNameForExternalCalls = value;
}
}
[XmlIgnore]
protected bool BlockCallingNameForExternalCallsSpecified { get; set; }
private bool _allowConfigurableCLIDForRedirectingIdentity;
[XmlElement(ElementName = "allowConfigurableCLIDForRedirectingIdentity", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool AllowConfigurableCLIDForRedirectingIdentity
{
get => _allowConfigurableCLIDForRedirectingIdentity;
set
{
AllowConfigurableCLIDForRedirectingIdentitySpecified = true;
_allowConfigurableCLIDForRedirectingIdentity = value;
}
}
[XmlIgnore]
protected bool AllowConfigurableCLIDForRedirectingIdentitySpecified { get; set; }
private bool _allowDepartmentCLIDNameOverride;
[XmlElement(ElementName = "allowDepartmentCLIDNameOverride", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool AllowDepartmentCLIDNameOverride
{
get => _allowDepartmentCLIDNameOverride;
set
{
AllowDepartmentCLIDNameOverrideSpecified = true;
_allowDepartmentCLIDNameOverride = value;
}
}
[XmlIgnore]
protected bool AllowDepartmentCLIDNameOverrideSpecified { get; set; }
private BroadWorksConnector.Ocip.Models.EnterpriseInternalCallsCLIDPolicy _enterpriseCallsCLIDPolicy;
[XmlElement(ElementName = "enterpriseCallsCLIDPolicy", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public BroadWorksConnector.Ocip.Models.EnterpriseInternalCallsCLIDPolicy EnterpriseCallsCLIDPolicy
{
get => _enterpriseCallsCLIDPolicy;
set
{
EnterpriseCallsCLIDPolicySpecified = true;
_enterpriseCallsCLIDPolicy = value;
}
}
[XmlIgnore]
protected bool EnterpriseCallsCLIDPolicySpecified { get; set; }
private BroadWorksConnector.Ocip.Models.EnterpriseInternalCallsCLIDPolicy _enterpriseGroupCallsCLIDPolicy;
[XmlElement(ElementName = "enterpriseGroupCallsCLIDPolicy", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public BroadWorksConnector.Ocip.Models.EnterpriseInternalCallsCLIDPolicy EnterpriseGroupCallsCLIDPolicy
{
get => _enterpriseGroupCallsCLIDPolicy;
set
{
EnterpriseGroupCallsCLIDPolicySpecified = true;
_enterpriseGroupCallsCLIDPolicy = value;
}
}
[XmlIgnore]
protected bool EnterpriseGroupCallsCLIDPolicySpecified { get; set; }
private BroadWorksConnector.Ocip.Models.ServiceProviderInternalCallsCLIDPolicy _serviceProviderGroupCallsCLIDPolicy;
[XmlElement(ElementName = "serviceProviderGroupCallsCLIDPolicy", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public BroadWorksConnector.Ocip.Models.ServiceProviderInternalCallsCLIDPolicy ServiceProviderGroupCallsCLIDPolicy
{
get => _serviceProviderGroupCallsCLIDPolicy;
set
{
ServiceProviderGroupCallsCLIDPolicySpecified = true;
_serviceProviderGroupCallsCLIDPolicy = value;
}
}
[XmlIgnore]
protected bool ServiceProviderGroupCallsCLIDPolicySpecified { get; set; }
private bool _useCallLimitsPolicy;
[XmlElement(ElementName = "useCallLimitsPolicy", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseCallLimitsPolicy
{
get => _useCallLimitsPolicy;
set
{
UseCallLimitsPolicySpecified = true;
_useCallLimitsPolicy = value;
}
}
[XmlIgnore]
protected bool UseCallLimitsPolicySpecified { get; set; }
private bool _useMaxSimultaneousCalls;
[XmlElement(ElementName = "useMaxSimultaneousCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseMaxSimultaneousCalls
{
get => _useMaxSimultaneousCalls;
set
{
UseMaxSimultaneousCallsSpecified = true;
_useMaxSimultaneousCalls = value;
}
}
[XmlIgnore]
protected bool UseMaxSimultaneousCallsSpecified { get; set; }
private int _maxSimultaneousCalls;
[XmlElement(ElementName = "maxSimultaneousCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
[MinInclusive(1)]
[MaxInclusive(999999)]
public int MaxSimultaneousCalls
{
get => _maxSimultaneousCalls;
set
{
MaxSimultaneousCallsSpecified = true;
_maxSimultaneousCalls = value;
}
}
[XmlIgnore]
protected bool MaxSimultaneousCallsSpecified { get; set; }
private bool _useMaxSimultaneousVideoCalls;
[XmlElement(ElementName = "useMaxSimultaneousVideoCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseMaxSimultaneousVideoCalls
{
get => _useMaxSimultaneousVideoCalls;
set
{
UseMaxSimultaneousVideoCallsSpecified = true;
_useMaxSimultaneousVideoCalls = value;
}
}
[XmlIgnore]
protected bool UseMaxSimultaneousVideoCallsSpecified { get; set; }
private int _maxSimultaneousVideoCalls;
[XmlElement(ElementName = "maxSimultaneousVideoCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
[MinInclusive(1)]
[MaxInclusive(999999)]
public int MaxSimultaneousVideoCalls
{
get => _maxSimultaneousVideoCalls;
set
{
MaxSimultaneousVideoCallsSpecified = true;
_maxSimultaneousVideoCalls = value;
}
}
[XmlIgnore]
protected bool MaxSimultaneousVideoCallsSpecified { get; set; }
private bool _useMaxCallTimeForAnsweredCalls;
[XmlElement(ElementName = "useMaxCallTimeForAnsweredCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseMaxCallTimeForAnsweredCalls
{
get => _useMaxCallTimeForAnsweredCalls;
set
{
UseMaxCallTimeForAnsweredCallsSpecified = true;
_useMaxCallTimeForAnsweredCalls = value;
}
}
[XmlIgnore]
protected bool UseMaxCallTimeForAnsweredCallsSpecified { get; set; }
private int _maxCallTimeForAnsweredCallsMinutes;
[XmlElement(ElementName = "maxCallTimeForAnsweredCallsMinutes", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
[MinInclusive(3)]
[MaxInclusive(2880)]
public int MaxCallTimeForAnsweredCallsMinutes
{
get => _maxCallTimeForAnsweredCallsMinutes;
set
{
MaxCallTimeForAnsweredCallsMinutesSpecified = true;
_maxCallTimeForAnsweredCallsMinutes = value;
}
}
[XmlIgnore]
protected bool MaxCallTimeForAnsweredCallsMinutesSpecified { get; set; }
private bool _useMaxCallTimeForUnansweredCalls;
[XmlElement(ElementName = "useMaxCallTimeForUnansweredCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseMaxCallTimeForUnansweredCalls
{
get => _useMaxCallTimeForUnansweredCalls;
set
{
UseMaxCallTimeForUnansweredCallsSpecified = true;
_useMaxCallTimeForUnansweredCalls = value;
}
}
[XmlIgnore]
protected bool UseMaxCallTimeForUnansweredCallsSpecified { get; set; }
private int _maxCallTimeForUnansweredCallsMinutes;
[XmlElement(ElementName = "maxCallTimeForUnansweredCallsMinutes", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
[MinInclusive(1)]
[MaxInclusive(2880)]
public int MaxCallTimeForUnansweredCallsMinutes
{
get => _maxCallTimeForUnansweredCallsMinutes;
set
{
MaxCallTimeForUnansweredCallsMinutesSpecified = true;
_maxCallTimeForUnansweredCallsMinutes = value;
}
}
[XmlIgnore]
protected bool MaxCallTimeForUnansweredCallsMinutesSpecified { get; set; }
private bool _useMaxConcurrentRedirectedCalls;
[XmlElement(ElementName = "useMaxConcurrentRedirectedCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseMaxConcurrentRedirectedCalls
{
get => _useMaxConcurrentRedirectedCalls;
set
{
UseMaxConcurrentRedirectedCallsSpecified = true;
_useMaxConcurrentRedirectedCalls = value;
}
}
[XmlIgnore]
protected bool UseMaxConcurrentRedirectedCallsSpecified { get; set; }
private int _maxConcurrentRedirectedCalls;
[XmlElement(ElementName = "maxConcurrentRedirectedCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
[MinInclusive(1)]
[MaxInclusive(999999)]
public int MaxConcurrentRedirectedCalls
{
get => _maxConcurrentRedirectedCalls;
set
{
MaxConcurrentRedirectedCallsSpecified = true;
_maxConcurrentRedirectedCalls = value;
}
}
[XmlIgnore]
protected bool MaxConcurrentRedirectedCallsSpecified { get; set; }
private int _maxRedirectionDepth;
[XmlElement(ElementName = "maxRedirectionDepth", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
[MinInclusive(1)]
[MaxInclusive(100)]
public int MaxRedirectionDepth
{
get => _maxRedirectionDepth;
set
{
MaxRedirectionDepthSpecified = true;
_maxRedirectionDepth = value;
}
}
[XmlIgnore]
protected bool MaxRedirectionDepthSpecified { get; set; }
private bool _useTranslationRoutingPolicy;
[XmlElement(ElementName = "useTranslationRoutingPolicy", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseTranslationRoutingPolicy
{
get => _useTranslationRoutingPolicy;
set
{
UseTranslationRoutingPolicySpecified = true;
_useTranslationRoutingPolicy = value;
}
}
[XmlIgnore]
protected bool UseTranslationRoutingPolicySpecified { get; set; }
private BroadWorksConnector.Ocip.Models.NetworkUsageSelection _networkUsageSelection;
[XmlElement(ElementName = "networkUsageSelection", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public BroadWorksConnector.Ocip.Models.NetworkUsageSelection NetworkUsageSelection
{
get => _networkUsageSelection;
set
{
NetworkUsageSelectionSpecified = true;
_networkUsageSelection = value;
}
}
[XmlIgnore]
protected bool NetworkUsageSelectionSpecified { get; set; }
private bool _enableEnterpriseExtensionDialing;
[XmlElement(ElementName = "enableEnterpriseExtensionDialing", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool EnableEnterpriseExtensionDialing
{
get => _enableEnterpriseExtensionDialing;
set
{
EnableEnterpriseExtensionDialingSpecified = true;
_enableEnterpriseExtensionDialing = value;
}
}
[XmlIgnore]
protected bool EnableEnterpriseExtensionDialingSpecified { get; set; }
private bool _enforceGroupCallingLineIdentityRestriction;
[XmlElement(ElementName = "enforceGroupCallingLineIdentityRestriction", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool EnforceGroupCallingLineIdentityRestriction
{
get => _enforceGroupCallingLineIdentityRestriction;
set
{
EnforceGroupCallingLineIdentityRestrictionSpecified = true;
_enforceGroupCallingLineIdentityRestriction = value;
}
}
[XmlIgnore]
protected bool EnforceGroupCallingLineIdentityRestrictionSpecified { get; set; }
private bool _enforceEnterpriseCallingLineIdentityRestriction;
[XmlElement(ElementName = "enforceEnterpriseCallingLineIdentityRestriction", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool EnforceEnterpriseCallingLineIdentityRestriction
{
get => _enforceEnterpriseCallingLineIdentityRestriction;
set
{
EnforceEnterpriseCallingLineIdentityRestrictionSpecified = true;
_enforceEnterpriseCallingLineIdentityRestriction = value;
}
}
[XmlIgnore]
protected bool EnforceEnterpriseCallingLineIdentityRestrictionSpecified { get; set; }
private bool _allowEnterpriseGroupCallTypingForPrivateDialingPlan;
[XmlElement(ElementName = "allowEnterpriseGroupCallTypingForPrivateDialingPlan", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool AllowEnterpriseGroupCallTypingForPrivateDialingPlan
{
get => _allowEnterpriseGroupCallTypingForPrivateDialingPlan;
set
{
AllowEnterpriseGroupCallTypingForPrivateDialingPlanSpecified = true;
_allowEnterpriseGroupCallTypingForPrivateDialingPlan = value;
}
}
[XmlIgnore]
protected bool AllowEnterpriseGroupCallTypingForPrivateDialingPlanSpecified { get; set; }
private bool _allowEnterpriseGroupCallTypingForPublicDialingPlan;
[XmlElement(ElementName = "allowEnterpriseGroupCallTypingForPublicDialingPlan", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool AllowEnterpriseGroupCallTypingForPublicDialingPlan
{
get => _allowEnterpriseGroupCallTypingForPublicDialingPlan;
set
{
AllowEnterpriseGroupCallTypingForPublicDialingPlanSpecified = true;
_allowEnterpriseGroupCallTypingForPublicDialingPlan = value;
}
}
[XmlIgnore]
protected bool AllowEnterpriseGroupCallTypingForPublicDialingPlanSpecified { get; set; }
private bool _overrideCLIDRestrictionForPrivateCallCategory;
[XmlElement(ElementName = "overrideCLIDRestrictionForPrivateCallCategory", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool OverrideCLIDRestrictionForPrivateCallCategory
{
get => _overrideCLIDRestrictionForPrivateCallCategory;
set
{
OverrideCLIDRestrictionForPrivateCallCategorySpecified = true;
_overrideCLIDRestrictionForPrivateCallCategory = value;
}
}
[XmlIgnore]
protected bool OverrideCLIDRestrictionForPrivateCallCategorySpecified { get; set; }
private bool _useEnterpriseCLIDForPrivateCallCategory;
[XmlElement(ElementName = "useEnterpriseCLIDForPrivateCallCategory", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseEnterpriseCLIDForPrivateCallCategory
{
get => _useEnterpriseCLIDForPrivateCallCategory;
set
{
UseEnterpriseCLIDForPrivateCallCategorySpecified = true;
_useEnterpriseCLIDForPrivateCallCategory = value;
}
}
[XmlIgnore]
protected bool UseEnterpriseCLIDForPrivateCallCategorySpecified { get; set; }
private bool _useIncomingCLIDPolicy;
[XmlElement(ElementName = "useIncomingCLIDPolicy", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseIncomingCLIDPolicy
{
get => _useIncomingCLIDPolicy;
set
{
UseIncomingCLIDPolicySpecified = true;
_useIncomingCLIDPolicy = value;
}
}
[XmlIgnore]
protected bool UseIncomingCLIDPolicySpecified { get; set; }
private bool _enableDialableCallerID;
[XmlElement(ElementName = "enableDialableCallerID", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool EnableDialableCallerID
{
get => _enableDialableCallerID;
set
{
EnableDialableCallerIDSpecified = true;
_enableDialableCallerID = value;
}
}
[XmlIgnore]
protected bool EnableDialableCallerIDSpecified { get; set; }
private bool _includeRedirectionsInMaximumNumberOfConcurrentCalls;
[XmlElement(ElementName = "includeRedirectionsInMaximumNumberOfConcurrentCalls", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool IncludeRedirectionsInMaximumNumberOfConcurrentCalls
{
get => _includeRedirectionsInMaximumNumberOfConcurrentCalls;
set
{
IncludeRedirectionsInMaximumNumberOfConcurrentCallsSpecified = true;
_includeRedirectionsInMaximumNumberOfConcurrentCalls = value;
}
}
[XmlIgnore]
protected bool IncludeRedirectionsInMaximumNumberOfConcurrentCallsSpecified { get; set; }
private bool _useUserPhoneNumberForGroupCallsWhenInternalCLIDUnavailable;
[XmlElement(ElementName = "useUserPhoneNumberForGroupCallsWhenInternalCLIDUnavailable", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseUserPhoneNumberForGroupCallsWhenInternalCLIDUnavailable
{
get => _useUserPhoneNumberForGroupCallsWhenInternalCLIDUnavailable;
set
{
UseUserPhoneNumberForGroupCallsWhenInternalCLIDUnavailableSpecified = true;
_useUserPhoneNumberForGroupCallsWhenInternalCLIDUnavailable = value;
}
}
[XmlIgnore]
protected bool UseUserPhoneNumberForGroupCallsWhenInternalCLIDUnavailableSpecified { get; set; }
private bool _useUserPhoneNumberForEnterpriseCallsWhenInternalCLIDUnavailable;
[XmlElement(ElementName = "useUserPhoneNumberForEnterpriseCallsWhenInternalCLIDUnavailable", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseUserPhoneNumberForEnterpriseCallsWhenInternalCLIDUnavailable
{
get => _useUserPhoneNumberForEnterpriseCallsWhenInternalCLIDUnavailable;
set
{
UseUserPhoneNumberForEnterpriseCallsWhenInternalCLIDUnavailableSpecified = true;
_useUserPhoneNumberForEnterpriseCallsWhenInternalCLIDUnavailable = value;
}
}
[XmlIgnore]
protected bool UseUserPhoneNumberForEnterpriseCallsWhenInternalCLIDUnavailableSpecified { get; set; }
private bool _useMaxCallsPerSecond;
[XmlElement(ElementName = "useMaxCallsPerSecond", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
public bool UseMaxCallsPerSecond
{
get => _useMaxCallsPerSecond;
set
{
UseMaxCallsPerSecondSpecified = true;
_useMaxCallsPerSecond = value;
}
}
[XmlIgnore]
protected bool UseMaxCallsPerSecondSpecified { get; set; }
private int _maxCallsPerSecond;
[XmlElement(ElementName = "maxCallsPerSecond", IsNullable = false, Namespace = "")]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:3563")]
[MinInclusive(1)]
[MaxInclusive(100)]
public int MaxCallsPerSecond
{
get => _maxCallsPerSecond;
set
{
MaxCallsPerSecondSpecified = true;
_maxCallsPerSecond = value;
}
}
[XmlIgnore]
protected bool MaxCallsPerSecondSpecified { get; set; }
}
}
| 36.968661 | 137 | 0.646 |
[
"MIT"
] |
Rogn/broadworks-connector-net
|
BroadworksConnector/Ocip/Models/SystemCallProcessingPolicyProfileCollaborateProfileGetResponse22V2.cs
| 25,952 |
C#
|
using System;
using shpero.Rvr.Protocol;
namespace shpero.Rvr.Commands.SystemInfoDevice
{
[Command(CommandId, DeviceId)]
public class GetFirmwareVersion : Command
{
public const byte CommandId = 0x00;
public const DeviceIdentifier DeviceId = DeviceIdentifier.SystemInfo;
public byte ProcessorId { get; }
public GetFirmwareVersion(byte processorId)
{
ProcessorId = processorId;
}
public override Message ToMessage()
{
var header = new Header(
commandId:CommandId,
targetId:ProcessorId,
deviceId: DeviceId,
sourceId: ApiTargetsAndSources.ServiceSource,
sequence:GetSequenceNumber(),
flags: Flags.DefaultRequestWithResponseFlags);
return new Message(header);
}
}
}
| 27.71875 | 77 | 0.607666 |
[
"MIT"
] |
paulmey/sphero-sdk-net
|
src/shpero.Rvr/Commands/SystemInfoDevice/GetFirmwareVersion.cs
| 889 |
C#
|
using AppBlocks.Models;
using System;
using System.Data;
using System.IO;
using System.Text.Json;
namespace AppBlocks.DataReaders
{
public class FileDataReader : IDataReader
{
protected StreamReader Stream { get; set; }
protected object[] Values;
protected bool Eof { get; set; }
protected string CurrentRecord { get; set; }
protected int CurrentIndex { get; set; }
public string FileName { get; set; }
public FileDataReader(string fileName)
{
FileName = fileName;
Stream = new StreamReader(fileName);
//Values = new object[FieldCount];
}
public void Close()
{
Array.Clear(Values, 0, Values.Length);
Stream.Close();
Stream.Dispose();
}
public int Depth
{
get { return 0; }
}
public DataTable GetSchemaTable()
{// avoid to implement several methods if your scenario do not demand it
try
{
throw new NotImplementedException();
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetSchemaTable():{exception}");
}
return null;
}
public bool IsClosed
{
get { return Eof; }
}
public bool NextResult()
{
return false;
}
public bool Read()
{
if (!FileName.EndsWith(".json"))
{
CurrentRecord = Stream.ReadLine();
} else
{
var contents = Stream.ReadToEnd();
Values = JsonSerializer.Deserialize<Item[]>(contents);
return true;
}
Eof = CurrentRecord == null;
if (!Eof)
{
Fill(Values);
CurrentIndex++;
}
return !Eof;
}
private void Fill(object[] values)
{ // by default, the first position of the array holds the value that will be
// inserted at the first column of the table, and so on
// lets assume here that the primary key is auto-generated
values[0] = null;
values[1] = CurrentRecord.Substring(0, 12).Trim();
values[2] = CurrentRecord.Substring(12, 40).Trim();
} // if the file is csv we could do a Split instead of Substring operations
public int RecordsAffected
{
get { return -1; }
}
public int FieldCount
{
get { return 3; }
}
//public object this[string name] => this[name];
public object this[string name]
{
get { return this[name]; }
}
public IDataReader GetData(int i)
{
if (i == 0)
return this;
return null;
}
public string GetDataTypeName(int i)
{
return "String";
}
public string GetName(int i)
{
return Values[i].ToString();
}
public string GetString(int i)
{
return Values[i].ToString();
}
public object GetValue(int i)
{
return Values[i];
}
public int GetValues(object[] values)
{
Fill(values);
Array.Copy(values, Values, this.FieldCount);
return this.FieldCount;
}
public bool GetBoolean(int i)
{
return Values[i] != null && (Values[i].ToString() == "1" || Values[i].ToString() == "true");
}
public byte GetByte(int i)
{
try
{
if (Values[i] != null) return Convert.ToByte(Values[i]);
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetByte({i}):{exception}");
}
return byte.MinValue;
}
public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
{
try
{
throw new NotImplementedException();
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetBytes({i}):{exception}");
}
return int.MinValue;
}
public char GetChar(int i)
{
try
{
if (Values[i] != null) return Convert.ToChar(Values[i]);
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetChar({i}):{exception}");
}
return char.MinValue;
}
public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
{
try
{
throw new NotImplementedException();
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetChars({i}):{exception}");
}
return long.MinValue;
}
public DateTime GetDateTime(int i)
{
try
{
throw new NotImplementedException();
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetDateTime({i}):{exception}");
}
return DateTime.MinValue;
}
public decimal GetDecimal(int i)
{
try
{
if (Values[i] != null) return Convert.ToDecimal(Values[i]);
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetDecimal({i}):{exception}");
}
return decimal.MinValue;
}
public double GetDouble(int i)
{
try
{
if (Values[i] != null) return Convert.ToDouble(Values[i]);
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetDouble({i}):{exception}");
}
return double.MinValue;
}
public Type GetFieldType(int i)
{
try
{
throw new NotImplementedException();
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetFieldType({i}):{exception}");
}
return null;
}
public float GetFloat(int i)
{
try
{
throw new NotImplementedException();
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetFloat({i}):{exception}");
}
return float.MinValue;
}
public Guid GetGuid(int i)
{
try
{
throw new NotImplementedException();
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetGuid({i}):{exception}");
}
return Guid.Empty;
}
public short GetInt16(int i)
{
try
{
if (Values[i] != null) return Convert.ToInt16(Values[i]);
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetInt16({i}):{exception}");
}
return short.MinValue;
}
public int GetInt32(int i)
{
try
{
if (Values[i] != null) return Convert.ToInt32(Values[i]);
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetInt32({i}):{exception}");
}
return int.MinValue;
}
public long GetInt64(int i)
{
try
{
if (Values[i] != null) return Convert.ToInt64(Values[i]);
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetInt64({i}):{exception}");
}
return long.MinValue;
}
public int GetOrdinal(string name)
{
try
{
throw new NotImplementedException();
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.GetOrdinal({name}):{exception}");
}
return int.MinValue;
}
public bool IsDBNull(int i)
{
try
{
throw new NotImplementedException();
}
catch (Exception exception)
{
Console.WriteLine($"ERROR in FileDataReader.IsDBNull({i}):{exception}");
}
return false;
}
public void Dispose()
{
Close();
}
public object this[int i]
{
get { return Values[i]; }
}
}
}
| 26.232493 | 104 | 0.464816 |
[
"MIT"
] |
AppBlocksNET/AppBlocks.DataReaders.FileDataReader
|
src/AppBlocks.DataReaders.FileDataReader/AppBlocks.DataReaders.FileDataReader/FileDataReader.cs
| 9,367 |
C#
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EFC4RESTAPI.Repositories;
using EFC4RESTAPI.Services;
using EFC4RESTAPI.Settings;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
namespace EFC4RESTAPI
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
var settings = Configuration.GetSection("DB_MySQL").Get<DBConnection>();
services.AddDbContext<AppDBContext>(options =>
options.UseMySql(settings.ConnString, new MySqlServerVersion(new Version(8, 0, 22)),mySqlOptions =>
mySqlOptions.CharSetBehavior(CharSetBehavior.NeverAppend)).EnableSensitiveDataLogging().EnableDetailedErrors());
services.AddScoped<IDBContext, EFCRepository>();
services.AddControllers(option => { option.SuppressAsyncSuffixInActionNames = false; });
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "EFC4RESTAPI", Version = "v1" });
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "EFC4RESTAPI v1"));
}
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
| 35.253521 | 125 | 0.648022 |
[
"Apache-2.0"
] |
smmhlbf/EFC4RESTAPI
|
Startup.cs
| 2,503 |
C#
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System
{
public static class PrimitiveExtensions
{
/// <summary>
/// Returns true when all <see cref="options"/> are eqal to <see cref="reference"/>
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="reference"></param>
/// <param name="options"></param>
/// <returns></returns>
public static bool MultiEqualsAnd<T>(this T reference, params T[] options)
{
return options.All(t => t.Equals(reference));
}
/// <summary>
/// Returns true when all <see cref="options"/> are eqal to <see cref="reference"/>
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="reference"></param>
/// <param name="options"></param>
/// <returns></returns>
public static bool MultiEqualsOr<T>(this T reference, params T[] options)
{
return options.Contains(reference);
}
/// <summary>
/// Returns the string representation of the bool in lower capitals
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string ToLower(this bool input)
{
return input.ToString().ToLower();
}
/// <summary>
/// Returns the string representation of the bool in upper capitals
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string ToUpper(this bool input)
{
return input.ToString().ToUpper();
}
}
}
| 31.672727 | 91 | 0.551091 |
[
"MIT"
] |
J-kit/UtiLib
|
UtiLib/Extensions/PrimitiveExtensions.cs
| 1,744 |
C#
|
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.Extensions.FileProviders;
using OrchardCore.Deployment.Remote.Services;
using OrchardCore.Deployment.Remote.ViewModels;
using OrchardCore.Deployment.Services;
namespace OrchardCore.Deployment.Remote.Controllers
{
public class ImportRemoteInstanceController : Controller
{
private readonly RemoteClientService _remoteClientService;
private readonly IDeploymentManager _deploymentManager;
private readonly IDataProtector _dataProtector;
public ImportRemoteInstanceController(
IDataProtectionProvider dataProtectionProvider,
RemoteClientService remoteClientService,
IDeploymentManager deploymentManager,
IHtmlLocalizer<ExportRemoteInstanceController> localizer)
{
_deploymentManager = deploymentManager;
_remoteClientService = remoteClientService;
_dataProtector = dataProtectionProvider.CreateProtector("OrchardCore.Deployment").ToTimeLimitedDataProtector();
}
/// <remarks>
/// We ignore the AFT as the service is called from external applications (they can't have valid ones) and
/// we use a private API key to secure its calls.
/// </remarks>
[HttpPost]
[IgnoreAntiforgeryToken]
public async Task<IActionResult> Import(ImportViewModel model)
{
var remoteClientList = await _remoteClientService.GetRemoteClientListAsync();
var remoteClient = remoteClientList.RemoteClients.FirstOrDefault(x => x.ClientName == model.ClientName);
var apiKey = Encoding.UTF8.GetString(_dataProtector.Unprotect(remoteClient.ProtectedApiKey));
if (remoteClient == null || model.ApiKey != apiKey || model.ClientName != remoteClient.ClientName)
{
return StatusCode((int)HttpStatusCode.BadRequest, "The Api Key was not recognized");
}
// Create a temporary filename to save the archive
var tempArchiveName = Path.GetTempFileName() + ".zip";
// Create a temporary folder to extract the archive to
var tempArchiveFolder = PathExtensions.Combine(Path.GetTempPath(), Path.GetRandomFileName());
try
{
using (var fs = System.IO.File.Create(tempArchiveName))
{
await model.Content.CopyToAsync(fs);
}
ZipFile.ExtractToDirectory(tempArchiveName, tempArchiveFolder);
await _deploymentManager.ImportDeploymentPackageAsync(new PhysicalFileProvider(tempArchiveFolder));
}
finally
{
if (System.IO.File.Exists(tempArchiveName))
{
System.IO.File.Delete(tempArchiveName);
}
if (Directory.Exists(tempArchiveFolder))
{
Directory.Delete(tempArchiveFolder, true);
}
}
return Ok();
}
}
}
| 37.873563 | 123 | 0.653414 |
[
"BSD-3-Clause"
] |
1051324354/OrchardCore
|
src/OrchardCore.Modules/OrchardCore.Deployment.Remote/Controllers/ImportRemoteInstanceController.cs
| 3,295 |
C#
|
using System;
using Microsoft.Extensions.Logging;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
namespace Lucca.Logs.Netcore.Tests
{
public static class LogPlayerExtension
{
public static void Log<T>(this ILogPlayer<T> player, LogLevel logLevel, int eventId, Exception exception, string message)
where T : class
{
switch (logLevel)
{
case LogLevel.Trace:
player.Logger.LogTrace(eventId, exception, message);
break;
case LogLevel.Debug:
player.Logger.LogDebug(eventId, exception, message);
break;
case LogLevel.Information:
player.Logger.LogInformation(eventId, exception, message);
break;
case LogLevel.Warning:
player.Logger.LogWarning(eventId, exception, message);
break;
case LogLevel.Error:
player.Logger.LogError(eventId, exception, message);
break;
case LogLevel.Critical:
player.Logger.LogCritical(eventId, exception, message);
break;
default:
throw new ArgumentOutOfRangeException(nameof(logLevel), logLevel, null);
}
}
}
}
| 27.868421 | 123 | 0.714825 |
[
"MIT"
] |
LuccaSA/Lucca.Logs
|
Lucca.Logs.Netcore3.Tests/LogPlayerExtension.cs
| 1,061 |
C#
|
using Common.Dto;
using Common.Tools;
using Data.Services;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using ToastNotifications;
using ToastNotifications.Lifetime;
using ToastNotifications.Messages;
using ToastNotifications.Position;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Data;
namespace LucaHome.Pages
{
public partial class MenuUpdatePage : Page, INotifyPropertyChanged
{
private const string TAG = "MenuUpdatePage";
private readonly NavigationService _navigationService;
private readonly Notifier _notifier;
private MenuDto _updateMenu;
public MenuUpdatePage(NavigationService navigationService, MenuDto updateMenu)
{
_navigationService = navigationService;
_updateMenu = updateMenu;
InitializeComponent();
DataContext = this;
_notifier = new Notifier(cfg =>
{
cfg.PositionProvider = new WindowPositionProvider(
parentWindow: Application.Current.MainWindow,
corner: Corner.BottomRight,
offsetX: 15,
offsetY: 15);
cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
notificationLifetime: TimeSpan.FromSeconds(2),
maximumNotificationCount: MaximumNotificationCount.FromCount(2));
cfg.Dispatcher = Application.Current.Dispatcher;
cfg.DisplayOptions.TopMost = true;
cfg.DisplayOptions.Width = 250;
});
_notifier.ClearMessages();
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public string MenuPageTitle
{
get
{
return string.Format("Update menu - {0}.{1}.{2}", _updateMenu.Date.Day, _updateMenu.Date.Month, _updateMenu.Date.Year); ;
}
set
{
Logger.Instance.Warning(TAG, "MenuPageTitle cannot be overriden!");
}
}
public CollectionView ListedMenuList
{
get
{
IList<string> listedMenuList = new List<string>();
foreach (ListedMenuDto entry in MenuService.Instance.ListedMenuList)
{
listedMenuList.Add(entry.Description);
}
return new CollectionView(listedMenuList);
}
}
public string Menu
{
get
{
return _updateMenu.Title;
}
set
{
_updateMenu.Title = value;
OnPropertyChanged("Menu");
}
}
public string Description
{
get
{
return _updateMenu.Description;
}
set
{
_updateMenu.Description = value;
OnPropertyChanged("Description");
}
}
private void Page_Unloaded(object sender, RoutedEventArgs routedEventArgs)
{
MenuService.Instance.OnMenuDownloadFinished -= _onMenuDownloadFinished;
MenuService.Instance.OnMenuUpdateFinished -= _onMenuUpdateFinished;
}
private void UpdateMenu_Click(object sender, RoutedEventArgs routedEventArgs)
{
MenuService.Instance.OnMenuUpdateFinished += _onMenuUpdateFinished;
MenuService.Instance.UpdateMenu(_updateMenu);
}
private void _onMenuDownloadFinished(IList<MenuDto> menuList, bool success, string response)
{
MenuService.Instance.OnMenuDownloadFinished -= _onMenuDownloadFinished;
_navigationService.GoBack();
}
private void _onMenuUpdateFinished(bool success, string response)
{
MenuService.Instance.OnMenuUpdateFinished -= _onMenuUpdateFinished;
if (success)
{
_notifier.ShowSuccess("Updated menu!");
MenuService.Instance.OnMenuDownloadFinished += _onMenuDownloadFinished;
MenuService.Instance.LoadMenuList();
}
else
{
_notifier.ShowError(string.Format("Updating menu failed!\n{0}", response));
}
}
private void ButtonBack_Click(object sender, RoutedEventArgs routedEventArgs)
{
_navigationService.GoBack();
}
}
}
| 30.641026 | 137 | 0.587238 |
[
"MIT"
] |
FriedrichWilhelmNietzsche/LucaHome-WPFApplication
|
LucaHome/Pages/MenuUpdatePage.xaml.cs
| 4,782 |
C#
|
using System.ComponentModel.DataAnnotations;
namespace OAuthApp.ApiModels.AppUsersController
{
public class MobileSignUpRequest
{
public long AppID { get; set; }
[Required]
public string Platform { get; set; }
[Required]
public string Phone { get; set; }
[Required]
public string Pwd { get; set; }
[Required]
public string VerifyCode { get; set; }
public string Avatar { get; set; }
}
}
| 20.25 | 47 | 0.59465 |
[
"Apache-2.0"
] |
seven1986/IdentityServer4.MicroService
|
ApiModels/AppUsersController/MobileSignUpRequest.cs
| 488 |
C#
|
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace Octokit
{
/// <summary>
/// Used to create a new tag
/// </summary>
/// <remarks>
/// Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create
/// an annotated tag in Git, you have to do this call to create the tag object, and then create the
/// refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference
/// - this call would be unnecessary.
/// </remarks>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class NewTag
{
/// <summary>
/// Gets or sets the tag.
/// </summary>
/// <value>
/// The tag.
/// </value>
public string Tag { get; set; }
/// <summary>
/// Gets or sets the tag message.
/// </summary>
/// <value>
/// The message.
/// </value>
public string Message { get; set; }
/// <summary>
/// The SHA of the git object this is tagging
/// </summary>
/// <value>
/// The object.
/// </value>
public string Object { get; set; }
/// <summary>
/// The type of the object we’re tagging. Normally this is a commit but it can also be a tree or a blob.
/// </summary>
/// <value>
/// The type.
/// </value>
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "Property name as defined by web api")]
public TaggedType Type { get; set; }
/// <summary>
/// An object with information about the individual creating the tag.
/// </summary>
/// <value>
/// The tagger.
/// </value>
public Committer Tagger { get; set; }
internal string DebuggerDisplay
{
get
{
return String.Format(CultureInfo.InvariantCulture, "Tag {0} Type: {1}", Tag, Type);
}
}
}
}
| 31.101449 | 148 | 0.5452 |
[
"MIT"
] |
ROBISKMAGICIAN/Desainer.net
|
Octokit/Models/Request/NewTag.cs
| 2,150 |
C#
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Session
{
public class DistributedSessionStore : ISessionStore
{
private readonly IDistributedCache _cache;
private readonly ILoggerFactory _loggerFactory;
public DistributedSessionStore(IDistributedCache cache, ILoggerFactory loggerFactory)
{
if (cache == null)
{
throw new ArgumentNullException(nameof(cache));
}
if (loggerFactory == null)
{
throw new ArgumentNullException(nameof(loggerFactory));
}
_cache = cache;
_loggerFactory = loggerFactory;
}
public ISession Create(string sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey)
{
if (string.IsNullOrEmpty(sessionKey))
{
throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(sessionKey));
}
if (tryEstablishSession == null)
{
throw new ArgumentNullException(nameof(tryEstablishSession));
}
return new DistributedSession(_cache, sessionKey, idleTimeout, ioTimeout, tryEstablishSession, _loggerFactory, isNewSessionKey);
}
}
}
| 34.297872 | 145 | 0.653226 |
[
"Apache-2.0"
] |
06b/AspNetCore
|
src/Middleware/Session/src/DistributedSessionStore.cs
| 1,612 |
C#
|
// <auto-generated>
// 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 k8s.Models
{
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// PersistentVolume (PV) is a storage resource provisioned by an
/// administrator. It is analogous to a node. More info:
/// https://kubernetes.io/docs/concepts/storage/persistent-volumes
/// </summary>
public partial class V1PersistentVolume
{
/// <summary>
/// Initializes a new instance of the V1PersistentVolume class.
/// </summary>
public V1PersistentVolume()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the V1PersistentVolume class.
/// </summary>
/// <param name="apiVersion">APIVersion defines the versioned schema of
/// this representation of an object. Servers should convert recognized
/// schemas to the latest internal value, and may reject unrecognized
/// values. More info:
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources</param>
/// <param name="kind">Kind is a string value representing the REST
/// resource this object represents. Servers may infer this from the
/// endpoint the client submits requests to. Cannot be updated. In
/// CamelCase. More info:
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds</param>
/// <param name="metadata">Standard object's metadata. More info:
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata</param>
/// <param name="spec">Spec defines a specification of a persistent
/// volume owned by the cluster. Provisioned by an administrator. More
/// info:
/// https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes</param>
/// <param name="status">Status represents the current
/// information/status for the persistent volume. Populated by the
/// system. Read-only. More info:
/// https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes</param>
public V1PersistentVolume(string apiVersion = default(string), string kind = default(string), V1ObjectMeta metadata = default(V1ObjectMeta), V1PersistentVolumeSpec spec = default(V1PersistentVolumeSpec), V1PersistentVolumeStatus status = default(V1PersistentVolumeStatus))
{
ApiVersion = apiVersion;
Kind = kind;
Metadata = metadata;
Spec = spec;
Status = status;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets aPIVersion defines the versioned schema of this
/// representation of an object. Servers should convert recognized
/// schemas to the latest internal value, and may reject unrecognized
/// values. More info:
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
/// </summary>
[JsonProperty(PropertyName = "apiVersion")]
public string ApiVersion { get; set; }
/// <summary>
/// Gets or sets kind is a string value representing the REST resource
/// this object represents. Servers may infer this from the endpoint
/// the client submits requests to. Cannot be updated. In CamelCase.
/// More info:
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
/// </summary>
[JsonProperty(PropertyName = "kind")]
public string Kind { get; set; }
/// <summary>
/// Gets or sets standard object's metadata. More info:
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
/// </summary>
[JsonProperty(PropertyName = "metadata")]
public V1ObjectMeta Metadata { get; set; }
/// <summary>
/// Gets or sets spec defines a specification of a persistent volume
/// owned by the cluster. Provisioned by an administrator. More info:
/// https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes
/// </summary>
[JsonProperty(PropertyName = "spec")]
public V1PersistentVolumeSpec Spec { get; set; }
/// <summary>
/// Gets or sets status represents the current information/status for
/// the persistent volume. Populated by the system. Read-only. More
/// info:
/// https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistent-volumes
/// </summary>
[JsonProperty(PropertyName = "status")]
public V1PersistentVolumeStatus Status { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Spec != null)
{
Spec.Validate();
}
}
}
}
| 45.58871 | 281 | 0.620555 |
[
"Apache-2.0"
] |
AshenW0lf/csharp
|
src/KubernetesClient/generated/Models/V1PersistentVolume.cs
| 5,653 |
C#
|
//// Description: Entity Framework Bulk Operations & Utilities (EF Bulk SaveChanges, Insert, Update, Delete, Merge | LINQ Query Cache, Deferred, Filter, IncludeFilter, IncludeOptimize | Audit)
//// Website & Documentation: https://github.com/zzzprojects/Entity-Framework-Plus
//// Forum & Issues: https://github.com/zzzprojects/EntityFramework-Plus/issues
//// License: https://github.com/zzzprojects/EntityFramework-Plus/blob/master/LICENSE
//// More projects: http://www.zzzprojects.com/
//// Copyright © ZZZ Projects Inc. 2014 - 2016. All rights reserved.
//using System.Collections.ObjectModel;
//using System.Data.Entity;
//using System.Linq;
//using Microsoft.VisualStudio.TestTools.UnitTesting;
//using Z.EntityFramework.Plus;
//namespace Z.Test.EntityFramework.Plus
//{
// public partial class QueryFilter_DbSet_DbSetFilter
// {
// [TestMethod]
// public void WithLazyLoading_ManyFilter_Disabled()
// {
// TestContext.DeleteAll(x => x.Inheritance_Interface_Entities);
// TestContext.DeleteAll(x => x.Inheritance_Interface_Entities_LazyLoading);
// using (var ctx = new TestContext())
// {
// var list = TestContext.Insert(ctx, x => x.Inheritance_Interface_Entities, 10);
// var left = ctx.Inheritance_Interface_Entities_LazyLoading.Add(new Inheritance_Interface_Entity_LazyLoading());
// left.Rights = new Collection<Inheritance_Interface_Entity>();
// list.ForEach(x => left.Rights.Add(x));
// ctx.SaveChanges();
// }
// using (var ctx = new TestContext(true, true, enableFilter1: false, enableFilter2: false, enableFilter3: false, enableFilter4: false))
// {
// var rights = ctx.Inheritance_Interface_Entities_LazyLoading.Filter(
// QueryFilterHelper.Filter.Filter1,
// QueryFilterHelper.Filter.Filter2,
// QueryFilterHelper.Filter.Filter3,
// QueryFilterHelper.Filter.Filter4).First().Rights;
// // STILL filter LazyLoading
// Assert.AreEqual(45, rights.Sum(x => x.ColumnInt));
// }
// }
// }
//}
| 46.583333 | 193 | 0.645796 |
[
"MIT"
] |
Ahmed-Abdelhameed/EntityFramework-Plus
|
src/test/Z.Test.EntityFramework.Plus.EF6/QueryDbSetFilter/DbSet_Filter/WithLazyLoading/ManyFilter_Disabled.cs
| 2,239 |
C#
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
namespace SampleEntityFrameworkProvider
{
/// <summary>
/// This enum describes the current server version
/// </summary>
internal enum StoreVersion
{
/// <summary>
/// Sql Server 9
/// </summary>
Sql9 = 90,
/// <summary>
/// Sql Server 10
/// </summary>
Sql10 = 100,
// higher versions go here
}
/// <summary>
/// This class is a simple utility class that determines the sql version from the
/// connection
/// </summary>
internal static class StoreVersionUtils
{
/// <summary>
/// Get the StoreVersion from the connection. Returns one of Sql9, Sql10
/// </summary>
/// <param name="connection">current sql connection</param>
/// <returns>Sql Version for the current connection</returns>
internal static StoreVersion GetStoreVersion(SampleConnection connection)
{
// We don't have anything unique for Sql
if ((connection.ServerVersion.StartsWith("10.", StringComparison.Ordinal)) ||
(connection.ServerVersion.StartsWith("11.", StringComparison.Ordinal)))
{
return StoreVersion.Sql10;
}
else if (connection.ServerVersion.StartsWith("09.", StringComparison.Ordinal))
{
return StoreVersion.Sql9;
}
else
{
throw new ArgumentException("The version of SQL Server is not supported via sample provider.");
}
}
internal static StoreVersion GetStoreVersion(string providerManifestToken)
{
switch (providerManifestToken)
{
case SampleProviderManifest.TokenSql9:
return StoreVersion.Sql9;
case SampleProviderManifest.TokenSql10:
return StoreVersion.Sql10;
default:
throw new ArgumentException("Could not determine storage version; a valid provider manifest token is required.");
}
}
internal static string GetVersionHint(StoreVersion version)
{
switch (version)
{
case StoreVersion.Sql9:
return SampleProviderManifest.TokenSql9;
case StoreVersion.Sql10:
return SampleProviderManifest.TokenSql10;
}
throw new ArgumentException("Could not determine storage version; a valid storage connection or a version hint is required.");
}
}
}
| 33.289157 | 138 | 0.579443 |
[
"Apache-2.0"
] |
mrward/entityframework-sharpdevelop
|
samples/Provider/SampleEntityFrameworkProvider/StoreVersion.cs
| 2,765 |
C#
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ValidationResultTest.cs" company="Catel development team">
// Copyright (c) 2011 - 2012 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Catel.Tests.Data
{
using System;
using Catel.Data;
using NUnit.Framework;
public class FieldValidationResultFacts
{
[TestFixture]
public class TheConstructor
{
[TestCase]
public void ThrowsNullReferenceExceptionForNullProperty()
{
ExceptionTester.CallMethodAndExpectException<NullReferenceException>(() => new FieldValidationResult((PropertyData)null, ValidationResultType.Error, "message"));
}
[TestCase]
public void ThrowsArgumentExceptionForNullPropertyName()
{
ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => new FieldValidationResult((string)null, ValidationResultType.Error, "message"));
}
[TestCase]
public void ThrowsArgumentExceptionForEmptyPropertyName()
{
ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => new FieldValidationResult(string.Empty, ValidationResultType.Error, "message"));
}
[TestCase]
public void ThrowsArgumentNullExceptionForNullMessage()
{
ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => new FieldValidationResult("myProperty", ValidationResultType.Error, null));
}
[TestCase]
public void SetsValuesCorrectlyUsingEmptyMessage()
{
var validationResult = new FieldValidationResult("myProperty", ValidationResultType.Error, string.Empty);
Assert.AreEqual("myProperty", validationResult.PropertyName);
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual(string.Empty, validationResult.Message);
}
[TestCase]
public void SetsValuesCorrectlyUsingNormalMessage()
{
var validationResult = new FieldValidationResult("myProperty", ValidationResultType.Error, "my message");
Assert.AreEqual("myProperty", validationResult.PropertyName);
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual("my message", validationResult.Message);
}
[TestCase]
public void SetsValuesCorrectlyUsingFormattedMessage()
{
var validationResult = new FieldValidationResult("myProperty", ValidationResultType.Error, "my message with {0}", "format");
Assert.AreEqual("myProperty", validationResult.PropertyName);
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual("my message with format", validationResult.Message);
}
}
[TestFixture]
public class TheCreateWarningMethod
{
private string MyProperty { get; set; }
[TestCase]
public void SetsValuesCorrectlyUsingNormalMessage()
{
var validationResult = FieldValidationResult.CreateWarning("myProperty", "my message");
Assert.AreEqual("myProperty", validationResult.PropertyName);
Assert.AreEqual(ValidationResultType.Warning, validationResult.ValidationResultType);
Assert.AreEqual("my message", validationResult.Message);
}
[TestCase]
public void SetsValuesCorrectlyUsingFormattedMessage()
{
var validationResult = FieldValidationResult.CreateWarning("myProperty", "my message with {0}", "format");
Assert.AreEqual("myProperty", validationResult.PropertyName);
Assert.AreEqual(ValidationResultType.Warning, validationResult.ValidationResultType);
Assert.AreEqual("my message with format", validationResult.Message);
}
[TestCase]
public void SetsValueCorrectlyUsingExpression()
{
var validationResult = FieldValidationResult.CreateWarning(() => MyProperty, "my message with {0}", "format");
Assert.AreEqual("MyProperty", validationResult.PropertyName);
Assert.AreEqual(ValidationResultType.Warning, validationResult.ValidationResultType);
Assert.AreEqual("my message with format", validationResult.Message);
}
}
[TestFixture]
public class TheCreateErrorMethod
{
private string MyProperty { get; set; }
[TestCase]
public void SetsValuesCorrectlyUsingNormalMessage()
{
var validationResult = FieldValidationResult.CreateError("myProperty", "my message");
Assert.AreEqual("myProperty", validationResult.PropertyName);
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual("my message", validationResult.Message);
}
[TestCase]
public void SetsValuesCorrectlyUsingFormattedMessage()
{
var validationResult = FieldValidationResult.CreateError("myProperty", "my message with {0}", "format");
Assert.AreEqual("myProperty", validationResult.PropertyName);
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual("my message with format", validationResult.Message);
}
[TestCase]
public void SetsValueCorrectlyUsingExpression()
{
var validationResult = FieldValidationResult.CreateError(() => MyProperty, "my message with {0}", "format");
Assert.AreEqual("MyProperty", validationResult.PropertyName);
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual("my message with format", validationResult.Message);
}
}
}
public class BusinessRuleValidationResultFacts
{
[TestFixture]
public class TheConstructor
{
[TestCase]
public void ThrowsArgumentNullExceptionForNullMessage()
{
ExceptionTester.CallMethodAndExpectException<ArgumentException>(() => new BusinessRuleValidationResult(ValidationResultType.Error, null));
}
[TestCase]
public void SetsValuesCorrectlyUsingEmptyMessage()
{
var validationResult = new BusinessRuleValidationResult(ValidationResultType.Error, string.Empty);
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual(string.Empty, validationResult.Message);
}
[TestCase]
public void SetsValuesCorrectlyUsingNormalMessage()
{
var validationResult = new BusinessRuleValidationResult(ValidationResultType.Error, "my message");
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual("my message", validationResult.Message);
}
[TestCase]
public void SetsValuesCorrectlyUsingFormattedMessage()
{
var validationResult = new BusinessRuleValidationResult(ValidationResultType.Error, "my message with {0}", "format");
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual("my message with format", validationResult.Message);
}
}
[TestFixture]
public class TheCreateWarningMethod
{
[TestCase]
public void SetsValuesCorrectlyUsingNormalMessage()
{
var validationResult = BusinessRuleValidationResult.CreateWarning("my message");
Assert.AreEqual(ValidationResultType.Warning, validationResult.ValidationResultType);
Assert.AreEqual("my message", validationResult.Message);
}
[TestCase]
public void SetsValuesCorrectlyUsingFormattedMessage()
{
var validationResult = BusinessRuleValidationResult.CreateWarning("my message with {0}", "format");
Assert.AreEqual(ValidationResultType.Warning, validationResult.ValidationResultType);
Assert.AreEqual("my message with format", validationResult.Message);
}
}
[TestFixture]
public class TheCreateErrorMethod
{
[TestCase]
public void SetsValuesCorrectlyUsingNormalMessage()
{
var validationResult = BusinessRuleValidationResult.CreateError("my message");
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual("my message", validationResult.Message);
}
[TestCase]
public void SetsValuesCorrectlyUsingFormattedMessage()
{
var validationResult = BusinessRuleValidationResult.CreateError("my message with {0}", "format");
Assert.AreEqual(ValidationResultType.Error, validationResult.ValidationResultType);
Assert.AreEqual("my message with format", validationResult.Message);
}
}
}
}
| 43.290043 | 177 | 0.6202 |
[
"MIT"
] |
14632791/Catel
|
src/Catel.Tests/Data/ValidationResultFacts.cs
| 10,002 |
C#
|
#if UNITY_EDITOR
using System;
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
namespace FastPlay.Editor {
public class AutoTypeInstance : ScriptableObject {
private bool is_playing;
private string current_text;
private int chars_per_second;
private float time_elapsed;
private float time_to_change_elapsed;
private float wait_to_change;
private int current_tip;
private bool random_tips;
private string[] tips;
public bool isPlaying {
get {
return is_playing;
}
}
void OnEnable() {
EditorApplication.update += Update;
}
void OnDisable() {
EditorApplication.update -= Update;
}
public void Init(int chars_per_second, float wait_to_change, bool random_tips, params string[] tips) {
this.chars_per_second = chars_per_second;
this.wait_to_change = wait_to_change;
this.random_tips = random_tips;
this.tips = tips;
}
public void Play() {
is_playing = true;
}
public void Stop() {
is_playing = false;
}
public string GetCurrentText() {
return current_text;
}
void Update() {
try {
if (is_playing) {
if (tips[current_tip] == (current_text ?? string.Empty).Replace("|", string.Empty)) {
time_to_change_elapsed += EditorTime.deltaTime;
if (time_to_change_elapsed >= wait_to_change) {
time_elapsed = 0.0f;
time_to_change_elapsed = 0.0f;
current_text = string.Empty;
if (random_tips) {
current_tip = UnityEngine.Random.Range(0, tips.Length - 1);
}
else {
current_tip++;
if (current_tip >= tips.Length) {
current_tip = 0;
}
}
}
}
else {
time_elapsed += EditorTime.deltaTime;
current_text = GetAutoTypeText(tips[current_tip], (int)(time_elapsed * chars_per_second));
}
}
else {
current_tip = 0;
time_elapsed = 0.0f;
time_to_change_elapsed = 0.0f;
current_text = string.Empty;
}
}
catch (Exception e) {
DestroyImmediate(this);
throw e;
}
}
private string GetAutoTypeText(string text, int current_char) {
if (current_char >= text.Length) {
return text;
}
return text.Substring(0, current_char).Replace("|", string.Empty) + "|";
}
}
}
#endif
| 21.037037 | 104 | 0.652289 |
[
"MIT"
] |
BrunoS3D/FastPlay
|
Assets/FastPlay/FP-Editor/AutoTypeInstance.cs
| 2,272 |
C#
|
using Macropse.Domain.External;
using Macropse.Domain.Logic.Interfaces;
using Macropse.Domain.Logic.Output;
using Macropse.Infrastructure.Module.Driver;
using Macropse.Infrastructure.Module.Message.Args;
using Macropse.Infrastructure.Module.Message.ScriptBase;
using System.Collections.Generic;
using System.Xml.Linq;
namespace Macropse.Domain.Logic.Parser
{
public sealed class ScriptRootBuilder : IBuilder<XElement, Header>
{
private Dictionary<string, dynamic> AllowedAttributesDefaultValues = new Dictionary<string, dynamic>()
{
{"pause", VirtualKey.Pause },
{"delay", 100 },
{"whilePressed", false },
{"ifWinActive", string.Empty }
};
public OutputPackage<Header> BuildObject(XElement sourceData)
{
if (sourceData.Name != "root")
{
return new OutputPackage<Header>(item: default, errorMessage: new ScriptRootMissingMessage(sourceData.Name.LocalName));
}
if(!sourceData.HasElements)
{
return new OutputPackage<Header>(item: default, errorMessage: new EmptyNestedTagMessage(sourceData.Name.LocalName, "macro"));
}
foreach (var curAttr in sourceData.Attributes())
{
if (AllowedAttributesDefaultValues.TryGetValue(curAttr.Name.LocalName, out var result))
{
object[] args = { curAttr.Value };
dynamic paramPac = typeof(ParamParser).GetMethod(nameof(ParamParser.ParseParam)).MakeGenericMethod(result.GetType()).Invoke(null, args);
if (paramPac.HasError)
{
return new OutputPackage<Header>(item: default(Header), errorMessage: paramPac.ErrorMessage);
}
AllowedAttributesDefaultValues[curAttr.Name.LocalName] = paramPac.Item;
}
else
{
return new OutputPackage<Header>(item: default, errorMessage: new UnknownArgumentMessage(sourceData.Name.LocalName, curAttr.Name.LocalName));
}
}
AllowedAttributesDefaultValues.TryGetValue("pause", out var pauseAttr);
AllowedAttributesDefaultValues.TryGetValue("delay", out var delayAttr);
AllowedAttributesDefaultValues.TryGetValue("whilePressed", out var whilePressedAttr);
AllowedAttributesDefaultValues.TryGetValue("ifWinActive", out var ifWinActiveAttr);
return new OutputPackage<Header>(item: new Header(pauseAttr, delayAttr, whilePressedAttr, ifWinActiveAttr), errorMessage: default);
}
}
}
| 43.645161 | 161 | 0.636364 |
[
"MIT"
] |
sh1ngekyo/macropse
|
Macropse.Domain/Logic/Parser/ScriptRootBuilder.cs
| 2,708 |
C#
|
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace NJection.LambdaConverter.Tests
{
/// <summary>
/// Summary description for ListAccessExpression
/// </summary>
[TestClass]
public class ListAccessExpression : BaseTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
[TestMethod]
public void ListAccess_OfAssignmentOfSpecificValueInReturnStatment_ReturnsTheAssignedValue()
{
int value = 10;
Func<int, int, int> @delegate = ListWriteAccessReturnsAssignmentExpression;
var func = ExecuteLambda<Func<int, int, int>>(@delegate);
var result = func(0, value);
Assert.AreEqual(result, value);
}
[TestMethod]
public void ListAccess_OfIndexingOf_ReturnsTheIndexedValue()
{
int value = 10;
Func<int, int> @delegate = ListReadAccessReturnsAssignmentExpression;
var func = ExecuteLambda<Func<int, int>>(@delegate);
var result = func(value);
Assert.AreEqual(result, value);
}
private int ListWriteAccessReturnsAssignmentExpression(int index, int value)
{
List<int> ints = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
return ints[index] = value;
}
private int ListReadAccessReturnsAssignmentExpression(int index)
{
List<int> ints = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
return ints[index];
}
}
}
| 30.323529 | 101 | 0.557226 |
[
"MIT"
] |
sagifogel/NJection.LambdaConverter
|
NJection.LambdaConverter.Tests/Tests/ListExpressions/ListAccessExpression.cs
| 2,064 |
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
namespace EFCore.SQL.Migrations
{
public partial class AddColuinBoil : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PurchaseDetailsId",
table: "BoilProcessMaster",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PurchaseDetailsId",
table: "BoilProcessMaster");
}
}
}
| 27.347826 | 71 | 0.600954 |
[
"Apache-2.0"
] |
infologs/DTSolutions
|
src/BuildingBlocks/EFCore.Support/EFCore.SQL/Migrations/20211113131431_AddColuinBoil.cs
| 631 |
C#
|
using STU.Common.Result;
using STU.Shared.Model;
using STU.Shared.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace STU.Shared.Services
{
public class LocationService : BaseService<Location>, ILocationService
{
public LocationService(IRepository<Location> locationRepository) : base(locationRepository) { }
public Result<Location> GetDirections(int buildingId)
{
return new Result<Location> { Success = true, Data = Repository.All(loc => loc.BuildingID == buildingId).FirstOrDefault() };
}
}
}
| 29.136364 | 136 | 0.720749 |
[
"Apache-2.0"
] |
jaseaman/thinkchangecrew
|
STU.Shared/Services/LocationService.cs
| 643 |
C#
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.NetPeer.ServerCommand
{
public interface IServerCommand
{
byte[] Serialize();
void Execute();
}
}
| 17.4 | 38 | 0.701149 |
[
"MIT"
] |
JacksonDorsett/Podium
|
New Unity Project/Assets/NetPeer/ServerCommand/IServerCommand.cs
| 263 |
C#
|
//----------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//----------------------------------------------------------------
namespace System.Activities.Presentation.View
{
internal interface IVersionEditor
{
void ShowErrorMessage(string message);
}
}
| 29.428571 | 67 | 0.478155 |
[
"Apache-2.0"
] |
Distrotech/mono
|
external/referencesource/System.Activities.Presentation/System.Activities.Presentation/System/Activities/Presentation/View/IVersionEditor.cs
| 414 |
C#
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TradingClient.Common;
using TradingClient.Data.Contracts;
using TradingClient.ViewModelInterfaces;
namespace TradingClient.ViewModels
{
public abstract class TradeItem : Observable, ITradeItem
{
#region Members
protected decimal _currentPrice;
protected decimal _currentPriceChange;
protected decimal _profit;
protected decimal _profitPips;
protected bool _isServerSide;
#endregion //Members
#region Properties
public Security Instrument { get; set; }
public decimal CurrentPrice
{
get => _currentPrice;
set => SetPropertyValue(ref _currentPrice, value, nameof(CurrentPrice));
}
public decimal CurrentPriceChange
{
get => _currentPriceChange;
set => SetPropertyValue(ref _currentPriceChange, value, nameof(CurrentPriceChange));
}
public decimal Profit
{
get => _profit;
set => SetPropertyValue(ref _profit, value, nameof(Profit));
}
public decimal ProfitPips
{
get => _profitPips;
set => SetPropertyValue(ref _profitPips, value, nameof(ProfitPips));
}
public bool IsServerSide
{
get => _isServerSide;
set => SetPropertyValue(ref _isServerSide, value, nameof(IsServerSide));
}
#endregion //Properties
}
}
| 25.737705 | 96 | 0.627389 |
[
"MPL-2.0"
] |
NominalNimbus/ClientNimbus
|
UserInterface/TradingClient.ViewModels/Trading/TradeItem.cs
| 1,572 |
C#
|
namespace Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401
{
using Microsoft.Azure.PowerShell.Cmdlets.Databricks.Runtime.PowerShell;
/// <summary>Custom Parameters used for Cluster Creation.</summary>
[System.ComponentModel.TypeConverter(typeof(WorkspaceCustomParametersTypeConverter))]
public partial class WorkspaceCustomParameters
{
/// <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.Databricks.Models.Api20180401.WorkspaceCustomParameters"
/// />.
/// </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.Databricks.Models.Api20180401.IWorkspaceCustomParameters"
/// />.
/// </returns>
public static Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParameters DeserializeFromDictionary(global::System.Collections.IDictionary content)
{
return new WorkspaceCustomParameters(content);
}
/// <summary>
/// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomParameters"
/// />.
/// </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.Databricks.Models.Api20180401.IWorkspaceCustomParameters"
/// />.
/// </returns>
public static Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
{
return new WorkspaceCustomParameters(content);
}
/// <summary>
/// Creates a new instance of <see cref="WorkspaceCustomParameters" />, 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.Databricks.Models.Api20180401.IWorkspaceCustomParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Databricks.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.Databricks.Runtime.SerializationMode.IncludeAll)?.ToString();
/// <summary>
/// Deserializes a <see cref="global::System.Collections.IDictionary" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomParameters"
/// />.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
internal WorkspaceCustomParameters(global::System.Collections.IDictionary content)
{
bool returnNow = false;
BeforeDeserializeDictionary(content, ref returnNow);
if (returnNow)
{
return;
}
// actually deserialize
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceId = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomStringParameter) content.GetValueForProperty("AmlWorkspaceId",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceId, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomStringParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkId = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomStringParameter) content.GetValueForProperty("CustomVirtualNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkId, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomStringParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetName = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomStringParameter) content.GetValueForProperty("CustomPublicSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetName, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomStringParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetName = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomStringParameter) content.GetValueForProperty("CustomPrivateSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetName, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomStringParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIP = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomBooleanParameter) content.GetValueForProperty("EnableNoPublicIP",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIP, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomBooleanParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryption = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomBooleanParameter) content.GetValueForProperty("PrepareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryption, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomBooleanParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).Encryption = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceEncryptionParameter) content.GetValueForProperty("Encryption",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).Encryption, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceEncryptionParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryption = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomBooleanParameter) content.GetValueForProperty("RequireInfrastructureEncryption",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryption, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomBooleanParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EncryptionValue = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IEncryption) content.GetValueForProperty("EncryptionValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EncryptionValue, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.EncryptionTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryptionType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("PrepareEncryptionType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryptionType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkIdType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("CustomVirtualNetworkIdType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkIdType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkIdValue = (string) content.GetValueForProperty("CustomVirtualNetworkIdValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkIdValue, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetNameType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("CustomPublicSubnetNameType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetNameType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetNameValue = (string) content.GetValueForProperty("CustomPublicSubnetNameValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetNameValue, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetNameType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("CustomPrivateSubnetNameType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetNameType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetNameValue = (string) content.GetValueForProperty("CustomPrivateSubnetNameValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetNameValue, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIPType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("EnableNoPublicIPType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIPType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIPValue = (bool) content.GetValueForProperty("EnableNoPublicIPValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIPValue, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool)));
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceIdValue = (string) content.GetValueForProperty("AmlWorkspaceIdValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceIdValue, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryptionValue = (bool) content.GetValueForProperty("PrepareEncryptionValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryptionValue, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool)));
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceIdType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("AmlWorkspaceIdType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceIdType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EncryptionType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("EncryptionType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EncryptionType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeySource = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.KeySource?) content.GetValueForProperty("ValueKeySource",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeySource, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.KeySource.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryptionType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("RequireInfrastructureEncryptionType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryptionType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryptionValue = (bool) content.GetValueForProperty("RequireInfrastructureEncryptionValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryptionValue, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool)));
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyVersion = (string) content.GetValueForProperty("ValueKeyVersion",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyVersion, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyVaultUri = (string) content.GetValueForProperty("ValueKeyVaultUri",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyVaultUri, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyName = (string) content.GetValueForProperty("ValueKeyName",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyName, 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.Databricks.Models.Api20180401.WorkspaceCustomParameters"
/// />.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
internal WorkspaceCustomParameters(global::System.Management.Automation.PSObject content)
{
bool returnNow = false;
BeforeDeserializePSObject(content, ref returnNow);
if (returnNow)
{
return;
}
// actually deserialize
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceId = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomStringParameter) content.GetValueForProperty("AmlWorkspaceId",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceId, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomStringParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkId = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomStringParameter) content.GetValueForProperty("CustomVirtualNetworkId",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkId, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomStringParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetName = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomStringParameter) content.GetValueForProperty("CustomPublicSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetName, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomStringParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetName = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomStringParameter) content.GetValueForProperty("CustomPrivateSubnetName",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetName, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomStringParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIP = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomBooleanParameter) content.GetValueForProperty("EnableNoPublicIP",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIP, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomBooleanParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryption = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomBooleanParameter) content.GetValueForProperty("PrepareEncryption",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryption, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomBooleanParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).Encryption = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceEncryptionParameter) content.GetValueForProperty("Encryption",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).Encryption, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceEncryptionParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryption = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomBooleanParameter) content.GetValueForProperty("RequireInfrastructureEncryption",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryption, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.WorkspaceCustomBooleanParameterTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EncryptionValue = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IEncryption) content.GetValueForProperty("EncryptionValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EncryptionValue, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.EncryptionTypeConverter.ConvertFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryptionType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("PrepareEncryptionType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryptionType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkIdType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("CustomVirtualNetworkIdType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkIdType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkIdValue = (string) content.GetValueForProperty("CustomVirtualNetworkIdValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomVirtualNetworkIdValue, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetNameType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("CustomPublicSubnetNameType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetNameType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetNameValue = (string) content.GetValueForProperty("CustomPublicSubnetNameValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPublicSubnetNameValue, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetNameType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("CustomPrivateSubnetNameType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetNameType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetNameValue = (string) content.GetValueForProperty("CustomPrivateSubnetNameValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).CustomPrivateSubnetNameValue, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIPType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("EnableNoPublicIPType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIPType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIPValue = (bool) content.GetValueForProperty("EnableNoPublicIPValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EnableNoPublicIPValue, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool)));
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceIdValue = (string) content.GetValueForProperty("AmlWorkspaceIdValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceIdValue, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryptionValue = (bool) content.GetValueForProperty("PrepareEncryptionValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).PrepareEncryptionValue, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool)));
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceIdType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("AmlWorkspaceIdType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).AmlWorkspaceIdType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EncryptionType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("EncryptionType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).EncryptionType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeySource = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.KeySource?) content.GetValueForProperty("ValueKeySource",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeySource, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.KeySource.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryptionType = (Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType?) content.GetValueForProperty("RequireInfrastructureEncryptionType",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryptionType, Microsoft.Azure.PowerShell.Cmdlets.Databricks.Support.CustomParameterType.CreateFrom);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryptionValue = (bool) content.GetValueForProperty("RequireInfrastructureEncryptionValue",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).RequireInfrastructureEncryptionValue, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool)));
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyVersion = (string) content.GetValueForProperty("ValueKeyVersion",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyVersion, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyVaultUri = (string) content.GetValueForProperty("ValueKeyVaultUri",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyVaultUri, global::System.Convert.ToString);
((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyName = (string) content.GetValueForProperty("ValueKeyName",((Microsoft.Azure.PowerShell.Cmdlets.Databricks.Models.Api20180401.IWorkspaceCustomParametersInternal)this).ValueKeyName, global::System.Convert.ToString);
AfterDeserializePSObject(content);
}
}
/// Custom Parameters used for Cluster Creation.
[System.ComponentModel.TypeConverter(typeof(WorkspaceCustomParametersTypeConverter))]
public partial interface IWorkspaceCustomParameters
{
}
}
| 181.299465 | 581 | 0.81975 |
[
"MIT"
] |
3quanfeng/azure-powershell
|
src/Databricks/generated/api/Models/Api20180401/WorkspaceCustomParameters.PowerShell.cs
| 33,717 |
C#
|
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using Org.BouncyCastle.Utilities;
using Org.BouncyCastle.Utilities.IO;
namespace Org.BouncyCastle.Bcpg
{
/**
* Basic output stream.
*/
public class ArmoredOutputStream
: BaseOutputStream
{
private static readonly byte[] encodingTable =
{
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
(byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
(byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
(byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
(byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
(byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
(byte)'v',
(byte)'w', (byte)'x', (byte)'y', (byte)'z',
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6',
(byte)'7', (byte)'8', (byte)'9',
(byte)'+', (byte)'/'
};
/**
* encode the input data producing a base 64 encoded byte array.
*/
private static void Encode(
Stream outStream,
int[] data,
int len)
{
Debug.Assert(len > 0);
Debug.Assert(len < 4);
byte[] bs = new byte[4];
int d1 = data[0];
bs[0] = encodingTable[(d1 >> 2) & 0x3f];
switch (len)
{
case 1:
{
bs[1] = encodingTable[(d1 << 4) & 0x3f];
bs[2] = (byte)'=';
bs[3] = (byte)'=';
break;
}
case 2:
{
int d2 = data[1];
bs[1] = encodingTable[((d1 << 4) | (d2 >> 4)) & 0x3f];
bs[2] = encodingTable[(d2 << 2) & 0x3f];
bs[3] = (byte)'=';
break;
}
case 3:
{
int d2 = data[1];
int d3 = data[2];
bs[1] = encodingTable[((d1 << 4) | (d2 >> 4)) & 0x3f];
bs[2] = encodingTable[((d2 << 2) | (d3 >> 6)) & 0x3f];
bs[3] = encodingTable[d3 & 0x3f];
break;
}
}
outStream.Write(bs, 0, bs.Length);
}
private readonly Stream outStream;
private int[] buf = new int[3];
private int bufPtr = 0;
private Crc24 crc = new Crc24();
private int chunkCount = 0;
private int lastb;
private bool start = true;
private bool clearText = false;
private bool newLine = false;
private string type;
private static readonly string nl = Platform.NewLine;
private static readonly string headerStart = "-----BEGIN PGP ";
private static readonly string headerTail = "-----";
private static readonly string footerStart = "-----END PGP ";
private static readonly string footerTail = "-----";
private static readonly string version;
static ArmoredOutputStream()
{
#if !NETFX_CORE
var assemblyName = new AssemblyName(Assembly.GetExecutingAssembly().FullName);
version = "BCPG C# v" + assemblyName.Version + " (with EC support)";
#else
version = "BCPG C# WinRT (with EC support)";
#endif
}
private readonly IDictionary headers;
public ArmoredOutputStream(Stream outStream)
{
this.outStream = outStream;
this.headers = Platform.CreateHashtable();
this.headers["Version"] = version;
}
public ArmoredOutputStream(Stream outStream, IDictionary headers)
{
this.outStream = outStream;
this.headers = Platform.CreateHashtable(headers);
this.headers["Version"] = version;
}
/**
* Set an additional header entry.
*
* @param name the name of the header entry.
* @param v the value of the header entry.
*/
public void SetHeader(
string name,
string v)
{
headers[name] = v;
}
/**
* Reset the headers to only contain a Version string.
*/
public void ResetHeaders()
{
headers.Clear();
headers["Version"] = version;
}
/**
* Start a clear text signed message.
* @param hashAlgorithm
*/
public void BeginClearText(HashAlgorithmTag hashAlgorithm)
{
string hash;
switch (hashAlgorithm)
{
case HashAlgorithmTag.Sha1:
hash = "SHA1";
break;
case HashAlgorithmTag.Sha256:
hash = "SHA256";
break;
case HashAlgorithmTag.Sha384:
hash = "SHA384";
break;
case HashAlgorithmTag.Sha512:
hash = "SHA512";
break;
case HashAlgorithmTag.MD2:
hash = "MD2";
break;
case HashAlgorithmTag.MD5:
hash = "MD5";
break;
case HashAlgorithmTag.RipeMD160:
hash = "RIPEMD160";
break;
default:
throw new IOException("unknown hash algorithm tag in beginClearText: " + hashAlgorithm);
}
DoWrite("-----BEGIN PGP SIGNED MESSAGE-----" + nl);
DoWrite("Hash: " + hash + nl + nl);
clearText = true;
newLine = true;
lastb = 0;
}
public void EndClearText()
{
clearText = false;
}
public override void WriteByte(
byte b)
{
if (clearText)
{
outStream.WriteByte(b);
if (newLine)
{
if (!(b == '\n' && lastb == '\r'))
{
newLine = false;
}
if (b == '-')
{
outStream.WriteByte((byte)' ');
outStream.WriteByte((byte)'-'); // dash escape
}
}
if (b == '\r' || (b == '\n' && lastb != '\r'))
{
newLine = true;
}
lastb = b;
return;
}
if (start)
{
bool newPacket = (b & 0x40) != 0;
int tag;
if (newPacket)
{
tag = b & 0x3f;
}
else
{
tag = (b & 0x3f) >> 2;
}
switch ((PacketTag)tag)
{
case PacketTag.PublicKey:
type = "PUBLIC KEY BLOCK";
break;
case PacketTag.SecretKey:
type = "PRIVATE KEY BLOCK";
break;
case PacketTag.Signature:
type = "SIGNATURE";
break;
default:
type = "MESSAGE";
break;
}
DoWrite(headerStart + type + headerTail + nl);
WriteHeaderEntry("Version", (string)headers["Version"]);
foreach (DictionaryEntry de in headers)
{
string k = (string)de.Key;
if (k != "Version")
{
string v = (string)de.Value;
WriteHeaderEntry(k, v);
}
}
DoWrite(nl);
start = false;
}
if (bufPtr == 3)
{
Encode(outStream, buf, bufPtr);
bufPtr = 0;
if ((++chunkCount & 0xf) == 0)
{
DoWrite(nl);
}
}
crc.Update(b);
buf[bufPtr++] = b & 0xff;
}
/**
* <b>Note</b>: close does nor close the underlying stream. So it is possible to write
* multiple objects using armoring to a single stream.
*/
#if !NETFX_CORE
public override void Close()
{
if (type != null)
{
if (bufPtr > 0)
{
Encode(outStream, buf, bufPtr);
}
DoWrite(nl + '=');
int crcV = crc.Value;
buf[0] = ((crcV >> 16) & 0xff);
buf[1] = ((crcV >> 8) & 0xff);
buf[2] = (crcV & 0xff);
Encode(outStream, buf, 3);
DoWrite(nl);
DoWrite(footerStart);
DoWrite(type);
DoWrite(footerTail);
DoWrite(nl);
outStream.Flush();
type = null;
start = true;
base.Close();
}
}
#else
protected override void Dispose(bool disposing)
{
try
{
if (type != null)
{
if (bufPtr > 0)
{
Encode(outStream, buf, bufPtr);
}
DoWrite(nl + '=');
int crcV = crc.Value;
buf[0] = ((crcV >> 16) & 0xff);
buf[1] = ((crcV >> 8) & 0xff);
buf[2] = (crcV & 0xff);
Encode(outStream, buf, 3);
DoWrite(nl);
DoWrite(footerStart);
DoWrite(type);
DoWrite(footerTail);
DoWrite(nl);
outStream.Flush();
type = null;
start = true;
}
}
finally
{
base.Dispose(disposing);
}
}
#endif
private void WriteHeaderEntry(
string name,
string v)
{
DoWrite(name + ": " + v + nl);
}
private void DoWrite(
string s)
{
byte[] bs = Strings.ToAsciiByteArray(s);
outStream.Write(bs, 0, bs.Length);
}
}
}
| 29.382586 | 108 | 0.389188 |
[
"MIT"
] |
SchmooseSA/Schmoose-BouncyCastle
|
Crypto/bcpg/ArmoredOutputStream.cs
| 11,136 |
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.ResourceManager.Cdn.Models
{
public partial class ContinentsResponse
{
internal static ContinentsResponse DeserializeContinentsResponse(JsonElement element)
{
Optional<IReadOnlyList<ContinentsResponseContinentsItem>> continents = default;
Optional<IReadOnlyList<ContinentsResponseCountryOrRegionsItem>> countryOrRegions = default;
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("continents"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.ThrowNonNullablePropertyIsNull();
continue;
}
List<ContinentsResponseContinentsItem> array = new List<ContinentsResponseContinentsItem>();
foreach (var item in property.Value.EnumerateArray())
{
array.Add(ContinentsResponseContinentsItem.DeserializeContinentsResponseContinentsItem(item));
}
continents = array;
continue;
}
if (property.NameEquals("countryOrRegions"))
{
if (property.Value.ValueKind == JsonValueKind.Null)
{
property.ThrowNonNullablePropertyIsNull();
continue;
}
List<ContinentsResponseCountryOrRegionsItem> array = new List<ContinentsResponseCountryOrRegionsItem>();
foreach (var item in property.Value.EnumerateArray())
{
array.Add(ContinentsResponseCountryOrRegionsItem.DeserializeContinentsResponseCountryOrRegionsItem(item));
}
countryOrRegions = array;
continue;
}
}
return new ContinentsResponse(Optional.ToList(continents), Optional.ToList(countryOrRegions));
}
}
}
| 40.684211 | 130 | 0.572229 |
[
"MIT"
] |
93mishra/azure-sdk-for-net
|
sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Models/ContinentsResponse.Serialization.cs
| 2,319 |
C#
|
using System;
namespace UnrealEngine
{
/// <summary>Struct allowing control over "walkable" normals, by allowing a restriction or relaxation of what steepness is normally walkable.</summary>
public partial struct FWalkableSlopeOverride
{
/// <summary>
/// Behavior of this surface (whether we affect the walkable slope).
/// @see GetWalkableSlopeBehavior(), SetWalkableSlopeBehavior()
/// </summary>
public EWalkableSlopeBehavior WalkableSlopeBehavior;
/// <summary>
/// Override walkable slope angle (in degrees), applying the rules of the Walkable Slope Behavior.
/// @see GetWalkableSlopeAngle(), SetWalkableSlopeAngle()
/// </summary>
public float WalkableSlopeAngle;
}
}
| 33.571429 | 152 | 0.744681 |
[
"MIT"
] |
xiongfang/UnrealCS
|
Script/UnrealEngine/GeneratedScriptFile/FWalkableSlopeOverride.cs
| 705 |
C#
|
using System;
using System.Collections.Generic;
using System.Linq;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Types;
using Grasshopper.Kernel.Parameters;
using Rhino.Geometry;
using Parametric_FEM_Toolbox.UIWidgets;
using Parametric_FEM_Toolbox.HelperLibraries;
using Parametric_FEM_Toolbox.RFEM;
using Parametric_FEM_Toolbox.Utilities;
using Dlubal.RFEM5;
using System.Runtime.InteropServices;
using Parametric_FEM_Toolbox.GUI;
namespace Parametric_FEM_Toolbox.Deprecated
{
public class Component_GetData_GUI_OBSOLETE_6 : GH_SwitcherComponent
{
// Declare class variables outside the method "SolveInstance" so their values persist
// when the method is called again.
List<RFNode> rfNodes = new List<RFNode>();
List<RFLine> rfLines = new List<RFLine>();
List<RFMember> rfMembers = new List<RFMember>();
List<RFSurface> rfSurfaces = new List<RFSurface>();
List<RFOpening> rfOpenings = new List<RFOpening>();
List<RFSupportP> rfSupportsP = new List<RFSupportP>();
List<RFSupportL> rfSupportsL = new List<RFSupportL>();
List<RFSupportS> rfSupportsS = new List<RFSupportS>();
List<RFLineHinge> rfLineHinges = new List<RFLineHinge>();
List<RFMemberHinge> rfMemberHinges = new List<RFMemberHinge>();
List<RFNodalRelease> rfNodalReleases = new List<RFNodalRelease>();
List<RFCroSec> rfCroSecs = new List<RFCroSec>();
List<RFMaterial> rfMaterials = new List<RFMaterial>();
List<RFNodalLoad> rfNodalLoads = new List<RFNodalLoad>();
List<RFLineLoad> rfLineLoads = new List<RFLineLoad>();
List<RFMemberLoad> rfMemberLoads = new List<RFMemberLoad>();
List<RFSurfaceLoad> rfSurfaceLoads = new List<RFSurfaceLoad>();
List<RFFreePolygonLoad> rfPolyLoads = new List<RFFreePolygonLoad>();
List<RFFreeLineLoad> rfFreeLineLoads = new List<RFFreeLineLoad>();
List<RFLoadCase> rfLoadCases = new List<RFLoadCase>();
List<RFLoadCombo> rfLoadCombos = new List<RFLoadCombo>();
List<RFResultCombo> rfResultCombos = new List<RFResultCombo>();
int modelDataCount = 0;
int modelDataCount1 = 0;
int modelDataCount2 = 0;
int modelDataCount3 = 0;
/// <summary>
/// Each implementation of GH_Component must provide a public
/// constructor without any arguments.
/// Category represents the Tab in which the component will appear,
/// Subcategory the panel. If you use non-existing tab or panel names,
/// new tabs/panels will automatically be created.
/// </summary>
public Component_GetData_GUI_OBSOLETE_6()
: base("Get Data", "Get Data", "Gets Data from the RFEM Model.", "B+G Toolbox", "RFEM")
{
}
// Define Keywords to search for this Component more easily in Grasshopper
public override IEnumerable<string> Keywords => new string[] {"rf", "get", "data"};
/// <summary>
/// Registers all the input parameters for this component.
/// </summary>
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddBooleanParameter("Run component?", "Run", "If true, the programm is executed.", GH_ParamAccess.item, false);
}
/// <summary>
/// Registers all the output parameters for this component.
/// </summary>
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
}
protected override void RegisterEvaluationUnits(EvaluationUnitManager mngr)
{
EvaluationUnit evaluationUnit = new EvaluationUnit("Get Data", "Get Data", "Gets Data from the RFEM Model.", Properties.Resources.icon_GetData);
mngr.RegisterUnit(evaluationUnit);
// Model Data
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Nodes", "Nodes", "Nodes to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[0].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Lines", "Lines", "Lines to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[1].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Members", "Members", "Members to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[2].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Surfaces", "Surfaces", "Surfaces to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[3].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Openings", "Openings", "Openings to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[4].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Nodal Supports", "NodSup", "Nodal Supports to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[5].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Line Supports", "LineSup", "Line Supports to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[6].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Surface Supports", "SrfcSup", "Surface Supports to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[7].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Member Hinges", "MemberHinges", "Member Hinges to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[8].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Line Hinges", "LineHinges", "Line Hinges to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[9].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Nodal Releases", "NodalReleases", "Nodal Releases to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[10].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Cross Sections", "CroSecs", "Cross Sections from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[11].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Materials", "Mat", "Materials to get from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[12].Parameter.Optional = true;
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Nodes", "RF Nodes", "Nodes from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Lines", "RF Lines", "Lines from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Members", "RF Members", "Members from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Surfaces", "RF Surfaces", "Surfaces from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Openings", "RF Openings", "Openings from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Nodal Supports", "RF NodSup", "Nodal Supports from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Line Supports", "RF LineSup", "Line Supports from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Surface Supports", "RF SrfcSup", "Surface Supports from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Member Hinges", "RF MemberHinges", "Member Hinges from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Line Hinges", "RF LineHinges", "Line Hinges from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "Nodal Releases", "NodalReleases", "Nodal Releases to get from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Cross Sections", "RF CroSecs", "Cross Sections to get from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Materials", "RF Mat", "Materials from the RFEM Model.");
modelDataCount = evaluationUnit.Inputs.Count;
GH_ExtendableMenu gH_ExtendableMenu0 = new GH_ExtendableMenu(0, "Model Data");
gH_ExtendableMenu0.Name = "Model Data";
gH_ExtendableMenu0.Expand();
evaluationUnit.AddMenu(gH_ExtendableMenu0);
for (int i = 0; i < modelDataCount; i++)
{
gH_ExtendableMenu0.RegisterInputPlug(evaluationUnit.Inputs[i]);
gH_ExtendableMenu0.RegisterOutputPlug(evaluationUnit.Outputs[i]);
}
// Load Data
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Nodal Loads", "NLoads", "Nodal Loads from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[modelDataCount + 0].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Line Loads", "LLoads", "Line Loads from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[modelDataCount+ 1].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Member Loads", "MLoads", "Member Loads from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[modelDataCount + 2].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Surface Loads", "SLoads", "Surface Loads from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[modelDataCount + 3].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Free Line Loads", "FLLoads", "Free Line Loads from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[modelDataCount + 4].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Free Polygon Loads", "PolyLoads", "Free Polygon Loads from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[modelDataCount + 5].Parameter.Optional = true;
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Nodal Loads", "RF NLoads", "Nodal Loads from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Line Loads", "RF LLoads", "Line Loads from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Member Loads", "RF MLoads", "Member Loads from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Surface Loads", "RF SLoads", "Surface Loads from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Free Line Loads", "RF FLLoads", "Free Line Loads from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Free Polygon Loads", "RF PolyLoads", "Free Polygon Loads from the RFEM Model.");
modelDataCount2 = evaluationUnit.Inputs.Count;
GH_ExtendableMenu gH_ExtendableMenu1 = new GH_ExtendableMenu(1, "Load Data");
gH_ExtendableMenu1.Name = "Load Data";
gH_ExtendableMenu1.Collapse();
evaluationUnit.AddMenu(gH_ExtendableMenu1);
for (int i = modelDataCount; i < modelDataCount2; i++)
{
gH_ExtendableMenu1.RegisterInputPlug(evaluationUnit.Inputs[i]);
gH_ExtendableMenu1.RegisterOutputPlug(evaluationUnit.Outputs[i]);
}
// Load Cases and Combos
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Load Cases", "LCases", "Load Cases from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[modelDataCount2 + 0].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Load Combos", "LCombos", "Load Combinations from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[modelDataCount2 + 1].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_Boolean(), "Result Combos", "RCombos", "Result Combinations from the RFEM Model.", GH_ParamAccess.item, new GH_Boolean(false));
evaluationUnit.Inputs[modelDataCount2 + 2].Parameter.Optional = true;
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Load Cases", "RF LCases", "Load Cases from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Load Combos", "RF LCombos", "Load Combinations from the RFEM Model.");
evaluationUnit.RegisterOutputParam(new Param_RFEM(), "RF Result Combos", "RF RCombos", "Result Combinations from the RFEM Model.");
modelDataCount3 = evaluationUnit.Inputs.Count;
GH_ExtendableMenu gH_ExtendableMenu2 = new GH_ExtendableMenu(2, "Load Cases and Combos");
gH_ExtendableMenu2.Name = "Load Cases and Combos";
gH_ExtendableMenu2.Collapse();
evaluationUnit.AddMenu(gH_ExtendableMenu2);
for (int i = modelDataCount2; i < modelDataCount3; i++)
{
gH_ExtendableMenu2.RegisterInputPlug(evaluationUnit.Inputs[i]);
gH_ExtendableMenu2.RegisterOutputPlug(evaluationUnit.Outputs[i]);
}
// Advanced
evaluationUnit.RegisterInputParam(new Param_Filter(), "Filter", "Filter", "Filter RFEM Objects", GH_ParamAccess.list);
evaluationUnit.Inputs[modelDataCount3].Parameter.Optional = true;
evaluationUnit.RegisterInputParam(new Param_String(), "Model Name", "Model Name", "Segment of the name of the RFEM Model to get information from", GH_ParamAccess.item);
evaluationUnit.Inputs[modelDataCount3 + 1].Parameter.Optional = true;
GH_ExtendableMenu gH_ExtendableMenu3 = new GH_ExtendableMenu(3, "Advanced");
gH_ExtendableMenu3.Name = "Advanced";
gH_ExtendableMenu3.Collapse();
evaluationUnit.AddMenu(gH_ExtendableMenu3);
for (int i = modelDataCount3; i < modelDataCount3 + 2; i++)
{
gH_ExtendableMenu3.RegisterInputPlug(evaluationUnit.Inputs[i]);
}
}
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object can be used to retrieve data from input parameters and
/// to store data in output parameters.</param>
protected override void SolveInstance(IGH_DataAccess DA, EvaluationUnit unit)
{
// Input counter
modelDataCount1 = 1 + modelDataCount2;
// RFEM variables
var modelName = "";
IModel model = null;
IModelData data = null;
ILoads loads = null;
// Output message
var msg = new List<string>();
// Assign GH Input
bool getnodes = false;
bool getlines = false;
bool getmembers = false;
bool getsurfaces = false;
bool getopenings = false;
bool getsupportsP = false;
bool getsupportsL = false;
bool getsupportsS = false;
bool getMemberHinges = false;
bool getLineHinges = false;
bool getNodalReleases = false;
bool getCroSecs = false;
bool getMaterials = false;
bool getNodalLoads = false;
bool getLineLoads = false;
bool getMemberLoads = false;
bool getSurfaceLoads = false;
bool getFreeLineLoads = false;
bool getPolyLoads = false;
bool getLoadCases = false;
bool getLoadCombos = false;
bool getResultCombos = false;
bool run = false;
var ghFilters = new List<GH_RFFilter>();
var inFilters = new List<RFFilter>();
DA.GetData(0, ref run);
DA.GetData(1, ref getnodes);
DA.GetData(2, ref getlines);
DA.GetData(3, ref getmembers);
DA.GetData(4, ref getsurfaces);
DA.GetData(5, ref getopenings);
DA.GetData(6, ref getsupportsP);
DA.GetData(7, ref getsupportsL);
DA.GetData(8, ref getsupportsS);
DA.GetData(9, ref getMemberHinges);
DA.GetData(10, ref getLineHinges);
DA.GetData(11, ref getNodalReleases);
DA.GetData(12, ref getCroSecs);
DA.GetData(13, ref getMaterials);
DA.GetData(14, ref getNodalLoads);
DA.GetData(15, ref getLineLoads);
DA.GetData(16, ref getMemberLoads);
DA.GetData(17, ref getSurfaceLoads);
DA.GetData(18, ref getFreeLineLoads);
DA.GetData(19, ref getPolyLoads);
DA.GetData(20, ref getLoadCases);
DA.GetData(21, ref getLoadCombos);
DA.GetData(22, ref getResultCombos);
if (DA.GetDataList(modelDataCount3+1, ghFilters))
{
inFilters = ghFilters.Select(x => x.Value).ToList();
}
// Do stuff
if (run)
{
if (!DA.GetData(modelDataCount3+2, ref modelName))
{
Component_GetData.ConnectRFEM(ref model, ref data);
}else
{
Component_GetData.ConnectRFEM(modelName, ref model, ref data);
}
Component_GetData.ClearOutput(ref rfNodes, ref rfLines, ref rfMembers, ref rfSurfaces, ref rfOpenings,
ref rfSupportsP, ref rfSupportsL, ref rfSupportsS, ref rfLineHinges, ref rfCroSecs, ref rfMaterials, ref rfNodalLoads,
ref rfLineLoads, ref rfMemberLoads, ref rfSurfaceLoads, ref rfPolyLoads, ref rfLoadCases, ref rfLoadCombos,
ref rfResultCombos, ref rfMemberHinges, ref rfNodalReleases, ref rfFreeLineLoads);
try
{
if (getnodes)
{
var filNodes = Component_GetData.FilterNodes(data, inFilters);
rfNodes = Component_GetData.GetRFNodes(filNodes, data);
}
if (getlines)
{
var filLines = Component_GetData.FilterLines(data, inFilters);
rfLines = Component_GetData.GetRFLines(filLines, data);
}
if (getmembers)
{
var filMembers = Component_GetData.FilterMembers(data, inFilters);
rfMembers = Component_GetData.GetRFMembers(filMembers, data);
}
if (getsurfaces)
{
var filSrfcs = Component_GetData.FilterSurfaces(data, inFilters);
rfSurfaces = Component_GetData.GetRFSurfaces(filSrfcs, data);
}
if (getopenings)
{
var filOpenings = Component_GetData.FilterOpenings(data, inFilters);
rfOpenings = Component_GetData.GetRFOpenings(filOpenings,data);
}
if (getsupportsP)
{
var filSupportsP = Component_GetData.FilterSupsP(data, inFilters);
rfSupportsP = Component_GetData.GetRFSupportsP(filSupportsP, data);
}
if (getsupportsL)
{
var filSupportsL = Component_GetData.FilterSupsL(data, inFilters);
rfSupportsL = Component_GetData.GetRFSupportsL(filSupportsL, data);
}
if (getsupportsS)
{
var filSupportsS = Component_GetData.FilterSupsS(data, inFilters);
rfSupportsS = Component_GetData.GetRFSupportsS(filSupportsS, data);
}
if (getMemberHinges)
{
var filMemberHinges = Component_GetData.FilterMH(data, inFilters);
rfMemberHinges = Component_GetData.GetRFMemberHinges(filMemberHinges, data);
}
if (getLineHinges)
{
var filLineHinges = Component_GetData.FilterLH(data, inFilters);
rfLineHinges = Component_GetData.GetRFLineHinges(filLineHinges, data);
}
if (getNodalReleases)
{
var filNodalReleases = Component_GetData.FilterNR(data, inFilters);
rfNodalReleases = Component_GetData.GetRFNodalReleases(filNodalReleases, data);
}
if (getCroSecs)
{
var filCroSecs = Component_GetData.FilterCroSecs(data, inFilters);
//rfCroSecs = Component_GetData.GetRFCroSecs(filCroSecs, model, ref msg);
rfCroSecs = Component_GetData.GetRFCroSecs(filCroSecs, model, data, ref msg);
}
if (getMaterials)
{
var filMaterials = Component_GetData.FilterMaterials(data, inFilters);
rfMaterials = Component_GetData.GetRFMaterials(filMaterials, data);
}
//Get Loads?
if (getNodalLoads || getLineLoads || getMemberLoads || getSurfaceLoads || getPolyLoads
|| getLoadCases || getLoadCombos || getResultCombos || getFreeLineLoads)
{
Component_GetData.GetLoadsFromRFEM(model, ref loads);
}
if (getNodalLoads)
{
var filNodalLoads = Component_GetData.FilterNodalLoads(data, loads, inFilters);
rfNodalLoads = Component_GetData.GetRFNodalLoads(filNodalLoads, data);
}
if (getLineLoads)
{
var filLineLoads = Component_GetData.FilterLineLoads(data, loads, inFilters);
rfLineLoads = Component_GetData.GetRFLineLoads(filLineLoads, data);
}
if (getMemberLoads)
{
var filMemberLoads = Component_GetData.FilterMemberLoads(data, loads, inFilters);
rfMemberLoads = Component_GetData.GetRFMemberLoads(filMemberLoads, data);
}
if (getSurfaceLoads)
{
var filSurfaceLoads = Component_GetData.FilterSurfaceLoads(data, loads, inFilters);
rfSurfaceLoads = Component_GetData.GetRFSurfaceLoads(filSurfaceLoads, data);
}
if (getFreeLineLoads)
{
var filLineLoads = Component_GetData.FilterFreeLineLoads(data, loads, inFilters);
rfFreeLineLoads = Component_GetData.GetRFFreeLineLoads(filLineLoads, data);
}
if (getPolyLoads)
{
var filPolyLoads = Component_GetData.FilterPolyLoads(data, loads, inFilters);
rfPolyLoads = Component_GetData.GetRFPolyLoads(filPolyLoads, data);
}
if (getLoadCases)
{
var filLoadCases = Component_GetData.FilterLoadCases(data, loads, inFilters);
rfLoadCases = Component_GetData.GetRFLoadCases(filLoadCases, data);
}
if (getLoadCombos)
{
var filLoadCombos = Component_GetData.FilterLoadCombos(data, loads, inFilters);
rfLoadCombos = Component_GetData.GetRFLoadCombos(filLoadCombos, data);
}
if (getResultCombos)
{
var filResultombos = Component_GetData.FilterResultCombos(data, loads, inFilters);
rfResultCombos = Component_GetData.GetRFResultCombos(filResultombos, data);
}
}
catch (Exception ex)
{
Component_GetData.ClearOutput(ref rfNodes, ref rfLines, ref rfMembers, ref rfSurfaces, ref rfOpenings,
ref rfSupportsP, ref rfSupportsL, ref rfSupportsS, ref rfLineHinges, ref rfCroSecs, ref rfMaterials, ref rfNodalLoads,
ref rfLineLoads, ref rfMemberLoads, ref rfSurfaceLoads, ref rfPolyLoads, ref rfLoadCases, ref rfLoadCombos,
ref rfResultCombos, ref rfMemberHinges, ref rfNodalReleases, ref rfFreeLineLoads);
throw ex;
}
Component_GetData.DisconnectRFEM(ref model, ref data);
}
// Assign GH Output
DA.SetDataList(0, rfNodes);
DA.SetDataList(1, rfLines);
DA.SetDataList(2, rfMembers);
DA.SetDataList(3, rfSurfaces);
DA.SetDataList(4, rfOpenings);
DA.SetDataList(5, rfSupportsP);
DA.SetDataList(6, rfSupportsL);
DA.SetDataList(7, rfSupportsS);
DA.SetDataList(8, rfMemberHinges);
DA.SetDataList(9, rfLineHinges);
DA.SetDataList(10, rfNodalReleases);
DA.SetDataList(11, rfCroSecs);
DA.SetDataList(12, rfMaterials);
DA.SetDataList(13, rfNodalLoads);
DA.SetDataList(14, rfLineLoads);
DA.SetDataList(15, rfMemberLoads);
DA.SetDataList(16, rfSurfaceLoads);
DA.SetDataList(17, rfFreeLineLoads);
DA.SetDataList(18, rfPolyLoads);
DA.SetDataList(19, rfLoadCases);
DA.SetDataList(20, rfLoadCombos);
DA.SetDataList(21, rfResultCombos);
if (msg.Count != 0)
{
//errorMsg.Add("List item index may be one unit lower than object number");
AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, String.Join(System.Environment.NewLine, msg.ToArray()));
}
}
/// <summary>
/// The Exposure property controls where in the panel a component icon
/// will appear. There are seven possible locations (primary to septenary),
/// each of which can be combined with the GH_Exposure.obscure flag, which
/// ensures the component will only be visible on panel dropdowns.
/// </summary>
public override GH_Exposure Exposure
{
get { return GH_Exposure.hidden; }
}
/// <summary>
/// Provides an Icon for every component that will be visible in the User Interface.
/// Icons need to be 24x24 pixels.
/// </summary>
protected override System.Drawing.Bitmap Icon
{
get
{
// You can add image files to your project resources and access them like this:
//return Resources.IconForThisComponent;
return Properties.Resources.icon_GetData;
}
}
/// <summary>
/// Each component must have a unique Guid to identify it.
/// It is vital this Guid doesn't change otherwise old ghx files
/// that use the old ID will partially fail during loading.
/// </summary>
public override Guid ComponentGuid
{
get { return new Guid("6d5e694d-4fe4-405a-ac82-92ecf2ca8e83"); }
}
}
}
| 56.968317 | 192 | 0.612673 |
[
"Apache-2.0"
] |
diego-apellaniz/Parametric-FEM-Toolbox
|
Parametric_FEM_Toolbox/Parametric_FEM_Toolbox/Deprecated/Component_GetData_GUI_OBSOLETE_6.cs
| 28,771 |
C#
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JoinRpg.CommonUI.Models")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JoinRpg.CommonUI.Models")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("81185840-6da0-440b-813a-e32d6ccad34e")]
// 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.333333 | 84 | 0.742754 |
[
"MIT"
] |
FulcrumVlsM/joinrpg-net
|
JoinRpg.CommonUI.Models/Properties/AssemblyInfo.cs
| 1,383 |
C#
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace CustomLoginPage
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
| 26.090909 | 70 | 0.709059 |
[
"Apache-2.0"
] |
AkhilNaidu09/IdentityServer3.Samples
|
source/CustomLoginPage/CustomLoginPage/Global.asax.cs
| 576 |
C#
|
using ContactList.Models;
using System;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace ContactList.Controllers
{
public class HomeController : Controller
{
// GET: Home
public async Task<ActionResult> Index()
{
var mgr = new ContactManager();
var contactList = await mgr.GetAllAsync();
return View(contactList);
}
// GET: Home/Details/5
public async Task<ActionResult> Details(string id)
{
var mgr = new ContactManager();
var contact = await mgr.GetByIdAsync(id);
return View(contact);
}
// GET: Home/Create
public ActionResult Create()
{
return View();
}
// POST: Home/Create
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Create(Contact newContact)
{
try
{
if (ModelState.IsValid)
{
var mgr = new ContactManager();
await mgr.CreateAsync(newContact);
return RedirectToAction("Index");
}
else
{
throw new ArgumentException("Name is required.");
}
}
catch
{
return View(newContact);
}
}
// GET: Home/Edit/5
public async Task<ActionResult> Edit(string id)
{
var mgr = new ContactManager();
var contact = await mgr.GetByIdAsync(id);
return View(contact);
}
// POST: Home/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Edit(Contact editContact)
{
try
{
if (ModelState.IsValid)
{
var mgr = new ContactManager();
await mgr.UpdateAsync(editContact);
return RedirectToAction("Index");
}
else
{
throw new ArgumentException("Name is required.");
}
}
catch
{
return View(editContact);
}
}
// GET: Home/Delete/5
[HttpGet]
public async Task<ActionResult> Delete(string id)
{
var mgr = new ContactManager();
var contact = await mgr.GetByIdAsync(id);
return View(contact);
}
// POST: Home/Delete/5
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Delete(Contact deleteContact)
{
try
{
var mgr = new ContactManager();
await mgr.DeleteAsync(deleteContact.Id);
return RedirectToAction("Index");
}
catch
{
return View();
}
}
}
}
| 26.53913 | 69 | 0.465924 |
[
"Unlicense"
] |
geoffsnowman/DocumentDBSampleCode
|
ContactList/Controllers/HomeController.cs
| 3,054 |
C#
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace SimpleSoft.Database
{
/// <summary>
/// Represents the read bulk operation by a collection of
/// external unique identifiers
/// </summary>
/// <typeparam name="TEntity">The entity type</typeparam>
/// <typeparam name="TId">The unique identifier type</typeparam>
public class EFCoreReadByExternalIdRange<TEntity, TId> : IReadByExternalIdRange<TEntity, TId>
where TEntity : class, IEntity, IHaveExternalId<TId>
where TId : IEquatable<TId>
{
private readonly IQueryable<TEntity> _query;
/// <summary>
/// Creates a new instance
/// </summary>
/// <param name="query"></param>
public EFCoreReadByExternalIdRange(IQueryable<TEntity> query)
{
_query = query;
}
/// <inheritdoc />
public async Task<IEnumerable<TEntity>> ReadAsync(IEnumerable<TId> externalIds, CancellationToken ct)
{
if (externalIds == null) throw new ArgumentNullException(nameof(externalIds));
return await _query.Where(e => externalIds.Contains(e.ExternalId)).ToListAsync(ct).ConfigureAwait(false);
}
}
/// <summary>
/// Represents the exists operation by an external unique identifier
/// of <see cref="Guid"/> type.
/// </summary>
/// <typeparam name="TEntity">The entity type</typeparam>
public class EFCoreReadByExternalIdRange<TEntity> : EFCoreReadByExternalIdRange<TEntity, Guid>, IReadByExternalIdRange<TEntity>
where TEntity : class, IEntity, IHaveExternalId
{
/// <summary>
/// Creates a new instance
/// </summary>
/// <param name="query"></param>
public EFCoreReadByExternalIdRange(IQueryable<TEntity> query) : base(query)
{
}
}
}
| 33.844828 | 131 | 0.648497 |
[
"MIT"
] |
simplesoft-pt/Database
|
src/SimpleSoft.Database.EFCore/EFCoreReadByExternalIdRange.cs
| 1,965 |
C#
|
using System;
namespace Microshoppy.Catalog
{
public class CatalogProduct
{
public Guid ProductId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}
}
| 16.583333 | 41 | 0.698492 |
[
"MIT"
] |
micro-shoppy/catalog
|
Microshoppy.Catalog/Microshoppy.Catalog/src/CatalogProduct.cs
| 199 |
C#
|
namespace codingfreaks.AspNetIdentity.Logic.Core.Repositories
{
using System;
using System.Diagnostics;
using System.Linq;
using Data.Core;
/// <summary>
/// Abstract base class for all repositories.
/// </summary>
public abstract class BaseRespository : IDisposable
{
#region member vars
private readonly Lazy<IdentityEntities> _dbContextFactory = new Lazy<IdentityEntities>(() => ContextUtil.Context);
private bool _disposed;
#endregion
#region explicit interfaces
/// <inheritdoc />
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
#region methods
/// <summary>
/// Releases the unmanaged resources that are used by the object and, optionally, releases the managed resources.
/// </summary>
/// <param name="disposing">
/// true to release both managed and unmanaged resources; false to release only unmanaged
/// resources.
/// </param>
protected virtual void Dispose(bool disposing)
{
if (_disposed || !disposing)
{
return;
}
if (_dbContextFactory.IsValueCreated)
{
_dbContextFactory.Value.Dispose();
}
_disposed = true;
}
/// <summary>
/// Central exception handler for all repositories.
/// </summary>
/// <param name="ex"></param>
protected virtual void HandleException(Exception ex)
{
Trace.TraceError(ex.Message);
}
~BaseRespository()
{
Dispose(false);
}
#endregion
#region properties
/// <summary>
/// The entity context.
/// </summary>
protected IdentityEntities DbContext => _dbContextFactory.Value;
#endregion
}
}
| 24.775 | 122 | 0.551463 |
[
"MIT"
] |
Farshadhn/blogsamples
|
AspNetIdentity/Logic/Logic.Core/Repositories/BaseRepository.cs
| 1,984 |
C#
|
namespace PlanetWars.Contracts.ManagementContracts
{
public class ApiGameResults
{
public ApiGameResults(ApiGameStats gameStats, string? fatalException, string[]? internalLog)
{
GameStats = gameStats;
FatalException = fatalException;
InternalLog = internalLog;
}
public ApiGameStats GameStats { get; }
public string? FatalException { get; }
public string[]? InternalLog { get; }
}
}
| 30 | 100 | 0.63125 |
[
"MIT"
] |
icfpcontest2020/galaxy
|
src/PlanetWars.Contracts/ManagementContracts/ApiGameResults.cs
| 482 |
C#
|
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System;
using System.Collections;
using System.Collections.Generic;
[AddComponentMenu("UI/UI ListGrid")]
public class UI_ListGrid : MonoBehaviour
{
public enum DIR
{
UP_RIGHT,
UP_LEFT,
DOWN_RIGHT,
DOWN_LEFT,
LEFT_UP,
LEFT_DOWN,
RIGHT_UP,
RIGHT_DOWN
}
[SerializeField]
public int IntervalLine;
[SerializeField]
public int IntervalItem;
[SerializeField]
public int LineMaxCount;
[SerializeField]
public DIR Dir = DIR.DOWN_RIGHT;
void Awake()
{
Refresh();
}
public void Refresh()
{
int childCount = this.transform.childCount;
int dirx = 1;
int diry = 1;
switch(this.Dir)
{
case DIR.UP_RIGHT:
dirx = 1;
diry = 1;
break;
case DIR.UP_LEFT:
dirx = -1;
diry = 1;
break;
case DIR.DOWN_RIGHT:
dirx = 1;
diry = -1;
break;
case DIR.DOWN_LEFT:
dirx = -1;
diry = -1;
break;
case DIR.LEFT_UP:
dirx = -1;
diry = 1;
break;
case DIR.LEFT_DOWN:
dirx = -1;
diry = -1;
break;
case DIR.RIGHT_UP:
dirx = 1;
diry = 1;
break;
case DIR.RIGHT_DOWN:
dirx = 1;
diry = -1;
break;
}
if(this.Dir <= DIR.DOWN_LEFT)
{
for(int i = 0 ; i<childCount ; i++)
{
Vector3 pos = new Vector3(i%LineMaxCount*IntervalItem*dirx,i/LineMaxCount*IntervalLine*diry,0);
Transform child = this.transform.GetChild(i);
child.localPosition = pos;
}
}
else
{
for(int i = 0 ; i<childCount ; i++)
{
Vector3 pos = new Vector3(i/LineMaxCount*IntervalLine*dirx,i%LineMaxCount*IntervalItem*diry,0);
Transform child = this.transform.GetChild(i);
child.localPosition = pos;
}
}
}
}
| 16.76699 | 99 | 0.631731 |
[
"MIT"
] |
luzexi/kdm-client
|
u3d/Assets/scripts/ui/core/Component/UI_ListGrid.cs
| 1,727 |
C#
|
using LNLOrder.Write.Application.Infrastructure;
using System;
using System.Collections.Generic;
using System.Text;
namespace LNLOrder.Write.Application.Customers
{
public class RegisterCustomerCommand : ICommand
{
public string Name { get; set; }
public string Adress { get; set; }
public string Email { get; set; }
}
}
| 23.866667 | 51 | 0.701117 |
[
"MIT"
] |
huseyinulas/CQRS-Demo
|
OrderProject.Application/Customers/RegisterCustomerCommand.cs
| 360 |
C#
|
//
// Copyright (c) Stanislav Grigoriev. All rights reserved.
// [email protected]
// https://github.com/StanislavGrigoriev/EasyCNTK
//
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//
using CNTK;
namespace EasyCNTK.LossFunctions
{
public sealed class SquaredError : Loss
{
public override Function GetLoss(Variable prediction, Variable targets, DeviceDescriptor device)
{
return CNTKLib.SquaredError(prediction, targets);
}
}
}
| 27.227273 | 105 | 0.709516 |
[
"MIT"
] |
StanislavGrigoriev/EasyCNTK
|
Source/EasyCNTK/LossFunctions/SquaredError.cs
| 601 |
C#
|
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* 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 Newtonsoft.Json;
namespace QuantConnect.Algorithm.Framework.Alphas
{
/// <summary>
/// Defines the scores given to a particular insight
/// </summary>
public class InsightScore
{
/// <summary>
/// Gets the time these scores were last updated
/// </summary>
[JsonProperty]
public DateTime UpdatedTimeUtc { get; private set; }
/// <summary>
/// Gets the direction score
/// </summary>
[JsonProperty]
public double Direction { get; private set; }
/// <summary>
/// Gets the magnitude score
/// </summary>
[JsonProperty]
public double Magnitude { get; private set; }
/// <summary>
/// Gets whether or not this is the insight's final score
/// </summary>
[JsonProperty]
public bool IsFinalScore { get; private set; }
/// <summary>
/// Initializes a new, default instance of the <see cref="InsightScore"/> class
/// </summary>
public InsightScore()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="InsightScore"/> class
/// </summary>
/// <param name="direction">The insight direction score</param>
/// <param name="magnitude">The insight percent change score</param>
/// <param name="updatedTimeUtc">The algorithm utc time these scores were computed</param>
public InsightScore(double direction, double magnitude, DateTime updatedTimeUtc)
{
Direction = direction;
Magnitude = magnitude;
UpdatedTimeUtc = updatedTimeUtc;
}
/// <summary>
/// Sets the specified score type with the value
/// </summary>
/// <param name="type">The score type to be set, Direction/Magnitude</param>
/// <param name="value">The new value for the score</param>
/// <param name="algorithmUtcTime">The algorithm's utc time at which time the new score was computed</param>
internal void SetScore(InsightScoreType type, double value, DateTime algorithmUtcTime)
{
if (IsFinalScore) return;
UpdatedTimeUtc = algorithmUtcTime;
switch (type)
{
case InsightScoreType.Direction:
Direction = Math.Max(0, Math.Min(1, value));
break;
case InsightScoreType.Magnitude:
Magnitude = Math.Max(0, Math.Min(1, value));
break;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
}
/// <summary>
/// Marks the score as finalized, preventing any further updates.
/// </summary>
/// <param name="algorithmUtcTime">The algorithm's utc time at which time these scores were finalized</param>
internal void Finalize(DateTime algorithmUtcTime)
{
IsFinalScore = true;
UpdatedTimeUtc = algorithmUtcTime;
}
/// <summary>
/// Gets the specified score
/// </summary>
/// <param name="type">The type of score to get, Direction/Magnitude</param>
/// <returns>The requested score</returns>
public double GetScore(InsightScoreType type)
{
switch (type)
{
case InsightScoreType.Direction:
return Direction;
case InsightScoreType.Magnitude:
return Magnitude;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
}
/// <summary>Returns a string that represents the current object.</summary>
/// <returns>A string that represents the current object.</returns>
/// <filterpriority>2</filterpriority>
public override string ToString()
{
return $"Direction: {Math.Round(100 * Direction, 2)} Magnitude: {Math.Round(100 * Magnitude, 2)}";
}
}
}
| 35.639706 | 117 | 0.5915 |
[
"Apache-2.0"
] |
AdvaithD/Lean
|
Common/Algorithm/Framework/Alphas/InsightScore.cs
| 4,849 |
C#
|
namespace ModernTlSharp.TLSharp.Tl.TL
{
public abstract class TLAbsFoundGif : TLObject
{
}
}
| 15 | 50 | 0.695238 |
[
"MIT"
] |
immmdreza/ModernTLSharp
|
ModernTlSharp/TLSharp.Tl/TL/TLAbsFoundGif.cs
| 105 |
C#
|
using System;
using System.IO;
using System.Security.Cryptography;
namespace Rebus.Encryption
{
/// <summary>
/// Helps with encrypting/decripting byte arrays, using the <see cref="RijndaelManaged"/> algorithm
/// </summary>
class RijndaelEncryptor : IEncryptor
{
readonly byte[] _key;
/// <summary>
/// Returns "rijndael" string
/// </summary>
public string ContentEncryptionValue => "rijndael";
/// <summary>
/// Creates the encrptor with the specified key - the key must be a valid, base64-encoded key
/// </summary>
/// <param name="key"></param>
public RijndaelEncryptor(string key)
{
try
{
_key = Convert.FromBase64String(key);
using var rijndael = Aes.Create();
rijndael.Key = _key;
}
catch (Exception exception)
{
throw new ArgumentException(
$@"Could not initialize the encryption algorithm with the specified key (not shown here for security reasons) - if you're unsure how to get a valid key, here's a newly generated key that you can use:
{GenerateNewKey()}
I promise that the suggested key has been generated this instant - if you don't believe me, feel free to run the program again ;)", exception);
}
}
static string GenerateNewKey()
{
using var rijndael = Aes.Create();
rijndael.GenerateKey();
return Convert.ToBase64String(rijndael.Key);
}
/// <summary>
/// Encrypts the given array of bytes, using the configured key. Returns an <see cref="EncryptedData"/> containing the encrypted
/// bytes and the generated salt.
/// </summary>
public EncryptedData Encrypt(byte[] bytes)
{
using var rijndael = Aes.Create();
rijndael.GenerateIV();
rijndael.Key = _key;
using var encryptor = rijndael.CreateEncryptor();
using var destination = new MemoryStream();
using var cryptoStream = new CryptoStream(destination, encryptor, CryptoStreamMode.Write);
cryptoStream.Write(bytes, 0, bytes.Length);
cryptoStream.FlushFinalBlock();
return new EncryptedData(destination.ToArray(), rijndael.IV);
}
/// <summary>
/// Decrypts the given <see cref="EncryptedData"/> using the configured key.
/// </summary>
public byte[] Decrypt(EncryptedData encryptedData)
{
var iv = encryptedData.Iv;
var bytes = encryptedData.Bytes;
using var rijndael = Aes.Create();
rijndael.IV = iv;
rijndael.Key = _key;
using var decryptor = rijndael.CreateDecryptor();
using var destination = new MemoryStream();
using var cryptoStream = new CryptoStream(destination, decryptor, CryptoStreamMode.Write);
cryptoStream.Write(bytes, 0, bytes.Length);
cryptoStream.FlushFinalBlock();
return destination.ToArray();
}
}
}
| 35.021978 | 219 | 0.588641 |
[
"MIT"
] |
microting/Rebus
|
Rebus/Encryption/RijndaelEncryptor.cs
| 3,189 |
C#
|
using Abp.AutoMapper;
using Abp.Modules;
using Abp.Reflection.Extensions;
using Group12.SE347.L11_HelloWork.Application.Services.SearchJobs.Dto;
using SE347.L11_HelloWork.Entities;
using System.Linq;
namespace Group12.SE347.L11_HelloWork.Application
{
public class Group12ApplicationModule : AbpModule
{
public Group12ApplicationModule() { }
public override void Initialize()
{
}
public override void PreInitialize()
{
IocManager.RegisterAssemblyByConvention(typeof(Group12ApplicationModule).GetAssembly());
Configuration.Modules.AbpAutoMapper().Configurators.Add(config =>
{
config.CreateMap<Recruitment, JobResultDto>()
.ForMember(u => u.Expertises, options => options.MapFrom(x => x.ExpertiseRecruitments.Select(ept => ept.Expertise.Name).ToList()));
});
}
}
}
| 30.766667 | 153 | 0.666306 |
[
"MIT"
] |
NgocSon288/HelloWork
|
aspnet-core/src/group12/Group12.SE347.L11_HelloWork.Application/Group12ApplicationModule.cs
| 925 |
C#
|
namespace ParteSISOL.Models.Servicios
{
public class RepositorioDenominaciones
{
}
}
| 14 | 42 | 0.714286 |
[
"MIT"
] |
pSharpX/ParteSISOL
|
ParteSISOL/Servicios/RepositorioDenominaciones.cs
| 100 |
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.