content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|
using Philcosa.Application.Interfaces.Services;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
namespace Philcosa.Server.Services
{
public class CurrentUserService : ICurrentUserService
{
public CurrentUserService(IHttpContextAccessor httpContextAccessor)
{
UserId = httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier);
Claims = httpContextAccessor.HttpContext?.User?.Claims.AsEnumerable().Select(item => new KeyValuePair<string, string>(item.Type, item.Value)).ToList();
}
public string UserId { get; }
public List<KeyValuePair<string, string>> Claims { get; set; }
}
} | 37.35 | 163 | 0.728246 | [
"MIT"
] | HenkVanMilligen/Philcosa | Philcosa/Server/Services/CurrentUserService.cs | 749 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SurrogateLibrary.Helpers
{
internal class DictionaryEx<TKey, TValue> : Dictionary<TKey, TValue>, IEquatable<DictionaryEx<TKey, TValue>>
{
public DictionaryEx() : base()
{
}
public DictionaryEx(int capacity) : base(capacity)
{
}
public DictionaryEx(IEnumerable<KeyValuePair<TKey, TValue>> collection) : base(collection)
{
}
public DictionaryEx(IEqualityComparer<TKey> comparer) : base(comparer)
{
}
public DictionaryEx(IDictionary<TKey, TValue> dictionary) : base(dictionary)
{
}
public DictionaryEx(int capacity, IEqualityComparer<TKey> comparer) : base(capacity, comparer)
{
}
public DictionaryEx(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context)
{
}
public DictionaryEx(IEnumerable<KeyValuePair<TKey, TValue>> collection,
IEqualityComparer<TKey> comparer) : base(collection, comparer)
{
}
public DictionaryEx(IDictionary<TKey, TValue> dictionary,
IEqualityComparer<TKey> comparer) : base(dictionary, comparer)
{
}
public static bool operator ==(DictionaryEx<TKey, TValue> obj1,
DictionaryEx<TKey, TValue> obj2)
{
if (object.ReferenceEquals(obj1, null)) return false;
return obj1.Equals(obj2);
}
public static bool operator !=(DictionaryEx<TKey, TValue> obj1,
DictionaryEx<TKey, TValue> obj2)
{
return !(obj1 == obj2);
}
/// <summary>
/// https://stackoverflow.com/a/8094931/492913
/// </summary>
public override int GetHashCode()
{
unchecked
{
int hash = 19;
foreach (var item in this)
{
hash = hash * 31 + item.GetHashCode();
}
return hash;
}
}
public override bool Equals(object obj)
{
return Equals(obj as DictionaryEx<TKey, TValue>);
}
public bool Equals(DictionaryEx<TKey, TValue> other)
{
if (object.ReferenceEquals(other, null)) return false;
if (object.ReferenceEquals(this, other)) return true;
return this.Intersect(other).Count() == this.Count;
}
}
}
| 27.789474 | 112 | 0.571591 | [
"MIT"
] | raffaeler/SemanticDrivenModeling | src/SemanticModelingSolution/SurrogateLibrary/Helpers/DictionaryEx.cs | 2,642 | C# |
namespace Mozilla.IoT.WebThing.Integration.Test.Events.String
{
public class EnumEvent : AbstractStructEventTest<Foo>
{
}
public enum Foo
{
A,
B,
C
}
}
| 14.266667 | 61 | 0.542056 | [
"Apache-2.0"
] | jabastien/webthing-csharp | tests/Mozilla.IoT.WebThing.Integration.Test/Events/String/EnumEvent.cs | 214 | C# |
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Aspose" file="QrParams.cs">
// Copyright (c) 2021 Aspose.BarCode for Cloud
// </copyright>
// <summary>
// 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.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
//
// This source code was auto-generated by AsposeBarcodeCloudCodegen.
//
using System;
using System.Collections.Generic;
using System.Text;
namespace Aspose.BarCode.Cloud.Sdk.Model
{
/// <summary>
/// QR parameters.
/// </summary>
public class QrParams
{
/// <summary>
/// QR / MicroQR selector mode. Select ForceQR for standard QR symbols, Auto for MicroQR.
/// </summary>
public QREncodeType? EncodeType { get; set; }
/// <summary>
/// Extended Channel Interpretation Identifiers. It is used to tell the barcode reader details about the used references for encoding the data in the symbol. Current implementation consists all well known charset encodings.
/// </summary>
public ECIEncodings? ECIEncoding { get; set; }
/// <summary>
/// QR symbology type of BarCode's encoding mode. Default value: QREncodeMode.Auto.
/// </summary>
public QREncodeMode? EncodeMode { get; set; }
/// <summary>
/// Level of Reed-Solomon error correction for QR barcode. From low to high: LevelL, LevelM, LevelQ, LevelH. see QRErrorLevel.
/// </summary>
public QRErrorLevel? ErrorLevel { get; set; }
/// <summary>
/// Version of QR Code. From Version1 to Version40 for QR code and from M1 to M4 for MicroQr. Default value is QRVersion.Auto.
/// </summary>
public QRVersion? Version { get; set; }
/// <summary>
/// Height/Width ratio of 2D BarCode module.
/// </summary>
public double? AspectRatio { get; set; }
/// <summary>
/// Encoding of codetext.
/// </summary>
public string TextEncoding { get; set; }
/// <summary>
/// QR structured append parameters.
/// </summary>
public StructuredAppend StructuredAppend { get; set; }
/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class QrParams {\n");
sb.Append(" AspectRatio: ").Append(AspectRatio).Append("\n");
sb.Append(" TextEncoding: ").Append(TextEncoding).Append("\n");
sb.Append(" EncodeType: ").Append(EncodeType).Append("\n");
sb.Append(" ECIEncoding: ").Append(ECIEncoding).Append("\n");
sb.Append(" EncodeMode: ").Append(EncodeMode).Append("\n");
sb.Append(" ErrorLevel: ").Append(ErrorLevel).Append("\n");
sb.Append(" Version: ").Append(Version).Append("\n");
sb.Append(" StructuredAppend: ").Append(StructuredAppend).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
}
}
| 42.288462 | 235 | 0.594588 | [
"MIT"
] | aspose-barcode-cloud/aspose-barcode-cloud-dotnet | src/Model/QrParams.cs | 4,398 | C# |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Concurrent;
using System.Linq;
namespace Microsoft.EntityFrameworkCore.TestUtilities
{
public static class DataGenerator
{
private static readonly ConcurrentDictionary<Type, object[]> Values = new ConcurrentDictionary<Type, object[]>();
private static readonly ConcurrentDictionary<int, object[][]> _boolCombinations
= new ConcurrentDictionary<int, object[][]>();
public static object[][] GetBoolCombinations(int length)
=> _boolCombinations.GetOrAdd(length, l => GetCombinations(Values[typeof(bool)], l));
static DataGenerator()
{
Values[typeof(bool)] = new object[] { false, true };
Values[typeof(bool?)] = new object[] { null, false, true };
}
public static object[][] GetCombinations(object[] set, int length)
{
var sets = new object[length][];
Array.Fill(sets, set);
return GetCombinations(sets);
}
public static object[][] GetCombinations(params Type[] types)
{
var sets = new object[types.Length][];
for (var i = 0; i < types.Length; i++)
{
var type = types[i];
if (!Values.TryGetValue(type, out var values))
{
if (!type.IsDefined(typeof(FlagsAttribute), false))
{
values = Enum.GetValues(type).Cast<object>().ToArray();
Values[type] = values;
}
else
{
throw new InvalidOperationException($"The set of values for the type {type} is not known.");
}
}
sets[i] = values;
}
return GetCombinations(sets);
}
public static object[][] GetCombinations(object[][] sets)
{
var numberOfCombinations = sets.Aggregate(1L, (current, set) => current * set.Length);
var combinations = new object[numberOfCombinations][];
for (var i = 0L; i < numberOfCombinations; i++)
{
var combination = new object[sets.Length];
var temp = i;
for (var j = 0; j < sets.Length; j++)
{
var set = sets[j];
combination[j] = set[(int)(temp % set.Length)];
temp /= set.Length;
}
combinations[i] = combination;
}
return combinations;
}
}
}
| 34.592593 | 121 | 0.521413 | [
"Apache-2.0"
] | 0b01/efcore | test/EFCore.Specification.Tests/TestUtilities/DataGenerator.cs | 2,802 | C# |
using MyXObject;
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
namespace MyXAribute
{
/// <summary>
/// 贝塞尔曲线
/// </summary>
public class BezierLine : IDisposable
{
#region 自定义属性
/// <summary>
/// 标示符
/// </summary>
private int _id;
/// <summary>
/// 提供曲线形状的控件可测试区域
/// </summary>
Path connector = new Path();
/// <summary>
/// 表示有各种图形组成的复杂形状
/// </summary>
private PathGeometry connectorGeometry;
/// <summary>
/// 表示由各种元素组成的复杂路劲
/// </summary>
private PathFigure connectorPoints;
/// <summary>
/// 构建一个三次方的贝塞尔曲线
/// </summary>
private BezierSegment connectorCurve;
/// <summary>
/// 笔触的大小
/// </summary>
private double _strokeThickness = 5;
/// <summary>
/// 起始点
/// </summary>
private BezierPoint _startPoint = new BezierPoint();
/// <summary>
/// 最大弯曲距离
/// </summary>
private double maxdis = 300;
/// <summary>
/// 最小距离
/// </summary>
private double mindis = 10;
/// <summary>
/// 结束点
/// </summary>
private BezierPoint _endPoint = new BezierPoint();
/// <summary>
/// 弯曲率
/// </summary>
private static float BendLow = 1.1f;
#endregion
#region 读取器
/// <summary>
/// 笔触大小读取器
/// </summary>
public double StrokeThickness
{
get
{
return _strokeThickness;
}
set
{
_strokeThickness = value;
connector.StrokeThickness = value;
}
}
/// <summary>
/// 贝塞尔曲线对象
/// </summary>
public Path Bezier
{
get
{
return connector;
}
}
/// <summary>
/// 标示符
/// </summary>
public int Id
{
get
{
return _id;
}
set
{
_id = value;
//connector.Name = value;
}
}
/// <summary>
/// 起始点
/// </summary>
public BezierPoint StartPoint
{
get
{
return _startPoint;
}
set
{
_startPoint = value;
}
}
/// <summary>
/// 结束点
/// </summary>
public BezierPoint EndPoint
{
get
{
return _endPoint;
}
set
{
_endPoint = value;
}
}
#endregion
#region 构造函数
/// <summary>
/// 构造函数
/// </summary>
/// <param name="id">id</param>
/// <param name="LineColor">线条的颜色</param>
/// <param name="onePoint">坐标</param>
/// <param name="position">位置信息</param>
public BezierLine(int id, Color LineColor, Point onePoint, XAribute.XPositonStyle position)
{
///赋予笔刷
connector.Stroke = new SolidColorBrush(LineColor);
///赋予笔触
connector.StrokeThickness = _strokeThickness;
///实例化
connectorGeometry = new PathGeometry();
connectorPoints = new PathFigure();
connectorCurve = new BezierSegment();
StartPoint.position = onePoint;
StartPoint.positionType = position;
EndPoint.position = onePoint;
///设置贝塞尔曲线的开始点
connectorPoints.StartPoint = StartPoint.position;
SetBezierLine(EndPoint.position, position);
connectorPoints.Segments.Add(connectorCurve);
connectorGeometry.Figures.Add(connectorPoints);
connector.Data = connectorGeometry;
this.Id = id;
}
/// <summary>
/// 构造函数
/// </summary>
/// <param name="id">id</param>
/// <param name="LineColor">线条的颜色</param>
/// <param name="onePoint">坐标</param>
/// <param name="position">位置信息</param>
public BezierLine(int id)
{
this.Id = id;
}
/// <summary>
/// 析构函数
/// </summary>
~BezierLine()
{
Dispose();
}
#endregion
#region 自定义函数
/// <summary>
/// 在已经设置信息的情况下初始化
/// </summary>
protected void InitLineInformation()
{
///赋予笔刷
connector.Stroke = new SolidColorBrush(StartPoint.LinkAribute.BorderColor);
///赋予笔触
connector.StrokeThickness = _strokeThickness;
///实例化
connectorGeometry = new PathGeometry();
connectorPoints = new PathFigure();
connectorCurve = new BezierSegment();
///设置贝塞尔曲线的开始点
connectorPoints.StartPoint = StartPoint.position;
AdjustBezierLine();
connectorPoints.Segments.Add(connectorCurve);
connectorGeometry.Figures.Add(connectorPoints);
connector.Data = connectorGeometry;
}
/// <summary>
/// 设置贝塞尔曲线的控制点
/// </summary>
/// <param name="EndPoint">结束点</param>
private void SetBezierOver(int pos,Point OverPoint)
{
//switch(pos)
//{
// case 1:
// connectorCurve.Point1 = new Point(StartPoint.X + (StartPoint.X + OverPoint.X)/10, StartPoint.Y);
// connectorCurve.Point2 = new Point(OverPoint.X - (StartPoint.X + OverPoint.X) / 10, OverPoint.Y);
// connectorCurve.Point3 = OverPoint;
// break;
// case 2:
// connectorCurve.Point1 = new Point(StartPoint.X - (StartPoint.X + OverPoint.X) / 10, StartPoint.Y);
// connectorCurve.Point2 = new Point(OverPoint.X + (StartPoint.X + OverPoint.X) / 10, OverPoint.Y);
// connectorCurve.Point3 = OverPoint;
// break;
// case 3:
// connectorCurve.Point1 = new Point(StartPoint.X - (StartPoint.X + OverPoint.X) / 10, StartPoint.Y);
// connectorCurve.Point2 = new Point(OverPoint.X + (StartPoint.X + OverPoint.X) / 10, OverPoint.Y);
// connectorCurve.Point3 = OverPoint;
// break;
// case 4:
// connectorCurve.Point1 = new Point(StartPoint.X + (StartPoint.X + OverPoint.X) / 10, StartPoint.Y);
// connectorCurve.Point2 = new Point(OverPoint.X - (StartPoint.X + OverPoint.X) / 10, OverPoint.Y);
// connectorCurve.Point3 = OverPoint;
// break;
//}
}
/// <summary>
/// 设置贝塞尔曲线的控制点
/// </summary>
/// <param name="EndPoint">结束点</param>
private void SetBezierOver(XAribute.XPositonStyle position, Point OverPoint)
{
EndPoint.position = OverPoint;
EndPoint.positionType = position;
AdjustBezierLine();
}
/// <summary>
/// 调整贝塞尔曲线的位置
/// </summary>
/// <param name="position">结尾点位置信息</param>
public void AdjustBezierLine()
{
///起始点
Point startp = StartPoint.LinkAribute == null ? StartPoint.position : StartPoint.LinkAribute.GetWorldPosition();
///终止点
Point endp = EndPoint.LinkAribute == null ? EndPoint.position : EndPoint.LinkAribute.GetWorldPosition();
///弯曲度
double cury = Math.Abs(startp.Y - endp.Y) / BendLow;
double curx = 0;
///需要的情况下才启用X方向的取值
if(StartPoint.LinkAribute != null && StartPoint.LinkAribute.SelectPositionStyle == XAribute.XPositonStyle.Left && (startp.X - endp.X) < 0)
{
curx = Math.Abs(startp.X - endp.X) / BendLow;
}
else if(StartPoint.LinkAribute != null && StartPoint.LinkAribute.SelectPositionStyle == XAribute.XPositonStyle.right && (startp.X - endp.X) > 0)
{
curx = Math.Abs(startp.X - endp.X) / BendLow;
}
double cur = curx > cury ? curx : cury;
///弯曲度
double dis = cur > maxdis ? maxdis : cur;
dis = dis < mindis ? mindis : dis;
switch (EndPoint.positionType)
{
case XAribute.XPositonStyle.Left:
connectorPoints.StartPoint = startp;
connectorCurve.Point1 = new Point(startp.X + dis, startp.Y);
connectorCurve.Point2 = new Point(endp.X - dis, endp.Y);
connectorCurve.Point3 = endp;
break;
case XAribute.XPositonStyle.right:
connectorPoints.StartPoint = startp;
connectorCurve.Point1 = new Point(startp.X - dis, startp.Y);
connectorCurve.Point2 = new Point(endp.X + dis, endp.Y);
connectorCurve.Point3 = endp;
break;
}
}
/// <summary>
/// 设置贝塞尔曲线
/// </summary>
/// <param name="OverPoint">贝塞尔曲线的结束的点</param>
public void SetBezierLine(Point OverPoint, XAribute.XPositonStyle position)
{
#region MyRegion
//if (StartPoint != null)
//{
// if (OverPoint.X >= StartPoint.X && OverPoint.Y >= StartPoint.Y)
// {
// SetBezierOver(1, OverPoint);
// }
// else if (OverPoint.X <= StartPoint.X && OverPoint.Y >= StartPoint.Y)
// {
// SetBezierOver(2, OverPoint);
// }
// else if (OverPoint.X <= StartPoint.X && OverPoint.Y >= StartPoint.Y)
// {
// SetBezierOver(3, OverPoint);
// }
// else if (OverPoint.X >= StartPoint.X && OverPoint.Y <= StartPoint.Y)
// {
// SetBezierOver(4, OverPoint);
// }
//}
#endregion
SetBezierOver(position, OverPoint);
}
/// <summary>
/// 直接设置贝塞尔曲线的2个点
/// </summary>
/// <param name="start">起始位置</param>
/// <param name="end">终止位置</param>
public void DirectSetBezierLineTwoPoint(XAribute start, XAribute end)
{
StartPoint.LinkAribute = start;
StartPoint.position = start.GetWorldPosition();
StartPoint.positionType = start.SelectPositionStyle;
EndPoint.LinkAribute = end;
EndPoint.position = end.GetWorldPosition();
EndPoint.positionType = end.SelectPositionStyle;
InitLineInformation();
}
/// <summary>
/// 当父控件移动的时候调整贝塞尔曲线的位置(弃用的方法)
/// </summary>
/// <param name="position">点的坐标</param>
/// <param name="dirtype">属性的方向类型</param>
public void BezierPositionChange(Point position, XAribute.XPositonStyle dirtype)
{
AdjustBezierLine();
//if (dirtype == StartPoint.positionType)
//{
// SetBezierStart(dirtype, position);
//}
//else
//{
// SetBezierOver(dirtype, position);
//}
}
/// <summary>
/// 设置的是起始点(弃用的方法)
/// </summary>
/// <param name="position">位置类型</param>
/// <param name="fistPoint">点的坐标</param>
protected void SetBezierStart(XAribute.XPositonStyle position, Point fistPoint)
{
double cur = (fistPoint.Y - EndPoint.position.Y) / ToolHelp.DisPoint(fistPoint, EndPoint.position) / 7;
double dis = cur > maxdis ? maxdis : cur;
dis = dis < mindis ? mindis : dis;
StartPoint.position = fistPoint;
switch (position)
{
case XAribute.XPositonStyle.Left:
connectorPoints.StartPoint = StartPoint.position;
connectorCurve.Point1 = new Point(StartPoint.position.X - dis, StartPoint.position.Y);
connectorCurve.Point2 = new Point(EndPoint.position.X + dis, EndPoint.position.Y);
//connectorCurve.Point3 = OverPoint;
break;
case XAribute.XPositonStyle.right:
connectorPoints.StartPoint = StartPoint.position;
connectorCurve.Point1 = new Point(StartPoint.position.X + dis, StartPoint.position.Y);
connectorCurve.Point2 = new Point(EndPoint.position.X - dis, EndPoint.position.Y);
//connectorCurve.Point3 = OverPoint;
break;
}
}
/// <summary>
/// 删除贝塞尔曲线的时候进行必要的操作
/// </summary>
public void DelBezierLine()
{
StartPoint.LinkAribute.ChildRemoveBezierLine(this);
EndPoint.LinkAribute.ChildRemoveBezierLine(this);
StartPoint = null;
EndPoint = null;
}
/// <summary>
/// 清理资源
/// </summary>
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// 清理
/// </summary>
/// <param name="disposing"></param>
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
//执行基本的清理代码
}
}
#endregion
}
/// <summary>
/// 关于贝塞尔曲线的起点和终点
/// </summary>
public class BezierPoint
{
/// <summary>
/// 点的坐标
/// </summary>
public Point position = new Point();
/// <summary>
/// 点对于属性的类型
/// </summary>
public XAribute.XPositonStyle positionType;
/// <summary>
/// 连接的属性
/// </summary>
public XAribute LinkAribute;
/// <summary>
/// 构造函数
/// </summary>
public BezierPoint()
{
positionType = XAribute.XPositonStyle.Left;
}
}
}
| 33.389908 | 156 | 0.486124 | [
"Apache-2.0"
] | Nagisakurumi/GraphicalProgramming | MyXAribute/BezierLine.cs | 15,456 | C# |
#region License
// Copyright 2015 Kastellanos Nikolaos
//
// 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.
#endregion
using System.IO;
namespace tainicom.Storage
{
public interface IStoreable
{
void Store (BinaryWriter stream);
void Restore(BinaryReader stream, int version);
}
}
| 31.074074 | 77 | 0.712753 | [
"Apache-2.0"
] | tainicom/XNALibrary | Source/Storage/IStoreable.cs | 841 | C# |
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using eCommerceStarterCode.Data;
namespace eCommerceStarterCode.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
<<<<<<< HEAD:eCommerceStarterCode/Migrations/20210902214354_initialmigrationtjm.Designer.cs
[Migration("20210902214354_initialmigrationtjm")]
partial class initialmigrationtjm
=======
[Migration("20210903024146_initialmigration")]
partial class initialmigration
>>>>>>> 4ff61d4925719d23c830dbef5d4a2b56f2ad1b63:eCommerceStarterCode/Migrations/20210903024146_initialmigration.Designer.cs
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 128)
<<<<<<< HEAD:eCommerceStarterCode/Migrations/20210902214354_initialmigrationtjm.Designer.cs
.HasAnnotation("ProductVersion", "5.0.9")
=======
.HasAnnotation("ProductVersion", "5.0.6")
>>>>>>> 4ff61d4925719d23c830dbef5d4a2b56f2ad1b63:eCommerceStarterCode/Migrations/20210903024146_initialmigration.Designer.cs
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
b.HasData(
new
{
<<<<<<< HEAD:eCommerceStarterCode/Migrations/20210902214354_initialmigrationtjm.Designer.cs
Id = "99b44f4b-f389-4da2-9115-bf1929f76e5d",
ConcurrencyStamp = "68cba88b-b42c-4948-a62b-fbd6f46dfd9e",
=======
Id = "eaa8e8d4-8596-40dc-ad5b-175b3c234c2f",
ConcurrencyStamp = "e005b6df-f65d-4ee8-a856-afa700e3fcb7",
>>>>>>> 4ff61d4925719d23c830dbef5d4a2b56f2ad1b63:eCommerceStarterCode/Migrations/20210903024146_initialmigration.Designer.cs
Name = "User",
NormalizedName = "USER"
},
new
{
<<<<<<< HEAD:eCommerceStarterCode/Migrations/20210902214354_initialmigrationtjm.Designer.cs
Id = "e4c62a9f-d3b9-4580-a630-87e1641b5707",
ConcurrencyStamp = "49ca7a9a-07cd-44ec-8305-6ae7ddda0635",
=======
Id = "73542959-71f0-416a-874c-ab8db7f832b7",
ConcurrencyStamp = "a29b3d28-1e49-47ba-82ad-79ce063ace37",
>>>>>>> 4ff61d4925719d23c830dbef5d4a2b56f2ad1b63:eCommerceStarterCode/Migrations/20210903024146_initialmigration.Designer.cs
Name = "Admin",
NormalizedName = "ADMIN"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");
b.Property<string>("Name")
.HasColumnType("nvarchar(450)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("eCommerceStarterCode.Models.AddToCart", b =>
{
b.Property<int>("ItemID")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("CartID")
.HasColumnType("int");
b.Property<int>("ProductID")
.HasColumnType("int");
b.HasKey("ItemID");
b.HasIndex("CartID");
b.HasIndex("ProductID");
<<<<<<< HEAD:eCommerceStarterCode/Migrations/20210902214354_initialmigrationtjm.Designer.cs
b.ToTable("AddToCart");
=======
b.ToTable("AddToCarts");
>>>>>>> 4ff61d4925719d23c830dbef5d4a2b56f2ad1b63:eCommerceStarterCode/Migrations/20210903024146_initialmigration.Designer.cs
});
modelBuilder.Entity("eCommerceStarterCode.Models.Buyer", b =>
{
b.Property<int>("BuyerID")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("UserID")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("BuyerID");
b.HasIndex("UserID");
b.ToTable("Buyers");
});
modelBuilder.Entity("eCommerceStarterCode.Models.Cart", b =>
{
b.Property<int>("CartID")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("BuyerID")
.HasColumnType("int");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<string>("Thumbnail")
.HasColumnType("nvarchar(max)");
b.Property<int>("Total")
.HasColumnType("int");
b.HasKey("CartID");
b.HasIndex("BuyerID");
b.ToTable("Carts");
});
modelBuilder.Entity("eCommerceStarterCode.Models.Product", b =>
{
b.Property<int>("ProductID")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ProductCategory")
.HasColumnType("nvarchar(max)");
b.Property<string>("ProductDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("ProductName")
.HasColumnType("nvarchar(max)");
b.Property<int>("ProductPrice")
.HasColumnType("int");
b.Property<int>("ProductRating")
.HasColumnType("int");
b.Property<string>("ProductReview")
.HasColumnType("nvarchar(max)");
b.Property<string>("ProductThumbnail")
.HasColumnType("nvarchar(max)");
b.HasKey("ProductID");
b.ToTable("Products");
});
modelBuilder.Entity("eCommerceStarterCode.Models.Seller", b =>
{
b.Property<int>("SellerID")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("UserID")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("SellerID");
b.HasIndex("UserID");
b.ToTable("Sellers");
});
modelBuilder.Entity("eCommerceStarterCode.Models.SellerUpdateProduct", b =>
{
b.Property<int>("NewProductID")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ProductID")
.HasColumnType("int");
b.Property<int>("SellerID")
.HasColumnType("int");
b.HasKey("NewProductID");
b.HasIndex("ProductID");
b.HasIndex("SellerID");
b.ToTable("SellerUpdateProducts");
});
modelBuilder.Entity("eCommerceStarterCode.Models.User", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("AddressLine1")
.HasColumnType("nvarchar(max)");
b.Property<string>("AddressLine2")
.HasColumnType("nvarchar(max)");
b.Property<string>("City")
.HasColumnType("nvarchar(max)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("LoginName")
.HasColumnType("nvarchar(max)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<string>("State")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<int>("ZipCode")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("eCommerceStarterCode.Models.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("eCommerceStarterCode.Models.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("eCommerceStarterCode.Models.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("eCommerceStarterCode.Models.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("eCommerceStarterCode.Models.AddToCart", b =>
{
b.HasOne("eCommerceStarterCode.Models.Cart", "Cart")
.WithMany()
.HasForeignKey("CartID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("eCommerceStarterCode.Models.Product", "Product")
.WithMany()
.HasForeignKey("ProductID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cart");
b.Navigation("Product");
});
modelBuilder.Entity("eCommerceStarterCode.Models.Buyer", b =>
{
b.HasOne("eCommerceStarterCode.Models.User", "User")
.WithMany()
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("eCommerceStarterCode.Models.Cart", b =>
{
b.HasOne("eCommerceStarterCode.Models.Buyer", "Buyer")
.WithMany()
.HasForeignKey("BuyerID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Buyer");
});
modelBuilder.Entity("eCommerceStarterCode.Models.Seller", b =>
{
b.HasOne("eCommerceStarterCode.Models.User", "User")
.WithMany()
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("eCommerceStarterCode.Models.SellerUpdateProduct", b =>
{
b.HasOne("eCommerceStarterCode.Models.Product", "Product")
.WithMany()
.HasForeignKey("ProductID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("eCommerceStarterCode.Models.Seller", "Seller")
.WithMany()
.HasForeignKey("SellerID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Seller");
});
#pragma warning restore 612, 618
}
}
}
| 38.690647 | 125 | 0.476385 | [
"MIT"
] | TBuscemi/eCommerce | eCommerceStarterCode/Migrations/20210902214354_initialmigrationtjm.Designer.cs | 21,514 | C# |
using System.ServiceProcess;
namespace KpdApps.Orationi.Messaging.PluginHost
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new PluginHost()
};
ServiceBase.Run(ServicesToRun);
}
}
}
| 21.857143 | 53 | 0.520697 | [
"MIT"
] | KpdApps/Orationi.Messaging | KpdApps.Orationi.Messaging.PluginHost/Program.cs | 461 | C# |
/*
* Copyright 2018 JDCLOUD.COM
*
* 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.
*
* Attack Log APIs
* Anti DDoS Protection Package Attack Log APIs
*
* OpenAPI spec version: v1
* Contact:
*
* NOTE: This class is auto generated by the jdcloud code generator program.
*/
using System;
using System.Collections.Generic;
using System.Text;
using JDCloudSDK.Core.Service;
namespace JDCloudSDK.Antipro.Apis
{
/// <summary>
/// 查询各类型攻击次数, 参数 ip 优先级大于 instanceId
/// /// - 指定 ip 参数时, 忽略 instanceId 参数, 查询 ip 相关攻击记录的各类型攻击次数
/// /// - 未指定 ip 时, 查询 instanceId 指定实例相关攻击记录的各类型攻击次数
/// /// - ip 和 instanceId 均未指定时, 查询用户所有公网 IP 攻击记录的各类型攻击次数
/// ///
/// </summary>
public class DescribeAttackTypeCountResponse : JdcloudResponse<DescribeAttackTypeCountResult>
{
}
} | 30.4 | 97 | 0.680556 | [
"Apache-2.0"
] | jdcloud-api/jdcloud-sdk-net | sdk/src/Service/Antipro/Apis/DescribeAttackTypeCountResponse.cs | 1,550 | C# |
// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Text;
namespace WavFile
{
/// <summary>
/// Read/Write WAV file header information.
/// </summary>
public static class WavFileInfo
{
/// <summary>
/// Read WAV file header.
/// </summary>
/// <param name="fs">The file stream.</param>
/// <returns>The new instance of the <see cref="WavFileHeader"/> struct.</returns>
public static WavFileHeader ReadFileHeader(FileStream fs)
{
var h = new WavFileHeader()
{
HeaderSize = 0
};
// Read WAV header.
var b = new BinaryReader(fs);
// WAVE
h.ChunkID = b.ReadUInt32(); // 0x46464952, "RIFF"
h.ChunkSize = b.ReadUInt32(); // 36 + SubChunk2Size, 4 + (8 + SubChunk1Size) + (8 + SubChunk2Size)
h.Format = b.ReadUInt32(); // 0x45564157, "WAVE"
h.HeaderSize += 12;
// fmt
h.Subchunk1ID = b.ReadUInt32(); // 0x20746d66, "fmt "
h.Subchunk1Size = b.ReadUInt32(); // 16 for PCM, 40 for WAVEFORMATEXTENSIBLE
h.AudioFormat = b.ReadUInt16(); // PCM = 1, WAVEFORMATEXTENSIBLE.SubFormat = 0xFFFE
h.NumChannels = b.ReadUInt16(); // Mono = 1, Stereo = 2, etc.
h.SampleRate = b.ReadUInt32(); // 8000, 44100, etc.
h.ByteRate = b.ReadUInt32(); // SampleRate * NumChannels * BitsPerSample/8
h.BlockAlign = b.ReadUInt16(); // NumChannels * BitsPerSample/8
h.BitsPerSample = b.ReadUInt16(); // 8 bits = 8, 16 bits = 16, etc.
h.HeaderSize += 24;
// Read PCM data or extensible data if exists.
if (h.Subchunk1Size == 16 && h.AudioFormat == 1)
{
// PCM
h.IsExtensible = false;
// Find "data" chunk.
while (b.PeekChar() != -1)
{
UInt32 chunk = b.ReadUInt32();
h.HeaderSize += 4;
if (chunk == 0x61746164)
{
// Note: 8-bit samples are stored as unsigned bytes, ranging from 0 to 255. 16-bit samples are stored as 2's-complement signed integers, ranging from -32768 to 32767.
// "data" chunk
h.Subchunk2ID = chunk; // 0x61746164, "data"
h.Subchunk2Size = b.ReadUInt32(); // NumSamples * NumChannels * BitsPerSample/8
h.HeaderSize += 4;
break;
}
else
{
// Read other non "data" chunks.
UInt32 chunkSize = b.ReadUInt32();
h.HeaderSize += 4;
string chunkName = Encoding.ASCII.GetString(BitConverter.GetBytes(chunk));
byte[] chunkData = b.ReadBytes((int)chunkSize);
h.HeaderSize += (int)chunkSize;
}
}
}
else if (h.Subchunk1Size > 16 && h.AudioFormat == 0xFFFE)
{
// read WAVEFORMATEXTENSIBLE
h.ExtraParamSize = b.ReadUInt16();
h.HeaderSize += 2;
if (h.ExtraParamSize == 22)
{
// if cbSize is set to 22 => WAVEFORMATEXTENSIBLE
h.IsExtensible = true;
//union {
// WORD wValidBitsPerSample; // bits of precision
// WORD wSamplesPerBlock; // valid if wBitsPerSample==0
// WORD wReserved; // If neither applies, set to zero.
//} Samples;
h.Samples = b.ReadUInt16();
// DWORD dwChannelMask; which channels are present in stream
h.ChannelMask = b.ReadUInt32();
// GUID SubFormat
byte[] subFormat = b.ReadBytes(16);
h.HeaderSize += 22;
// Check sub-format.
h.GuidSubFormat = new Guid(subFormat);
if (h.GuidSubFormat != WavFileHeader.SubTypePCM && h.GuidSubFormat != WavFileHeader.SubTypeIEEE_FLOAT)
{
throw new Exception(String.Format("Not supported WAV file type: {0}", h.GuidSubFormat));
}
// Find "data" chunk.
while (b.PeekChar() != -1)
{
UInt32 chunk = b.ReadUInt32();
h.HeaderSize += 4;
if (chunk == 0x61746164)
{
// "data" chunk
h.Subchunk2ID = chunk; // 0x61746164, "data"
h.Subchunk2Size = b.ReadUInt32(); // NumSamples * NumChannels * BitsPerSample/8
h.HeaderSize += 4;
break;
}
else
{
// Read other non "data" chunks.
UInt32 chunkSize = b.ReadUInt32();
h.HeaderSize += 4;
string chunkName = Encoding.ASCII.GetString(BitConverter.GetBytes(chunk));
byte[] chunkData = b.ReadBytes((int)chunkSize);
h.HeaderSize += (int)chunkSize;
}
}
}
else
{
throw new Exception("Not supported WAV file header.");
}
}
else
{
throw new Exception("Not supported WAV file header.");
}
// Calculate number of total samples.
h.TotalSamples = (long)((double)h.Subchunk2Size / ((double)h.NumChannels * (double)h.BitsPerSample / 8));
// Calculate duration in seconds.
h.Duration = (1 / (double)h.SampleRate) * (double)h.TotalSamples;
return h;
}
/// <summary>
/// Write WAV file header.
/// </summary>
/// <param name="fs">The file stream.</param>
/// <param name="h">The wav file header.</param>
public static void WriteFileHeader(FileStream fs, WavFileHeader h)
{
// Write WAV header.
var b = new BinaryWriter(fs);
// WAVE
b.Write((UInt32)0x46464952); // 0x46464952, "RIFF"
b.Write(h.ChunkSize);
b.Write((UInt32)0x45564157); // 0x45564157, "WAVE"
// fmt
b.Write((UInt32)0x20746d66); // 0x20746d66, "fmt "
b.Write(h.Subchunk1Size);
b.Write(h.AudioFormat);
b.Write(h.NumChannels);
b.Write(h.SampleRate);
b.Write(h.ByteRate);
b.Write(h.BlockAlign);
b.Write(h.BitsPerSample);
// Write PCM data or extensible data if exists.
if (h.Subchunk1Size == 16 && h.AudioFormat == 1)
{
// PCM
b.Write((UInt32)0x61746164); // 0x61746164, "data"
b.Write(h.Subchunk2Size);
}
else if (h.Subchunk1Size > 16 && h.AudioFormat == 0xFFFE)
{
// Write WAVEFORMATEXTENSIBLE
b.Write(h.ExtraParamSize);
b.Write(h.Samples);
b.Write(h.ChannelMask);
b.Write(h.GuidSubFormat.ToByteArray());
b.Write((UInt32)0x61746164); // 0x61746164, "data"
b.Write(h.Subchunk2Size);
}
else
{
throw new Exception("Not supported WAV file header.");
}
}
/// <summary>
/// Get mono WAV file header from multi-channel WAV file.
/// </summary>
/// <param name="h">The wav file header.</param>
/// <returns>The new instance of the <see cref="WavFileHeader"/> struct.</returns>
public static WavFileHeader GetMonoWavFileHeader(WavFileHeader h)
{
// Each mono output file has the same header.
var mh = new WavFileHeader();
// WAVE
mh.ChunkID = (UInt32)0x46464952; // 0x46464952, "RIFF"
mh.ChunkSize = 36 + (h.Subchunk2Size / h.NumChannels); // 36 + SubChunk2Size, 4 + (8 + SubChunk1Size) + (8 + SubChunk2Size)
mh.Format = (UInt32)0x45564157; // 0x45564157, "WAVE"
// fmt
mh.Subchunk1ID = (UInt32)0x20746d66; // 0x20746d66, "fmt "
mh.Subchunk1Size = 16; // 16 for PCM, 40 for WAVEFORMATEXTENSIBLE
mh.AudioFormat = (UInt16)1; // PCM = 1, WAVEFORMATEXTENSIBLE.SubFormat = 0xFFFE
mh.NumChannels = (UInt16)1; // Mono = 1, Stereo = 2, etc.
mh.SampleRate = h.SampleRate; // 8000, 44100, etc.
mh.ByteRate = (UInt32)((h.SampleRate * 1 * h.BitsPerSample) / 8); // SampleRate * NumChannels * BitsPerSample/8
mh.BlockAlign = (UInt16)((1 * h.BitsPerSample) / 8); // NumChannels * BitsPerSample/8
mh.BitsPerSample = h.BitsPerSample; // 8 bits = 8, 16 bits = 16, etc.
// extensible
mh.ExtraParamSize = (UInt16)0;
mh.ChannelMask = (UInt32)0;
mh.GuidSubFormat = new Guid();
// data
mh.Subchunk2ID = (UInt32)0x61746164; // 0x61746164, "data"
mh.Subchunk2Size = h.Subchunk2Size / h.NumChannels; // NumSamples * NumChannels * BitsPerSample/8
// info
mh.IsExtensible = false;
mh.HeaderSize = 44;
mh.TotalSamples = (long)((double)mh.Subchunk2Size / ((double)mh.NumChannels * (double)mh.BitsPerSample / 8));
mh.Duration = (1 / (double)mh.SampleRate) * (double)mh.TotalSamples;
return mh;
}
}
}
| 39.482759 | 190 | 0.4787 | [
"MIT"
] | caleblanchard/SimpleWavSplitter | src/WavFile/WavFileInfo.cs | 10,310 | C# |
// öğrenci tanımlama ve ekrana yazdırma
Ogrenci ogrenci = new Ogrenci();
ogrenci.Isim = "Hakkı";
ogrenci.Soyisim = "Ayman";
ogrenci.OgrenciNo = 123;
ogrenci.Sinif = 4;
ogrenci.OgrenciBilgileriniGetir();
ogrenci.SinifAtlat();
ogrenci.OgrenciBilgileriniGetir();
// Öğrenci parametrelerini belirleyen sınıf
class Ogrenci
{
private string isim;
private string soyisim;
private int ogrenciNo;
private int sinif;
public string Isim { get => isim; set => isim = value; }
public string Soyisim { get => soyisim; set => soyisim = value; }
public int OgrenciNo { get => ogrenciNo; set => ogrenciNo = value; }
public int Sinif
{
get => sinif;
set
{
if(value <1)
{
Console.WriteLine("Sınıf En Az 1 Olabilir!");
sinif = 1;
}
else
{
sinif = value;
}
}
}
public Ogrenci(string ısim, string soyisim, int ogrenciNo, int sinif)
{
Isim = ısim;
Soyisim = soyisim;
OgrenciNo = ogrenciNo;
Sinif = sinif;
}
public Ogrenci()
{}
// Öğrenci Bilgilerini Ekrana yazan fonksiyon
public void OgrenciBilgileriniGetir()
{
Console.WriteLine("******* Öğrenci Bilgileri *******");
Console.WriteLine("Öğrenci Adı: {0}",this.isim);
Console.WriteLine("Öğrenci Adı: {0}",this.soyisim);
Console.WriteLine("Öğrenci Adı: {0}",this.ogrenciNo);
Console.WriteLine("Öğrenci Adı: {0}",this.sinif);
}
// SInıfı yükselten fonksiyon
public void SinifAtlat()
{
this.sinif = this.sinif+1;
}
// SInıfı Düşüren fonksiyon
public void SinifDusur()
{
this.sinif = this.sinif+1;
}
} | 23.294872 | 73 | 0.565768 | [
"MIT"
] | SoulCriminal/EncapsulationKavram- | Program.cs | 1,856 | C# |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Aws.WafV2.Inputs
{
public sealed class WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchSingleQueryArgumentGetArgs : Pulumi.ResourceArgs
{
/// <summary>
/// Name of the query header to inspect. This setting must be provided as lower case characters.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
public WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchSingleQueryArgumentGetArgs()
{
}
}
}
| 39.038462 | 204 | 0.752709 | [
"ECL-2.0",
"Apache-2.0"
] | chivandikwa/pulumi-aws | sdk/dotnet/WafV2/Inputs/WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchSingleQueryArgumentGetArgs.cs | 1,015 | C# |
using System;
namespace YoYo
{
public interface Function
{
Symbol GetName();
int GetNargs();
object[] GetArgArray(Context c);
object Run(Object[] arglist, Context c);
void Trace();
void Untrace();
}
}
| 17.533333 | 48 | 0.555133 | [
"MIT"
] | abegel/yoyo | YoYoInterpreter/Function.cs | 265 | C# |
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Pathfinding
{
public class AstarProfiler
{
public class ProfilePoint
{
public Stopwatch watch = new Stopwatch();
public int totalCalls;
public long tmpBytes;
public long totalBytes;
}
private static Dictionary<string, AstarProfiler.ProfilePoint> profiles = new Dictionary<string, AstarProfiler.ProfilePoint>();
private static DateTime startTime = DateTime.UtcNow;
public static AstarProfiler.ProfilePoint[] fastProfiles;
public static string[] fastProfileNames;
private AstarProfiler()
{
}
[Conditional("ProfileAstar")]
public static void InitializeFastProfile(string[] profileNames)
{
}
[Conditional("ProfileAstar")]
public static void StartFastProfile(int tag)
{
}
[Conditional("ProfileAstar")]
public static void EndFastProfile(int tag)
{
}
[Conditional("UNITY_PRO_PROFILER")]
public static void EndProfile()
{
}
[Conditional("ProfileAstar")]
public static void StartProfile(string tag)
{
}
[Conditional("ProfileAstar")]
public static void EndProfile(string tag)
{
}
[Conditional("ProfileAstar")]
public static void Reset()
{
}
[Conditional("ProfileAstar")]
public static void PrintFastResults()
{
}
[Conditional("ProfileAstar")]
public static void PrintResults()
{
}
}
}
| 18.730769 | 129 | 0.678987 | [
"MIT"
] | corefan/mobahero_src | Pathfinding/AstarProfiler.cs | 1,461 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the snow-device-management-2021-08-04.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using System.Net;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.SnowDeviceManagement.Model
{
/// <summary>
/// Container for the parameters to the CancelTask operation.
/// Sends a cancel request for a specified task. You can cancel a task only if it's still
/// in a <code>QUEUED</code> state. Tasks that are already running can't be cancelled.
///
/// <note>
/// <para>
/// A task might still run if it's processed from the queue before the <code>CancelTask</code>
/// operation changes the task's state.
/// </para>
/// </note>
/// </summary>
public partial class CancelTaskRequest : AmazonSnowDeviceManagementRequest
{
private string _taskId;
/// <summary>
/// Gets and sets the property TaskId.
/// <para>
/// The ID of the task that you are attempting to cancel. You can retrieve a task ID by
/// using the <code>ListTasks</code> operation.
/// </para>
/// </summary>
[AWSProperty(Required=true, Min=1, Max=64)]
public string TaskId
{
get { return this._taskId; }
set { this._taskId = value; }
}
// Check to see if TaskId property is set
internal bool IsSetTaskId()
{
return this._taskId != null;
}
}
} | 32.191176 | 120 | 0.648241 | [
"Apache-2.0"
] | EbstaLimited/aws-sdk-net | sdk/src/Services/SnowDeviceManagement/Generated/Model/CancelTaskRequest.cs | 2,189 | C# |
using UnityEngine;
namespace Mirror
{
/// <summary>Start position for player spawning, automatically registers itself in the NetworkManager.</summary>
[DisallowMultipleComponent]
[AddComponentMenu("Network/NetworkStartPosition")]
[HelpURL("https://mirror-networking.com/docs/Articles/Components/NetworkStartPosition.html")]
public class NetworkStartPosition : MonoBehaviour
{
public void Awake()
{
NetworkManager.RegisterStartPosition(transform);
}
public void OnDestroy()
{
NetworkManager.UnRegisterStartPosition(transform);
}
}
}
| 28.818182 | 116 | 0.68612 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | ARAPHELLE/Soil | Soil/Assets/Mirror/Runtime/NetworkStartPosition.cs | 634 | C# |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
using System;
using System.Collections.Generic;
using Aliyun.Acs.Core.Transform;
using Aliyun.Acs.Vpc.Model.V20160428;
namespace Aliyun.Acs.Vpc.Transform.V20160428
{
public class DisableVpcClassicLinkResponseUnmarshaller
{
public static DisableVpcClassicLinkResponse Unmarshall(UnmarshallerContext _ctx)
{
DisableVpcClassicLinkResponse disableVpcClassicLinkResponse = new DisableVpcClassicLinkResponse();
disableVpcClassicLinkResponse.HttpResponse = _ctx.HttpResponse;
disableVpcClassicLinkResponse.RequestId = _ctx.StringValue("DisableVpcClassicLink.RequestId");
return disableVpcClassicLinkResponse;
}
}
}
| 37.05 | 102 | 0.765857 | [
"Apache-2.0"
] | aliyun/aliyun-openapi-net-sdk | aliyun-net-sdk-vpc/Vpc/Transform/V20160428/DisableVpcClassicLinkResponseUnmarshaller.cs | 1,482 | C# |
/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud.Vod.V20180717.Models
{
using Newtonsoft.Json;
using System.Collections.Generic;
using TencentCloud.Common;
public class UserDefineAsrTextReviewTemplateInfo : AbstractModel
{
/// <summary>
/// 用户自定语音智能识别任务开关,可选值:
/// <li>ON:开启自定义语音智能识别任务;</li>
/// <li>OFF:关闭自定义语音智能识别任务。</li>
/// </summary>
[JsonProperty("Switch")]
public string Switch{ get; set; }
/// <summary>
/// 用户自定义语音过滤标签,智能识别结果包含选择的标签则返回结果,如果过滤标签为空,则审核结果全部返回。如果要使用标签过滤功能,添加自定义语音关键词素材时需要添加对应标签。
/// 标签个数最多 10 个,每个标签长度最多 16 个字符。
/// </summary>
[JsonProperty("LabelSet")]
public string[] LabelSet{ get; set; }
/// <summary>
/// 判定涉嫌违规的分数阈值,当智能智能识别达到该分数以上,认为涉嫌违规,不填默认为 100 分。取值范围:0~100。
/// </summary>
[JsonProperty("BlockConfidence")]
public long? BlockConfidence{ get; set; }
/// <summary>
/// 判定需人工复核是否违规的分数阈值,当智能识别达到该分数以上,认为需人工复核,不填默认为 75 分。取值范围:0~100。
/// </summary>
[JsonProperty("ReviewConfidence")]
public long? ReviewConfidence{ get; set; }
/// <summary>
/// For internal usage only. DO NOT USE IT.
/// </summary>
public override void ToMap(Dictionary<string, string> map, string prefix)
{
this.SetParamSimple(map, prefix + "Switch", this.Switch);
this.SetParamArraySimple(map, prefix + "LabelSet.", this.LabelSet);
this.SetParamSimple(map, prefix + "BlockConfidence", this.BlockConfidence);
this.SetParamSimple(map, prefix + "ReviewConfidence", this.ReviewConfidence);
}
}
}
| 34.279412 | 96 | 0.636637 | [
"Apache-2.0"
] | TencentCloud/tencentcloud-sdk-dotnet | TencentCloud/Vod/V20180717/Models/UserDefineAsrTextReviewTemplateInfo.cs | 2,833 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the organizations-2016-11-28.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.Organizations.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.Organizations.Model.Internal.MarshallTransformations
{
/// <summary>
/// TagResource Request Marshaller
/// </summary>
public class TagResourceRequestMarshaller : IMarshaller<IRequest, TagResourceRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((TagResourceRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(TagResourceRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.Organizations");
string target = "AWSOrganizationsV20161128.TagResource";
request.Headers["X-Amz-Target"] = target;
request.Headers["Content-Type"] = "application/x-amz-json-1.1";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2016-11-28";
request.HttpMethod = "POST";
request.ResourcePath = "/";
request.MarshallerVersion = 2;
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetResourceId())
{
context.Writer.WritePropertyName("ResourceId");
context.Writer.Write(publicRequest.ResourceId);
}
if(publicRequest.IsSetTags())
{
context.Writer.WritePropertyName("Tags");
context.Writer.WriteArrayStart();
foreach(var publicRequestTagsListValue in publicRequest.Tags)
{
context.Writer.WriteObjectStart();
var marshaller = TagMarshaller.Instance;
marshaller.Marshall(publicRequestTagsListValue, context);
context.Writer.WriteObjectEnd();
}
context.Writer.WriteArrayEnd();
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static TagResourceRequestMarshaller _instance = new TagResourceRequestMarshaller();
internal static TagResourceRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static TagResourceRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 35.669421 | 137 | 0.606348 | [
"Apache-2.0"
] | PureKrome/aws-sdk-net | sdk/src/Services/Organizations/Generated/Model/Internal/MarshallTransformations/TagResourceRequestMarshaller.cs | 4,316 | C# |
using FluentAssertions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using System.Net;
using System.Threading.Tasks;
using Xunit;
namespace Mendham.Testing.AspNetCore.Test
{
public class TestServerFixtureTest : Test<TestServerFixtureTestFixture>
{
public TestServerFixtureTest(TestServerFixtureTestFixture fixture) : base(fixture)
{
}
[Fact]
public async Task Client_CallTestPath_Status200()
{
var response = await Fixture.Client.GetAsync("test");
response.Should()
.HaveStatusCode(HttpStatusCode.OK, "that is the value on the test path");
}
[Fact]
public async Task Client_CallBase_Status404()
{
var response = await Fixture.Client.GetAsync("");
response.Should()
.HaveStatusCode(HttpStatusCode.NotFound, "the path is not mapped to anything");
}
}
public class TestServerFixtureTestFixture : TestServerFixture
{
protected override IWebHostBuilder GetWebHostBuilder()
{
return new WebHostBuilder()
.Configure(app =>
{
app.Map("/test",
testApp => testApp.Run(ctx =>
{
ctx.Response.StatusCode = 200;
return Task.FromResult(0);
}));
});
}
}
}
| 28.807692 | 95 | 0.560748 | [
"Apache-2.0"
] | Mendham/Mendham | test/Mendham.Testing.AspNetCore.Test/TestServerFixtureTest.cs | 1,500 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
namespace _05._Bomb_numbers
{
class Program
{
static void Main(string[] args)
{
List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
int[] bombSquad = Console.ReadLine().Split().Select(int.Parse).ToArray();
Detonation(numbers, bombSquad[0], bombSquad[1]);
Console.WriteLine(numbers.Sum());
}
static List<int> Detonation(List<int> list, int bomb, int range)
{
int bombIndex = list.IndexOf(bomb);
while (bombIndex!=-1)
{
int leftNumber = bombIndex - range;
int rightNumber = bombIndex + range;
if (leftNumber<0)
{
leftNumber = 0;
}
if (rightNumber > list.Count-1)
{
rightNumber = list.Count - 1;
}
list.RemoveRange(leftNumber, rightNumber-leftNumber+1);
bombIndex = list.IndexOf(bomb);
//for (int j = 0; j < list.Count; j++)
//{
// if (list[j] == bomb)
// {
// index = j;
// break;
// }
//}
//list.RemoveAt(index);
//for (int i = 0; i < range * 2; i++)
//{
// if (index - range >= list.Count)
// {
// break;
// }
// else
// {
// list.RemoveAt(index - range);
// }
//}
}
return list;
}
}
}
| 29.435484 | 86 | 0.387397 | [
"MIT"
] | DeyanDanailov/SoftUniCSharpFundamentals | repos/05. Bomb numbers/Program.cs | 1,827 | 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.Web.Mvc;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Newtonsoft.Json;
using NuGetGallery.Areas.Admin.Models;
using NuGetGallery.Areas.Admin.ViewModels;
using NuGetGallery.Helpers;
namespace NuGetGallery.Areas.Admin.Controllers
{
public class SupportRequestController
: AdminControllerBase
{
private const int _defaultTakeCount = 30;
private readonly ISupportRequestService _supportRequestService;
private readonly IUserService _userService;
private readonly JsonSerializerSettings _defaultJsonSerializerSettings = new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
Formatting = Formatting.None
};
public SupportRequestController(
ISupportRequestService supportRequestService,
IUserService userService)
{
_supportRequestService = supportRequestService;
_userService = userService;
}
public ViewResult Admins()
{
var viewModel = new SupportRequestAdminsViewModel();
viewModel.Admins.AddRange(_supportRequestService.GetAllAdmins().Select(a => new SupportRequestAdminViewModel(a)));
return View(viewModel);
}
public ActionResult GetAdmins()
{
var admins = _supportRequestService.GetAllAdmins().Select(a => new SupportRequestAdminViewModel(a));
var data = JsonConvert.SerializeObject(admins, _defaultJsonSerializerSettings);
return Json(data, JsonRequestBehavior.AllowGet);
}
[HttpPost]
public async Task<ActionResult> DisableAdmin(int key)
{
try
{
await _supportRequestService.ToggleAdminAccessAsync(key, enabled: false);
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
}
catch (ArgumentException)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
}
[HttpPost]
public async Task<ActionResult> EnableAdmin(int key)
{
try
{
await _supportRequestService.ToggleAdminAccessAsync(key, enabled: true);
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
}
catch (ArgumentException)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
}
[HttpPost]
public async Task<ActionResult> AddAdmin(string galleryUsername, string pagerDutyUsername)
{
try
{
await _supportRequestService.AddAdminAsync(galleryUsername, pagerDutyUsername);
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
}
catch (ArgumentException)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
}
[HttpPost]
public async Task<ActionResult> UpdateAdmin(int key, string galleryUsername, string pagerDutyUsername)
{
try
{
await _supportRequestService.UpdateAdminAsync(key, galleryUsername, pagerDutyUsername);
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
}
catch (ArgumentException)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
}
[HttpPost]
public async Task<ActionResult> Save(int issueKey, int? assignedToId, int issueStatusId, string comment)
{
try
{
await _supportRequestService.UpdateIssueAsync(issueKey, assignedToId, issueStatusId, comment, GetLoggedInUser());
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
}
catch (ArgumentException)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
}
public async Task<ActionResult> Filter(int pageNumber = 1, int take = _defaultTakeCount, int? assignedToId = null, int? issueStatusId = null, string reason = null)
{
if (pageNumber <= 0)
{
pageNumber = 1;
}
if (take < 1)
{
take = _defaultTakeCount;
}
var issues = (await GetSupportRequestsAsync(pageNumber, take, assignedToId, reason, issueStatusId)).Take(take).ToList();
var totalCount = _supportRequestService.GetIssueCount(assignedToId, reason, issueStatusId);
int maxPage;
if (totalCount % take == 0)
{
maxPage = totalCount / take;
}
else
{
maxPage = totalCount / take + 1;
}
var result = new
{
Issues = issues,
CurrentPageNumber = Math.Max(pageNumber, 1),
MaxPage = Math.Max(maxPage, 1)
};
var data = JsonConvert.SerializeObject(result, _defaultJsonSerializerSettings);
return Json(data, JsonRequestBehavior.AllowGet);
}
public async Task<ActionResult> Index(int pageNumber = 1, int take = _defaultTakeCount, int? assignedToId = null, int? issueStatusId = null, string reason = null)
{
if (pageNumber <= 0)
{
pageNumber = 1;
}
if (take < 1)
{
take = _defaultTakeCount;
}
var viewModel = new SupportRequestsViewModel();
viewModel.ItemsPerPage = take;
viewModel.CurrentPageNumber = pageNumber;
viewModel.AssignedToChoices = GetListOfAdmins();
viewModel.IssueStatusNameChoices = GetListOfIssueStatuses();
viewModel.AssignedToFilter = assignedToId;
viewModel.ReasonChoices = GetListOfReasons(reason);
viewModel.IssueStatusIdFilter = issueStatusId;
viewModel.ReasonFilter = reason;
var totalCount = _supportRequestService.GetIssueCount(assignedToId, reason, issueStatusId);
if (totalCount % take == 0)
{
viewModel.MaxPage = totalCount / take;
}
else
{
viewModel.MaxPage = totalCount / take + 1;
}
var issues = await GetSupportRequestsAsync(pageNumber, take, assignedToId, reason, issueStatusId);
viewModel.Issues.AddRange(issues);
return View(viewModel);
}
public ActionResult History(int id)
{
var historyEntries = _supportRequestService.GetHistoryEntriesByIssueKey(id).OrderByDescending(h => h.EntryDate);
return Json(historyEntries, JsonRequestBehavior.AllowGet);
}
private async Task<List<SupportRequestViewModel>> GetSupportRequestsAsync(int pageNumber = 1, int take = _defaultTakeCount, int? assignedTo = null, string reason = null, int? issueStatusId = null)
{
if (pageNumber <= 0)
{
pageNumber = 1;
}
if (take < 1)
{
take = _defaultTakeCount;
}
var skip = (pageNumber - 1) * take;
var galleryUsername = GetLoggedInUser();
var issues = _supportRequestService.GetIssues(assignedTo, reason, issueStatusId, galleryUsername);
IEnumerable<Issue> pagedIssues = issues;
if (skip > 0)
{
pagedIssues = issues.Skip(skip);
}
pagedIssues = pagedIssues.Take(take);
var enumerable = pagedIssues as IList<Issue> ?? pagedIssues.ToList();
var distinctUserKeys = enumerable.Select(i => i.UserKey).Where(i => i.HasValue).Select(i => i.Value).Distinct().ToList();
var userEmails = await _userService.GetEmailAddressesForUserKeysAsync(distinctUserKeys);
var results = new List<SupportRequestViewModel>();
foreach (var issue in enumerable)
{
var viewModel = new SupportRequestViewModel(issue);
viewModel.AssignedToGalleryUsername = issue.AssignedTo?.GalleryUsername;
viewModel.IssueStatusName = issue.IssueStatus.Name;
viewModel.UserEmail = issue.UserKey.HasValue ? userEmails[issue.UserKey.Value] : string.Empty;
results.Add(viewModel);
}
return results;
}
private string GetLoggedInUser()
{
return User.Identity.Name;
}
private List<SelectListItem> GetListOfIssueStatuses(int? selectedIssueKey = -1)
{
var issueStatuses = _supportRequestService.GetAllIssueStatuses();
var items = new List<SelectListItem>();
foreach (var status in issueStatuses)
{
var item = new SelectListItem { Text = status.Name, Value = status.Key.ToString(CultureInfo.InvariantCulture) };
if (selectedIssueKey.HasValue && status.Key == selectedIssueKey)
{
item.Selected = true;
}
items.Add(item);
}
items.Add(new SelectListItem { Text = "Unresolved", Value = IssueStatusKeys.Unresolved.ToString(CultureInfo.InvariantCulture) });
return items;
}
private static List<SelectListItem> GetListOfReasons(string reasonToSelect)
{
var reasons = new List<SelectListItem>();
var reasonValues = Enum.GetValues(typeof(ReportPackageReason));
foreach (var reasonValue in reasonValues)
{
var item = new SelectListItem { Text = EnumHelper.GetDescription((ReportPackageReason)reasonValue) };
if (!string.IsNullOrEmpty(reasonToSelect)
&& string.Equals(reasonValue.ToString(), reasonToSelect, StringComparison.OrdinalIgnoreCase))
{
item.Selected = true;
}
reasons.Add(item);
}
return reasons;
}
private List<SelectListItem> GetListOfAdmins(int? selectedAdminKey = null)
{
var results = new List<SelectListItem>
{
// Add the "unassigned" admin
new SelectListItem {Text = "unassigned", Value = "-1", Selected = selectedAdminKey == -1}
};
var admins = _supportRequestService.GetAllAdmins();
foreach (var a in admins.OrderBy(a => a.GalleryUsername))
{
var currentItem = new SelectListItem { Text = a.GalleryUsername, Value = a.Key.ToString(CultureInfo.InvariantCulture) };
if (a.Key == selectedAdminKey)
{
currentItem.Selected = true;
}
results.Add(currentItem);
}
return results;
}
}
} | 35.224615 | 204 | 0.585779 | [
"Apache-2.0"
] | SubPointSolutions/MetaPackGallery | src/NuGetGallery/Areas/Admin/Controllers/SupportRequestController.cs | 11,450 | C# |
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ShoelessJoeWebApi.DataAccess.DataModels;
namespace ShoelessJoeWebApi.DataAccess.Migrations
{
[DbContext(typeof(ShoelessdevContext))]
[Migration("20211229220601_AddedBills")]
partial class AddedBills
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Address", b =>
{
b.Property<int>("AddressId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("City")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<int>("StateId")
.HasColumnType("int");
b.Property<string>("Street")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<string>("ZipCode")
.IsRequired()
.HasMaxLength(5)
.HasColumnType("nvarchar(5)");
b.HasKey("AddressId");
b.HasIndex("StateId");
b.ToTable("Addresses");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.BillService.Bill", b =>
{
b.Property<int>("BillId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<decimal>("AmountDue")
.HasColumnType("decimal(18,2)");
b.Property<string>("BillName")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DueDate")
.HasColumnType("datetime2");
b.Property<bool>("IsLate")
.HasColumnType("bit");
b.Property<bool>("IsPaid")
.HasColumnType("bit");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("BillId");
b.HasIndex("UserId");
b.ToTable("Bill");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Comment", b =>
{
b.Property<int>("CommentId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("BuyerId")
.HasColumnType("int");
b.Property<string>("CommentBody")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<DateTime>("DatePosted")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2");
b.Property<bool?>("IsApproved")
.HasColumnType("bit");
b.Property<bool>("IsShipped")
.HasColumnType("bit");
b.Property<int>("ShoeId")
.HasColumnType("int");
b.HasKey("CommentId");
b.HasIndex("BuyerId");
b.HasIndex("ShoeId");
b.ToTable("Comments");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.CommentAndSeller", b =>
{
b.Property<int>("CommentBuyerId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("CommentId")
.HasColumnType("int");
b.Property<int>("SellerId")
.HasColumnType("int");
b.HasKey("CommentBuyerId");
b.HasIndex("CommentId");
b.HasIndex("SellerId");
b.ToTable("CommentAndSeller");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Friend", b =>
{
b.Property<int>("SenderId")
.HasColumnType("int");
b.Property<int>("RecieverId")
.HasColumnType("int");
b.Property<DateTime?>("DateAccepted")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2");
b.HasKey("SenderId", "RecieverId");
b.HasIndex("RecieverId");
b.ToTable("Friends");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Manufacter", b =>
{
b.Property<int>("ManufacterId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("AddressId")
.HasColumnType("int");
b.Property<bool>("IsApproved")
.HasColumnType("bit");
b.Property<string>("Name")
.HasMaxLength(75)
.HasColumnType("nvarchar(75)");
b.HasKey("ManufacterId");
b.HasIndex("AddressId")
.IsUnique();
b.ToTable("Manufacters");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Model", b =>
{
b.Property<int>("ModelId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("ManufacterId")
.HasColumnType("int");
b.Property<string>("ModelName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("ModelId");
b.HasIndex("ManufacterId");
b.ToTable("Models");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Post", b =>
{
b.Property<int>("PostId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CommentBody")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<DateTime>("DatePosted")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("PostId");
b.HasIndex("UserId");
b.ToTable("Posts");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Reply", b =>
{
b.Property<int>("ReplyId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("CommentId")
.HasColumnType("int");
b.Property<DateTime>("DatePosted")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2");
b.Property<string>("ReplyBody")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("ReplyId");
b.HasIndex("CommentId");
b.HasIndex("UserId");
b.ToTable("Replies");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.School", b =>
{
b.Property<int>("SchoolId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("AddressId")
.HasColumnType("int");
b.Property<string>("SchoolName")
.IsRequired()
.HasMaxLength(75)
.HasColumnType("nvarchar(75)");
b.HasKey("SchoolId");
b.HasIndex("AddressId")
.IsUnique();
b.ToTable("Schools");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Shoe", b =>
{
b.Property<int>("ShoeId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<bool?>("BothShoes")
.HasColumnType("bit");
b.Property<bool>("IsSold")
.HasColumnType("bit");
b.Property<double?>("LeftSize")
.HasColumnType("float");
b.Property<int>("ModelId")
.HasColumnType("int");
b.Property<double?>("RightSize")
.HasColumnType("float");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("ShoeId");
b.HasIndex("ModelId");
b.HasIndex("UserId");
b.ToTable("Shoes");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.ShoeImage", b =>
{
b.Property<int>("ImgGroupId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("LeftShoeLeft")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<string>("LeftShoeRight")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<string>("RightShoeLeft")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<string>("RightShoeRight")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<int>("ShoeId")
.HasColumnType("int");
b.HasKey("ImgGroupId");
b.HasIndex("ShoeId")
.IsUnique();
b.ToTable("ShoeImages");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.State", b =>
{
b.Property<int>("StateId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("StateAbr")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("nvarchar(2)");
b.Property<string>("StateName")
.IsRequired()
.HasMaxLength(75)
.HasColumnType("nvarchar(75)");
b.HasKey("StateId");
b.ToTable("States");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.User", b =>
{
b.Property<int>("UserId")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool?>("IsAdmin")
.HasColumnType("bit");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<int?>("SchoolId")
.HasColumnType("int");
b.HasKey("UserId");
b.HasIndex("SchoolId");
b.ToTable("Users");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Address", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.State", "State")
.WithMany("Addresses")
.HasForeignKey("StateId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("State");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.BillService.Bill", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.User", "User")
.WithMany("Bills")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Comment", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.User", "Buyer")
.WithMany("BuyerComments")
.HasForeignKey("BuyerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.Shoe", "Shoe")
.WithMany("Comments")
.HasForeignKey("ShoeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Buyer");
b.Navigation("Shoe");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.CommentAndSeller", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.Comment", "Comment")
.WithMany("CommentAndSellers")
.HasForeignKey("CommentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.User", "Seller")
.WithMany("CommentAndSellers")
.HasForeignKey("SellerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Comment");
b.Navigation("Seller");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Friend", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.User", "Reciever")
.WithMany("RecieverFriends")
.HasForeignKey("RecieverId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.User", "Sender")
.WithMany("SenderFriends")
.HasForeignKey("SenderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Reciever");
b.Navigation("Sender");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Manufacter", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.Address", "Address")
.WithOne("Manufacter")
.HasForeignKey("ShoelessJoeWebApi.DataAccess.DataModels.Manufacter", "AddressId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Address");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Model", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.Manufacter", "Manufacter")
.WithMany("Models")
.HasForeignKey("ManufacterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manufacter");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Post", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.User", "User")
.WithMany("Posts")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Reply", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.Comment", "Comment")
.WithMany("Replies")
.HasForeignKey("CommentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.User", "User")
.WithMany("Replies")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Comment");
b.Navigation("User");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.School", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.Address", "Address")
.WithOne("School")
.HasForeignKey("ShoelessJoeWebApi.DataAccess.DataModels.School", "AddressId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Address");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Shoe", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.Model", "Model")
.WithMany("Shoes")
.HasForeignKey("ModelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.User", "User")
.WithMany("Shoes")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Model");
b.Navigation("User");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.ShoeImage", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.Shoe", "Shoe")
.WithOne("ShoeImage")
.HasForeignKey("ShoelessJoeWebApi.DataAccess.DataModels.ShoeImage", "ShoeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Shoe");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.User", b =>
{
b.HasOne("ShoelessJoeWebApi.DataAccess.DataModels.School", "School")
.WithMany("Students")
.HasForeignKey("SchoolId");
b.Navigation("School");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Address", b =>
{
b.Navigation("Manufacter");
b.Navigation("School");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Comment", b =>
{
b.Navigation("CommentAndSellers");
b.Navigation("Replies");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Manufacter", b =>
{
b.Navigation("Models");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Model", b =>
{
b.Navigation("Shoes");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.School", b =>
{
b.Navigation("Students");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.Shoe", b =>
{
b.Navigation("Comments");
b.Navigation("ShoeImage");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.State", b =>
{
b.Navigation("Addresses");
});
modelBuilder.Entity("ShoelessJoeWebApi.DataAccess.DataModels.User", b =>
{
b.Navigation("Bills");
b.Navigation("BuyerComments");
b.Navigation("CommentAndSellers");
b.Navigation("Posts");
b.Navigation("RecieverFriends");
b.Navigation("Replies");
b.Navigation("SenderFriends");
b.Navigation("Shoes");
});
#pragma warning restore 612, 618
}
}
}
| 37.280179 | 125 | 0.459444 | [
"MIT"
] | TClaypool00/ShoelessJoeApiV2 | ShoelessJoeWebApi.DataAccess/Migrations/20211229220601_AddedBills.Designer.cs | 25,017 | C# |
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Resolution.Sentences;
using Resolution.Visitors.ConjunctionExclusion;
namespace Resolution.Tests.VisitorsTests.ConjunctionExclusion
{
[TestClass]
public class ChildConjunctionExclusionStateTests
{
[TestMethod]
public void ParseLiteral_ShouldSetFsmStateToItself()
{
var fsm = Mock.Of<IConjunctionExclusionFSM>();
var testedState = new ChildConjunctionExclusionState(fsm);
var literal = new Literal("p");
testedState.ParseLiteral(literal);
Assert.AreEqual(testedState, fsm.State);
}
[TestMethod]
public void ParseComplexSentence_ShouldSetFsmStateToItself_WhenSentenceIsAlternative()
{
var fsm = Mock.Of<IConjunctionExclusionFSM>();
var testedState = new ChildConjunctionExclusionState(fsm);
var complexSentence = new ComplexSentence(Connective.OR, new Literal("p"), new Literal("q"));
testedState.ParseComplexSentence(complexSentence);
Assert.AreEqual(testedState, fsm.State);
}
[TestMethod]
public void ParseComplexSentence_ShouldSetFsmStateToRoot_WhenSentenceIsConjunction()
{
var fsm = Mock.Of<IConjunctionExclusionFSM>();
var testedState = new ChildConjunctionExclusionState(fsm);
var complexSentence = new ComplexSentence(Connective.AND, new Literal("p"), new Literal("q"));
testedState.ParseComplexSentence(complexSentence);
Assert.IsInstanceOfType(fsm.State, typeof(RootConjunctionExclusionState));
}
[TestMethod]
public void ParseComplexSentence_ShouldThrowArgumentException_WhenSentenceIsImplication()
{
var fsm = Mock.Of<IConjunctionExclusionFSM>();
var testedState = new ChildConjunctionExclusionState(fsm);
var complexSentence = new ComplexSentence(Connective.IMPLICATION, new Literal("p"), new Literal("q"));
Assert.ThrowsException<ArgumentException>(() => testedState.ParseComplexSentence(complexSentence));
}
}
} | 42.843137 | 114 | 0.686957 | [
"Apache-2.0"
] | wsi4/wsi_rezolucja | Resolution/Resolution.Tests/VisitorsTests/ConjunctionExclusion/ChildConjunctionExclusionStateTests.cs | 2,187 | 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("DAL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DAL")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ed6d111f-1c54-4381-af4f-8de0c075242d")]
// 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.27027 | 84 | 0.741842 | [
"MIT"
] | RikiZilber/LicensingOffice | DAL/Properties/AssemblyInfo.cs | 1,382 | C# |
// ----------------------------------------------------------------------
// <copyright file="GetToken.cs">
// Copyright (c) The Loxone.NET Authors. All rights reserved.
// </copyright>
// <license>
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE.txt file.
// </license>
// ----------------------------------------------------------------------
namespace Loxone.Client.Transport.Serialization.Responses
{
using System;
using System.Text.Json.Serialization;
internal sealed class GetToken
{
public string Token { get; set; }
public string Key { get; set; }
[JsonConverter(typeof(LXDateTimeConverter))]
public DateTime ValidUntil { get; set; }
public int TokenRights { get; set; }
[JsonPropertyName("unsecurePass")]
public bool UnsecurePassword { get; set; }
}
}
| 29.096774 | 73 | 0.542129 | [
"MIT"
] | graspea/Loxone.NET | Loxone.Client/Transport/Serialization/Responses/GetToken.cs | 902 | C# |
using AnimationOrTween;
using System;
using UnityEngine;
[AddComponentMenu("NGUI/Interaction/Button Play Animation")]
public class UIButtonPlayAnimation : MonoBehaviour
{
public string callWhenFinished;
public bool clearSelection;
public string clipName;
public DisableCondition disableWhenFinished;
public GameObject eventReceiver;
public EnableCondition ifDisabledOnPlay;
private bool mHighlighted;
private bool mStarted;
public ActiveAnimation.OnFinished onFinished;
public AnimationOrTween.Direction playDirection = AnimationOrTween.Direction.Forward;
public bool resetOnPlay;
public Animation target;
public AnimationOrTween.Trigger trigger;
private void OnActivate(bool isActive)
{
if (base.enabled && (((this.trigger == AnimationOrTween.Trigger.OnActivate) || ((this.trigger == AnimationOrTween.Trigger.OnActivateTrue) && isActive)) || ((this.trigger == AnimationOrTween.Trigger.OnActivateFalse) && !isActive)))
{
this.Play(isActive);
}
}
private void OnClick()
{
if (base.enabled && (this.trigger == AnimationOrTween.Trigger.OnClick))
{
this.Play(true);
}
}
private void OnDoubleClick()
{
if (base.enabled && (this.trigger == AnimationOrTween.Trigger.OnDoubleClick))
{
this.Play(true);
}
}
private void OnEnable()
{
if (this.mStarted && this.mHighlighted)
{
this.OnHover(UICamera.IsHighlighted(base.gameObject));
}
}
private void OnHover(bool isOver)
{
if (base.enabled)
{
if (((this.trigger == AnimationOrTween.Trigger.OnHover) || ((this.trigger == AnimationOrTween.Trigger.OnHoverTrue) && isOver)) || ((this.trigger == AnimationOrTween.Trigger.OnHoverFalse) && !isOver))
{
this.Play(isOver);
}
this.mHighlighted = isOver;
}
}
private void OnPress(bool isPressed)
{
if (base.enabled && (((this.trigger == AnimationOrTween.Trigger.OnPress) || ((this.trigger == AnimationOrTween.Trigger.OnPressTrue) && isPressed)) || ((this.trigger == AnimationOrTween.Trigger.OnPressFalse) && !isPressed)))
{
this.Play(isPressed);
}
}
private void OnSelect(bool isSelected)
{
if (base.enabled && (((this.trigger == AnimationOrTween.Trigger.OnSelect) || ((this.trigger == AnimationOrTween.Trigger.OnSelectTrue) && isSelected)) || ((this.trigger == AnimationOrTween.Trigger.OnSelectFalse) && !isSelected)))
{
this.Play(true);
}
}
private void Play(bool forward)
{
if (this.target == null)
{
this.target = base.GetComponentInChildren<Animation>();
}
if (this.target != null)
{
if (this.clearSelection && (UICamera.selectedObject == base.gameObject))
{
UICamera.selectedObject = null;
}
int num = -(int)this.playDirection;
AnimationOrTween.Direction playDirection = !forward ? ((AnimationOrTween.Direction) num) : this.playDirection;
ActiveAnimation animation = ActiveAnimation.Play(this.target, this.clipName, playDirection, this.ifDisabledOnPlay, this.disableWhenFinished);
if (animation != null)
{
if (this.resetOnPlay)
{
animation.Reset();
}
animation.onFinished = this.onFinished;
if ((this.eventReceiver != null) && !string.IsNullOrEmpty(this.callWhenFinished))
{
animation.eventReceiver = this.eventReceiver;
animation.callWhenFinished = this.callWhenFinished;
}
else
{
animation.eventReceiver = null;
}
}
}
}
private void Start()
{
this.mStarted = true;
}
}
| 33.01626 | 238 | 0.593204 | [
"Apache-2.0"
] | ITALIA195/AoTTG-Mod | UIButtonPlayAnimation.cs | 4,061 | C# |
using Domain.Todos.Aggregates;
namespace Domain.Todos.Queries;
public record TodoGetSingleQuery(Guid AggregateId) : IQuery<Todo?>; | 26.4 | 67 | 0.818182 | [
"MIT"
] | NQbbe/DDD-CQRS-EventSourcing-Template | src/Domain/Todos/Queries/TodoGetSingleQuery.cs | 132 | C# |
using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace EntidadClient.Areas.Identity.Pages.Account.Manage
{
public class DeletePersonalDataModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly ILogger<DeletePersonalDataModel> _logger;
public DeletePersonalDataModel(
UserManager<IdentityUser> userManager,
SignInManager<IdentityUser> signInManager,
ILogger<DeletePersonalDataModel> logger)
{
_userManager = userManager;
_signInManager = signInManager;
_logger = logger;
}
[BindProperty]
public InputModel Input { get; set; }
public class InputModel
{
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
}
public bool RequirePassword { get; set; }
public async Task<IActionResult> OnGet()
{
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
}
RequirePassword = await _userManager.HasPasswordAsync(user);
return Page();
}
public async Task<IActionResult> OnPostAsync()
{
var user = await _userManager.GetUserAsync(User);
if (user == null)
{
return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
}
RequirePassword = await _userManager.HasPasswordAsync(user);
if (RequirePassword)
{
if (!await _userManager.CheckPasswordAsync(user, Input.Password))
{
ModelState.AddModelError(string.Empty, "Password not correct.");
return Page();
}
}
var result = await _userManager.DeleteAsync(user);
var userId = await _userManager.GetUserIdAsync(user);
if (!result.Succeeded)
{
throw new InvalidOperationException($"Unexpected error occurred deleteing user with ID '{userId}'.");
}
await _signInManager.SignOutAsync();
_logger.LogInformation("User with ID '{UserId}' deleted themselves.", userId);
return Redirect("~/");
}
}
} | 33.963855 | 118 | 0.579283 | [
"MIT"
] | andcolombia/libreria-net-core-auth | Areas/Identity/Pages/Account/Manage/DeletePersonalData.cshtml.cs | 2,821 | C# |
// ReSharper disable once CheckNamespace
namespace Toppings {
public partial class DecimalValue {
private const decimal NanoDivisor = 1_000_000_000m;
private DecimalValue (decimal value) {
Units = (long) decimal.Truncate (value);
Nanos = (int) ((value - Units) * NanoDivisor);
}
public static implicit operator decimal (DecimalValue value) =>
value.Units + (value.Nanos / NanoDivisor);
public static implicit operator DecimalValue (decimal value) =>
new DecimalValue (value);
}
} | 41.071429 | 71 | 0.641739 | [
"MIT"
] | tschettler/ndc-minnesota-2020 | src/Toppings/Protos/DecimalValue.cs | 575 | C# |
using System;
namespace API_Program
{
class Program
{
static void Main(string[] args)
{
// load config
Config config = new Config();
config.configConsole();
//
restart:
int eleccion;
functions obj = new functions();
obj.clear();
obj.welcomeMsg();
obj.clear();
Console.WriteLine("Username: " + obj.getNombre());
restart1:
Console.WriteLine("Seleccione una de estas dos opciones: ");
Console.WriteLine("1. Calculadora");
Console.WriteLine("2. Lista Base");
Console.WriteLine("3. Conversion");
Console.WriteLine("4. Randomizer");
eleccion = Convert.ToInt32(Console.ReadLine());
switch (eleccion)
{
case 1:
Console.WriteLine("Usted a escogido la calculadora");
obj.clear();
Calculadora calc = new Calculadora();
retu:
calc.calculadora();
int volver;
Console.WriteLine("Desea hacer otra operación?");
Console.WriteLine("1.- Y");
Console.WriteLine("2.- N");
Console.WriteLine("3.- Salir");
volver = Convert.ToInt32(Console.ReadLine());
switch (volver)
{
case 1:
functions tmobj = new functions();
tmobj.clear();
goto retu;
case 2:
functions dtrobj = new functions();
dtrobj.clear();
goto restart1;
case 3:
functions trobj = new functions();
trobj.closeProgram();
trobj.clear();
break;
}
break;
case 2:
List lista = new List();
Console.WriteLine("Usted a escogido la lista base");
obj.clear();
lista.baseList();
obj.clear();
goto restart1;
case 3:
Conversion conver = new Conversion();
Console.WriteLine("Usted a escogido la Conversion");
obj.clear();
conver.conversion();
obj.clear();
goto restart1;
case 4:
Randomizer ran = new Randomizer();
Console.WriteLine("Usted a eligido Randomizer");
obj.pause();
obj.clear();
ran.randomi();
obj.clear();
goto restart1;
case 32:
obj.clear();
ConfigH titles = new ConfigH();
titles.configTitleChangeConsole();
goto restart1;
default: Console.WriteLine("Usted no ha escogido uno de los tres puntos establecidos");
goto restart;
}
}
}
}
| 37.815217 | 104 | 0.392642 | [
"MIT"
] | neopkr/csharp-program | Program.cs | 3,482 | C# |
using System;
using System.Collections.Generic;
using KoiVM.CFG;
namespace KoiVM.VM {
public class VMMethodInfo {
public VMMethodInfo() {
BlockKeys = new Dictionary<IBasicBlock, VMBlockKey>();
UsedRegister = new HashSet<VMRegisters>();
}
public ScopeBlock RootScope;
public readonly Dictionary<IBasicBlock, VMBlockKey> BlockKeys;
public readonly HashSet<VMRegisters> UsedRegister;
public byte EntryKey;
public byte ExitKey;
}
public struct VMBlockKey {
public byte EntryKey;
public byte ExitKey;
}
} | 24.043478 | 65 | 0.725136 | [
"CC0-1.0"
] | ElektroKill/KoiVM | KoiVM/VM/VMMethodInfo.cs | 555 | C# |
namespace SampleApp
{
partial class DataTableTreeExample
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataTableTreeExample));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.treeViewAdv1 = new Aga.Controls.Tree.TreeViewAdv();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.addNodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.nodeTextBox1 = new Aga.Controls.Tree.NodeControls.NodeTextBox();
this.nodeStateIcon1 = new Aga.Controls.Tree.NodeControls.NodeStateIcon();
this.panel1 = new System.Windows.Forms.Panel();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ParentID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Label = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Data = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.label1 = new System.Windows.Forms.Label();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.treeViewAdv1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.panel1);
this.splitContainer1.Panel2.Controls.Add(this.dataGridView1);
this.splitContainer1.Size = new System.Drawing.Size(830, 528);
this.splitContainer1.SplitterDistance = 298;
this.splitContainer1.TabIndex = 0;
//
// treeViewAdv1
//
this.treeViewAdv1.BackColor = System.Drawing.SystemColors.Window;
this.treeViewAdv1.ContextMenuStrip = this.contextMenuStrip1;
this.treeViewAdv1.Cursor = System.Windows.Forms.Cursors.Default;
this.treeViewAdv1.DefaultToolTipProvider = null;
this.treeViewAdv1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeViewAdv1.DragDropMarkColor = System.Drawing.Color.Black;
this.treeViewAdv1.LineColor = System.Drawing.SystemColors.ControlDark;
this.treeViewAdv1.Location = new System.Drawing.Point(0, 0);
this.treeViewAdv1.Model = null;
this.treeViewAdv1.Name = "treeViewAdv1";
this.treeViewAdv1.NodeControls.Add(this.nodeTextBox1);
this.treeViewAdv1.NodeControls.Add(this.nodeStateIcon1);
this.treeViewAdv1.SelectedNode = null;
this.treeViewAdv1.Size = new System.Drawing.Size(298, 528);
this.treeViewAdv1.TabIndex = 0;
this.treeViewAdv1.Text = "treeViewAdv1";
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addNodeToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(153, 48);
//
// addNodeToolStripMenuItem
//
this.addNodeToolStripMenuItem.Name = "addNodeToolStripMenuItem";
this.addNodeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.addNodeToolStripMenuItem.Text = "Add Node";
this.addNodeToolStripMenuItem.Click += new System.EventHandler(this.addNode_Click);
//
// nodeTextBox1
//
this.nodeTextBox1.IncrementalSearchEnabled = true;
this.nodeTextBox1.LeftMargin = 3;
this.nodeTextBox1.ParentColumn = null;
//
// nodeStateIcon1
//
this.nodeStateIcon1.LeftMargin = 1;
this.nodeStateIcon1.ParentColumn = null;
//
// panel1
//
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 428);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(528, 100);
this.panel1.TabIndex = 1;
//
// dataGridView1
//
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ID,
this.ParentID,
this.Label,
this.Data});
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(528, 528);
this.dataGridView1.TabIndex = 0;
this.dataGridView1.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.dataGridView1_RowsAdded);
//
// ID
//
this.ID.HeaderText = "ID";
this.ID.Name = "ID";
//
// ParentID
//
this.ParentID.HeaderText = "ParentID";
this.ParentID.Name = "ParentID";
//
// Label
//
this.Label.HeaderText = "Label";
this.Label.Name = "Label";
//
// Data
//
this.Data.HeaderText = "Data";
this.Data.Name = "Data";
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "");
this.imageList1.Images.SetKeyName(1, "");
this.imageList1.Images.SetKeyName(2, "");
this.imageList1.Images.SetKeyName(3, "");
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(59, 34);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(174, 13);
this.label1.TabIndex = 0;
this.label1.Text = "right click on a folder to add a node";
//
// DataTableTreeExample
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "DataTableTreeExample";
this.Size = new System.Drawing.Size(830, 528);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private Aga.Controls.Tree.TreeViewAdv treeViewAdv1;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
private System.Windows.Forms.DataGridViewTextBoxColumn ParentID;
private System.Windows.Forms.DataGridViewTextBoxColumn Label;
private System.Windows.Forms.DataGridViewTextBoxColumn Data;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem addNodeToolStripMenuItem;
private System.Windows.Forms.ImageList imageList1;
private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBox1;
private Aga.Controls.Tree.NodeControls.NodeStateIcon nodeStateIcon1;
private System.Windows.Forms.Label label1;
}
}
| 47.552995 | 153 | 0.598992 | [
"MIT"
] | DoomStorm/WindowTabs | treeviewadv/SampleApp/DataTableExample/DataTableTreeExample.designer.cs | 10,319 | C# |
using System;
using System.Data;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NSubstitute;
namespace Mutex.Data.Impl.UnitTests
{
[TestClass]
public class CommandFactoryUnitTest
{
[TestMethod]
public void Construct_WithoutDbTypeResolver()
{
new CommandFactory();
}
//[TestMethod]
//[ExpectedException(typeof(ArgumentNullException))]
//public void Construct_WithNullDbTypeResolver_ThrowsException()
//{
// new CommandFactory(null);
//}
//[TestMethod]
//public void Construct_WithDbTypeResolver()
//{
// var dbTypeResolver = Substitute.For<IDbTypeResolver>();
// new CommandFactory(dbTypeResolver);
//}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void Create_WithNullDbCommand_ThrowsException()
{
var sut = new CommandFactory();
sut.Create(null);
}
[TestMethod]
public void Create_WithoutDbTypeResolver_CreatesCommand()
{
var sut = new CommandFactory();
var dbCommand = Substitute.For<IDbCommand>();
var actual = sut.Create(dbCommand);
Assert.AreSame(typeof(Command), actual.GetType());
}
//[TestMethod]
//public void Create_WithDbTypeResolver_CreatesCommand()
//{
// var dbTypeResolver = Substitute.For<IDbTypeResolver>();
// var sut = new CommandFactory(dbTypeResolver);
// var dbCommand = Substitute.For<IDbCommand>();
// var actual = sut.Create(dbCommand);
// Assert.AreSame(typeof(Command), actual.GetType());
//}
}
}
| 27.215385 | 72 | 0.596947 | [
"MIT"
] | jmuukka/data | Impl.UnitTests/CommandFactoryUnitTest.cs | 1,771 | C# |
namespace Goke.Plotly.Blazor
{
public class Scene
{
public Axis Xaxis { get; set; } = new Axis();
public Axis Yaxis { get; set; } = new Axis();
public Axis Zaxis { get; set; } = new Axis();
}
} | 23.1 | 53 | 0.541126 | [
"MIT"
] | goke-ai/plotly-blazor | src/Plotly.Blazor/Plotly/Scene.cs | 233 | C# |
using System;
using System.Collections.Generic;
using EZNEW.Develop.Entity;
namespace EZNEW.Entity.Sys
{
/// <summary>
/// 操作功能分组
/// </summary>
[Serializable]
[Entity("Sys_OperationGroup", "Sys", "操作功能分组")]
public class OperationGroupEntity : BaseEntity<OperationGroupEntity>
{
/// <summary>
/// 编号
/// </summary>
[EntityField(Description = "编号", Role = FieldRole.PrimaryKey)]
public long Id { get; set; }
/// <summary>
/// 名称
/// </summary>
[EntityField(Description = "名称")]
public string Name { get; set; }
/// <summary>
/// 排序
/// </summary>
[EntityField(Description = "排序")]
public int Sort { get; set; }
/// <summary>
/// 上级
/// </summary>
[EntityField(Description = "上级")]
public long Parent { get; set; }
/// <summary>
/// 说明
/// </summary>
[EntityField(Description = "说明")]
public string Remark { get; set; }
}
} | 24.045455 | 72 | 0.510397 | [
"MIT"
] | eznew-net/Demo | Modules/Sys/Model/EZNEW.Entity.Sys/OperationGroupEntity.cs | 1,122 | C# |
namespace ModelGenerator
{
public class Program
{
public static void Main(string[] args)
{
var command = Args.Configuration.Configure<ModelBuilder>().CreateAndBind(args);
command.Execute();
}
}
} | 23.181818 | 91 | 0.588235 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | AMCN41R/nHapi | src/ModelGenerator/Program.cs | 255 | C# |
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class UE4MarchingCubesGPUTarget : TargetRules
{
public UE4MarchingCubesGPUTarget(TargetInfo Target)
{
Type = TargetType.Game;
}
//
// TargetRules interface.
//
public override void SetupBinaries(
TargetInfo Target,
ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
ref List<string> OutExtraModuleNames
)
{
OutExtraModuleNames.Add("UE4MarchingCubesGPU");
}
}
| 20.192308 | 68 | 0.777143 | [
"MIT"
] | runedegroot/UE4MarchingCubesGPU | Source/UE4MarchingCubesGPU.Target.cs | 525 | C# |
/*
* DISCLAIMER
*
* Copyright 2016 ArangoDB GmbH, Cologne, Germany
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright holder is ArangoDB GmbH, Cologne, Germany
*/
namespace VelocyPack
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Reflection;
using VelocyPack.Exceptions;
using VelocyPack.Internal;
using VelocyPack.Migration.Util;
/// <author>Mark - mark at arangodb.com</author>
public class VPack
{
private const string ATTR_KEY = "key";
private const string ATTR_VALUE = "value";
private readonly IDictionary<Type, IVPackSerializer> serializers;
private readonly IDictionary<Type, IVPackDeserializer> deserializers;
private readonly IDictionary<string, IDictionary<Type, IVPackDeserializer>> deserializersByName;
private readonly IDictionary<Type, IVPackInstanceCreator> instanceCreators;
private readonly IDictionary<Type, IVPackKeyMapAdapter> keyMapAdapters;
private readonly VPackBuilder.IBuilderOptions builderOptions;
private readonly VPackCache cache;
private readonly IVPackSerializationContext serializationContext;
private readonly VPackDeserializationContext deserializationContext;
private readonly bool serializeNullValues;
public class Builder
{
private readonly IDictionary<Type, IVPackSerializer> serializers;
private readonly IDictionary<Type, IVPackDeserializer> deserializers;
private readonly IDictionary<string, IDictionary<Type, IVPackDeserializer>> deserializersByName;
private readonly IDictionary<Type, IVPackInstanceCreator> instanceCreators;
private readonly VPackBuilder.IBuilderOptions builderOptions;
private bool serializeNullValues;
private IVPackFieldNamingStrategy fieldNamingStrategy;
public Builder()
{
this.serializers = new Dictionary<Type, IVPackSerializer>();
this.deserializers = new Dictionary<Type, IVPackDeserializer>();
this.deserializersByName = new Dictionary<string, IDictionary<Type, IVPackDeserializer>>();
this.instanceCreators = new Dictionary<Type, IVPackInstanceCreator>();
this.builderOptions = new DefaultVPackBuilderOptions();
this.serializeNullValues = false;
this.instanceCreators[typeof(IEnumerable)] = VPackInstanceCreators.COLLECTION;
this.instanceCreators[typeof(IList)] = VPackInstanceCreators.LIST;
this.instanceCreators[typeof(IDictionary)] = VPackInstanceCreators.MAP;
this.serializers[typeof(string)] = VPackSerializers.STRING;
this.serializers[typeof(bool)] = VPackSerializers.BOOLEAN;
this.serializers[typeof(int)] = VPackSerializers.INTEGER;
this.serializers[typeof(long)] = VPackSerializers.LONG;
this.serializers[typeof(short)] = VPackSerializers.SHORT;
this.serializers[typeof(double)] = VPackSerializers.DOUBLE;
this.serializers[typeof(float)] = VPackSerializers.FLOAT;
this.serializers[typeof(BigInteger)] = VPackSerializers.BIG_INTEGER;
this.serializers[typeof(decimal)] = VPackSerializers.NUMBER;
this.serializers[typeof(char)] = VPackSerializers.CHARACTER;
this.serializers[typeof(DateTime)] = VPackSerializers.DATE;
this.serializers[typeof(VPackSlice)] = VPackSerializers.VPACK;
this.deserializers[typeof(string)] = VPackDeserializers.STRING;
this.deserializers[typeof(bool)] = VPackDeserializers.BOOLEAN;
this.deserializers[typeof(int)] = VPackDeserializers.INTEGER;
this.deserializers[typeof(long)] = VPackDeserializers.LONG;
this.deserializers[typeof(short)] = VPackDeserializers.SHORT;
this.deserializers[typeof(double)] = VPackDeserializers.DOUBLE;
this.deserializers[typeof(float)] = VPackDeserializers.FLOAT;
this.deserializers[typeof(BigInteger)] = VPackDeserializers.BIG_INTEGER;
this.deserializers[typeof(decimal)] = VPackDeserializers.NUMBER;
this.deserializers[typeof(char)] = VPackDeserializers.CHARACTER;
this.deserializers[typeof(DateTime)] = VPackDeserializers.DATE;
this.deserializers[typeof(VPackSlice)] = VPackDeserializers.VPACK;
}
public virtual Builder RegisterSerializer<T>(Type type, IVPackSerializer serializer)
{
this.serializers[type] = serializer;
return this;
}
public virtual Builder RegisterDeserializer<T>(Type type, VPackDeserializer<T> deserializer)
{
this.deserializers[type] = deserializer;
return this;
}
public virtual Builder RegisterDeserializer<T>(
string fieldName,
Type type,
VPackDeserializer<T> deserializer)
{
IDictionary<Type, IVPackDeserializer> byName = this.deserializersByName[fieldName];
if (byName == null)
{
byName = new Dictionary<Type, IVPackDeserializer>();
this.deserializersByName[fieldName] = byName;
}
byName[type] = deserializer;
return this;
}
public virtual Builder RegisterInstanceCreator<T>(Type type, VPackInstanceCreator<T> creator)
{
this.instanceCreators[type] = creator;
return this;
}
public virtual Builder BuildUnindexedArrays(bool buildUnindexedArrays)
{
this.builderOptions.SetBuildUnindexedArrays(buildUnindexedArrays);
return this;
}
public virtual Builder BuildUnindexedObjects(bool buildUnindexedObjects)
{
this.builderOptions.SetBuildUnindexedObjects(buildUnindexedObjects);
return this;
}
public virtual Builder SerializeNullValues(bool serializeNullValues)
{
this.serializeNullValues = serializeNullValues;
return this;
}
public virtual Builder FieldNamingStrategy(IVPackFieldNamingStrategy fieldNamingStrategy)
{
this.fieldNamingStrategy = fieldNamingStrategy;
return this;
}
public virtual VPack Build()
{
return new VPack(
this.serializers,
this.deserializers,
this.instanceCreators,
this.builderOptions,
this.serializeNullValues,
fieldNamingStrategy,
this.deserializersByName);
}
}
private VPack(
IDictionary<Type, IVPackSerializer> serializers,
IDictionary<Type, IVPackDeserializer> deserializers,
IDictionary<Type, IVPackInstanceCreator> instanceCreators,
VPackBuilder.IBuilderOptions builderOptions,
bool serializeNullValues,
IVPackFieldNamingStrategy fieldNamingStrategy,
IDictionary<string, IDictionary<Type, IVPackDeserializer>> deserializersByName)
{
this.serializers = serializers;
this.deserializers = deserializers;
this.instanceCreators = instanceCreators;
this.builderOptions = builderOptions;
this.serializeNullValues = serializeNullValues;
this.deserializersByName = deserializersByName;
this.keyMapAdapters = new Dictionary<Type, IVPackKeyMapAdapter>();
this.cache = new VPackCache(fieldNamingStrategy);
this.serializationContext = new _VPackSerializationContext_209(this);
this.deserializationContext = new _VPackDeserializationContext_216(this);
this.keyMapAdapters[typeof(string)] = VPackKeyMapAdapters.STRING;
this.keyMapAdapters[typeof(bool)] = VPackKeyMapAdapters.BOOLEAN;
this.keyMapAdapters[typeof(int)] = VPackKeyMapAdapters.INTEGER;
this.keyMapAdapters[typeof(long)] = VPackKeyMapAdapters.LONG;
this.keyMapAdapters[typeof(short)] = VPackKeyMapAdapters.SHORT;
this.keyMapAdapters[typeof(double)] = VPackKeyMapAdapters.DOUBLE;
this.keyMapAdapters[typeof(float)] = VPackKeyMapAdapters.FLOAT;
this.keyMapAdapters[typeof(BigInteger)] = VPackKeyMapAdapters.BIG_INTEGER;
this.keyMapAdapters[typeof(decimal)] = VPackKeyMapAdapters.NUMBER;
this.keyMapAdapters[typeof(char)] = VPackKeyMapAdapters.CHARACTER;
}
private sealed class _VPackSerializationContext_209 : IVPackSerializationContext
{
public _VPackSerializationContext_209(VPack _enclosing)
{
this._enclosing = _enclosing;
}
/// <exception cref="VPackParserException"/>
public void Serialize(VPackBuilder builder, string attribute, object entity)
{
this._enclosing.Serialize(
attribute,
entity,
entity.GetType(),
builder,
new Dictionary<string, object>());
}
private readonly VPack _enclosing;
}
private sealed class _VPackDeserializationContext_216 : VPackDeserializationContext
{
public _VPackDeserializationContext_216(VPack _enclosing)
{
this._enclosing = _enclosing;
}
/// <exception cref="VPackParserException"/>
public T Deserialize<T>(VPackSlice vpack)
{
return this._enclosing.Deserialize<T>(vpack);
}
private readonly VPack _enclosing;
}
/// <exception cref="VPackParserException"/>
public virtual T Deserialize<T>(VPackSlice vpack)
{
if (typeof(T) == typeof(VPackSlice))
{
return (T)(object)vpack;
}
T entity;
try
{
entity = (T)GetValue(null, vpack, typeof(T), null);
}
catch (Exception e)
{
throw new VPackParserException(e);
}
return entity;
}
private IVPackDeserializer GetDeserializer(string fieldName, Type type)
{
IVPackDeserializer deserializer = null;
IDictionary<Type, IVPackDeserializer> byName = this.deserializersByName[fieldName];
if (byName != null)
{
deserializer = byName[type];
}
if (deserializer == null)
{
deserializer = this.deserializers[type];
}
return deserializer;
}
/// <exception cref="java.lang.InstantiationException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private object DeserializeObject(VPackSlice parent, VPackSlice vpack, Type type, string fieldName)
{
object entity;
IVPackDeserializer deserializer = this.GetDeserializer(fieldName, type);
if (deserializer != null)
{
entity = deserializer.Deserialize(parent, vpack, this.deserializationContext);
}
else
{
if (type == typeof(object))
{
entity = GetValue(parent, vpack, this.getType(vpack), fieldName);
}
else
{
entity = CreateInstance(type);
this.DeserializeFields(entity, vpack);
}
}
return entity;
}
private Type getType(VPackSlice vpack)
{
Type type;
if (vpack.IsObject)
{
type = typeof(IDictionary);
}
else
{
if (vpack.IsString)
{
type = typeof(string);
}
else
{
if (vpack.IsBoolean)
{
type = typeof(bool);
}
else
{
if (vpack.IsArray)
{
type = typeof(ICollection);
}
else
{
if (vpack.IsDate)
{
type = typeof(DateTime);
}
else
{
if (vpack.IsDouble)
{
type = typeof(double);
}
else
{
if (vpack.IsNumber)
{
type = typeof(decimal);
}
else
{
if (vpack.IsCustom)
{
type = typeof(string);
}
else
{
type = null;
}
}
}
}
}
}
}
}
return type;
}
/// <exception cref="java.lang.InstantiationException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
private object CreateInstance(Type type)
{
object entity = null;
IVPackInstanceCreator creator = this.instanceCreators[type];
if (creator != null)
{
entity = creator.CreateInstance();
}
else
{
if (type.IsGenericParameter && !type.IsConstructedGenericType)
{
var info = type.GetTypeInfo();
if (typeof(IDictionary<,>).GetTypeInfo().IsAssignableFrom(info))
{
entity = new Dictionary<object, object>(0);
}
else if (typeof(IList<>).GetTypeInfo().IsAssignableFrom(info))
{
entity = new List<object>(0);
}
else if (typeof(IEnumerable<>).GetTypeInfo().IsAssignableFrom(info))
{
entity = Enumerable.Empty<object>();
}
else
throw new TypeLoadException(string.Format("Creating open generic types are not supported. ({0})", type));
}
else
{
entity = Activator.CreateInstance(type);
}
}
return entity;
}
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="java.lang.InstantiationException"/>
/// <exception cref="VPackException"/>
private void DeserializeFields(object entity, VPackSlice vpack)
{
IDictionary<string, VPackCache.FieldInfo> fields = this.cache.getFields(entity.GetType());
for (IEnumerator<IEntry<string, VPackSlice>> iterator = vpack.ObjectIterator(); iterator.MoveNext();)
{
IEntry<string, VPackSlice> next = iterator.Current;
VPackCache.FieldInfo fieldInfo = fields[next.Key];
if (fieldInfo != null && fieldInfo.IsDeserialize)
{
this.DeserializeField(vpack, next.Value, entity, fieldInfo);
}
}
}
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="java.lang.InstantiationException"/>
/// <exception cref="VPackException"/>
private void DeserializeField(
VPackSlice parent,
VPackSlice vpack,
object entity,
VPackCache.FieldInfo fieldInfo)
{
if (!vpack.IsNone)
{
object value = GetValue(parent, vpack, fieldInfo.Type, fieldInfo.FieldName);
fieldInfo.set(entity, value);
}
}
/// <exception cref="java.lang.InstantiationException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private object GetValue(VPackSlice parent, VPackSlice vpack, Type type, string fieldName)
{
object value;
Type tmpType;
if (vpack.IsNull)
{
value = null;
}
else
{
IVPackDeserializer deserializer = this.GetDeserializer(fieldName, type);
if (deserializer != null)
{
value = deserializer.Deserialize(parent, vpack, this.deserializationContext);
}
else
{
var info = type.GetTypeInfo();
if (type.IsGenericParameter)
{
if(!type.IsConstructedGenericType) throw new TypeLoadException(string.Format("Creating open generic types are not supported. ({0})", type));
Type[] gens;
if (typeof(IDictionary<,>).GetTypeInfo().IsAssignableFrom(info))
{
gens = type.GetTargetType(typeof(IDictionary<,>)).GenericTypeArguments;
value = DeserializeMap(parent, vpack, type, gens[0], gens[1]);
}
else if (typeof(IEnumerable<>).GetTypeInfo().IsAssignableFrom(info))
{
gens = type.GetTargetType(typeof(IEnumerable<>)).GenericTypeArguments;
value = DeserializeCollection(parent, vpack, type, gens[0]);
}
else value = DeserializeObject(parent, vpack, type, fieldName);
}
else
{
Type rawType = typeof(object);
if (typeof(IDictionary).GetTypeInfo().IsAssignableFrom(info))
{
value = DeserializeMap(parent, vpack, type, rawType, rawType);
}
else if (typeof(IEnumerable).GetTypeInfo().IsAssignableFrom(info))
{
value = DeserializeCollection(parent, vpack, type, rawType);
}
else if (info.IsArray)
{
value = DeserializeArray(parent, vpack, type);
}
else if (info.IsEnum)
{
value = Enum.Parse(type, vpack.AsString);
}
else
{
value = DeserializeObject(parent, vpack, type, fieldName);
}
}
}
}
return value;
}
/// <exception cref="java.lang.InstantiationException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private Array DeserializeArray(VPackSlice parent, VPackSlice vpack, Type type)
{
int length = vpack.GetLength();
Type subType = type.GetElementType();
Array value = Array.CreateInstance(subType, length);
for (int i = 0; i < length; i++)
{
value.SetValue(GetValue(parent, vpack.Get(i), subType, null), i);
}
return value;
}
/// <exception cref="java.lang.InstantiationException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private IEnumerable DeserializeCollection(VPackSlice parent, VPackSlice vpack, Type type, Type contentType)
{
var info = type.GetTypeInfo();
long length = vpack.GetLength();
IList value;
if (typeof(IList).GetTypeInfo().IsAssignableFrom(info) && info.IsClass) value = (IList)CreateInstance(type);
else value = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(contentType), (int)length);
if (length > 0)
{
for (int i = 0; i < length; i++)
{
value.Add(GetValue(parent, vpack.Get(i), contentType, null));
}
}
return value;
}
/// <exception cref="java.lang.InstantiationException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private IDictionary DeserializeMap(VPackSlice parent, VPackSlice vpack, Type type, Type keyType, Type valueType)
{
var info = type.GetTypeInfo();
int length = vpack.GetLength();
IDictionary value;
if (typeof(IDictionary).GetTypeInfo().IsAssignableFrom(info) && info.IsClass) value = (IDictionary)CreateInstance(type);
else value = new Dictionary<object, object>(length);
if (length > 0)
{
IVPackKeyMapAdapter keyMapAdapter = this.GetKeyMapAdapter(keyType);
if (keyMapAdapter != null)
{
for (IEnumerator<IEntry<string, VPackSlice>> iterator = vpack.ObjectIterator();
iterator.MoveNext();)
{
IEntry<string, VPackSlice> next = iterator.Current;
object name = keyMapAdapter.Deserialize(next.Key);
value[name] = GetValue(vpack, next.Value, valueType, name.ToString());
}
}
else
{
for (int i = 0; i < vpack.GetLength(); i++)
{
VPackSlice entry = vpack.Get(i);
object mapKey = GetValue(parent, entry.Get(ATTR_KEY), keyType, null);
object mapValue = GetValue(parent, entry.Get(ATTR_VALUE), valueType, null);
value[mapKey] = mapValue;
}
}
}
return value;
}
/// <exception cref="VPackParserException"/>
public virtual VPackSlice Serialize(object entity)
{
return this.Serialize(entity, entity.GetType(), new Dictionary<string, object>());
}
/// <exception cref="VPackParserException"/>
public virtual VPackSlice Serialize(object entity, IDictionary<string, object> additionalFields)
{
return this.Serialize(entity, entity.GetType(), additionalFields);
}
/// <exception cref="VPackParserException"/>
public virtual VPackSlice Serialize(object entity, Type type)
{
return this.Serialize(entity, type, new Dictionary<string, object>());
}
/// <exception cref="VPackParserException"/>
public virtual VPackSlice Serialize(object entity, Type type, IDictionary<string, object> additionalFields)
{
if (type == typeof(VPackSlice))
{
return (VPackSlice)entity;
}
VPackBuilder builder = new VPackBuilder(this.builderOptions);
this.Serialize(null, entity, type, builder, new Dictionary<string, object>(additionalFields));
return builder.Slice();
}
/// <exception cref="VPackParserException"/>
private void Serialize(
string name,
object entity,
Type type,
VPackBuilder builder,
IDictionary<string, object> additionalFields)
{
try
{
this.AddValue(name, type, entity, builder, null, additionalFields);
}
catch (Exception e)
{
throw new VPackParserException(e);
}
}
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private void SerializeObject(
string name,
object entity,
VPackBuilder builder,
IDictionary<string, object> additionalFields)
{
IVPackSerializer serializer = this.serializers[entity.GetType()];
if (serializer != null)
{
serializer.Serialize(builder, name, entity, this.serializationContext);
}
else
{
builder.Add(name, ValueType.OBJECT);
this.SerializeFields(entity, builder, additionalFields);
if (additionalFields.Count > 0)
{
additionalFields.Clear();
builder.Close(true);
}
else
{
builder.Close(false);
}
}
}
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private void SerializeFields(object entity, VPackBuilder builder, IDictionary<string, object> additionalFields)
{
IDictionary<string, VPackCache.FieldInfo> fields = this.cache.getFields(entity.GetType());
foreach (VPackCache.FieldInfo fieldInfo in fields.Values)
{
if (fieldInfo.IsSerialize)
{
this.SerializeField(entity, builder, fieldInfo, additionalFields);
}
}
foreach (KeyValuePair<string, object> entry in additionalFields)
{
string key = entry.Key;
if (!fields.ContainsKey(key))
{
object value = entry.Value;
this.AddValue(key, value != null ? value.GetType() : null, value, builder, null, additionalFields);
}
}
}
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private void SerializeField(
object entity,
VPackBuilder builder,
VPackCache.FieldInfo fieldInfo,
IDictionary<string, object> additionalFields)
{
string fieldName = fieldInfo.FieldName;
Type type = fieldInfo.Type;
object value = fieldInfo.get(entity);
this.AddValue(fieldName, type, value, builder, fieldInfo, additionalFields);
}
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private void AddValue(
string name,
Type type,
object value,
VPackBuilder builder,
VPackCache.FieldInfo fieldInfo,
IDictionary<string, object> additionalFields)
{
if (value == null)
{
if (this.serializeNullValues)
{
builder.Add(name, ValueType.NULL);
}
}
else
{
IVPackSerializer serializer = this.serializers[type];
if (serializer != null)
{
serializer.Serialize(builder, name, value, this.serializationContext);
}
else
{
var info = type.GetTypeInfo();
if (type.IsGenericParameter)
{
if(!type.IsConstructedGenericType) throw new TypeLoadException(string.Format("Creating open generic types are not supported. ({0})", type));
Type[] gens;
if (typeof(IDictionary<,>).GetTypeInfo().IsAssignableFrom(info))
{
gens = type.GetTargetType(typeof(IDictionary<,>)).GenericTypeArguments;
this.SerializeMap(name, value, builder, gens[0], additionalFields);
}
else if (typeof(IEnumerable<>).GetTypeInfo().IsAssignableFrom(info))
{
this.SerializeIterable(name, value, builder, additionalFields);
}
else if (type.IsConstructedGenericType)
{
this.SerializeObject(name, value, builder, additionalFields);
}
}
else
{
if (typeof(IDictionary).GetTypeInfo().IsAssignableFrom(info))
{
this.SerializeMap(name, value, builder, typeof(string), additionalFields);
}
else if (typeof(IEnumerable).GetTypeInfo().IsAssignableFrom(info))
{
this.SerializeIterable(name, value, builder, additionalFields);
}
else if (info.IsArray)
{
this.SerializeArray(name, (Array)value, builder, additionalFields);
}
else
{
this.SerializeObject(name, value, builder, additionalFields);
}
}
}
}
}
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private void SerializeArray(
string name,
Array value,
VPackBuilder builder,
IDictionary<string, object> additionalFields)
{
builder.Add(name, ValueType.ARRAY);
for (int i = 0; i < value.GetLength(0); i++)
{
object element = value.GetValue(i);
this.AddValue(null, element.GetType(), element, builder, null, additionalFields);
}
builder.Close();
}
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private void SerializeIterable(
string name,
object value,
VPackBuilder builder,
IDictionary<string, object> additionalFields)
{
builder.Add(name, ValueType.ARRAY);
for (IEnumerator iterator = ((IEnumerable)value).GetEnumerator(); iterator.MoveNext();)
{
object element = iterator.Current;
this.AddValue(null, element.GetType(), element, builder, null, additionalFields);
}
builder.Close();
}
/// <exception cref="System.MissingMethodException"/>
/// <exception cref="java.lang.IllegalAccessException"/>
/// <exception cref="java.lang.reflect.InvocationTargetException"/>
/// <exception cref="VPackException"/>
private void SerializeMap(
string name,
object value,
VPackBuilder builder,
Type keyType,
IDictionary<string, object> additionalFields)
{
IDictionary map = (IDictionary)value;
if (map.Count > 0)
{
IVPackKeyMapAdapter keyMapAdapter = this.GetKeyMapAdapter(keyType);
if (keyMapAdapter != null)
{
builder.Add(name, ValueType.OBJECT);
foreach (KeyValuePair<object, object> entry in map)
{
object entryValue = entry.Value;
this.AddValue(
keyMapAdapter.Serialize(entry.Key),
entryValue != null ? entryValue.GetType() : typeof(object),
entry.Value,
builder,
null,
additionalFields);
}
builder.Close();
}
else
{
builder.Add(name, ValueType.ARRAY);
foreach (KeyValuePair<object, object> entry in map)
{
string s = null;
builder.Add(s, ValueType.OBJECT);
this.AddValue(ATTR_KEY, entry.Key.GetType(), entry.Key, builder, null, additionalFields);
this.AddValue(ATTR_VALUE, entry.Value.GetType(), entry.Value, builder, null, additionalFields);
builder.Close();
}
builder.Close();
}
}
else
{
builder.Add(name, ValueType.OBJECT);
builder.Close();
}
}
private IVPackKeyMapAdapter GetKeyMapAdapter(Type type)
{
IVPackKeyMapAdapter adapter = this.keyMapAdapters[type];
if (adapter == null && type.GetTypeInfo().IsEnum)
{
adapter = VPackKeyMapAdapters.CreateEnumAdapter(type);
}
return adapter;
}
}
} | 40.637061 | 164 | 0.52392 | [
"Apache-2.0"
] | composite/ArangoDB.Net | VelocyPack/VPack.cs | 37,061 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using BeamLab.Buggy.Data;
namespace BeamLab.Buggy.Pages.Account
{
public class LoginModel : PageModel
{
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly ILogger<LoginModel> _logger;
public LoginModel(SignInManager<ApplicationUser> signInManager, ILogger<LoginModel> logger)
{
_signInManager = signInManager;
_logger = logger;
}
[BindProperty]
public InputModel Input { get; set; }
public IList<AuthenticationScheme> ExternalLogins { get; set; }
public string ReturnUrl { get; set; }
[TempData]
public string ErrorMessage { get; set; }
public class InputModel
{
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
}
public async Task OnGetAsync(string returnUrl = null)
{
if (!string.IsNullOrEmpty(ErrorMessage))
{
ModelState.AddModelError(string.Empty, ErrorMessage);
}
// Clear the existing external cookie to ensure a clean login process
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
ReturnUrl = returnUrl;
}
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
ReturnUrl = returnUrl;
if (ModelState.IsValid)
{
// This doesn't count login failures towards account lockout
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: true);
if (result.Succeeded)
{
_logger.LogInformation("User logged in.");
return LocalRedirect(Url.GetLocalUrl(returnUrl));
}
if (result.RequiresTwoFactor)
{
return RedirectToPage("./LoginWith2fa", new { ReturnUrl = returnUrl, RememberMe = Input.RememberMe });
}
if (result.IsLockedOut)
{
_logger.LogWarning("User account locked out.");
return RedirectToPage("./Lockout");
}
else
{
ModelState.AddModelError(string.Empty, "Invalid login attempt.");
return Page();
}
}
// If we got this far, something failed, redisplay form
return Page();
}
}
}
| 33.33 | 141 | 0.587159 | [
"Apache-2.0"
] | Beam-Lab/Buggy | BeamLab.Buggy/Pages/Account/Login.cshtml.cs | 3,333 | C# |
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
namespace Microsoft.Xna.Framework.Graphics
{
/// <summary>
/// Defines how vertex data is ordered.
/// </summary>
public enum PrimitiveType
{
/// <summary>
/// Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle. Back-face culling is affected by the current winding-order render state.
/// </summary>
TriangleList,
/// <summary>
/// Renders the vertices as a triangle strip. The back-face culling flag is flipped automatically on even-numbered triangles.
/// </summary>
TriangleStrip,
/// <summary>
/// Renders the vertices as a list of isolated straight line segments; the count may be any positive integer.
/// </summary>
LineList,
/// <summary>
/// Renders the vertices as a single polyline; the count may be any positive integer.
/// </summary>
LineStrip,
}
}
| 33.588235 | 210 | 0.656743 | [
"MIT"
] | NebulaSleuth/MonoGame.XamarinForms | MonoGame.Framework/MonoGame.Framework.AndroidForms/Graphics/Vertices/PrimitiveType.cs | 1,142 | C# |
using System;
using Newtonsoft.Json;
namespace Alexa.NET.ProactiveEvents.TrashCollectionReminders
{
public class TrashCollectionReminderPayload
{
public TrashCollectionReminderPayload() { }
public TrashCollectionReminderPayload(DayOfWeek collectionDay, GarbageType[] garbageTypes)
{
Alert = new TrashCollectionReminderAlert(collectionDay, garbageTypes);
}
[JsonProperty("alert")]
public TrashCollectionReminderAlert Alert { get; set; }
}
} | 28.611111 | 98 | 0.712621 | [
"MIT"
] | JasonSowers/twitch-alexa-skill | Alexa.NET.ProactiveEvents/TrashCollectionReminders/TrashCollectionReminderPayload.cs | 517 | C# |
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Binance.Net.Objects
{
/// <summary>
/// Information about an account
/// </summary>
public class BinanceStreamAccountInfo: BinanceStreamEvent
{
/// <summary>
/// Commission percentage to pay when making trades
/// </summary>
[JsonProperty("m")]
public decimal MakerCommission { get; set; }
/// <summary>
/// Commission percentage to pay when taking trades
/// </summary>
[JsonProperty("t")]
public decimal TakerCommission { get; set; }
/// <summary>
/// Commission percentage to buy when buying
/// </summary>
[JsonProperty("b")]
public decimal BuyerCommission { get; set; }
/// <summary>
/// Commission percentage to buy when selling
/// </summary>
[JsonProperty("s")]
public decimal SellerCommission { get; set; }
/// <summary>
/// Boolean indicating if this account can trade
/// </summary>
[JsonProperty("T")]
public bool CanTrade { get; set; }
/// <summary>
/// Boolean indicating if this account can withdraw
/// </summary>
[JsonProperty("W")]
public bool CanWithdraw { get; set; }
/// <summary>
/// Boolean indicating if this account can deposit
/// </summary>
[JsonProperty("D")]
public bool CanDeposit { get; set; }
/// <summary>
/// List of assets with their current balances
/// </summary>
[JsonProperty("B")]
public List<BinanceStreamBalance> Balances { get; set; }
}
/// <summary>
/// Information about an asset balance
/// </summary>
public class BinanceStreamBalance
{
/// <summary>
/// The asset this balance is for
/// </summary>
[JsonProperty("a")]
public string Asset { get; set; }
/// <summary>
/// The amount that isn't locked in a trade
/// </summary>
[JsonProperty("f")]
public decimal Free { get; set; }
/// <summary>
/// The amount that is currently locked in a trade
/// </summary>
[JsonProperty("l")]
public decimal Locked { get; set; }
/// <summary>
/// The total balance of this asset (Free + Locked)
/// </summary>
public decimal Total => Free + Locked;
}
}
| 31.367089 | 64 | 0.54318 | [
"MIT"
] | Peixer/Binance.Net | Binance.Net/Objects/BinanceStreamAccountInfo.cs | 2,480 | C# |
using System.Reflection;
[assembly: AssemblyMetadata("ImplicitNullability.AppliesTo", "InputPaRaMeters")] // wrong casing => invalid
| 33.75 | 107 | 0.785185 | [
"MIT"
] | sheitmann/ImplicitNullability | Src/ImplicitNullability.Plugin.Tests/test/data/UnitTests/Configuration/ImplicitNullabilityConfigurationEvaluatorTest/AttributeWithInvalidValue.cs | 137 | C# |
// Copyright 2014 Pēteris Ņikiforovs
//
// 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.Collections.Generic;
using Latvian.Tokenization;
using Latvian.Tokenization.Readers;
using NUnit.Framework;
namespace Latvian.Tests.Tokenization
{
[TestFixture]
public class PositionCounterTests
{
[Test]
public void Test()
{
string[] strings = new[] { "es", " ", "\n", "eju" };
List<Token> tokens = new List<Token>();
PositionCounter feeder = new PositionCounter();
foreach (string s in strings)
{
Token token = new Token();
token.Text = s;
token.Position = feeder.Position;
token.Line = feeder.Line;
token.LinePosition = feeder.LinePosition;
feeder.Add(s);
token.PositionEnd = feeder.Position;
token.LineEnd = feeder.Line;
token.LinePositionEnd = feeder.LinePosition;
tokens.Add(token);
}
Assert.AreEqual(4, tokens.Count);
Assert.AreEqual(0, tokens[0].Position);
Assert.AreEqual(2, tokens[0].PositionEnd);
Assert.AreEqual(0, tokens[0].Line);
Assert.AreEqual(0, tokens[0].LineEnd);
Assert.AreEqual(0, tokens[0].LinePosition);
Assert.AreEqual(2, tokens[0].LinePositionEnd);
Assert.AreEqual(2, tokens[1].Position);
Assert.AreEqual(3, tokens[1].PositionEnd);
Assert.AreEqual(0, tokens[1].Line);
Assert.AreEqual(0, tokens[1].LineEnd);
Assert.AreEqual(2, tokens[1].LinePosition);
Assert.AreEqual(3, tokens[1].LinePositionEnd);
Assert.AreEqual(3, tokens[2].Position);
Assert.AreEqual(4, tokens[2].PositionEnd);
Assert.AreEqual(0, tokens[2].Line);
Assert.AreEqual(1, tokens[2].LineEnd);
Assert.AreEqual(3, tokens[2].LinePosition);
Assert.AreEqual(0, tokens[2].LinePositionEnd);
Assert.AreEqual(4, tokens[3].Position);
Assert.AreEqual(7, tokens[3].PositionEnd);
Assert.AreEqual(1, tokens[3].Line);
Assert.AreEqual(1, tokens[3].LineEnd);
Assert.AreEqual(0, tokens[3].LinePosition);
Assert.AreEqual(3, tokens[3].LinePositionEnd);
}
}
}
| 35.890244 | 75 | 0.59735 | [
"Apache-2.0"
] | pdonald/latvian | Latvian.Tests/Tokenization/PositionCounterTests.cs | 2,947 | C# |
/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud.Vod.V20180717.Models
{
using Newtonsoft.Json;
using System.Collections.Generic;
using TencentCloud.Common;
public class PoliticalImgReviewTemplateInfo : AbstractModel
{
/// <summary>
/// 画面鉴政任务开关,可选值:
/// <li>ON:开启画面鉴政任务;</li>
/// <li>OFF:关闭画面鉴政任务。</li>
/// </summary>
[JsonProperty("Switch")]
public string Switch{ get; set; }
/// <summary>
/// 画面鉴政过滤标签,审核结果包含选择的标签则返回结果,如果过滤标签为空,则审核结果全部返回,可选值为:
/// <li>violation_photo:违规图标;</li>
/// <li>politician:政治人物;</li>
/// <li>entertainment:娱乐明星;</li>
/// <li>sport:体育明星。</li>
/// </summary>
[JsonProperty("LabelSet")]
public string[] LabelSet{ get; set; }
/// <summary>
/// 判定涉嫌违规的分数阈值,当智能审核达到该分数以上,认为涉嫌违规,不填默认为 97 分。取值范围:0~100。
/// </summary>
[JsonProperty("BlockConfidence")]
public long? BlockConfidence{ get; set; }
/// <summary>
/// 判定需人工复核是否违规的分数阈值,当智能审核达到该分数以上,认为需人工复核,不填默认为 95 分。取值范围:0~100。
/// </summary>
[JsonProperty("ReviewConfidence")]
public long? ReviewConfidence{ get; set; }
/// <summary>
/// 内部实现,用户禁止调用
/// </summary>
internal override void ToMap(Dictionary<string, string> map, string prefix)
{
this.SetParamSimple(map, prefix + "Switch", this.Switch);
this.SetParamArraySimple(map, prefix + "LabelSet.", this.LabelSet);
this.SetParamSimple(map, prefix + "BlockConfidence", this.BlockConfidence);
this.SetParamSimple(map, prefix + "ReviewConfidence", this.ReviewConfidence);
}
}
}
| 33.253521 | 89 | 0.619229 | [
"Apache-2.0"
] | Darkfaker/tencentcloud-sdk-dotnet | TencentCloud/Vod/V20180717/Models/PoliticalImgReviewTemplateInfo.cs | 2,789 | C# |
namespace ConsoleTemplate.Generic;
public static class HelpersStatic
{
public static string FixedWidth(string s, int width)
{
return new string(s.Take(width).ToArray()).PadRight(width);
}
public static void DisplayException(Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"Error :: Outer Type :: {ex.GetType()}");
Console.WriteLine($" :: {ex.Message}");
ex.StackTrace?.Split(Environment.NewLine).ToList<string>().ForEach((line) => { Console.WriteLine($" :: {line}"); });
Console.WriteLine($" :: Inner Type :: {(ex.InnerException is null ? "-" : ex.InnerException?.GetType())}");
Console.WriteLine($" :: {(ex.InnerException is null ? "-" : ex.InnerException?.Message)}");
ex.InnerException?.StackTrace?.Split(Environment.NewLine).ToList<string>().ForEach((line) => { Console.WriteLine($" :: {line}"); });
Console.ResetColor();
}
public static string ValueOrDash(int? valueIn)
{
if (!valueIn.HasValue || valueIn.Value == 0)
{
return "-";
}
else
{
return valueIn?.ToString() ?? "";
}
}
}
| 36.628571 | 159 | 0.554602 | [
"MIT"
] | Hyper-Dragon/TemplatesHD | Src-DotNet-ConsoleDiCmdLine/Generic/HelpersStatic.cs | 1,284 | C# |
namespace AssetStudioGUI
{
partial class AssetStudioGUIForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AssetStudioGUIForm));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.extractFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.extractFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.displayAll = new System.Windows.Forms.ToolStripMenuItem();
this.enablePreview = new System.Windows.Forms.ToolStripMenuItem();
this.displayInfo = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripMenuItem();
this.specifyUnityVersion = new System.Windows.Forms.ToolStripTextBox();
this.showExpOpt = new System.Windows.Forms.ToolStripMenuItem();
this.modelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportAllObjectssplitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.exportSelectedObjectsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exportSelectedObjectsmergeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportAllAssetsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportSelectedAssetsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportFilteredAssetsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem12 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem13 = new System.Windows.Forms.ToolStripMenuItem();
this.filterTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.debugMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripMenuItem();
this.exportClassStructuresMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.sceneTreeView = new AssetStudioGUI.GOHierarchy();
this.treeSearch = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.assetListView = new System.Windows.Forms.ListView();
this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderContainer = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderPathID = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.listSearch = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.classesListView = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.progressbarPanel = new System.Windows.Forms.Panel();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.tabControl2 = new System.Windows.Forms.TabControl();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.previewPanel = new System.Windows.Forms.Panel();
this.assetInfoLabel = new System.Windows.Forms.Label();
this.FMODpanel = new System.Windows.Forms.Panel();
this.FMODcopyright = new System.Windows.Forms.Label();
this.FMODinfoLabel = new System.Windows.Forms.Label();
this.FMODtimerLabel = new System.Windows.Forms.Label();
this.FMODstatusLabel = new System.Windows.Forms.Label();
this.FMODprogressBar = new System.Windows.Forms.TrackBar();
this.FMODvolumeBar = new System.Windows.Forms.TrackBar();
this.FMODloopButton = new System.Windows.Forms.CheckBox();
this.FMODstopButton = new System.Windows.Forms.Button();
this.FMODpauseButton = new System.Windows.Forms.Button();
this.FMODplayButton = new System.Windows.Forms.Button();
this.fontPreviewBox = new System.Windows.Forms.RichTextBox();
this.glControl1 = new OpenTK.GLControl();
this.textPreviewBox = new System.Windows.Forms.TextBox();
this.classTextBox = new System.Windows.Forms.TextBox();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.dumpTextBox = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.timer = new System.Windows.Forms.Timer(this.components);
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportAnimatorwithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.goToSceneHierarchyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.progressbarPanel.SuspendLayout();
this.tabControl2.SuspendLayout();
this.tabPage4.SuspendLayout();
this.previewPanel.SuspendLayout();
this.FMODpanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.FMODprogressBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.FMODvolumeBar)).BeginInit();
this.tabPage5.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.optionsToolStripMenuItem,
this.modelToolStripMenuItem,
this.exportToolStripMenuItem,
this.filterTypeToolStripMenuItem,
this.debugMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1264, 25);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.loadFileToolStripMenuItem,
this.loadFolderToolStripMenuItem,
this.toolStripMenuItem1,
this.extractFileToolStripMenuItem,
this.extractFolderToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(39, 21);
this.fileToolStripMenuItem.Text = "File";
//
// loadFileToolStripMenuItem
//
this.loadFileToolStripMenuItem.Name = "loadFileToolStripMenuItem";
this.loadFileToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.loadFileToolStripMenuItem.Text = "Load file";
this.loadFileToolStripMenuItem.Click += new System.EventHandler(this.loadFile_Click);
//
// loadFolderToolStripMenuItem
//
this.loadFolderToolStripMenuItem.Name = "loadFolderToolStripMenuItem";
this.loadFolderToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.loadFolderToolStripMenuItem.Text = "Load folder";
this.loadFolderToolStripMenuItem.Click += new System.EventHandler(this.loadFolder_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(151, 6);
//
// extractFileToolStripMenuItem
//
this.extractFileToolStripMenuItem.Name = "extractFileToolStripMenuItem";
this.extractFileToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.extractFileToolStripMenuItem.Text = "Extract file";
this.extractFileToolStripMenuItem.Click += new System.EventHandler(this.extractFileToolStripMenuItem_Click);
//
// extractFolderToolStripMenuItem
//
this.extractFolderToolStripMenuItem.Name = "extractFolderToolStripMenuItem";
this.extractFolderToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.extractFolderToolStripMenuItem.Text = "Extract folder";
this.extractFolderToolStripMenuItem.Click += new System.EventHandler(this.extractFolderToolStripMenuItem_Click);
//
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.displayAll,
this.enablePreview,
this.displayInfo,
this.toolStripMenuItem14,
this.showExpOpt});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21);
this.optionsToolStripMenuItem.Text = "Options";
//
// displayAll
//
this.displayAll.CheckOnClick = true;
this.displayAll.Name = "displayAll";
this.displayAll.Size = new System.Drawing.Size(223, 22);
this.displayAll.Text = "Display all assets";
this.displayAll.ToolTipText = "Check this option will display all types assets. Not extractable assets can expor" +
"t the RAW file.";
this.displayAll.CheckedChanged += new System.EventHandler(this.displayAll_CheckedChanged);
//
// enablePreview
//
this.enablePreview.Checked = true;
this.enablePreview.CheckOnClick = true;
this.enablePreview.CheckState = System.Windows.Forms.CheckState.Checked;
this.enablePreview.Name = "enablePreview";
this.enablePreview.Size = new System.Drawing.Size(223, 22);
this.enablePreview.Text = "Enable preview";
this.enablePreview.ToolTipText = "Toggle the loading and preview of readable assets, such as images, sounds, text, " +
"etc.\r\nDisable preview if you have performance or compatibility issues.";
this.enablePreview.CheckedChanged += new System.EventHandler(this.enablePreview_Check);
//
// displayInfo
//
this.displayInfo.Checked = true;
this.displayInfo.CheckOnClick = true;
this.displayInfo.CheckState = System.Windows.Forms.CheckState.Checked;
this.displayInfo.Name = "displayInfo";
this.displayInfo.Size = new System.Drawing.Size(223, 22);
this.displayInfo.Text = "Display asset infromation";
this.displayInfo.ToolTipText = "Toggle the overlay that shows information about each asset, eg. image size, forma" +
"t, audio bitrate, etc.";
this.displayInfo.CheckedChanged += new System.EventHandler(this.displayAssetInfo_Check);
//
// toolStripMenuItem14
//
this.toolStripMenuItem14.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.specifyUnityVersion});
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
this.toolStripMenuItem14.Size = new System.Drawing.Size(223, 22);
this.toolStripMenuItem14.Text = "Specify Unity version";
//
// specifyUnityVersion
//
this.specifyUnityVersion.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F);
this.specifyUnityVersion.Name = "specifyUnityVersion";
this.specifyUnityVersion.Size = new System.Drawing.Size(100, 23);
//
// showExpOpt
//
this.showExpOpt.Name = "showExpOpt";
this.showExpOpt.Size = new System.Drawing.Size(223, 22);
this.showExpOpt.Text = "Export options";
this.showExpOpt.Click += new System.EventHandler(this.showExpOpt_Click);
//
// modelToolStripMenuItem
//
this.modelToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exportAllObjectssplitToolStripMenuItem1,
this.exportSelectedObjectsToolStripMenuItem,
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem,
this.toolStripSeparator1,
this.exportSelectedObjectsmergeToolStripMenuItem,
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem});
this.modelToolStripMenuItem.Name = "modelToolStripMenuItem";
this.modelToolStripMenuItem.Size = new System.Drawing.Size(58, 21);
this.modelToolStripMenuItem.Text = "Model";
//
// exportAllObjectssplitToolStripMenuItem1
//
this.exportAllObjectssplitToolStripMenuItem1.Name = "exportAllObjectssplitToolStripMenuItem1";
this.exportAllObjectssplitToolStripMenuItem1.Size = new System.Drawing.Size(417, 22);
this.exportAllObjectssplitToolStripMenuItem1.Text = "Export all objects (split)";
this.exportAllObjectssplitToolStripMenuItem1.Click += new System.EventHandler(this.exportAllObjectssplitToolStripMenuItem1_Click);
//
// exportSelectedObjectsToolStripMenuItem
//
this.exportSelectedObjectsToolStripMenuItem.Name = "exportSelectedObjectsToolStripMenuItem";
this.exportSelectedObjectsToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
this.exportSelectedObjectsToolStripMenuItem.Text = "Export selected objects (split)";
this.exportSelectedObjectsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsToolStripMenuItem_Click);
//
// exportSelectedObjectsWithAnimationClipToolStripMenuItem
//
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Name = "exportSelectedObjectsWithAnimationClipToolStripMenuItem";
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Text = "Export selected objects (split) + selected AnimationClips";
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportObjectswithAnimationClipMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(414, 6);
//
// exportSelectedObjectsmergeToolStripMenuItem
//
this.exportSelectedObjectsmergeToolStripMenuItem.Name = "exportSelectedObjectsmergeToolStripMenuItem";
this.exportSelectedObjectsmergeToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
this.exportSelectedObjectsmergeToolStripMenuItem.Text = "Export selected objects (merge)";
this.exportSelectedObjectsmergeToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsmergeToolStripMenuItem_Click);
//
// exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem
//
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Name = "exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem";
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Text = "Export selected objects (merge) + selected AnimationClips";
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem_Click);
//
// exportToolStripMenuItem
//
this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exportAllAssetsMenuItem,
this.exportSelectedAssetsMenuItem,
this.exportFilteredAssetsMenuItem,
this.toolStripSeparator3,
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem,
this.toolStripSeparator4,
this.toolStripMenuItem2,
this.toolStripMenuItem3,
this.toolStripSeparator2,
this.toolStripMenuItem10});
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(58, 21);
this.exportToolStripMenuItem.Text = "Export";
//
// exportAllAssetsMenuItem
//
this.exportAllAssetsMenuItem.Name = "exportAllAssetsMenuItem";
this.exportAllAssetsMenuItem.Size = new System.Drawing.Size(284, 22);
this.exportAllAssetsMenuItem.Text = "All assets";
this.exportAllAssetsMenuItem.Click += new System.EventHandler(this.exportAllAssetsMenuItem_Click);
//
// exportSelectedAssetsMenuItem
//
this.exportSelectedAssetsMenuItem.Name = "exportSelectedAssetsMenuItem";
this.exportSelectedAssetsMenuItem.Size = new System.Drawing.Size(284, 22);
this.exportSelectedAssetsMenuItem.Text = "Selected assets";
this.exportSelectedAssetsMenuItem.Click += new System.EventHandler(this.exportSelectedAssetsMenuItem_Click);
//
// exportFilteredAssetsMenuItem
//
this.exportFilteredAssetsMenuItem.Name = "exportFilteredAssetsMenuItem";
this.exportFilteredAssetsMenuItem.Size = new System.Drawing.Size(284, 22);
this.exportFilteredAssetsMenuItem.Text = "Filtered assets";
this.exportFilteredAssetsMenuItem.Click += new System.EventHandler(this.exportFilteredAssetsMenuItem_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(281, 6);
//
// exportAnimatorWithSelectedAnimationClipToolStripMenuItem
//
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Name = "exportAnimatorWithSelectedAnimationClipToolStripMenuItem";
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(284, 22);
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Text = "Animator + selected AnimationClips";
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportAnimatorwithAnimationClipMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(281, 6);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem4,
this.toolStripMenuItem5,
this.toolStripMenuItem6});
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(284, 22);
this.toolStripMenuItem2.Text = "Raw";
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem4.Text = "All assets";
this.toolStripMenuItem4.Click += new System.EventHandler(this.toolStripMenuItem4_Click);
//
// toolStripMenuItem5
//
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
this.toolStripMenuItem5.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem5.Text = "Selected assets";
this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click);
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem6.Text = "Filtered assets";
this.toolStripMenuItem6.Click += new System.EventHandler(this.toolStripMenuItem6_Click);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem7,
this.toolStripMenuItem8,
this.toolStripMenuItem9});
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(284, 22);
this.toolStripMenuItem3.Text = "Dump";
//
// toolStripMenuItem7
//
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem7.Text = "All assets";
this.toolStripMenuItem7.Click += new System.EventHandler(this.toolStripMenuItem7_Click);
//
// toolStripMenuItem8
//
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
this.toolStripMenuItem8.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem8.Text = "Selected assets";
this.toolStripMenuItem8.Click += new System.EventHandler(this.toolStripMenuItem8_Click);
//
// toolStripMenuItem9
//
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
this.toolStripMenuItem9.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem9.Text = "Filtered assets";
this.toolStripMenuItem9.Click += new System.EventHandler(this.toolStripMenuItem9_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(281, 6);
//
// toolStripMenuItem10
//
this.toolStripMenuItem10.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem11,
this.toolStripMenuItem12,
this.toolStripMenuItem13});
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
this.toolStripMenuItem10.Size = new System.Drawing.Size(284, 22);
this.toolStripMenuItem10.Text = "Asset list to XML";
//
// toolStripMenuItem11
//
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
this.toolStripMenuItem11.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem11.Text = "All assets";
this.toolStripMenuItem11.Click += new System.EventHandler(this.toolStripMenuItem11_Click);
//
// toolStripMenuItem12
//
this.toolStripMenuItem12.Name = "toolStripMenuItem12";
this.toolStripMenuItem12.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem12.Text = "Selected assets";
this.toolStripMenuItem12.Click += new System.EventHandler(this.toolStripMenuItem12_Click);
//
// toolStripMenuItem13
//
this.toolStripMenuItem13.Name = "toolStripMenuItem13";
this.toolStripMenuItem13.Size = new System.Drawing.Size(165, 22);
this.toolStripMenuItem13.Text = "Filtered assets";
this.toolStripMenuItem13.Click += new System.EventHandler(this.toolStripMenuItem13_Click);
//
// filterTypeToolStripMenuItem
//
this.filterTypeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.allToolStripMenuItem});
this.filterTypeToolStripMenuItem.Name = "filterTypeToolStripMenuItem";
this.filterTypeToolStripMenuItem.Size = new System.Drawing.Size(80, 21);
this.filterTypeToolStripMenuItem.Text = "Filter Type";
//
// allToolStripMenuItem
//
this.allToolStripMenuItem.Checked = true;
this.allToolStripMenuItem.CheckOnClick = true;
this.allToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.allToolStripMenuItem.Name = "allToolStripMenuItem";
this.allToolStripMenuItem.Size = new System.Drawing.Size(90, 22);
this.allToolStripMenuItem.Text = "All";
this.allToolStripMenuItem.Click += new System.EventHandler(this.typeToolStripMenuItem_Click);
//
// debugMenuItem
//
this.debugMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem15,
this.exportClassStructuresMenuItem});
this.debugMenuItem.Name = "debugMenuItem";
this.debugMenuItem.Size = new System.Drawing.Size(59, 21);
this.debugMenuItem.Text = "Debug";
//
// toolStripMenuItem15
//
this.toolStripMenuItem15.Checked = true;
this.toolStripMenuItem15.CheckOnClick = true;
this.toolStripMenuItem15.CheckState = System.Windows.Forms.CheckState.Checked;
this.toolStripMenuItem15.Name = "toolStripMenuItem15";
this.toolStripMenuItem15.Size = new System.Drawing.Size(207, 22);
this.toolStripMenuItem15.Text = "Show error message";
this.toolStripMenuItem15.Click += new System.EventHandler(this.toolStripMenuItem15_Click);
//
// exportClassStructuresMenuItem
//
this.exportClassStructuresMenuItem.Name = "exportClassStructuresMenuItem";
this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(207, 22);
this.exportClassStructuresMenuItem.Text = "Export class structures";
this.exportClassStructuresMenuItem.Click += new System.EventHandler(this.exportClassStructuresMenuItem_Click);
//
// splitContainer1
//
this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 25);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tabControl1);
this.splitContainer1.Panel1.Controls.Add(this.progressbarPanel);
this.splitContainer1.Panel1MinSize = 200;
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.tabControl2);
this.splitContainer1.Panel2.Controls.Add(this.statusStrip1);
this.splitContainer1.Panel2MinSize = 400;
this.splitContainer1.Size = new System.Drawing.Size(1264, 656);
this.splitContainer1.SplitterDistance = 482;
this.splitContainer1.TabIndex = 2;
this.splitContainer1.TabStop = false;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.Padding = new System.Drawing.Point(17, 3);
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(480, 634);
this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.tabControl1.TabIndex = 0;
this.tabControl1.Selected += new System.Windows.Forms.TabControlEventHandler(this.tabPageSelected);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.sceneTreeView);
this.tabPage1.Controls.Add(this.treeSearch);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(472, 608);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Scene Hierarchy";
this.tabPage1.UseVisualStyleBackColor = true;
//
// sceneTreeView
//
this.sceneTreeView.CheckBoxes = true;
this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.sceneTreeView.HideSelection = false;
this.sceneTreeView.Location = new System.Drawing.Point(0, 21);
this.sceneTreeView.Name = "sceneTreeView";
this.sceneTreeView.Size = new System.Drawing.Size(472, 587);
this.sceneTreeView.TabIndex = 1;
this.sceneTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.sceneTreeView_AfterCheck);
//
// treeSearch
//
this.treeSearch.Dock = System.Windows.Forms.DockStyle.Top;
this.treeSearch.ForeColor = System.Drawing.SystemColors.GrayText;
this.treeSearch.Location = new System.Drawing.Point(0, 0);
this.treeSearch.Name = "treeSearch";
this.treeSearch.Size = new System.Drawing.Size(472, 21);
this.treeSearch.TabIndex = 0;
this.treeSearch.Text = " Search ";
this.treeSearch.TextChanged += new System.EventHandler(this.treeSearch_TextChanged);
this.treeSearch.Enter += new System.EventHandler(this.treeSearch_Enter);
this.treeSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeSearch_KeyDown);
this.treeSearch.Leave += new System.EventHandler(this.treeSearch_Leave);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.assetListView);
this.tabPage2.Controls.Add(this.listSearch);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(472, 608);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Asset List";
this.tabPage2.UseVisualStyleBackColor = true;
//
// assetListView
//
this.assetListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeaderName,
this.columnHeaderContainer,
this.columnHeaderType,
this.columnHeaderPathID,
this.columnHeaderSize});
this.assetListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.assetListView.FullRowSelect = true;
this.assetListView.GridLines = true;
this.assetListView.HideSelection = false;
this.assetListView.Location = new System.Drawing.Point(0, 21);
this.assetListView.Name = "assetListView";
this.assetListView.Size = new System.Drawing.Size(472, 587);
this.assetListView.TabIndex = 1;
this.assetListView.UseCompatibleStateImageBehavior = false;
this.assetListView.View = System.Windows.Forms.View.Details;
this.assetListView.VirtualMode = true;
this.assetListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.assetListView_ColumnClick);
this.assetListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.selectAsset);
this.assetListView.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.assetListView_RetrieveVirtualItem);
this.assetListView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.assetListView_MouseClick);
//
// columnHeaderName
//
this.columnHeaderName.Text = "Name";
this.columnHeaderName.Width = 170;
//
// columnHeaderContainer
//
this.columnHeaderContainer.Text = "Container";
this.columnHeaderContainer.Width = 80;
//
// columnHeaderType
//
this.columnHeaderType.Text = "Type";
this.columnHeaderType.Width = 90;
//
// columnHeaderPathID
//
this.columnHeaderPathID.Text = "PathID";
//
// columnHeaderSize
//
this.columnHeaderSize.Text = "Size";
this.columnHeaderSize.Width = 50;
//
// listSearch
//
this.listSearch.Dock = System.Windows.Forms.DockStyle.Top;
this.listSearch.ForeColor = System.Drawing.SystemColors.GrayText;
this.listSearch.Location = new System.Drawing.Point(0, 0);
this.listSearch.Name = "listSearch";
this.listSearch.Size = new System.Drawing.Size(472, 21);
this.listSearch.TabIndex = 0;
this.listSearch.Text = " Filter ";
this.listSearch.TextChanged += new System.EventHandler(this.ListSearchTextChanged);
this.listSearch.Enter += new System.EventHandler(this.listSearch_Enter);
this.listSearch.Leave += new System.EventHandler(this.listSearch_Leave);
//
// tabPage3
//
this.tabPage3.Controls.Add(this.classesListView);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(472, 608);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Asset Classes";
this.tabPage3.UseVisualStyleBackColor = true;
//
// classesListView
//
this.classesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2});
this.classesListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.classesListView.FullRowSelect = true;
this.classesListView.HideSelection = false;
this.classesListView.Location = new System.Drawing.Point(0, 0);
this.classesListView.MultiSelect = false;
this.classesListView.Name = "classesListView";
this.classesListView.Size = new System.Drawing.Size(472, 608);
this.classesListView.TabIndex = 0;
this.classesListView.UseCompatibleStateImageBehavior = false;
this.classesListView.View = System.Windows.Forms.View.Details;
this.classesListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.classesListView_ItemSelectionChanged);
//
// columnHeader1
//
this.columnHeader1.DisplayIndex = 1;
this.columnHeader1.Text = "Name";
this.columnHeader1.Width = 300;
//
// columnHeader2
//
this.columnHeader2.DisplayIndex = 0;
this.columnHeader2.Text = "ID";
this.columnHeader2.Width = 70;
//
// progressbarPanel
//
this.progressbarPanel.Controls.Add(this.progressBar1);
this.progressbarPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.progressbarPanel.Location = new System.Drawing.Point(0, 634);
this.progressbarPanel.Name = "progressbarPanel";
this.progressbarPanel.Padding = new System.Windows.Forms.Padding(1, 3, 1, 1);
this.progressbarPanel.Size = new System.Drawing.Size(480, 20);
this.progressbarPanel.TabIndex = 2;
//
// progressBar1
//
this.progressBar1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.progressBar1.Location = new System.Drawing.Point(1, 2);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(478, 17);
this.progressBar1.Step = 1;
this.progressBar1.TabIndex = 1;
//
// tabControl2
//
this.tabControl2.Controls.Add(this.tabPage4);
this.tabControl2.Controls.Add(this.tabPage5);
this.tabControl2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl2.Location = new System.Drawing.Point(0, 0);
this.tabControl2.Name = "tabControl2";
this.tabControl2.SelectedIndex = 0;
this.tabControl2.Size = new System.Drawing.Size(776, 632);
this.tabControl2.TabIndex = 4;
this.tabControl2.SelectedIndexChanged += new System.EventHandler(this.tabControl2_SelectedIndexChanged);
//
// tabPage4
//
this.tabPage4.Controls.Add(this.previewPanel);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(768, 606);
this.tabPage4.TabIndex = 0;
this.tabPage4.Text = "Preview";
this.tabPage4.UseVisualStyleBackColor = true;
//
// previewPanel
//
this.previewPanel.BackColor = System.Drawing.SystemColors.ControlDark;
this.previewPanel.BackgroundImage = global::AssetStudioGUI.Properties.Resources.preview;
this.previewPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.previewPanel.Controls.Add(this.assetInfoLabel);
this.previewPanel.Controls.Add(this.FMODpanel);
this.previewPanel.Controls.Add(this.fontPreviewBox);
this.previewPanel.Controls.Add(this.glControl1);
this.previewPanel.Controls.Add(this.textPreviewBox);
this.previewPanel.Controls.Add(this.classTextBox);
this.previewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.previewPanel.Location = new System.Drawing.Point(0, 0);
this.previewPanel.Name = "previewPanel";
this.previewPanel.Size = new System.Drawing.Size(768, 606);
this.previewPanel.TabIndex = 1;
this.previewPanel.Resize += new System.EventHandler(this.preview_Resize);
//
// assetInfoLabel
//
this.assetInfoLabel.AutoSize = true;
this.assetInfoLabel.BackColor = System.Drawing.Color.Transparent;
this.assetInfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.assetInfoLabel.Location = new System.Drawing.Point(4, 7);
this.assetInfoLabel.Name = "assetInfoLabel";
this.assetInfoLabel.Size = new System.Drawing.Size(0, 12);
this.assetInfoLabel.TabIndex = 0;
//
// FMODpanel
//
this.FMODpanel.BackColor = System.Drawing.SystemColors.ControlDark;
this.FMODpanel.Controls.Add(this.FMODcopyright);
this.FMODpanel.Controls.Add(this.FMODinfoLabel);
this.FMODpanel.Controls.Add(this.FMODtimerLabel);
this.FMODpanel.Controls.Add(this.FMODstatusLabel);
this.FMODpanel.Controls.Add(this.FMODprogressBar);
this.FMODpanel.Controls.Add(this.FMODvolumeBar);
this.FMODpanel.Controls.Add(this.FMODloopButton);
this.FMODpanel.Controls.Add(this.FMODstopButton);
this.FMODpanel.Controls.Add(this.FMODpauseButton);
this.FMODpanel.Controls.Add(this.FMODplayButton);
this.FMODpanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.FMODpanel.Location = new System.Drawing.Point(0, 0);
this.FMODpanel.Name = "FMODpanel";
this.FMODpanel.Size = new System.Drawing.Size(768, 606);
this.FMODpanel.TabIndex = 2;
this.FMODpanel.Visible = false;
//
// FMODcopyright
//
this.FMODcopyright.AutoSize = true;
this.FMODcopyright.ForeColor = System.Drawing.SystemColors.ControlLight;
this.FMODcopyright.Location = new System.Drawing.Point(214, 337);
this.FMODcopyright.Name = "FMODcopyright";
this.FMODcopyright.Size = new System.Drawing.Size(341, 12);
this.FMODcopyright.TabIndex = 9;
this.FMODcopyright.Text = "Audio Engine supplied by FMOD by Firelight Technologies.";
//
// FMODinfoLabel
//
this.FMODinfoLabel.AutoSize = true;
this.FMODinfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODinfoLabel.Location = new System.Drawing.Point(269, 235);
this.FMODinfoLabel.Name = "FMODinfoLabel";
this.FMODinfoLabel.Size = new System.Drawing.Size(0, 12);
this.FMODinfoLabel.TabIndex = 8;
//
// FMODtimerLabel
//
this.FMODtimerLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODtimerLabel.Location = new System.Drawing.Point(404, 235);
this.FMODtimerLabel.Name = "FMODtimerLabel";
this.FMODtimerLabel.Size = new System.Drawing.Size(155, 12);
this.FMODtimerLabel.TabIndex = 7;
this.FMODtimerLabel.Text = "0:00.0 / 0:00.0";
this.FMODtimerLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// FMODstatusLabel
//
this.FMODstatusLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.FMODstatusLabel.Location = new System.Drawing.Point(213, 235);
this.FMODstatusLabel.Name = "FMODstatusLabel";
this.FMODstatusLabel.Size = new System.Drawing.Size(50, 12);
this.FMODstatusLabel.TabIndex = 6;
this.FMODstatusLabel.Text = "Stopped";
//
// FMODprogressBar
//
this.FMODprogressBar.AutoSize = false;
this.FMODprogressBar.Location = new System.Drawing.Point(213, 253);
this.FMODprogressBar.Maximum = 1000;
this.FMODprogressBar.Name = "FMODprogressBar";
this.FMODprogressBar.Size = new System.Drawing.Size(350, 22);
this.FMODprogressBar.TabIndex = 5;
this.FMODprogressBar.TickStyle = System.Windows.Forms.TickStyle.None;
this.FMODprogressBar.Scroll += new System.EventHandler(this.FMODprogressBar_Scroll);
this.FMODprogressBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FMODprogressBar_MouseDown);
this.FMODprogressBar.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FMODprogressBar_MouseUp);
//
// FMODvolumeBar
//
this.FMODvolumeBar.LargeChange = 2;
this.FMODvolumeBar.Location = new System.Drawing.Point(460, 280);
this.FMODvolumeBar.Name = "FMODvolumeBar";
this.FMODvolumeBar.Size = new System.Drawing.Size(104, 45);
this.FMODvolumeBar.TabIndex = 4;
this.FMODvolumeBar.TickStyle = System.Windows.Forms.TickStyle.Both;
this.FMODvolumeBar.Value = 8;
this.FMODvolumeBar.ValueChanged += new System.EventHandler(this.FMODvolumeBar_ValueChanged);
//
// FMODloopButton
//
this.FMODloopButton.Appearance = System.Windows.Forms.Appearance.Button;
this.FMODloopButton.Location = new System.Drawing.Point(399, 280);
this.FMODloopButton.Name = "FMODloopButton";
this.FMODloopButton.Size = new System.Drawing.Size(55, 42);
this.FMODloopButton.TabIndex = 3;
this.FMODloopButton.Text = "Loop";
this.FMODloopButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.FMODloopButton.UseVisualStyleBackColor = true;
this.FMODloopButton.CheckedChanged += new System.EventHandler(this.FMODloopButton_CheckedChanged);
//
// FMODstopButton
//
this.FMODstopButton.Location = new System.Drawing.Point(338, 280);
this.FMODstopButton.Name = "FMODstopButton";
this.FMODstopButton.Size = new System.Drawing.Size(55, 42);
this.FMODstopButton.TabIndex = 2;
this.FMODstopButton.Text = "Stop";
this.FMODstopButton.UseVisualStyleBackColor = true;
this.FMODstopButton.Click += new System.EventHandler(this.FMODstopButton_Click);
//
// FMODpauseButton
//
this.FMODpauseButton.Location = new System.Drawing.Point(277, 280);
this.FMODpauseButton.Name = "FMODpauseButton";
this.FMODpauseButton.Size = new System.Drawing.Size(55, 42);
this.FMODpauseButton.TabIndex = 1;
this.FMODpauseButton.Text = "Pause";
this.FMODpauseButton.UseVisualStyleBackColor = true;
this.FMODpauseButton.Click += new System.EventHandler(this.FMODpauseButton_Click);
//
// FMODplayButton
//
this.FMODplayButton.Location = new System.Drawing.Point(216, 280);
this.FMODplayButton.Name = "FMODplayButton";
this.FMODplayButton.Size = new System.Drawing.Size(55, 42);
this.FMODplayButton.TabIndex = 0;
this.FMODplayButton.Text = "Play";
this.FMODplayButton.UseVisualStyleBackColor = true;
this.FMODplayButton.Click += new System.EventHandler(this.FMODplayButton_Click);
//
// fontPreviewBox
//
this.fontPreviewBox.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.fontPreviewBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.fontPreviewBox.Location = new System.Drawing.Point(0, 0);
this.fontPreviewBox.Name = "fontPreviewBox";
this.fontPreviewBox.ReadOnly = true;
this.fontPreviewBox.Size = new System.Drawing.Size(768, 606);
this.fontPreviewBox.TabIndex = 0;
this.fontPreviewBox.Text = resources.GetString("fontPreviewBox.Text");
this.fontPreviewBox.Visible = false;
this.fontPreviewBox.WordWrap = false;
//
// glControl1
//
this.glControl1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.glControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.glControl1.Location = new System.Drawing.Point(0, 0);
this.glControl1.Name = "glControl1";
this.glControl1.Size = new System.Drawing.Size(768, 606);
this.glControl1.TabIndex = 4;
this.glControl1.Visible = false;
this.glControl1.VSync = false;
this.glControl1.Load += new System.EventHandler(this.glControl1_Load);
this.glControl1.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl1_Paint);
this.glControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.glControl1_MouseDown);
this.glControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.glControl1_MouseMove);
this.glControl1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.glControl1_MouseUp);
this.glControl1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.glControl1_MouseWheel);
//
// textPreviewBox
//
this.textPreviewBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.textPreviewBox.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textPreviewBox.Location = new System.Drawing.Point(0, 0);
this.textPreviewBox.Multiline = true;
this.textPreviewBox.Name = "textPreviewBox";
this.textPreviewBox.ReadOnly = true;
this.textPreviewBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textPreviewBox.Size = new System.Drawing.Size(768, 606);
this.textPreviewBox.TabIndex = 2;
this.textPreviewBox.Visible = false;
this.textPreviewBox.WordWrap = false;
//
// classTextBox
//
this.classTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.classTextBox.Location = new System.Drawing.Point(0, 0);
this.classTextBox.Multiline = true;
this.classTextBox.Name = "classTextBox";
this.classTextBox.ReadOnly = true;
this.classTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.classTextBox.Size = new System.Drawing.Size(768, 606);
this.classTextBox.TabIndex = 3;
this.classTextBox.Visible = false;
this.classTextBox.WordWrap = false;
//
// tabPage5
//
this.tabPage5.Controls.Add(this.dumpTextBox);
this.tabPage5.Location = new System.Drawing.Point(4, 22);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Size = new System.Drawing.Size(768, 606);
this.tabPage5.TabIndex = 1;
this.tabPage5.Text = "Dump";
this.tabPage5.UseVisualStyleBackColor = true;
//
// dumpTextBox
//
this.dumpTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.dumpTextBox.Location = new System.Drawing.Point(0, 0);
this.dumpTextBox.Multiline = true;
this.dumpTextBox.Name = "dumpTextBox";
this.dumpTextBox.ReadOnly = true;
this.dumpTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.dumpTextBox.Size = new System.Drawing.Size(768, 606);
this.dumpTextBox.TabIndex = 0;
this.dumpTextBox.WordWrap = false;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1});
this.statusStrip1.Location = new System.Drawing.Point(0, 632);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(776, 22);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(761, 17);
this.toolStripStatusLabel1.Spring = true;
this.toolStripStatusLabel1.Text = "Ready to go";
this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// timer
//
this.timer.Interval = 10;
this.timer.Tick += new System.EventHandler(this.timer_Tick);
//
// openFileDialog1
//
this.openFileDialog1.AddExtension = false;
this.openFileDialog1.Filter = "All types|*.*";
this.openFileDialog1.Multiselect = true;
this.openFileDialog1.RestoreDirectory = true;
//
// contextMenuStrip1
//
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem,
this.exportSelectedAssetsToolStripMenuItem,
this.exportAnimatorwithselectedAnimationClipMenuItem,
this.goToSceneHierarchyToolStripMenuItem,
this.showOriginalFileToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(327, 114);
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
this.copyToolStripMenuItem.Text = "Copy text";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
//
// exportSelectedAssetsToolStripMenuItem
//
this.exportSelectedAssetsToolStripMenuItem.Name = "exportSelectedAssetsToolStripMenuItem";
this.exportSelectedAssetsToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
this.exportSelectedAssetsToolStripMenuItem.Text = "Export selected assets";
this.exportSelectedAssetsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedAssetsToolStripMenuItem_Click);
//
// exportAnimatorwithselectedAnimationClipMenuItem
//
this.exportAnimatorwithselectedAnimationClipMenuItem.Name = "exportAnimatorwithselectedAnimationClipMenuItem";
this.exportAnimatorwithselectedAnimationClipMenuItem.Size = new System.Drawing.Size(326, 22);
this.exportAnimatorwithselectedAnimationClipMenuItem.Text = "Export Animator + selected AnimationClips";
this.exportAnimatorwithselectedAnimationClipMenuItem.Visible = false;
this.exportAnimatorwithselectedAnimationClipMenuItem.Click += new System.EventHandler(this.exportAnimatorwithAnimationClipMenuItem_Click);
//
// goToSceneHierarchyToolStripMenuItem
//
this.goToSceneHierarchyToolStripMenuItem.Name = "goToSceneHierarchyToolStripMenuItem";
this.goToSceneHierarchyToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
this.goToSceneHierarchyToolStripMenuItem.Text = "Go to scene hierarchy";
this.goToSceneHierarchyToolStripMenuItem.Visible = false;
this.goToSceneHierarchyToolStripMenuItem.Click += new System.EventHandler(this.goToSceneHierarchyToolStripMenuItem_Click);
//
// showOriginalFileToolStripMenuItem
//
this.showOriginalFileToolStripMenuItem.Name = "showOriginalFileToolStripMenuItem";
this.showOriginalFileToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
this.showOriginalFileToolStripMenuItem.Text = "Show original file";
this.showOriginalFileToolStripMenuItem.Visible = false;
this.showOriginalFileToolStripMenuItem.Click += new System.EventHandler(this.showOriginalFileToolStripMenuItem_Click);
//
// AssetStudioGUIForm
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1264, 681);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.menuStrip1);
this.Icon = global::AssetStudioGUI.Properties.Resources._as;
this.KeyPreview = true;
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(620, 372);
this.Name = "AssetStudioGUIForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AssetStudioGUI";
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.AssetStudioGUIForm_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.AssetStudioGUIForm_DragEnter);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.AssetStudioForm_KeyDown);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.progressbarPanel.ResumeLayout(false);
this.tabControl2.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.previewPanel.ResumeLayout(false);
this.previewPanel.PerformLayout();
this.FMODpanel.ResumeLayout(false);
this.FMODpanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.FMODprogressBar)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.FMODvolumeBar)).EndInit();
this.tabPage5.ResumeLayout(false);
this.tabPage5.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TextBox treeSearch;
private System.Windows.Forms.TextBox listSearch;
private System.Windows.Forms.ToolStripMenuItem loadFileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadFolderToolStripMenuItem;
private System.Windows.Forms.ListView assetListView;
private System.Windows.Forms.ColumnHeader columnHeaderName;
private System.Windows.Forms.ColumnHeader columnHeaderSize;
private System.Windows.Forms.ColumnHeader columnHeaderType;
private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportAllAssetsMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportSelectedAssetsMenuItem;
private System.Windows.Forms.Panel previewPanel;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.Panel progressbarPanel;
private System.Windows.Forms.ToolStripMenuItem exportFilteredAssetsMenuItem;
private System.Windows.Forms.ToolStripMenuItem modelToolStripMenuItem;
private System.Windows.Forms.Label assetInfoLabel;
private System.Windows.Forms.TextBox textPreviewBox;
private System.Windows.Forms.RichTextBox fontPreviewBox;
private System.Windows.Forms.Panel FMODpanel;
private System.Windows.Forms.TrackBar FMODvolumeBar;
private System.Windows.Forms.CheckBox FMODloopButton;
private System.Windows.Forms.Button FMODstopButton;
private System.Windows.Forms.Button FMODpauseButton;
private System.Windows.Forms.Button FMODplayButton;
private System.Windows.Forms.TrackBar FMODprogressBar;
private System.Windows.Forms.Label FMODstatusLabel;
private System.Windows.Forms.Label FMODtimerLabel;
private System.Windows.Forms.Label FMODinfoLabel;
private System.Windows.Forms.Timer timer;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem displayAll;
private System.Windows.Forms.ToolStripMenuItem enablePreview;
private System.Windows.Forms.ToolStripMenuItem displayInfo;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem extractFileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem extractFolderToolStripMenuItem;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.ToolStripMenuItem showExpOpt;
private GOHierarchy sceneTreeView;
private System.Windows.Forms.ToolStripMenuItem debugMenuItem;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.ListView classesListView;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.TextBox classTextBox;
private System.Windows.Forms.ToolStripMenuItem exportClassStructuresMenuItem;
private System.Windows.Forms.Label FMODcopyright;
private OpenTK.GLControl glControl1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem showOriginalFileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportAnimatorwithselectedAnimationClipMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportSelectedAssetsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem filterTypeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem allToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportSelectedObjectsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportSelectedObjectsWithAnimationClipToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem exportAnimatorWithSelectedAnimationClipToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportAllObjectssplitToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem goToSceneHierarchyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportSelectedObjectsmergeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem6;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem7;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem8;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9;
private System.Windows.Forms.ColumnHeader columnHeaderContainer;
private System.Windows.Forms.ColumnHeader columnHeaderPathID;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.TabControl tabControl2;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.TextBox dumpTextBox;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem10;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem11;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem12;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem13;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem14;
private System.Windows.Forms.ToolStripTextBox specifyUnityVersion;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem15;
}
}
| 57.930099 | 184 | 0.658646 | [
"MIT"
] | 2chevskii/AssetStudio | AssetStudioGUI/AssetStudioGUIForm.Designer.cs | 70,445 | C# |
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityModel;
using IdNet6.Events;
using IdNet6.Extensions;
using IdNet6.Services;
using IdNet6.Validation;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace IdNet6.ResponseHandling
{
/// <summary>
/// The introspection response generator
/// </summary>
/// <seealso cref="IdNet6.ResponseHandling.IIntrospectionResponseGenerator" />
public class IntrospectionResponseGenerator : IIntrospectionResponseGenerator
{
/// <summary>
/// Gets the events.
/// </summary>
/// <value>
/// The events.
/// </value>
protected readonly IEventService Events;
/// <summary>
/// The logger
/// </summary>
protected readonly ILogger Logger;
/// <summary>
/// Initializes a new instance of the <see cref="IntrospectionResponseGenerator" /> class.
/// </summary>
/// <param name="events">The events.</param>
/// <param name="logger">The logger.</param>
public IntrospectionResponseGenerator(IEventService events, ILogger<IntrospectionResponseGenerator> logger)
{
Events = events;
Logger = logger;
}
/// <summary>
/// Processes the response.
/// </summary>
/// <param name="validationResult">The validation result.</param>
/// <returns></returns>
public virtual async Task<Dictionary<string, object>> ProcessAsync(IntrospectionRequestValidationResult validationResult)
{
Logger.LogTrace("Creating introspection response");
// standard response
var response = new Dictionary<string, object>
{
{ "active", false }
};
// token is invalid
if (validationResult.IsActive == false)
{
Logger.LogDebug("Creating introspection response for inactive token.");
await Events.RaiseAsync(new TokenIntrospectionSuccessEvent(validationResult));
return response;
}
// expected scope not present
if (await AreExpectedScopesPresentAsync(validationResult) == false)
{
return response;
}
Logger.LogDebug("Creating introspection response for active token.");
// get all claims (without scopes)
response = validationResult.Claims.Where(c => c.Type != JwtClaimTypes.Scope).ToClaimsDictionary();
// add active flag
response.Add("active", true);
// calculate scopes the caller is allowed to see
var allowedScopes = validationResult.Api.Scopes;
var scopes = validationResult.Claims.Where(c => c.Type == JwtClaimTypes.Scope).Select(x => x.Value);
scopes = scopes.Where(x => allowedScopes.Contains(x));
response.Add("scope", scopes.ToSpaceSeparatedString());
await Events.RaiseAsync(new TokenIntrospectionSuccessEvent(validationResult));
return response;
}
/// <summary>
/// Checks if the API resource is allowed to introspect the scopes.
/// </summary>
/// <param name="validationResult">The validation result.</param>
/// <returns></returns>
protected virtual async Task<bool> AreExpectedScopesPresentAsync(IntrospectionRequestValidationResult validationResult)
{
var apiScopes = validationResult.Api.Scopes;
var tokenScopes = validationResult.Claims.Where(c => c.Type == JwtClaimTypes.Scope);
var tokenScopesThatMatchApi = tokenScopes.Where(c => apiScopes.Contains(c.Value));
var result = false;
if (tokenScopesThatMatchApi.Any())
{
// at least one of the scopes the API supports is in the token
result = true;
}
else
{
// no scopes for this API are found in the token
Logger.LogError("Expected scope {scopes} is missing in token", apiScopes);
await Events.RaiseAsync(new TokenIntrospectionFailureEvent(validationResult.Api.Name, "Expected scopes are missing", validationResult.Token, apiScopes, tokenScopes.Select(s => s.Value)));
}
return result;
}
}
} | 37.201613 | 203 | 0.611533 | [
"Apache-2.0"
] | simple0x47/IdNet6 | src/IdNet6/src/ResponseHandling/Default/IntrospectionResponseGenerator.cs | 4,613 | C# |
using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using TestDownload.Authorization.Users;
namespace TestDownload.Sessions.Dto
{
[AutoMapFrom(typeof(User))]
public class UserLoginInfoDto : EntityDto<long>
{
public string Name { get; set; }
public string Surname { get; set; }
public string UserName { get; set; }
public string EmailAddress { get; set; }
}
}
| 22 | 51 | 0.667464 | [
"MIT"
] | wzengguang/TestDowload | aspnet-core/src/TestDownload.Application/Sessions/Dto/UserLoginInfoDto.cs | 420 | C# |
//
// SnippetExecutor.cs
//
// Copyright (C) 2005 Novell, Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using System.Collections;
using System.Xml.Serialization;
using Beagrep.Util;
namespace Beagrep.Daemon {
[RequestMessage (typeof (SnippetRequest))]
public class SnippetExecutor : RequestMessageExecutor {
public override ResponseMessage Execute (RequestMessage req)
{
SnippetRequest request = (SnippetRequest) req;
Queryable queryable = QueryDriver.GetQueryable (request.Hit.Source);
ISnippetReader snippet_reader;
bool full_text = request.FullText;
int ctx_length = request.ContextLength;
int snp_length = request.SnippetLength;
if (queryable == null) {
Log.Error ("SnippetExecutor: No queryable object matches '{0}'", request.Hit.Source);
snippet_reader = new SnippetReader (null, null, false, -1, -1);
full_text = false;
} else
snippet_reader = queryable.GetSnippet (request.QueryTerms, request.Hit, full_text, ctx_length, snp_length);
return new SnippetResponse (new SnippetList (full_text, snippet_reader));
}
}
}
| 36.491525 | 111 | 0.752903 | [
"MIT"
] | baohaojun/beagrep | beagrepd/SnippetExecutor.cs | 2,153 | C# |
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("FlexDMDUI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FlexDMDUI")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur True à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
//Pour commencer à générer des applications localisables, définissez
//<UICulture>CultureUtiliséePourCoder</UICulture> dans votre fichier .csproj
//dans <PropertyGroup>. Par exemple, si vous utilisez le français
//dans vos fichiers sources, définissez <UICulture> à fr-FR. Puis, supprimez les marques de commentaire de
//l'attribut NeutralResourceLanguage ci-dessous. Mettez à jour "fr-FR" dans
//la ligne ci-après pour qu'elle corresponde au paramètre UICulture du fichier projet.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //où se trouvent les dictionnaires de ressources spécifiques à un thème
//(utilisé si une ressource est introuvable dans la page,
// ou dictionnaires de ressources de l'application)
ResourceDictionaryLocation.SourceAssembly //où se trouve le dictionnaire de ressources générique
//(utilisé si une ressource est introuvable dans la page,
// dans l'application ou dans l'un des dictionnaires de ressources spécifiques à un thème)
)]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 46.410714 | 136 | 0.72374 | [
"Apache-2.0"
] | mkalkbrenner/flexdmd | FlexDMDUI/Properties/AssemblyInfo.cs | 2,644 | C# |
using IPA.Config.Stores;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo(GeneratedStore.AssemblyVisibilityTarget)]
namespace CustomEnergyBar.Settings
{
internal class SettingsStore
{
public string Selected = "defaultEnergyBar";
public bool AllowSFX = true;
}
}
| 19.533333 | 71 | 0.798635 | [
"MIT"
] | ckosmic/CustomEnergyBars | CustomEnergyBar/Settings/SettingsStore.cs | 295 | C# |
using System;
namespace WebHDFS
{
/// <summary>
/// https://hadoop.apache.org/docs/r2.8.0/hadoop-project-dist/hadoop-hdfs/WebHDFS.html#ContentSummary_JSON_Schema
/// </summary>
public class ContentSummaryClass
{
/// <summary>
/// Gets or sets the content summary.
/// </summary>
/// <value>The content summary.</value>
public ContentSummary ContentSummary { get; set; }
}
/// <summary>
/// Archive.
/// </summary>
public class ARCHIVE
{
/// <summary>
/// Gets or sets the consumed.
/// </summary>
/// <value>The consumed.</value>
public int consumed { get; set; }
/// <summary>
/// Gets or sets the quota.
/// </summary>
/// <value>The quota.</value>
public int quota { get; set; }
}
/// <summary>
/// Disk.
/// </summary>
public class DISK
{
/// <summary>
/// Gets or sets the consumed.
/// </summary>
/// <value>The consumed.</value>
public int consumed { get; set; }
/// <summary>
/// Gets or sets the quota.
/// </summary>
/// <value>The quota.</value>
public int quota { get; set; }
}
/// <summary>
/// SSD.
/// </summary>
public class SSD
{
/// <summary>
/// Gets or sets the consumed.
/// </summary>
/// <value>The consumed.</value>
public int consumed { get; set; }
/// <summary>
/// Gets or sets the quota.
/// </summary>
/// <value>The quota.</value>
public int quota { get; set; }
}
/// <summary>
/// Type quota.
/// </summary>
public class TypeQuota
{
/// <summary>
/// Gets or sets the archive.
/// </summary>
/// <value>The archive.</value>
public ARCHIVE ARCHIVE { get; set; }
/// <summary>
/// Gets or sets the disk.
/// </summary>
/// <value>The disk.</value>
public DISK DISK { get; set; }
/// <summary>
/// Gets or sets the ssd.
/// </summary>
/// <value>The ssd.</value>
public SSD SSD { get; set; }
}
/// <summary>
/// Content summary.
/// </summary>
public class ContentSummary
{
/// <summary>
/// Gets or sets the directory count.
/// </summary>
/// <value>The directory count.</value>
public int directoryCount { get; set; }
/// <summary>
/// Gets or sets the file count.
/// </summary>
/// <value>The file count.</value>
public int fileCount { get; set; }
/// <summary>
/// Gets or sets the length.
/// </summary>
/// <value>The length.</value>
public int length { get; set; }
/// <summary>
/// Gets or sets the quota.
/// </summary>
/// <value>The quota.</value>
public int quota { get; set; }
/// <summary>
/// Gets or sets the space consumed.
/// </summary>
/// <value>The space consumed.</value>
public int spaceConsumed { get; set; }
/// <summary>
/// Gets or sets the space quota.
/// </summary>
/// <value>The space quota.</value>
public int spaceQuota { get; set; }
/// <summary>
/// Gets or sets the type quota.
/// </summary>
/// <value>The type quota.</value>
public TypeQuota typeQuota { get; set; }
}
}
| 25.225352 | 117 | 0.47962 | [
"Apache-2.0"
] | risdenk/webhdfs-dotnet | WebHDFS/ContentSummaryClass.cs | 3,584 | C# |
using Newtonsoft.Json;
using System.Collections.Generic;
namespace TauriApiWrapper.Objects.Responses.Achievement
{
public sealed class CharacterAchievementsCategory
{
[JsonProperty("info")]
public CharacterAchievementsInfo Info { get; set; }
[JsonProperty("subcat", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<string, CharacterAchievementsInfo> Subcat { get; set; }
}
} | 31.214286 | 81 | 0.729977 | [
"Apache-2.0"
] | brues-code/TauriApiWrapper | TauriApiWrapper/Objects/Responses/Achievement/CharacterAchievementsCategory.cs | 439 | C# |
using FluentMigrator;
using Nop.Core.Domain.Affiliates;
using Nop.Core.Domain.Blogs;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Configuration;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Directory;
using Nop.Core.Domain.Discounts;
using Nop.Core.Domain.Forums;
using Nop.Core.Domain.Gdpr;
using Nop.Core.Domain.Localization;
using Nop.Core.Domain.Logging;
using Nop.Core.Domain.Media;
using Nop.Core.Domain.Messages;
using Nop.Core.Domain.News;
using Nop.Core.Domain.Orders;
using Nop.Core.Domain.Polls;
using Nop.Core.Domain.Security;
using Nop.Core.Domain.Seo;
using Nop.Core.Domain.Shipping;
using Nop.Core.Domain.Stores;
using Nop.Core.Domain.Tasks;
using Nop.Core.Domain.Tax;
using Nop.Core.Domain.Topics;
using Nop.Core.Domain.Vendors;
namespace Nop.Data.Migrations
{
[SkipMigrationOnUpdate]
[NopMigration("2020/01/31 11:24:16:2551771", "Nop.Data base schema")]
public class SchemaMigration : AutoReversingMigration
{
private readonly IMigrationManager _migrationManager;
public SchemaMigration(IMigrationManager migrationManager)
{
_migrationManager = migrationManager;
}
/// <summary>
/// Collect the UP migration expressions
/// <remarks>
/// We use an explicit table creation order instead of an automatic one
/// due to problems creating relationships between tables
/// </remarks>
/// </summary>
public override void Up()
{
_migrationManager.BuildTable<AddressAttribute>(Create);
_migrationManager.BuildTable<AddressAttributeValue>(Create);
_migrationManager.BuildTable<GenericAttribute>(Create);
_migrationManager.BuildTable<SearchTerm>(Create);
_migrationManager.BuildTable<Country>(Create);
_migrationManager.BuildTable<Currency>(Create);
_migrationManager.BuildTable<MeasureDimension>(Create);
_migrationManager.BuildTable<MeasureWeight>(Create);
_migrationManager.BuildTable<StateProvince>(Create);
_migrationManager.BuildTable<Address>(Create);
_migrationManager.BuildTable<Affiliate>(Create);
_migrationManager.BuildTable<CustomerAttribute>(Create);
_migrationManager.BuildTable<CustomerAttributeValue>(Create);
_migrationManager.BuildTable<Customer>(Create);
_migrationManager.BuildTable<CustomerPassword>(Create);
_migrationManager.BuildTable<CustomerAddressMapping>(Create);
_migrationManager.BuildTable<CustomerRole>(Create);
_migrationManager.BuildTable<CustomerCustomerRoleMapping>(Create);
_migrationManager.BuildTable<ExternalAuthenticationRecord>(Create);
_migrationManager.BuildTable<CheckoutAttribute>(Create);
_migrationManager.BuildTable<CheckoutAttributeValue>(Create);
_migrationManager.BuildTable<ReturnRequestAction>(Create);
_migrationManager.BuildTable<ReturnRequest>(Create);
_migrationManager.BuildTable<ReturnRequestReason>(Create);
_migrationManager.BuildTable<ProductAttribute>(Create);
_migrationManager.BuildTable<PredefinedProductAttributeValue>(Create);
_migrationManager.BuildTable<ProductTag>(Create);
_migrationManager.BuildTable<Product>(Create);
_migrationManager.BuildTable<ProductTemplate>(Create);
_migrationManager.BuildTable<BackInStockSubscription>(Create);
_migrationManager.BuildTable<RelatedProduct>(Create);
_migrationManager.BuildTable<ReviewType>(Create);
_migrationManager.BuildTable<SpecificationAttribute>(Create);
_migrationManager.BuildTable<ProductAttributeCombination>(Create);
_migrationManager.BuildTable<ProductAttributeMapping>(Create);
_migrationManager.BuildTable<ProductAttributeValue>(Create);
_migrationManager.BuildTable<Order>(Create);
_migrationManager.BuildTable<OrderItem>(Create);
_migrationManager.BuildTable<RewardPointsHistory>(Create);
_migrationManager.BuildTable<GiftCard>(Create);
_migrationManager.BuildTable<GiftCardUsageHistory>(Create);
_migrationManager.BuildTable<OrderNote>(Create);
_migrationManager.BuildTable<RecurringPayment>(Create);
_migrationManager.BuildTable<RecurringPaymentHistory>(Create);
_migrationManager.BuildTable<ShoppingCartItem>(Create);
_migrationManager.BuildTable<Store>(Create);
_migrationManager.BuildTable<StoreMapping>(Create);
_migrationManager.BuildTable<Language>(Create);
_migrationManager.BuildTable<LocaleStringResource>(Create);
_migrationManager.BuildTable<LocalizedProperty>(Create);
_migrationManager.BuildTable<BlogPost>(Create);
_migrationManager.BuildTable<BlogComment>(Create);
_migrationManager.BuildTable<Category>(Create);
_migrationManager.BuildTable<CategoryTemplate>(Create);
_migrationManager.BuildTable<ProductCategory>(Create);
_migrationManager.BuildTable<CrossSellProduct>(Create);
_migrationManager.BuildTable<Manufacturer>(Create);
_migrationManager.BuildTable<ManufacturerTemplate>(Create);
_migrationManager.BuildTable<ProductManufacturer>(Create);
_migrationManager.BuildTable<ProductProductTagMapping>(Create);
_migrationManager.BuildTable<ProductReview>(Create);
_migrationManager.BuildTable<ProductReviewHelpfulness>(Create);
_migrationManager.BuildTable<ProductReviewReviewTypeMapping>(Create);
_migrationManager.BuildTable<SpecificationAttributeOption>(Create);
_migrationManager.BuildTable<ProductSpecificationAttribute>(Create);
_migrationManager.BuildTable<TierPrice>(Create);
_migrationManager.BuildTable<Warehouse>(Create);
_migrationManager.BuildTable<DeliveryDate>(Create);
_migrationManager.BuildTable<ProductAvailabilityRange>(Create);
_migrationManager.BuildTable<Shipment>(Create);
_migrationManager.BuildTable<ShipmentItem>(Create);
_migrationManager.BuildTable<ShippingMethod>(Create);
_migrationManager.BuildTable<ShippingMethodCountryMapping>(Create);
_migrationManager.BuildTable<ProductWarehouseInventory>(Create);
_migrationManager.BuildTable<StockQuantityHistory>(Create);
_migrationManager.BuildTable<Download>(Create);
_migrationManager.BuildTable<Picture>(Create);
_migrationManager.BuildTable<PictureBinary>(Create);
_migrationManager.BuildTable<ProductPicture>(Create);
_migrationManager.BuildTable<Setting>(Create);
_migrationManager.BuildTable<Discount>(Create);
_migrationManager.BuildTable<DiscountCategoryMapping>(Create);
_migrationManager.BuildTable<DiscountProductMapping>(Create);
_migrationManager.BuildTable<DiscountRequirement>(Create);
_migrationManager.BuildTable<DiscountUsageHistory>(Create);
_migrationManager.BuildTable<DiscountManufacturerMapping>(Create);
_migrationManager.BuildTable<PrivateMessage>(Create);
_migrationManager.BuildTable<ForumGroup>(Create);
_migrationManager.BuildTable<Forum>(Create);
_migrationManager.BuildTable<ForumTopic>(Create);
_migrationManager.BuildTable<ForumPost>(Create);
_migrationManager.BuildTable<ForumPostVote>(Create);
_migrationManager.BuildTable<ForumSubscription>(Create);
_migrationManager.BuildTable<GdprConsent>(Create);
_migrationManager.BuildTable<GdprLog>(Create);
_migrationManager.BuildTable<ActivityLogType>(Create);
_migrationManager.BuildTable<ActivityLog>(Create);
_migrationManager.BuildTable<Log>(Create);
_migrationManager.BuildTable<Campaign>(Create);
_migrationManager.BuildTable<EmailAccount>(Create);
_migrationManager.BuildTable<MessageTemplate>(Create);
_migrationManager.BuildTable<NewsLetterSubscription>(Create);
_migrationManager.BuildTable<QueuedEmail>(Create);
_migrationManager.BuildTable<NewsItem>(Create);
_migrationManager.BuildTable<NewsComment>(Create);
_migrationManager.BuildTable<Poll>(Create);
_migrationManager.BuildTable<PollAnswer>(Create);
_migrationManager.BuildTable<PollVotingRecord>(Create);
_migrationManager.BuildTable<AclRecord>(Create);
_migrationManager.BuildTable<PermissionRecord>(Create);
_migrationManager.BuildTable<PermissionRecordCustomerRoleMapping>(Create);
_migrationManager.BuildTable<UrlRecord>(Create);
_migrationManager.BuildTable<ScheduleTask>(Create);
_migrationManager.BuildTable<TaxCategory>(Create);
_migrationManager.BuildTable<TopicTemplate>(Create);
_migrationManager.BuildTable<Topic>(Create);
_migrationManager.BuildTable<Vendor>(Create);
_migrationManager.BuildTable<VendorAttribute>(Create);
_migrationManager.BuildTable<VendorAttributeValue>(Create);
_migrationManager.BuildTable<VendorNote>(Create);
}
}
}
| 44.706977 | 86 | 0.712963 | [
"MIT"
] | ASP-WAF/FireWall | Samples/NopeCommerce/Libraries/Nop.Data/Migrations/SchemaMigration.cs | 9,614 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System.Collections.Generic;
using Azure.Core;
namespace Azure.ResourceManager.KeyVault.Models
{
/// <summary> A set of rules governing the network accessibility of a managed hsm pool. </summary>
public partial class MhsmNetworkRuleSet
{
/// <summary> Initializes a new instance of MhsmNetworkRuleSet. </summary>
public MhsmNetworkRuleSet()
{
IpRules = new ChangeTrackingList<MhsmipRule>();
VirtualNetworkRules = new ChangeTrackingList<MhsmVirtualNetworkRule>();
}
/// <summary> Initializes a new instance of MhsmNetworkRuleSet. </summary>
/// <param name="bypass"> Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. </param>
/// <param name="defaultAction"> The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. </param>
/// <param name="ipRules"> The list of IP address rules. </param>
/// <param name="virtualNetworkRules"> The list of virtual network rules. </param>
internal MhsmNetworkRuleSet(NetworkRuleBypassOptions? bypass, NetworkRuleAction? defaultAction, IList<MhsmipRule> ipRules, IList<MhsmVirtualNetworkRule> virtualNetworkRules)
{
Bypass = bypass;
DefaultAction = defaultAction;
IpRules = ipRules;
VirtualNetworkRules = virtualNetworkRules;
}
/// <summary> Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. </summary>
public NetworkRuleBypassOptions? Bypass { get; set; }
/// <summary> The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. </summary>
public NetworkRuleAction? DefaultAction { get; set; }
/// <summary> The list of IP address rules. </summary>
public IList<MhsmipRule> IpRules { get; }
/// <summary> The list of virtual network rules. </summary>
public IList<MhsmVirtualNetworkRule> VirtualNetworkRules { get; }
}
}
| 53.282609 | 206 | 0.695226 | [
"MIT"
] | Cardsareus/azure-sdk-for-net | sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmNetworkRuleSet.cs | 2,451 | C# |
using System;
using NUnit.Framework;
namespace AsyncAwaitBestPractices.UnitTests
{
class Tests_WeakEventManager_EventHandler : BaseTest
{
[Test]
public void WeakEventManager_HandleEvent_ValidImplementation()
{
//Arrange
TestEvent += HandleTestEvent;
bool didEventFire = false;
void HandleTestEvent(object? sender, EventArgs e)
{
if (sender is null)
throw new ArgumentNullException(nameof(sender));
Assert.IsNotNull(sender);
Assert.AreEqual(this.GetType(), sender.GetType());
Assert.IsNotNull(e);
didEventFire = true;
TestEvent -= HandleTestEvent;
}
//Act
TestWeakEventManager.RaiseEvent(this, new EventArgs(), nameof(TestEvent));
//Assert
Assert.IsTrue(didEventFire);
}
[Test]
public void WeakEventManager_HandleEvent_NullSender()
{
//Arrange
TestEvent += HandleTestEvent;
bool didEventFire = false;
void HandleTestEvent(object? sender, EventArgs e)
{
Assert.IsNull(sender);
Assert.IsNotNull(e);
didEventFire = true;
TestEvent -= HandleTestEvent;
}
//Act
TestWeakEventManager.RaiseEvent(null, new EventArgs(), nameof(TestEvent));
//Assert
Assert.IsTrue(didEventFire);
}
[Test]
public void WeakEventManager_HandleEvent_EmptyEventArgs()
{
//Arrange
TestEvent += HandleTestEvent;
bool didEventFire = false;
void HandleTestEvent(object? sender, EventArgs e)
{
if (sender is null)
throw new ArgumentNullException(nameof(sender));
Assert.IsNotNull(sender);
Assert.AreEqual(this.GetType(), sender.GetType());
Assert.IsNotNull(e);
Assert.AreEqual(EventArgs.Empty, e);
didEventFire = true;
TestEvent -= HandleTestEvent;
}
//Act
TestWeakEventManager.RaiseEvent(this, EventArgs.Empty, nameof(TestEvent));
//Assert
Assert.IsTrue(didEventFire);
}
[Test]
public void WeakEventManager_HandleEvent_NullEventArgs()
{
//Arrange
TestEvent += HandleTestEvent;
bool didEventFire = false;
void HandleTestEvent(object? sender, EventArgs e)
{
if (sender is null)
throw new ArgumentNullException(nameof(sender));
Assert.IsNotNull(sender);
Assert.AreEqual(this.GetType(), sender.GetType());
Assert.IsNull(e);
didEventFire = true;
TestEvent -= HandleTestEvent;
}
//Act
TestWeakEventManager.RaiseEvent(this, null, nameof(TestEvent));
//Assert
Assert.IsTrue(didEventFire);
}
[Test]
public void WeakEventManager_HandleEvent_InvalidHandleEventName()
{
//Arrange
TestEvent += HandleTestEvent;
bool didEventFire = false;
void HandleTestEvent(object? sender, EventArgs e) => didEventFire = true;
//Act
TestWeakEventManager.RaiseEvent(this, new EventArgs(), nameof(TestStringEvent));
//Assert
Assert.False(didEventFire);
TestEvent -= HandleTestEvent;
}
[Test]
public void WeakEventManager_UnassignedEvent()
{
//Arrange
bool didEventFire = false;
TestEvent += HandleTestEvent;
TestEvent -= HandleTestEvent;
void HandleTestEvent(object? sender, EventArgs e) => didEventFire = true;
//Act
TestWeakEventManager.RaiseEvent(null, null, nameof(TestEvent));
//Assert
Assert.IsFalse(didEventFire);
}
[Test]
public void WeakEventManager_UnassignedEventManager()
{
//Arrange
var unassignedEventManager = new WeakEventManager();
bool didEventFire = false;
TestEvent += HandleTestEvent;
void HandleTestEvent(object? sender, EventArgs e) => didEventFire = true;
//Act
unassignedEventManager.RaiseEvent(null, null, nameof(TestEvent));
//Assert
Assert.IsFalse(didEventFire);
TestEvent -= HandleTestEvent;
}
[Test]
public void WeakEventManager_AddEventHandler_NullHandler()
{
//Arrange
//Act
//Assert
Assert.Throws<ArgumentNullException>(() => TestWeakEventManager.AddEventHandler(null), "Value cannot be null.\nParameter name: handler");
}
[Test]
public void WeakEventManager_AddEventHandler_NullEventName()
{
//Arrange
//Act
//Assert
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference
Assert.Throws<ArgumentNullException>(() => TestWeakEventManager.AddEventHandler(null, null), "Value cannot be null.\nParameter name: eventName");
#pragma warning restore CS8625
}
[Test]
public void WeakEventManager_AddEventHandler_EmptyEventName()
{
//Arrange
//Act
//Assert
Assert.Throws<ArgumentNullException>(() => TestWeakEventManager.AddEventHandler(null, string.Empty), "Value cannot be null.\nParameter name: eventName");
}
[Test]
public void WeakEventManager_AddEventHandler_WhitespaceEventName()
{
//Arrange
//Act
//Assert
Assert.Throws<ArgumentNullException>(() => TestWeakEventManager.AddEventHandler(null, " "), "Value cannot be null.\nParameter name: eventName");
}
[Test]
public void WeakEventManager_RemoveEventHandler_NullHandler()
{
//Arrange
//Act
//Assert
Assert.Throws<ArgumentNullException>(() => TestWeakEventManager.RemoveEventHandler(null), "Value cannot be null.\nParameter name: handler");
}
[Test]
public void WeakEventManager_RemoveEventHandler_NullEventName()
{
//Arrange
//Act
//Assert
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference
Assert.Throws<ArgumentNullException>(() => TestWeakEventManager.RemoveEventHandler(null, null), "Value cannot be null.\nParameter name: eventName");
#pragma warning restore CS8625
}
[Test]
public void WeakEventManager_RemoveEventHandler_EmptyEventName()
{
//Arrange
//Act
//Assert
Assert.Throws<ArgumentNullException>(() => TestWeakEventManager.RemoveEventHandler(null, string.Empty), "Value cannot be null.\nParameter name: eventName");
}
[Test]
public void WeakEventManager_RemoveEventHandler_WhiteSpaceEventName()
{
//Arrange
//Act
//Assert
Assert.Throws<ArgumentNullException>(() => TestWeakEventManager.RemoveEventHandler(null, " "), "Value cannot be null.\nParameter name: eventName");
}
[Test]
public void WeakEventManager_HandleEvent_InvalidHandleEvent()
{
//Arrange
TestEvent += HandleTestEvent;
bool didEventFire = false;
void HandleTestEvent(object? sender, EventArgs e) => didEventFire = true;
//Act
//Assert
Assert.Throws<InvalidHandleEventException>(() => TestWeakEventManager.RaiseEvent(nameof(TestEvent)));
Assert.IsFalse(didEventFire);
TestEvent -= HandleTestEvent;
}
}
}
| 29.471223 | 168 | 0.567924 | [
"MIT"
] | Ahmed-Dawood/AsyncAwaitBestPractices | Src/AsyncAwaitBestPractices.UnitTests/WeakEventManagerTests/Tests_WeakEventManager_EventHandler.cs | 8,195 | C# |
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Automation.Peers;
using NativeAutomationProperties = Microsoft.UI.Xaml.Automation.AutomationProperties;
using WPanel = Microsoft.UI.Xaml.Controls.Panel;
using WNavigationViewItem = Microsoft.UI.Xaml.Controls.NavigationViewItem;
using WFrameworkElement = Microsoft.UI.Xaml.FrameworkElement;
using WWindow = Microsoft.UI.Xaml.Window;
using Microsoft.Maui.Hosting;
using Microsoft.Maui.Handlers;
using Microsoft.Maui;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Handlers;
using Microsoft.Maui.Platform;
using System.Threading.Tasks;
using System;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
namespace Microsoft.Maui.DeviceTests
{
public partial class HandlerTestBase
{
protected bool GetIsAccessibilityElement(IViewHandler viewHandler) =>
((AccessibilityView)((DependencyObject)viewHandler.NativeView).GetValue(NativeAutomationProperties.AccessibilityViewProperty))
== AccessibilityView.Content;
Task RunWindowTest<THandler>(IWindow window, Func<THandler, Task> action)
where THandler : class, IElementHandler
{
return InvokeOnMainThreadAsync(async () =>
{
var testingRootPanel = (WPanel)MauiProgram.CurrentWindow.Content;
IElementHandler newWindowHandler = null;
NavigationRootManager navigationRootManager = null;
try
{
var scopedContext = new MauiContext(MauiContext.Services);
scopedContext.AddWeakSpecific(MauiProgram.CurrentWindow);
var mauiContext = scopedContext.MakeScoped(true);
navigationRootManager = mauiContext.GetNavigationRootManager();
navigationRootManager.UseCustomAppTitleBar = false;
newWindowHandler = window.ToHandler(mauiContext);
var content = window.Content.Handler.ToPlatform();
await content.LoadedAsync();
await Task.Delay(10);
if (typeof(THandler).IsAssignableFrom(newWindowHandler.GetType()))
await action((THandler)newWindowHandler);
else if (typeof(THandler).IsAssignableFrom(window.Content.Handler.GetType()))
await action((THandler)window.Content.Handler);
}
finally
{
if (navigationRootManager != null)
navigationRootManager.Disconnect();
if (newWindowHandler != null)
newWindowHandler.DisconnectHandler();
// Set the root window panel back to the testing panel
if (testingRootPanel != null && MauiProgram.CurrentWindow.Content != testingRootPanel)
{
MauiProgram.CurrentWindow.Content = testingRootPanel;
await testingRootPanel.LoadedAsync();
await Task.Delay(10);
}
}
});
}
protected IEnumerable<WNavigationViewItem> GetNavigationViewItems(MauiNavigationView navigationView)
{
if (navigationView.MenuItems?.Count > 0)
{
foreach (var menuItem in navigationView.MenuItems)
{
if (menuItem is WNavigationViewItem item)
yield return item;
}
}
else if (navigationView.MenuItemsSource != null && navigationView.TopNavMenuItemsHost != null)
{
var itemCount = navigationView.TopNavMenuItemsHost.ItemsSourceView.Count;
for (int i = 0; i < itemCount; i++)
{
UI.Xaml.UIElement uIElement = navigationView.TopNavMenuItemsHost.TryGetElement(i);
if (uIElement is WNavigationViewItem item)
yield return item;
}
}
}
MauiNavigationView GetMauiNavigationView(NavigationRootManager navigationRootManager)
{
return (navigationRootManager.RootView as WindowRootView).NavigationViewControl;
}
protected MauiNavigationView GetMauiNavigationView(IMauiContext mauiContext)
{
return GetMauiNavigationView(mauiContext.GetNavigationRootManager());
}
}
}
| 33.925926 | 129 | 0.759552 | [
"MIT"
] | adospace/maui | src/Controls/tests/DeviceTests/HandlerTestBase.Windows.cs | 3,666 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using BuildXL.Cache.ContentStore.Service;
using FluentAssertions;
using Xunit;
namespace ContentStoreTest.Service
{
public class BufferSerializeContextTests
{
[Fact]
public void LengthProperty()
{
var context = new BufferSerializeContext(new byte[0]);
context.Length.Should().Be(0);
}
[Fact]
public void OffsetPropertyInitialized()
{
var context = new BufferSerializeContext(new byte[0]);
context.Offset.Should().Be(0);
}
[Fact]
public void Int32Roundtrip()
{
var buffer = new byte[4];
var context1 = new BufferSerializeContext(buffer);
context1.Serialize(7);
var context2 = new BufferSerializeContext(buffer);
var i = context2.DeserializeInt32();
i.Should().Be(7);
}
[Fact]
public void Int64Roundtrip()
{
var buffer = new byte[16];
var ticks = DateTime.UtcNow.Ticks;
var context1 = new BufferSerializeContext(buffer);
context1.Serialize(ticks);
context1.Serialize(ticks + 1);
var context2 = new BufferSerializeContext(buffer);
var t1 = context2.DeserializeInt64();
var t2 = context2.DeserializeInt64();
t1.Should().Be(ticks);
t2.Should().Be(ticks + 1);
}
[Fact]
public void GuidRoundtrip()
{
var buffer = new byte[16];
var id1 = new Guid("0647396E-C99F-47DB-B567-C022E953CB69");
var context1 = new BufferSerializeContext(buffer);
context1.Serialize(id1);
var context2 = new BufferSerializeContext(buffer);
var id2 = context2.DeserializeGuid();
id2.Should().Be(id1);
}
}
}
| 28.306667 | 102 | 0.553462 | [
"MIT"
] | AzureMentor/BuildXL | Public/Src/Cache/ContentStore/Test/Service/BufferSerializeContextTests.cs | 2,123 | C# |
using System.Data.Entity;
using Verademo.Models;
namespace Verademo.Data
{
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext() : base("Server=127.0.0.1,1433;Database=Verademo;User=sa;Password=SuperSecurePassw0rd!")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<User>().HasKey(x => x.UserName);
}
public DbSet<User> Users { get; set; }
}
}
| 23.714286 | 125 | 0.646586 | [
"MIT"
] | Lerer/verademo-dotnet | app/Data/ApplicationDbContext.cs | 498 | C# |
using Microsoft.Bot.Builder.FormFlow;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace HotelBot.Models
{
public enum BedSizeOptions
{
King,
Queen,
Single,
Double
}
public enum AmenitiesOptions
{
Kitechen,
ExtraTowels,
GymAccess,
Wifi
}
[Serializable]
public class RoomReservation
{
public BedSizeOptions? BedSize;
public int? NumberOfOccupants;
public DateTime? CheckInDate;
public List<AmenitiesOptions> Amenities;
public static IForm<RoomReservation> BuildForm()
{
return new FormBuilder<RoomReservation>()
.Message("Welcome to help reservation bot!")
.Build();
}
}
} | 19.666667 | 60 | 0.596852 | [
"MIT"
] | agholap/Azure532 | HotelBot/Models/RoomReservation.cs | 828 | C# |
using System.Xml;
namespace SharpDox.UML.SVG
{
internal class SvgLink : SvgElement
{
private XmlAttribute _href;
public SvgLink(SvgRoot rootSvg, string text, string href, double x, double y) : base(rootSvg, "a")
{
Text = new SvgText(rootSvg, text, x, y);
CreateElement();
Text.Fill = "#1382CE";
Text.OnMouseOut = "this.setAttribute('fill', '#1382CE')";
Text.OnMouseOver = "this.setAttribute('fill', '#F58026')";
Href = href;
Text.X = x;
Text.Y = y;
}
private void CreateElement()
{
_href = _rootSvg.CreateAttribute("xlink:href", "http://www.w3.org/1999/xlink");
Attributes.Append(_href);
var target = _rootSvg.CreateAttribute("target");
target.Value = "_top";
Attributes.Append(target);
AppendChild(Text);
}
public SvgText Text { get; set; }
public string Href { get { return _href.Value; } set { _href.Value = value; } }
}
} | 28.578947 | 106 | 0.541436 | [
"MIT"
] | CoderGears/sharpDox | src/Libraries/SharpDox.UML/SVG/SvgLink.cs | 1,088 | C# |
// Compiler options: -langversion:future
using System;
using System.Threading.Tasks;
class Program
{
static void CompilationTestOnly ()
{
var t = new Task<int> (() => 5);
var t2 = Task.Run (() => { return t; });
}
public static void Main ()
{
}
}
| 15.294118 | 42 | 0.626923 | [
"Apache-2.0"
] | 121468615/mono | mcs/tests/test-async-25.cs | 260 | 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.Diagnostics;
namespace System.Reflection.TypeLoading
{
/// <summary>
/// A convenience class that holds the palette of core types that were successfully loaded (or the reason they were not.)
/// </summary>
internal sealed class CoreTypes
{
private readonly RoType[] _coreTypes;
private readonly Exception[] _exceptions;
internal CoreTypes(TypeLoader loader)
{
int numCoreTypes = (int)CoreType.NumCoreTypes;
RoType[] coreTypes = new RoType[numCoreTypes];
Exception[] exceptions = new Exception[numCoreTypes];
RoAssembly coreAssembly = loader.TryGetCoreAssembly(out Exception e);
if (coreAssembly == null)
{
for (int i = 0; i < numCoreTypes; i++)
{
exceptions[i] = e;
}
}
else
{
for (int i = 0; i < numCoreTypes; i++)
{
((CoreType)i).GetFullName(out byte[] ns, out byte[] name);
RoType type = coreAssembly.GetTypeCore(ns, name, ignoreCase: false, out e);
coreTypes[i] = type;
if (type == null)
{
exceptions[i] = e;
}
}
}
_coreTypes = coreTypes;
_exceptions = exceptions;
}
/// <summary>
/// Returns null if the specific core type did not exist or could not be loaded. Call GetException(coreType) to get detailed info.
/// </summary>
public RoType this[CoreType coreType] => _coreTypes[(int)coreType];
public Exception GetException(CoreType coreType) => _exceptions[(int)coreType];
}
}
| 36.581818 | 138 | 0.552684 | [
"MIT"
] | AlexanderSWilliams/corefxlab | src/System.Reflection.TypeLoader/src/System/Reflection/TypeLoading/General/CoreTypes.cs | 2,012 | C# |
// MIT License
// Copyright (c) 2011-2016 Elisée Maurer, Sparklin Labs, Creative Patterns
// Copyright (c) 2016 Thomas Morgner, Rabbit-StewDio Ltd.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using Microsoft.Xna.Framework;
using Steropes.UI.Components;
using Steropes.UI.Input.MouseInput;
using Steropes.UI.Platform;
using Steropes.UI.Styles;
using Steropes.UI.Util;
using Steropes.UI.Widgets.Container;
using Steropes.UI.Widgets.Styles;
namespace Steropes.UI.Widgets
{
public class NotebookTabList : WidgetContainerBase<bool>
{
readonly NotebookStyleDefinition notebookStyle;
readonly EventSupport<EventArgs> activeTabChangedSupport;
INotebookTab activeTab;
bool allowDragReorder;
public NotebookTabList(IUIStyle style) : base(style)
{
activeTabChangedSupport = new EventSupport<EventArgs>();
allowDragReorder = true;
notebookStyle = StyleSystem.StylesFor<NotebookStyleDefinition>();
DragState = new DragNDropState(this);
}
public event EventHandler<EventArgs> ActiveTabChanged
{
add { activeTabChangedSupport.Event += value; }
remove { activeTabChangedSupport.Event -= value; }
}
public EventHandler<EventArgs> OnActiveTabChanged
{
get { return activeTabChangedSupport.Handler; }
set { activeTabChangedSupport.Handler = value; }
}
public INotebookTab ActiveTab
{
get
{
return activeTab;
}
set
{
if (ReferenceEquals(value, activeTab))
{
return;
}
if (activeTab != null)
{
activeTab.IsActive = false;
}
activeTab = value;
if (activeTab != null)
{
activeTab.IsActive = true;
}
OnPropertyChanged();
activeTabChangedSupport.Raise(this, EventArgs.Empty);
}
}
public bool AllowDragReorder
{
get
{
return allowDragReorder;
}
set
{
if (allowDragReorder != value)
{
allowDragReorder = value;
OnPropertyChanged();
}
}
}
public int NotebookTabOverlapX
{
get
{
return Style.GetValue(notebookStyle.NotebookTabOverlapX);
}
set
{
Style.SetValue(notebookStyle.NotebookTabOverlapX, value);
}
}
/// <summary>
/// Protected for test introspection.
/// </summary>
protected DragNDropState DragState { get; }
public void ActivateTab(INotebookTab notebookTab)
{
if (IndexOf(notebookTab) != -1)
{
ActiveTab = notebookTab;
}
}
public void Add(INotebookTab widget, bool pinned = false)
{
AddImpl(widget, Count, pinned);
}
public void Add(INotebookTab widget, int index, bool pinned = false)
{
AddImpl(widget, index, pinned);
}
public void CloseTab(INotebookTab notebookTab)
{
Remove(notebookTab);
}
public void Remove(INotebookTab widget)
{
var idx = IndexOf(widget);
if (idx == -1)
{
throw new ArgumentException();
}
RemoveImpl(idx);
}
/// <summary>
/// Todo: Handle minimum sizing on tabs.
/// Todo: Handle scrolling (when more space needed by tabs than available).
/// Todo: Handle drag'n'drop.
/// </summary>
/// <param name="layoutSize"></param>
/// <returns></returns>
protected override Rectangle ArrangeOverride(Rectangle layoutSize)
{
var draggedTab = DragState.DraggedTab;
var x = layoutSize.X;
var dragHandled = false;
for (var i = 0; i < this.Count; i++)
{
var tab = this[i];
if (DragState.DragActive && ReferenceEquals(tab, draggedTab))
{
continue;
}
if (DragState.DragActive && draggedTab != null)
{
if (dragHandled == false)
{
var centerPoint = x + tab.DesiredSize.Width / 2;
if (centerPoint > DragState.DraggedTabOffset)
{
x += draggedTab.DesiredSize.WidthInt - NotebookTabOverlapX;
dragHandled = true;
}
}
}
tab.Arrange(new Rectangle(x, layoutSize.Bottom - tab.DesiredSize.HeightInt, tab.DesiredSize.WidthInt, tab.DesiredSize.HeightInt));
x += tab.DesiredSize.WidthInt - NotebookTabOverlapX;
}
if (Count > 0)
{
// correct for last tab overlap area.
x += NotebookTabOverlapX;
}
if (DragState.DragActive && draggedTab != null)
{
var dx = (int)MathHelper.Clamp(DragState.DraggedTabOffset, layoutSize.Left, x);
var dy = layoutSize.Bottom - draggedTab.DesiredSize.HeightInt;
draggedTab.Arrange(new Rectangle(dx, dy, draggedTab.DesiredSize.WidthInt, draggedTab.DesiredSize.HeightInt));
}
return layoutSize;
}
protected override void DrawChildren(IBatchedDrawingService drawingService)
{
for (var i = 0; i < this.Count; i++)
{
var child = this[i];
if (ReferenceEquals(child, ActiveTab))
{
continue;
}
if (DragState.DragActive && ReferenceEquals(child, DragState.DraggedTab))
{
continue;
}
if (child.Visibility == Visibility.Visible)
{
child.Draw(drawingService);
}
}
if (ActiveTab?.Visibility == Visibility.Visible)
{
ActiveTab.Draw(drawingService);
}
if (DragState.DragActive && DragState.DraggedTab != ActiveTab)
{
DragState.DraggedTab?.Draw(drawingService);
}
}
protected override Size MeasureOverride(Size availableSize)
{
float height = 0;
float width = 0;
for (var i = 0; i < Count; i++)
{
var tab = this[i];
tab.Measure(availableSize);
width += tab.DesiredSize.Width;
height = Math.Max(height, tab.DesiredSize.Height);
}
width += NotebookTabOverlapX * Math.Max(0, Count - 1);
return new Size(width, height);
}
protected override void OnChildAdded(IWidget w, int index, bool constraint)
{
base.OnChildAdded(w, index, constraint);
DragState.Install(w);
if (w is INotebookTab)
{
var tab = (INotebookTab)w;
tab.CloseRequested += OnCloseRequested;
tab.ActivationRequested += OnActivationRequested;
}
if (ActiveTab == null)
{
ActiveTab = (NotebookTab)w;
}
}
protected override void OnChildRemoved(IWidget w, int index, bool constraint)
{
base.OnChildRemoved(w, index, constraint);
DragState.Uninstall(w);
if (w is INotebookTab)
{
var tab = (INotebookTab)w;
tab.CloseRequested -= OnCloseRequested;
tab.ActivationRequested -= OnActivationRequested;
}
if (Count > 0)
{
var nextIndex = Math.Min(Count - 1, index + 1);
ActiveTab = (NotebookTab)this[nextIndex];
}
else
{
ActiveTab = null;
}
}
void OnActivationRequested(object sender, EventArgs args)
{
var tab = sender as INotebookTab;
if (tab == null)
{
return;
}
if (tab.Parent != this)
{
return;
}
ActivateTab(tab);
}
void OnCloseRequested(object sender, EventArgs args)
{
var tab = sender as INotebookTab;
if (tab == null)
{
return;
}
if (tab.Parent != this)
{
return;
}
CloseTab(tab);
}
/// <summary>
/// Public to allow deep testing.
/// </summary>
public class DragNDropState
{
readonly NotebookTabList parent;
public DragNDropState(NotebookTabList parent)
{
this.parent = parent;
}
public bool DragActive { get; private set; }
public NotebookTab DraggedTab { get; private set; }
public float DraggedTabEventOrigin { get; private set; }
public float DraggedTabOffset { get; private set; }
public float DraggedTabOffsetOrigin { get; private set; }
public void Install(IWidget widget)
{
widget.MouseDown += OnMouseDown;
widget.MouseDragged += OnMouseDragged;
widget.MouseUp += OnMouseUp;
}
public void Uninstall(IWidget widget)
{
widget.MouseDown -= OnMouseDown;
widget.MouseDragged -= OnMouseDragged;
widget.MouseUp -= OnMouseUp;
}
int FindInsertIndex()
{
var retval = 0;
for (var i = 0; i < parent.Count; i++)
{
var tab = parent[i];
if (ReferenceEquals(tab, DraggedTab))
{
retval += 1;
continue;
}
if (tab.LayoutRect.Center.X < DraggedTabOffset)
{
retval += 1;
continue;
}
return retval;
}
return retval;
}
void OnMouseDown(object sender, MouseEventArgs args)
{
if (args.Button != MouseButton.Left || parent.AllowDragReorder == false)
{
return;
}
DraggedTab = sender as NotebookTab;
if (DraggedTab != null)
{
DraggedTabOffsetOrigin = DraggedTab.LayoutRect.X;
DraggedTabEventOrigin = args.Position.X;
DraggedTabOffset = DraggedTab.LayoutRect.X;
}
args.Consume();
}
void OnMouseDragged(object sender, MouseEventArgs args)
{
if (DraggedTab != null)
{
var deltaX = args.Position.X - DraggedTabEventOrigin;
if (Math.Abs(deltaX) > 5)
{
DragActive = true;
}
DraggedTabOffset = DraggedTabOffsetOrigin + deltaX;
parent.InvalidateLayout();
args.Consume();
}
}
void OnMouseUp(object sender, MouseEventArgs args)
{
if (DraggedTab == null || DragActive == false)
{
return;
}
args.Consume();
var idx = parent.IndexOf(DraggedTab);
if (idx == -1)
{
DraggedTab = null;
return;
}
var insertIdx = FindInsertIndex();
if (insertIdx != idx)
{
var focused = parent.Screen?.FocusManager?.FocusedWidget;
var activeTab = parent.ActiveTab;
parent.Remove(DraggedTab);
var newIndex = FindInsertIndex();
parent.Add(DraggedTab, newIndex);
if (focused != null)
{
parent.Screen.FocusManager.FocusedWidget = focused;
}
parent.ActiveTab = activeTab;
parent.InvalidateLayout();
}
DragActive = false;
DraggedTab = null;
DraggedTabOffset = 0;
DraggedTabOffsetOrigin = 0;
DraggedTabEventOrigin = 0;
}
}
}
} | 26.423503 | 138 | 0.591088 | [
"MIT"
] | RabbitStewDio/Steropes.UI | src/Steropes.UI/Widgets/NotebookTabList.cs | 11,920 | C# |
using MediatR;
namespace ELearning.Application.Users.Queries.GetUsersList
{
public class GetUsersListQuery : IRequest<UsersListViewModel>
{
}
}
| 17.555556 | 65 | 0.753165 | [
"MIT"
] | MKafar/ELearning | ELearning.Application/Users/Queries/GetUsersList/GetUsersListQuery.cs | 160 | C# |
namespace Northwind.Data
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
[Table("Customers")]
public class Customer
{
[Key]
[Column("Customer ID")]
[MaxLength(5)]
public string Id { get; set; }
[Required]
[Column("Company Name")]
[MaxLength(5)]
public string Name { get; set; }
public virtual Contact Contact { get; set; }
[MaxLength(60)]
public string Address { get; set; }
[MaxLength(15)]
public string City { get; set; }
[MaxLength(15)]
public string Region { get; set; }
[Column("Postal Code")]
[MaxLength(10)]
public string PostalCode { get; set; }
[MaxLength(15)]
public string Country { get; set; }
[MaxLength(24)]
public string Phone { get; set; }
[MaxLength(24)]
public string Fax { get; set; }
}
}
| 22.630435 | 55 | 0.558117 | [
"MIT"
] | achingono/Northwind.Web.WebPages | Northwind.Data/Customer.cs | 1,041 | C# |
namespace _04.CubicMessages
{
using System;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
public class CubicMessages
{
public static void Main()
{
var pattern = @"^(?<leftPart>\d+)(?<message>[a-zA-Z]+)(?<rightPart>[^a-zA-Z]*)$";
var messageRegex = new Regex(pattern);
while (true)
{
var line = Console.ReadLine();
if (line == "Over!")
{
break;
}
var messageMatch = messageRegex.Match(line);
if (!messageMatch.Success)
{
continue;
}
var leftPart = messageMatch.Groups["leftPart"].Value;
var message = messageMatch.Groups["message"].Value;
var rightPart = messageMatch.Groups["rightPart"].Value;
var messageLength = int.Parse(Console.ReadLine());
if (messageLength != message.Length)
{
continue;
}
//var verificationCode = new string((leftPart + rightPart)
// .Where(char.IsDigit)
// .Select(@char => int.Parse(@char.ToString()))
// .Select(index => index >= 0 && index < message.Length ? message[index] : ' ')
// .ToArray());
// FROM HERE
var verificationCode = new StringBuilder();
foreach (var @char in leftPart+ rightPart)
{
if (!char.IsDigit(@char))
{
continue;
}
var index = int.Parse(@char.ToString());
var isValidIndex = index >= 0 && index < message.Length;
if (isValidIndex)
{
verificationCode.Append(message[index]);
}
else
{
verificationCode.Append(' ');
}
}
// TO HERE IS THE SAME AS UPPER!!!
Console.WriteLine($"{message} == {verificationCode}");
}
}
}
}
| 31.346667 | 99 | 0.415142 | [
"MIT"
] | TsvetanNikolov123/CSharp---Programming-Fundamentals | Exam Preparation IV/04.CubicMessages/CubicMessages.cs | 2,353 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void AddWideningLower_Vector64_SByte()
{
var test = new SimpleBinaryOpTest__AddWideningLower_Vector64_SByte();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleBinaryOpTest__AddWideningLower_Vector64_SByte
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle outHandle;
private ulong alignment;
public DataTable(SByte[] inArray1, SByte[] inArray2, Int16[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<SByte>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int16>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<SByte, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<SByte> _fld1;
public Vector64<SByte> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>());
return testStruct;
}
public void RunStructFldScenario(SimpleBinaryOpTest__AddWideningLower_Vector64_SByte testClass)
{
var result = AdvSimd.AddWideningLower(_fld1, _fld2);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleBinaryOpTest__AddWideningLower_Vector64_SByte testClass)
{
fixed (Vector64<SByte>* pFld1 = &_fld1)
fixed (Vector64<SByte>* pFld2 = &_fld2)
{
var result = AdvSimd.AddWideningLower(
AdvSimd.LoadVector64((SByte*)(pFld1)),
AdvSimd.LoadVector64((SByte*)(pFld2))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
private static Vector64<SByte> _clsVar1;
private static Vector64<SByte> _clsVar2;
private Vector64<SByte> _fld1;
private Vector64<SByte> _fld2;
private DataTable _dataTable;
static SimpleBinaryOpTest__AddWideningLower_Vector64_SByte()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>());
}
public SimpleBinaryOpTest__AddWideningLower_Vector64_SByte()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
_dataTable = new DataTable(_data1, _data2, new Int16[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.AddWideningLower(
Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<SByte>>(_dataTable.inArray2Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.AddWideningLower(
AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((SByte*)(_dataTable.inArray2Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddWideningLower), new Type[] { typeof(Vector64<SByte>), typeof(Vector64<SByte>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<SByte>>(_dataTable.inArray2Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int16>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddWideningLower), new Type[] { typeof(Vector64<SByte>), typeof(Vector64<SByte>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((SByte*)(_dataTable.inArray2Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int16>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.AddWideningLower(
_clsVar1,
_clsVar2
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<SByte>* pClsVar1 = &_clsVar1)
fixed (Vector64<SByte>* pClsVar2 = &_clsVar2)
{
var result = AdvSimd.AddWideningLower(
AdvSimd.LoadVector64((SByte*)(pClsVar1)),
AdvSimd.LoadVector64((SByte*)(pClsVar2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector64<SByte>>(_dataTable.inArray2Ptr);
var result = AdvSimd.AddWideningLower(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr));
var op2 = AdvSimd.LoadVector64((SByte*)(_dataTable.inArray2Ptr));
var result = AdvSimd.AddWideningLower(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleBinaryOpTest__AddWideningLower_Vector64_SByte();
var result = AdvSimd.AddWideningLower(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleBinaryOpTest__AddWideningLower_Vector64_SByte();
fixed (Vector64<SByte>* pFld1 = &test._fld1)
fixed (Vector64<SByte>* pFld2 = &test._fld2)
{
var result = AdvSimd.AddWideningLower(
AdvSimd.LoadVector64((SByte*)(pFld1)),
AdvSimd.LoadVector64((SByte*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.AddWideningLower(_fld1, _fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<SByte>* pFld1 = &_fld1)
fixed (Vector64<SByte>* pFld2 = &_fld2)
{
var result = AdvSimd.AddWideningLower(
AdvSimd.LoadVector64((SByte*)(pFld1)),
AdvSimd.LoadVector64((SByte*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.AddWideningLower(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.AddWideningLower(
AdvSimd.LoadVector64((SByte*)(&test._fld1)),
AdvSimd.LoadVector64((SByte*)(&test._fld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<SByte> op1, Vector64<SByte> op2, void* result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), op2);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
Int16[] outArray = new Int16[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<SByte>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<SByte>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int16>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(SByte[] left, SByte[] right, Int16[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (var i = 0; i < RetElementCount; i++)
{
if (Helpers.AddWidening(left[i], right[i]) != result[i])
{
succeeded = false;
break;
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.AddWideningLower)}<Int16>(Vector64<SByte>, Vector64<SByte>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| 42.190566 | 185 | 0.585886 | [
"MIT"
] | 2m0nd/runtime | src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/AddWideningLower.Vector64.SByte.cs | 22,361 | C# |
/*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
using System;
using System.Net;
using Amazon.Runtime;
namespace Amazon.ElastiCache.Model
{
///<summary>
/// AmazonElastiCache exception
/// </summary>
public class ReplicationGroupAlreadyExistsException : AmazonElastiCacheException
{
/// <summary>
/// Constructs a new ReplicationGroupAlreadyExistsException with the specified error
/// message.
/// </summary>
/// <param name="message">
/// Describes the error encountered.
/// </param>
internal ReplicationGroupAlreadyExistsException(string message)
: base(message) {}
internal ReplicationGroupAlreadyExistsException(string message, Exception innerException)
: base(message, innerException) {}
internal ReplicationGroupAlreadyExistsException(Exception innerException)
: base(innerException) {}
internal ReplicationGroupAlreadyExistsException(string message, Exception innerException, ErrorType errorType, string errorCode, string RequestId, HttpStatusCode statusCode)
: base(message, innerException, errorType, errorCode, RequestId, statusCode) {}
internal ReplicationGroupAlreadyExistsException(string message, ErrorType errorType, string errorCode, string RequestId, HttpStatusCode statusCode)
: base(message, errorType, errorCode, RequestId, statusCode) {}
}
}
| 39.980392 | 182 | 0.69642 | [
"Apache-2.0"
] | jdluzen/aws-sdk-net-android | AWSSDK/Amazon.ElastiCache/Model/ReplicationGroupAlreadyExistsException.cs | 2,039 | C# |
using LionFrame.Basic.Models;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Text;
namespace LionFrame.Basic
{
/// <summary>
/// 图形验证码工具类
/// </summary>
public static class CaptchaHelper
{
const string Letters = "2346789ABCDEFGHJKLMNPRTUVWXYZ";
/// <summary>
/// 生成带字母的验证码 -- 去除了混淆字母
/// </summary>
/// <param name="length"></param>
/// <returns></returns>
public static string GenerateCaptchaCode(int length = 4)
{
Random rand = new Random();
int maxRand = Letters.Length - 1;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++)
{
int index = rand.Next(maxRand);
sb.Append(Letters[index]);
}
return sb.ToString();
}
/// <summary>
/// 生成指定位数的随机数字码
/// </summary>
/// <param name="length"></param>
/// <returns></returns>
public static string CreateRandomNumber(int length)
{
Random random = new Random();
StringBuilder sbMsgCode = new StringBuilder();
for (int i = 0; i < length; i++)
{
sbMsgCode.Append(random.Next(0, 9));
}
return sbMsgCode.ToString();
}
/// <summary>
/// 创建验证码图片
/// </summary>
/// <param name="captcha"></param>
/// <returns></returns>
public static CaptchaResult CreateVerifyCodeImage(string captcha)
{
int codeW = 80;
int codeH = 30;
int fontSize = 16;
Color[] color = { Color.Black, Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Brown, Color.DarkBlue, Color.CornflowerBlue };
string[] font = { "Times New Roman" };
//生成验证码字符串
Random rnd = new Random(Guid.NewGuid().GetHashCode());
//创建画布
Bitmap bmp = new Bitmap(codeW, codeH);
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.Linen);
//画噪线
for (int i = 0; i < 3; i++)
{
int x1 = rnd.Next(codeW);
int y1 = rnd.Next(codeH);
int x2 = rnd.Next(codeW);
int y2 = rnd.Next(codeH);
Color clr = color[rnd.Next(color.Length)];
g.DrawLine(new Pen(clr), x1, y1, x2, y2);
}
//画验证码
for (int i = 0; i < captcha.Length; i++)
{
string fnt = font[rnd.Next(font.Length)];
Font ft = new Font(fnt, fontSize);
Color clr = color[rnd.Next(color.Length)];
g.DrawString(captcha[i].ToString(), ft, new SolidBrush(clr), (float)i * 18, (float)0);
}
//将验证码写入图片内存流中,以image/png格式输出
MemoryStream ms = new MemoryStream();
try
{
bmp.Save(ms, ImageFormat.Png);
return new CaptchaResult
{
Captcha = captcha,
CaptchaBase64Data = ms.ToArray(),
Timestamp = DateTime.Now
};
}
catch (Exception)
{
return null;
}
finally
{
ms.Close();
ms.Dispose();
g.Dispose();
bmp.Dispose();
}
}
#region 绘制验证码
///// <summary>
///// 绘制验证码
///// </summary>
//public static CaptchaResult CreateImage(string captcha, int letterWidth = 16, int letterHeight = 20)
//{
// Random rand = new Random(Guid.NewGuid().GetHashCode());
// int intImageWidth = captcha.Length * letterWidth;
// Bitmap image = new Bitmap(intImageWidth, letterHeight);
// Graphics g = Graphics.FromImage(image);
// g.Clear(Color.White);
// for (int i = 0; i < 4; i++)
// {
// int x1 = rand.Next(image.Width - 1);
// int x2 = rand.Next(image.Width - 1);
// int y1 = rand.Next(image.Height - 1);
// int y2 = rand.Next(image.Height - 1);
// g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
// }
// int _x = -12;
// Font[] fonts = {
// new Font(new FontFamily("Times New Roman"),10 +rand.Next(1),System.Drawing.FontStyle.Regular),
// new Font(new FontFamily("Georgia"), 10 + rand.Next(1),System.Drawing.FontStyle.Regular),
// new Font(new FontFamily("Arial"), 10 + rand.Next(1),System.Drawing.FontStyle.Regular),
// new Font(new FontFamily("Comic Sans MS"), 10 + rand.Next(1),System.Drawing.FontStyle.Regular)
// };
// for (int int_index = 0; int_index < captcha.Length; int_index++)
// {
// _x += rand.Next(12, 16);
// var _y = rand.Next(-2, 2);
// string str_char = captcha.Substring(int_index, 1);
// str_char = rand.Next(1) == 1 ? str_char.ToLower() : str_char.ToUpper();
// Brush newBrush = new SolidBrush(GetRandomColor());
// Point thePos = new Point(_x, _y);
// g.DrawString(str_char, fonts[rand.Next(fonts.Length - 1)], newBrush, thePos);
// }
// for (int i = 0; i < 10; i++)
// {
// int x = rand.Next(image.Width - 1);
// int y = rand.Next(image.Height - 1);
// image.SetPixel(x, y, Color.FromArgb(rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255)));
// }
// image = TwistImage(image, true, rand.Next(1, 3), rand.Next(4, 6));
// g.DrawRectangle(new Pen(Color.LightGray, 1), 0, 0, intImageWidth - 1, (letterHeight - 1));
// MemoryStream ms = new MemoryStream();
// image.Save(ms, ImageFormat.Png);
// return new CaptchaResult { Captcha = captcha, CaptchaByteData = ms.ToArray(), Timestamp = DateTime.Now };
//}
///// <summary>
///// 字体随机颜色
///// </summary>
//public static Color GetRandomColor()
//{
// var randomNum = new Random(Guid.NewGuid().GetHashCode());
// int intRed = randomNum.Next(180);
// int intGreen = randomNum.Next(180);
// int intBlue = (intRed + intGreen > 300) ? 0 : 400 - intRed - intGreen;
// intBlue = (intBlue > 255) ? 255 : intBlue;
// return Color.FromArgb(intRed, intGreen, intBlue);
//}
///// <summary>
///// 正弦曲线Wave扭曲图片
///// </summary>
///// <param name="srcBmp">图片路径</param>
///// <param name="bXDir">如果扭曲则选择为True</param>
///// <param name="dMultipleValue">波形的幅度倍数,越大扭曲的程度越高,一般为3</param>
///// <param name="dPhase">波形的起始相位,取值区间[0-2*PI)</param>
//public static Bitmap TwistImage(Bitmap srcBmp, bool bXDir, double dMultipleValue, double dPhase)
//{
// double PI = 6.283185307179586476925286766559;
// Bitmap destBmp = new Bitmap(srcBmp.Width, srcBmp.Height);
// Graphics graph = Graphics.FromImage(destBmp);
// graph.FillRectangle(new SolidBrush(Color.White), 0, 0, destBmp.Width, destBmp.Height);
// graph.Dispose();
// double dBaseAxisLen = bXDir ? (double)destBmp.Height : (double)destBmp.Width;
// for (int i = 0; i < destBmp.Width; i++)
// {
// for (int j = 0; j < destBmp.Height; j++)
// {
// double dx = 0;
// dx = bXDir ? (PI * (double)j) / dBaseAxisLen : (PI * (double)i) / dBaseAxisLen;
// dx += dPhase;
// double dy = Math.Sin(dx);
// int nOldX = bXDir ? i + (int)(dy * dMultipleValue) : i;
// int nOldY = bXDir ? j : j + (int)(dy * dMultipleValue);
// Color color = srcBmp.GetPixel(i, j);
// if (nOldX >= 0 && nOldX < destBmp.Width
// && nOldY >= 0 && nOldY < destBmp.Height)
// {
// destBmp.SetPixel(nOldX, nOldY, color);
// }
// }
// }
// srcBmp.Dispose();
// return destBmp;
//}
#endregion
}
}
| 39.096916 | 146 | 0.464451 | [
"MIT"
] | levy-w-wang/LionFrame | LionFrame.Basic/CaptchaHelper.cs | 9,171 | C# |
using System;
using System.Collections.Generic;
namespace KeyPayV2.Au.Enums
{
public enum PayRunWarningType
{
PaymentFile,
MoreLeaveThanAccrued,
UnpaidEarnings,
Birthday,
Anniversary,
NegativeEarnings,
PreviouslyTerminated,
TerminatedWithExpenseReimbursements,
ExpiredQualification,
DuplicateEarningsLines,
TaxCodeMissing,
Bpay,
LeaveYearCapReached,
AutoEnrolmentChanges,
EmployeePensionContributionRefund,
PensionSchemeRequiresAuthorization,
UkTaxCodeUpdate,
UkTaxCodeUpdateError,
NINOUnknown,
ProRataEarnings,
HmrcLateReasonWarning,
BelowMinimumWage,
ExpiredSpecialTaxRate,
ExpiredStudentLoanRate,
PendingLeaveRequest,
LeaveRequestBeyondPayPeriod,
PrecedingLeaveRequest,
IncompletePayRunTasks,
PendingExpenseRequests,
PayDayFiling,
PayDayFilingAmendment,
EmployeeInformation,
IrdSettings,
AutoUpdatedNICategory,
UkStudentLoanUpdate,
PensionProviderDoesNotAllowOverseasAddress,
MissingLeaveYearEntitlement,
LeaveRequestUnitTypeMismatch,
ExpiredNric,
ExcessOvertime,
ForeignEmployee,
ExcessDeductions,
TerminatedForeignEmployee,
StatutoryPaymentApplied,
StatutoryPaymentAppliedPrevious,
NationalInsuranceValidations,
MixedOffsets,
PendingSapPayment,
ScheduledUpdateApplied,
PensionSettingsUpdated,
TaxReliefThresholdExceeded,
UkNotNoticeUpdate,
EarningsAutomaticallyAdjusted,
EarningsRequireAdjustment,
UkTaxCodeP9Update,
HrdfEmployeeWarning,
NewPayrolledBenefits,
SubmitTerminatedEmployeeToHmrc
}
}
| 28.588235 | 52 | 0.649177 | [
"MIT"
] | hr-central/keypay-dotnet-v2 | src/keypay-dotnet/Au/Enums/PayRunWarningType.cs | 1,944 | C# |
using System.Globalization;
using System.Reflection;
using Avalonia;
namespace DHT.Desktop {
internal static class Program {
public static string Version { get; }
public static CultureInfo Culture { get; }
static Program() {
Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "";
while (Version.EndsWith(".0")) {
Version = Version[..^2];
}
Culture = CultureInfo.CurrentCulture;
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
}
public static void Main(string[] args) {
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
private static AppBuilder BuildAvaloniaApp() {
return AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
}
}
| 29.205882 | 81 | 0.72004 | [
"MIT"
] | SoftwareGuy/Discord-History-Tracker | app/Desktop/Program.cs | 995 | C# |
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /cgi-bin/template/get_all_private_template 接口的请求。</para>
/// </summary>
public class CgibinTemplateGetAllPrivateTemplateRequest : WechatApiRequest
{
}
}
| 26.2 | 79 | 0.694656 | [
"MIT"
] | ZUOXIANGE/DotNetCore.SKIT.FlurlHttpClient.Wechat | src/SKIT.FlurlHttpClient.Wechat.Api/Models/CgibinTemplate/CgibinTemplateGetAllPrivateTemplateRequest.cs | 280 | C# |
using BookingsApi.Contract.Responses;
using BookingsApi.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using Castle.Core.Internal;
namespace BookingsApi.Mappings
{
public class AudioRecordedHearingsBySearchResponseMapper
{
private const string ErrorMessage = "Hearing is missing case";
public List<AudioRecordedHearingsBySearchResponse> MapHearingToDetailedResponse(IEnumerable<Hearing> videoHearing,
string caseNumber)
{
if (videoHearing == null || !videoHearing.Any()) return new List<AudioRecordedHearingsBySearchResponse>();
var response = new List<AudioRecordedHearingsBySearchResponse>();
foreach (var hearing in videoHearing)
{
var judgeParticipant = hearing.GetParticipants()
.FirstOrDefault(s => s.HearingRole?.UserRole != null && s.HearingRole.UserRole.IsJudge);
var courtroomAccountName = judgeParticipant != null
? judgeParticipant.DisplayName
: string.Empty;
var courtroomAccount = (judgeParticipant?.Person != null)
? judgeParticipant.Person.Username
: string.Empty;
var @case = caseNumber.IsNullOrEmpty()
? hearing.GetCases().FirstOrDefault()
: hearing.GetCases()
.FirstOrDefault(c => c.Number.ToLower().Trim().Contains(caseNumber.ToLower().Trim()));
if (@case == null) throw new ArgumentException(ErrorMessage);
var hearingByCaseNumber = new AudioRecordedHearingsBySearchResponse()
{
Id = hearing.Id,
ScheduledDateTime = hearing.ScheduledDateTime,
HearingVenueName = hearing.HearingVenueName,
HearingRoomName = hearing.HearingRoomName,
CourtroomAccount = courtroomAccount,
CourtroomAccountName = courtroomAccountName,
CaseName = @case.Name,
CaseNumber = @case.Number,
GroupId = hearing.SourceId
};
response.Add(hearingByCaseNumber);
}
return response;
}
}
}
| 40.189655 | 122 | 0.590305 | [
"MIT"
] | hmcts/vh-bookings-api | BookingsApi/BookingsApi/Mappings/AudioRecordedHearingsBySearchResponseMapper.cs | 2,333 | C# |
/*
* Copyright © 2016-2018 EDDiscovery development team
*
* 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.
*
* EDDiscovery is not affiliated with Frontier Developments plc.
*/
using BaseUtils.JSON;
using System;
namespace EliteDangerousCore.JournalEvents
{
[JournalEntryType(JournalTypeEnum.Powerplay)]
public class JournalPowerplay : JournalEntry
{
public JournalPowerplay(JObject evt) : base(evt, JournalTypeEnum.Powerplay)
{
Power = evt["Power"].Str();
Rank = evt["Rank"].Int();
Merits = evt["Merits"].Int();
Votes = evt["Votes"].Int();
TimePledged = evt["TimePledged"].Long();
TimePledgedSpan = new TimeSpan((int)(TimePledged/60/60),(int)((TimePledged/60)%60),(int)(TimePledged%60));
TimePledgedString = TimePledgedSpan.ToString();
}
public string Power { get; set; }
public int Rank { get; set; }
public int Merits { get; set; }
public int Votes { get; set; }
public long TimePledged { get; set; }
public TimeSpan TimePledgedSpan { get; set; }
public string TimePledgedString { get; set; }
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = BaseUtils.FieldBuilder.Build("", Power, "Rank: ".T(EDTx.JournalEntry_Rank), Rank, "Merits: ".T(EDTx.JournalEntry_Merits), Merits, "Votes: ".T(EDTx.JournalEntry_Votes), Votes, "Pledged: ".T(EDTx.JournalEntry_Pledged), TimePledgedString);
detailed = "";
}
}
[JournalEntryType(JournalTypeEnum.PowerplayCollect)]
public class JournalPowerplayCollect : JournalEntry, ICommodityJournalEntry
{
public JournalPowerplayCollect(JObject evt) : base(evt, JournalTypeEnum.PowerplayCollect)
{
Power = evt["Power"].Str();
Type = JournalFieldNaming.FixCommodityName(evt["Type"].Str());
Type_Localised = JournalFieldNaming.CheckLocalisation(evt["Type_Localised"].Str(), Type);
Count = evt["Count"].Int();
}
public string Power { get; set; }
public string Type { get; set; }
public string Type_Localised { get; set; }
public int Count { get; set; }
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = BaseUtils.FieldBuilder.Build("", Power, "Type: ".T(EDTx.JournalEntry_Type), Type_Localised, "Count: ".T(EDTx.JournalEntry_Count), Count);
detailed = "";
}
public void UpdateCommodities(MaterialCommoditiesMicroResourceList mc, bool unusedinsrv)
{
mc.Change( EventTimeUTC, MaterialCommodityMicroResourceType.CatType.Commodity, Type, Count, 0);
}
}
[JournalEntryType(JournalTypeEnum.PowerplayDefect)]
public class JournalPowerplayDefect : JournalEntry
{
public JournalPowerplayDefect(JObject evt) : base(evt, JournalTypeEnum.PowerplayDefect)
{
FromPower = evt["FromPower"].Str();
ToPower = evt["ToPower"].Str();
}
public string FromPower { get; set; }
public string ToPower { get; set; }
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = BaseUtils.FieldBuilder.Build("From Power: ".T(EDTx.JournalEntry_FromPower), FromPower, "To Power: ".T(EDTx.JournalEntry_ToPower), ToPower);
detailed = "";
}
}
[JournalEntryType(JournalTypeEnum.PowerplayDeliver)]
public class JournalPowerplayDeliver : JournalEntry, ICommodityJournalEntry
{
public JournalPowerplayDeliver(JObject evt) : base(evt, JournalTypeEnum.PowerplayDeliver)
{
Power = evt["Power"].Str();
Type = JournalFieldNaming.FixCommodityName(evt["Type"].Str());
Type_Localised = JournalFieldNaming.CheckLocalisation(evt["Type_Localised"].Str(), Type);
Count = evt["Count"].Int();
}
public string Power { get; set; }
public string Type { get; set; }
public string Type_Localised { get; set; }
public int Count { get; set; }
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = BaseUtils.FieldBuilder.Build("", Power, "Type: ".T(EDTx.JournalEntry_Type), Type_Localised, "Count: ".T(EDTx.JournalEntry_Count), Count);
detailed = "";
}
public void UpdateCommodities(MaterialCommoditiesMicroResourceList mc, bool unusedinsrv)
{
mc.Change( EventTimeUTC, MaterialCommodityMicroResourceType.CatType.Commodity, Type, -Count, 0 );
}
}
[JournalEntryType(JournalTypeEnum.PowerplayFastTrack)]
public class JournalPowerplayFastTrack : JournalEntry, ILedgerJournalEntry
{
public JournalPowerplayFastTrack(JObject evt) : base(evt, JournalTypeEnum.PowerplayFastTrack)
{
Power = evt["Power"].Str();
Cost = evt["Cost"].Long();
}
public string Power { get; set; }
public long Cost { get; set; }
public void Ledger(Ledger mcl)
{
mcl.AddEvent(Id, EventTimeUTC, EventTypeID, Power, -Cost);
}
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = BaseUtils.FieldBuilder.Build("", Power, "Cost: ; cr;N0".T(EDTx.JournalEntry_Cost), Cost);
detailed = "";
}
}
[JournalEntryType(JournalTypeEnum.PowerplayJoin)]
public class JournalPowerplayJoin : JournalEntry
{
public JournalPowerplayJoin(JObject evt) : base(evt, JournalTypeEnum.PowerplayJoin)
{
Power = evt["Power"].Str();
}
public string Power { get; set; }
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = Power;
detailed = "";
}
}
[JournalEntryType(JournalTypeEnum.PowerplayLeave)]
public class JournalPowerplayLeave : JournalEntry
{
public JournalPowerplayLeave(JObject evt) : base(evt, JournalTypeEnum.PowerplayLeave)
{
Power = evt["Power"].Str();
}
public string Power { get; set; }
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = Power;
detailed = "";
}
}
[JournalEntryType(JournalTypeEnum.PowerplaySalary)]
public class JournalPowerplaySalary : JournalEntry, ILedgerJournalEntry
{
public JournalPowerplaySalary(JObject evt) : base(evt, JournalTypeEnum.PowerplaySalary)
{
Power = evt["Power"].Str();
Amount = evt["Amount"].Long();
}
public string Power { get; set; }
public long Amount { get; set; }
public void Ledger(Ledger mcl)
{
mcl.AddEvent(Id, EventTimeUTC, EventTypeID, Power, Amount);
}
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = BaseUtils.FieldBuilder.Build("", Power, "Amount: ; cr;N0".T(EDTx.JournalEntry_Amount), Amount);
detailed = "";
}
}
[JournalEntryType(JournalTypeEnum.PowerplayVote)]
public class JournalPowerplayVote : JournalEntry
{
public JournalPowerplayVote(JObject evt) : base(evt, JournalTypeEnum.PowerplayVote)
{
Power = evt["Power"].Str();
System = evt["System"].Str();
Votes = evt["Votes"].Int();
}
public string Power { get; set; }
public string System { get; set; }
public int Votes { get; set; }
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = BaseUtils.FieldBuilder.Build("", Power, "System: ".T(EDTx.JournalEntry_System), System, "Votes: ".T(EDTx.JournalEntry_Votes), Votes);
detailed = "";
}
}
[JournalEntryType(JournalTypeEnum.PowerplayVoucher)]
public class JournalPowerplayVoucher : JournalEntry
{
public JournalPowerplayVoucher(JObject evt) : base(evt, JournalTypeEnum.PowerplayVoucher)
{
Power = evt["Power"].Str();
Systems = evt["Systems"]?.ToObjectQ<string[]>();
}
public string Power { get; set; }
public string[] Systems { get; set; }
public override void FillInformation(ISystem sys, string whereami, out string info, out string detailed)
{
info = Power;
if (Systems != null)
{
info += ", Systems: ".T(EDTx.JournalEntry_Systems);
bool comma = false;
foreach (string s in Systems)
{
if (comma)
info += ", ";
comma = true;
info += s;
}
}
detailed = "";
}
}
}
| 38.159091 | 256 | 0.600159 | [
"Apache-2.0"
] | EDDiscovery/EliteDangerousCore | EliteDangerous/JournalEvents/JournalPowerplay.cs | 10,077 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the neptune-2014-10-31.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.Neptune.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
namespace Amazon.Neptune.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for DBClusterSnapshotAttribute Object
/// </summary>
public class DBClusterSnapshotAttributeUnmarshaller : IUnmarshaller<DBClusterSnapshotAttribute, XmlUnmarshallerContext>, IUnmarshaller<DBClusterSnapshotAttribute, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public DBClusterSnapshotAttribute Unmarshall(XmlUnmarshallerContext context)
{
DBClusterSnapshotAttribute unmarshalledObject = new DBClusterSnapshotAttribute();
int originalDepth = context.CurrentDepth;
int targetDepth = originalDepth + 1;
if (context.IsStartOfDocument)
targetDepth += 2;
while (context.ReadAtDepth(originalDepth))
{
if (context.IsStartElement || context.IsAttribute)
{
if (context.TestExpression("AttributeName", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.AttributeName = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("AttributeValues/AttributeValue", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
var item = unmarshaller.Unmarshall(context);
unmarshalledObject.AttributeValues.Add(item);
continue;
}
}
else if (context.IsEndElement && context.CurrentDepth < originalDepth)
{
return unmarshalledObject;
}
}
return unmarshalledObject;
}
/// <summary>
/// Unmarshaller error response to exception.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public DBClusterSnapshotAttribute Unmarshall(JsonUnmarshallerContext context)
{
return null;
}
private static DBClusterSnapshotAttributeUnmarshaller _instance = new DBClusterSnapshotAttributeUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static DBClusterSnapshotAttributeUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 36.471154 | 191 | 0.612708 | [
"Apache-2.0"
] | Bio2hazard/aws-sdk-net | sdk/src/Services/Neptune/Generated/Model/Internal/MarshallTransformations/DBClusterSnapshotAttributeUnmarshaller.cs | 3,793 | C# |
// c:\program files (x86)\windows kits\10\include\10.0.18362.0\shared\ks.h(2084,9)
using System;
using System.Runtime.InteropServices;
namespace DirectN
{
[StructLayout(LayoutKind.Sequential)]
public partial struct KSSTREAM_UVC_METADATATYPE_TIMESTAMP
{
public uint PresentationTimeStamp;
public uint SourceClockReference;
public __struct_ks_371__union_0 __union_2;
public ushort Reserved0;
public uint Reserved1;
}
}
| 27.941176 | 83 | 0.726316 | [
"MIT"
] | bbday/DirectN | DirectN/DirectN/Generated/KSSTREAM_UVC_METADATATYPE_TIMESTAMP.cs | 477 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epam.FinalTask.PhotoAlbum.Entities;
namespace Epam.FinalTask.PhotoAlbum.DAL.Contracts
{
public interface IUsersDao
{
User GetUserByUserName(string userName);
User GetUserById(int userId);
bool Add(User user);
bool Remove(User user);
bool BanUser(User user);
bool UnbanUser(User user);
bool PromoteToAdmin(User user);
bool DemoteToUser(User user);
}
}
| 19.241379 | 49 | 0.682796 | [
"MIT"
] | SergioPonomarev/XT-2018Q4 | Epam.FinalTask/Epam.FinalTask.PhotoAlbum.DAL.Contracts/IUsersDao.cs | 560 | C# |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Aws.Ec2TransitGateway
{
/// <summary>
/// Manages an EC2 Transit Gateway VPC Attachment. For examples of custom route table association and propagation, see the EC2 Transit Gateway Networking Examples Guide.
///
/// > This content is derived from https://github.com/terraform-providers/terraform-provider-aws/blob/master/website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown.
/// </summary>
public partial class VpcAttachment : Pulumi.CustomResource
{
/// <summary>
/// Whether DNS support is enabled. Valid values: `disable`, `enable`. Default value: `enable`.
/// </summary>
[Output("dnsSupport")]
public Output<string?> DnsSupport { get; private set; } = null!;
/// <summary>
/// Whether IPv6 support is enabled. Valid values: `disable`, `enable`. Default value: `disable`.
/// </summary>
[Output("ipv6Support")]
public Output<string?> Ipv6Support { get; private set; } = null!;
/// <summary>
/// Identifiers of EC2 Subnets.
/// </summary>
[Output("subnetIds")]
public Output<ImmutableArray<string>> SubnetIds { get; private set; } = null!;
/// <summary>
/// Key-value tags for the EC2 Transit Gateway VPC Attachment.
/// </summary>
[Output("tags")]
public Output<ImmutableDictionary<string, object>?> Tags { get; private set; } = null!;
/// <summary>
/// Boolean whether the VPC Attachment should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
/// </summary>
[Output("transitGatewayDefaultRouteTableAssociation")]
public Output<bool?> TransitGatewayDefaultRouteTableAssociation { get; private set; } = null!;
/// <summary>
/// Boolean whether the VPC Attachment should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
/// </summary>
[Output("transitGatewayDefaultRouteTablePropagation")]
public Output<bool?> TransitGatewayDefaultRouteTablePropagation { get; private set; } = null!;
/// <summary>
/// Identifier of EC2 Transit Gateway.
/// </summary>
[Output("transitGatewayId")]
public Output<string> TransitGatewayId { get; private set; } = null!;
/// <summary>
/// Identifier of EC2 VPC.
/// </summary>
[Output("vpcId")]
public Output<string> VpcId { get; private set; } = null!;
/// <summary>
/// Identifier of the AWS account that owns the EC2 VPC.
/// </summary>
[Output("vpcOwnerId")]
public Output<string> VpcOwnerId { get; private set; } = null!;
/// <summary>
/// Create a VpcAttachment resource with the given unique name, arguments, and options.
/// </summary>
///
/// <param name="name">The unique name of the resource</param>
/// <param name="args">The arguments used to populate this resource's properties</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public VpcAttachment(string name, VpcAttachmentArgs args, CustomResourceOptions? options = null)
: base("aws:ec2transitgateway/vpcAttachment:VpcAttachment", name, args ?? ResourceArgs.Empty, MakeResourceOptions(options, ""))
{
}
private VpcAttachment(string name, Input<string> id, VpcAttachmentState? state = null, CustomResourceOptions? options = null)
: base("aws:ec2transitgateway/vpcAttachment:VpcAttachment", name, state, MakeResourceOptions(options, id))
{
}
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
{
var defaultOptions = new CustomResourceOptions
{
Version = Utilities.Version,
};
var merged = CustomResourceOptions.Merge(defaultOptions, options);
// Override the ID if one was specified for consistency with other language SDKs.
merged.Id = id ?? merged.Id;
return merged;
}
/// <summary>
/// Get an existing VpcAttachment resource's state with the given name, ID, and optional extra
/// properties used to qualify the lookup.
/// </summary>
///
/// <param name="name">The unique name of the resulting resource.</param>
/// <param name="id">The unique provider ID of the resource to lookup.</param>
/// <param name="state">Any extra arguments used during the lookup.</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public static VpcAttachment Get(string name, Input<string> id, VpcAttachmentState? state = null, CustomResourceOptions? options = null)
{
return new VpcAttachment(name, id, state, options);
}
}
public sealed class VpcAttachmentArgs : Pulumi.ResourceArgs
{
/// <summary>
/// Whether DNS support is enabled. Valid values: `disable`, `enable`. Default value: `enable`.
/// </summary>
[Input("dnsSupport")]
public Input<string>? DnsSupport { get; set; }
/// <summary>
/// Whether IPv6 support is enabled. Valid values: `disable`, `enable`. Default value: `disable`.
/// </summary>
[Input("ipv6Support")]
public Input<string>? Ipv6Support { get; set; }
[Input("subnetIds", required: true)]
private InputList<string>? _subnetIds;
/// <summary>
/// Identifiers of EC2 Subnets.
/// </summary>
public InputList<string> SubnetIds
{
get => _subnetIds ?? (_subnetIds = new InputList<string>());
set => _subnetIds = value;
}
[Input("tags")]
private InputMap<object>? _tags;
/// <summary>
/// Key-value tags for the EC2 Transit Gateway VPC Attachment.
/// </summary>
public InputMap<object> Tags
{
get => _tags ?? (_tags = new InputMap<object>());
set => _tags = value;
}
/// <summary>
/// Boolean whether the VPC Attachment should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
/// </summary>
[Input("transitGatewayDefaultRouteTableAssociation")]
public Input<bool>? TransitGatewayDefaultRouteTableAssociation { get; set; }
/// <summary>
/// Boolean whether the VPC Attachment should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
/// </summary>
[Input("transitGatewayDefaultRouteTablePropagation")]
public Input<bool>? TransitGatewayDefaultRouteTablePropagation { get; set; }
/// <summary>
/// Identifier of EC2 Transit Gateway.
/// </summary>
[Input("transitGatewayId", required: true)]
public Input<string> TransitGatewayId { get; set; } = null!;
/// <summary>
/// Identifier of EC2 VPC.
/// </summary>
[Input("vpcId", required: true)]
public Input<string> VpcId { get; set; } = null!;
public VpcAttachmentArgs()
{
}
}
public sealed class VpcAttachmentState : Pulumi.ResourceArgs
{
/// <summary>
/// Whether DNS support is enabled. Valid values: `disable`, `enable`. Default value: `enable`.
/// </summary>
[Input("dnsSupport")]
public Input<string>? DnsSupport { get; set; }
/// <summary>
/// Whether IPv6 support is enabled. Valid values: `disable`, `enable`. Default value: `disable`.
/// </summary>
[Input("ipv6Support")]
public Input<string>? Ipv6Support { get; set; }
[Input("subnetIds")]
private InputList<string>? _subnetIds;
/// <summary>
/// Identifiers of EC2 Subnets.
/// </summary>
public InputList<string> SubnetIds
{
get => _subnetIds ?? (_subnetIds = new InputList<string>());
set => _subnetIds = value;
}
[Input("tags")]
private InputMap<object>? _tags;
/// <summary>
/// Key-value tags for the EC2 Transit Gateway VPC Attachment.
/// </summary>
public InputMap<object> Tags
{
get => _tags ?? (_tags = new InputMap<object>());
set => _tags = value;
}
/// <summary>
/// Boolean whether the VPC Attachment should be associated with the EC2 Transit Gateway association default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
/// </summary>
[Input("transitGatewayDefaultRouteTableAssociation")]
public Input<bool>? TransitGatewayDefaultRouteTableAssociation { get; set; }
/// <summary>
/// Boolean whether the VPC Attachment should propagate routes with the EC2 Transit Gateway propagation default route table. This cannot be configured or perform drift detection with Resource Access Manager shared EC2 Transit Gateways. Default value: `true`.
/// </summary>
[Input("transitGatewayDefaultRouteTablePropagation")]
public Input<bool>? TransitGatewayDefaultRouteTablePropagation { get; set; }
/// <summary>
/// Identifier of EC2 Transit Gateway.
/// </summary>
[Input("transitGatewayId")]
public Input<string>? TransitGatewayId { get; set; }
/// <summary>
/// Identifier of EC2 VPC.
/// </summary>
[Input("vpcId")]
public Input<string>? VpcId { get; set; }
/// <summary>
/// Identifier of the AWS account that owns the EC2 VPC.
/// </summary>
[Input("vpcOwnerId")]
public Input<string>? VpcOwnerId { get; set; }
public VpcAttachmentState()
{
}
}
}
| 42.695313 | 266 | 0.621134 | [
"ECL-2.0",
"Apache-2.0"
] | dixler/pulumi-aws | sdk/dotnet/Ec2transitgateway/VpcAttachment.cs | 10,930 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nwazet.Commerce.Models;
using Orchard.ContentManagement.Handlers;
using Orchard.Environment.Extensions;
namespace Nwazet.Commerce.Handlers {
[OrchardFeature("Nwazet.AdvancedSKUManagement")]
public class AdvancedSKUsSiteSettingPartHandler : ContentHandler {
public AdvancedSKUsSiteSettingPartHandler() {
Filters.Add(new ActivatingFilter<AdvancedSKUsSiteSettingPart>("Site"));
}
}
}
| 28.736842 | 83 | 0.771062 | [
"BSD-3-Clause"
] | LaserSrl/Nwazet.Commerce | Handlers/AdvancedSKUsSiteSettingPartHandler.cs | 548 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Destroyer : MonoBehaviour
{
[SerializeField] private float lifeTimer;
private bool isDestroyMe = false;
private void Start()
{
if (lifeTimer > 0.01f)
{
Destroy(gameObject, lifeTimer);
}
}
void Update()
{
if (isDestroyMe)
{
//Debug.Log("line destroy");
Destroy(gameObject);
}
}
public void DestroyMe()
{
isDestroyMe = true;
}
}
| 17 | 45 | 0.55615 | [
"MIT"
] | omf2333/42019801GameProgramming | Assets/Scripts/Destroyer.cs | 563 | C# |
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;
namespace ToolKit.OData
{
/// <summary>
/// An OData Response Object.
/// </summary>
public class ODataResponse
{
/// <summary>
/// Gets or sets the Context for the OData response.
/// </summary>
[JsonProperty("@odata.context")]
public string Context { get; protected set; }
/// <summary>
/// Gets the HTTP Status code.
/// </summary>
public int StatusCode { get; internal set; }
/// <summary>
/// Gets or sets the collection of values returned.
/// </summary>
[JsonProperty("value")]
[SuppressMessage(
"Usage",
"CA2227:Collection properties should be read only",
Justification = "JSON Deserializing requires this property to be settable.")]
public List<object> Value { get; protected set; }
/// <summary>
/// Gets or sets any warnings related to the OData request.
/// </summary>
[JsonProperty("@vsts.warnings")]
[SuppressMessage(
"Usage",
"CA2227:Collection properties should be read only",
Justification = "JSON Deserializing requires this property to be settable.")]
public List<string> Warnings { get; protected set; }
/// <summary>
/// Create a new instance of the <see cref="ODataResponse" /> class.
/// </summary>
/// <param name="json">The string containing the JSON.</param>
/// <returns>An object containing the data.</returns>
public static ODataResponse Create(string json)
{
var response = JsonConvert.DeserializeObject<ODataResponse>(json);
response.StatusCode = 200;
return response;
}
}
}
| 32.842105 | 89 | 0.584402 | [
"Apache-2.0"
] | dcjulian29/toolkit | ToolKit/OData/ODataResponse.cs | 1,872 | C# |
namespace Alipay.AopSdk.Core.Response
{
/// <summary>
/// AlipayEcoCplifeBillSyncResponse.
/// </summary>
public class AlipayEcoCplifeBillSyncResponse : AopResponse
{
}
}
| 19.5 | 62 | 0.671795 | [
"MIT"
] | leixf2005/Alipay.AopSdk.Core | Alipay.AopSdk.Core/Response/AlipayEcoCplifeBillSyncResponse.cs | 195 | C# |
/////////////////////////////////////////////////////////////////////////////////
//
// Photoshop PSD FileType Plugin for Paint.NET
// http://psdplugin.codeplex.com/
//
// This software is provided under the MIT License:
// Copyright (c) 2006-2007 Frank Blumenberg
// Copyright (c) 2010-2012 Tao Yue
//
// See LICENSE.txt for complete licensing and attribution information.
//
/////////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PhotoshopFile
{
public static class PsdBlendMode
{
public const string Normal = "norm";
public const string Darken = "dark";
public const string Lighten = "lite";
public const string Hue = "hue ";
public const string Saturation = "sat ";
public const string Color = "colr";
public const string Luminosity = "lum ";
public const string Multiply = "mul ";
public const string Screen = "scrn";
public const string Dissolve = "diss";
public const string Overlay = "over";
public const string HardLight = "hLit";
public const string SoftLight = "sLit";
public const string Difference = "diff";
public const string Exclusion = "smud";
public const string ColorDodge = "div ";
public const string ColorBurn = "idiv";
public const string LinearBurn = "lbrn";
public const string LinearDodge = "lddg";
public const string VividLight = "vLit";
public const string LinearLight = "lLit";
public const string PinLight = "pLit";
public const string HardMix = "hMix";
public const string PassThrough = "pass";
public const string DarkerColor = "dkCl";
public const string LighterColor = "lgCl";
public const string Subtract = "fsub";
public const string Divide = "fdiv";
}
}
| 34.716981 | 82 | 0.628804 | [
"BSD-3-Clause"
] | 0x00000FF/PsdPlugin | PsdFile/PsdBlendMode.cs | 1,842 | C# |
#region Copyright
// MIT License
//
// Copyright (c) 2020 Ivan Bondy
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion
namespace ApexLoader
{
#region using
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
#endregion
public class CookieDelegateHandler : DelegatingHandler
{
public string AccessCookie { get; set; }
//private readonly IHttpContextAccessor httpContextAccessor;
//private ISession Session;
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (!string.IsNullOrEmpty(AccessCookie))
{
request.Headers.Add("Cookie", AccessCookie);
}
return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
}
}
} | 36.339623 | 133 | 0.720665 | [
"MIT"
] | ibondy/ApexLoader | CookieDelegateHandler.cs | 1,928 | C# |
using AnimalCentre.Models.Contracts;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace AnimalCentre.Models.Services
{
public abstract class Procedure : IProcedure
{
protected IList<IAnimal> procedureHistory;
protected Procedure()
{
this.procedureHistory = new List<IAnimal>();
}
public string History()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine(this.GetType().Name);
string[] animalsInfo = procedureHistory
.OrderBy(a => a.Name)
.Select(a => a.ToString())
.ToArray();
sb.AppendLine(string.Join(Environment.NewLine, animalsInfo));
string result = sb.ToString().TrimEnd();
return result;
}
public abstract void DoService(IAnimal animal, int procedureTime);
protected void CheckTime(int time, IAnimal animal)
{
if (time <= animal.ProcedureTime)
{
animal.ProcedureTime -= time;
}
else
{
throw new ArgumentException("Animal doesn't have enough procedure time");
}
}
}
}
| 26.895833 | 89 | 0.55151 | [
"MIT"
] | borisbotev/SoftUni | C# OOP Basics/10.Exam- AnimalCentre/AnimalCentre/Models/Services/Procedure.cs | 1,293 | C# |
using System.Collections.Generic;
using System.Linq;
using Gatsby.Analysis.Diagnostics;
using Gatsby.Analysis.Syntax.Tree;
namespace Gatsby.Analysis.Syntax.Lexer
{
public sealed class SyntaxToken : SyntaxNode
{
public SyntaxToken(TokenType kind, int position, string text, object value)
{
Kind = kind;
Position = position;
Text = text;
Value = value;
}
public override TokenType Kind { get; }
public int Position { get; }
public string Text { get; }
public object Value { get; }
public TextSpan Span => new TextSpan(Position, Text.Length);
public override IEnumerable<SyntaxNode> GetChildren()
{
return Enumerable.Empty<SyntaxNode>();
}
}
} | 27.689655 | 83 | 0.612702 | [
"MIT"
] | sample1561/gatsby | Gatsby/Analysis/Syntax/Lexer/SyntaxToken.cs | 803 | C# |
/*******************************************************************************
* Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* *****************************************************************************
*
* AWS Tools for Windows (TM) PowerShell (TM)
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using Amazon.PowerShell.Common;
using Amazon.Runtime;
using Amazon.EC2;
using Amazon.EC2.Model;
namespace Amazon.PowerShell.Cmdlets.EC2
{
/// <summary>
/// Describes the events for the specified EC2 Fleet during the specified time.
///
///
/// <para>
/// EC2 Fleet events are delayed by up to 30 seconds before they can be described. This
/// ensures that you can query by the last evaluated time and not miss a recorded event.
/// EC2 Fleet events are available for 48 hours.
/// </para><br/><br/>This cmdlet automatically pages all available results to the pipeline - parameters related to iteration are only needed if you want to manually control the paginated output. To disable autopagination, use -NoAutoIteration.
/// </summary>
[Cmdlet("Get", "EC2FleetHistory")]
[OutputType("Amazon.EC2.Model.HistoryRecordEntry")]
[AWSCmdlet("Calls the Amazon Elastic Compute Cloud (EC2) DescribeFleetHistory API operation.", Operation = new[] {"DescribeFleetHistory"}, SelectReturnType = typeof(Amazon.EC2.Model.DescribeFleetHistoryResponse))]
[AWSCmdletOutput("Amazon.EC2.Model.HistoryRecordEntry or Amazon.EC2.Model.DescribeFleetHistoryResponse",
"This cmdlet returns a collection of Amazon.EC2.Model.HistoryRecordEntry objects.",
"The service call response (type Amazon.EC2.Model.DescribeFleetHistoryResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class GetEC2FleetHistoryCmdlet : AmazonEC2ClientCmdlet, IExecutor
{
#region Parameter EventType
/// <summary>
/// <para>
/// <para>The type of events to describe. By default, all events are described.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[AWSConstantClassSource("Amazon.EC2.FleetEventType")]
public Amazon.EC2.FleetEventType EventType { get; set; }
#endregion
#region Parameter FleetId
/// <summary>
/// <para>
/// <para>The ID of the EC2 Fleet.</para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String FleetId { get; set; }
#endregion
#region Parameter UtcStartTime
/// <summary>
/// <para>
/// <para>The start date and time for the events, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.DateTime? UtcStartTime { get; set; }
#endregion
#region Parameter MaxResult
/// <summary>
/// <para>
/// <para>The maximum number of results to return in a single call. Specify a value between
/// 1 and 1000. The default value is 1000. To retrieve the remaining results, make another
/// call with the returned <code>NextToken</code> value.</para>
/// </para>
/// <para>
/// <br/><b>Note:</b> In AWSPowerShell and AWSPowerShell.NetCore this parameter is used to limit the total number of items returned by the cmdlet.
/// <br/>In AWS.Tools this parameter is simply passed to the service to specify how many items should be returned by each service call.
/// <br/>Pipe the output of this cmdlet into Select-Object -First to terminate retrieving data pages early and control the number of items returned.
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("MaxItems","MaxResults")]
public int? MaxResult { get; set; }
#endregion
#region Parameter NextToken
/// <summary>
/// <para>
/// <para>The token for the next set of results.</para>
/// </para>
/// <para>
/// <br/><b>Note:</b> This parameter is only used if you are manually controlling output pagination of the service API call.
/// <br/>In order to manually control output pagination, use '-NextToken $null' for the first call and '-NextToken $AWSHistory.LastServiceResponse.NextToken' for subsequent calls.
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String NextToken { get; set; }
#endregion
#region Parameter StartTime
/// <summary>
/// <para>
/// <para>This property is deprecated. Setting this property results in non-UTC DateTimes not
/// being marshalled correctly. Use StartTimeUtc instead. Setting either StartTime or
/// StartTimeUtc results in both StartTime and StartTimeUtc being assigned, the latest
/// assignment to either one of the two property is reflected in the value of both. StartTime
/// is provided for backwards compatibility only and assigning a non-Utc DateTime to it
/// results in the wrong timestamp being passed to the service.</para><para>The start date and time for the events, in UTC format (for example, <i>YYYY</i>-<i>MM</i>-<i>DD</i>T<i>HH</i>:<i>MM</i>:<i>SS</i>Z).</para>
/// </para>
/// <para>This parameter is deprecated.</para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[System.ObsoleteAttribute("This parameter is deprecated and may result in the wrong timestamp being passed to the service, use UtcStartTime instead.")]
public System.DateTime? StartTime { get; set; }
#endregion
#region Parameter Select
/// <summary>
/// Use the -Select parameter to control the cmdlet output. The default value is 'HistoryRecords'.
/// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.EC2.Model.DescribeFleetHistoryResponse).
/// Specifying the name of a property of type Amazon.EC2.Model.DescribeFleetHistoryResponse will result in that property being returned.
/// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public string Select { get; set; } = "HistoryRecords";
#endregion
#region Parameter NoAutoIteration
/// <summary>
/// By default the cmdlet will auto-iterate and retrieve all results to the pipeline by performing multiple
/// service calls. If set, the cmdlet will retrieve only the next 'page' of results using the value of NextToken
/// as the start point.
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter NoAutoIteration { get; set; }
#endregion
protected override void ProcessRecord()
{
base.ProcessRecord();
var context = new CmdletContext();
// allow for manipulation of parameters prior to loading into context
PreExecutionContextLoad(context);
if (ParameterWasBound(nameof(this.Select)))
{
context.Select = CreateSelectDelegate<Amazon.EC2.Model.DescribeFleetHistoryResponse, GetEC2FleetHistoryCmdlet>(Select) ??
throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
}
context.EventType = this.EventType;
context.FleetId = this.FleetId;
#if MODULAR
if (this.FleetId == null && ParameterWasBound(nameof(this.FleetId)))
{
WriteWarning("You are passing $null as a value for parameter FleetId which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.MaxResult = this.MaxResult;
#if !MODULAR
if (ParameterWasBound(nameof(this.MaxResult)) && this.MaxResult.HasValue)
{
WriteWarning("AWSPowerShell and AWSPowerShell.NetCore use the MaxResult parameter to limit the total number of items returned by the cmdlet." +
" This behavior is obsolete and will be removed in a future version of these modules. Pipe the output of this cmdlet into Select-Object -First to terminate" +
" retrieving data pages early and control the number of items returned. AWS.Tools already implements the new behavior of simply passing MaxResult" +
" to the service to specify how many items should be returned by each service call.");
}
#endif
context.NextToken = this.NextToken;
context.UtcStartTime = this.UtcStartTime;
#if MODULAR
if (this.UtcStartTime == null && ParameterWasBound(nameof(this.UtcStartTime)))
{
WriteWarning("You are passing $null as a value for parameter UtcStartTime which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
context.StartTime = this.StartTime;
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
// allow further manipulation of loaded context prior to processing
PostExecutionContextLoad(context);
var output = Execute(context) as CmdletOutput;
ProcessOutput(output);
}
#region IExecutor Members
#if MODULAR
public object Execute(ExecutorContext context)
{
var cmdletContext = context as CmdletContext;
var useParameterSelect = this.Select.StartsWith("^");
// create request and set iteration invariants
var request = new Amazon.EC2.Model.DescribeFleetHistoryRequest();
if (cmdletContext.EventType != null)
{
request.EventType = cmdletContext.EventType;
}
if (cmdletContext.FleetId != null)
{
request.FleetId = cmdletContext.FleetId;
}
if (cmdletContext.MaxResult != null)
{
request.MaxResults = AutoIterationHelpers.ConvertEmitLimitToServiceTypeInt32(cmdletContext.MaxResult.Value);
}
if (cmdletContext.UtcStartTime != null)
{
request.StartTimeUtc = cmdletContext.UtcStartTime.Value;
}
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
if (cmdletContext.StartTime != null)
{
if (cmdletContext.UtcStartTime != null)
{
throw new System.ArgumentException("Parameters StartTime and UtcStartTime are mutually exclusive.", nameof(this.StartTime));
}
request.StartTime = cmdletContext.StartTime.Value;
}
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
// Initialize loop variant and commence piping
var _nextToken = cmdletContext.NextToken;
var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));
var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
do
{
request.NextToken = _nextToken;
CmdletOutput output;
try
{
var response = CallAWSServiceOperation(client, request);
object pipelineOutput = null;
if (!useParameterSelect)
{
pipelineOutput = cmdletContext.Select(response, this);
}
output = new CmdletOutput
{
PipelineOutput = pipelineOutput,
ServiceResponse = response
};
_nextToken = response.NextToken;
}
catch (Exception e)
{
output = new CmdletOutput { ErrorResponse = e };
}
ProcessOutput(output);
} while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken));
if (useParameterSelect)
{
WriteObject(cmdletContext.Select(null, this));
}
return null;
}
#else
public object Execute(ExecutorContext context)
{
var cmdletContext = context as CmdletContext;
var useParameterSelect = this.Select.StartsWith("^");
// create request and set iteration invariants
var request = new Amazon.EC2.Model.DescribeFleetHistoryRequest();
if (cmdletContext.EventType != null)
{
request.EventType = cmdletContext.EventType;
}
if (cmdletContext.FleetId != null)
{
request.FleetId = cmdletContext.FleetId;
}
if (cmdletContext.UtcStartTime != null)
{
request.StartTimeUtc = cmdletContext.UtcStartTime.Value;
}
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
if (cmdletContext.StartTime != null)
{
if (cmdletContext.UtcStartTime != null)
{
throw new System.ArgumentException("Parameters StartTime and UtcStartTime are mutually exclusive.", nameof(this.StartTime));
}
request.StartTime = cmdletContext.StartTime.Value;
}
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
// Initialize loop variants and commence piping
System.String _nextToken = null;
int? _emitLimit = null;
int _retrievedSoFar = 0;
if (AutoIterationHelpers.HasValue(cmdletContext.NextToken))
{
_nextToken = cmdletContext.NextToken;
}
if (AutoIterationHelpers.HasValue(cmdletContext.MaxResult))
{
_emitLimit = cmdletContext.MaxResult;
}
var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));
var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
do
{
request.NextToken = _nextToken;
if (_emitLimit.HasValue)
{
request.MaxResults = AutoIterationHelpers.ConvertEmitLimitToInt32(_emitLimit.Value);
}
CmdletOutput output;
try
{
var response = CallAWSServiceOperation(client, request);
object pipelineOutput = null;
if (!useParameterSelect)
{
pipelineOutput = cmdletContext.Select(response, this);
}
output = new CmdletOutput
{
PipelineOutput = pipelineOutput,
ServiceResponse = response
};
int _receivedThisCall = response.HistoryRecords.Count;
_nextToken = response.NextToken;
_retrievedSoFar += _receivedThisCall;
if (_emitLimit.HasValue)
{
_emitLimit -= _receivedThisCall;
}
}
catch (Exception e)
{
if (_retrievedSoFar == 0 || !_emitLimit.HasValue)
{
output = new CmdletOutput { ErrorResponse = e };
}
else
{
break;
}
}
ProcessOutput(output);
} while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken) && (!_emitLimit.HasValue || _emitLimit.Value >= 1));
if (useParameterSelect)
{
WriteObject(cmdletContext.Select(null, this));
}
return null;
}
#endif
public ExecutorContext CreateContext()
{
return new CmdletContext();
}
#endregion
#region AWS Service Operation Call
private Amazon.EC2.Model.DescribeFleetHistoryResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.DescribeFleetHistoryRequest request)
{
Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "DescribeFleetHistory");
try
{
#if DESKTOP
return client.DescribeFleetHistory(request);
#elif CORECLR
return client.DescribeFleetHistoryAsync(request).GetAwaiter().GetResult();
#else
#error "Unknown build edition"
#endif
}
catch (AmazonServiceException exc)
{
var webException = exc.InnerException as System.Net.WebException;
if (webException != null)
{
throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
}
throw;
}
}
#endregion
internal partial class CmdletContext : ExecutorContext
{
public Amazon.EC2.FleetEventType EventType { get; set; }
public System.String FleetId { get; set; }
public int? MaxResult { get; set; }
public System.String NextToken { get; set; }
public System.DateTime? UtcStartTime { get; set; }
[System.ObsoleteAttribute]
public System.DateTime? StartTime { get; set; }
public System.Func<Amazon.EC2.Model.DescribeFleetHistoryResponse, GetEC2FleetHistoryCmdlet, object> Select { get; set; } =
(response, cmdlet) => response.HistoryRecords;
}
}
}
| 46.621145 | 283 | 0.584711 | [
"Apache-2.0"
] | 5u5hma/aws-tools-for-powershell | modules/AWSPowerShell/Cmdlets/EC2/Basic/Get-EC2FleetHistory-Cmdlet.cs | 21,166 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RocketMQ.Client//.Protocal.Header
{
public class QueryTopicConsumeByWhoRequestHeader : CommandCustomHeader
{
[CFNotNull]
public string topic { get; set; }
//@Override
public void checkFields() //throws RemotingCommandException
{
}
}
}
| 20.238095 | 74 | 0.677647 | [
"MIT"
] | leeveel/RocketMQ.Client | RocketMQ.Client/Protocal/Header/QueryTopicConsumeByWhoRequestHeader.cs | 427 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Diagnostics.ContractsLight;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BuildXL.Cache.ContentStore.Hashing;
using BuildXL.Cache.ContentStore.Interfaces.FileSystem;
using BuildXL.Cache.ContentStore.Interfaces.Results;
using BuildXL.Cache.ContentStore.Interfaces.Tracing;
using BuildXL.Cache.ContentStore.Interfaces.Utils;
using BuildXL.Cache.ContentStore.Service.Grpc;
namespace BuildXL.Cache.ContentStore.Distributed.Utilities
{
/// <summary>
/// File copier which operates over Grpc. <seealso cref="GrpcCopyClient"/>, <seealso cref="GrpcServerFactory"/>
/// </summary>
public class GrpcFileCopier : IAbsolutePathFileCopier
{
private const int DefaultGrpcPort = 7089;
private Context _context;
private int _grpcPort;
/// <summary>
/// Constructor for <see cref="GrpcFileCopier"/>.
/// </summary>
public GrpcFileCopier(Context context, int grpcPort)
{
_context = context;
_grpcPort = grpcPort;
}
/// <inheritdoc />
public Task<FileExistenceResult> CheckFileExistsAsync(AbsolutePath path, TimeSpan timeout, CancellationToken cancellationToken)
{
// TODO: Implement!
throw new NotImplementedException();
}
/// <inheritdoc />
public async Task<CopyFileResult> CopyFileAsync(AbsolutePath sourcePath, AbsolutePath destinationPath, long contentSize, bool overwrite, CancellationToken cancellationToken)
{
// Extract host and contentHash from sourcePath
(string host, ContentHash contentHash) = ExtractHostHashFromAbsolutePath(sourcePath);
CopyFileResult copyFileResult = null;
// Contact hard-coded port on source
using (var client = GrpcCopyClient.Create(host, DefaultGrpcPort))
{
copyFileResult = await client.CopyFileAsync(_context, contentHash, destinationPath, cancellationToken);
}
return copyFileResult;
}
private (string host, ContentHash contentHash) ExtractHostHashFromAbsolutePath(AbsolutePath sourcePath)
{
Contract.Assert(sourcePath.IsUnc);
// TODO: Keep the segments in the AbsolutePath object?
// TODO: Indexable structure?
var segments = sourcePath.GetSegments();
Contract.Assert(segments.Count >= 4);
var host = segments.First();
var hashLiteral = segments.Last();
if (hashLiteral.EndsWith(GrpcDistributedPathTransformer.BlobFileExtension))
{
hashLiteral = hashLiteral.Substring(0, hashLiteral.Length - GrpcDistributedPathTransformer.BlobFileExtension.Length);
}
var hashTypeLiteral = segments.ElementAt(segments.Count - 1 - 2);
if (!Enum.TryParse(hashTypeLiteral, out HashType hashType))
{
throw new InvalidOperationException($"{hashTypeLiteral} is not a valid member of {nameof(HashType)}");
}
var contentHash = new ContentHash(hashType, HexUtilities.HexToBytes(hashLiteral));
return (host, contentHash);
}
/// <inheritdoc />
public async Task<CopyFileResult> CopyToAsync(AbsolutePath sourcePath, Stream destinationStream, long expectedContentSize, CancellationToken cancellationToken)
{
// Extract host and contentHash from sourcePath
(string host, ContentHash contentHash) = ExtractHostHashFromAbsolutePath(sourcePath);
CopyFileResult copyFileResult = null;
// Contact hard-coded port on source
using (var client = GrpcCopyClient.Create(host, DefaultGrpcPort))
{
copyFileResult = await client.CopyToAsync(_context, contentHash, destinationStream, cancellationToken);
}
return copyFileResult;
}
}
}
| 41.086538 | 182 | 0.650363 | [
"MIT"
] | socat/BuildXL | Public/Src/Cache/ContentStore/Distributed/Utilities/GrpcFileCopier.cs | 4,273 | 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.
/*============================================================
**
**
**
**
** Purpose: Defines the root type for all marshal by reference aka
** AppDomain bound types
**
**
**
===========================================================*/
namespace System {
using System;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Runtime.Remoting;
#if FEATURE_REMOTING
using System.Runtime.Remoting.Lifetime;
using System.Runtime.Remoting.Services;
#endif
using System.Runtime.InteropServices;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Diagnostics.Contracts;
using CultureInfo = System.Globalization.CultureInfo;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class MarshalByRefObject
{
#if FEATURE_REMOTING
private Object __identity;
private Object Identity { get { return __identity; } set { __identity = value; } }
#if FEATURE_COMINTEROP
[System.Security.SecuritySafeCritical] // auto-generated
internal IntPtr GetComIUnknown(bool fIsBeingMarshalled)
{
IntPtr pUnk;
if(RemotingServices.IsTransparentProxy(this))
{
pUnk = RemotingServices.GetRealProxy(this).GetCOMIUnknown(fIsBeingMarshalled);
}
else
{
pUnk = Marshal.GetIUnknownForObject(this);
}
return pUnk;
}
[System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern IntPtr GetComIUnknown(MarshalByRefObject o);
#endif // FEATURE_COMINTEROP
// (1) for remote COM objects IsInstance of can't be executed on
// the proxies, so we need this method to be executed on the
// actual object.
// (2) for remote objects that do not have the complete type information
// we intercept calls to check the type and execute it on the actual
// object
internal bool IsInstanceOfType(Type T)
{
return T.IsInstanceOfType(this);
}
// for remote COM Objects the late binding methods can't be
// executed on proxies, so we need this method to execute on
// the real object
internal Object InvokeMember(String name,BindingFlags invokeAttr,Binder binder,
Object[] args,ParameterModifier[] modifiers,CultureInfo culture,String[] namedParameters)
{
Type t = GetType();
// Sanity check
if(!t.IsCOMObject)
throw new InvalidOperationException(Environment.GetResourceString("Arg_InvokeMember"));
// Call into the runtime to invoke on the COM object.
return t.InvokeMember(name, invokeAttr, binder, this, args, modifiers, culture, namedParameters);
}
// Returns a new cloned MBR instance that is a memberwise copy of this
// with the identity nulled out, so there are no identity conflicts
// when the cloned object is marshalled
protected MarshalByRefObject MemberwiseClone(bool cloneIdentity)
{
MarshalByRefObject mbr = (MarshalByRefObject)base.MemberwiseClone();
// set the identity on the cloned object to null
if (!cloneIdentity)
mbr.Identity = null;
return mbr;
}
// A helper routine to extract the identity either from the marshalbyrefobject base
// class if it is not a proxy, otherwise from the real proxy.
// A flag is set to indicate whether the object passed in is a server or a proxy
[System.Security.SecuritySafeCritical] // auto-generated
internal static Identity GetIdentity(MarshalByRefObject obj, out bool fServer)
{
fServer = true;
Identity id = null;
if(null != obj)
{
if(!RemotingServices.IsTransparentProxy(obj))
{
id = (Identity)obj.Identity;
}
else
{
// Toggle flag to indicate that we have a proxy
fServer = false;
id = RemotingServices.GetRealProxy(obj).IdentityObject;
}
}
return id;
}
// Another helper that delegates to the helper above
internal static Identity GetIdentity(MarshalByRefObject obj)
{
Contract.Assert(!RemotingServices.IsTransparentProxy(obj), "Use this method for server objects only");
bool fServer;
return GetIdentity(obj, out fServer);
}
internal ServerIdentity __RaceSetServerIdentity(ServerIdentity id)
{
if (__identity == null)
{
// For strictly MBR types, the TP field in the identity
// holds the real server
if (!id.IsContextBound)
{
id.RaceSetTransparentProxy(this);
}
Interlocked.CompareExchange(ref __identity, id, null);
}
return (ServerIdentity)__identity;
}
internal void __ResetServerIdentity()
{
__identity = null;
}
// This method is used return a lifetime service object which
// is used to control the lifetime policy to the object.
// For the default Lifetime service this will be an object of typoe ILease.
//
[System.Security.SecurityCritical] // auto-generated_required
public Object GetLifetimeService()
{
return LifetimeServices.GetLease(this);
}
// This method is used return lifetime service object. This method
// can be overridden to return a LifetimeService object with properties unique to
// this object.
// For the default Lifetime service this will be an object of type ILease.
//
[System.Security.SecurityCritical] // auto-generated_required
public virtual Object InitializeLifetimeService()
{
return LifetimeServices.GetLeaseInitial(this);
}
[System.Security.SecurityCritical] // auto-generated_required
public virtual ObjRef CreateObjRef(Type requestedType)
{
if(__identity == null)
{
throw new RemotingException(Environment.GetResourceString(
"Remoting_NoIdentityEntry"));
}
return new ObjRef(this, requestedType);
}
// This is for casting interop ObjRefLite's.
// ObjRefLite's have been deprecated. These methods are not exposed
// through any user APIs and would be removed in the future
[System.Security.SecuritySafeCritical] // auto-generated
internal bool CanCastToXmlType(String xmlTypeName, String xmlTypeNamespace)
{
Type castType = SoapServices.GetInteropTypeFromXmlType(xmlTypeName, xmlTypeNamespace);
if (castType == null)
{
String typeNamespace;
String assemblyName;
if (!SoapServices.DecodeXmlNamespaceForClrTypeNamespace(xmlTypeNamespace,
out typeNamespace, out assemblyName))
return false;
String typeName;
if ((typeNamespace != null) && (typeNamespace.Length > 0))
typeName = typeNamespace + "." + xmlTypeName;
else
typeName = xmlTypeName;
try
{
Assembly asm = Assembly.Load(assemblyName);
castType = asm.GetType(typeName, false, false);
}
catch
{
return false;
}
}
if (castType != null)
return castType.IsAssignableFrom(this.GetType());
return false;
} // CanCastToXmlType
// helper method for calling CanCastToXmlType
// ObjRefLite's have been deprecated. These methods are not exposed
// through any user APIs and would be removed in the future
[System.Security.SecuritySafeCritical] // auto-generated
internal static bool CanCastToXmlTypeHelper(RuntimeType castType, MarshalByRefObject o)
{
if (castType == null)
throw new ArgumentNullException("castType");
Contract.EndContractBlock();
// MarshalByRefObject's can only be casted to MarshalByRefObject's or interfaces.
if (!castType.IsInterface && !castType.IsMarshalByRef)
return false;
// figure out xml type name
String xmlTypeName = null;
String xmlTypeNamespace = null;
if (!SoapServices.GetXmlTypeForInteropType(castType, out xmlTypeName, out xmlTypeNamespace))
{
// There's no registered interop type name, so just use the default.
xmlTypeName = castType.Name;
xmlTypeNamespace =
SoapServices.CodeXmlNamespaceForClrTypeNamespace(
castType.Namespace, castType.GetRuntimeAssembly().GetSimpleName());
}
return o.CanCastToXmlType(xmlTypeName, xmlTypeNamespace);
} // CanCastToXmlType
#endif // FEATURE_REMOTING
}
} // namespace
| 38.072243 | 117 | 0.585938 | [
"MIT"
] | Rayislandstyle/dotnet-coreclr | src/mscorlib/src/System/MarshalByRefObject.cs | 10,013 | C# |
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/spanner/v1/spanner.proto
// </auto-generated>
// Original file comments:
// Copyright 2018 Google LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
#pragma warning disable 0414, 1591
#region Designer generated code
using grpc = global::Grpc.Core;
namespace Google.Cloud.Spanner.V1 {
/// <summary>
/// Cloud Spanner API
///
/// The Cloud Spanner API can be used to manage sessions and execute
/// transactions on data stored in Cloud Spanner databases.
/// </summary>
public static partial class Spanner
{
static readonly string __ServiceName = "google.spanner.v1.Spanner";
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.CreateSessionRequest> __Marshaller_google_spanner_v1_CreateSessionRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.CreateSessionRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.Session> __Marshaller_google_spanner_v1_Session = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.Session.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.GetSessionRequest> __Marshaller_google_spanner_v1_GetSessionRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.GetSessionRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.ListSessionsRequest> __Marshaller_google_spanner_v1_ListSessionsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.ListSessionsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.ListSessionsResponse> __Marshaller_google_spanner_v1_ListSessionsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.ListSessionsResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.DeleteSessionRequest> __Marshaller_google_spanner_v1_DeleteSessionRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.DeleteSessionRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Protobuf.WellKnownTypes.Empty> __Marshaller_google_protobuf_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.ExecuteSqlRequest> __Marshaller_google_spanner_v1_ExecuteSqlRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.ExecuteSqlRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.ResultSet> __Marshaller_google_spanner_v1_ResultSet = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.ResultSet.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.PartialResultSet> __Marshaller_google_spanner_v1_PartialResultSet = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.PartialResultSet.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest> __Marshaller_google_spanner_v1_ExecuteBatchDmlRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse> __Marshaller_google_spanner_v1_ExecuteBatchDmlResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.ReadRequest> __Marshaller_google_spanner_v1_ReadRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.ReadRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.BeginTransactionRequest> __Marshaller_google_spanner_v1_BeginTransactionRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.BeginTransactionRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.Transaction> __Marshaller_google_spanner_v1_Transaction = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.Transaction.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.CommitRequest> __Marshaller_google_spanner_v1_CommitRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.CommitRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.CommitResponse> __Marshaller_google_spanner_v1_CommitResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.CommitResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.RollbackRequest> __Marshaller_google_spanner_v1_RollbackRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.RollbackRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.PartitionQueryRequest> __Marshaller_google_spanner_v1_PartitionQueryRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.PartitionQueryRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.PartitionResponse> __Marshaller_google_spanner_v1_PartitionResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.PartitionResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.Spanner.V1.PartitionReadRequest> __Marshaller_google_spanner_v1_PartitionReadRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.Spanner.V1.PartitionReadRequest.Parser.ParseFrom);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.CreateSessionRequest, global::Google.Cloud.Spanner.V1.Session> __Method_CreateSession = new grpc::Method<global::Google.Cloud.Spanner.V1.CreateSessionRequest, global::Google.Cloud.Spanner.V1.Session>(
grpc::MethodType.Unary,
__ServiceName,
"CreateSession",
__Marshaller_google_spanner_v1_CreateSessionRequest,
__Marshaller_google_spanner_v1_Session);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.GetSessionRequest, global::Google.Cloud.Spanner.V1.Session> __Method_GetSession = new grpc::Method<global::Google.Cloud.Spanner.V1.GetSessionRequest, global::Google.Cloud.Spanner.V1.Session>(
grpc::MethodType.Unary,
__ServiceName,
"GetSession",
__Marshaller_google_spanner_v1_GetSessionRequest,
__Marshaller_google_spanner_v1_Session);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.ListSessionsRequest, global::Google.Cloud.Spanner.V1.ListSessionsResponse> __Method_ListSessions = new grpc::Method<global::Google.Cloud.Spanner.V1.ListSessionsRequest, global::Google.Cloud.Spanner.V1.ListSessionsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ListSessions",
__Marshaller_google_spanner_v1_ListSessionsRequest,
__Marshaller_google_spanner_v1_ListSessionsResponse);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.DeleteSessionRequest, global::Google.Protobuf.WellKnownTypes.Empty> __Method_DeleteSession = new grpc::Method<global::Google.Cloud.Spanner.V1.DeleteSessionRequest, global::Google.Protobuf.WellKnownTypes.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"DeleteSession",
__Marshaller_google_spanner_v1_DeleteSessionRequest,
__Marshaller_google_protobuf_Empty);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.ExecuteSqlRequest, global::Google.Cloud.Spanner.V1.ResultSet> __Method_ExecuteSql = new grpc::Method<global::Google.Cloud.Spanner.V1.ExecuteSqlRequest, global::Google.Cloud.Spanner.V1.ResultSet>(
grpc::MethodType.Unary,
__ServiceName,
"ExecuteSql",
__Marshaller_google_spanner_v1_ExecuteSqlRequest,
__Marshaller_google_spanner_v1_ResultSet);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.ExecuteSqlRequest, global::Google.Cloud.Spanner.V1.PartialResultSet> __Method_ExecuteStreamingSql = new grpc::Method<global::Google.Cloud.Spanner.V1.ExecuteSqlRequest, global::Google.Cloud.Spanner.V1.PartialResultSet>(
grpc::MethodType.ServerStreaming,
__ServiceName,
"ExecuteStreamingSql",
__Marshaller_google_spanner_v1_ExecuteSqlRequest,
__Marshaller_google_spanner_v1_PartialResultSet);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest, global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse> __Method_ExecuteBatchDml = new grpc::Method<global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest, global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ExecuteBatchDml",
__Marshaller_google_spanner_v1_ExecuteBatchDmlRequest,
__Marshaller_google_spanner_v1_ExecuteBatchDmlResponse);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.ReadRequest, global::Google.Cloud.Spanner.V1.ResultSet> __Method_Read = new grpc::Method<global::Google.Cloud.Spanner.V1.ReadRequest, global::Google.Cloud.Spanner.V1.ResultSet>(
grpc::MethodType.Unary,
__ServiceName,
"Read",
__Marshaller_google_spanner_v1_ReadRequest,
__Marshaller_google_spanner_v1_ResultSet);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.ReadRequest, global::Google.Cloud.Spanner.V1.PartialResultSet> __Method_StreamingRead = new grpc::Method<global::Google.Cloud.Spanner.V1.ReadRequest, global::Google.Cloud.Spanner.V1.PartialResultSet>(
grpc::MethodType.ServerStreaming,
__ServiceName,
"StreamingRead",
__Marshaller_google_spanner_v1_ReadRequest,
__Marshaller_google_spanner_v1_PartialResultSet);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.BeginTransactionRequest, global::Google.Cloud.Spanner.V1.Transaction> __Method_BeginTransaction = new grpc::Method<global::Google.Cloud.Spanner.V1.BeginTransactionRequest, global::Google.Cloud.Spanner.V1.Transaction>(
grpc::MethodType.Unary,
__ServiceName,
"BeginTransaction",
__Marshaller_google_spanner_v1_BeginTransactionRequest,
__Marshaller_google_spanner_v1_Transaction);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.CommitRequest, global::Google.Cloud.Spanner.V1.CommitResponse> __Method_Commit = new grpc::Method<global::Google.Cloud.Spanner.V1.CommitRequest, global::Google.Cloud.Spanner.V1.CommitResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Commit",
__Marshaller_google_spanner_v1_CommitRequest,
__Marshaller_google_spanner_v1_CommitResponse);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.RollbackRequest, global::Google.Protobuf.WellKnownTypes.Empty> __Method_Rollback = new grpc::Method<global::Google.Cloud.Spanner.V1.RollbackRequest, global::Google.Protobuf.WellKnownTypes.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"Rollback",
__Marshaller_google_spanner_v1_RollbackRequest,
__Marshaller_google_protobuf_Empty);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.PartitionQueryRequest, global::Google.Cloud.Spanner.V1.PartitionResponse> __Method_PartitionQuery = new grpc::Method<global::Google.Cloud.Spanner.V1.PartitionQueryRequest, global::Google.Cloud.Spanner.V1.PartitionResponse>(
grpc::MethodType.Unary,
__ServiceName,
"PartitionQuery",
__Marshaller_google_spanner_v1_PartitionQueryRequest,
__Marshaller_google_spanner_v1_PartitionResponse);
static readonly grpc::Method<global::Google.Cloud.Spanner.V1.PartitionReadRequest, global::Google.Cloud.Spanner.V1.PartitionResponse> __Method_PartitionRead = new grpc::Method<global::Google.Cloud.Spanner.V1.PartitionReadRequest, global::Google.Cloud.Spanner.V1.PartitionResponse>(
grpc::MethodType.Unary,
__ServiceName,
"PartitionRead",
__Marshaller_google_spanner_v1_PartitionReadRequest,
__Marshaller_google_spanner_v1_PartitionResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Google.Cloud.Spanner.V1.SpannerReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of Spanner</summary>
[grpc::BindServiceMethod(typeof(Spanner), "BindService")]
public abstract partial class SpannerBase
{
/// <summary>
/// Creates a new session. A session can be used to perform
/// transactions that read and/or modify data in a Cloud Spanner database.
/// Sessions are meant to be reused for many consecutive
/// transactions.
///
/// Sessions can only execute one transaction at a time. To execute
/// multiple concurrent read-write/write-only transactions, create
/// multiple sessions. Note that standalone reads and queries use a
/// transaction internally, and count toward the one transaction
/// limit.
///
/// Cloud Spanner limits the number of sessions that can exist at any given
/// time; thus, it is a good idea to delete idle and/or unneeded sessions.
/// Aside from explicit deletes, Cloud Spanner can delete sessions for which no
/// operations are sent for more than an hour. If a session is deleted,
/// requests to it return `NOT_FOUND`.
///
/// Idle sessions can be kept alive by sending a trivial SQL query
/// periodically, e.g., `"SELECT 1"`.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.Session> CreateSession(global::Google.Cloud.Spanner.V1.CreateSessionRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Gets a session. Returns `NOT_FOUND` if the session does not exist.
/// This is mainly useful for determining whether a session is still
/// alive.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.Session> GetSession(global::Google.Cloud.Spanner.V1.GetSessionRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Lists all sessions in a given database.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.ListSessionsResponse> ListSessions(global::Google.Cloud.Spanner.V1.ListSessionsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Ends a session, releasing server resources associated with it. This will
/// asynchronously trigger cancellation of any operations that are running with
/// this session.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Protobuf.WellKnownTypes.Empty> DeleteSession(global::Google.Cloud.Spanner.V1.DeleteSessionRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Executes an SQL statement, returning all results in a single reply. This
/// method cannot be used to return a result set larger than 10 MiB;
/// if the query yields more data than that, the query fails with
/// a `FAILED_PRECONDITION` error.
///
/// Operations inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be fetched in streaming fashion by calling
/// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
/// instead.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.ResultSet> ExecuteSql(global::Google.Cloud.Spanner.V1.ExecuteSqlRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the
/// result set as a stream. Unlike
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on
/// the size of the returned result set. However, no individual row in the
/// result set can exceed 100 MiB, and no column value can exceed 10 MiB.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task ExecuteStreamingSql(global::Google.Cloud.Spanner.V1.ExecuteSqlRequest request, grpc::IServerStreamWriter<global::Google.Cloud.Spanner.V1.PartialResultSet> responseStream, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Executes a batch of SQL DML statements. This method allows many statements
/// to be run with lower latency than submitting them sequentially with
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
///
/// Statements are executed in order, sequentially.
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
/// [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
/// statement fails, its error status will be returned as part of the
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
/// stop at the first failed statement; the remaining statements will not run.
///
/// ExecuteBatchDml is expected to return an OK status with a response even if
/// there was an error while processing one of the DML statements. Clients must
/// inspect response.status to determine if there were any errors while
/// processing the request.
///
/// See more details in
/// [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse> ExecuteBatchDml(global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Reads rows from the database using key lookups and scans, as a
/// simple key/value style alternative to
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be
/// used to return a result set larger than 10 MiB; if the read matches more
/// data than that, the read fails with a `FAILED_PRECONDITION`
/// error.
///
/// Reads inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be yielded in streaming fashion by calling
/// [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.ResultSet> Read(global::Google.Cloud.Spanner.V1.ReadRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Like [Read][google.spanner.v1.Spanner.Read], except returns the result set
/// as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no
/// limit on the size of the returned result set. However, no individual row in
/// the result set can exceed 100 MiB, and no column value can exceed
/// 10 MiB.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task StreamingRead(global::Google.Cloud.Spanner.V1.ReadRequest request, grpc::IServerStreamWriter<global::Google.Cloud.Spanner.V1.PartialResultSet> responseStream, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Begins a new transaction. This step can often be skipped:
/// [Read][google.spanner.v1.Spanner.Read],
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
/// [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
/// side-effect.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.Transaction> BeginTransaction(global::Google.Cloud.Spanner.V1.BeginTransactionRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Commits a transaction. The request includes the mutations to be
/// applied to rows in the database.
///
/// `Commit` might return an `ABORTED` error. This can occur at any time;
/// commonly, the cause is conflicts with concurrent
/// transactions. However, it can also happen for a variety of other
/// reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
/// the transaction from the beginning, re-using the same session.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.CommitResponse> Commit(global::Google.Cloud.Spanner.V1.CommitRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Rolls back a transaction, releasing any locks it holds. It is a good
/// idea to call this for any transaction that includes one or more
/// [Read][google.spanner.v1.Spanner.Read] or
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately
/// decides not to commit.
///
/// `Rollback` returns `OK` if it successfully aborts the transaction, the
/// transaction was already aborted, or the transaction is not
/// found. `Rollback` never returns `ABORTED`.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Protobuf.WellKnownTypes.Empty> Rollback(global::Google.Cloud.Spanner.V1.RollbackRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a query
/// operation in parallel. Each of the returned partition tokens can be used
/// by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to
/// specify a subset of the query result to read. The same session and
/// read-only transaction must be used by the PartitionQueryRequest used to
/// create the partition tokens and the ExecuteSqlRequests that use the
/// partition tokens.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the query, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.PartitionResponse> PartitionQuery(global::Google.Cloud.Spanner.V1.PartitionQueryRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a read
/// operation in parallel. Each of the returned partition tokens can be used
/// by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a
/// subset of the read result to read. The same session and read-only
/// transaction must be used by the PartitionReadRequest used to create the
/// partition tokens and the ReadRequests that use the partition tokens. There
/// are no ordering guarantees on rows returned among the returned partition
/// tokens, or even within each individual StreamingRead call issued with a
/// partition_token.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the read, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.Spanner.V1.PartitionResponse> PartitionRead(global::Google.Cloud.Spanner.V1.PartitionReadRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for Spanner</summary>
public partial class SpannerClient : grpc::ClientBase<SpannerClient>
{
/// <summary>Creates a new client for Spanner</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public SpannerClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for Spanner that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public SpannerClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected SpannerClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected SpannerClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
/// <summary>
/// Creates a new session. A session can be used to perform
/// transactions that read and/or modify data in a Cloud Spanner database.
/// Sessions are meant to be reused for many consecutive
/// transactions.
///
/// Sessions can only execute one transaction at a time. To execute
/// multiple concurrent read-write/write-only transactions, create
/// multiple sessions. Note that standalone reads and queries use a
/// transaction internally, and count toward the one transaction
/// limit.
///
/// Cloud Spanner limits the number of sessions that can exist at any given
/// time; thus, it is a good idea to delete idle and/or unneeded sessions.
/// Aside from explicit deletes, Cloud Spanner can delete sessions for which no
/// operations are sent for more than an hour. If a session is deleted,
/// requests to it return `NOT_FOUND`.
///
/// Idle sessions can be kept alive by sending a trivial SQL query
/// periodically, e.g., `"SELECT 1"`.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.Session CreateSession(global::Google.Cloud.Spanner.V1.CreateSessionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return CreateSession(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates a new session. A session can be used to perform
/// transactions that read and/or modify data in a Cloud Spanner database.
/// Sessions are meant to be reused for many consecutive
/// transactions.
///
/// Sessions can only execute one transaction at a time. To execute
/// multiple concurrent read-write/write-only transactions, create
/// multiple sessions. Note that standalone reads and queries use a
/// transaction internally, and count toward the one transaction
/// limit.
///
/// Cloud Spanner limits the number of sessions that can exist at any given
/// time; thus, it is a good idea to delete idle and/or unneeded sessions.
/// Aside from explicit deletes, Cloud Spanner can delete sessions for which no
/// operations are sent for more than an hour. If a session is deleted,
/// requests to it return `NOT_FOUND`.
///
/// Idle sessions can be kept alive by sending a trivial SQL query
/// periodically, e.g., `"SELECT 1"`.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.Session CreateSession(global::Google.Cloud.Spanner.V1.CreateSessionRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_CreateSession, null, options, request);
}
/// <summary>
/// Creates a new session. A session can be used to perform
/// transactions that read and/or modify data in a Cloud Spanner database.
/// Sessions are meant to be reused for many consecutive
/// transactions.
///
/// Sessions can only execute one transaction at a time. To execute
/// multiple concurrent read-write/write-only transactions, create
/// multiple sessions. Note that standalone reads and queries use a
/// transaction internally, and count toward the one transaction
/// limit.
///
/// Cloud Spanner limits the number of sessions that can exist at any given
/// time; thus, it is a good idea to delete idle and/or unneeded sessions.
/// Aside from explicit deletes, Cloud Spanner can delete sessions for which no
/// operations are sent for more than an hour. If a session is deleted,
/// requests to it return `NOT_FOUND`.
///
/// Idle sessions can be kept alive by sending a trivial SQL query
/// periodically, e.g., `"SELECT 1"`.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.Session> CreateSessionAsync(global::Google.Cloud.Spanner.V1.CreateSessionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return CreateSessionAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates a new session. A session can be used to perform
/// transactions that read and/or modify data in a Cloud Spanner database.
/// Sessions are meant to be reused for many consecutive
/// transactions.
///
/// Sessions can only execute one transaction at a time. To execute
/// multiple concurrent read-write/write-only transactions, create
/// multiple sessions. Note that standalone reads and queries use a
/// transaction internally, and count toward the one transaction
/// limit.
///
/// Cloud Spanner limits the number of sessions that can exist at any given
/// time; thus, it is a good idea to delete idle and/or unneeded sessions.
/// Aside from explicit deletes, Cloud Spanner can delete sessions for which no
/// operations are sent for more than an hour. If a session is deleted,
/// requests to it return `NOT_FOUND`.
///
/// Idle sessions can be kept alive by sending a trivial SQL query
/// periodically, e.g., `"SELECT 1"`.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.Session> CreateSessionAsync(global::Google.Cloud.Spanner.V1.CreateSessionRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_CreateSession, null, options, request);
}
/// <summary>
/// Gets a session. Returns `NOT_FOUND` if the session does not exist.
/// This is mainly useful for determining whether a session is still
/// alive.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.Session GetSession(global::Google.Cloud.Spanner.V1.GetSessionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetSession(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Gets a session. Returns `NOT_FOUND` if the session does not exist.
/// This is mainly useful for determining whether a session is still
/// alive.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.Session GetSession(global::Google.Cloud.Spanner.V1.GetSessionRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetSession, null, options, request);
}
/// <summary>
/// Gets a session. Returns `NOT_FOUND` if the session does not exist.
/// This is mainly useful for determining whether a session is still
/// alive.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.Session> GetSessionAsync(global::Google.Cloud.Spanner.V1.GetSessionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetSessionAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Gets a session. Returns `NOT_FOUND` if the session does not exist.
/// This is mainly useful for determining whether a session is still
/// alive.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.Session> GetSessionAsync(global::Google.Cloud.Spanner.V1.GetSessionRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetSession, null, options, request);
}
/// <summary>
/// Lists all sessions in a given database.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.ListSessionsResponse ListSessions(global::Google.Cloud.Spanner.V1.ListSessionsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ListSessions(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Lists all sessions in a given database.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.ListSessionsResponse ListSessions(global::Google.Cloud.Spanner.V1.ListSessionsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ListSessions, null, options, request);
}
/// <summary>
/// Lists all sessions in a given database.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.ListSessionsResponse> ListSessionsAsync(global::Google.Cloud.Spanner.V1.ListSessionsRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ListSessionsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Lists all sessions in a given database.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.ListSessionsResponse> ListSessionsAsync(global::Google.Cloud.Spanner.V1.ListSessionsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ListSessions, null, options, request);
}
/// <summary>
/// Ends a session, releasing server resources associated with it. This will
/// asynchronously trigger cancellation of any operations that are running with
/// this session.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty DeleteSession(global::Google.Cloud.Spanner.V1.DeleteSessionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return DeleteSession(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Ends a session, releasing server resources associated with it. This will
/// asynchronously trigger cancellation of any operations that are running with
/// this session.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty DeleteSession(global::Google.Cloud.Spanner.V1.DeleteSessionRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_DeleteSession, null, options, request);
}
/// <summary>
/// Ends a session, releasing server resources associated with it. This will
/// asynchronously trigger cancellation of any operations that are running with
/// this session.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> DeleteSessionAsync(global::Google.Cloud.Spanner.V1.DeleteSessionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return DeleteSessionAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Ends a session, releasing server resources associated with it. This will
/// asynchronously trigger cancellation of any operations that are running with
/// this session.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> DeleteSessionAsync(global::Google.Cloud.Spanner.V1.DeleteSessionRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_DeleteSession, null, options, request);
}
/// <summary>
/// Executes an SQL statement, returning all results in a single reply. This
/// method cannot be used to return a result set larger than 10 MiB;
/// if the query yields more data than that, the query fails with
/// a `FAILED_PRECONDITION` error.
///
/// Operations inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be fetched in streaming fashion by calling
/// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
/// instead.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.ResultSet ExecuteSql(global::Google.Cloud.Spanner.V1.ExecuteSqlRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ExecuteSql(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Executes an SQL statement, returning all results in a single reply. This
/// method cannot be used to return a result set larger than 10 MiB;
/// if the query yields more data than that, the query fails with
/// a `FAILED_PRECONDITION` error.
///
/// Operations inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be fetched in streaming fashion by calling
/// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
/// instead.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.ResultSet ExecuteSql(global::Google.Cloud.Spanner.V1.ExecuteSqlRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ExecuteSql, null, options, request);
}
/// <summary>
/// Executes an SQL statement, returning all results in a single reply. This
/// method cannot be used to return a result set larger than 10 MiB;
/// if the query yields more data than that, the query fails with
/// a `FAILED_PRECONDITION` error.
///
/// Operations inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be fetched in streaming fashion by calling
/// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
/// instead.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.ResultSet> ExecuteSqlAsync(global::Google.Cloud.Spanner.V1.ExecuteSqlRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ExecuteSqlAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Executes an SQL statement, returning all results in a single reply. This
/// method cannot be used to return a result set larger than 10 MiB;
/// if the query yields more data than that, the query fails with
/// a `FAILED_PRECONDITION` error.
///
/// Operations inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be fetched in streaming fashion by calling
/// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
/// instead.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.ResultSet> ExecuteSqlAsync(global::Google.Cloud.Spanner.V1.ExecuteSqlRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ExecuteSql, null, options, request);
}
/// <summary>
/// Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the
/// result set as a stream. Unlike
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on
/// the size of the returned result set. However, no individual row in the
/// result set can exceed 100 MiB, and no column value can exceed 10 MiB.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncServerStreamingCall<global::Google.Cloud.Spanner.V1.PartialResultSet> ExecuteStreamingSql(global::Google.Cloud.Spanner.V1.ExecuteSqlRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ExecuteStreamingSql(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the
/// result set as a stream. Unlike
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on
/// the size of the returned result set. However, no individual row in the
/// result set can exceed 100 MiB, and no column value can exceed 10 MiB.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncServerStreamingCall<global::Google.Cloud.Spanner.V1.PartialResultSet> ExecuteStreamingSql(global::Google.Cloud.Spanner.V1.ExecuteSqlRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncServerStreamingCall(__Method_ExecuteStreamingSql, null, options, request);
}
/// <summary>
/// Executes a batch of SQL DML statements. This method allows many statements
/// to be run with lower latency than submitting them sequentially with
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
///
/// Statements are executed in order, sequentially.
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
/// [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
/// statement fails, its error status will be returned as part of the
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
/// stop at the first failed statement; the remaining statements will not run.
///
/// ExecuteBatchDml is expected to return an OK status with a response even if
/// there was an error while processing one of the DML statements. Clients must
/// inspect response.status to determine if there were any errors while
/// processing the request.
///
/// See more details in
/// [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse ExecuteBatchDml(global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ExecuteBatchDml(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Executes a batch of SQL DML statements. This method allows many statements
/// to be run with lower latency than submitting them sequentially with
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
///
/// Statements are executed in order, sequentially.
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
/// [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
/// statement fails, its error status will be returned as part of the
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
/// stop at the first failed statement; the remaining statements will not run.
///
/// ExecuteBatchDml is expected to return an OK status with a response even if
/// there was an error while processing one of the DML statements. Clients must
/// inspect response.status to determine if there were any errors while
/// processing the request.
///
/// See more details in
/// [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse ExecuteBatchDml(global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ExecuteBatchDml, null, options, request);
}
/// <summary>
/// Executes a batch of SQL DML statements. This method allows many statements
/// to be run with lower latency than submitting them sequentially with
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
///
/// Statements are executed in order, sequentially.
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
/// [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
/// statement fails, its error status will be returned as part of the
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
/// stop at the first failed statement; the remaining statements will not run.
///
/// ExecuteBatchDml is expected to return an OK status with a response even if
/// there was an error while processing one of the DML statements. Clients must
/// inspect response.status to determine if there were any errors while
/// processing the request.
///
/// See more details in
/// [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse> ExecuteBatchDmlAsync(global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ExecuteBatchDmlAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Executes a batch of SQL DML statements. This method allows many statements
/// to be run with lower latency than submitting them sequentially with
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
///
/// Statements are executed in order, sequentially.
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
/// [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
/// statement fails, its error status will be returned as part of the
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
/// stop at the first failed statement; the remaining statements will not run.
///
/// ExecuteBatchDml is expected to return an OK status with a response even if
/// there was an error while processing one of the DML statements. Clients must
/// inspect response.status to determine if there were any errors while
/// processing the request.
///
/// See more details in
/// [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
/// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse> ExecuteBatchDmlAsync(global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ExecuteBatchDml, null, options, request);
}
/// <summary>
/// Reads rows from the database using key lookups and scans, as a
/// simple key/value style alternative to
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be
/// used to return a result set larger than 10 MiB; if the read matches more
/// data than that, the read fails with a `FAILED_PRECONDITION`
/// error.
///
/// Reads inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be yielded in streaming fashion by calling
/// [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.ResultSet Read(global::Google.Cloud.Spanner.V1.ReadRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Read(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Reads rows from the database using key lookups and scans, as a
/// simple key/value style alternative to
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be
/// used to return a result set larger than 10 MiB; if the read matches more
/// data than that, the read fails with a `FAILED_PRECONDITION`
/// error.
///
/// Reads inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be yielded in streaming fashion by calling
/// [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.ResultSet Read(global::Google.Cloud.Spanner.V1.ReadRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Read, null, options, request);
}
/// <summary>
/// Reads rows from the database using key lookups and scans, as a
/// simple key/value style alternative to
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be
/// used to return a result set larger than 10 MiB; if the read matches more
/// data than that, the read fails with a `FAILED_PRECONDITION`
/// error.
///
/// Reads inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be yielded in streaming fashion by calling
/// [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.ResultSet> ReadAsync(global::Google.Cloud.Spanner.V1.ReadRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ReadAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Reads rows from the database using key lookups and scans, as a
/// simple key/value style alternative to
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be
/// used to return a result set larger than 10 MiB; if the read matches more
/// data than that, the read fails with a `FAILED_PRECONDITION`
/// error.
///
/// Reads inside read-write transactions might return `ABORTED`. If
/// this occurs, the application should restart the transaction from
/// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
/// details.
///
/// Larger result sets can be yielded in streaming fashion by calling
/// [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.ResultSet> ReadAsync(global::Google.Cloud.Spanner.V1.ReadRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Read, null, options, request);
}
/// <summary>
/// Like [Read][google.spanner.v1.Spanner.Read], except returns the result set
/// as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no
/// limit on the size of the returned result set. However, no individual row in
/// the result set can exceed 100 MiB, and no column value can exceed
/// 10 MiB.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncServerStreamingCall<global::Google.Cloud.Spanner.V1.PartialResultSet> StreamingRead(global::Google.Cloud.Spanner.V1.ReadRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return StreamingRead(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Like [Read][google.spanner.v1.Spanner.Read], except returns the result set
/// as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no
/// limit on the size of the returned result set. However, no individual row in
/// the result set can exceed 100 MiB, and no column value can exceed
/// 10 MiB.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncServerStreamingCall<global::Google.Cloud.Spanner.V1.PartialResultSet> StreamingRead(global::Google.Cloud.Spanner.V1.ReadRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncServerStreamingCall(__Method_StreamingRead, null, options, request);
}
/// <summary>
/// Begins a new transaction. This step can often be skipped:
/// [Read][google.spanner.v1.Spanner.Read],
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
/// [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
/// side-effect.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.Transaction BeginTransaction(global::Google.Cloud.Spanner.V1.BeginTransactionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return BeginTransaction(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Begins a new transaction. This step can often be skipped:
/// [Read][google.spanner.v1.Spanner.Read],
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
/// [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
/// side-effect.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.Transaction BeginTransaction(global::Google.Cloud.Spanner.V1.BeginTransactionRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_BeginTransaction, null, options, request);
}
/// <summary>
/// Begins a new transaction. This step can often be skipped:
/// [Read][google.spanner.v1.Spanner.Read],
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
/// [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
/// side-effect.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.Transaction> BeginTransactionAsync(global::Google.Cloud.Spanner.V1.BeginTransactionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return BeginTransactionAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Begins a new transaction. This step can often be skipped:
/// [Read][google.spanner.v1.Spanner.Read],
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
/// [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
/// side-effect.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.Transaction> BeginTransactionAsync(global::Google.Cloud.Spanner.V1.BeginTransactionRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_BeginTransaction, null, options, request);
}
/// <summary>
/// Commits a transaction. The request includes the mutations to be
/// applied to rows in the database.
///
/// `Commit` might return an `ABORTED` error. This can occur at any time;
/// commonly, the cause is conflicts with concurrent
/// transactions. However, it can also happen for a variety of other
/// reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
/// the transaction from the beginning, re-using the same session.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.CommitResponse Commit(global::Google.Cloud.Spanner.V1.CommitRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Commit(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Commits a transaction. The request includes the mutations to be
/// applied to rows in the database.
///
/// `Commit` might return an `ABORTED` error. This can occur at any time;
/// commonly, the cause is conflicts with concurrent
/// transactions. However, it can also happen for a variety of other
/// reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
/// the transaction from the beginning, re-using the same session.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.CommitResponse Commit(global::Google.Cloud.Spanner.V1.CommitRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Commit, null, options, request);
}
/// <summary>
/// Commits a transaction. The request includes the mutations to be
/// applied to rows in the database.
///
/// `Commit` might return an `ABORTED` error. This can occur at any time;
/// commonly, the cause is conflicts with concurrent
/// transactions. However, it can also happen for a variety of other
/// reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
/// the transaction from the beginning, re-using the same session.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.CommitResponse> CommitAsync(global::Google.Cloud.Spanner.V1.CommitRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return CommitAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Commits a transaction. The request includes the mutations to be
/// applied to rows in the database.
///
/// `Commit` might return an `ABORTED` error. This can occur at any time;
/// commonly, the cause is conflicts with concurrent
/// transactions. However, it can also happen for a variety of other
/// reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
/// the transaction from the beginning, re-using the same session.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.CommitResponse> CommitAsync(global::Google.Cloud.Spanner.V1.CommitRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Commit, null, options, request);
}
/// <summary>
/// Rolls back a transaction, releasing any locks it holds. It is a good
/// idea to call this for any transaction that includes one or more
/// [Read][google.spanner.v1.Spanner.Read] or
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately
/// decides not to commit.
///
/// `Rollback` returns `OK` if it successfully aborts the transaction, the
/// transaction was already aborted, or the transaction is not
/// found. `Rollback` never returns `ABORTED`.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty Rollback(global::Google.Cloud.Spanner.V1.RollbackRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Rollback(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Rolls back a transaction, releasing any locks it holds. It is a good
/// idea to call this for any transaction that includes one or more
/// [Read][google.spanner.v1.Spanner.Read] or
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately
/// decides not to commit.
///
/// `Rollback` returns `OK` if it successfully aborts the transaction, the
/// transaction was already aborted, or the transaction is not
/// found. `Rollback` never returns `ABORTED`.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty Rollback(global::Google.Cloud.Spanner.V1.RollbackRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Rollback, null, options, request);
}
/// <summary>
/// Rolls back a transaction, releasing any locks it holds. It is a good
/// idea to call this for any transaction that includes one or more
/// [Read][google.spanner.v1.Spanner.Read] or
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately
/// decides not to commit.
///
/// `Rollback` returns `OK` if it successfully aborts the transaction, the
/// transaction was already aborted, or the transaction is not
/// found. `Rollback` never returns `ABORTED`.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> RollbackAsync(global::Google.Cloud.Spanner.V1.RollbackRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return RollbackAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Rolls back a transaction, releasing any locks it holds. It is a good
/// idea to call this for any transaction that includes one or more
/// [Read][google.spanner.v1.Spanner.Read] or
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately
/// decides not to commit.
///
/// `Rollback` returns `OK` if it successfully aborts the transaction, the
/// transaction was already aborted, or the transaction is not
/// found. `Rollback` never returns `ABORTED`.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> RollbackAsync(global::Google.Cloud.Spanner.V1.RollbackRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Rollback, null, options, request);
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a query
/// operation in parallel. Each of the returned partition tokens can be used
/// by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to
/// specify a subset of the query result to read. The same session and
/// read-only transaction must be used by the PartitionQueryRequest used to
/// create the partition tokens and the ExecuteSqlRequests that use the
/// partition tokens.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the query, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.PartitionResponse PartitionQuery(global::Google.Cloud.Spanner.V1.PartitionQueryRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return PartitionQuery(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a query
/// operation in parallel. Each of the returned partition tokens can be used
/// by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to
/// specify a subset of the query result to read. The same session and
/// read-only transaction must be used by the PartitionQueryRequest used to
/// create the partition tokens and the ExecuteSqlRequests that use the
/// partition tokens.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the query, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.PartitionResponse PartitionQuery(global::Google.Cloud.Spanner.V1.PartitionQueryRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_PartitionQuery, null, options, request);
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a query
/// operation in parallel. Each of the returned partition tokens can be used
/// by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to
/// specify a subset of the query result to read. The same session and
/// read-only transaction must be used by the PartitionQueryRequest used to
/// create the partition tokens and the ExecuteSqlRequests that use the
/// partition tokens.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the query, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.PartitionResponse> PartitionQueryAsync(global::Google.Cloud.Spanner.V1.PartitionQueryRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return PartitionQueryAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a query
/// operation in parallel. Each of the returned partition tokens can be used
/// by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to
/// specify a subset of the query result to read. The same session and
/// read-only transaction must be used by the PartitionQueryRequest used to
/// create the partition tokens and the ExecuteSqlRequests that use the
/// partition tokens.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the query, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.PartitionResponse> PartitionQueryAsync(global::Google.Cloud.Spanner.V1.PartitionQueryRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_PartitionQuery, null, options, request);
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a read
/// operation in parallel. Each of the returned partition tokens can be used
/// by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a
/// subset of the read result to read. The same session and read-only
/// transaction must be used by the PartitionReadRequest used to create the
/// partition tokens and the ReadRequests that use the partition tokens. There
/// are no ordering guarantees on rows returned among the returned partition
/// tokens, or even within each individual StreamingRead call issued with a
/// partition_token.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the read, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.PartitionResponse PartitionRead(global::Google.Cloud.Spanner.V1.PartitionReadRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return PartitionRead(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a read
/// operation in parallel. Each of the returned partition tokens can be used
/// by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a
/// subset of the read result to read. The same session and read-only
/// transaction must be used by the PartitionReadRequest used to create the
/// partition tokens and the ReadRequests that use the partition tokens. There
/// are no ordering guarantees on rows returned among the returned partition
/// tokens, or even within each individual StreamingRead call issued with a
/// partition_token.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the read, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.Spanner.V1.PartitionResponse PartitionRead(global::Google.Cloud.Spanner.V1.PartitionReadRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_PartitionRead, null, options, request);
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a read
/// operation in parallel. Each of the returned partition tokens can be used
/// by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a
/// subset of the read result to read. The same session and read-only
/// transaction must be used by the PartitionReadRequest used to create the
/// partition tokens and the ReadRequests that use the partition tokens. There
/// are no ordering guarantees on rows returned among the returned partition
/// tokens, or even within each individual StreamingRead call issued with a
/// partition_token.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the read, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.PartitionResponse> PartitionReadAsync(global::Google.Cloud.Spanner.V1.PartitionReadRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return PartitionReadAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates a set of partition tokens that can be used to execute a read
/// operation in parallel. Each of the returned partition tokens can be used
/// by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a
/// subset of the read result to read. The same session and read-only
/// transaction must be used by the PartitionReadRequest used to create the
/// partition tokens and the ReadRequests that use the partition tokens. There
/// are no ordering guarantees on rows returned among the returned partition
/// tokens, or even within each individual StreamingRead call issued with a
/// partition_token.
///
/// Partition tokens become invalid when the session used to create them
/// is deleted, is idle for too long, begins a new transaction, or becomes too
/// old. When any of these happen, it is not possible to resume the read, and
/// the whole operation must be restarted from the beginning.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.Spanner.V1.PartitionResponse> PartitionReadAsync(global::Google.Cloud.Spanner.V1.PartitionReadRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_PartitionRead, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override SpannerClient NewInstance(ClientBaseConfiguration configuration)
{
return new SpannerClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(SpannerBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_CreateSession, serviceImpl.CreateSession)
.AddMethod(__Method_GetSession, serviceImpl.GetSession)
.AddMethod(__Method_ListSessions, serviceImpl.ListSessions)
.AddMethod(__Method_DeleteSession, serviceImpl.DeleteSession)
.AddMethod(__Method_ExecuteSql, serviceImpl.ExecuteSql)
.AddMethod(__Method_ExecuteStreamingSql, serviceImpl.ExecuteStreamingSql)
.AddMethod(__Method_ExecuteBatchDml, serviceImpl.ExecuteBatchDml)
.AddMethod(__Method_Read, serviceImpl.Read)
.AddMethod(__Method_StreamingRead, serviceImpl.StreamingRead)
.AddMethod(__Method_BeginTransaction, serviceImpl.BeginTransaction)
.AddMethod(__Method_Commit, serviceImpl.Commit)
.AddMethod(__Method_Rollback, serviceImpl.Rollback)
.AddMethod(__Method_PartitionQuery, serviceImpl.PartitionQuery)
.AddMethod(__Method_PartitionRead, serviceImpl.PartitionRead).Build();
}
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
/// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
/// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static void BindService(grpc::ServiceBinderBase serviceBinder, SpannerBase serviceImpl)
{
serviceBinder.AddMethod(__Method_CreateSession, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.CreateSessionRequest, global::Google.Cloud.Spanner.V1.Session>(serviceImpl.CreateSession));
serviceBinder.AddMethod(__Method_GetSession, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.GetSessionRequest, global::Google.Cloud.Spanner.V1.Session>(serviceImpl.GetSession));
serviceBinder.AddMethod(__Method_ListSessions, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.ListSessionsRequest, global::Google.Cloud.Spanner.V1.ListSessionsResponse>(serviceImpl.ListSessions));
serviceBinder.AddMethod(__Method_DeleteSession, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.DeleteSessionRequest, global::Google.Protobuf.WellKnownTypes.Empty>(serviceImpl.DeleteSession));
serviceBinder.AddMethod(__Method_ExecuteSql, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.ExecuteSqlRequest, global::Google.Cloud.Spanner.V1.ResultSet>(serviceImpl.ExecuteSql));
serviceBinder.AddMethod(__Method_ExecuteStreamingSql, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod<global::Google.Cloud.Spanner.V1.ExecuteSqlRequest, global::Google.Cloud.Spanner.V1.PartialResultSet>(serviceImpl.ExecuteStreamingSql));
serviceBinder.AddMethod(__Method_ExecuteBatchDml, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.ExecuteBatchDmlRequest, global::Google.Cloud.Spanner.V1.ExecuteBatchDmlResponse>(serviceImpl.ExecuteBatchDml));
serviceBinder.AddMethod(__Method_Read, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.ReadRequest, global::Google.Cloud.Spanner.V1.ResultSet>(serviceImpl.Read));
serviceBinder.AddMethod(__Method_StreamingRead, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod<global::Google.Cloud.Spanner.V1.ReadRequest, global::Google.Cloud.Spanner.V1.PartialResultSet>(serviceImpl.StreamingRead));
serviceBinder.AddMethod(__Method_BeginTransaction, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.BeginTransactionRequest, global::Google.Cloud.Spanner.V1.Transaction>(serviceImpl.BeginTransaction));
serviceBinder.AddMethod(__Method_Commit, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.CommitRequest, global::Google.Cloud.Spanner.V1.CommitResponse>(serviceImpl.Commit));
serviceBinder.AddMethod(__Method_Rollback, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.RollbackRequest, global::Google.Protobuf.WellKnownTypes.Empty>(serviceImpl.Rollback));
serviceBinder.AddMethod(__Method_PartitionQuery, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.PartitionQueryRequest, global::Google.Cloud.Spanner.V1.PartitionResponse>(serviceImpl.PartitionQuery));
serviceBinder.AddMethod(__Method_PartitionRead, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Google.Cloud.Spanner.V1.PartitionReadRequest, global::Google.Cloud.Spanner.V1.PartitionResponse>(serviceImpl.PartitionRead));
}
}
}
#endregion
| 70.159401 | 372 | 0.710771 | [
"Apache-2.0"
] | Wackymax/google-cloud-dotnet | apis/Google.Cloud.Spanner.V1/Google.Cloud.Spanner.V1/SpannerGrpc.cs | 107,835 | C# |
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace BaGet.Protocol
{
/// <inheritdoc />
public class PackageContentClient : IPackageContentClient
{
private readonly HttpClient _httpClient;
/// <summary>
/// Create a new Package Content client.
/// </summary>
/// <param name="httpClient">The HTTP client used to send requests.</param>
public PackageContentClient(HttpClient httpClient)
{
_httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
}
/// <inheritdoc />
public async Task<PackageVersions> GetPackageVersionsOrNullAsync(string url)
{
var response = await _httpClient.DeserializeUrlAsync<PackageVersions>(url);
if (response.StatusCode == HttpStatusCode.NotFound)
{
return null;
}
return response.GetResultOrThrow();
}
/// <inheritdoc />
public async Task<Stream> GetPackageContentStreamAsync(string url)
{
var response = await _httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsStreamAsync();
}
/// <inheritdoc />
public async Task<Stream> GetPackageManifestStreamAsync(string url)
{
var response = await _httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsStreamAsync();
}
}
}
| 28.803571 | 92 | 0.618103 | [
"MIT"
] | 3da/BaGet | src/BaGet.Protocol/PackageContent/PackageContentClient.cs | 1,613 | C# |
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("PlayerPrefs")]
[Tooltip("Sets the value of the preference identified by key.")]
public class PlayerPrefsSetInt : FsmStateAction
{
[CompoundArray("Count", "Key", "Value")]
[Tooltip("Case sensitive key.")]
public FsmString[] keys;
public FsmInt[] values;
public override void Reset()
{
keys = new FsmString[1];
values = new FsmInt[1];
}
public override void OnEnter()
{
for(int i = 0; i<keys.Length;i++){
if(!keys[i].IsNone || !keys[i].Value.Equals("")) PlayerPrefs.SetInt(keys[i].Value, values[i].IsNone ? 0 : values[i].Value);
}
Finish();
}
}
} | 26.310345 | 128 | 0.644823 | [
"Apache-2.0"
] | Drestat/ARfun | ARfun/Assets/PlayMaker/Actions/PlayerPrefs/PlayerPrefsSetInt.cs | 763 | C# |
/*
* Copyright (c) 2008, DIaLOGIKa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of DIaLOGIKa nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY DIaLOGIKa ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL DIaLOGIKa BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace DIaLOGIKa.b2xtranslator.OpenXmlLib
{
public class ExternalRelationship
{
protected string _id;
protected string _relationshipType;
protected string _target;
public ExternalRelationship(string id, string relationshipType, Uri targetUri)
{
_id = id;
_relationshipType = relationshipType;
_target = targetUri.ToString();
}
public ExternalRelationship(string id, string relationshipType, string target)
{
_id = id;
_relationshipType = relationshipType;
_target = target;
}
public string Id
{
get { return _id; }
set { _id = value; }
}
public string RelationshipType
{
get { return _relationshipType; }
set { _relationshipType = value; }
}
public string Target
{
get { return _target; }
set { _target = value; }
}
public Uri TargetUri
{
get { return new Uri(_target, UriKind.RelativeOrAbsolute); }
}
}
}
| 36.87013 | 87 | 0.643889 | [
"BSD-3-Clause"
] | datadiode/B2XTranslator | src/Common/OpenXmlLib/ExternalRelationship.cs | 2,839 | C# |
namespace XpressTest;
public class ResultMockVerifierCreator<TSut, TSutResult>
:
IResultMockVerifierCreator<TSut, TSutResult>
where TSut : class
{
private readonly IMockCountVerifierCreatorComposer<IResultAsserter<TSut, TSutResult>> _mockCounterVerifierCreatorComposer;
private readonly IMockCountVerifierCreatorComposer<IAsyncResultAsserter<TSut, TSutResult>> _asyncMockCounterVerifierCreatorComposer;
public ResultMockVerifierCreator(
IMockCountVerifierCreatorComposer<IResultAsserter<TSut, TSutResult>> mockCounterVerifierCreatorComposer,
IMockCountVerifierCreatorComposer<IAsyncResultAsserter<TSut, TSutResult>> asyncMockCounterVerifierCreatorComposer
)
{
_mockCounterVerifierCreatorComposer = mockCounterVerifierCreatorComposer;
_asyncMockCounterVerifierCreatorComposer = asyncMockCounterVerifierCreatorComposer;
}
public IAsyncResultMockVerifier<TSut, TSutResult, TMock> Create<TMock>(
IAsyncResultAsserter<TSut, TSutResult> asserter
)
where TMock : class
{
var mockCounterVerifierCreator = _asyncMockCounterVerifierCreatorComposer.Compose<TMock>(
asserter
);
return new AsyncResultMockVerifier<TSut, TSutResult, TMock>(
mockCounterVerifierCreator,
asserter
);
}
public IAsyncResultMockVerifier<TSut, TSutResult, TMock> Create<TMock>(
IMock<TMock> mock,
IAsyncResultAsserter<TSut, TSutResult> asserter
)
where TMock : class
{
var mockCounterVerifierCreator = _asyncMockCounterVerifierCreatorComposer.Compose(
mock,
asserter
);
return new AsyncResultMockVerifier<TSut, TSutResult, TMock>(
mockCounterVerifierCreator,
asserter
);
}
public IResultMockVerifier<TSut, TSutResult, TMock> Create<TMock>(
IMock<TMock> mock,
IResultAsserter<TSut, TSutResult> asserter
)
where TMock : class
{
var mockCounterVerifierCreator = _mockCounterVerifierCreatorComposer.Compose(
mock,
asserter
);
return new ResultMockVerifier<TSut, TSutResult, TMock>(
mockCounterVerifierCreator,
asserter
);
}
} | 34.117647 | 136 | 0.696983 | [
"MIT"
] | JonnyOrman/XpressTest | Code/XpressTest/ResultMockVerifierCreator.cs | 2,320 | C# |
using test;
using Xamarin.Forms;
namespace PopupMediaCamera
{
public class App : Application
{
public App()
{
MainPage = new NavigationPage(new Page1());
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
///// <summary>
///// The get navigation.
///// </summary>
///// <returns>
///// The <see cref="NavigationPage"/>.
///// </returns>
public static NavigationPage GetNavigation()
{
var page = Current.MainPage as NavigationPage;
return page;
}
}
}
| 21.675 | 58 | 0.493656 | [
"MIT"
] | AndreiMisiukevich/MediaPlugin | tests/PopupMediaCamera/App.cs | 869 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.