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 Godot;
namespace Osls.Plants.MassTestChamber
{
public class EmitterParticles : Particles
{
#region ==================== Fields / Properties ====================
private ParticlesMaterial _processMaterial;
/// <summary>
/// true if the process is valid and mass is added
/// </summary>
public bool IsProvidingMass { get; private set; }
/// <summary>
/// true if the particles are not caged and start roaming in the area
/// </summary>
public bool IsLeakingParticles { get; private set; }
#endregion
#region ==================== Public Methods ====================
/// <summary>
/// Called before the simulation is added to the main tree
/// </summary>
public void Setup()
{
_processMaterial = (ParticlesMaterial)ProcessMaterial;
}
/// <summary>
/// The particles will run out with TIME
/// </summary>
public void ShowAsOff(Cart cart)
{
if (Emitting) Emitting = false;
IsProvidingMass = false;
ShowAsToFarAway(1f - cart.RailPosition);
IsLeakingParticles = false;
}
/// <summary>
/// Will emit particles according to the current state.
/// The cart must be at the front position, the force field off and the focus on.
/// </summary>
public void ShowAsActiveWith(Cart cart, bool field, bool focus)
{
if (!Emitting) Emitting = true;
if (field)
{
ShowAsInvalidField();
IsProvidingMass = false;
IsLeakingParticles = true;
}
else
{
if (focus)
{
if (cart.FrontPositionReached)
{
ShowAsCorrect();
IsProvidingMass = true;
IsLeakingParticles = false;
}
else
{
ShowAsToFarAway(1f - cart.RailPosition);
IsProvidingMass = false;
IsLeakingParticles = false;
}
}
else
{
ShowAsNoFocus();
IsProvidingMass = false;
IsLeakingParticles = true;
}
}
}
#endregion
#region ==================== Helpers ====================
private void ShowAsCorrect()
{
_processMaterial.Spread = 20f;
_processMaterial.Gravity = new Vector3(-5f, 0f, 0f);
_processMaterial.RadialAccel = -10f;
_processMaterial.TangentialAccel = 0f;
_processMaterial.Damping = 5f;
}
/// <summary>
/// Used if the cart is too far away from the intended position.
/// </summary>
/// <param name="amount">from 0 (correct frontal position) to 1 (back position)</param>
private void ShowAsToFarAway(float amount)
{
_processMaterial.Spread = 20f;
_processMaterial.Gravity = new Vector3(-5f, 0f, 0f);
_processMaterial.RadialAccel = -10f;
_processMaterial.TangentialAccel = 6f * amount;
_processMaterial.Damping = 5f;
}
/// <summary>
/// Used if no focus is active for the particles
/// </summary>
private void ShowAsNoFocus()
{
_processMaterial.Spread = 7f;
_processMaterial.Gravity = new Vector3(5.5f, 0f, 0f);
_processMaterial.RadialAccel = 0f;
_processMaterial.TangentialAccel = 0f;
_processMaterial.Damping = 4f;
}
/// <summary>
/// Used if the force field is already active which will blow non caged particles away
/// </summary>
private void ShowAsInvalidField()
{
_processMaterial.Spread = 10f;
_processMaterial.Gravity = new Vector3(5f, 0f, 0f);
_processMaterial.RadialAccel = 0f;
_processMaterial.TangentialAccel = 0f;
_processMaterial.Damping = 5f;
}
#endregion
}
}
| 33.278195 | 95 | 0.488251 | [
"MIT"
] | Kersoph/open-sequential-logic-sandbox | data/plant_models/mass_test_chamber/spatial_elements/EmitterParticles.cs | 4,426 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
using JT809.Protocol;
using JT809.Protocol.Extensions;
using JT809.Protocol.MessageBody;
using JT809.Protocol.Exceptions;
using JT809.Protocol.SubMessageBody;
using JT809.Protocol.Enums;
using JT809.Protocol.Internal;
namespace JT809.Protocol.Test.JT809SubMessageBody
{
public class JT809_0x1200_0x120ATest
{
private JT809Serializer JT809Serializer = new JT809Serializer();
private JT809Serializer JT809_2019_Serializer = new JT809Serializer(new DefaultGlobalConfig() { Version = JT809Version.JTT2019 });
[Fact]
public void Test1()
{
JT809_0x1200_0x120A jT809_0X1200_0X120A = new JT809_0x1200_0x120A
{
DriverID = "123456789123456789",
DriverName = "smallchi",
Licence= "abcdef123456789",
OrgName= "www123456789"
};
var hex = JT809Serializer.Serialize(jT809_0X1200_0X120A).ToHexString();
//"73 6D 61 6C 6C 63 68 69 00 00 00 00 00 00 00 00 31 32 33 34 35 36 37 38 39 31 32 33 34 35 36 37 38 39 00 00 61 62 63 64 65 66 31 32 33 34 35 36 37 38 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 77 77 77 31 32 33 34 35 36 37 38 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
Assert.Equal("736D616C6C63686900000000000000003132333435363738393132333435363738390000616263646566313233343536373839000000000000000000000000000000000000000000000000007777773132333435363738390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", hex);Assert.Equal("736D616C6C63686900000000000000003132333435363738393132333435363738390000616263646566313233343536373839000000000000000000000000000000000000000000000000007777773132333435363738390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", hex);
}
[Fact]
public void Test2()
{
var bytes = "73 6D 61 6C 6C 63 68 69 00 00 00 00 00 00 00 00 31 32 33 34 35 36 37 38 39 31 32 33 34 35 36 37 38 39 00 00 61 62 63 64 65 66 31 32 33 34 35 36 37 38 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 77 77 77 31 32 33 34 35 36 37 38 39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00".ToHexBytes();
JT809_0x1200_0x120A jT809_0X1200_0X120A = JT809Serializer.Deserialize<JT809_0x1200_0x120A>(bytes);
Assert.Equal("123456789123456789", jT809_0X1200_0X120A.DriverID);
Assert.Equal("smallchi", jT809_0X1200_0X120A.DriverName);
Assert.Equal("abcdef123456789", jT809_0X1200_0X120A.Licence);
Assert.Equal("www123456789", jT809_0X1200_0X120A.OrgName);
}
[Fact]
public void Test_2019_1()
{
JT809_0x1200_0x120A jT809_0X1200_0X120A = new JT809_0x1200_0x120A
{
DriverID = "123456789123456789",
DriverName = "smallchi",
Licence = "abcdef123456789",
OrgName = "www123456789",
ValidDate = DateTime.Parse("2020-04-23 22:22:22"),
SourceDataType=0x02,
SourceMsgSn=1
};
var hex = JT809_2019_Serializer.Serialize(jT809_0X1200_0X120A).ToHexString();
Assert.Equal("000200000001736D616C6C63686900000000000000003132333435363738393132333435363738390000616263646566313233343536373839000000000000000000000000000000000000000000000000007777773132333435363738390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005EA1A49E", hex);
}
[Fact]
public void Test_2019_2()
{
var bytes = "000200000001736D616C6C63686900000000000000003132333435363738393132333435363738390000616263646566313233343536373839000000000000000000000000000000000000000000000000007777773132333435363738390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005EA1A49E".ToHexBytes();
JT809_0x1200_0x120A jT809_0X1200_0X120A = JT809_2019_Serializer.Deserialize<JT809_0x1200_0x120A>(bytes);
Assert.Equal("123456789123456789", jT809_0X1200_0X120A.DriverID);
Assert.Equal("smallchi", jT809_0X1200_0X120A.DriverName);
Assert.Equal("abcdef123456789", jT809_0X1200_0X120A.Licence);
Assert.Equal("www123456789", jT809_0X1200_0X120A.OrgName);
Assert.Equal(DateTime.Parse("2020-04-23 22:22:22"), jT809_0X1200_0X120A.ValidDate);
Assert.Equal(0x02, jT809_0X1200_0X120A.SourceDataType);
Assert.Equal(1u, jT809_0X1200_0X120A.SourceMsgSn);
}
}
}
| 86.7625 | 1,160 | 0.757384 | [
"MIT"
] | AchaInChina/JT809 | src/JT809.Protocol.Test/JT809SubMessageBody/JT809_0x1200_0x120ATest.cs | 6,943 | C# |
using System;
using EasyNetQ.DI;
namespace EasyNetQ.Interception
{
public static class InterceptionExtensions
{
public static IServiceRegister EnableInterception(this IServiceRegister serviceRegister, Action<IInterceptorRegistrator> configure)
{
var registrator = new InterceptorRegistrator(serviceRegister);
configure(registrator);
return registrator.Register();
}
public static IInterceptorRegistrator EnableGZipCompression(this IInterceptorRegistrator interceptorRegistrator)
{
interceptorRegistrator.Add(new GZipInterceptor());
return interceptorRegistrator;
}
public static IInterceptorRegistrator EnableTripleDESEncryption(this IInterceptorRegistrator interceptorRegistrator, byte[] key, byte[] iv)
{
interceptorRegistrator.Add(new TripleDESInterceptor(key, iv));
return interceptorRegistrator;
}
}
} | 36.222222 | 147 | 0.706544 | [
"MIT"
] | Eu-JinOoi/EasyNetQ | Source/EasyNetQ/Interception/InterceptionExtensions.cs | 980 | C# |
using AutoMapper;
using Microsoft.Extensions.DependencyInjection;
using Ridics.Authentication.Service.MapperProfiles;
using Ridics.Authentication.Service.MapperProfiles.Contracts;
using Ridics.Authentication.Service.MapperProfiles.Converters;
using Ridics.Authentication.Service.MapperProfiles.Resolvers.UserContacts;
using Ridics.Authentication.Service.MapperProfiles.Resolvers.UserData;
using Ridics.Authentication.Service.MapperProfiles.Sorters.Implementation;
using Ridics.Authentication.Service.MapperProfiles.Sorters.Interfaces;
using Ridics.Core.Structures.Shared;
namespace Ridics.Authentication.Service.IoC
{
public static class IocAutomapperRegistrationExtensions
{
public static void RegisterAutomapper(this IServiceCollection services)
{
services.AddScoped<IMapper>((c) => Mapper.Instance);
services.RegisterMapperProfiles();
services.RegisterAutomapperResolvers();
services.RegisterAutomapperConverters();
services.RegisterSorters();
}
private static void RegisterAutomapperResolvers(this IServiceCollection services)
{
services.AddScoped<UserDataToListResolver<IConvertibleToUserData>>();
services.AddScoped<UserContactConfirmCodeResolver<IConvertibleToUserContacts>>();
}
private static void RegisterAutomapperConverters(this IServiceCollection services)
{
services.AddScoped<DateTimeOffsetToUtcDateTimeConverter>();
services.AddScoped<UtcDateTimeToDateTimeOffsetConverter>();
}
private static void RegisterMapperProfiles(this IServiceCollection services)
{
services.AddScoped<Profile, ApiAccessKeyProfile>();
services.AddScoped<Profile, ClaimProfile>();
services.AddScoped<Profile, ClaimTypeEnumProfile>();
services.AddScoped<Profile, ClaimTypeProfile>();
services.AddScoped<Profile, ClientProfile>();
services.AddScoped<Profile, DateTimeProfile>();
services.AddScoped<Profile, DynamicModuleProfile>();
services.AddScoped<Profile, ExternalLoginProfile>();
services.AddScoped<Profile, ExternalLoginProviderProfile>();
services.AddScoped<Profile, GrantTypeProfile>();
services.AddScoped<Profile, PermissionProfile>();
services.AddScoped<Profile, PersistedGrantProfile>();
services.AddScoped<Profile, ResourcePermissionProfile>();
services.AddScoped<Profile, ResourcePermissionTypeActionProfile>();
services.AddScoped<Profile, ResourcePermissionTypeProfile>();
services.AddScoped<Profile, ResourceProfile>();
services.AddScoped<Profile, RoleProfile>();
services.AddScoped<Profile, ScopeProfile>();
services.AddScoped<Profile, SecretProfile>();
services.AddScoped<Profile, TwoFactorLoginProfile>();
services.AddScoped<Profile, UriProfile>();
services.AddScoped<Profile, UserProfile>();
RegisterMapperContractProfiles(services);
}
private static void RegisterMapperContractProfiles(IServiceCollection services)
{
services.AddTransient<Profile, PermissionContractProfile>();
services.AddTransient<Profile, RoleContractProfile>();
services.AddTransient<Profile, UserContactContractProfile>();
services.AddTransient<Profile, UserContractProfile>();
services.AddTransient<Profile, ExternalLoginProviderContractProfile>();
services.AddTransient<Profile, ExternalLoginContractProfile>();
}
private static void RegisterSorters(this IServiceCollection services)
{
services.AddScoped<IApiResourceSorter, ApiResourceByNameSorter>();
services.AddScoped<IApiSecretSorter, ApiSecretByValueSorter>();
services.AddScoped<IClaimSorter, ClaimByValueSorter>();
services.AddScoped<IClaimTypeSorter, ClaimTypeByNameSorter>();
services.AddScoped<IContactSorter, ContactByValueSorter>();
services.AddScoped<IGrantTypeSorter, GrantTypeByDisplayNameSorter>();
services.AddScoped<IIdentityResourceSorter, IdentityResourceByNameSorter>();
services.AddScoped<IPermissionSorter, PermissionByNameSorter>();
services.AddScoped<IResourcePermissionSorter, ResourcePermissionByResourceIdSorter>();
services.AddScoped<IResourcePermissionTypeActionSorter, ResourcePermissionTypeActionByNameSorter>();
services.AddScoped<IRoleSorter, RoleByNameSorter>();
services.AddScoped<IScopeSorter, ScopeByNameSorter>();
services.AddScoped<ISecretSorter, SecretByValueSorter>();
services.AddScoped<IUriSorter, UriByValueSorter>();
services.AddScoped<IUserSorter, UserByLastAndFirstNameSorter>();
services.AddScoped<IUserInfoSorter, UserInfoByUsernameSorter>();
services.AddScoped<IUserDataSorter, UserDataByValueSorter>();
}
}
}
| 52.752577 | 112 | 0.716045 | [
"BSD-3-Clause"
] | RIDICS/Authentication | Solution/Ridics.Authentication.Service/IoC/IocAutomapperRegistrationExtensions.cs | 5,119 | C# |
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
namespace EasyTcp3.ClientUtils.Async
{
/// <summary>
/// Class with all ConnectAsync functions
/// </summary>
public static class ConnectAsyncUtil
{
/// <summary>
/// Establishes connection with remote host
/// </summary>
/// <param name="client"></param>
/// <param name="endPoint">endPoint of remote host</param>
/// <param name="socket">socket for EasyTcpClient, new one is create when null</param>
/// <returns>determines whether the client connected successfully</returns>
public static async Task<bool> ConnectAsync(this EasyTcpClient client, EndPoint endPoint, Socket socket = null)
{
if (client == null) throw new ArgumentException("Could not connect: client is null");
if (endPoint == null) throw new ArgumentException("Could not connect: endpoint is null");
if (client.BaseSocket != null) throw new ArgumentException("Could not connect: client is still connected");
try
{
client.BaseSocket = socket ?? client.Protocol.GetSocket(endPoint.AddressFamily);
await client.BaseSocket.ConnectAsync(endPoint);
if (client.BaseSocket.Connected && client.Protocol.OnConnect(client))
{
client.FireOnConnect();
return true;
}
}
catch
{
//Ignore exception, dispose (&disconnect) client and return false
}
client.Dispose();
return false;
}
/// <summary>
/// Establishes connection with remote host
/// </summary>
/// <param name="client"></param>
/// <param name="ipAddress">ipAddress of remote host</param>
/// <param name="port">port of remote host</param>
/// <param name="socket">socket for EasyTcpClient, new one is create when null</param>
/// <returns>determines whether the client connected successfully</returns>
public static async Task<bool> ConnectAsync(this EasyTcpClient client, IPAddress ipAddress, ushort port,
Socket socket = null)
=> await client.ConnectAsync(new IPEndPoint(ipAddress, port), socket);
/// <summary>
/// Establishes connection with remote host
/// </summary>
/// <param name="client"></param>
/// <param name="ipAddress">ipAddress of remote host as string</param>
/// <param name="port">port of remote host</param>
/// <param name="socket">socket for EasyTcpClient, new one is create when null</param>
/// <returns>determines whether the client connected successfully</returns>
/// <exception cref="ArgumentException">ipAddress is not a valid IPv4/IPv6 address</exception>
public static async Task<bool> ConnectAsync(this EasyTcpClient client, string ipAddress, ushort port,
Socket socket = null)
{
if (!IPAddress.TryParse(ipAddress, out IPAddress address))
throw new ArgumentException(
"Could not connect to remote host: ipAddress is not a valid IPv4/IPv6 address");
return await client.ConnectAsync(address, port, socket);
}
}
} | 44.578947 | 119 | 0.61098 | [
"MIT"
] | Maarten-Baert/EasyTcp | EasyTcp3/EasyTcp3/ClientUtils/Async/ConnectAsyncUtil.cs | 3,388 | C# |
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
namespace PythonBinding.Tests.Converter
{
/// <summary>
/// Tests ArithmeticOperatorType conversions:
///
/// None,
/// Assign,
///
/// Add, Done
/// Subtract,
/// Multiply,
/// Divide,
/// Modulus,
///
/// Power, // (VB only)
/// DivideInteger, // (VB only)
/// ConcatString, // (VB only)
///
/// ShiftLeft,
/// ShiftRight,
///
/// BitwiseAnd,
/// BitwiseOr,
/// ExclusiveOr
/// </summary>
[TestFixture]
public class AssignmentOperatorConversionTestFixture
{
string csharp = "class Foo\r\n" +
"{\r\n" +
"\tpublic void Convert(int a)\r\n" +
"\t{\r\n" +
"\t\ta ASSIGNMENT_OPERATOR 5;\r\n" +
"\t}\r\n" +
"}";
string vb = "Namespace DefaultNamespace\r\n" +
"\tPublic Class Foo\r\n" +
"\t\tPublic Sub Convert(ByVal a as Integer)\r\n" +
"\t\t\ta ASSIGNMENT_OPERATOR 5;\r\n" +
"\t\tEnd Sub\r\n" +
"\tEnd Class\r\n" +
"End Namespace";
string pythonCodeTemplate = "class Foo(object):\r\n" +
"\tdef Convert(self, a):\r\n" +
"\t\ta ASSIGNMENT_OPERATOR 5";
[Test]
public void MultiplyOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(GetCode(csharp, "*="));
string expectedPython = GetCode(pythonCodeTemplate, "*=");
Assert.AreEqual(expectedPython, python);
}
[Test]
public void DivideOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(GetCode(csharp, "/="));
string expectedPython = GetCode(pythonCodeTemplate, "/=");
Assert.AreEqual(expectedPython, python);
}
[Test]
public void AndOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(GetCode(csharp, "&="));
string expectedPython = GetCode(pythonCodeTemplate, "&=");
Assert.AreEqual(expectedPython, python);
}
[Test]
public void OrOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(GetCode(csharp, "|="));
string expectedPython = GetCode(pythonCodeTemplate, "|=");
Assert.AreEqual(expectedPython, python);
}
[Test]
public void ExclusiveOrOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(GetCode(csharp, "^="));
string expectedPython = GetCode(pythonCodeTemplate, "^=");
Assert.AreEqual(expectedPython, python);
}
[Test]
public void ShiftLeftOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(GetCode(csharp, "<<="));
string expectedPython = GetCode(pythonCodeTemplate, "<<=");
Assert.AreEqual(expectedPython, python);
}
[Test]
public void ShiftRightOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(GetCode(csharp, ">>="));
string expectedPython = GetCode(pythonCodeTemplate, ">>=");
Assert.AreEqual(expectedPython, python);
}
[Test]
public void VBConcatOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet);
string python = converter.Convert(GetCode(vb, "&="));
string expectedPython = GetCode(pythonCodeTemplate, "+=");
Assert.AreEqual(expectedPython, python);
}
[Test]
public void VBDivideIntegerOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet);
string python = converter.Convert(GetCode(vb, "\\="));
string expectedPython = GetCode(pythonCodeTemplate, "/=");
Assert.AreEqual(expectedPython, python);
}
[Test]
public void VBPowerOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet);
string python = converter.Convert(GetCode(vb, "^="));
string expectedPython = GetCode(pythonCodeTemplate, "**=");
Assert.AreEqual(expectedPython, python);
}
string GetCode(string code, string assignmentOperator)
{
return code.Replace("ASSIGNMENT_OPERATOR", assignmentOperator);
}
}
}
| 29.515337 | 103 | 0.687383 | [
"MIT"
] | Plankankul/SharpDevelop-w-Framework | src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/AssignmentOperatorConversionTestFixture.cs | 4,813 | C# |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: StreamRequest.cs.tt
namespace Microsoft.Graph
{
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading;
/// <summary>
/// The type PrintDocumentContentRequest.
/// </summary>
public partial class PrintDocumentContentRequest : BaseRequest, IPrintDocumentContentRequest
{
/// <summary>
/// Constructs a new PrintDocumentContentRequest.
/// <param name="requestUrl">The request URL.</param>
/// <param name="client">The <see cref="IBaseClient"/> for handling requests.</param>
/// <param name="options">Query option name value pairs for the request.</param>
/// </summary>
public PrintDocumentContentRequest(
string requestUrl,
IBaseClient client,
IEnumerable<Option> options)
: base(requestUrl, client, options)
{
}
/// <summary>
/// Gets the stream.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <param name="completionOption">The <see cref="HttpCompletionOption"/> to pass to the <see cref="IHttpProvider"/> on send.</param>
/// <returns>The stream.</returns>
public System.Threading.Tasks.Task<Stream> GetAsync(CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
this.Method = HttpMethods.GET;
return this.SendStreamRequestAsync(null, cancellationToken, completionOption);
}
/// <summary>
/// Gets the <see cref="GraphResponse"/> object of the request.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <param name="completionOption">The <see cref="HttpCompletionOption"/> to pass to the <see cref="IHttpProvider"/> on send.</param>
/// <returns>The <see cref="GraphResponse"/> object of the request.</returns>
public System.Threading.Tasks.Task<GraphResponse> GetResponseAsync(CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
this.Method = HttpMethods.GET;
return this.SendAsyncWithGraphResponse(null, cancellationToken, completionOption);
}
/// <summary>
/// PUTs the specified stream.
/// </summary>
/// <param name="content">The stream to PUT.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <param name="completionOption">The <see cref="HttpCompletionOption"/> to pass to the <see cref="IHttpProvider"/> on send.</param>
/// <returns>The updated stream.</returns>
public System.Threading.Tasks.Task<Stream> PutAsync(Stream content, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
this.ContentType ??= CoreConstants.MimeTypeNames.Application.Stream;
this.Method = HttpMethods.PUT;
return this.SendStreamRequestAsync(content, cancellationToken, completionOption);
}
/// <summary>
/// PUTs the specified stream and returns a <see cref="GraphResponse"/> object.
/// </summary>
/// <param name="content">The stream to PUT.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <param name="completionOption">The <see cref="HttpCompletionOption"/> to pass to the <see cref="IHttpProvider"/> on send.</param>
/// <returns>The <see cref="GraphResponse"/> object returned by the PUT call.</returns>
public System.Threading.Tasks.Task<GraphResponse> PutResponseAsync(Stream content, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
this.ContentType ??= CoreConstants.MimeTypeNames.Application.Stream;
this.Method = HttpMethods.PUT;
return this.SendAsyncWithGraphResponse(content, cancellationToken, completionOption);
}
}
}
| 53.144444 | 219 | 0.646874 | [
"MIT"
] | ScriptBox99/msgraph-beta-sdk-dotnet | src/Microsoft.Graph/Generated/requests/PrintDocumentContentRequest.cs | 4,783 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.ComponentModel;
using MeetingDataExchange.Model;
using System.Collections.ObjectModel;
using MeetingDataExchange.ServerCommunication;
using System.Windows.Threading;
namespace MeetingDataExchange.Pages
{
public partial class MeetingsPage : PhoneApplicationPage, INotifyPropertyChanged
{
private MDEDataContext MDEDB;
private Server server;
private readonly DispatcherTimer _timer;
private ObservableCollection<Meeting> _meetings;
public ObservableCollection<Meeting> meetings
{
get
{
return _meetings;
}
set
{
if (_meetings != value)
{
_meetings = value;
NotifyPropertyChanged("meetings");
}
}
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
MDEDB = new MDEDataContext();
string serverName = NavigationContext.QueryString["serverName"];
server = new ObservableCollection<Server>(from Server s in MDEDB.Servers where s.serverName == serverName select s)[0];
serverNameTextBox.Text = serverName;
meetings = new ObservableCollection<Meeting>(server.meetings);
refresh();
_timer.Start();
base.OnNavigatedTo(e);
}
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
_timer.Stop();
base.OnNavigatedFrom(e);
}
public MeetingsPage()
{
InitializeComponent();
this.DataContext = this;
_timer = new DispatcherTimer();
_timer.Interval = TimeSpan.FromMilliseconds(10000);
_timer.Tick += (o, arg) => refresh();
}
public void meetingClicked(Object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Pages/MeetingPage.xaml?meetingID=" + ((Button)sender).Tag, UriKind.Relative));//
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
// Used to notify the app that a property has changed.
private void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
private void setControlEnabled(bool isEnabled)
{
progressBar.Visibility = isEnabled ? Visibility.Collapsed : Visibility.Visible;
}
public void refresh()
{
setControlEnabled(false);
string url = server.address + "/api/meeting/list/" + server.login + "/" + server.sid;
new HttpGetRequest<MeetingsListOutput>(url, meetingListCallback);
}
private void meetingListCallback(MeetingsListOutput output)
{
this.Dispatcher.BeginInvoke(delegate()
{
if (output == null)
{
//MessageBox.Show("Error communicating with server. Check your internet connection and try again.");
connectionFailureTextBlock.Visibility = System.Windows.Visibility.Visible;
}
else if (output.status == "ok")
{
connectionFailureTextBlock.Visibility = System.Windows.Visibility.Collapsed;
foreach (MeetingOutput meetingOutput in output.meetings)
{
var meeting = (from Meeting m in MDEDB.Meetings where m.serverMeetingID == meetingOutput.meetingid select m);
if (meeting.Count() == 0)
{
MDEDB.Meetings.InsertOnSubmit(meetingOutput.getEntity(server));
}
else
{
Meeting m1 = meeting.ToList()[0];
Meeting m2 = meetingOutput.getEntity(server);
m1.adminName = m2.adminName;
m1.topic = m2.topic;
m1.title = m1.title;
m1.numerOfMembers = m2.numerOfMembers;
m1.permissions = m2.permissions;
m1.startTime = m2.startTime;
m1.endTime = m2.endTime;
}
}
MDEDB.SubmitChanges();
meetings = new ObservableCollection<Meeting>(from Meeting m in MDEDB.Meetings
where m.server == server
select m);
}
else
{
MessageBox.Show("Unable to refresh.\nServer response:\n" + output.reason);
}
setControlEnabled(true);
});
}
}
} | 36.633987 | 137 | 0.522212 | [
"MIT"
] | nokia-wroclaw/innovativeproject-meetingdataexchange | MeetingDataExchangeWinPhone/MeetingDataExchange/Pages/MeetingsPage.xaml.cs | 5,607 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.ML;
using Microsoft.ML.Data;
using ImageClassification.IO;
namespace ImageClassification
{
public static class Classifier
{
/// <summary>
/// Returns the result of predicting what the image file is, using the saved model trained by Trainer.GenerateModel().(Trainer.GenerateModel()で学習させた保存済みモデルを使用して、画像ファイルが何であるかを予測した結果を返します。)
/// </summary>
/// <param name="pipelineZipFilePath"></param>
/// <param name="trainedModelZipFilePath"></param>
/// <param name="targetImageFile"></param>
/// <returns></returns>
public static ImageResult GetSingleImagePrediction(string pipelineZipFilePath, string trainedModelZipFilePath, string targetImageFile)
{
MLContext mlContext = new MLContext(seed: 1);
DataViewSchema dataPrepPipelineSchema, modelSchema;
// データ準備パイプラインとトレーニング済みモデルを読み込む
ITransformer dataPrepPipeline = mlContext.Model.Load(pipelineZipFilePath, out dataPrepPipelineSchema);
ITransformer trainedModel = mlContext.Model.Load(trainedModelZipFilePath, out modelSchema);
// データのロード
var data = new List<ImageData>();
data.Add(new ImageData { ImagePath = targetImageFile });
var dataView = mlContext.Data.LoadFromEnumerable(data);
var transformedDataView = dataPrepPipeline.Transform(dataView);
var prediction = trainedModel.Transform(transformedDataView);
var predictions = mlContext.Data.CreateEnumerable<ImagePrediction>(prediction, reuseRowObject: true);
// ラベルと予測文字列のキーバリューを取得
VBuffer<ReadOnlyMemory<char>> keyValues = default;
transformedDataView.Schema["Label"].GetKeyValues(ref keyValues);
return new ImageResult(predictions.First(), keyValues);
}
public static ImageResult GetSingleImagePrediction(MLContext mlContext, ITransformer dataPrepPipeline, ITransformer trainedModel, string targetImageFile)
{
// データのロード
var data = new List<ImageData>();
data.Add(new ImageData { ImagePath = targetImageFile });
var dataView = mlContext.Data.LoadFromEnumerable(data);
var transformedDataView = dataPrepPipeline.Transform(dataView);
var prediction = trainedModel.Transform(transformedDataView);
var predictions = mlContext.Data.CreateEnumerable<ImagePrediction>(prediction, reuseRowObject: true);
// ラベルと予測文字列のキーバリューを取得
VBuffer<ReadOnlyMemory<char>> keyValues = default;
transformedDataView.Schema["Label"].GetKeyValues(ref keyValues);
return new ImageResult(predictions.First(), keyValues);
}
public static List<ImageResult> GetBulkImagePrediction(string pipelineZipFilePath, string trainedModelZipFilePath, string targetImagesFolder)
{
MLContext mlContext = new MLContext(seed: 1);
DataViewSchema dataPrepPipelineSchema, modelSchema;
// データ準備パイプラインとトレーニング済みモデルを読み込む
ITransformer dataPrepPipeline = mlContext.Model.Load(pipelineZipFilePath, out dataPrepPipelineSchema);
ITransformer trainedModel = mlContext.Model.Load(trainedModelZipFilePath, out modelSchema);
// データのロード
var dataFiles = Directory.EnumerateFiles(targetImagesFolder, "*", SearchOption.AllDirectories).Where(s =>
s.EndsWith(".jpg", StringComparison.CurrentCultureIgnoreCase) || s.EndsWith(".png", StringComparison.CurrentCultureIgnoreCase));
var dataSet = dataFiles.Select(f => new ImageData
{
ImagePath = f,
Name = Directory.GetParent(f).Name
});
var dataView = mlContext.Data.LoadFromEnumerable(dataSet);
var transformedDataView = dataPrepPipeline.Transform(dataView);
var prediction = trainedModel.Transform(transformedDataView);
var predictions = mlContext.Data.CreateEnumerable<ImagePrediction>(prediction, reuseRowObject: true);
// ラベルと予測文字列のキーバリューを取得
VBuffer<ReadOnlyMemory<char>> keyValues = default;
transformedDataView.Schema["Label"].GetKeyValues(ref keyValues);
var allImgResults = new List<ImageResult>();
foreach (var p in predictions)
{
allImgResults.Add(new ImageResult(p, keyValues));
}
var imgResults = (from a in allImgResults orderby a.HighScore descending select a);
return imgResults.ToList();
}
}
}
| 49.957447 | 195 | 0.675256 | [
"MIT"
] | teonsen/ImageClassification | ImageClassification/Classifier.cs | 5,054 | C# |
using System;
namespace Ultraviolet.Presentation.Animations
{
/// <summary>
/// Represents a clock which tracks the timing state of a simple animations.
/// </summary>
public sealed class SimpleClock : Clock
{
/// <summary>
/// Initializes a new instance of the <see cref="SimpleClock"/> class.
/// </summary>
/// <param name="loopBehavior">The clock's loop behavior.</param>
/// <param name="duration">The clock's duration.</param>
public SimpleClock(LoopBehavior loopBehavior, TimeSpan duration)
{
this.loopBehavior = loopBehavior;
this.duration = duration;
}
/// <inheritdoc/>
public override LoopBehavior LoopBehavior
{
get { return loopBehavior; }
}
/// <inheritdoc/>
public override TimeSpan Duration
{
get { return duration; }
}
/// <summary>
/// Sets the clock's loop behavior.
/// </summary>
/// <param name="loopBehavior">The clock's loop behavior.</param>
internal void SetLoopBehavior(LoopBehavior loopBehavior)
{
this.loopBehavior = loopBehavior;
}
/// <summary>
/// Sets the clock's duration.
/// </summary>
/// <param name="duration">The clock's duration.</param>
internal void SetDuration(TimeSpan duration)
{
this.duration = duration;
}
/// <summary>
/// Gets the <see cref="UpfPool{TPooledType}.PooledObject"/> that represents this clock, if the clock
/// was retrieved from an internal pool.
/// </summary>
internal UpfPool<SimpleClock>.PooledObject PooledObject
{
get;
set;
}
/// <inheritdoc/>
protected override Boolean IsValid
{
get { return true; }
}
// Property values.
private LoopBehavior loopBehavior;
private TimeSpan duration;
}
}
| 28.736111 | 109 | 0.550507 | [
"Apache-2.0",
"MIT"
] | MicroWorldwide/ultraviolet | Source/Ultraviolet.Presentation/Shared/Animations/SimpleClock.cs | 2,071 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ZigBeeNet;
using ZigBeeNet.App.Discovery;
using ZigBeeNet.ZCL;
using ZigBeeNet.ZDO;
using ZigBeeNet.ZDO.Command;
using Serilog;
namespace ZigBeeNet.App.Discovery
{
/// <summary>
/// <see cref="ZigBeeNetworkDiscoverer"/> is used to discover devices in the network.
///
/// Notifications will be sent to the listeners when nodes and endpoints are discovered.
/// Device listeners are always notified first as each endpoint discovery completes.
/// Once a node is fully discovered and all its endpoints are included into the network,
/// we can notify the node listeners.
///
/// </summary>
public class ZigBeeNetworkDiscoverer : IZigBeeCommandListener, IZigBeeAnnounceListener
{
/// <summary>
/// Default maximum number of retries to perform
/// </summary>
private const int DEFAULT_MAX_RETRY_COUNT = 3;
/// <summary>
/// Default period between retries
/// </summary>
private const int DEFAULT_RETRY_PERIOD = 1500;
/// <summary>
/// Default minimum time before information can be queried again for same network address or endpoint.
/// </summary>
private const int DEFAULT_REQUERY_TIME = 300000;
/// <summary>
/// The ZigBee network manager.
/// </summary>
private ZigBeeNetworkManager _networkManager;
/// <summary>
/// Period between retries
/// </summary>
private int _retryPeriod = DEFAULT_RETRY_PERIOD;
/// <summary>
/// Period between retries
/// </summary>
private int _retryCount = DEFAULT_MAX_RETRY_COUNT;
/// <summary>
/// The minimum time before performing a requery
/// </summary>
private int _requeryPeriod = DEFAULT_REQUERY_TIME;
/// <summary>
/// Map of node discovery times.
/// </summary>
private Dictionary<ushort, long> _discoveryStartTime = new Dictionary<ushort, long>();
/// <summary>
/// Flag used to initialise the discoverer once the network is ONLINE
/// </summary>
private bool _initialized = false;
/// <summary>
/// Discovers ZigBee network state.
///
/// <param name="_networkManager">the <see cref="ZigBeeNetworkManager"></param>
/// </summary>
public ZigBeeNetworkDiscoverer(ZigBeeNetworkManager networkManager)
{
_networkManager = networkManager;
}
/// <summary>
/// Starts up ZigBee network discoverer. This adds a listener to wait for the network to go online.
/// </summary>
public void Startup()
{
Log.Debug("Network discovery task: starting");
_initialized = true;
_networkManager.AddCommandListener(this);
_networkManager.AddAnnounceListener(this);
// Start discovery from root node.
// StartNodeDiscovery(0);
}
/// <summary>
/// Shuts down ZigBee network discoverer.
/// </summary>
public void Shutdown()
{
Log.Debug("Network discovery task: shutdown");
_networkManager.RemoveCommandListener(this);
_networkManager.RemoveAnnounceListener(this);
_initialized = false;
}
/// <summary>
/// Sets the retry period in milliseconds. This is the amount of time the service will wait following a failed
/// request before performing a retry.
///
/// <param name="retryPeriod">the period in milliseconds between retries</param>
/// </summary>
public void SetRetryPeriod(int retryPeriod)
{
_retryPeriod = retryPeriod;
}
/// <summary>
/// Sets the maximum number of retries the service will perform at any stage before failing.
///
/// <param name="retryCount">the maximum number of retries.</param>
/// </summary>
public void SetRetryCount(int retryCount)
{
_retryCount = retryCount;
}
/// <summary>
/// Sets the minimum period between requeries on each node
///
/// <param name="requeryPeriod">the requery period in milliseconds</param>
/// </summary>
public void SetRequeryPeriod(int requeryPeriod)
{
_requeryPeriod = requeryPeriod;
}
public void DeviceStatusUpdate(ZigBeeNodeStatus deviceStatus, ushort networkAddress, IeeeAddress ieeeAddress)
{
switch (deviceStatus)
{
case ZigBeeNodeStatus.UNSECURED_JOIN:
case ZigBeeNodeStatus.SECURED_REJOIN:
case ZigBeeNodeStatus.UNSECURED_REJOIN:
// We only care about devices that have joined or rejoined
Log.Debug("{IeeeAddress}: Device status updated. NWK={NetworkAddress}", ieeeAddress, networkAddress);
AddNode(ieeeAddress, networkAddress);
break;
default:
break;
}
}
public void CommandReceived(ZigBeeCommand command)
{
// Node has been announced.
if (command is DeviceAnnounce)
{
DeviceAnnounce announce = (DeviceAnnounce)command;
Log.Debug("{IeeeAddress}: Device announce received. NWK={NetworkAddress}", announce.IeeeAddr, announce.NwkAddrOfInterest);
AddNode(announce.IeeeAddr, announce.NwkAddrOfInterest);
}
}
/// <summary>
/// Starts a discovery on a node given the network address.
///
/// <param name="requeryPeriod">networkAddress the network address of the node to discover</param>
/// </summary>
public void RediscoverNode(ushort networkAddress)
{
if (!_initialized)
{
Log.Debug("Network discovery task: can't perform rediscovery on {NetworkAddress} until initialization complete.", networkAddress);
return;
}
Log.Debug("{NetworkAddress}: NWK Discovery starting node rediscovery", networkAddress);
int retries = 0;
Task.Run(async () =>
{
try
{
do
{
// Request basic response, start index for associated list is 0
IeeeAddressRequest ieeeAddressRequest = new IeeeAddressRequest();
ieeeAddressRequest.DestinationAddress = new ZigBeeEndpointAddress(ZigBeeBroadcastDestination.GetBroadcastDestination(BroadcastDestination.BROADCAST_RX_ON).Key);
ieeeAddressRequest.RequestType = 0;
ieeeAddressRequest.StartIndex = 0;
ieeeAddressRequest.NwkAddrOfInterest = networkAddress;
CommandResult response = await _networkManager.SendTransaction(ieeeAddressRequest, ieeeAddressRequest);
if (response.IsError())
{
return;
}
IeeeAddressResponse ieeeAddressResponse = (IeeeAddressResponse)response.GetResponse();
Log.Debug("{NetworkAddress}: NWK Discovery IeeeAddressRequest returned {IeeeAddressResponse}", networkAddress, ieeeAddressResponse);
if (ieeeAddressResponse != null && ieeeAddressResponse.Status == ZdoStatus.SUCCESS)
{
AddNode(ieeeAddressResponse.IeeeAddrRemoteDev, ieeeAddressResponse.NwkAddrRemoteDev);
StartNodeDiscovery(ieeeAddressResponse.NwkAddrRemoteDev);
break;
}
// We failed with the last request. Wait a bit then retry
try
{
Log.Debug("{NetworkAddress}: NWK Discovery node rediscovery request failed. Wait before retry.", networkAddress);
await Task.Delay(_retryPeriod);
}
catch (ThreadAbortException)
{
break;
}
} while (retries++ < _retryCount);
}
catch (Exception e) // TODO: Handle more secific Exception here (ThreadAbortException etc.)
{
Log.Debug("NWK Discovery Error in checkIeeeAddressResponse ", e);
}
Log.Debug("{NetworkAddress}: NWK Discovery finishing node rediscovery after {Retries} attempts", networkAddress, retries);
});
// StartNodeDiscovery(nodeAddress);
}
/// <summary>
/// Starts a discovery on a node. This will send a <see cref="NetworkAddressRequest"/> as a broadcast and will receive
/// the response to trigger a full discovery.
///
/// <param name="ieeeAddress">the <see cref="IeeeAddress"/> of the node to discover</param>
/// </summary>
public void RediscoverNode(IeeeAddress ieeeAddress)
{
if (!_initialized)
{
Log.Debug("Network discovery task: can't perform rediscovery on {IeeeAddress} until initialization complete.",
ieeeAddress);
return;
}
Task.Run(async () =>
{
Log.Debug("{IeeeAddress}: NWK Discovery starting node rediscovery", ieeeAddress);
int retries = 0;
try
{
do
{
if (Thread.CurrentThread.ThreadState == ThreadState.WaitSleepJoin)
{
break;
}
NetworkAddressRequest request = new NetworkAddressRequest();
request.IeeeAddr = ieeeAddress;
request.RequestType = 0;
request.StartIndex = 0;
request.DestinationAddress = new ZigBeeEndpointAddress(ZigBeeBroadcastDestination.GetBroadcastDestination(BroadcastDestination.BROADCAST_RX_ON).Key);
CommandResult response = await _networkManager.SendTransaction(request, request);
NetworkAddressResponse nwkAddressResponse = response.GetResponse<NetworkAddressResponse>();
if (nwkAddressResponse != null && nwkAddressResponse.Status == ZdoStatus.SUCCESS)
{
AddNode(nwkAddressResponse.IeeeAddrRemoteDev, nwkAddressResponse.NwkAddrRemoteDev);
StartNodeDiscovery(nwkAddressResponse.NwkAddrRemoteDev);
break;
}
// We failed with the last request. Wait a bit then retry
try
{
Log.Debug("{IeeeAddress}: NWK Discovery node rediscovery request failed. Wait before retry.", ieeeAddress);
await Task.Delay(_retryPeriod);
}
catch (Exception)
{
break;
}
} while (retries++ < _retryCount);
}
catch (Exception e)
{
Log.Debug("NWK Discovery error in rediscoverNode ", e);
}
Log.Debug("{IeeeAddress}: NWK Discovery finishing node rediscovery", ieeeAddress);
});
}
/// <summary>
/// Performs the top level node discovery. This discovers node level attributes such as the endpoints and
/// descriptors.
///
/// <param name="nodeNetworkAddress">the network address to start a discovery on</param>
/// </summary>
private void StartNodeDiscovery(ushort nodeNetworkAddress)
{
// Check if we need to do a rediscovery on this node first...
lock (_discoveryStartTime)
{
if (_discoveryStartTime.ContainsKey(nodeNetworkAddress) && DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - _discoveryStartTime[nodeNetworkAddress] < _requeryPeriod)
{
Log.Information("{NetworkAddress}: NWK Discovery node discovery already in progress", nodeNetworkAddress);
return;
}
_discoveryStartTime[nodeNetworkAddress] = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
}
Log.Debug("{NetworkAddress}: NWK Discovery scheduling node discovery", nodeNetworkAddress);
// TODO: Return Task ?
Task.Run(async () =>
{
try
{
Log.Debug("{NetworkAddress}: NWK Discovery starting node discovery", nodeNetworkAddress);
int retries = 0;
bool success = true;
do
{
if (Thread.CurrentThread.ThreadState == ThreadState.WaitSleepJoin)
{
break;
}
if (!success)
{
// We failed with the last request. Wait a bit then retry.
await Task.Delay(_retryPeriod);
}
// If we don't know the node yet, then try to find the IEEE address
// before requesting the associated nodes.
if (_networkManager.GetNode(nodeNetworkAddress) == null)
{
success = await GetIeeeAddress(nodeNetworkAddress);
continue;
}
success = await GetAssociatedNodes(nodeNetworkAddress);
if (success)
{
break;
}
} while (retries++ < _retryCount);
Log.Debug("{NetworkAddress}: NWK Discovery ending node discovery", nodeNetworkAddress);
}
catch (Exception e)
{
Log.Error("{NetworkAddress}: NWK Discovery error during node discovery: {Error}", nodeNetworkAddress, e);
}
});
}
/**
* Get the associated nodes for this address, and start a discovery of the associated nodes.
*
* <param name="networkAddress">networkAddress the network address of the node</param>
* <returns>true if the message was processed ok</returns>
*/
private async Task<bool> GetAssociatedNodes(ushort networkAddress)
{
int startIndex = 0;
int totalAssociatedDevices = 0;
List<ushort> associatedDevices = new List<ushort>();
do
{
// Request extended response, start index for associated list is 0
IeeeAddressRequest ieeeAddressRequest = new IeeeAddressRequest();
ieeeAddressRequest.DestinationAddress = new ZigBeeEndpointAddress(networkAddress);
ieeeAddressRequest.RequestType = 1;
ieeeAddressRequest.StartIndex = (byte)startIndex;
ieeeAddressRequest.NwkAddrOfInterest = networkAddress;
CommandResult response = await _networkManager.SendTransaction(ieeeAddressRequest, ieeeAddressRequest);
if (response.IsError())
{
return false;
}
IeeeAddressResponse ieeeAddressResponse = (IeeeAddressResponse)response.GetResponse();
Log.Debug("{NetworkAddress}: NWK Discovery IeeeAddressRequest returned {IeeeAddressResponse}", networkAddress, ieeeAddressResponse);
if (ieeeAddressResponse != null && ieeeAddressResponse.Status == ZdoStatus.SUCCESS && startIndex.Equals(ieeeAddressResponse.StartIndex))
{
associatedDevices.AddRange(ieeeAddressResponse.NwkAddrAssocDevList);
startIndex += ieeeAddressResponse.NwkAddrAssocDevList.Count;
totalAssociatedDevices = ieeeAddressResponse.NwkAddrAssocDevList.Count;
}
} while (startIndex < totalAssociatedDevices);
// Start discovery for any associated nodes
foreach (var deviceNetworkAddress in associatedDevices)
{
StartNodeDiscovery(deviceNetworkAddress);
}
return true;
}
/// <summary>
/// Discovers the IeeeAddress of a remote device. This uses a broadcast request to try to discover the
/// device.
///
/// <param name="networkAddress">the network address of the node</param>
/// <returns>true if the message was processed ok</returns>
/// </summary>
private async Task<bool> GetIeeeAddress(ushort networkAddress)
{
// Request basic response, start index for associated list is 0
IeeeAddressRequest request = new IeeeAddressRequest();
request.RequestType = 0;
request.StartIndex = 0;
request.NwkAddrOfInterest = networkAddress;
request.DestinationAddress = new ZigBeeEndpointAddress(ZigBeeBroadcastDestination.GetBroadcastDestination(BroadcastDestination.BROADCAST_RX_ON).Key);
CommandResult response = await _networkManager.SendTransaction(request, request);
if (response.IsError())
{
return false;
}
IeeeAddressResponse ieeeAddressResponse = (IeeeAddressResponse)response.GetResponse();
Log.Debug("{NetworkAddress}: NWK Discovery IeeeAddressRequest returned {IeeeAddressResponse}", networkAddress, ieeeAddressResponse);
if (ieeeAddressResponse != null && ieeeAddressResponse.Status == ZdoStatus.SUCCESS)
{
AddNode(ieeeAddressResponse.IeeeAddrRemoteDev, ieeeAddressResponse.NwkAddrRemoteDev);
StartNodeDiscovery(ieeeAddressResponse.NwkAddrRemoteDev);
return true;
}
return false;
}
/// <summary>
/// Updates ZigBeeNode and adds it to the ZigBeeNetworkManager
///
/// <param name="ieeeAddress">the <see cref="IeeeAddress"> of the newly announced node</param>
/// <param name="networkAddress">the network address of the newly announced node</param>
/// </summary>
private void AddNode(IeeeAddress ieeeAddress, ushort networkAddress)
{
Log.Debug("{IeeeAddress}: NWK Discovery add node {NetworkAddress}", ieeeAddress, networkAddress);
ZigBeeNode node = new ZigBeeNode(_networkManager, ieeeAddress, networkAddress);
node.SetNodeState(ZigBeeNodeState.ONLINE);
_networkManager.UpdateNode(node);
}
}
}
| 41.317125 | 184 | 0.56107 | [
"EPL-1.0"
] | DavidKarlas/ZigbeeNet | libraries/ZigBeeNet/App/Discovery/ZigBeeNetworkDiscoverer.cs | 19,545 | C# |
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Identity.Web.Resource;
namespace IdentityApi.Controllers
{
[Authorize]
[ApiController]
[Route("[controller]")]
[RequiredScope(RequiredScopesConfigurationKey = "AzureAd:Scopes")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
} | 32.891892 | 107 | 0.603944 | [
"MIT"
] | ddgroleau/identity-api | IdentityApi/Controllers/WeatherForecastController.cs | 1,217 | C# |
namespace TabletFriend.Data
{
public enum StretchData
{
/// <summary>
/// The content preserves its original size.
/// </summary>
None = 0,
/// <summary>
/// The content is resized to fill the destination dimensions.
/// The aspect ratio is not preserved.
/// </summary>
Fill = 1,
/// <summary>
/// The content is resized to fit in the destination dimensions while it preserves its native aspect ratio.
/// </summary>
Fit = 2,
}
}
| 20.26087 | 109 | 0.641631 | [
"MIT"
] | Martenfur/TabletFriend | TabletFriend/TabletFriend/Data/StretchData.cs | 468 | C# |
using BlazorProducts.Client.HttpRepository;
using Entities.Models;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace BlazorProducts.Client.Pages
{
public partial class Products : IDisposable
{
public List<Product> ProductList { get; set; } = new List<Product>();
[Inject]
public IProductHttpRepository ProductRepo { get; set; }
[Inject]
public HttpInterceptorService Interceptor { get; set; }
protected async override Task OnInitializedAsync()
{
Interceptor.RegisterEvent();
ProductList = await ProductRepo.GetProducts();
}
public void Dispose() => Interceptor.DisposeEvent();
}
}
| 22.935484 | 71 | 0.758087 | [
"MIT"
] | CodeMazeBlog/blazor-wasm-error-handling | End/Http Error Handling/BlazorProducts.Client/BlazorProducts.Client/Pages/Products.razor.cs | 713 | C# |
using MediatR;
namespace handlers.Queries
{
public class GetTotalGameCount : IRequest<int>
{
}
} | 13.75 | 50 | 0.681818 | [
"MIT"
] | tbd-friends/trackr | handlers/Query/Queries/GetTotalGameCount.cs | 112 | 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("BitsExchange")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BitsExchange")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8e4efaa5-dc71-413d-a5d8-5e50954dc8f7")]
// 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.756757 | 84 | 0.745168 | [
"MIT"
] | Vyara/Telerik-C-1-Homeworks | 03. Operators and Expressions/BitsExchange/Properties/AssemblyInfo.cs | 1,400 | C# |
using SlimDX.Direct2D;
namespace MO.Direct2d.Draw
{
//============================================================
// <T>固定色刷。</T>
//
// @history MAOCY 120223
//============================================================
public class FDxBitmapBrush : FDxBrush
{
// 位图
protected FDxBitmap _bitmap;
// 位图刷子属性
protected BitmapBrushProperties _bitmapProperties = new BitmapBrushProperties();
//============================================================
// <T>构造固定色刷。</T>
//============================================================
public FDxBitmapBrush() {
}
//============================================================
// <T>获得位图。</T>
//============================================================
public FDxBitmap Bitmap {
get { return _bitmap; }
}
//============================================================
// <T>获得位图刷子属性。</T>
//============================================================
public BitmapBrushProperties BitmapProperties {
get { return _bitmapProperties; }
}
//============================================================
// <T>设置处理。</T>
//============================================================
public override void Setup() {
Refresh();
}
//============================================================
// <T>加载文件。</T>
//
// @param fileName 文件
//============================================================
public void LoadBitmap(System.Drawing.Bitmap bitmap) {
_bitmap = new FDxBitmap();
_bitmap.Device = _device;
_bitmap.LoadBitmap(bitmap);
}
//============================================================
// <T>加载文件。</T>
//
// @param fileName 文件
//============================================================
public void LoadFile(string fileName) {
_bitmap = new FDxBitmap();
_bitmap.Device = _device;
using(System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(fileName)) {
_bitmap.LoadBitmap(bitmap);
}
}
//============================================================
// <T>重新加载。</T>
//============================================================
public void Refresh() {
// 释放对象
if (null != _native) {
_native.Dispose();
}
// 创建对象
_bitmapProperties.VerticalExtendMode = ExtendMode.Wrap;
_bitmapProperties.HorizontalExtendMode = ExtendMode.Wrap;
_native = new BitmapBrush(_device.Target, _bitmap.Native, _bitmapProperties);
}
}
}
| 32.654762 | 86 | 0.333212 | [
"Apache-2.0"
] | favedit/MoCross | Tools/1 - Common/MoDirect2d/Draw/FDxBitmapBrush.cs | 2,877 | C# |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: IEntityCollectionRequestBuilder.cs.tt
namespace Microsoft.Graph
{
using System;
using System.Collections.Generic;
/// <summary>
/// The interface IDeviceManagementResourceAccessProfilesCollectionRequestBuilder.
/// </summary>
public partial interface IDeviceManagementResourceAccessProfilesCollectionRequestBuilder : IBaseRequestBuilder
{
/// <summary>
/// Builds the request.
/// </summary>
/// <returns>The built request.</returns>
IDeviceManagementResourceAccessProfilesCollectionRequest Request();
/// <summary>
/// Builds the request.
/// </summary>
/// <param name="options">The query and header options for the request.</param>
/// <returns>The built request.</returns>
IDeviceManagementResourceAccessProfilesCollectionRequest Request(IEnumerable<Option> options);
/// <summary>
/// Gets an <see cref="IDeviceManagementResourceAccessProfileBaseRequestBuilder"/> for the specified DeviceManagementResourceAccessProfileBase.
/// </summary>
/// <param name="id">The ID for the DeviceManagementResourceAccessProfileBase.</param>
/// <returns>The <see cref="IDeviceManagementResourceAccessProfileBaseRequestBuilder"/>.</returns>
IDeviceManagementResourceAccessProfileBaseRequestBuilder this[string id] { get; }
/// <summary>
/// Gets the request builder for DeviceManagementResourceAccessProfileBaseQueryByPlatformType.
/// </summary>
/// <returns>The <see cref="IDeviceManagementResourceAccessProfileBaseQueryByPlatformTypeRequestBuilder"/>.</returns>
IDeviceManagementResourceAccessProfileBaseQueryByPlatformTypeRequestBuilder QueryByPlatformType(
PolicyPlatformType platformType);
}
}
| 48.042553 | 153 | 0.666076 | [
"MIT"
] | ScriptBox99/msgraph-beta-sdk-dotnet | src/Microsoft.Graph/Generated/requests/IDeviceManagementResourceAccessProfilesCollectionRequestBuilder.cs | 2,258 | C# |
using System.Runtime.Serialization;
namespace Iviz.Msgs.Rosapi
{
[DataContract (Name = "rosapi/ServiceRequestDetails")]
public sealed class ServiceRequestDetails : IService
{
/// <summary> Request message. </summary>
[DataMember] public ServiceRequestDetailsRequest Request { get; set; }
/// <summary> Response message. </summary>
[DataMember] public ServiceRequestDetailsResponse Response { get; set; }
/// <summary> Empty constructor. </summary>
public ServiceRequestDetails()
{
Request = new ServiceRequestDetailsRequest();
Response = new ServiceRequestDetailsResponse();
}
/// <summary> Setter constructor. </summary>
public ServiceRequestDetails(ServiceRequestDetailsRequest request)
{
Request = request;
Response = new ServiceRequestDetailsResponse();
}
IService IService.Create() => new ServiceRequestDetails();
IRequest IService.Request
{
get => Request;
set => Request = (ServiceRequestDetailsRequest)value;
}
IResponse IService.Response
{
get => Response;
set => Response = (ServiceRequestDetailsResponse)value;
}
public void Dispose()
{
Request.Dispose();
Response.Dispose();
}
string IService.RosType => RosServiceType;
/// <summary> Full ROS name of this service. </summary>
[Preserve] public const string RosServiceType = "rosapi/ServiceRequestDetails";
/// <summary> MD5 hash of a compact representation of the service. </summary>
[Preserve] public const string RosMd5Sum = "f9c88144f6f6bd888dd99d4e0411905d";
public override string ToString() => Extensions.ToString(this);
}
[DataContract]
public sealed class ServiceRequestDetailsRequest : IRequest<ServiceRequestDetails, ServiceRequestDetailsResponse>, IDeserializable<ServiceRequestDetailsRequest>
{
[DataMember (Name = "type")] public string Type { get; set; }
/// <summary> Constructor for empty message. </summary>
public ServiceRequestDetailsRequest()
{
Type = string.Empty;
}
/// <summary> Explicit constructor. </summary>
public ServiceRequestDetailsRequest(string Type)
{
this.Type = Type;
}
/// <summary> Constructor with buffer. </summary>
public ServiceRequestDetailsRequest(ref Buffer b)
{
Type = b.DeserializeString();
}
public ISerializable RosDeserialize(ref Buffer b)
{
return new ServiceRequestDetailsRequest(ref b);
}
ServiceRequestDetailsRequest IDeserializable<ServiceRequestDetailsRequest>.RosDeserialize(ref Buffer b)
{
return new ServiceRequestDetailsRequest(ref b);
}
public void RosSerialize(ref Buffer b)
{
b.Serialize(Type);
}
public void Dispose()
{
}
public void RosValidate()
{
if (Type is null) throw new System.NullReferenceException(nameof(Type));
}
public int RosMessageLength
{
get {
int size = 4;
size += BuiltIns.UTF8.GetByteCount(Type);
return size;
}
}
public override string ToString() => Extensions.ToString(this);
}
[DataContract]
public sealed class ServiceRequestDetailsResponse : IResponse, IDeserializable<ServiceRequestDetailsResponse>
{
[DataMember (Name = "typedefs")] public TypeDef[] Typedefs { get; set; }
/// <summary> Constructor for empty message. </summary>
public ServiceRequestDetailsResponse()
{
Typedefs = System.Array.Empty<TypeDef>();
}
/// <summary> Explicit constructor. </summary>
public ServiceRequestDetailsResponse(TypeDef[] Typedefs)
{
this.Typedefs = Typedefs;
}
/// <summary> Constructor with buffer. </summary>
public ServiceRequestDetailsResponse(ref Buffer b)
{
Typedefs = b.DeserializeArray<TypeDef>();
for (int i = 0; i < Typedefs.Length; i++)
{
Typedefs[i] = new TypeDef(ref b);
}
}
public ISerializable RosDeserialize(ref Buffer b)
{
return new ServiceRequestDetailsResponse(ref b);
}
ServiceRequestDetailsResponse IDeserializable<ServiceRequestDetailsResponse>.RosDeserialize(ref Buffer b)
{
return new ServiceRequestDetailsResponse(ref b);
}
public void RosSerialize(ref Buffer b)
{
b.SerializeArray(Typedefs, 0);
}
public void Dispose()
{
}
public void RosValidate()
{
if (Typedefs is null) throw new System.NullReferenceException(nameof(Typedefs));
for (int i = 0; i < Typedefs.Length; i++)
{
if (Typedefs[i] is null) throw new System.NullReferenceException($"{nameof(Typedefs)}[{i}]");
Typedefs[i].RosValidate();
}
}
public int RosMessageLength
{
get {
int size = 4;
foreach (var i in Typedefs)
{
size += i.RosMessageLength;
}
return size;
}
}
public override string ToString() => Extensions.ToString(this);
}
}
| 31.222222 | 164 | 0.557194 | [
"MIT"
] | KIT-ISAS/iviz | iviz_msgs/rosapi/srv/ServiceRequestDetails.cs | 5,901 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnerVolume : MonoBehaviour
{
BoxCollider boxCollider;
// Start is called before the first frame update
void Start()
{
}
private void Awake()
{
boxCollider = GetComponent<BoxCollider>();
}
public Vector3 GetPositionInBounds()
{
Bounds boxBounds = boxCollider.bounds;
return new Vector3(Random.Range(boxBounds.min.x, boxBounds.max.x), transform.position.y, Random.Range(boxBounds.min.z, boxBounds.max.z));
}
}
| 22.153846 | 145 | 0.685764 | [
"MIT"
] | danhccc/GAME3033_ZombieProject_HancongZ | Assets/Scripts/ManagerScripts/SpawnerVolume.cs | 576 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Net.Test.Common;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace System.Net.WebSockets.Client.Tests
{
public class ConnectTest : ClientWebSocketTestBase
{
public ConnectTest(ITestOutputHelper output) : base(output) { }
[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(UnavailableWebSocketServers))]
public async Task ConnectAsync_NotWebSocketServer_ThrowsWebSocketExceptionWithMessage(Uri server, string exceptionMessage, WebSocketError errorCode)
{
using (var cws = new ClientWebSocket())
{
var cts = new CancellationTokenSource(TimeOutMilliseconds);
WebSocketException ex = await Assert.ThrowsAsync<WebSocketException>(() =>
cws.ConnectAsync(server, cts.Token));
if (PlatformDetection.IsNetCore && !PlatformDetection.IsUap) // bug fix in netcoreapp: https://github.com/dotnet/corefx/pull/35960
{
Assert.Equal(errorCode, ex.WebSocketErrorCode);
}
Assert.Equal(WebSocketState.Closed, cws.State);
// .NET Framework and UAP implmentations have different exception message from .NET Core.
if (!PlatformDetection.IsUap)
{
Assert.Equal(exceptionMessage, ex.Message);
}
}
}
[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task EchoBinaryMessage_Success(Uri server)
{
await WebSocketHelper.TestEcho(server, WebSocketMessageType.Binary, TimeOutMilliseconds, _output);
}
[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task EchoTextMessage_Success(Uri server)
{
await WebSocketHelper.TestEcho(server, WebSocketMessageType.Text, TimeOutMilliseconds, _output);
}
[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoHeadersServers))]
public async Task ConnectAsync_AddCustomHeaders_Success(Uri server)
{
using (var cws = new ClientWebSocket())
{
cws.Options.SetRequestHeader("X-CustomHeader1", "Value1");
cws.Options.SetRequestHeader("X-CustomHeader2", "Value2");
using (var cts = new CancellationTokenSource(TimeOutMilliseconds))
{
Task taskConnect = cws.ConnectAsync(server, cts.Token);
Assert.True(
(cws.State == WebSocketState.None) ||
(cws.State == WebSocketState.Connecting) ||
(cws.State == WebSocketState.Open),
"State immediately after ConnectAsync incorrect: " + cws.State);
await taskConnect;
}
Assert.Equal(WebSocketState.Open, cws.State);
byte[] buffer = new byte[65536];
WebSocketReceiveResult recvResult;
using (var cts = new CancellationTokenSource(TimeOutMilliseconds))
{
recvResult = await ReceiveEntireMessageAsync(cws, new ArraySegment<byte>(buffer), cts.Token);
}
Assert.Equal(WebSocketMessageType.Text, recvResult.MessageType);
string headers = WebSocketData.GetTextFromBuffer(new ArraySegment<byte>(buffer, 0, recvResult.Count));
Assert.True(headers.Contains("X-CustomHeader1:Value1"));
Assert.True(headers.Contains("X-CustomHeader2:Value2"));
await cws.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None);
}
}
[ConditionalFact(nameof(WebSocketsSupported))]
public async Task ConnectAsync_AddHostHeader_Success()
{
string expectedHost = null;
await LoopbackServer.CreateClientAndServerAsync(async uri =>
{
expectedHost = "subdomain." + uri.Host;
using (var cws = new ClientWebSocket())
using (var cts = new CancellationTokenSource(TimeOutMilliseconds))
{
cws.Options.SetRequestHeader("Host", expectedHost);
await cws.ConnectAsync(uri, cts.Token);
}
}, server => server.AcceptConnectionAsync(async connection =>
{
Dictionary<string, string> headers = await LoopbackHelper.WebSocketHandshakeAsync(connection);
Assert.NotNull(headers);
Assert.True(headers.TryGetValue("Host", out string host));
Assert.Equal(expectedHost, host);
}), new LoopbackServer.Options { WebSocketEndpoint = true });
}
[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoHeadersServers))]
public async Task ConnectAsync_CookieHeaders_Success(Uri server)
{
using (var cws = new ClientWebSocket())
{
Assert.Null(cws.Options.Cookies);
cws.Options.Cookies = new CookieContainer();
Cookie cookie1 = new Cookie("Cookies", "Are Yummy");
Cookie cookie2 = new Cookie("Especially", "Chocolate Chip");
Cookie secureCookie = new Cookie("Occasionally", "Raisin");
secureCookie.Secure = true;
cws.Options.Cookies.Add(server, cookie1);
cws.Options.Cookies.Add(server, cookie2);
cws.Options.Cookies.Add(server, secureCookie);
using (var cts = new CancellationTokenSource(TimeOutMilliseconds))
{
Task taskConnect = cws.ConnectAsync(server, cts.Token);
Assert.True(
cws.State == WebSocketState.None ||
cws.State == WebSocketState.Connecting ||
cws.State == WebSocketState.Open,
"State immediately after ConnectAsync incorrect: " + cws.State);
await taskConnect;
}
Assert.Equal(WebSocketState.Open, cws.State);
byte[] buffer = new byte[65536];
WebSocketReceiveResult recvResult;
using (var cts = new CancellationTokenSource(TimeOutMilliseconds))
{
recvResult = await ReceiveEntireMessageAsync(cws, new ArraySegment<byte>(buffer), cts.Token);
}
Assert.Equal(WebSocketMessageType.Text, recvResult.MessageType);
string headers = WebSocketData.GetTextFromBuffer(new ArraySegment<byte>(buffer, 0, recvResult.Count));
Assert.True(headers.Contains("Cookies=Are Yummy"));
Assert.True(headers.Contains("Especially=Chocolate Chip"));
Assert.Equal(server.Scheme == "wss", headers.Contains("Occasionally=Raisin"));
await cws.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None);
}
}
[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ConnectAsync_PassNoSubProtocol_ServerRequires_ThrowsWebSocketException(Uri server)
{
const string AcceptedProtocol = "CustomProtocol";
using (var cws = new ClientWebSocket())
{
var cts = new CancellationTokenSource(TimeOutMilliseconds);
var ub = new UriBuilder(server);
ub.Query = "subprotocol=" + AcceptedProtocol;
WebSocketException ex = await Assert.ThrowsAsync<WebSocketException>(() =>
cws.ConnectAsync(ub.Uri, cts.Token));
_output.WriteLine(ex.Message);
if (PlatformDetection.IsNetCore) // bug fix in netcoreapp: https://github.com/dotnet/corefx/pull/35960
{
Assert.True(ex.WebSocketErrorCode == WebSocketError.Faulted ||
ex.WebSocketErrorCode == WebSocketError.NotAWebSocket);
}
Assert.Equal(WebSocketState.Closed, cws.State);
}
}
[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ConnectAsync_PassMultipleSubProtocols_ServerRequires_ConnectionUsesAgreedSubProtocol(Uri server)
{
const string AcceptedProtocol = "AcceptedProtocol";
const string OtherProtocol = "OtherProtocol";
using (var cws = new ClientWebSocket())
{
cws.Options.AddSubProtocol(AcceptedProtocol);
cws.Options.AddSubProtocol(OtherProtocol);
var cts = new CancellationTokenSource(TimeOutMilliseconds);
var ub = new UriBuilder(server);
ub.Query = "subprotocol=" + AcceptedProtocol;
await cws.ConnectAsync(ub.Uri, cts.Token);
Assert.Equal(WebSocketState.Open, cws.State);
Assert.Equal(AcceptedProtocol, cws.SubProtocol);
}
}
[ConditionalFact(nameof(WebSocketsSupported))]
public async Task ConnectAsync_NonStandardRequestHeaders_HeadersAddedWithoutValidation()
{
await LoopbackServer.CreateClientAndServerAsync(async uri =>
{
using (var clientSocket = new ClientWebSocket())
using (var cts = new CancellationTokenSource(TimeOutMilliseconds))
{
clientSocket.Options.SetRequestHeader("Authorization", "AWS4-HMAC-SHA256 Credential=PLACEHOLDER /20190301/us-east-2/neptune-db/aws4_request, SignedHeaders=host;x-amz-date, Signature=b8155de54d9faab00000000000000000000000000a07e0d7dda49902e4d9202");
await clientSocket.ConnectAsync(uri, cts.Token);
}
}, server => server.AcceptConnectionAsync(async connection =>
{
Assert.NotNull(await LoopbackHelper.WebSocketHandshakeAsync(connection));
}), new LoopbackServer.Options { WebSocketEndpoint = true });
}
[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task ConnectAndCloseAsync_UseProxyServer_ExpectedClosedState(Uri server)
{
using (var cws = new ClientWebSocket())
using (var cts = new CancellationTokenSource(TimeOutMilliseconds))
using (LoopbackProxyServer proxyServer = LoopbackProxyServer.Create())
{
cws.Options.Proxy = new WebProxy(proxyServer.Uri);
await cws.ConnectAsync(server, cts.Token);
string expectedCloseStatusDescription = "Client close status";
await cws.CloseAsync(WebSocketCloseStatus.NormalClosure, expectedCloseStatusDescription, cts.Token);
Assert.Equal(WebSocketState.Closed, cws.State);
Assert.Equal(WebSocketCloseStatus.NormalClosure, cws.CloseStatus);
Assert.Equal(expectedCloseStatusDescription, cws.CloseStatusDescription);
}
}
[ConditionalFact(nameof(WebSocketsSupported))]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap)]
public async Task ConnectAsync_CancellationRequestedBeforeConnect_ThrowsOperationCanceledException()
{
using (var clientSocket = new ClientWebSocket())
{
var cts = new CancellationTokenSource();
cts.Cancel();
Task t = clientSocket.ConnectAsync(new Uri("ws://" + Guid.NewGuid().ToString("N")), cts.Token);
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t);
}
}
[ConditionalFact(nameof(WebSocketsSupported))]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap)]
public async Task ConnectAsync_CancellationRequestedAfterConnect_ThrowsOperationCanceledException()
{
var releaseServer = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
await LoopbackServer.CreateClientAndServerAsync(async uri =>
{
var clientSocket = new ClientWebSocket();
try
{
var cts = new CancellationTokenSource();
Task t = clientSocket.ConnectAsync(uri, cts.Token);
Assert.False(t.IsCompleted);
cts.Cancel();
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t);
}
finally
{
releaseServer.SetResult(true);
clientSocket.Dispose();
}
}, server => server.AcceptConnectionAsync(async connection =>
{
await releaseServer.Task;
}), new LoopbackServer.Options { WebSocketEndpoint = true });
}
}
}
| 47.575862 | 268 | 0.610857 | [
"MIT"
] | Neos-Metaverse/corefx | src/System.Net.WebSockets.Client/tests/ConnectTest.cs | 13,797 | C# |
using System.IO;
using System.Runtime.Serialization;
using GameEstate.Formats.Red.CR2W.Reflection;
using FastMember;
using static GameEstate.Formats.Red.Records.Enums;
namespace GameEstate.Formats.Red.Types
{
[DataContract(Namespace = "")]
[REDMeta]
public class BTSaveNamedTargetOnEvent : IBehTreeTask
{
[Ordinal(1)] [RED("namedTargetToSave")] public CName NamedTargetToSave { get; set;}
[Ordinal(2)] [RED("saveUnder")] public CName SaveUnder { get; set;}
[Ordinal(3)] [RED("gameplayEventToSaveOn")] public CName GameplayEventToSaveOn { get; set;}
public BTSaveNamedTargetOnEvent(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name){ }
public static new CVariable Create(CR2WFile cr2w, CVariable parent, string name) => new BTSaveNamedTargetOnEvent(cr2w, parent, name);
public override void Read(BinaryReader file, uint size) => base.Read(file, size);
public override void Write(BinaryWriter file) => base.Write(file);
}
} | 34.655172 | 136 | 0.731343 | [
"MIT"
] | smorey2/GameEstate | src/GameEstate.Formats.Red/Formats/Red/W3/RTTIConvert/BTSaveNamedTargetOnEvent.cs | 1,005 | C# |
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.AvalonEdit.Utils;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows.Input;
namespace ICSharpCode.AvalonEdit.Gui
{
/// <summary>
/// A set of input bindings and event handlers for the text area.
/// </summary>
public interface ITextAreaInputHandler
{
/// <summary>
/// Gets the text area that the input handler belongs to.
/// </summary>
TextArea TextArea {
get;
}
/// <summary>
/// Attaches an input handler to the text area.
/// </summary>
void Attach();
/// <summary>
/// Detaches the input handler from the text area.
/// </summary>
void Detach();
}
/// <summary>
/// Default-implementation of <see cref="ITextAreaInputHandler"/>.
/// </summary>
public class TextAreaInputHandler : ITextAreaInputHandler
{
readonly ObserveAddRemoveCollection<CommandBinding> commandBindings;
readonly ObserveAddRemoveCollection<InputBinding> inputBindings;
readonly ObserveAddRemoveCollection<ITextAreaInputHandler> nestedInputHandlers;
readonly TextArea textArea;
bool isAttached;
/// <summary>
/// Creates a new TextAreaInputHandler.
/// </summary>
public TextAreaInputHandler(TextArea textArea)
{
if (textArea == null)
throw new ArgumentNullException("textArea");
this.textArea = textArea;
commandBindings = new ObserveAddRemoveCollection<CommandBinding>(CommandBinding_Added, CommandBinding_Removed);
inputBindings = new ObserveAddRemoveCollection<InputBinding>(InputBinding_Added, InputBinding_Removed);
nestedInputHandlers = new ObserveAddRemoveCollection<ITextAreaInputHandler>(NestedInputHandler_Added, NestedInputHandler_Removed);
}
/// <inheritdoc/>
public TextArea TextArea {
get { return textArea; }
}
/// <summary>
/// Gets whether the input handler is currently attached to the text area.
/// </summary>
public bool IsAttached {
get { return isAttached; }
}
#region CommandBindings / InputBindings
/// <summary>
/// Gets the command bindings of this input handler.
/// </summary>
public ICollection<CommandBinding> CommandBindings {
get { return commandBindings; }
}
void CommandBinding_Added(CommandBinding commandBinding)
{
if (isAttached)
textArea.CommandBindings.Add(commandBinding);
}
void CommandBinding_Removed(CommandBinding commandBinding)
{
if (isAttached)
textArea.CommandBindings.Remove(commandBinding);
}
/// <summary>
/// Gets the input bindings of this input handler.
/// </summary>
public ICollection<InputBinding> InputBindings {
get { return inputBindings; }
}
void InputBinding_Added(InputBinding inputBinding)
{
if (isAttached)
textArea.InputBindings.Add(inputBinding);
}
void InputBinding_Removed(InputBinding inputBinding)
{
if (isAttached)
textArea.InputBindings.Remove(inputBinding);
}
/// <summary>
/// Adds a command and input binding.
/// </summary>
/// <param name="command">The command ID.</param>
/// <param name="modifiers">The modifiers of the keyboard shortcut.</param>
/// <param name="key">The key of the keyboard shortcut.</param>
/// <param name="handler">The event handler to run when the command is executed.</param>
public void AddBinding(ICommand command, ModifierKeys modifiers, Key key, ExecutedRoutedEventHandler handler)
{
this.CommandBindings.Add(new CommandBinding(command, handler));
this.InputBindings.Add(new KeyBinding(command, key, modifiers));
}
#endregion
#region NestedInputHandlers
/// <summary>
/// Gets the collection of nested input handlers. NestedInputHandlers are activated and deactivated
/// together with this input handler.
/// </summary>
public ICollection<ITextAreaInputHandler> NestedInputHandlers {
get { return nestedInputHandlers; }
}
void NestedInputHandler_Added(ITextAreaInputHandler handler)
{
if (handler == null)
throw new ArgumentNullException("handler");
if (handler.TextArea != textArea)
throw new ArgumentException("The nested handler must be working for the same text area!");
if (isAttached)
handler.Attach();
}
void NestedInputHandler_Removed(ITextAreaInputHandler handler)
{
if (isAttached)
handler.Detach();
}
#endregion
#region Attach/Detach
/// <inheritdoc/>
public virtual void Attach()
{
if (isAttached)
throw new InvalidOperationException("Input handler is already attached");
isAttached = true;
textArea.CommandBindings.AddRange(commandBindings);
textArea.InputBindings.AddRange(inputBindings);
foreach (ITextAreaInputHandler handler in nestedInputHandlers)
handler.Attach();
}
/// <inheritdoc/>
public virtual void Detach()
{
if (!isAttached)
throw new InvalidOperationException("Input handler is not attached");
isAttached = false;
foreach (CommandBinding b in commandBindings)
textArea.CommandBindings.Remove(b);
foreach (InputBinding b in inputBindings)
textArea.InputBindings.Remove(b);
foreach (ITextAreaInputHandler handler in nestedInputHandlers)
handler.Detach();
}
#endregion
}
}
| 28.983784 | 133 | 0.718389 | [
"MIT"
] | ishani/Oddity | Badge/toolchain2/ICSharpCode.AvalonEdit/Gui/TextAreaInputHandler.cs | 5,362 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ImageQuantization
{
public struct Edge : IComparable<Edge>
{
public int from, to;
public double cost;
public Edge(double cost, int f, int t)
{
from = f;
to = t;
this.cost = cost;
}
public int CompareTo(Edge other)
{
if (this.cost < other.cost)
return -1;
else if (this.cost > other.cost)
return 1;
else return 0;
}
}
class MstPrimEager
{
public Edge[] edgeTo { set; get; }
private double[] distTo;
private bool[] visited;
private IPriorityQueue ipq;
private int V;// number of vertices in the graph
public MstPrimEager(int GraphNodesCount)
{
V = GraphNodesCount;
edgeTo = new Edge[V];
distTo = new double[V];
visited = new bool[V];
ipq = new IPriorityQueue(V);
for (int i = 0; i < V; ++i)
{
distTo[i] = double.MaxValue;
}
}
public void GetMst()
{
Visit(0);
double sum = 0;
for(int i=0;i<edgeTo.Count();++i)
{
sum += edgeTo[i].cost;
}
MainForm.mstVal = sum;
}
private void Visit(int i)
{
distTo[i] = 0;
ipq.Insert(i, distTo[i]);
while (!ipq.IsEmpty())
{
int j = ipq.DeleteMin();
Proccess(j);
}
}
private void Proccess(int j)
{
visited[j] = true;
for (int i = 0; i < V; ++i)
{
if (visited[i]) continue;
double edgeCost = Util.CalculateEdgeValue(j, i);
if (edgeCost < distTo[i])
{
distTo[i] = edgeCost;
edgeTo[i] = new Edge(edgeCost, j, i);
if (ipq.Contains(i))
{
ipq.DecreaseKey(i, distTo[i]);
}
else ipq.Insert(i, distTo[i]);
}
}
}
}
}
| 25.956522 | 64 | 0.416248 | [
"MIT"
] | Abdullah-AlAttar/Image-Quantization-Project- | ImageQuantization/ImageQuantization/MstPrimEager.cs | 2,390 | C# |
#region Copyright (C) 2003-2016 Stimulsoft
/*
{*******************************************************************}
{ }
{ Stimulsoft Reports }
{ }
{ Copyright (C) 2003-2016 Stimulsoft }
{ ALL RIGHTS RESERVED }
{ }
{ The entire contents of this file is protected by U.S. and }
{ International Copyright Laws. Unauthorized reproduction, }
{ reverse-engineering, and distribution of all or any portion of }
{ the code contained in this file is strictly prohibited and may }
{ result in severe civil and criminal penalties and will be }
{ prosecuted to the maximum extent possible under the law. }
{ }
{ RESTRICTIONS }
{ }
{ THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES }
{ ARE CONFIDENTIAL AND PROPRIETARY }
{ TRADE SECRETS OF Stimulsoft }
{ }
{ CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON }
{ ADDITIONAL RESTRICTIONS. }
{ }
{*******************************************************************}
*/
#endregion Copyright (C) 2003-2016 Stimulsoft
using System;
using System.ComponentModel;
using System.Drawing;
using System.ComponentModel.Design.Serialization;
using System.Globalization;
using System.Collections;
using System.Reflection;
namespace Stimulsoft.Base.Localization
{
public class StiPointFConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return ((sourceType == typeof(string)) || base.CanConvertFrom(context, sourceType));
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return ((destinationType == typeof(InstanceDescriptor)) || base.CanConvertTo(context, destinationType));
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
string str = value as string;
if (str == null)
{
return base.ConvertFrom(context, culture, value);
}
string str2 = str.Trim();
if (str2.Length == 0)
{
return null;
}
if (culture == null)
{
culture = CultureInfo.CurrentCulture;
}
char ch = culture.TextInfo.ListSeparator[0];
string[] strArray = str2.Split(new char[] { ch });
float[] numArray = new float[strArray.Length];
TypeConverter converter = TypeDescriptor.GetConverter(typeof(float));
for (int i = 0; i < numArray.Length; i++)
{
numArray[i] = (float)converter.ConvertFromString(context, culture, strArray[i]);
}
if (numArray.Length != 2)
{
throw new Exception("ConvertInvalidPrimitive");
}
return new PointF(numArray[0], numArray[1]);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == null)
{
throw new ArgumentNullException("destinationType");
}
if (value is PointF)
{
if (destinationType == typeof(string))
{
PointF point = (PointF)value;
if (culture == null)
{
culture = CultureInfo.CurrentCulture;
}
string separator = culture.TextInfo.ListSeparator + " ";
TypeConverter converter = TypeDescriptor.GetConverter(typeof(float));
string[] strArray = new string[2];
int num = 0;
strArray[num++] = converter.ConvertToString(context, culture, point.X);
strArray[num++] = converter.ConvertToString(context, culture, point.Y);
return string.Join(separator, strArray);
}
if (destinationType == typeof(InstanceDescriptor))
{
PointF point2 = (PointF)value;
ConstructorInfo constructor = typeof(PointF).GetConstructor(new Type[] { typeof(float), typeof(float) });
if (constructor != null)
{
return new InstanceDescriptor(constructor, new object[] { point2.X, point2.Y });
}
}
}
return base.ConvertTo(context, culture, value, destinationType);
}
public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
{
if (propertyValues == null)
{
throw new ArgumentNullException("propertyValues");
}
object obj2 = propertyValues["X"];
object obj3 = propertyValues["Y"];
if (((obj2 == null) || (obj3 == null)) || (!(obj2 is float) || !(obj3 is float)))
{
throw new Exception("ConvertInvalidPrimitive");
}
return new PointF((float)obj2, (float)obj3);
}
public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
{
return true;
}
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
return TypeDescriptor.GetProperties(typeof(PointF), attributes).Sort(new string[] { "X", "Y" });
}
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return true;
}
}
} | 39.233333 | 136 | 0.548343 | [
"MIT"
] | stimulsoft/Stimulsoft.Controls.Net | Stimulsoft.Base/Localization/StiPointFConverter.cs | 5,885 | C# |
/*
* Copyright 2007 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using Result = com.google.zxing.Result;
namespace com.google.zxing.client.result
{
/// <summary> Tries to parse results that are a URI of some kind.
///
/// </summary>
/// <author> Sean Owen
/// </author>
/// <author>www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source
/// </author>
sealed class URIResultParser:ResultParser
{
private URIResultParser()
{
}
public static URIParsedResult parse(Result result)
{
System.String rawText = result.Text;
// We specifically handle the odd "URL" scheme here for simplicity
if (rawText != null && rawText.StartsWith("URL:"))
{
rawText = rawText.Substring(4);
}
if (!isBasicallyValidURI(rawText))
{
return null;
}
return new URIParsedResult(rawText, null);
}
/// <summary> Determines whether a string is not obviously not a URI. This implements crude checks; this class does not
/// intend to strictly check URIs as its only function is to represent what is in a barcode, but, it does
/// need to know when a string is obviously not a URI.
/// </summary>
internal static bool isBasicallyValidURI(System.String uri)
{
if (uri == null || uri.IndexOf(' ') >= 0 || uri.IndexOf('\n') >= 0)
{
return false;
}
// Look for period in a domain but followed by at least a two-char TLD
// Forget strings that don't have a valid-looking protocol
int period = uri.IndexOf('.');
if (period >= uri.Length - 2)
{
return false;
}
int colon = uri.IndexOf(':');
if (period < 0 && colon < 0)
{
return false;
}
if (colon >= 0)
{
if (period < 0 || period > colon)
{
// colon ends the protocol
for (int i = 0; i < colon; i++)
{
char c = uri[i];
if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z'))
{
return false;
}
}
}
else
{
// colon starts the port; crudely look for at least two numbers
if (colon >= uri.Length - 2)
{
return false;
}
for (int i = colon + 1; i < colon + 3; i++)
{
char c = uri[i];
if (c < '0' || c > '9')
{
return false;
}
}
}
}
return true;
}
}
} | 27.386792 | 122 | 0.591457 | [
"Apache-2.0"
] | LeonidRulit/zxing1 | csharp/client/result/URIResultParser.cs | 2,903 | C# |
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class UnrealMapboxPluginTarget : TargetRules
{
public UnrealMapboxPluginTarget( TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange( new string[] { "UnrealMapboxPlugin" } );
}
}
| 25.733333 | 69 | 0.777202 | [
"MIT"
] | delebash/UnrealMapboxPlugin | Source/UnrealMapboxPlugin.Target.cs | 386 | C# |
using System;
using System.Collections.Generic;
using Melanchall.DryWetMidi.Common;
using Melanchall.DryWetMidi.Core;
using Melanchall.DryWetMidi.Interaction;
namespace Melanchall.DryWetMidi.Tools
{
/// <summary>
/// Provides methods to randomize chords time.
/// </summary>
[Obsolete("OBS10")]
public static class ChordsRandomizerUtilities
{
#region Methods
/// <summary>
/// Randomizes chords contained in the specified <see cref="TrackChunk"/>.
/// </summary>
/// <param name="trackChunk"><see cref="TrackChunk"/> to randomize chords in.</param>
/// <param name="bounds">Bounds to randomize time within.</param>
/// <param name="tempoMap">Tempo map used to calculate time bounds to randomize within.</param>
/// <param name="settings">Settings according to which chords should be randomized.</param>
/// <exception cref="ArgumentNullException">
/// <para>One of the following errors occured:</para>
/// <list type="bullet">
/// <item>
/// <description><paramref name="trackChunk"/> is <c>null</c>.</description>
/// </item>
/// <item>
/// <description><paramref name="bounds"/> is <c>null</c>.</description>
/// </item>
/// <item>
/// <description><paramref name="tempoMap"/> is <c>null</c>.</description>
/// </item>
/// </list>
/// </exception>
[Obsolete("OBS10")]
public static void RandomizeChords(this TrackChunk trackChunk, IBounds bounds, TempoMap tempoMap, ChordsRandomizingSettings settings = null)
{
ThrowIfArgument.IsNull(nameof(trackChunk), trackChunk);
ThrowIfArgument.IsNull(nameof(bounds), bounds);
ThrowIfArgument.IsNull(nameof(tempoMap), tempoMap);
using (var chordsManager = trackChunk.ManageChords(settings?.ChordDetectionSettings))
{
new ChordsRandomizer().Randomize(chordsManager.Objects, bounds, tempoMap, settings);
}
}
/// <summary>
/// Randomizes chords contained in the specified collection of <see cref="TrackChunk"/>.
/// </summary>
/// <param name="trackChunks">Collection of <see cref="TrackChunk"/> to randomize chords in.</param>
/// <param name="bounds">Bounds to randomize time within.</param>
/// <param name="tempoMap">Tempo map used to calculate time bounds to randomize within.</param>
/// <param name="settings">Settings according to which chords should be randomized.</param>
/// <exception cref="ArgumentNullException">
/// <para>One of the following errors occured:</para>
/// <list type="bullet">
/// <item>
/// <description><paramref name="trackChunks"/> is <c>null</c>.</description>
/// </item>
/// <item>
/// <description><paramref name="bounds"/> is <c>null</c>.</description>
/// </item>
/// <item>
/// <description><paramref name="tempoMap"/> is <c>null</c>.</description>
/// </item>
/// </list>
/// </exception>
[Obsolete("OBS10")]
public static void RandomizeChords(this IEnumerable<TrackChunk> trackChunks, IBounds bounds, TempoMap tempoMap, ChordsRandomizingSettings settings = null)
{
ThrowIfArgument.IsNull(nameof(trackChunks), trackChunks);
ThrowIfArgument.IsNull(nameof(bounds), bounds);
ThrowIfArgument.IsNull(nameof(tempoMap), tempoMap);
foreach (var trackChunk in trackChunks)
{
trackChunk.RandomizeChords(bounds, tempoMap, settings);
}
}
/// <summary>
/// Randomizes chords contained in the specified <see cref="MidiFile"/>.
/// </summary>
/// <param name="midiFile"><see cref="MidiFile"/> to randomize chords in.</param>
/// <param name="bounds">Bounds to randomize time within.</param>
/// <param name="settings">Settings according to which chords should be randomized.</param>
/// <exception cref="ArgumentNullException">
/// <para>One of the following errors occured:</para>
/// <list type="bullet">
/// <item>
/// <description><paramref name="midiFile"/> is <c>null</c>.</description>
/// </item>
/// <item>
/// <description><paramref name="bounds"/> is <c>null</c>.</description>
/// </item>
/// </list>
/// </exception>
[Obsolete("OBS10")]
public static void RandomizeChords(this MidiFile midiFile, IBounds bounds, ChordsRandomizingSettings settings = null)
{
ThrowIfArgument.IsNull(nameof(midiFile), midiFile);
ThrowIfArgument.IsNull(nameof(bounds), bounds);
var tempoMap = midiFile.GetTempoMap();
midiFile.GetTrackChunks().RandomizeChords(bounds, tempoMap, settings);
}
#endregion
}
}
| 43.155172 | 162 | 0.601079 | [
"MIT"
] | melanchall/drymidi | DryWetMidi/Tools/Randomizer/Utilities/ChordsRandomizerUtilities.cs | 5,008 | C# |
using UnityEngine;
/// <summary>
/// Author: Josh H.
/// Support: assetstore.joshh@gmail.com
/// </summary>
namespace JoshH.Extensions
{
public static class Vector2Extension
{
public static Vector2 Rotate(this Vector2 v, float degrees)
{
float sin = Mathf.Sin(degrees * Mathf.Deg2Rad);
float cos = Mathf.Cos(degrees * Mathf.Deg2Rad);
float tx = v.x;
float ty = v.y;
v.x = (cos * tx) - (sin * ty);
v.y = (sin * tx) + (cos * ty);
return v;
}
}
} | 23.625 | 67 | 0.522046 | [
"MIT"
] | Julius-Bendt/flyer | Assets/UIGradient/Scripts/Vector2Extension.cs | 569 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using DoVuiHaiNao.Areas.WebManager.Data;
using DoVuiHaiNao.Models;
using DoVuiHaiNao.Areas.WebManager.ViewModels;
using DoVuiHaiNao.Extension;
using Microsoft.AspNetCore.Authorization;
namespace DoVuiHaiNao.Areas.WebManager.Controllers
{
[Area("WebManager")]
[Authorize(Roles = "Admin, Manager")]
public class MembersController : Controller
{
private readonly IMemberManagerRepository _repository;
public MembersController(IMemberManagerRepository repository)
{
_repository = repository;
}
// GET: WebManager/Members
[Route("/quan-ly-web/thanh-vien")]
public async Task<IActionResult> Index(string sortOrder,
string currentFilter,
string searchString,
int? page, int? pageSize)
{
List<NumberItem> SoLuong = new List<NumberItem>
{
new NumberItem { Value = 10},
new NumberItem { Value = 20},
new NumberItem { Value = 50},
new NumberItem { Value = 100},
};
ViewData["SoLuong"] = SoLuong;
ViewData["CurrentSort"] = sortOrder;
ViewData["FullNameParm"] = String.IsNullOrEmpty(sortOrder) ? "fullName" : "";
ViewData["CurrentSize"] = pageSize;
if (searchString != null)
{
page = 1;
}
else
{
searchString = currentFilter;
}
ViewData["CurrentFilter"] = searchString;
PaginatedList<Member> temp = await _repository.GetAll(sortOrder, searchString, page, pageSize);
return View(temp);
}
// GET: WebManager/Members/Details/5
[Route("/quan-ly-web/thanh-vien/chi-tiet/{id}")]
public async Task<IActionResult> Details(string id)
{
if (id == null)
{
return NotFound();
}
var member = await _repository.Get(id);
if (member == null)
{
return NotFound();
}
return View(member);
}
[Route("/quan-ly-web/thanh-vien/chinh-sua/{id}")]
public async Task<IActionResult> Edit(string id)
{
if (id == null)
{
return NotFound();
}
var member = await _repository.Get(id);
if (member == null)
{
return NotFound();
}
return View(member);
}
// POST: WebManager/Members/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
[Route("/quan-ly-web/thanh-vien/chinh-sua/{id}")]
public async Task<IActionResult> Edit(string id, [Bind("FullName,About,PictureSmall,Picture65x65,Slug,PictureBig,DateofBirth,Facebook,GooglePlus,Linkedin,Twitter,IdentityFacebook,Score,Website,CreateDT,Id,UserName,NormalizedUserName,Email,NormalizedEmail,EmailConfirmed,PasswordHash,SecurityStamp,ConcurrencyStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEnd,LockoutEnabled,AccessFailedCount")] Member member)
{
if (id != member.Id)
{
return NotFound();
}
if (ModelState.IsValid)
{
try
{
await _repository.Update(member);
}
catch (DbUpdateConcurrencyException)
{
if (!MemberExists(member.Id))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction("Index");
}
return View(member);
}
// GET: WebManager/Members/Delete/5
[Route("/quan-ly-web/thanh-vien/xoa/{id}")]
public async Task<IActionResult> Delete(string id)
{
if (id == null)
{
return NotFound();
}
var member = await _repository.Get(id);
if (member == null)
{
return NotFound();
}
return View(member);
}
[Route("/quan-ly-web/thanh-vien/xoa/{id}")]
// POST: WebManager/Members/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(string id)
{
await _repository.Delete(id);
return RedirectToAction("Index");
}
private bool MemberExists(string id)
{
return _repository.Exists(id);
}
}
}
| 32.1375 | 433 | 0.540257 | [
"Apache-2.0"
] | nguyendev/DVMN | Code/DVMN/DoVuiHaiNao/Areas/WebManager/Controllers/MembersController.cs | 5,142 | C# |
using System.Collections.Generic;
using System.Linq;
using Orchard.DynamicForms.Models;
namespace Orchard.DynamicForms.ViewModels {
public class FormsIndexViewModel {
public IList<IGrouping<string, Submission>> Forms { get; set; }
}
} | 28 | 71 | 0.75 | [
"BSD-3-Clause"
] | 1996dylanriley/Orchard | src/Orchard.Web/Modules/Orchard.DynamicForms/ViewModels/FormsIndexViewModel.cs | 254 | 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 NICE.Identity.Authorisation.WebAPI.Repositories;
namespace NICE.Identity.Authorisation.WebAPI.Migrations
{
[DbContext(typeof(IdentityContext))]
[Migration("20191202084355_RefactorIDAM121")]
partial class RefactorIDAM121
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.Environment", b =>
{
b.Property<int>("EnvironmentId")
.ValueGeneratedOnAdd()
.HasColumnName("EnvironmentID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50);
b.Property<int>("Order");
b.HasKey("EnvironmentId");
b.ToTable("Environments");
b.HasData(
new
{
EnvironmentId = 1,
Name = "Local",
Order = 0
},
new
{
EnvironmentId = 2,
Name = "Dev",
Order = 0
},
new
{
EnvironmentId = 3,
Name = "Test",
Order = 0
},
new
{
EnvironmentId = 4,
Name = "Alpha",
Order = 0
},
new
{
EnvironmentId = 5,
Name = "Beta",
Order = 0
},
new
{
EnvironmentId = 6,
Name = "Live",
Order = 0
});
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.Role", b =>
{
b.Property<int>("RoleId")
.ValueGeneratedOnAdd()
.HasColumnName("RoleID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100);
b.Property<int>("WebsiteId")
.HasColumnName("WebsiteID");
b.HasKey("RoleId");
b.HasIndex("WebsiteId");
b.ToTable("Roles");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.Service", b =>
{
b.Property<int>("ServiceId")
.ValueGeneratedOnAdd()
.HasColumnName("ServiceID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100);
b.HasKey("ServiceId");
b.ToTable("Services");
b.HasData(
new
{
ServiceId = 1,
Name = "NICE Website"
},
new
{
ServiceId = 2,
Name = "EPPI Reviewer v5"
});
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.TermsVersion", b =>
{
b.Property<int>("TermsVersionId")
.HasColumnName("TermsVersionID");
b.Property<int>("CreatedByUserId")
.HasColumnName("CreatedByUserID");
b.Property<DateTime>("VersionDate");
b.HasKey("TermsVersionId");
b.HasIndex("CreatedByUserId");
b.ToTable("TermsVersions");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.User", b =>
{
b.Property<int>("UserId")
.ValueGeneratedOnAdd()
.HasColumnName("UserID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<bool>("AllowContactMe");
b.Property<string>("NameIdentifier")
.IsRequired()
.HasColumnName("NameIdentifier")
.HasMaxLength(100);
b.Property<string>("EmailAddress")
.IsRequired()
.HasMaxLength(320);
b.Property<string>("FirstName")
.HasMaxLength(100);
b.Property<bool>("HasVerifiedEmailAddress");
b.Property<DateTime?>("InitialRegistrationDate");
b.Property<bool>("IsLockedOut");
b.Property<bool>("IsMigrated");
b.Property<bool>("IsStaffMember");
b.Property<DateTime?>("LastLoggedInDate");
b.Property<string>("LastName")
.HasMaxLength(100);
b.HasKey("UserId");
b.ToTable("Users");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.UserAcceptedTermsVersion", b =>
{
b.Property<int>("UserAcceptedTermsVersionId")
.ValueGeneratedOnAdd()
.HasColumnName("UserAcceptedTermsVersionID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("TermsVersionId")
.HasColumnName("TermsVersionID");
b.Property<DateTime>("UserAcceptedDate");
b.Property<int>("UserId");
b.HasKey("UserAcceptedTermsVersionId");
b.HasIndex("TermsVersionId");
b.HasIndex("UserId");
b.ToTable("UserAcceptedTermsVersion");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.UserRole", b =>
{
b.Property<int>("UserRoleId")
.ValueGeneratedOnAdd()
.HasColumnName("UserRoleID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("RoleId")
.HasColumnName("RoleID");
b.Property<int>("UserId")
.HasColumnName("UserID");
b.HasKey("UserRoleId");
b.HasAlternateKey("UserId", "RoleId")
.HasName("IX_UserRoles_UserID_RoleID");
b.HasIndex("RoleId");
b.ToTable("UserRoles");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.Website", b =>
{
b.Property<int>("WebsiteId")
.ValueGeneratedOnAdd()
.HasColumnName("WebsiteID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("EnvironmentId")
.HasColumnName("EnvironmentID");
b.Property<string>("Host")
.IsRequired()
.HasMaxLength(255);
b.Property<int>("ServiceId")
.HasColumnName("ServiceID");
b.HasKey("WebsiteId");
b.HasIndex("EnvironmentId");
b.HasIndex("ServiceId");
b.ToTable("Websites");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.Role", b =>
{
b.HasOne("NICE.Identity.Authorisation.WebAPI.DataModels.Website", "Website")
.WithMany("Roles")
.HasForeignKey("WebsiteId")
.HasConstraintName("FK_Roles_Roles");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.TermsVersion", b =>
{
b.HasOne("NICE.Identity.Authorisation.WebAPI.DataModels.User", "CreatedByUser")
.WithMany("UserCreatedTermsVersions")
.HasForeignKey("CreatedByUserId")
.HasConstraintName("FK_TermsVersion_CreatedByUser");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.UserAcceptedTermsVersion", b =>
{
b.HasOne("NICE.Identity.Authorisation.WebAPI.DataModels.TermsVersion", "TermsVersion")
.WithMany("UserAcceptedTermsVersions")
.HasForeignKey("TermsVersionId")
.HasConstraintName("FK_UserAcceptedTermsVersion_TermsVersion");
b.HasOne("NICE.Identity.Authorisation.WebAPI.DataModels.User", "User")
.WithMany("UserAcceptedTermsVersions")
.HasForeignKey("UserId")
.HasConstraintName("FK_UserAcceptedTermsVersion_User");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.UserRole", b =>
{
b.HasOne("NICE.Identity.Authorisation.WebAPI.DataModels.Role", "Role")
.WithMany("UserRoles")
.HasForeignKey("RoleId")
.HasConstraintName("FK_UserRoles_Roles");
b.HasOne("NICE.Identity.Authorisation.WebAPI.DataModels.User", "User")
.WithMany("UserRoles")
.HasForeignKey("UserId")
.HasConstraintName("FK_UserRoles_Users");
});
modelBuilder.Entity("NICE.Identity.Authorisation.WebAPI.DataModels.Website", b =>
{
b.HasOne("NICE.Identity.Authorisation.WebAPI.DataModels.Environment", "Environment")
.WithMany("Websites")
.HasForeignKey("EnvironmentId")
.HasConstraintName("FK_ServiceInstance_Environments");
b.HasOne("NICE.Identity.Authorisation.WebAPI.DataModels.Service", "Service")
.WithMany("Websites")
.HasForeignKey("ServiceId")
.HasConstraintName("FK_ServiceInstance_Services");
});
#pragma warning restore 612, 618
}
}
}
| 38.876972 | 125 | 0.46876 | [
"MIT"
] | nhsevidence/identity | NICE.Identity.Authorisation.WebAPI/Migrations/20191202084355_RefactorIDAM121.Designer.cs | 12,326 | C# |
using Character.Attributes;
using Character.Display;
using Character.Physical;
namespace Character.Races
{
public class HighElf : Elf
{
public HighElf() : base(new TextObj("High Elf")) { }
public override IAttributeScore RacialAttributeAdjustment(ICharacterAttribute attribute) => (AttributeScore)base.RacialAttributeAdjustment(attribute).Add(ApplyIntellegenceBonus(attribute));
public override IHitPoints BonusHitPoints() => new HitPoints(0);
private IAttributeScore ApplyIntellegenceBonus(ICharacterAttribute attribute) => attribute.MatchesName(CharacterAttributeName.Intelligence) ? new AttributeScore(1) : new AttributeScore(0);
}
}
| 45.533333 | 197 | 0.770132 | [
"MIT"
] | MyTurnyet/CharacterBuilder | Character/Races/HighElf.cs | 685 | C# |
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Azure.Storage;
using Azure.Storage.Blobs;
using Microsoft.Data.SqlClient;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlTools.ServiceLayer.Admin;
using Microsoft.SqlTools.ServiceLayer.AzureBlob;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation;
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
using Microsoft.SqlTools.ServiceLayer.Management;
using Microsoft.SqlTools.ServiceLayer.TaskServices;
using Microsoft.SqlTools.ServiceLayer.Test.Common;
using NUnit.Framework;
using static Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility.LiveConnectionHelper;
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.DisasterRecovery
{
class BackupRestoreUrlTests
{
/// <summary>
/// Create simple backup test
/// </summary>
[Test]
public async Task BackupDatabaseToUrlAndRestoreFromUrlTest()
{
DisasterRecoveryService service = new DisasterRecoveryService();
string databaseName = "SqlToolsService_TestBackupToUrl_" + new Random().Next(10000000, 99999999);
using (SqlTestDb testDb = SqlTestDb.CreateNew(TestServerType.OnPrem, false, databaseName))
{
var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo(databaseName);
using (DatabaseTaskHelper helper = AdminService.CreateDatabaseTaskHelper(liveConnection.ConnectionInfo, databaseExists: true))
using (SqlConnection sqlConn = ConnectionService.OpenSqlConnection(liveConnection.ConnectionInfo))
{
ServerConnection serverConn = new ServerConnection(sqlConn);
Server server = new Server(serverConn);
SharedAccessSignatureCreator sasCreator = new SharedAccessSignatureCreator(server);
AzureBlobConnectionSetting azureBlobConnection = TestAzureBlobConnectionService.Instance.Settings;
sasCreator.CreateSqlSASCredential(azureBlobConnection.AccountName, azureBlobConnection.AccountKey, azureBlobConnection.BlobContainerUri, "");
string backupPath = GetAzureBlobBackupPath(databaseName);
BackupInfo backupInfo = CreateDefaultBackupInfo(databaseName,
BackupType.Full,
new List<string>() { backupPath },
new Dictionary<string, int>() { { backupPath, (int)DeviceType.Url } });
BackupOperation backupOperation = CreateBackupOperation(service, liveConnection.ConnectionInfo.OwnerUri, backupInfo, helper.DataContainer, sqlConn);
// Backup the database
service.PerformBackup(backupOperation);
testDb.Cleanup();
}
}
await VerifyRestore(databaseName, true, TaskExecutionModeFlag.Execute, databaseName);
VerifyAndCleanAzureBlobBackup(databaseName);
}
private BackupInfo CreateDefaultBackupInfo(string databaseName, BackupType backupType, List<string> backupPathList, Dictionary<string, int> backupPathDevices)
{
BackupInfo backupInfo = new BackupInfo();
backupInfo.BackupComponent = (int)BackupComponent.Database;
backupInfo.BackupDeviceType = (int)BackupDeviceType.Url;
backupInfo.BackupPathDevices = backupPathDevices;
backupInfo.BackupPathList = backupPathList;
backupInfo.BackupsetName = "default_backup";
backupInfo.BackupType = (int)backupType;
backupInfo.DatabaseName = databaseName;
backupInfo.SelectedFileGroup = null;
backupInfo.SelectedFiles = "";
return backupInfo;
}
private string GetAzureBlobBackupPath(string databaseName)
{
AzureBlobConnectionSetting azureBlobConnection = TestAzureBlobConnectionService.Instance.Settings;
return azureBlobConnection.BlobContainerUri + "/" + databaseName + ".bak";
}
private void VerifyAndCleanAzureBlobBackup(string databaseName)
{
AzureBlobConnectionSetting azureBlobConnection = TestAzureBlobConnectionService.Instance.Settings;
string blobUri = GetAzureBlobBackupPath(databaseName);
string accountKey = azureBlobConnection.AccountKey;
string accountName = azureBlobConnection.AccountName;
bool result = BlobDropIfExists(blobUri, accountName, accountKey);
Assert.True(result, "Backup doesn't exists on Azure blob storage");
}
public static bool BlobDropIfExists(string blobUri, string accountName, string accountKey)
{
BlobClient client = new BlobClient(new Uri(blobUri), new StorageSharedKeyCredential(accountName, accountKey));
return client.DeleteIfExists();
}
private BackupOperation CreateBackupOperation(DisasterRecoveryService service, string uri, BackupInfo backupInfo, CDataContainer dataContainer, SqlConnection sqlConn)
{
var backupParams = new BackupParams
{
OwnerUri = uri,
BackupInfo = backupInfo,
};
return service.CreateBackupOperation(dataContainer, sqlConn, backupParams.BackupInfo);
}
private async Task<RestorePlanResponse> VerifyRestore(
string sourceDbName = null,
bool canRestore = true,
TaskExecutionModeFlag executionMode = TaskExecutionModeFlag.None,
string targetDatabase = null,
string[] selectedBackupSets = null,
Dictionary<string, object> options = null,
Func<Database, bool> verifyDatabase = null,
bool shouldFail = false)
{
string backUpFilePath = GetAzureBlobBackupPath(targetDatabase);
using (SqlTestDb testDb = SqlTestDb.CreateNew(TestServerType.OnPrem, false, "master"))
{
TestConnectionResult connectionResult = await LiveConnectionHelper.InitLiveConnectionInfoAsync("master", testDb.ConnectionString);
RestoreDatabaseHelper service = new RestoreDatabaseHelper();
// If source database is sepecified verfiy it's part of source db list
if (!string.IsNullOrEmpty(sourceDbName))
{
RestoreConfigInfoResponse configInfoResponse = service.CreateConfigInfoResponse(new RestoreConfigInfoRequestParams
{
OwnerUri = testDb.ConnectionString
});
IEnumerable<string> dbNames = configInfoResponse.ConfigInfo[RestoreOptionsHelper.SourceDatabaseNamesWithBackupSets] as IEnumerable<string>;
Assert.True(dbNames.Any(x => x == sourceDbName));
}
var request = new RestoreParams
{
BackupFilePaths = backUpFilePath,
TargetDatabaseName = targetDatabase,
OwnerUri = testDb.ConnectionString,
SelectedBackupSets = selectedBackupSets,
SourceDatabaseName = sourceDbName,
DeviceType = DeviceType.Url
};
request.Options[RestoreOptionsHelper.ReadHeaderFromMedia] = string.IsNullOrEmpty(backUpFilePath);
if (options != null)
{
foreach (var item in options)
{
if (!request.Options.ContainsKey(item.Key))
{
request.Options.Add(item.Key, item.Value);
}
}
}
var restoreDataObject = service.CreateRestoreDatabaseTaskDataObject(request, connectionResult.ConnectionInfo);
restoreDataObject.ConnectionInfo = connectionResult.ConnectionInfo;
var response = service.CreateRestorePlanResponse(restoreDataObject);
Assert.NotNull(response);
Assert.False(string.IsNullOrWhiteSpace(response.SessionId));
Assert.AreEqual(response.CanRestore, canRestore);
if (canRestore)
{
Assert.True(response.DbFiles.Any());
if (string.IsNullOrEmpty(targetDatabase))
{
targetDatabase = response.DatabaseName;
}
Assert.AreEqual(response.DatabaseName, targetDatabase);
Assert.NotNull(response.PlanDetails);
Assert.True(response.PlanDetails.Any());
Assert.NotNull(response.PlanDetails[RestoreOptionsHelper.BackupTailLog]);
Assert.NotNull(response.PlanDetails[RestoreOptionsHelper.TailLogBackupFile]);
Assert.NotNull(response.PlanDetails[RestoreOptionsHelper.DataFileFolder]);
Assert.NotNull(response.PlanDetails[RestoreOptionsHelper.LogFileFolder]);
Assert.NotNull(response.PlanDetails[RestoreOptionsHelper.StandbyFile]);
Assert.NotNull(response.PlanDetails[RestoreOptionsHelper.StandbyFile]);
if (executionMode != TaskExecutionModeFlag.None)
{
try
{
request.SessionId = response.SessionId;
restoreDataObject = service.CreateRestoreDatabaseTaskDataObject(request);
Assert.AreEqual(response.SessionId, restoreDataObject.SessionId);
request.RelocateDbFiles = !restoreDataObject.DbFilesLocationAreValid();
restoreDataObject.Execute((TaskExecutionMode)Enum.Parse(typeof(TaskExecutionMode), executionMode.ToString()));
if (executionMode.HasFlag(TaskExecutionModeFlag.Execute))
{
Assert.True(restoreDataObject.Server.Databases.Contains(targetDatabase));
if (verifyDatabase != null)
{
Assert.True(verifyDatabase(restoreDataObject.Server.Databases[targetDatabase]));
}
//To verify the backupset that are restored, verifying the database is a better options.
//Some tests still verify the number of backup sets that are executed which in some cases can be less than the selected list
if (verifyDatabase == null && selectedBackupSets != null)
{
Assert.AreEqual(selectedBackupSets.Count(), restoreDataObject.RestorePlanToExecute.RestoreOperations.Count());
}
}
if (executionMode.HasFlag(TaskExecutionModeFlag.Script))
{
Assert.False(string.IsNullOrEmpty(restoreDataObject.ScriptContent));
}
}
catch (Exception ex)
{
if (!shouldFail)
{
Assert.False(true, ex.Message);
}
}
finally
{
await DropDatabase(targetDatabase);
}
}
}
return response;
}
}
private async Task DropDatabase(string databaseName)
{
string dropDatabaseQuery = string.Format(CultureInfo.InvariantCulture,
Scripts.DropDatabaseIfExist, databaseName);
await TestServiceProvider.Instance.RunQueryAsync(TestServerType.OnPrem, "master", dropDatabaseQuery);
}
}
}
| 50.051383 | 174 | 0.609729 | [
"MIT"
] | KevinRansom/sqltoolsservice | test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/DisasterRecovery/BackupRestoreUrlTests.cs | 12,665 | C# |
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v13.1.5.0 (NJsonSchema v10.0.27.0 (Newtonsoft.Json v10.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------
#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."
#pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?'
#pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ...
#pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..."
namespace AlibabaSDK.WebSocketModels
{
using System = global::System;
/// <summary>采购消息-采购商发布询价消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_BUYER_PUBLISH_BUYOFFER&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_PUBLISH_BUYOFFER
{
/// <summary>询价单ID</summary>
[Newtonsoft.Json.JsonProperty("buyOfferId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long BuyOfferId { get; set; }
/// <summary>接入商的PR ID</summary>
[Newtonsoft.Json.JsonProperty("prId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PrId { get; set; }
/// <summary>发布询价的操作人子账号ID</summary>
[Newtonsoft.Json.JsonProperty("subUserId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SubUserId { get; set; }
}
/// <summary>采购消息-采购商取消询价消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_BUYER_CANCEL_BUYOFFER&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_CANCEL_BUYOFFER
{
/// <summary>询价单ID</summary>
[Newtonsoft.Json.JsonProperty("buyOfferId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BuyOfferId { get; set; }
/// <summary>接入商的PR ID</summary>
[Newtonsoft.Json.JsonProperty("prId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PrId { get; set; }
/// <summary>发布询价的操作人子账号ID</summary>
[Newtonsoft.Json.JsonProperty("subUserId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SubUserId { get; set; }
}
/// <summary>采购消息-供应商发布报价消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_SUPPLIER_QUOTATION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_SUPPLIER_QUOTATION
{
/// <summary>报价单ID</summary>
[Newtonsoft.Json.JsonProperty("quotationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long QuotationId { get; set; }
/// <summary>询价单ID</summary>
[Newtonsoft.Json.JsonProperty("buyOfferId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long BuyOfferId { get; set; }
/// <summary>接入商的PR ID</summary>
[Newtonsoft.Json.JsonProperty("prId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PrId { get; set; }
/// <summary>供应商在1688的会员ID</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierMemberId { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_SUPPLIER_CANCEL_QUOTATION : CAIGOU_MSG_SUPPLIER_QUOTATION
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_MARK_QUOTATION : CAIGOU_MSG_SUPPLIER_QUOTATION
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_UNMARK_QUOTATION : CAIGOU_MSG_SUPPLIER_QUOTATION
{
}
/// <summary>采购消息-采购商修改询价单消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_BUYER_MODIFY_BUYOFFER&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_MODIFY_BUYOFFER
{
/// <summary>新询价单ID</summary>
[Newtonsoft.Json.JsonProperty("buyOfferId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long BuyOfferId { get; set; }
/// <summary>修改前询价单ID</summary>
[Newtonsoft.Json.JsonProperty("sourceBuyOfferId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SourceBuyOfferId { get; set; }
/// <summary>接入商的PR ID</summary>
[Newtonsoft.Json.JsonProperty("prId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PrId { get; set; }
/// <summary>发布询价的操作人子账号ID</summary>
[Newtonsoft.Json.JsonProperty("subUserId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SubUserId { get; set; }
}
/// <summary>采购消息-采购商下单消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_BUYER_ORDERED&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_ORDERED
{
/// <summary>订单类型</summary>
[Newtonsoft.Json.JsonProperty("bizType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BizType { get; set; }
/// <summary>供应商在1688的会员ID</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierMemberId { get; set; }
/// <summary>订单id</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderId { get; set; }
/// <summary>发布询价的操作人子账号ID</summary>
[Newtonsoft.Json.JsonProperty("subUserId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SubUserId { get; set; }
[Newtonsoft.Json.JsonProperty("Items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<Items> Items { get; set; } = new System.Collections.ObjectModel.Collection<Items>();
}
/// <summary>采购消息-采购商与供应商建立合作关系消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_CREATE_COOPERATEION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_CREATE_COOPERATEION
{
/// <summary>询价单ID</summary>
[Newtonsoft.Json.JsonProperty("buyOfferId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long BuyOfferId { get; set; }
}
/// <summary>采购消息-交易成功(账期、确认收货)消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_TRADE_SUCCEED&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_TRADE_SUCCEED
{
/// <summary>询价单id</summary>
[Newtonsoft.Json.JsonProperty("buyOfferId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long BuyOfferId { get; set; }
/// <summary>报价单id</summary>
[Newtonsoft.Json.JsonProperty("quotationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long QuotationId { get; set; }
/// <summary>供应商在1688的会员id</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierMemberId { get; set; }
/// <summary>订单id</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderId { get; set; }
/// <summary>接入商的PR id</summary>
[Newtonsoft.Json.JsonProperty("prId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PrId { get; set; }
/// <summary>发布询价的操作人子账号ID</summary>
[Newtonsoft.Json.JsonProperty("subUserId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SubUserId { get; set; }
[Newtonsoft.Json.JsonProperty("Items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<Items2> Items { get; set; } = new System.Collections.ObjectModel.Collection<Items2>();
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_CLOSE_ORDER : CAIGOU_MSG_TRADE_SUCCEED
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_SUPPLIER_APPLY : CAIGOU_MSG_CREATE_COOPERATEION
{
}
/// <summary>采购消息-采购商付款成功消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_BUYER_PAYED_SUCCEED&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_PAYED_SUCCEED
{
/// <summary>询价单ID</summary>
[Newtonsoft.Json.JsonProperty("buyOfferId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BuyOfferId { get; set; }
/// <summary>报价单ID</summary>
[Newtonsoft.Json.JsonProperty("quotationId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string QuotationId { get; set; }
/// <summary>供应商在1688的会员ID</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierMemberId { get; set; }
/// <summary>订单ID</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderId { get; set; }
/// <summary>接入商的PRID</summary>
[Newtonsoft.Json.JsonProperty("prId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PrId { get; set; }
/// <summary>发布询价的操作人子账号ID</summary>
[Newtonsoft.Json.JsonProperty("subUserId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SubUserId { get; set; }
[Newtonsoft.Json.JsonProperty("Items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<Items3> Items { get; set; } = new System.Collections.ObjectModel.Collection<Items3>();
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_PUBLISH_PRODUCT : CAIGOU_MSG_CREATE_COOPERATEION
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_MODIFIED_PRODUCT : CAIGOU_MSG_CREATE_COOPERATEION
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_DELETE_PRODUCT_QUOTE : CAIGOU_MSG_CREATE_COOPERATEION
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_DELETE_PRODUCT : CAIGOU_MSG_CREATE_COOPERATEION
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_PUBLISH_PRODUCT_QUOTE : CAIGOU_MSG_CREATE_COOPERATEION
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_MODIFIED_PRODUCT_QUOTE : CAIGOU_MSG_CREATE_COOPERATEION
{
}
/// <summary>订单消息-1688创建订单(卖家视角)
/// https://open.1688.com/doc/topicDetail.htm?id=ORDER_BUYER_MAKE&topicGroup=ORDER</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_MAKE
{
/// <summary>订单ID</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderId { get; set; }
/// <summary>当前订单状态,状态值为waitbuyerpay</summary>
[Newtonsoft.Json.JsonProperty("currentStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string CurrentStatus { get; set; }
/// <summary>消息发送时间</summary>
[Newtonsoft.Json.JsonProperty("msgSendTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MsgSendTime { get; set; }
/// <summary>买家中文站会员ID</summary>
[Newtonsoft.Json.JsonProperty("buyerMemberId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string BuyerMemberId { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_PART_PART_SENDGOODS : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ORDER_PRICE_MODIFY : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ANNOUNCE_SENDGOODS : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ORDER_SUCCESS : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_PAY : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ORDER_COMFIRM_RECEIVEGOODS : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ORDER_BUYER_CLOSE : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ORDER_SELLER_CLOSE : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ORDER_BOPS_CLOSE : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ORDER_STEP_PAY : ORDER_BUYER_MAKE
{
}
/// <summary>商品消息-1688产品下架/merchandise off the shelf
/// https://open.1688.com/doc/topicDetail.htm?id=PRODUCT_PRODUCT_EXPIRE&topicGroup=PRODUCT</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_PRODUCT_EXPIRE
{
/// <summary>商品ID集合,至少有一个,用逗号分割</summary>
[Newtonsoft.Json.JsonProperty("productIds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ProductIds { get; set; }
/// <summary>1688会员ID</summary>
[Newtonsoft.Json.JsonProperty("memberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MemberId { get; set; }
/// <summary>消息类型,具体可为PRODUCT_EXPIRE、PRODUCT_NEW_OR_MODIFY、PRODUCT_DELETE、PRODUCT_REPOST</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Status { get; set; }
/// <summary>消息发送时间</summary>
[Newtonsoft.Json.JsonProperty("msgSendTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MsgSendTime { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_PRODUCT_NEW_OR_MODIFY : PRODUCT_PRODUCT_EXPIRE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_PRODUCT_DELETE : PRODUCT_PRODUCT_EXPIRE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_PRODUCT_REPOST : PRODUCT_PRODUCT_EXPIRE
{
}
/// <summary>采购消息-供应商发货
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_SUPPLIER_SEND_GOODS&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_SUPPLIER_SEND_GOODS
{
/// <summary>供应商在1688的会员id</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierMemberId { get; set; }
/// <summary>订单id</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderId { get; set; }
/// <summary>订单类型</summary>
[Newtonsoft.Json.JsonProperty("bizType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BizType { get; set; }
/// <summary>发布询价的操作人子账号ID</summary>
[Newtonsoft.Json.JsonProperty("subUserId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SubUserId { get; set; }
[Newtonsoft.Json.JsonProperty("Items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<Items4> Items { get; set; } = new System.Collections.ObjectModel.Collection<Items4>();
}
/// <summary>采购消息-企业采购单
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PURCHARSE_ORDER&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PURCHARSE_ORDER
{
/// <summary>采购单id</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>采购单标题</summary>
[Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Title { get; set; }
/// <summary>采购单号</summary>
[Newtonsoft.Json.JsonProperty("purchaseOrderNumber", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string PurchaseOrderNumber { get; set; }
[Newtonsoft.Json.JsonProperty("receiveUserInfo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public ReceiveUserInfo ReceiveUserInfo { get; set; } = new ReceiveUserInfo();
/// <summary>提交采购单时间</summary>
[Newtonsoft.Json.JsonProperty("gmtCreate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string GmtCreate { get; set; }
/// <summary>采购单状态</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Status { get; set; }
/// <summary>采购商memberId</summary>
[Newtonsoft.Json.JsonProperty("memberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MemberId { get; set; }
[Newtonsoft.Json.JsonProperty("orderList", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<OrderList> OrderList { get; set; } = new System.Collections.ObjectModel.Collection<OrderList>();
}
/// <summary>采购消息-采购商品状态变化
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_MALL_GOODS_STATUS_CHANGE&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_MALL_GOODS_STATUS_CHANGE
{
/// <summary>商品Id</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>物料名称</summary>
[Newtonsoft.Json.JsonProperty("materialName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MaterialName { get; set; }
/// <summary>供应商名称</summary>
[Newtonsoft.Json.JsonProperty("supplierName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierName { get; set; }
/// <summary>上下架状态</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Status { get; set; }
/// <summary>商品标题</summary>
[Newtonsoft.Json.JsonProperty("subject", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Subject { get; set; }
/// <summary>物料编码</summary>
[Newtonsoft.Json.JsonProperty("materialCode", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MaterialCode { get; set; }
/// <summary>offerId</summary>
[Newtonsoft.Json.JsonProperty("offerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OfferId { get; set; }
}
/// <summary>采购消息-商品变化消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_MALL_GOODS&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_MALL_GOODS
{
/// <summary>交易类型</summary>
[Newtonsoft.Json.JsonProperty("tradeType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string TradeType { get; set; }
/// <summary>单位</summary>
[Newtonsoft.Json.JsonProperty("saleUnit", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SaleUnit { get; set; }
/// <summary>物料名称</summary>
[Newtonsoft.Json.JsonProperty("materialName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MaterialName { get; set; }
/// <summary>数量</summary>
[Newtonsoft.Json.JsonProperty("saleAmount", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? SaleAmount { get; set; }
/// <summary>供应商名称</summary>
[Newtonsoft.Json.JsonProperty("supplierName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierName { get; set; }
/// <summary>上下架状态</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Status { get; set; }
/// <summary>商品标题</summary>
[Newtonsoft.Json.JsonProperty("subject", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Subject { get; set; }
/// <summary>图片列表</summary>
[Newtonsoft.Json.JsonProperty("pictureList", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<string> PictureList { get; set; } = new System.Collections.ObjectModel.Collection<string>();
/// <summary>采购商名称</summary>
[Newtonsoft.Json.JsonProperty("buyerName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BuyerName { get; set; }
/// <summary>商品Id</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? Id { get; set; }
/// <summary>商品描述</summary>
[Newtonsoft.Json.JsonProperty("content", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Content { get; set; }
[Newtonsoft.Json.JsonProperty("priceRangeList", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<PriceRangeList> PriceRangeList { get; set; } = new System.Collections.ObjectModel.Collection<PriceRangeList>();
/// <summary>物料分类</summary>
[Newtonsoft.Json.JsonProperty("categoryName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CategoryName { get; set; }
/// <summary>价格</summary>
[Newtonsoft.Json.JsonProperty("price", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? Price { get; set; }
/// <summary>物料编码</summary>
[Newtonsoft.Json.JsonProperty("materialCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string MaterialCode { get; set; }
[Newtonsoft.Json.JsonProperty("sendAddressList", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<SendAddressList> SendAddressList { get; set; }
/// <summary>offerId</summary>
[Newtonsoft.Json.JsonProperty("offerId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OfferId { get; set; }
}
/// <summary>采购消息-采购单创建成功
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PURCHARSE_ORDER_CREATE_DONE&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PURCHARSE_ORDER_CREATE_DONE
{
}
/// <summary>采购消息-采购商品价格变化
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_MALL_GOODS_PRICE_CHANGE&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_MALL_GOODS_PRICE_CHANGE
{
/// <summary>商品Id</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>物料名称</summary>
[Newtonsoft.Json.JsonProperty("materialName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MaterialName { get; set; }
/// <summary>价格</summary>
[Newtonsoft.Json.JsonProperty("price", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Price { get; set; }
/// <summary>供应商名称</summary>
[Newtonsoft.Json.JsonProperty("supplierName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierName { get; set; }
/// <summary>商品标题</summary>
[Newtonsoft.Json.JsonProperty("subject", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Subject { get; set; }
/// <summary>物料编码</summary>
[Newtonsoft.Json.JsonProperty("materialCode", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MaterialCode { get; set; }
/// <summary>offerId</summary>
[Newtonsoft.Json.JsonProperty("offerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OfferId { get; set; }
[Newtonsoft.Json.JsonProperty("priceRangeList", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public PriceRangeList2 PriceRangeList { get; set; } = new PriceRangeList2();
}
/// <summary>订单消息-1688订单售中退款(卖家视角)
/// https://open.1688.com/doc/topicDetail.htm?id=ORDER_ORDER_BUYER_REFUND_IN_SALES&topicGroup=ORDER</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ORDER_BUYER_REFUND_IN_SALES
{
/// <summary>订单ID</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderId { get; set; }
/// <summary>当前订单状态</summary>
[Newtonsoft.Json.JsonProperty("currentStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string CurrentStatus { get; set; }
/// <summary>消息发送时间</summary>
[Newtonsoft.Json.JsonProperty("msgSendTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MsgSendTime { get; set; }
/// <summary>买家中文站会员ID</summary>
[Newtonsoft.Json.JsonProperty("buyerMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BuyerMemberId { get; set; }
/// <summary>退款操作,具体状态为:BUYER_APPLY_REFUND(买家申请退款)、BUYER_RECEIVE_CLOSE(买家确认收货关闭)、SELLER_SEND_GOODS_CLOSE(卖家发货关闭)、BUYER_CANCEL_REFUND_CLOSE(买家撤销退款申请关闭)、BUYER_UPLOAD_BILL(买家上传凭证)、SELLER_UPLOAD_BILL(卖家上传凭证)、SELLER_REJECT_REFUND(卖家拒绝退款)、SELLER_AGREE_REFUND(卖家同意退款)、SELLER_RECEIVE_GOODS(卖家确认收货)、BUYER_SEND_GOODS(买家声明发货)、BUYER_MODIFY_REFUND_PROTOCOL(买家修改退款协议)、BUYER_APPLY_SUPPORT(买家申请客服介入)、SELLER_APPLY_SUPPORT(卖家申请客服介入)、SYSTEM_AGREE_REFUND_PROTOCOL(系统超时同意退款协议)、SYSTEM_AGREE_REFUND(系统超时同意退款,即退款成功)、SYSTEM_SEND_GOODS(系统超时退货,主交易流程的退货)、SYSTEM_MODIFY_REFUND_PROTOCOL(系统超时修改协议)、SYSTEM_NOTIFY_APPLY_SUPPORT(系统通知申请客服介入)、SELLER_AGREE_REFUND_PROCOTOL(卖家同意退款协议)、 SELLER_REJECT_REFUND_PROCOTOL(卖家拒绝退款协议)、 CRM_APPLY_TIMEOUT_CLOSE(申请客服介入、超时关闭、目前仅售后业务在用)、CRM_APPLY_SUPPORT(CRM申请介入)、 CRM_INTERVENE_TASK(CRM介入处理)、 CRM_DISMISS_TASK(CRM撤销工单)、 CRM_FINISH_TASK(CRM完结工单)、BUYER_STEP_PAY_ORDER_CLOSE(买家支付,退款关闭,分阶段订单情况)、BUYER_STEP_CONFIRM_CLOSE(买家确认,退款关闭,分阶段订单情况)、BUYER_CLOSE_TRADE_CLOSE(买家终止交易,退款关闭,分阶段订单情况)、SELLER_CONFIRM_ORDER_CLOSE(卖家确认,退款关闭,分阶段订单情况)、SELLER_STEP_PUSH_CLOSE(卖家推进,退款关闭,分阶段订单情况)</summary>
[Newtonsoft.Json.JsonProperty("refundAction", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string RefundAction { get; set; }
/// <summary>操作的发起人,buyer(买家),seller(卖家),system(系统)</summary>
[Newtonsoft.Json.JsonProperty("operator", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Operator { get; set; }
/// <summary>退款单ID</summary>
[Newtonsoft.Json.JsonProperty("refundId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string RefundId { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_ORDER_REFUND_AFTER_SALES : ORDER_ORDER_BUYER_REFUND_IN_SALES
{
}
/// <summary>采购消息-采购商请购单创建成功消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_BUYER_REQUISITION_CREATE_SUCCESS&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYER_REQUISITION_CREATE_SUCCESS
{
/// <summary>请购单标题</summary>
[Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Title { get; set; }
/// <summary>提交请购人子账号</summary>
[Newtonsoft.Json.JsonProperty("createLoginId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string CreateLoginId { get; set; }
/// <summary>请购单号</summary>
[Newtonsoft.Json.JsonProperty("requisitionNo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string RequisitionNo { get; set; }
/// <summary>请购单Id</summary>
[Newtonsoft.Json.JsonProperty("requisitionId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long RequisitionId { get; set; }
}
/// <summary>商品消息-商品发布结果消息同步
/// https://open.1688.com/doc/topicDetail.htm?id=PRODUCT_PRODUCT_CREATE_RESULT&topicGroup=PRODUCT</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_PRODUCT_CREATE_RESULT
{
/// <summary>货号</summary>
[Newtonsoft.Json.JsonProperty("cargoNum", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CargoNum { get; set; }
/// <summary>是否成功铺货</summary>
[Newtonsoft.Json.JsonProperty("isSuccess", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool IsSuccess { get; set; }
/// <summary>CBU商品ID</summary>
[Newtonsoft.Json.JsonProperty("offerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OfferId { get; set; }
/// <summary>巴拿马ID</summary>
[Newtonsoft.Json.JsonProperty("requestId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long RequestId { get; set; }
/// <summary>错误码</summary>
[Newtonsoft.Json.JsonProperty("errorCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ErrorCode { get; set; }
/// <summary>外部商品ID</summary>
[Newtonsoft.Json.JsonProperty("srcGoodId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SrcGoodId { get; set; }
}
/// <summary>采购消息-采购单取消
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PURCHASE_ORDER_CANCEL&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PURCHASE_ORDER_CANCEL
{
/// <summary>采购单id</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>采购单标题</summary>
[Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Title { get; set; }
/// <summary>采购单状态</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Status { get; set; }
}
/// <summary>商品消息-一键铺货消息
/// https://open.1688.com/doc/topicDetail.htm?id=PRODUCT_PRODUCT_CROSSBOARD_INFORM&topicGroup=PRODUCT</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_PRODUCT_CROSSBOARD_INFORM
{
/// <summary>商品ID</summary>
[Newtonsoft.Json.JsonProperty("offerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string OfferId { get; set; }
/// <summary>分销商CBU的会员ID</summary>
[Newtonsoft.Json.JsonProperty("userInfo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string UserInfo { get; set; }
/// <summary>执行动作,值为distribution</summary>
[Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Action { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_TRADE_RECEIVE_NOTE_CREATE : CAIGOU_MSG_PURCHARSE_ORDER_CREATE_DONE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_TRADE_RECEIVE_NOTE_CLOSE : CAIGOU_MSG_PURCHARSE_ORDER_CREATE_DONE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_TRADE_RECEIVE_NOTE_AGREE : CAIGOU_MSG_PURCHARSE_ORDER_CREATE_DONE
{
}
/// <summary>采购消息-创建采购订单
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PROCUREMENT_ORDER_CREATED&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_ORDER_CREATED
{
/// <summary>采购订单ID</summary>
[Newtonsoft.Json.JsonProperty("procurementOrderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long ProcurementOrderId { get; set; }
/// <summary>操作类型,create新建,update更新</summary>
[Newtonsoft.Json.JsonProperty("opMsgType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string OpMsgType { get; set; }
}
/// <summary>跨境消息-跨境设为货源
/// https://open.1688.com/doc/topicDetail.htm?id=CROSSBOARD_CROSSBOARD_ADD_SUPPLY&topicGroup=CROSSBOARD</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CROSSBOARD_CROSSBOARD_ADD_SUPPLY
{
/// <summary>1688商品ID</summary>
[Newtonsoft.Json.JsonProperty("offerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string OfferId { get; set; }
/// <summary>ISV中的用户ID</summary>
[Newtonsoft.Json.JsonProperty("clientId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ClientId { get; set; }
/// <summary>ISV中的商品ID</summary>
[Newtonsoft.Json.JsonProperty("productId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ProductId { get; set; }
/// <summary>ISV中的商品URL</summary>
[Newtonsoft.Json.JsonProperty("productUri", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ProductUri { get; set; }
}
/// <summary>采购消息-更新框架协议状态
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_FRAMEWORK_AGREEMENT_STATUS_UPDATE&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_FRAMEWORK_AGREEMENT_STATUS_UPDATE
{
/// <summary>主键ID</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>框架协议标题</summary>
[Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Title { get; set; }
/// <summary>框架协议编号</summary>
[Newtonsoft.Json.JsonProperty("frameworkAgreementNum", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string FrameworkAgreementNum { get; set; }
/// <summary>创建时间</summary>
[Newtonsoft.Json.JsonProperty("gmtCreate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string GmtCreate { get; set; }
/// <summary>协议状态,包括wait_approval:审批中,approved:审批通过未生效,effective:已生效,dismissed:已驳回,freezing:已冻结,expired:已到期,completed:已完成,terminated:终止,deleted:删除</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Status { get; set; }
}
/// <summary>采购消息-创建框架协议
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_FRAMEWORK_AGREEMENT_CREATE&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_FRAMEWORK_AGREEMENT_CREATE
{
/// <summary>框架协议主键ID</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>创建时间</summary>
[Newtonsoft.Json.JsonProperty("gmtCreate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string GmtCreate { get; set; }
/// <summary>框架协议标题</summary>
[Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Title { get; set; }
/// <summary>框架协议编号</summary>
[Newtonsoft.Json.JsonProperty("frameworkAgreementNum", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string FrameworkAgreementNum { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_ORDER_STATUS_UPDATE : CAIGOU_MSG_PROCUREMENT_ORDER_CREATED
{
}
/// <summary>采购消息-创建结算单
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_SETTLEMENT_ORDER_CREATE&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_SETTLEMENT_ORDER_CREATE
{
/// <summary>结算单Id</summary>
[Newtonsoft.Json.JsonProperty("settlementId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SettlementId { get; set; }
}
/// <summary>订单消息-1688订单售中退款(买家视角)
/// https://open.1688.com/doc/topicDetail.htm?id=ORDER_BUYER_VIEW_ORDER_BUYER_REFUND_IN_SALES&topicGroup=ORDER</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_BUYER_REFUND_IN_SALES
{
/// <summary>订单ID</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderId { get; set; }
/// <summary>当前订单状态</summary>
[Newtonsoft.Json.JsonProperty("currentStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string CurrentStatus { get; set; }
/// <summary>消息发送时间</summary>
[Newtonsoft.Json.JsonProperty("msgSendTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MsgSendTime { get; set; }
/// <summary>买家中文站会员ID</summary>
[Newtonsoft.Json.JsonProperty("buyerMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BuyerMemberId { get; set; }
/// <summary>退款操作,具体状态为:BUYER_APPLY_REFUND(买家申请退款)、BUYER_RECEIVE_CLOSE(买家确认收货关闭)、SELLER_SEND_GOODS_CLOSE(卖家发货关闭)、BUYER_CANCEL_REFUND_CLOSE(买家撤销退款申请关闭)、BUYER_UPLOAD_BILL(买家上传凭证)、SELLER_UPLOAD_BILL(卖家上传凭证)、SELLER_REJECT_REFUND(卖家拒绝退款)、SELLER_AGREE_REFUND(卖家同意退款)、SELLER_RECEIVE_GOODS(卖家确认收货)、BUYER_SEND_GOODS(买家声明发货)、BUYER_MODIFY_REFUND_PROTOCOL(买家修改退款协议)、BUYER_APPLY_SUPPORT(买家申请客服介入)、SELLER_APPLY_SUPPORT(卖家申请客服介入)、SYSTEM_AGREE_REFUND_PROTOCOL(系统超时同意退款协议)、SYSTEM_AGREE_REFUND(系统超时同意退款,即退款成功)、SYSTEM_SEND_GOODS(系统超时退货,主交易流程的退货)、SYSTEM_MODIFY_REFUND_PROTOCOL(系统超时修改协议)、SYSTEM_NOTIFY_APPLY_SUPPORT(系统通知申请客服介入)、SELLER_AGREE_REFUND_PROCOTOL(卖家同意退款协议)、 SELLER_REJECT_REFUND_PROCOTOL(卖家拒绝退款协议)、 CRM_APPLY_TIMEOUT_CLOSE(申请客服介入、超时关闭、目前仅售后业务在用)、CRM_APPLY_SUPPORT(CRM申请介入)、 CRM_INTERVENE_TASK(CRM介入处理)、 CRM_DISMISS_TASK(CRM撤销工单)、 CRM_FINISH_TASK(CRM完结工单)、BUYER_STEP_PAY_ORDER_CLOSE(买家支付,退款关闭,分阶段订单情况)、BUYER_STEP_CONFIRM_CLOSE(买家确认,退款关闭,分阶段订单情况)、BUYER_CLOSE_TRADE_CLOSE(买家终止交易,退款关闭,分阶段订单情况)、SELLER_CONFIRM_ORDER_CLOSE(卖家确认,退款关闭,分阶段订单情况)、SELLER_STEP_PUSH_CLOSE(卖家推进,退款关闭,分阶段订单情况)</summary>
[Newtonsoft.Json.JsonProperty("refundAction", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string RefundAction { get; set; }
/// <summary>操作的发起人,buyer(买家),seller(卖家),system(系统)</summary>
[Newtonsoft.Json.JsonProperty("operator", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Operator { get; set; }
/// <summary>卖家中文站会员ID</summary>
[Newtonsoft.Json.JsonProperty("sellerMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SellerMemberId { get; set; }
/// <summary>退款单ID</summary>
[Newtonsoft.Json.JsonProperty("refundId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string RefundId { get; set; }
}
/// <summary>授权消息-授权取消消息
/// https://open.1688.com/doc/topicDetail.htm?id=AUTHORIZATION_CANCEL&topicGroup=AUTHORIZATION</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class AUTHORIZATION_CANCEL
{
/// <summary>应用唯一标识</summary>
[Newtonsoft.Json.JsonProperty("appKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string AppKey { get; set; }
/// <summary>应用名</summary>
[Newtonsoft.Json.JsonProperty("appName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string AppName { get; set; }
/// <summary>应用所属ISV的userId</summary>
[Newtonsoft.Json.JsonProperty("isvUserId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? IsvUserId { get; set; }
/// <summary>授权用户登录名</summary>
[Newtonsoft.Json.JsonProperty("loginId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string LoginId { get; set; }
/// <summary>授权用户memberId,1688特有</summary>
[Newtonsoft.Json.JsonProperty("memberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MemberId { get; set; }
/// <summary>授权用户userId</summary>
[Newtonsoft.Json.JsonProperty("userId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long UserId { get; set; }
/// <summary>授权用户对应主账号的userId</summary>
[Newtonsoft.Json.JsonProperty("adminUserId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long AdminUserId { get; set; }
/// <summary>取消授权的时间</summary>
[Newtonsoft.Json.JsonProperty("timestamp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Timestamp { get; set; }
[Newtonsoft.Json.JsonProperty("reason", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public Reason Reason { get; set; } = new Reason();
}
/// <summary>订单消息-1688交易付款(买家视角)/1688 transaction payment (buyer view)
/// https://open.1688.com/doc/topicDetail.htm?id=ORDER_BUYER_VIEW_ORDER_PAY&topicGroup=ORDER</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_PAY
{
/// <summary>订单ID</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderId { get; set; }
/// <summary>当前订单状态,状态值为waitsellersend</summary>
[Newtonsoft.Json.JsonProperty("currentStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string CurrentStatus { get; set; }
/// <summary>消息发送时间</summary>
[Newtonsoft.Json.JsonProperty("msgSendTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string MsgSendTime { get; set; }
/// <summary>买家中文站会员ID</summary>
[Newtonsoft.Json.JsonProperty("buyerMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BuyerMemberId { get; set; }
/// <summary>卖家中文站会员ID</summary>
[Newtonsoft.Json.JsonProperty("sellerMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SellerMemberId { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_REFUND_AFTER_SALES : ORDER_BUYER_VIEW_ORDER_BUYER_REFUND_IN_SALES
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_BUYER_CLOSE : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_BOPS_CLOSE : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_BUYER_MAKE : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_STEP_PAY : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_PART_PART_SENDGOODS : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_PRICE_MODIFY : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ANNOUNCE_SENDGOODS : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_COMFIRM_RECEIVEGOODS : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_SUCCESS : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_ORDER_SELLER_CLOSE : ORDER_BUYER_VIEW_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_RELATION_VIEW_PRODUCT_NEW_OR_MODIFY : PRODUCT_PRODUCT_EXPIRE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_RELATION_VIEW_PRODUCT_DELETE : PRODUCT_PRODUCT_EXPIRE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_RELATION_VIEW_PRODUCT_REPOST : PRODUCT_PRODUCT_EXPIRE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_RELATION_VIEW_PRODUCT_EXPIRE : PRODUCT_PRODUCT_EXPIRE
{
}
/// <summary>服务市场消息-服务市场订单创建
/// https://open.1688.com/doc/topicDetail.htm?id=SERVICEMARKET_ORDER_CREATE&topicGroup=SERVICEMARKET</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class SERVICEMARKET_ORDER_CREATE
{
/// <summary>订单创建时间</summary>
[Newtonsoft.Json.JsonProperty("gmtCreate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long GmtCreate { get; set; }
/// <summary>订单号</summary>
[Newtonsoft.Json.JsonProperty("orderNo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string OrderNo { get; set; }
/// <summary>订单行号</summary>
[Newtonsoft.Json.JsonProperty("itemNo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ItemNo { get; set; }
/// <summary>产品线</summary>
[Newtonsoft.Json.JsonProperty("productLine", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ProductLine { get; set; }
/// <summary>appKey</summary>
[Newtonsoft.Json.JsonProperty("appKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string AppKey { get; set; }
/// <summary>原价</summary>
[Newtonsoft.Json.JsonProperty("basePrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long BasePrice { get; set; }
/// <summary>最终价</summary>
[Newtonsoft.Json.JsonProperty("ultimatePrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long UltimatePrice { get; set; }
/// <summary>执行价格</summary>
[Newtonsoft.Json.JsonProperty("executePrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long ExecutePrice { get; set; }
/// <summary>已支付价格</summary>
[Newtonsoft.Json.JsonProperty("paymentAmount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long PaymentAmount { get; set; }
/// <summary>未付款(payment_none)、已付款(payment_success)</summary>
[Newtonsoft.Json.JsonProperty("paymentStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string PaymentStatus { get; set; }
/// <summary>服务前(B)、服务中(S)、已结束(E)、已取消(C)</summary>
[Newtonsoft.Json.JsonProperty("bizStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BizStatus { get; set; }
/// <summary>支付人uerId</summary>
[Newtonsoft.Json.JsonProperty("payCustomerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long PayCustomerId { get; set; }
/// <summary>受益人userId</summary>
[Newtonsoft.Json.JsonProperty("benifitCustomerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long BenifitCustomerId { get; set; }
/// <summary>签约人userId(订购人)</summary>
[Newtonsoft.Json.JsonProperty("signCustomerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SignCustomerId { get; set; }
/// <summary>数量</summary>
[Newtonsoft.Json.JsonProperty("quantity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Quantity { get; set; }
/// <summary>单位:D天, M月, Y年, P份</summary>
[Newtonsoft.Json.JsonProperty("unit", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Unit { get; set; }
/// <summary>服务开始时间</summary>
[Newtonsoft.Json.JsonProperty("gmtServiceBegin", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? GmtServiceBegin { get; set; }
/// <summary>服务结束时间</summary>
[Newtonsoft.Json.JsonProperty("gmtServiceEnd", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? GmtServiceEnd { get; set; }
/// <summary>支付人memberId</summary>
[Newtonsoft.Json.JsonProperty("payMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string PayMemberId { get; set; }
/// <summary>受益人memberId</summary>
[Newtonsoft.Json.JsonProperty("benifitMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BenifitMemberId { get; set; }
/// <summary>签约人memberId(订购人)</summary>
[Newtonsoft.Json.JsonProperty("signMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SignMemberId { get; set; }
/// <summary>卖家userId</summary>
[Newtonsoft.Json.JsonProperty("sellerAliid", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SellerAliid { get; set; }
/// <summary>仅针对非APP类品消息有效,对于代运营和综合市场来说就是对应品的Id,对于商品详情来说就是对应模板的Id</summary>
[Newtonsoft.Json.JsonProperty("attachedAppKey", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string AttachedAppKey { get; set; }
/// <summary>版本名</summary>
[Newtonsoft.Json.JsonProperty("skuName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SkuName { get; set; }
/// <summary>版本号</summary>
[Newtonsoft.Json.JsonProperty("skuVersion", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SkuVersion { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class SERVICEMARKET_ORDER_CANCEL : SERVICEMARKET_ORDER_CREATE
{
}
/// <summary>服务市场消息-服务市场订单支付
/// https://open.1688.com/doc/topicDetail.htm?id=SERVICEMARKET_ORDER_PAY&topicGroup=SERVICEMARKET</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class SERVICEMARKET_ORDER_PAY
{
/// <summary>订单创建时间</summary>
[Newtonsoft.Json.JsonProperty("gmtCreate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long GmtCreate { get; set; }
/// <summary>订单号</summary>
[Newtonsoft.Json.JsonProperty("orderNo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string OrderNo { get; set; }
/// <summary>订单行号</summary>
[Newtonsoft.Json.JsonProperty("itemNo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ItemNo { get; set; }
/// <summary>产品线</summary>
[Newtonsoft.Json.JsonProperty("productLine", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ProductLine { get; set; }
/// <summary>appKey</summary>
[Newtonsoft.Json.JsonProperty("appKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string AppKey { get; set; }
/// <summary>原价</summary>
[Newtonsoft.Json.JsonProperty("basePrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long BasePrice { get; set; }
/// <summary>最终价</summary>
[Newtonsoft.Json.JsonProperty("ultimatePrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long UltimatePrice { get; set; }
/// <summary>执行价格</summary>
[Newtonsoft.Json.JsonProperty("executePrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long ExecutePrice { get; set; }
/// <summary>已支付价格</summary>
[Newtonsoft.Json.JsonProperty("paymentAmount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long PaymentAmount { get; set; }
/// <summary>未付款(payment_none)、已付款(payment_success)</summary>
[Newtonsoft.Json.JsonProperty("paymentStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string PaymentStatus { get; set; }
/// <summary>服务前(B)、服务中(S)、已结束(E)、已取消(C)</summary>
[Newtonsoft.Json.JsonProperty("bizStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BizStatus { get; set; }
/// <summary>支付人uerId</summary>
[Newtonsoft.Json.JsonProperty("payCustomerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long PayCustomerId { get; set; }
/// <summary>受益人userId</summary>
[Newtonsoft.Json.JsonProperty("benifitCustomerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long BenifitCustomerId { get; set; }
/// <summary>签约人userId(订购人)</summary>
[Newtonsoft.Json.JsonProperty("signCustomerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SignCustomerId { get; set; }
/// <summary>数量</summary>
[Newtonsoft.Json.JsonProperty("quantity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Quantity { get; set; }
/// <summary>单位:D天, M月, Y年, P份</summary>
[Newtonsoft.Json.JsonProperty("unit", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Unit { get; set; }
/// <summary>服务开始时间</summary>
[Newtonsoft.Json.JsonProperty("gmtServiceBegin", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? GmtServiceBegin { get; set; }
/// <summary>服务结束时间</summary>
[Newtonsoft.Json.JsonProperty("gmtServiceEnd", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? GmtServiceEnd { get; set; }
/// <summary>支付人memberId</summary>
[Newtonsoft.Json.JsonProperty("payMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string PayMemberId { get; set; }
/// <summary>受益人memberId</summary>
[Newtonsoft.Json.JsonProperty("benifitMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BenifitMemberId { get; set; }
/// <summary>签约人memberId(订购人)</summary>
[Newtonsoft.Json.JsonProperty("signMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SignMemberId { get; set; }
/// <summary>卖家userId</summary>
[Newtonsoft.Json.JsonProperty("sellerAliid", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SellerAliid { get; set; }
/// <summary>仅针对非APP类品消息有效,对于代运营和综合市场来说就是对应品的Id,对于商品详情来说就是对应模板的Id</summary>
[Newtonsoft.Json.JsonProperty("attachedAppKey", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string AttachedAppKey { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class SERVICEMARKET_ORDER_CLOSE : SERVICEMARKET_ORDER_PAY
{
}
/// <summary>采购消息-创建收货单成功消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PROCUREMENT_RECEIVEGOODS_ACTION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_RECEIVEGOODS_ACTION
{
/// <summary>收货单ID</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>发生动作,值:CREATE:创建;CANCEL:取消;EDIT:编辑;REJECT:拒绝(退回);CONFIRM:确认;</summary>
[Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Action { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class SERVICEMARKET_ORDER_CREATE_FAIL : SERVICEMARKET_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class SERVICEMARKET_ORDER_SERVICE_START : SERVICEMARKET_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class SERVICEMARKET_ORDER_SERVICE_END : SERVICEMARKET_ORDER_PAY
{
}
/// <summary>采购消息-采购商请购单驳回消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_REJECT_REQUISITION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_REJECT_REQUISITION
{
/// <summary>驳回内容</summary>
[Newtonsoft.Json.JsonProperty("msgItems", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public MsgItems MsgItems { get; set; } = new MsgItems();
}
/// <summary>采购消息-结算单动作消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PROCUREMENT_SETTLEMENT_ACTION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_SETTLEMENT_ACTION
{
/// <summary>当前结算单的动作,值:CREATE:创建;CANCEL:取消;EDIT:编辑;REJECT:拒绝(退回);CONFIRM:确认;</summary>
[Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Action { get; set; }
/// <summary>结算单ID</summary>
[Newtonsoft.Json.JsonProperty("settlementNoteId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SettlementNoteId { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_SEND_GOODS_ACTION : CAIGOU_MSG_PROCUREMENT_RECEIVEGOODS_ACTION
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class SERVICEMARKET_ORDER_SERVICE_REFUND : SERVICEMARKET_ORDER_PAY
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_RETURN_GOODS_ACTION : CAIGOU_MSG_PROCUREMENT_RECEIVEGOODS_ACTION
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_MODIFY_MEMO : ORDER_BUYER_MAKE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BUYER_VIEW_MODIFY_MEMO : ORDER_BUYER_VIEW_ORDER_PAY
{
}
/// <summary>采购消息-提交比价单消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PRICINGCHART_SUBMITTED&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PRICINGCHART_SUBMITTED
{
/// <summary>询价单id</summary>
[Newtonsoft.Json.JsonProperty("purchaseId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long PurchaseId { get; set; }
/// <summary>比价单id</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>提交比价单用户id</summary>
[Newtonsoft.Json.JsonProperty("userId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long UserId { get; set; }
}
/// <summary>采购消息-付款单动作消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PROCUREMENT_PAY_ACTION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_PAY_ACTION
{
/// <summary>动作 </summary>
[Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Action { get; set; }
/// <summary>状态</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Status { get; set; }
/// <summary>付款单主键 </summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
}
/// <summary>采购消息-订单执行中消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PROCUREMENT_ORDER_ACTION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_ORDER_ACTION
{
/// <summary>订单id</summary>
[Newtonsoft.Json.JsonProperty("procurementOrderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ProcurementOrderId { get; set; }
/// <summary>消息类型, 订单转为执行中消息 returnOrder 订单转为供应商退回消息</summary>
[Newtonsoft.Json.JsonProperty("opMsgType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string OpMsgType { get; set; }
/// <summary>消息具体内容,本消息为订单执行中消息订单id</summary>
[Newtonsoft.Json.JsonProperty("dataContent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string DataContent { get; set; }
}
/// <summary>采购消息-运输需求单动作消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PROCUREMENT_TRANSPORTDEMAND_ACTION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_TRANSPORTDEMAND_ACTION
{
/// <summary>当前运输需求单的动作</summary>
[Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Action { get; set; }
/// <summary>运输需求单ID</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>供应商memberId</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierMemberId { get; set; }
}
/// <summary>订单消息-1688订单批量支付状态同步消息
/// https://open.1688.com/doc/topicDetail.htm?id=ORDER_BATCH_PAY&topicGroup=ORDER</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_BATCH_PAY
{
[Newtonsoft.Json.JsonProperty("batchPay", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<BatchPay> BatchPay { get; set; } = new System.Collections.ObjectModel.Collection<BatchPay>();
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_RECEIVEGOODS_ACTION : CAIGOU_MSG_PROCUREMENT_RECEIVEGOODS_ACTION
{
}
/// <summary>采购消息-关闭采购订单消息(卖家视角)
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CLOSE_ORDER_ACTION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CLOSE_ORDER_ACTION
{
/// <summary>采购订单id</summary>
[Newtonsoft.Json.JsonProperty("procurementOrderId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? ProcurementOrderId { get; set; }
/// <summary>订单号</summary>
[Newtonsoft.Json.JsonProperty("orderCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OrderCode { get; set; }
}
/// <summary>商品消息-1688商品库存变更消息(关系用户视角)
/// https://open.1688.com/doc/topicDetail.htm?id=PRODUCT_PRODUCT_INVENTORY_CHANGE&topicGroup=PRODUCT</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_PRODUCT_INVENTORY_CHANGE
{
/// <summary>库存变更列表</summary>
[Newtonsoft.Json.JsonProperty("OfferInventoryChangeList", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<OfferInventoryChangeList> OfferInventoryChangeList { get; set; }
}
/// <summary>采购消息-创建采购订单消息(卖家视角)
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CREATE_ORDER_ACTION&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CREATE_ORDER_ACTION
{
/// <summary>采购订单id</summary>
[Newtonsoft.Json.JsonProperty("procurementOrderId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? ProcurementOrderId { get; set; }
/// <summary>订单号</summary>
[Newtonsoft.Json.JsonProperty("orderCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OrderCode { get; set; }
/// <summary>状态,wait_supplier_confirm:待供应商确认,approved:已生效</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Status { get; set; }
/// <summary>来源类型</summary>
[Newtonsoft.Json.JsonProperty("sourceType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SourceType { get; set; }
/// <summary>供应商memberId</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SupplierMemberId { get; set; }
/// <summary>供应商编码</summary>
[Newtonsoft.Json.JsonProperty("supplierCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SupplierCode { get; set; }
/// <summary>买家memberId</summary>
[Newtonsoft.Json.JsonProperty("buyerMemberId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string BuyerMemberId { get; set; }
/// <summary>创建者Id</summary>
[Newtonsoft.Json.JsonProperty("creatorUserId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? CreatorUserId { get; set; }
}
/// <summary>商品消息-商品池&超买价变更消息(关系用户视角)
/// https://open.1688.com/doc/topicDetail.htm?id=PRODUCT_RELATION_VIEW_EXIT_SUPERBUYER&topicGroup=PRODUCT</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_RELATION_VIEW_EXIT_SUPERBUYER
{
[Newtonsoft.Json.JsonProperty("products", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<Products> Products { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PRODUCT_RELATION_VIEW_PRODUCT_AUDIT : PRODUCT_PRODUCT_EXPIRE
{
}
/// <summary>订单消息-社交拼团和C2M大店发货消息
/// https://open.1688.com/doc/topicDetail.htm?id=ORDER_GROUPON_ORDER_SUCCESS&topicGroup=ORDER</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ORDER_GROUPON_ORDER_SUCCESS
{
/// <summary>订单id</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? OrderId { get; set; }
/// <summary>团模板id</summary>
[Newtonsoft.Json.JsonProperty("templateId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? TemplateId { get; set; }
/// <summary>团id</summary>
[Newtonsoft.Json.JsonProperty("grouponId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? GrouponId { get; set; }
}
/// <summary>供应链消息-订单售中退款关闭(可以发货)
/// https://open.1688.com/doc/topicDetail.htm?id=ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES&topicGroup=ASCP</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES
{
/// <summary>供应商ID</summary>
[Newtonsoft.Json.JsonProperty("supplierId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierId { get; set; }
/// <summary>交易主订单ID列表</summary>
[Newtonsoft.Json.JsonProperty("bizOrderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<string> BizOrderId { get; set; } = new System.Collections.ObjectModel.Collection<string>();
}
/// <summary>物流消息-物流单状态变更(买家视角)
/// https://open.1688.com/doc/topicDetail.htm?id=LOGISTICS_BUYER_VIEW_TRACE&topicGroup=LOGISTICS</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class LOGISTICS_BUYER_VIEW_TRACE
{
[Newtonsoft.Json.JsonProperty("OrderLogisticsTracingModel", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public OrderLogisticsTracingModel OrderLogisticsTracingModel { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class LOGISTICS_SELLER_VIEW_TRACE : LOGISTICS_BUYER_VIEW_TRACE
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ASCP_ASCP_ORDER_PAY : ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ASCP_ASCP_ORDER_ANNOUNCE_SENDGOODS : ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ASCP_ASCP_ORDER_BUYER_REFUND_APPLY_IN_SALES : ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES
{
}
/// <summary>物流消息-物流单号修改消息
/// https://open.1688.com/doc/topicDetail.htm?id=LOGISTICS_MAIL_NO_CHANGE&topicGroup=LOGISTICS</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class LOGISTICS_MAIL_NO_CHANGE
{
[Newtonsoft.Json.JsonProperty("MailNoChangeModel", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public MailNoChangeModel MailNoChangeModel { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ASCP_ASCP_ORDER_BUYER_REFUND_SUCCESS : ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ASCP_ASCP_ORDER_SUCCESS : ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES
{
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ASCP_ASCP_ORDER_COMFIRM_RECEIVEGOODS : ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES
{
}
/// <summary>采购消息-终止交易结果消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PROCUREMENT_TERMINATE_ORDER_RESULT&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_TERMINATE_ORDER_RESULT
{
/// <summary>终止交易结果数据</summary>
[Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public Data Data { get; set; }
/// <summary>终止交易结果布尔值</summary>
[Newtonsoft.Json.JsonProperty("success", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool? Success { get; set; }
/// <summary>异常情况下,错误信息</summary>
[Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Message { get; set; }
/// <summary>异常情况下,错误代码</summary>
[Newtonsoft.Json.JsonProperty("resultCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ResultCode { get; set; }
}
/// <summary>采购消息-采购买家供应商准入
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_PROCUREMENT_SLC_ADMIT_STATUS_UPDATE&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_PROCUREMENT_SLC_ADMIT_STATUS_UPDATE
{
/// <summary>供应商memberId</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierMemberId { get; set; }
/// <summary>准入申请单id</summary>
[Newtonsoft.Json.JsonProperty("admitId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long AdmitId { get; set; }
/// <summary>供应商loginId</summary>
[Newtonsoft.Json.JsonProperty("supplierLoginId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierLoginId { get; set; }
/// <summary>供应商公司名称</summary>
[Newtonsoft.Json.JsonProperty("companyName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string CompanyName { get; set; }
/// <summary>供应商记录id</summary>
[Newtonsoft.Json.JsonProperty("supplierBuyerId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? SupplierBuyerId { get; set; }
/// <summary>供应商准入记录操作</summary>
[Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Action { get; set; }
/// <summary>供应商准入申请审批单id</summary>
[Newtonsoft.Json.JsonProperty("auditApplyId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? AuditApplyId { get; set; }
/// <summary>供应商准入申请单当前状态</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Status { get; set; }
}
/// <summary>采购消息-企业采购审批结果消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_WORKFLOW_PROCESS_RESULT&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_WORKFLOW_PROCESS_RESULT
{
/// <summary>审批对应的业务流程,枚举值:requisition(请购审批)、buyoffer(询价审批)、decision(决标审批)、formalbidding(招标审批)、awardBidding(定标审批)、pricingchart(比价审批)</summary>
[Newtonsoft.Json.JsonProperty("bizType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BizType { get; set; }
/// <summary>审批结果,枚举值:pass(通过)、reject(拒绝)</summary>
[Newtonsoft.Json.JsonProperty("approvalResult", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ApprovalResult { get; set; }
/// <summary>审批对应的业务单据的阿里系统主键</summary>
[Newtonsoft.Json.JsonProperty("bizId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BizId { get; set; }
}
/// <summary>采购消息-发布审批中状态的询价单消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_BUYOFFER_PUBLISH_AUDIT&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_BUYOFFER_PUBLISH_AUDIT
{
/// <summary>业务类型,询价单</summary>
[Newtonsoft.Json.JsonProperty("bizType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BizType { get; set; }
/// <summary>询价单id</summary>
[Newtonsoft.Json.JsonProperty("bizId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string BizId { get; set; }
/// <summary>外部询价单id</summary>
[Newtonsoft.Json.JsonProperty("prId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string PrId { get; set; }
/// <summary>询价单当前的状态,例如审批中</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Status { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_SETTLEMENT_ACTION : CAIGOU_MSG_PROCUREMENT_SETTLEMENT_ACTION
{
}
/// <summary>采购消息-内部商城商品状态变化消息(卖家视角)
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_SELLER_VIEW_MSG_MALL_GOODS_STATUS_CHANGE&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_SELLER_VIEW_MSG_MALL_GOODS_STATUS_CHANGE
{
/// <summary>商品ID</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id { get; set; }
/// <summary>供应商名称</summary>
[Newtonsoft.Json.JsonProperty("supplierName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SupplierName { get; set; }
/// <summary>商品状态,new-未上架,published-已上架,deleted-已删除</summary>
[Newtonsoft.Json.JsonProperty("goodsStatus", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string GoodsStatus { get; set; }
/// <summary>商品标题</summary>
[Newtonsoft.Json.JsonProperty("subject", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Subject { get; set; }
}
/// <summary>采购消息-买家修改供应商消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_SLC_BUYER_SUPPLIER_UPDATE&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_SLC_BUYER_SUPPLIER_UPDATE
{
/// <summary>操作时间</summary>
[Newtonsoft.Json.JsonProperty("operateTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OperateTime { get; set; }
/// <summary>供应商memberId</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SupplierMemberId { get; set; }
/// <summary>供应商登陆id</summary>
[Newtonsoft.Json.JsonProperty("supplierLoginId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SupplierLoginId { get; set; }
/// <summary>供应商公司名</summary>
[Newtonsoft.Json.JsonProperty("companyName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CompanyName { get; set; }
/// <summary>供应商工商注册号</summary>
[Newtonsoft.Json.JsonProperty("companyRegNo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CompanyRegNo { get; set; }
/// <summary>供应商社会信用代码</summary>
[Newtonsoft.Json.JsonProperty("companyCreditCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CompanyCreditCode { get; set; }
/// <summary>主键id</summary>
[Newtonsoft.Json.JsonProperty("supplierBuyerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SupplierBuyerId { get; set; }
/// <summary>操作</summary>
[Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Action { get; set; }
/// <summary>操作人登陆di</summary>
[Newtonsoft.Json.JsonProperty("operatorLoginId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OperatorLoginId { get; set; }
/// <summary>操作人名称</summary>
[Newtonsoft.Json.JsonProperty("operatorName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OperatorName { get; set; }
}
/// <summary>采购消息-采购商请购单创建成功消息(卖家视角)
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_CREATE_SUCCESS&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_CREATE_SUCCESS
{
/// <summary>请购单标题</summary>
[Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Title { get; set; }
/// <summary>请购单号</summary>
[Newtonsoft.Json.JsonProperty("requisitionNo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string RequisitionNo { get; set; }
/// <summary>请购单Id</summary>
[Newtonsoft.Json.JsonProperty("requisitionId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long RequisitionId { get; set; }
}
/// <summary>采购消息-买家添加供应商消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_MSG_SLC_BUYER_SUPPLIER_ADD&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_SLC_BUYER_SUPPLIER_ADD
{
/// <summary>操作时间</summary>
[Newtonsoft.Json.JsonProperty("operateTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OperateTime { get; set; }
/// <summary>供应商memberId</summary>
[Newtonsoft.Json.JsonProperty("supplierMemberId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SupplierMemberId { get; set; }
/// <summary>供应商登陆id</summary>
[Newtonsoft.Json.JsonProperty("supplierLoginId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SupplierLoginId { get; set; }
/// <summary>供应商公司名</summary>
[Newtonsoft.Json.JsonProperty("companyName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CompanyName { get; set; }
/// <summary>供应商工商注册号</summary>
[Newtonsoft.Json.JsonProperty("companyRegNo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CompanyRegNo { get; set; }
/// <summary>供应商社会信用代码</summary>
[Newtonsoft.Json.JsonProperty("companyCreditCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CompanyCreditCode { get; set; }
/// <summary>记录主键id</summary>
[Newtonsoft.Json.JsonProperty("supplierBuyerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SupplierBuyerId { get; set; }
/// <summary>操作</summary>
[Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Action { get; set; }
/// <summary>供应商等级</summary>
[Newtonsoft.Json.JsonProperty("classify", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Classify { get; set; }
/// <summary>供应商等级名称</summary>
[Newtonsoft.Json.JsonProperty("classifyName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ClassifyName { get; set; }
/// <summary>操作人登陆id</summary>
[Newtonsoft.Json.JsonProperty("operatorLoginId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OperatorLoginId { get; set; }
/// <summary>操作人名称</summary>
[Newtonsoft.Json.JsonProperty("operatorName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OperatorName { get; set; }
}
/// <summary>采购消息-请购单审批全部驳回消息(卖家视角)
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_APPROVAL_REJECT&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_APPROVAL_REJECT
{
/// <summary>请购单ID</summary>
[Newtonsoft.Json.JsonProperty("requisitionId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? RequisitionId { get; set; }
}
/// <summary>旺旺消息-买家询盘消息
/// https://open.1688.com/doc/topicDetail.htm?id=WANG_BUYER_INQUIRY&topicGroup=WANG</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class WANG_BUYER_INQUIRY
{
/// <summary>旺旺消息id</summary>
[Newtonsoft.Json.JsonProperty("wwMsgId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string WwMsgId { get; set; }
/// <summary>旺旺消息标签列表,枚举值如下:价格相关,功能询问,加工定制,发货相关,售后问题,商品细节询问,实物真实性,广告,材质相关,正品确认,物流相关,现货相关,要联系方式,规格相关,质量相关,其他费用问题,商品链接,订单链接,其他</summary>
[Newtonsoft.Json.JsonProperty("wwMsgTags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<string> WwMsgTags { get; set; }
/// <summary>消息发送者loginId</summary>
[Newtonsoft.Json.JsonProperty("senderLoginId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SenderLoginId { get; set; }
/// <summary>买家等级(脱敏),B1(初级),B2(中级),B3(高级)</summary>
[Newtonsoft.Json.JsonProperty("userLevel", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string UserLevel { get; set; }
/// <summary>消息时间</summary>
[Newtonsoft.Json.JsonProperty("msgTime", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string MsgTime { get; set; }
/// <summary>消息接收者loginId</summary>
[Newtonsoft.Json.JsonProperty("receiverLoginId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ReceiverLoginId { get; set; }
/// <summary>消息接收者对应主账号loginId</summary>
[Newtonsoft.Json.JsonProperty("receiverAdminLoginId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ReceiverAdminLoginId { get; set; }
/// <summary>旺旺消息对应的业务场景</summary>
[Newtonsoft.Json.JsonProperty("scenario", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Scenario { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_MSG_SLC_BUYER_SUPPLIER_DELETE : CAIGOU_MSG_SLC_BUYER_SUPPLIER_UPDATE
{
}
/// <summary>采购消息-采购子订单取消消息
/// https://open.1688.com/doc/topicDetail.htm?id=CAIGOU_BUYER_VIEW_MSG_CANCEL_PROCUREMENT_ENTRY&topicGroup=CAIGOU</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CAIGOU_BUYER_VIEW_MSG_CANCEL_PROCUREMENT_ENTRY
{
/// <summary>采购订单id</summary>
[Newtonsoft.Json.JsonProperty("procurementOrderId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? ProcurementOrderId { get; set; }
/// <summary>子订单id集合</summary>
[Newtonsoft.Json.JsonProperty("procurementOrderEntryIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? ProcurementOrderEntryIds { get; set; }
/// <summary>采购订单编号</summary>
[Newtonsoft.Json.JsonProperty("orderCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OrderCode { get; set; }
}
/// <summary>消息类型</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public enum TypeDescription
{
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_PUBLISH_BUYOFFER")]
CAIGOU_MSG_BUYER_PUBLISH_BUYOFFER = 0,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_CANCEL_BUYOFFER")]
CAIGOU_MSG_BUYER_CANCEL_BUYOFFER = 1,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_SUPPLIER_QUOTATION")]
CAIGOU_MSG_SUPPLIER_QUOTATION = 2,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_SUPPLIER_CANCEL_QUOTATION")]
CAIGOU_MSG_SUPPLIER_CANCEL_QUOTATION = 3,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_MARK_QUOTATION")]
CAIGOU_MSG_BUYER_MARK_QUOTATION = 4,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_UNMARK_QUOTATION")]
CAIGOU_MSG_BUYER_UNMARK_QUOTATION = 5,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_MODIFY_BUYOFFER")]
CAIGOU_MSG_BUYER_MODIFY_BUYOFFER = 6,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_ORDERED")]
CAIGOU_MSG_BUYER_ORDERED = 7,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_CREATE_COOPERATEION")]
CAIGOU_MSG_CREATE_COOPERATEION = 8,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_TRADE_SUCCEED")]
CAIGOU_MSG_TRADE_SUCCEED = 9,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_CLOSE_ORDER")]
CAIGOU_MSG_CLOSE_ORDER = 10,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_SUPPLIER_APPLY")]
CAIGOU_MSG_SUPPLIER_APPLY = 11,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_PAYED_SUCCEED")]
CAIGOU_MSG_BUYER_PAYED_SUCCEED = 12,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_PUBLISH_PRODUCT")]
CAIGOU_MSG_BUYER_PUBLISH_PRODUCT = 13,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_MODIFIED_PRODUCT")]
CAIGOU_MSG_BUYER_MODIFIED_PRODUCT = 14,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_DELETE_PRODUCT_QUOTE")]
CAIGOU_MSG_BUYER_DELETE_PRODUCT_QUOTE = 15,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_DELETE_PRODUCT")]
CAIGOU_MSG_BUYER_DELETE_PRODUCT = 16,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_PUBLISH_PRODUCT_QUOTE")]
CAIGOU_MSG_BUYER_PUBLISH_PRODUCT_QUOTE = 17,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_MODIFIED_PRODUCT_QUOTE")]
CAIGOU_MSG_BUYER_MODIFIED_PRODUCT_QUOTE = 18,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_MAKE")]
ORDER_BUYER_MAKE = 19,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_PART_PART_SENDGOODS")]
ORDER_PART_PART_SENDGOODS = 20,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ORDER_PRICE_MODIFY")]
ORDER_ORDER_PRICE_MODIFY = 21,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ANNOUNCE_SENDGOODS")]
ORDER_ANNOUNCE_SENDGOODS = 22,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ORDER_SUCCESS")]
ORDER_ORDER_SUCCESS = 23,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_PAY")]
ORDER_PAY = 24,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ORDER_COMFIRM_RECEIVEGOODS")]
ORDER_ORDER_COMFIRM_RECEIVEGOODS = 25,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ORDER_BUYER_CLOSE")]
ORDER_ORDER_BUYER_CLOSE = 26,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ORDER_SELLER_CLOSE")]
ORDER_ORDER_SELLER_CLOSE = 27,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ORDER_BOPS_CLOSE")]
ORDER_ORDER_BOPS_CLOSE = 28,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ORDER_STEP_PAY")]
ORDER_ORDER_STEP_PAY = 29,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_PRODUCT_EXPIRE")]
PRODUCT_PRODUCT_EXPIRE = 30,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_PRODUCT_NEW_OR_MODIFY")]
PRODUCT_PRODUCT_NEW_OR_MODIFY = 31,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_PRODUCT_DELETE")]
PRODUCT_PRODUCT_DELETE = 32,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_PRODUCT_REPOST")]
PRODUCT_PRODUCT_REPOST = 33,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_SUPPLIER_SEND_GOODS")]
CAIGOU_MSG_SUPPLIER_SEND_GOODS = 34,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PURCHARSE_ORDER")]
CAIGOU_MSG_PURCHARSE_ORDER = 35,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_MALL_GOODS_STATUS_CHANGE")]
CAIGOU_MSG_MALL_GOODS_STATUS_CHANGE = 36,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_MALL_GOODS")]
CAIGOU_MSG_MALL_GOODS = 37,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PURCHARSE_ORDER_CREATE_DONE")]
CAIGOU_MSG_PURCHARSE_ORDER_CREATE_DONE = 38,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_MALL_GOODS_PRICE_CHANGE")]
CAIGOU_MSG_MALL_GOODS_PRICE_CHANGE = 39,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ORDER_BUYER_REFUND_IN_SALES")]
ORDER_ORDER_BUYER_REFUND_IN_SALES = 40,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_ORDER_REFUND_AFTER_SALES")]
ORDER_ORDER_REFUND_AFTER_SALES = 41,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYER_REQUISITION_CREATE_SUCCESS")]
CAIGOU_MSG_BUYER_REQUISITION_CREATE_SUCCESS = 42,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_PRODUCT_CREATE_RESULT")]
PRODUCT_PRODUCT_CREATE_RESULT = 43,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PURCHASE_ORDER_CANCEL")]
CAIGOU_MSG_PURCHASE_ORDER_CANCEL = 44,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_PRODUCT_CROSSBOARD_INFORM")]
PRODUCT_PRODUCT_CROSSBOARD_INFORM = 45,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_TRADE_RECEIVE_NOTE_CREATE")]
CAIGOU_MSG_TRADE_RECEIVE_NOTE_CREATE = 46,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_TRADE_RECEIVE_NOTE_CLOSE")]
CAIGOU_MSG_TRADE_RECEIVE_NOTE_CLOSE = 47,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_TRADE_RECEIVE_NOTE_AGREE")]
CAIGOU_MSG_TRADE_RECEIVE_NOTE_AGREE = 48,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_ORDER_CREATED")]
CAIGOU_MSG_PROCUREMENT_ORDER_CREATED = 49,
[System.Runtime.Serialization.EnumMember(Value = @"CROSSBOARD_CROSSBOARD_ADD_SUPPLY")]
CROSSBOARD_CROSSBOARD_ADD_SUPPLY = 50,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_FRAMEWORK_AGREEMENT_STATUS_UPDATE")]
CAIGOU_MSG_FRAMEWORK_AGREEMENT_STATUS_UPDATE = 51,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_FRAMEWORK_AGREEMENT_CREATE")]
CAIGOU_MSG_FRAMEWORK_AGREEMENT_CREATE = 52,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_ORDER_STATUS_UPDATE")]
CAIGOU_MSG_PROCUREMENT_ORDER_STATUS_UPDATE = 53,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_SETTLEMENT_ORDER_CREATE")]
CAIGOU_MSG_SETTLEMENT_ORDER_CREATE = 54,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_BUYER_REFUND_IN_SALES")]
ORDER_BUYER_VIEW_ORDER_BUYER_REFUND_IN_SALES = 55,
[System.Runtime.Serialization.EnumMember(Value = @"AUTHORIZATION_CANCEL")]
AUTHORIZATION_CANCEL = 56,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_PAY")]
ORDER_BUYER_VIEW_ORDER_PAY = 57,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_REFUND_AFTER_SALES")]
ORDER_BUYER_VIEW_ORDER_REFUND_AFTER_SALES = 58,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_BUYER_CLOSE")]
ORDER_BUYER_VIEW_ORDER_BUYER_CLOSE = 59,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_BOPS_CLOSE")]
ORDER_BUYER_VIEW_ORDER_BOPS_CLOSE = 60,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_BUYER_MAKE")]
ORDER_BUYER_VIEW_BUYER_MAKE = 61,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_STEP_PAY")]
ORDER_BUYER_VIEW_ORDER_STEP_PAY = 62,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_PART_PART_SENDGOODS")]
ORDER_BUYER_VIEW_PART_PART_SENDGOODS = 63,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_PRICE_MODIFY")]
ORDER_BUYER_VIEW_ORDER_PRICE_MODIFY = 64,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ANNOUNCE_SENDGOODS")]
ORDER_BUYER_VIEW_ANNOUNCE_SENDGOODS = 65,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_COMFIRM_RECEIVEGOODS")]
ORDER_BUYER_VIEW_ORDER_COMFIRM_RECEIVEGOODS = 66,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_SUCCESS")]
ORDER_BUYER_VIEW_ORDER_SUCCESS = 67,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_ORDER_SELLER_CLOSE")]
ORDER_BUYER_VIEW_ORDER_SELLER_CLOSE = 68,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_RELATION_VIEW_PRODUCT_NEW_OR_MODIFY")]
PRODUCT_RELATION_VIEW_PRODUCT_NEW_OR_MODIFY = 69,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_RELATION_VIEW_PRODUCT_DELETE")]
PRODUCT_RELATION_VIEW_PRODUCT_DELETE = 70,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_RELATION_VIEW_PRODUCT_REPOST")]
PRODUCT_RELATION_VIEW_PRODUCT_REPOST = 71,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_RELATION_VIEW_PRODUCT_EXPIRE")]
PRODUCT_RELATION_VIEW_PRODUCT_EXPIRE = 72,
[System.Runtime.Serialization.EnumMember(Value = @"SERVICEMARKET_ORDER_CREATE")]
SERVICEMARKET_ORDER_CREATE = 73,
[System.Runtime.Serialization.EnumMember(Value = @"SERVICEMARKET_ORDER_CANCEL")]
SERVICEMARKET_ORDER_CANCEL = 74,
[System.Runtime.Serialization.EnumMember(Value = @"SERVICEMARKET_ORDER_PAY")]
SERVICEMARKET_ORDER_PAY = 75,
[System.Runtime.Serialization.EnumMember(Value = @"SERVICEMARKET_ORDER_CLOSE")]
SERVICEMARKET_ORDER_CLOSE = 76,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_RECEIVEGOODS_ACTION")]
CAIGOU_MSG_PROCUREMENT_RECEIVEGOODS_ACTION = 77,
[System.Runtime.Serialization.EnumMember(Value = @"SERVICEMARKET_ORDER_CREATE_FAIL")]
SERVICEMARKET_ORDER_CREATE_FAIL = 78,
[System.Runtime.Serialization.EnumMember(Value = @"SERVICEMARKET_ORDER_SERVICE_START")]
SERVICEMARKET_ORDER_SERVICE_START = 79,
[System.Runtime.Serialization.EnumMember(Value = @"SERVICEMARKET_ORDER_SERVICE_END")]
SERVICEMARKET_ORDER_SERVICE_END = 80,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_REJECT_REQUISITION")]
CAIGOU_MSG_REJECT_REQUISITION = 81,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_SETTLEMENT_ACTION")]
CAIGOU_MSG_PROCUREMENT_SETTLEMENT_ACTION = 82,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_SEND_GOODS_ACTION")]
CAIGOU_MSG_PROCUREMENT_SEND_GOODS_ACTION = 83,
[System.Runtime.Serialization.EnumMember(Value = @"SERVICEMARKET_ORDER_SERVICE_REFUND")]
SERVICEMARKET_ORDER_SERVICE_REFUND = 84,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_RETURN_GOODS_ACTION")]
CAIGOU_MSG_PROCUREMENT_RETURN_GOODS_ACTION = 85,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_MODIFY_MEMO")]
ORDER_MODIFY_MEMO = 86,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BUYER_VIEW_MODIFY_MEMO")]
ORDER_BUYER_VIEW_MODIFY_MEMO = 87,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PRICINGCHART_SUBMITTED")]
CAIGOU_MSG_PRICINGCHART_SUBMITTED = 88,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_PAY_ACTION")]
CAIGOU_MSG_PROCUREMENT_PAY_ACTION = 89,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_ORDER_ACTION")]
CAIGOU_MSG_PROCUREMENT_ORDER_ACTION = 90,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_TRANSPORTDEMAND_ACTION")]
CAIGOU_MSG_PROCUREMENT_TRANSPORTDEMAND_ACTION = 91,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_BATCH_PAY")]
ORDER_BATCH_PAY = 92,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_RECEIVEGOODS_ACTION")]
CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_RECEIVEGOODS_ACTION = 93,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CLOSE_ORDER_ACTION")]
CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CLOSE_ORDER_ACTION = 94,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_PRODUCT_INVENTORY_CHANGE")]
PRODUCT_PRODUCT_INVENTORY_CHANGE = 95,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CREATE_ORDER_ACTION")]
CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CREATE_ORDER_ACTION = 96,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_RELATION_VIEW_EXIT_SUPERBUYER")]
PRODUCT_RELATION_VIEW_EXIT_SUPERBUYER = 97,
[System.Runtime.Serialization.EnumMember(Value = @"PRODUCT_RELATION_VIEW_PRODUCT_AUDIT")]
PRODUCT_RELATION_VIEW_PRODUCT_AUDIT = 98,
[System.Runtime.Serialization.EnumMember(Value = @"ORDER_GROUPON_ORDER_SUCCESS")]
ORDER_GROUPON_ORDER_SUCCESS = 99,
[System.Runtime.Serialization.EnumMember(Value = @"ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES")]
ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES = 100,
[System.Runtime.Serialization.EnumMember(Value = @"LOGISTICS_BUYER_VIEW_TRACE")]
LOGISTICS_BUYER_VIEW_TRACE = 101,
[System.Runtime.Serialization.EnumMember(Value = @"LOGISTICS_SELLER_VIEW_TRACE")]
LOGISTICS_SELLER_VIEW_TRACE = 102,
[System.Runtime.Serialization.EnumMember(Value = @"ASCP_ASCP_ORDER_PAY")]
ASCP_ASCP_ORDER_PAY = 103,
[System.Runtime.Serialization.EnumMember(Value = @"ASCP_ASCP_ORDER_ANNOUNCE_SENDGOODS")]
ASCP_ASCP_ORDER_ANNOUNCE_SENDGOODS = 104,
[System.Runtime.Serialization.EnumMember(Value = @"ASCP_ASCP_ORDER_BUYER_REFUND_APPLY_IN_SALES")]
ASCP_ASCP_ORDER_BUYER_REFUND_APPLY_IN_SALES = 105,
[System.Runtime.Serialization.EnumMember(Value = @"LOGISTICS_MAIL_NO_CHANGE")]
LOGISTICS_MAIL_NO_CHANGE = 106,
[System.Runtime.Serialization.EnumMember(Value = @"ASCP_ASCP_ORDER_BUYER_REFUND_SUCCESS")]
ASCP_ASCP_ORDER_BUYER_REFUND_SUCCESS = 107,
[System.Runtime.Serialization.EnumMember(Value = @"ASCP_ASCP_ORDER_SUCCESS")]
ASCP_ASCP_ORDER_SUCCESS = 108,
[System.Runtime.Serialization.EnumMember(Value = @"ASCP_ASCP_ORDER_COMFIRM_RECEIVEGOODS")]
ASCP_ASCP_ORDER_COMFIRM_RECEIVEGOODS = 109,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_TERMINATE_ORDER_RESULT")]
CAIGOU_MSG_PROCUREMENT_TERMINATE_ORDER_RESULT = 110,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_PROCUREMENT_SLC_ADMIT_STATUS_UPDATE")]
CAIGOU_MSG_PROCUREMENT_SLC_ADMIT_STATUS_UPDATE = 111,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_WORKFLOW_PROCESS_RESULT")]
CAIGOU_MSG_WORKFLOW_PROCESS_RESULT = 112,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_BUYOFFER_PUBLISH_AUDIT")]
CAIGOU_MSG_BUYOFFER_PUBLISH_AUDIT = 113,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_SETTLEMENT_ACTION")]
CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_SETTLEMENT_ACTION = 114,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_SELLER_VIEW_MSG_MALL_GOODS_STATUS_CHANGE")]
CAIGOU_SELLER_VIEW_MSG_MALL_GOODS_STATUS_CHANGE = 115,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_SLC_BUYER_SUPPLIER_UPDATE")]
CAIGOU_MSG_SLC_BUYER_SUPPLIER_UPDATE = 116,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_CREATE_SUCCESS")]
CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_CREATE_SUCCESS = 117,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_SLC_BUYER_SUPPLIER_ADD")]
CAIGOU_MSG_SLC_BUYER_SUPPLIER_ADD = 118,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_APPROVAL_REJECT")]
CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_APPROVAL_REJECT = 119,
[System.Runtime.Serialization.EnumMember(Value = @"WANG_BUYER_INQUIRY")]
WANG_BUYER_INQUIRY = 120,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_MSG_SLC_BUYER_SUPPLIER_DELETE")]
CAIGOU_MSG_SLC_BUYER_SUPPLIER_DELETE = 121,
[System.Runtime.Serialization.EnumMember(Value = @"CAIGOU_BUYER_VIEW_MSG_CANCEL_PROCUREMENT_ENTRY")]
CAIGOU_BUYER_VIEW_MSG_CANCEL_PROCUREMENT_ENTRY = 122,
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class TypeDescriptionJson
{
[Newtonsoft.Json.JsonProperty("JsonDescription", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string JsonDescription { get; set; } = "{\"CAIGOU_MSG_BUYER_PUBLISH_BUYOFFER\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u53d1\u5e03\u8be2\u4ef7\u6d88\u606f\",\"CAIGOU_MSG_BUYER_CANCEL_BUYOFFER\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u53d6\u6d88\u8be2\u4ef7\u6d88\u606f\",\"CAIGOU_MSG_SUPPLIER_QUOTATION\":\"\u91c7\u8d2d\u6d88\u606f-\u4f9b\u5e94\u5546\u53d1\u5e03\u62a5\u4ef7\u6d88\u606f\",\"CAIGOU_MSG_SUPPLIER_CANCEL_QUOTATION\":\"\u91c7\u8d2d\u6d88\u606f-\u4f9b\u5e94\u5546\u53d6\u6d88\u62a5\u4ef7\u6d88\u606f\",\"CAIGOU_MSG_BUYER_MARK_QUOTATION\":\"\u91c7\u8d2d\u6d88\u606f-\u4f9b\u5e94\u5546\u9009\u62e9\u5907\u9009\u62a5\u4ef7\u6d88\u606f\",\"CAIGOU_MSG_BUYER_UNMARK_QUOTATION\":\"\u91c7\u8d2d\u6d88\u606f-\u4f9b\u5e94\u5546\u64a4\u9500\u5907\u9009\u62a5\u4ef7\u6d88\u606f\",\"CAIGOU_MSG_BUYER_MODIFY_BUYOFFER\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u4fee\u6539\u8be2\u4ef7\u5355\u6d88\u606f\",\"CAIGOU_MSG_BUYER_ORDERED\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u4e0b\u5355\u6d88\u606f\",\"CAIGOU_MSG_CREATE_COOPERATEION\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u4e0e\u4f9b\u5e94\u5546\u5efa\u7acb\u5408\u4f5c\u5173\u7cfb\u6d88\u606f\",\"CAIGOU_MSG_TRADE_SUCCEED\":\"\u91c7\u8d2d\u6d88\u606f-\u4ea4\u6613\u6210\u529f\uff08\u8d26\u671f\u3001\u786e\u8ba4\u6536\u8d27\uff09\u6d88\u606f\",\"CAIGOU_MSG_CLOSE_ORDER\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u5173\u95ed\u4e0b\u5355\u6d88\u606f\",\"CAIGOU_MSG_SUPPLIER_APPLY\":\"\u91c7\u8d2d\u6d88\u606f-\u4f9b\u5e94\u5546\u7533\u8bf7\u6d88\u606f\",\"CAIGOU_MSG_BUYER_PAYED_SUCCEED\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u4ed8\u6b3e\u6210\u529f\u6d88\u606f\",\"CAIGOU_MSG_BUYER_PUBLISH_PRODUCT\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u53d1\u5e03\u7269\u6599\u6d88\u606f\",\"CAIGOU_MSG_BUYER_MODIFIED_PRODUCT\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u4fee\u6539\u7269\u6599\u4fe1\u606f\u6d88\u606f\",\"CAIGOU_MSG_BUYER_DELETE_PRODUCT_QUOTE\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u5220\u9664\u7269\u6599\u62a5\u4ef7\u6d88\u606f\",\"CAIGOU_MSG_BUYER_DELETE_PRODUCT\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u5220\u9664\u7269\u6599\u6d88\u606f\",\"CAIGOU_MSG_BUYER_PUBLISH_PRODUCT_QUOTE\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u53d1\u5e03\u7269\u6599\u62a5\u4ef7\u6d88\u606f\",\"CAIGOU_MSG_BUYER_MODIFIED_PRODUCT_QUOTE\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u4fee\u6539\u7269\u6599\u62a5\u4ef7\u6d88\u606f\",\"ORDER_BUYER_MAKE\":\"\u8ba2\u5355\u6d88\u606f-1688\u521b\u5efa\u8ba2\u5355\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_PART_PART_SENDGOODS\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u90e8\u5206\u53d1\u8d27\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_ORDER_PRICE_MODIFY\":\"\u8ba2\u5355\u6d88\u606f-1688\u4fee\u6539\u8ba2\u5355\u4ef7\u683c\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_ANNOUNCE_SENDGOODS\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u53d1\u8d27\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_ORDER_SUCCESS\":\"\u8ba2\u5355\u6d88\u606f-1688\u4ea4\u6613\u6210\u529f\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_PAY\":\"\u8ba2\u5355\u6d88\u606f-1688\u4ea4\u6613\u4ed8\u6b3e\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_ORDER_COMFIRM_RECEIVEGOODS\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u786e\u8ba4\u6536\u8d27\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_ORDER_BUYER_CLOSE\":\"\u8ba2\u5355\u6d88\u606f-1688\u4e70\u5bb6\u5173\u95ed\u8ba2\u5355\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_ORDER_SELLER_CLOSE\":\"\u8ba2\u5355\u6d88\u606f-1688\u5356\u5bb6\u5173\u95ed\u8ba2\u5355\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_ORDER_BOPS_CLOSE\":\"\u8ba2\u5355\u6d88\u606f-1688\u8fd0\u8425\u540e\u53f0\u5173\u95ed\u8ba2\u5355\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_ORDER_STEP_PAY\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u9636\u6bb5\u4ed8\u6b3e\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"PRODUCT_PRODUCT_EXPIRE\":\"\u5546\u54c1\u6d88\u606f-1688\u4ea7\u54c1\u4e0b\u67b6/merchandise off the shelf\",\"PRODUCT_PRODUCT_NEW_OR_MODIFY\":\"\u5546\u54c1\u6d88\u606f-1688\u4ea7\u54c1\u65b0\u589e\u6216\u4fee\u6539/merchandise adding or modification\",\"PRODUCT_PRODUCT_DELETE\":\"\u5546\u54c1\u6d88\u606f-1688\u4ea7\u54c1\u5220\u9664/merchandise removal\",\"PRODUCT_PRODUCT_REPOST\":\"\u5546\u54c1\u6d88\u606f-1688\u4ea7\u54c1\u4e0a\u67b6/new product listing\",\"CAIGOU_MSG_SUPPLIER_SEND_GOODS\":\"\u91c7\u8d2d\u6d88\u606f-\u4f9b\u5e94\u5546\u53d1\u8d27\",\"CAIGOU_MSG_PURCHARSE_ORDER\":\"\u91c7\u8d2d\u6d88\u606f-\u4f01\u4e1a\u91c7\u8d2d\u5355\",\"CAIGOU_MSG_MALL_GOODS_STATUS_CHANGE\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u54c1\u72b6\u6001\u53d8\u5316\",\"CAIGOU_MSG_MALL_GOODS\":\"\u91c7\u8d2d\u6d88\u606f-\u5546\u54c1\u53d8\u5316\u6d88\u606f\",\"CAIGOU_MSG_PURCHARSE_ORDER_CREATE_DONE\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5355\u521b\u5efa\u6210\u529f\",\"CAIGOU_MSG_MALL_GOODS_PRICE_CHANGE\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u54c1\u4ef7\u683c\u53d8\u5316\",\"ORDER_ORDER_BUYER_REFUND_IN_SALES\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u552e\u4e2d\u9000\u6b3e\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_ORDER_REFUND_AFTER_SALES\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u552e\u540e\u9000\u6b3e\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"CAIGOU_MSG_BUYER_REQUISITION_CREATE_SUCCESS\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u8bf7\u8d2d\u5355\u521b\u5efa\u6210\u529f\u6d88\u606f\",\"PRODUCT_PRODUCT_CREATE_RESULT\":\"\u5546\u54c1\u6d88\u606f-\u5546\u54c1\u53d1\u5e03\u7ed3\u679c\u6d88\u606f\u540c\u6b65\",\"CAIGOU_MSG_PURCHASE_ORDER_CANCEL\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5355\u53d6\u6d88\",\"PRODUCT_PRODUCT_CROSSBOARD_INFORM\":\"\u5546\u54c1\u6d88\u606f-\u4e00\u952e\u94fa\u8d27\u6d88\u606f\",\"CAIGOU_MSG_TRADE_RECEIVE_NOTE_CREATE\":\"\u91c7\u8d2d\u6d88\u606f-\u521b\u5efa\u6536\u8d27\u5355\",\"CAIGOU_MSG_TRADE_RECEIVE_NOTE_CLOSE\":\"\u91c7\u8d2d\u6d88\u606f-\u62d2\u7edd\u6536\u8d27\u5355\",\"CAIGOU_MSG_TRADE_RECEIVE_NOTE_AGREE\":\"\u91c7\u8d2d\u6d88\u606f-\u540c\u610f\u6536\u8d27\u5355\",\"CAIGOU_MSG_PROCUREMENT_ORDER_CREATED\":\"\u91c7\u8d2d\u6d88\u606f-\u521b\u5efa\u91c7\u8d2d\u8ba2\u5355\",\"CROSSBOARD_CROSSBOARD_ADD_SUPPLY\":\"\u8de8\u5883\u6d88\u606f-\u8de8\u5883\u8bbe\u4e3a\u8d27\u6e90\",\"CAIGOU_MSG_FRAMEWORK_AGREEMENT_STATUS_UPDATE\":\"\u91c7\u8d2d\u6d88\u606f-\u66f4\u65b0\u6846\u67b6\u534f\u8bae\u72b6\u6001\",\"CAIGOU_MSG_FRAMEWORK_AGREEMENT_CREATE\":\"\u91c7\u8d2d\u6d88\u606f-\u521b\u5efa\u6846\u67b6\u534f\u8bae\",\"CAIGOU_MSG_PROCUREMENT_ORDER_STATUS_UPDATE\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u8ba2\u5355\u72b6\u6001\u66f4\u65b0\",\"CAIGOU_MSG_SETTLEMENT_ORDER_CREATE\":\"\u91c7\u8d2d\u6d88\u606f-\u521b\u5efa\u7ed3\u7b97\u5355\",\"ORDER_BUYER_VIEW_ORDER_BUYER_REFUND_IN_SALES\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u552e\u4e2d\u9000\u6b3e\uff08\u4e70\u5bb6\u89c6\u89d2\uff09\",\"AUTHORIZATION_CANCEL\":\"\u6388\u6743\u6d88\u606f-\u6388\u6743\u53d6\u6d88\u6d88\u606f\",\"ORDER_BUYER_VIEW_ORDER_PAY\":\"\u8ba2\u5355\u6d88\u606f-1688\u4ea4\u6613\u4ed8\u6b3e\uff08\u4e70\u5bb6\u89c6\u89d2\uff09/1688 transaction payment (buyer view)\",\"ORDER_BUYER_VIEW_ORDER_REFUND_AFTER_SALES\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u552e\u540e\u9000\u6b3e\uff08\u4e70\u5bb6\u89c6\u89d2\uff09\",\"ORDER_BUYER_VIEW_ORDER_BUYER_CLOSE\":\"\u8ba2\u5355\u6d88\u606f-1688\u4e70\u5bb6\u5173\u95ed\u8ba2\u5355\uff08\u4e70\u5bb6\u89c6\u89d2\uff09/buyer closing order (buyer view)\",\"ORDER_BUYER_VIEW_ORDER_BOPS_CLOSE\":\"\u8ba2\u5355\u6d88\u606f-1688\u8fd0\u8425\u540e\u53f0\u5173\u95ed\u8ba2\u5355\uff08\u4e70\u5bb6\u89c6\u89d2\uff09\",\"ORDER_BUYER_VIEW_BUYER_MAKE\":\"\u8ba2\u5355\u6d88\u606f-1688\u521b\u5efa\u8ba2\u5355\uff08\u4e70\u5bb6\u89c6\u89d2\uff09/order created (buyer view)\",\"ORDER_BUYER_VIEW_ORDER_STEP_PAY\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u9636\u6bb5\u4ed8\u6b3e\uff08\u4e70\u5bb6\u89c6\u89d2\uff09\",\"ORDER_BUYER_VIEW_PART_PART_SENDGOODS\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u90e8\u5206\u53d1\u8d27\uff08\u4e70\u5bb6\u89c6\u89d2\uff09/Partial delivery of 1688 order (buyer view)\",\"ORDER_BUYER_VIEW_ORDER_PRICE_MODIFY\":\"\u8ba2\u5355\u6d88\u606f-1688\u4fee\u6539\u8ba2\u5355\u4ef7\u683c\uff08\u4e70\u5bb6\u89c6\u89d2\uff09/order price modification (buyer view)\",\"ORDER_BUYER_VIEW_ANNOUNCE_SENDGOODS\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u53d1\u8d27\uff08\u4e70\u5bb6\u89c6\u89d2\uff09/1688 order delivery (buyer view)\",\"ORDER_BUYER_VIEW_ORDER_COMFIRM_RECEIVEGOODS\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u786e\u8ba4\u6536\u8d27\uff08\u4e70\u5bb6\u89c6\u89d2\uff09/order receipt confirmation (buyer view)\",\"ORDER_BUYER_VIEW_ORDER_SUCCESS\":\"\u8ba2\u5355\u6d88\u606f-1688\u4ea4\u6613\u6210\u529f\uff08\u4e70\u5bb6\u89c6\u89d2\uff09\",\"ORDER_BUYER_VIEW_ORDER_SELLER_CLOSE\":\"\u8ba2\u5355\u6d88\u606f-1688\u5356\u5bb6\u5173\u95ed\u8ba2\u5355\uff08\u4e70\u5bb6\u89c6\u89d2\uff09/seller closing order (buyer view)\",\"PRODUCT_RELATION_VIEW_PRODUCT_NEW_OR_MODIFY\":\"\u5546\u54c1\u6d88\u606f-1688\u4ea7\u54c1\u65b0\u589e\u6216\u4fee\u6539\uff08\u5173\u7cfb\u7528\u6237\u89c6\u89d2\uff09\",\"PRODUCT_RELATION_VIEW_PRODUCT_DELETE\":\"\u5546\u54c1\u6d88\u606f-1688\u4ea7\u54c1\u5220\u9664\uff08\u5173\u7cfb\u7528\u6237\u89c6\u89d2\uff09\",\"PRODUCT_RELATION_VIEW_PRODUCT_REPOST\":\"\u5546\u54c1\u6d88\u606f-1688\u4ea7\u54c1\u4e0a\u67b6\uff08\u5173\u7cfb\u7528\u6237\u89c6\u89d2\uff09\",\"PRODUCT_RELATION_VIEW_PRODUCT_EXPIRE\":\"\u5546\u54c1\u6d88\u606f-1688\u4ea7\u54c1\u4e0b\u67b6\uff08\u5173\u7cfb\u7528\u6237\u89c6\u89d2\uff09\",\"SERVICEMARKET_ORDER_CREATE\":\"\u670d\u52a1\u5e02\u573a\u6d88\u606f-\u670d\u52a1\u5e02\u573a\u8ba2\u5355\u521b\u5efa\",\"SERVICEMARKET_ORDER_CANCEL\":\"\u670d\u52a1\u5e02\u573a\u6d88\u606f-\u670d\u52a1\u5e02\u573a\u8ba2\u5355\u53d6\u6d88\",\"SERVICEMARKET_ORDER_PAY\":\"\u670d\u52a1\u5e02\u573a\u6d88\u606f-\u670d\u52a1\u5e02\u573a\u8ba2\u5355\u652f\u4ed8\",\"SERVICEMARKET_ORDER_CLOSE\":\"\u670d\u52a1\u5e02\u573a\u6d88\u606f-\u670d\u52a1\u5e02\u573a\u8ba2\u5355\u5173\u95ed\",\"CAIGOU_MSG_PROCUREMENT_RECEIVEGOODS_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u521b\u5efa\u6536\u8d27\u5355\u6210\u529f\u6d88\u606f\",\"SERVICEMARKET_ORDER_CREATE_FAIL\":\"\u670d\u52a1\u5e02\u573a\u6d88\u606f-\u670d\u52a1\u5e02\u573a\u8ba2\u5355\u521b\u5efa\u5931\u8d25\",\"SERVICEMARKET_ORDER_SERVICE_START\":\"\u670d\u52a1\u5e02\u573a\u6d88\u606f-\u670d\u52a1\u5e02\u573a\u8ba2\u5355\u670d\u52a1\u5f00\u59cb\",\"SERVICEMARKET_ORDER_SERVICE_END\":\"\u670d\u52a1\u5e02\u573a\u6d88\u606f-\u670d\u52a1\u5e02\u573a\u8ba2\u5355\u670d\u52a1\u7ed3\u675f\",\"CAIGOU_MSG_REJECT_REQUISITION\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u8bf7\u8d2d\u5355\u9a73\u56de\u6d88\u606f\",\"CAIGOU_MSG_PROCUREMENT_SETTLEMENT_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u7ed3\u7b97\u5355\u52a8\u4f5c\u6d88\u606f\",\"CAIGOU_MSG_PROCUREMENT_SEND_GOODS_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u6267\u884c\u53d1\u8d27\u6d88\u606f\",\"SERVICEMARKET_ORDER_SERVICE_REFUND\":\"\u670d\u52a1\u5e02\u573a\u6d88\u606f-\u670d\u52a1\u5e02\u573a\u8ba2\u5355\u9000\u6b3e\",\"CAIGOU_MSG_PROCUREMENT_RETURN_GOODS_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u9000\u8d27\u5355\u52a8\u4f5c\u6d88\u606f\",\"ORDER_MODIFY_MEMO\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u5907\u6ce8\u4fee\u6539\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ORDER_BUYER_VIEW_MODIFY_MEMO\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u5907\u6ce8\u4fee\u6539\uff08\u4e70\u5bb6\u89c6\u89d2\uff09/order remarks modification (buyer view)\",\"CAIGOU_MSG_PRICINGCHART_SUBMITTED\":\"\u91c7\u8d2d\u6d88\u606f-\u63d0\u4ea4\u6bd4\u4ef7\u5355\u6d88\u606f\",\"CAIGOU_MSG_PROCUREMENT_PAY_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u4ed8\u6b3e\u5355\u52a8\u4f5c\u6d88\u606f\",\"CAIGOU_MSG_PROCUREMENT_ORDER_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u8ba2\u5355\u6267\u884c\u4e2d\u6d88\u606f \",\"CAIGOU_MSG_PROCUREMENT_TRANSPORTDEMAND_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u8fd0\u8f93\u9700\u6c42\u5355\u52a8\u4f5c\u6d88\u606f\",\"ORDER_BATCH_PAY\":\"\u8ba2\u5355\u6d88\u606f-1688\u8ba2\u5355\u6279\u91cf\u652f\u4ed8\u72b6\u6001\u540c\u6b65\u6d88\u606f\",\"CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_RECEIVEGOODS_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u521b\u5efa\u6536\u8d27\u5355\u6210\u529f\u6d88\u606f\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CLOSE_ORDER_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u5173\u95ed\u91c7\u8d2d\u8ba2\u5355\u6d88\u606f\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"PRODUCT_PRODUCT_INVENTORY_CHANGE\":\"\u5546\u54c1\u6d88\u606f-1688\u5546\u54c1\u5e93\u5b58\u53d8\u66f4\u6d88\u606f\uff08\u5173\u7cfb\u7528\u6237\u89c6\u89d2\uff09\",\"CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_CREATE_ORDER_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u521b\u5efa\u91c7\u8d2d\u8ba2\u5355\u6d88\u606f\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"PRODUCT_RELATION_VIEW_EXIT_SUPERBUYER\":\"\u5546\u54c1\u6d88\u606f-\u5546\u54c1\u6c60&\u8d85\u4e70\u4ef7\u53d8\u66f4\u6d88\u606f\uff08\u5173\u7cfb\u7528\u6237\u89c6\u89d2\uff09\",\"PRODUCT_RELATION_VIEW_PRODUCT_AUDIT\":\"\u5546\u54c1\u6d88\u606f-1688\u4ea7\u54c1\u5ba1\u6838\u4e0b\u67b6\uff08\u5173\u7cfb\u7528\u6237\u89c6\u89d2\uff09\",\"ORDER_GROUPON_ORDER_SUCCESS\":\"\u8ba2\u5355\u6d88\u606f-\u793e\u4ea4\u62fc\u56e2\u548cC2M\u5927\u5e97\u53d1\u8d27\u6d88\u606f\",\"ASCP_ASCP_ORDER_BUYER_REFUND_CLOSED_IN_SALES\":\"\u4f9b\u5e94\u94fe\u6d88\u606f-\u8ba2\u5355\u552e\u4e2d\u9000\u6b3e\u5173\u95ed\uff08\u53ef\u4ee5\u53d1\u8d27\uff09\",\"LOGISTICS_BUYER_VIEW_TRACE\":\"\u7269\u6d41\u6d88\u606f-\u7269\u6d41\u5355\u72b6\u6001\u53d8\u66f4\uff08\u4e70\u5bb6\u89c6\u89d2\uff09\",\"LOGISTICS_SELLER_VIEW_TRACE\":\"\u7269\u6d41\u6d88\u606f-\u7269\u6d41\u5355\u72b6\u6001\u53d8\u66f4\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"ASCP_ASCP_ORDER_PAY\":\"\u4f9b\u5e94\u94fe\u6d88\u606f-\u4ea4\u6613\u4ed8\u6b3e\uff08\u5f85\u53d1\u8d27\uff09\",\"ASCP_ASCP_ORDER_ANNOUNCE_SENDGOODS\":\"\u4f9b\u5e94\u94fe\u6d88\u606f-\u8ba2\u5355\u53d1\u8d27\uff08\u5305\u62ec\u90e8\u5206\u53d1\u8d27\uff09\",\"ASCP_ASCP_ORDER_BUYER_REFUND_APPLY_IN_SALES\":\"\u4f9b\u5e94\u94fe\u6d88\u606f-\u8ba2\u5355\u552e\u4e2d\u9000\u6b3e\u7533\u8bf7\uff08\u53d6\u6d88\u53d1\u8d27\uff09\",\"LOGISTICS_MAIL_NO_CHANGE\":\"\u7269\u6d41\u6d88\u606f-\u7269\u6d41\u5355\u53f7\u4fee\u6539\u6d88\u606f\",\"ASCP_ASCP_ORDER_BUYER_REFUND_SUCCESS\":\"\u4f9b\u5e94\u94fe\u6d88\u606f-\u8ba2\u5355\u552e\u4e2d\u9000\u6b3e\u5b8c\u6210\uff08\u53d6\u6d88\u6210\u529f\uff09\",\"ASCP_ASCP_ORDER_SUCCESS\":\"\u4f9b\u5e94\u94fe\u6d88\u606f-\u4ea4\u6613\u6210\u529f\u6d88\u606f\",\"ASCP_ASCP_ORDER_COMFIRM_RECEIVEGOODS\":\"\u4f9b\u5e94\u94fe\u6d88\u606f-\u8ba2\u5355\u786e\u8ba4\u6536\u8d27\",\"CAIGOU_MSG_PROCUREMENT_TERMINATE_ORDER_RESULT\":\"\u91c7\u8d2d\u6d88\u606f-\u7ec8\u6b62\u4ea4\u6613\u7ed3\u679c\u6d88\u606f\",\"CAIGOU_MSG_PROCUREMENT_SLC_ADMIT_STATUS_UPDATE\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u4e70\u5bb6\u4f9b\u5e94\u5546\u51c6\u5165\",\"CAIGOU_MSG_WORKFLOW_PROCESS_RESULT\":\"\u91c7\u8d2d\u6d88\u606f-\u4f01\u4e1a\u91c7\u8d2d\u5ba1\u6279\u7ed3\u679c\u6d88\u606f\",\"CAIGOU_MSG_BUYOFFER_PUBLISH_AUDIT\":\"\u91c7\u8d2d\u6d88\u606f-\u53d1\u5e03\u5ba1\u6279\u4e2d\u72b6\u6001\u7684\u8be2\u4ef7\u5355\u6d88\u606f\",\"CAIGOU_SELLER_VIEW_MSG_PROCUREMENT_SETTLEMENT_ACTION\":\"\u91c7\u8d2d\u6d88\u606f-\u7ed3\u7b97\u5355\u52a8\u4f5c\u6d88\u606f\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"CAIGOU_SELLER_VIEW_MSG_MALL_GOODS_STATUS_CHANGE\":\"\u91c7\u8d2d\u6d88\u606f-\u5185\u90e8\u5546\u57ce\u5546\u54c1\u72b6\u6001\u53d8\u5316\u6d88\u606f\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"CAIGOU_MSG_SLC_BUYER_SUPPLIER_UPDATE\":\"\u91c7\u8d2d\u6d88\u606f-\u4e70\u5bb6\u4fee\u6539\u4f9b\u5e94\u5546\u6d88\u606f\",\"CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_CREATE_SUCCESS\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5546\u8bf7\u8d2d\u5355\u521b\u5efa\u6210\u529f\u6d88\u606f\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"CAIGOU_MSG_SLC_BUYER_SUPPLIER_ADD\":\"\u91c7\u8d2d\u6d88\u606f-\u4e70\u5bb6\u6dfb\u52a0\u4f9b\u5e94\u5546\u6d88\u606f\",\"CAIGOU_SELLER_VIEW_MSG_BUYER_REQUISITION_APPROVAL_REJECT\":\"\u91c7\u8d2d\u6d88\u606f-\u8bf7\u8d2d\u5355\u5ba1\u6279\u5168\u90e8\u9a73\u56de\u6d88\u606f\uff08\u5356\u5bb6\u89c6\u89d2\uff09\",\"WANG_BUYER_INQUIRY\":\"\u65fa\u65fa\u6d88\u606f-\u4e70\u5bb6\u8be2\u76d8\u6d88\u606f\",\"CAIGOU_MSG_SLC_BUYER_SUPPLIER_DELETE\":\"\u91c7\u8d2d\u6d88\u606f-\u4e70\u5bb6\u5220\u9664\u4f9b\u5e94\u5546\u6d88\u606f\",\"CAIGOU_BUYER_VIEW_MSG_CANCEL_PROCUREMENT_ENTRY\":\"\u91c7\u8d2d\u6d88\u606f-\u91c7\u8d2d\u5b50\u8ba2\u5355\u53d6\u6d88\u6d88\u606f\"}";
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class Items
{
/// <summary>订单的订单项id</summary>
[Newtonsoft.Json.JsonProperty("orderItemId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderItemId { get; set; }
/// <summary>商品报价ID</summary>
[Newtonsoft.Json.JsonProperty("productQuoteId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long ProductQuoteId { get; set; }
/// <summary>物料ID</summary>
[Newtonsoft.Json.JsonProperty("productId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long ProductId { get; set; }
/// <summary>外部对接系统的产品代码</summary>
[Newtonsoft.Json.JsonProperty("productCode", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ProductCode { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class Items2
{
/// <summary>订单的订单项id</summary>
[Newtonsoft.Json.JsonProperty("orderItemId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderItemId { get; set; }
/// <summary>采购单的采购项id</summary>
[Newtonsoft.Json.JsonProperty("supplyNoteItemId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SupplyNoteItemId { get; set; }
/// <summary>外部对接系统的pr行id</summary>
[Newtonsoft.Json.JsonProperty("prItemId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? PrItemId { get; set; }
/// <summary>外部对接系统的产品代码</summary>
[Newtonsoft.Json.JsonProperty("productCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ProductCode { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class Items3
{
/// <summary>订单的订单项ID</summary>
[Newtonsoft.Json.JsonProperty("orderItemId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderItemId { get; set; }
/// <summary>采购必应的采购单的采购项ID</summary>
[Newtonsoft.Json.JsonProperty("supplyNoteItemId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SupplyNoteItemId { get; set; }
/// <summary>外部对接系统的PR行ID</summary>
[Newtonsoft.Json.JsonProperty("prItemId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PrItemId { get; set; }
/// <summary>外部对接系统的产品代码</summary>
[Newtonsoft.Json.JsonProperty("productCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ProductCode { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class Items4
{
/// <summary>订单的订单项id</summary>
[Newtonsoft.Json.JsonProperty("orderItemId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderItemId { get; set; }
/// <summary>offerId</summary>
[Newtonsoft.Json.JsonProperty("offerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OfferId { get; set; }
/// <summary>外部对接系统的物料编码</summary>
[Newtonsoft.Json.JsonProperty("productCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ProductCode { get; set; }
/// <summary>在1688创建物料的Id</summary>
[Newtonsoft.Json.JsonProperty("productId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long ProductId { get; set; }
/// <summary>在1688报价Id</summary>
[Newtonsoft.Json.JsonProperty("productQuoteId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long ProductQuoteId { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class ReceiveUserInfo
{
/// <summary>收货人电话</summary>
[Newtonsoft.Json.JsonProperty("phone", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Phone { get; set; }
/// <summary>收货人邮编</summary>
[Newtonsoft.Json.JsonProperty("post", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Post { get; set; }
/// <summary>收货人地址</summary>
[Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Address { get; set; }
/// <summary>收货人姓名</summary>
[Newtonsoft.Json.JsonProperty("userName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string UserName { get; set; }
/// <summary>收货人手机号</summary>
[Newtonsoft.Json.JsonProperty("mobile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Mobile { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class OrderList
{
/// <summary>供应商memberId</summary>
[Newtonsoft.Json.JsonProperty("sellerMemberId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SellerMemberId { get; set; }
/// <summary>商品金额</summary>
[Newtonsoft.Json.JsonProperty("sumProductPayment", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SumProductPayment { get; set; }
/// <summary>供应商名称</summary>
[Newtonsoft.Json.JsonProperty("sellerCompanyName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string SellerCompanyName { get; set; }
/// <summary>下单公司主体</summary>
[Newtonsoft.Json.JsonProperty("pcorpName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string PcorpName { get; set; }
[Newtonsoft.Json.JsonProperty("entryList", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required]
public System.Collections.Generic.ICollection<EntryList> EntryList { get; set; } = new System.Collections.ObjectModel.Collection<EntryList>();
/// <summary>订单id</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OrderId { get; set; }
/// <summary>总金额</summary>
[Newtonsoft.Json.JsonProperty("sumPayment", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long SumPayment { get; set; }
/// <summary>子账号userId</summary>
[Newtonsoft.Json.JsonProperty("createUserId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long CreateUserId { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PriceRangeList
{
/// <summary>阶梯价格不含税价</summary>
[Newtonsoft.Json.JsonProperty("noTaxPrice", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string NoTaxPrice { get; set; }
/// <summary>阶梯价格数量</summary>
[Newtonsoft.Json.JsonProperty("mod", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Mod { get; set; }
/// <summary>阶梯价格含税价</summary>
[Newtonsoft.Json.JsonProperty("taxPrice", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string TaxPrice { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class SendAddressList
{
/// <summary>发货地址</summary>
[Newtonsoft.Json.JsonProperty("address", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Address { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class PriceRangeList2
{
/// <summary>阶梯价格不含税价</summary>
[Newtonsoft.Json.JsonProperty("noTaxPrice", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? NoTaxPrice { get; set; }
/// <summary>阶梯价格数量</summary>
[Newtonsoft.Json.JsonProperty("mod", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? Mod { get; set; }
/// <summary>阶梯价格含税价</summary>
[Newtonsoft.Json.JsonProperty("taxPrice", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? TaxPrice { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class Reason
{
/// <summary>导致授权取消的行为,示例值:账号改密码(ACCOUNT_PASSWORD_MODIFIED)、订购到期(ORDER_EXPIRED)、子账号被停用(SUB_ACCOUNT_INACTIVE)、子账号被删除(SUB_ACCOUNT_DELETED)、账号被安全处罚(ACCOUNT_PUBLISHED)、单用户对接应用授权账号被修改(BOND_ACCOUNT_MODIFIED)、手动取消账号授权(MANUAL_CANCEL)</summary>
[Newtonsoft.Json.JsonProperty("operation", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Operation { get; set; }
/// <summary>操作人,跟原因一起决定了授权取消的行为来源</summary>
[Newtonsoft.Json.JsonProperty("operator", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Operator { get; set; }
/// <summary>操作人类型,示例值:用户(USER),开发者(ISV),平台管理员(ADMINISTRATOR),系统操作(SYSTEM)</summary>
[Newtonsoft.Json.JsonProperty("operatorType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OperatorType { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class MsgItems
{
/// <summary>请购id</summary>
[Newtonsoft.Json.JsonProperty("requisitionId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? RequisitionId { get; set; }
/// <summary>请购行id</summary>
[Newtonsoft.Json.JsonProperty("requisitionItemId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? RequisitionItemId { get; set; }
/// <summary>请购行序号</summary>
[Newtonsoft.Json.JsonProperty("requisitionItemNo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string RequisitionItemNo { get; set; }
/// <summary>ERP请购单编号</summary>
[Newtonsoft.Json.JsonProperty("erpReqNo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ErpReqNo { get; set; }
/// <summary>ERP请购单行号</summary>
[Newtonsoft.Json.JsonProperty("erpReqItemNo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ErpReqItemNo { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class BatchPay
{
/// <summary>订单id</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string OrderId { get; set; }
/// <summary>订单支付状态,可为successed(支付成功)、ACCOUNT_BALANCE_NOT_ENOUGH(余额不足)、ACCOUNT_NOT_EXIST(跨境宝2.0场景下可能签约但是在ipay没有开户)、ACCOUNT_FROZEN(账户冻结)、PARAM_ILLEGAL(参数非法)</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Status { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class OfferInventoryChangeList
{
/// <summary>1688商品id</summary>
[Newtonsoft.Json.JsonProperty("offerId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OfferId { get; set; }
/// <summary>在线可售offer数量</summary>
[Newtonsoft.Json.JsonProperty("offerOnSale", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long OfferOnSale { get; set; }
/// <summary>商品skuId</summary>
[Newtonsoft.Json.JsonProperty("skuId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? SkuId { get; set; }
/// <summary>在线可售sku数量</summary>
[Newtonsoft.Json.JsonProperty("skuOnSale", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? SkuOnSale { get; set; }
/// <summary>该offer整体库存变化数</summary>
[Newtonsoft.Json.JsonProperty("quantity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Quantity { get; set; }
/// <summary>库存变更时间</summary>
[Newtonsoft.Json.JsonProperty("bizTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public System.DateTimeOffset BizTime { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class Products
{
/// <summary>商品id</summary>
[Newtonsoft.Json.JsonProperty("productId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ProductId { get; set; }
/// <summary>是否支持超买价;true支持超买价</summary>
[Newtonsoft.Json.JsonProperty("supportSuperPrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool SupportSuperPrice { get; set; }
/// <summary>商品状态;枚举,DELETE:删除商品,商品不在商品池;UPDATE:商品超买价状态可能有更新;机构可以只关心DELETE状态判断是否在商品池</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Status { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class OrderLogisticsTracingModel
{
/// <summary>物流编号</summary>
[Newtonsoft.Json.JsonProperty("logisticsId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string LogisticsId { get; set; }
/// <summary>cp code</summary>
[Newtonsoft.Json.JsonProperty("cpCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string CpCode { get; set; }
/// <summary>运单号</summary>
[Newtonsoft.Json.JsonProperty("mailNo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string MailNo { get; set; }
/// <summary>物流单发生变化的状态,包括发货(CONSIGN)、揽收(ACCEPT)、运输(TRANSPORT)、派送(DELIVERING)、签收(SIGN)</summary>
[Newtonsoft.Json.JsonProperty("statusChanged", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string StatusChanged { get; set; }
/// <summary>发生变化的时间</summary>
[Newtonsoft.Json.JsonProperty("changeTime", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.DateTimeOffset? ChangeTime { get; set; }
/// <summary>该物流单关联的订单信息</summary>
[Newtonsoft.Json.JsonProperty("orderLogsItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<OrderLogsItems> OrderLogsItems { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class MailNoChangeModel
{
/// <summary>物流单号</summary>
[Newtonsoft.Json.JsonProperty("logisticsId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string LogisticsId { get; set; }
/// <summary>更改前的cp code</summary>
[Newtonsoft.Json.JsonProperty("oldCpCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OldCpCode { get; set; }
/// <summary>更改后的cp code</summary>
[Newtonsoft.Json.JsonProperty("newCpCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string NewCpCode { get; set; }
/// <summary>更改前的运单号</summary>
[Newtonsoft.Json.JsonProperty("oldMailNo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string OldMailNo { get; set; }
/// <summary>更改后的运单号</summary>
[Newtonsoft.Json.JsonProperty("newMailNo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string NewMailNo { get; set; }
/// <summary>发生时间</summary>
[Newtonsoft.Json.JsonProperty("eventTime", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.DateTimeOffset? EventTime { get; set; }
/// <summary>该物流单关联的订单信息</summary>
[Newtonsoft.Json.JsonProperty("orderLogsItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public object OrderLogsItems { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class Data
{
/// <summary>pass error</summary>
[Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Result { get; set; }
/// <summary>终止交易单id</summary>
[Newtonsoft.Json.JsonProperty("terminateTradeId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? TerminateTradeId { get; set; }
/// <summary>订单id</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? OrderId { get; set; }
/// <summary>终止交易单状态</summary>
[Newtonsoft.Json.JsonProperty("terminateTradeStatus", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string TerminateTradeStatus { get; set; }
/// <summary>终止交易单错误信息</summary>
[Newtonsoft.Json.JsonProperty("checkErrorInfos", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<CheckErrorInfos> CheckErrorInfos { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class EntryList
{
/// <summary>单位</summary>
[Newtonsoft.Json.JsonProperty("unit", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Unit { get; set; }
/// <summary>税率</summary>
[Newtonsoft.Json.JsonProperty("taxRate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long TaxRate { get; set; }
/// <summary>交易类型</summary>
[Newtonsoft.Json.JsonProperty("tradeTypeStr", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string TradeTypeStr { get; set; }
/// <summary>图片链接</summary>
[Newtonsoft.Json.JsonProperty("imageUrl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ImageUrl { get; set; }
/// <summary>价格</summary>
[Newtonsoft.Json.JsonProperty("discountPrice", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long DiscountPrice { get; set; }
/// <summary>数量</summary>
[Newtonsoft.Json.JsonProperty("quantity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Quantity { get; set; }
/// <summary>物料编码</summary>
[Newtonsoft.Json.JsonProperty("productMaterialCode", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ProductMaterialCode { get; set; }
/// <summary>商品名称</summary>
[Newtonsoft.Json.JsonProperty("productName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ProductName { get; set; }
/// <summary>子订单id</summary>
[Newtonsoft.Json.JsonProperty("entryId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long EntryId { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class OrderLogsItems
{
/// <summary>交易主单id</summary>
[Newtonsoft.Json.JsonProperty("orderId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? OrderId { get; set; }
/// <summary>交易子单id</summary>
[Newtonsoft.Json.JsonProperty("orderEntryId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? OrderEntryId { get; set; }
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.27.0 (Newtonsoft.Json v10.0.0.0)")]
public partial class CheckErrorInfos
{
/// <summary>单据ID</summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? Id { get; set; }
/// <summary>单据编码</summary>
[Newtonsoft.Json.JsonProperty("code", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Code { get; set; }
/// <summary>单据状态</summary>
[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Status { get; set; }
/// <summary>单据类型</summary>
[Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Type { get; set; }
/// <summary>单据行号</summary>
[Newtonsoft.Json.JsonProperty("rowNum", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long? RowNum { get; set; }
}
}
#pragma warning restore 1591
#pragma warning restore 1573
#pragma warning restore 472
#pragma warning restore 114
#pragma warning restore 108 | 61.150838 | 16,499 | 0.723659 | [
"MIT"
] | mccj/AlibabaSDKFor1688 | src/sdk/AlibabaSDKFor1688/AlibabaWebSocketClientModelsGeneration.cs | 194,050 | C# |
namespace Microsoft.NodejsTools.Options {
partial class NodejsNpmOptionsControl {
/// <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.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this._showOutputWhenRunningNpm = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.ClearCacheButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this._cacheClearedSuccessfully = new System.Windows.Forms.Label();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox1.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.AutoSize = true;
this.groupBox1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.groupBox1.Controls.Add(this.tableLayoutPanel3);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(6, 3);
this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 3, 6, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(376, 42);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "npm Command Execution";
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.AutoSize = true;
this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel3.ColumnCount = 1;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel3.Controls.Add(this._showOutputWhenRunningNpm, 0, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Top;
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(370, 23);
this.tableLayoutPanel3.TabIndex = 2;
//
// _showOutputWhenRunningNpm
//
this._showOutputWhenRunningNpm.AutoSize = true;
this._showOutputWhenRunningNpm.Location = new System.Drawing.Point(3, 3);
this._showOutputWhenRunningNpm.Name = "_showOutputWhenRunningNpm";
this._showOutputWhenRunningNpm.Size = new System.Drawing.Size(228, 17);
this._showOutputWhenRunningNpm.TabIndex = 1;
this._showOutputWhenRunningNpm.Text = "Show Output window when executing &npm";
this._showOutputWhenRunningNpm.UseVisualStyleBackColor = true;
//
// groupBox2
//
this.groupBox2.AutoSize = true;
this.groupBox2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.groupBox2.Controls.Add(this.tableLayoutPanel1);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(6, 51);
this.groupBox2.Margin = new System.Windows.Forms.Padding(6, 3, 6, 3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(376, 74);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "npm Package Catalog";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.AutoSize = true;
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 260F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLayoutPanel1.Controls.Add(this.ClearCacheButton, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this._cacheClearedSuccessfully, 2, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(367, 38);
this.tableLayoutPanel1.TabIndex = 0;
//
// ClearCacheButton
//
this.ClearCacheButton.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ClearCacheButton.Location = new System.Drawing.Point(263, 7);
this.ClearCacheButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
this.ClearCacheButton.Name = "ClearCacheButton";
this.ClearCacheButton.Size = new System.Drawing.Size(74, 23);
this.ClearCacheButton.TabIndex = 0;
this.ClearCacheButton.Text = "&Clear Cache";
this.ClearCacheButton.UseVisualStyleBackColor = true;
this.ClearCacheButton.Click += new System.EventHandler(this.ClearCacheButton_Click);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 6);
this.label1.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(249, 26);
this.label1.TabIndex = 1;
this.label1.Text = "Delete data from local Node.js Tools npm package catalog cache";
//
// _cacheClearedSuccessfully
//
this._cacheClearedSuccessfully.AccessibleDescription = "Cache Cleared Successfully";
this._cacheClearedSuccessfully.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this._cacheClearedSuccessfully.AutoSize = true;
this._cacheClearedSuccessfully.Font = new System.Drawing.Font("Segoe UI Symbol", 14F, System.Drawing.FontStyle.Bold);
this._cacheClearedSuccessfully.Location = new System.Drawing.Point(337, 0);
this._cacheClearedSuccessfully.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this._cacheClearedSuccessfully.Name = "_cacheClearedSuccessfully";
this._cacheClearedSuccessfully.Size = new System.Drawing.Size(27, 38);
this._cacheClearedSuccessfully.TabIndex = 2;
this._cacheClearedSuccessfully.Text = "✓";
this._cacheClearedSuccessfully.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this._cacheClearedSuccessfully.Visible = false;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.AutoSize = true;
this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Controls.Add(this.groupBox1, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.groupBox2, 0, 1);
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, -1);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 2;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.Size = new System.Drawing.Size(388, 128);
this.tableLayoutPanel2.TabIndex = 4;
//
// NodejsNpmOptionsControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.Controls.Add(this.tableLayoutPanel2);
this.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8);
this.Name = "NodejsNpmOptionsControl";
this.Size = new System.Drawing.Size(391, 130);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button ClearCacheButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox _showOutputWhenRunningNpm;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Label _cacheClearedSuccessfully;
}
}
| 57.661905 | 174 | 0.637129 | [
"Apache-2.0"
] | Weflac/nodejstools | Nodejs/Product/Nodejs/Options/NodejsNpmOptionsControl.Designer.cs | 11,904 | C# |
using System;
namespace lab_16_access_modifiers
{
class Program
{
static void Main(string[] args)
{
var p = new Parent();
var c = new Child();
// p._hidden ...
p.Exposed = "Yes we can see this";
c.Exposed = "Yes also visible";
p.IsUserLive = true;
c.IsUserLive = true;
// p.FamilyName ...
// SOMEHOW CREATE AS MANY VARIABLES AS YOU CAN IN DIFFERENT WAYS THAT BOTH p and c CAN ACCESS
var dog = new Dog();
dog.Name = "GreatestPet";
p.TakeForWalk(dog);
c.TakeForWalk(dog);
c.ChangeNameOfDog(dog, "I Like This Name Better");
p.ChangeNameOfDog(dog, "Stick With Original");
Console.WriteLine(dog.Name);
}
}
class Dog {
public string Name { get; set; }
}
class Parent
{
private int _hidden; // ENCAPSULATION
public string Exposed { get; set; }
internal bool IsUserLive; // VISIBLE INSIDE .EXE/DLL BUT NOT OUTSIDE IT
protected string FamilyName { get; set; } // VISIBLE INSIDE CHILD
public void TakeForWalk(Dog d) { Console.WriteLine($"Taking {d.Name} for a walk"); }
public void ChangeNameOfDog(Dog dog, string newName) { dog.Name = newName; }
}
class Child : Parent
{
// CAN'T PUT CODE DIRECTLY IN CLASS
// USE CONSTRUCTOR BUT COULD USE ANY METHOD
public Child()
{
this.FamilyName = "Robertson";
}
}
}
| 26.491803 | 105 | 0.530322 | [
"MIT"
] | philanderson888/2020-01-c-sharp-labs | labs/lab_16_access_modifiers/Program.cs | 1,618 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CN_Model
{
public class CNMemo : IEquatable<CNMemo>,ICloneable
{
public int MemoId { get; set; }
private string _content;
public string Content { get { if (_content == null) { _content = "memo content here"; }return _content; } set { _content = value; } }
private string _title;
public string Title { get { if (_title == null) { _title = "NewTitle"; } return _title; } set { _title = value; } }
public string Tag { get; set; }
public bool Equals(CNMemo other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return MemoId == other.MemoId && string.Equals(Content, other.Content) && string.Equals(Title, other.Title) && string.Equals(Tag, other.Tag);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
var other = obj as CNMemo;
return other != null && Equals(other);
}
public override int GetHashCode()
{
unchecked
{
var hashCode = MemoId;
hashCode = (hashCode*397) ^ (Content != null ? Content.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0);
hashCode = (hashCode*397) ^ (Tag != null ? Tag.GetHashCode() : 0);
return hashCode;
}
}
public object Clone()
{
return new CNMemo()
{
Content = string.Copy(this.Content),
Title = string.Copy(this.Title),
MemoId = this.MemoId,
Tag = string.Copy(this.Tag)
};
}
}
}
| 34.087719 | 153 | 0.538857 | [
"MIT"
] | engimaxp/CoffeeNewspaper | CoffeeNewspaper/CN_Model/CNMemo.cs | 1,945 | C# |
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using static ATL.AudioData.AudioDataManager;
using Commons;
using static ATL.ChannelsArrangements;
namespace ATL.AudioData.IO
{
/// <summary>
/// Class for ScreamTracker Module files manipulation (extensions : .S3M)
///
/// Note : Parsing as it is considers the file as one single song.
/// Modules with song delimiters (pattern code 0xFF) are supported, but displayed as one track
/// instead of multiple tracks (behaviour of foobar2000).
///
/// As a consequence, modules containing multiple songs and exotic loops (i.e. looping from song 2 to song 1)
/// might not be detected with their exact duration.
/// </summary>
class S3M : MetaDataIO, IAudioDataIO
{
private const string ZONE_TITLE = "title";
private const String S3M_SIGNATURE = "SCRM";
private const byte MAX_ROWS = 64;
// Effects
private const byte EFFECT_SET_SPEED = 0x01;
private const byte EFFECT_ORDER_JUMP = 0x02;
private const byte EFFECT_JUMP_TO_ROW = 0x03;
private const byte EFFECT_EXTENDED = 0x13;
private const byte EFFECT_SET_BPM = 0x14;
private const byte EFFECT_EXTENDED_LOOP = 0xB;
// Standard fields
private IList<byte> FChannelTable;
private IList<byte> FPatternTable;
private IList<IList<IList<S3MEvent>>> FPatterns;
private IList<Instrument> FInstruments;
private byte initialSpeed;
private byte initialTempo;
private byte nbChannels;
private String trackerName;
private double bitrate;
private double duration;
private SizeInfo sizeInfo;
private readonly string filePath;
// ---------- INFORMATIVE INTERFACE IMPLEMENTATIONS & MANDATORY OVERRIDES
// IAudioDataIO
public int SampleRate // Sample rate (hz)
{
get { return 0; }
}
public bool IsVBR
{
get { return false; }
}
public int CodecFamily
{
get { return AudioDataIOFactory.CF_SEQ_WAV; }
}
public string FileName
{
get { return filePath; }
}
public double BitRate
{
get { return bitrate; }
}
public double Duration
{
get { return duration; }
}
public ChannelsArrangement ChannelsArrangement
{
get { return ChannelsArrangements.STEREO; }
}
public bool IsMetaSupported(int metaDataType)
{
return (metaDataType == MetaDataIOFactory.TAG_NATIVE);
}
// IMetaDataIO
protected override int getDefaultTagOffset()
{
return TO_BUILTIN;
}
protected override int getImplementedTagType()
{
return MetaDataIOFactory.TAG_NATIVE;
}
protected override byte getFrameMapping(string zone, string ID, byte tagVersion)
{
throw new NotImplementedException();
}
// === PRIVATE STRUCTURES/SUBCLASSES ===
private class Instrument
{
public byte Type = 0;
public String FileName = "";
public String DisplayName = "";
// Other fields not useful for ATL
}
private class S3MEvent
{
// Commented fields below not useful for ATL
public int Channel;
//public byte Note;
//public byte Instrument;
//public byte Volume;
public byte Command;
public byte Info;
public void Reset()
{
Channel = 0;
Command = 0;
Info = 0;
}
}
// ---------- CONSTRUCTORS & INITIALIZERS
private void resetData()
{
// Reset variables
duration = 0;
bitrate = 0;
FPatternTable = new List<byte>();
FChannelTable = new List<byte>();
FPatterns = new List<IList<IList<S3MEvent>>>();
FInstruments = new List<Instrument>();
trackerName = "";
nbChannels = 0;
ResetData();
}
public S3M(string filePath)
{
this.filePath = filePath;
resetData();
}
// === PRIVATE METHODS ===
private double calculateDuration()
{
double result = 0;
// Jump and break control variables
int currentPatternIndex = 0; // Index in the pattern table
int currentPattern = 0; // Pattern number per se
int currentRow = 0;
bool positionJump = false;
bool patternBreak = false;
// Loop control variables
bool isInsideLoop = false;
double loopDuration = 0;
IList<S3MEvent> row;
double speed = initialSpeed;
double tempo = initialTempo;
double previousTempo = tempo;
do // Patterns loop
{
do // Lines loop
{
currentPattern = FPatternTable[currentPatternIndex];
while ((currentPattern > FPatterns.Count - 1) && (currentPatternIndex < FPatternTable.Count - 1))
{
if (currentPattern.Equals(255)) // End of song / sub-song
{
// Reset speed & tempo to file default (do not keep remaining values from previous sub-song)
speed = initialSpeed;
tempo = initialTempo;
}
currentPattern = FPatternTable[++currentPatternIndex];
}
if (currentPattern > FPatterns.Count - 1) return result;
row = FPatterns[currentPattern][currentRow];
foreach (S3MEvent theEvent in row) // Events loop
{
if (theEvent.Command.Equals(EFFECT_SET_SPEED))
{
if (theEvent.Info > 0) speed = theEvent.Info;
}
else if (theEvent.Command.Equals(EFFECT_SET_BPM))
{
if (theEvent.Info > 0x20)
{
tempo = theEvent.Info;
}
else
{
if (theEvent.Info.Equals(0))
{
tempo = previousTempo;
}
else
{
previousTempo = tempo;
if (theEvent.Info < 0x10)
{
tempo -= theEvent.Info;
}
else
{
tempo += (theEvent.Info - 0x10);
}
}
}
}
else if (theEvent.Command.Equals(EFFECT_ORDER_JUMP))
{
// Processes position jump only if the jump is forward
// => Prevents processing "forced" song loops ad infinitum
if (theEvent.Info > currentPatternIndex)
{
currentPatternIndex = Math.Min(theEvent.Info, FPatternTable.Count - 1);
currentRow = 0;
positionJump = true;
}
}
else if (theEvent.Command.Equals(EFFECT_JUMP_TO_ROW))
{
currentPatternIndex++;
currentRow = Math.Min(theEvent.Info, (byte)63);
patternBreak = true;
}
else if (theEvent.Command.Equals(EFFECT_EXTENDED))
{
if ((theEvent.Info >> 4).Equals(EFFECT_EXTENDED_LOOP))
{
if ((theEvent.Info & 0xF).Equals(0)) // Beginning of loop
{
loopDuration = 0;
isInsideLoop = true;
}
else // End of loop + nb. repeat indicator
{
result += loopDuration * (theEvent.Info & 0xF);
isInsideLoop = false;
}
}
}
if (positionJump || patternBreak) break;
} // end Events loop
result += 60 * (speed / (24 * tempo));
if (isInsideLoop) loopDuration += 60 * (speed / (24 * tempo));
if (positionJump || patternBreak) break;
currentRow++;
} while (currentRow < MAX_ROWS);
if (positionJump || patternBreak)
{
positionJump = false;
patternBreak = false;
}
else
{
currentPatternIndex++;
currentRow = 0;
}
} while (currentPatternIndex < FPatternTable.Count); // end patterns loop
return result;
}
private String getTrackerName(ushort trackerVersion)
{
String result = "";
switch ((trackerVersion & 0xF000) >> 12)
{
case 0x1: result = "ScreamTracker"; break;
case 0x2: result = "Imago Orpheus"; break;
case 0x3: result = "Impulse Tracker"; break;
case 0x4: result = "Schism Tracker"; break;
case 0x5: result = "OpenMPT"; break;
case 0xC: result = "Camoto/libgamemusic"; break;
}
return result;
}
private void readInstruments(BufferedBinaryReader source, IList<ushort> instrumentPointers)
{
foreach (ushort pos in instrumentPointers)
{
source.Seek(pos << 4, SeekOrigin.Begin);
Instrument instrument = new Instrument();
instrument.Type = source.ReadByte();
instrument.FileName = Utils.Latin1Encoding.GetString(source.ReadBytes(12)).Trim();
instrument.FileName = instrument.FileName.Replace("\0", "");
if (instrument.Type > 0) // Same offsets for PCM and AdLib display names
{
source.Seek(35, SeekOrigin.Current);
instrument.DisplayName = StreamUtils.ReadNullTerminatedStringFixed(source, Encoding.ASCII, 28);
instrument.DisplayName = instrument.DisplayName.Replace("\0", "");
source.Seek(4, SeekOrigin.Current);
}
FInstruments.Add(instrument);
}
}
private void readPatterns(BufferedBinaryReader source, IList<ushort> patternPointers)
{
byte rowNum;
byte what;
IList<S3MEvent> aRow;
IList<IList<S3MEvent>> aPattern;
foreach (ushort pos in patternPointers)
{
aPattern = new List<IList<S3MEvent>>();
source.Seek(pos << 4, SeekOrigin.Begin);
aRow = new List<S3MEvent>();
rowNum = 0;
source.Seek(2, SeekOrigin.Current); // patternSize
do
{
what = source.ReadByte();
if (what > 0)
{
S3MEvent theEvent = new S3MEvent();
theEvent.Channel = what & 0x1F;
if ((what & 0x20) > 0) source.Seek(2, SeekOrigin.Current); // Note & Instrument
if ((what & 0x40) > 0) source.Seek(1, SeekOrigin.Current); // Volume
if ((what & 0x80) > 0)
{
theEvent.Command = source.ReadByte();
theEvent.Info = source.ReadByte();
}
aRow.Add(theEvent);
}
else // what = 0 => end of row
{
aPattern.Add(aRow);
aRow = new List<S3MEvent>();
rowNum++;
}
} while (rowNum < MAX_ROWS);
FPatterns.Add(aPattern);
}
}
// === PUBLIC METHODS ===
public bool Read(BinaryReader source, AudioDataManager.SizeInfo sizeInfo, MetaDataIO.ReadTagParams readTagParams)
{
this.sizeInfo = sizeInfo;
return read(source, readTagParams);
}
protected override bool read(BinaryReader source, MetaDataIO.ReadTagParams readTagParams)
{
bool result = true;
ushort nbOrders = 0;
ushort nbPatterns = 0;
ushort nbInstruments = 0;
ushort flags;
ushort trackerVersion;
StringBuilder comment = new StringBuilder("");
IList<ushort> patternPointers = new List<ushort>();
IList<ushort> instrumentPointers = new List<ushort>();
resetData();
BufferedBinaryReader bSource = new BufferedBinaryReader(source.BaseStream);
// Title = first 28 chars
string title = StreamUtils.ReadNullTerminatedStringFixed(bSource, System.Text.Encoding.ASCII, 28);
if (readTagParams.PrepareForWriting)
{
structureHelper.AddZone(0, 28, new byte[28] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, ZONE_TITLE);
}
tagData.IntegrateValue(TagData.TAG_FIELD_TITLE, title.Trim());
bSource.Seek(4, SeekOrigin.Current);
nbOrders = bSource.ReadUInt16();
nbInstruments = bSource.ReadUInt16();
nbPatterns = bSource.ReadUInt16();
flags = bSource.ReadUInt16();
trackerVersion = bSource.ReadUInt16();
trackerName = getTrackerName(trackerVersion);
bSource.Seek(2, SeekOrigin.Current); // sampleType (16b)
if (!S3M_SIGNATURE.Equals(Utils.Latin1Encoding.GetString(bSource.ReadBytes(4))))
{
result = false;
throw new InvalidDataException("Invalid S3M file (file signature mismatch)");
}
bSource.Seek(1, SeekOrigin.Current); // globalVolume (8b)
tagExists = true;
initialSpeed = bSource.ReadByte();
initialTempo = bSource.ReadByte();
bSource.Seek(1, SeekOrigin.Current); // masterVolume (8b)
bSource.Seek(1, SeekOrigin.Current); // ultraClickRemoval (8b)
bSource.Seek(1, SeekOrigin.Current); // defaultPan (8b)
bSource.Seek(8, SeekOrigin.Current); // defaultPan (64b)
bSource.Seek(2, SeekOrigin.Current); // ptrSpecial (16b)
// Channel table
for (int i = 0; i < 32; i++)
{
FChannelTable.Add(bSource.ReadByte());
if (FChannelTable[FChannelTable.Count - 1] < 30) nbChannels++;
}
// Pattern table
for (int i = 0; i < nbOrders; i++)
{
FPatternTable.Add(bSource.ReadByte());
}
// Instruments pointers
for (int i = 0; i < nbInstruments; i++)
{
instrumentPointers.Add(bSource.ReadUInt16());
}
// Patterns pointers
for (int i = 0; i < nbPatterns; i++)
{
patternPointers.Add(bSource.ReadUInt16());
}
readInstruments(bSource, instrumentPointers);
readPatterns(bSource, patternPointers);
// == Computing track properties
duration = calculateDuration() * 1000.0;
foreach (Instrument i in FInstruments)
{
string displayName = i.DisplayName.Trim();
if (displayName.Length > 0) comment.Append(displayName).Append(Settings.InternalValueSeparator);
}
if (comment.Length > 0) comment.Remove(comment.Length - 1, 1);
tagData.IntegrateValue(TagData.TAG_FIELD_COMMENT, comment.ToString());
bitrate = sizeInfo.FileSize / duration;
return result;
}
protected override int write(TagData tag, BinaryWriter w, string zone)
{
int result = 0;
if (ZONE_TITLE.Equals(zone))
{
string title = tag.Title;
if (title.Length > 28) title = title.Substring(0, 28);
else if (title.Length < 28) title = Utils.BuildStrictLengthString(title, 28, '\0');
w.Write(Utils.Latin1Encoding.GetBytes(title));
result = 1;
}
return result;
}
}
} | 34.647287 | 160 | 0.477235 | [
"MIT"
] | Piorosen/atldotnet | ATL/AudioData/IO/S3M.cs | 17,878 | 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.Collections.Generic;
using System.Diagnostics.ContractsLight;
using System.Linq;
using BuildXL.FrontEnd.Ninja.Serialization;
using BuildXL.Pips;
using BuildXL.Pips.Operations;
using BuildXL.Utilities;
using Test.BuildXL.TestUtilities.Xunit;
using static BuildXL.Utilities.FormattableStringEx;
namespace Test.BuildXL.FrontEnd.Ninja.Infrastructure
{
/// <summary>
/// The result of scheduling a list of <see cref="NinjaNode"/>
/// </summary>
public sealed class NinjaSchedulingResult
{
private readonly PathTable m_pathTable;
private readonly Dictionary<NinjaNode, (bool success, Process process)> m_schedulingResult;
/// <summary>
/// The scheduled graph
/// </summary>
public IPipGraph PipGraph { get; }
/// <nodoc/>
internal NinjaSchedulingResult(PathTable pathTable, IPipGraph pipGraph, Dictionary<NinjaNode, (bool, Process)> schedulingResult)
{
Contract.Requires(pathTable != null);
Contract.Requires(schedulingResult != null);
m_pathTable = pathTable;
PipGraph = pipGraph;
m_schedulingResult = schedulingResult;
}
/// <summary>
/// Asserts that all scheduled projects suceeded
/// </summary>
public NinjaSchedulingResult AssertSuccess()
{
foreach (var entry in m_schedulingResult)
{
XAssert.IsTrue(entry.Value.success, I($"Expected to schedule '{entry.Key.Command}' but scheduling failed."));
}
return this;
}
/// <summary>
/// Retrieves the successfully scheduled process corresponding to the specified project
/// </summary>
public Process RetrieveSuccessfulProcess(NinjaNode project)
{
if (!m_schedulingResult.TryGetValue(project, out var result))
{
XAssert.IsTrue(false, "Specified project did not run");
}
if (!result.success)
{
XAssert.IsTrue(false, "Specified project did not succeed");
}
return result.process;
}
/// <summary>
/// Retrieves all processes that were scheduled
/// </summary>
public IEnumerable<Process> RetrieveAllProcesses()
{
return m_schedulingResult.Values.Select(kvp => kvp.process);
}
/// <summary>
/// Asserts the occurrence of at least one scheduled failured and retrieves all the failed projects
/// </summary>
/// <returns></returns>
public IEnumerable<NinjaNode> AssertFailureAndRetrieveFailedProjects()
{
var result = m_schedulingResult.Where(kvp => !kvp.Value.success).Select(kvp => kvp.Key).ToList();
XAssert.IsTrue(result.Count > 1, "Expected to find a failure, but all projects succeeded at scheduling");
return result;
}
}
}
| 35.097826 | 137 | 0.606999 | [
"MIT"
] | AzureMentor/BuildXL | Public/Src/FrontEnd/UnitTests/Ninja/Infrastructure/NinjaSchedulingResult.cs | 3,229 | C# |
using AutoMapper;
using Entidades;
using Entidades.Dto;
using Microsoft.AspNetCore.Mvc;
using Persistencia.Interfaces;
using System;
namespace Api.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class TagController : ControllerBase
{
private readonly ITagService tagService;
private readonly IMapper mapper;
public TagController(ITagService tagService, IMapper mapper)
{
this.tagService = tagService;
this.mapper = mapper;
}
[HttpGet("{id}")]
public ActionResult GetTag(long id)
{
try
{
Tag tag = tagService.Buscar(id);
TagDto dto = mapper.Map<TagDto>(tag);
return Ok(dto);
}
catch (Exception e)
{
return BadRequest(e);
}
}
}
} | 24.297297 | 68 | 0.551724 | [
"MIT"
] | lgmagalhaes88/Achei | backend/Api/Controllers/TagController.cs | 901 | C# |
using System;
namespace Jbpc.Common.ExtensionMethods
{
public static class TempSqlVariableNameGenerator
{
public static string Generate(int nth)
{
if (nth < 1) throw new ApplicationException($@"{nth} nth parameter cannot be less than 1");
if (nth > 256) throw new ApplicationException($@"{nth} > More than 256 SqlParameters???");
int dividend = nth;
string columnName = "";
while (dividend > 0)
{
var modulo = (dividend - 1) % 26;
columnName = $"{Convert.ToChar(65 + modulo)}{columnName}";
dividend = (int)((dividend - modulo) / 26);
}
return columnName;
}
}
}
| 28.692308 | 103 | 0.536193 | [
"MIT"
] | JaniceBPC/Common | Jbpc.Common/ExtensionMethods/SQL/TempSqlVariableNameGenerator.cs | 748 | C# |
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Benchmarks.General.PixelConversion
{
[StructLayout(LayoutKind.Sequential)]
public struct TestArgb : ITestPixel<TestArgb>
{
public byte A;
public byte R;
public byte G;
public byte B;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromRgba32(Rgba32 p)
{
this.R = p.R;
this.G = p.G;
this.B = p.B;
this.A = p.A;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromRgba32(ref Rgba32 p)
{
this.R = p.R;
this.G = p.G;
this.B = p.B;
this.A = p.A;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromBytes(byte r, byte g, byte b, byte a)
{
this.R = r;
this.G = g;
this.B = b;
this.A = a;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromVector4(Vector4 p)
{
this.R = (byte)p.X;
this.G = (byte)p.Y;
this.B = (byte)p.Z;
this.A = (byte)p.W;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FromVector4(ref Vector4 p)
{
this.R = (byte)p.X;
this.G = (byte)p.Y;
this.B = (byte)p.Z;
this.A = (byte)p.W;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Rgba32 ToRgba32()
{
return new Rgba32(this.R, this.G, this.B, this.A);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyToRgba32(ref Rgba32 dest)
{
dest.R = this.R;
dest.G = this.G;
dest.B = this.B;
dest.A = this.A;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector4 ToVector4()
{
return new Vector4(this.R, this.G, this.B, this.A);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyToVector4(ref Vector4 dest)
{
dest.X = this.R;
dest.Y = this.G;
dest.Z = this.B;
dest.W = this.A;
}
}
}
| 26.604167 | 65 | 0.533673 | [
"Apache-2.0"
] | asmodat/ImageSharp | tests/ImageSharp.Benchmarks/General/PixelConversion/TestArgb.cs | 2,554 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using AutoSharp.Utils;
using EloBuddy;
using EloBuddy.SDK;
using EloBuddy.SDK.Events;
namespace AutoSharp.Auto.HowlingAbyss.ARAMShopAI
{
internal static class BuyItemEvent
{
public delegate void OnBoughtItem(InventorySlot item);
//public static short BuyItemAns = 0x97;
public static int LastUpdate;
private static List<ItemId> Inventory = new List<ItemId>();
static BuyItemEvent()
{
Loading.OnLoadingComplete += Game_OnGameLoad;
}
public static event OnBoughtItem OnBuyItem;
private static void Game_OnGameLoad(EventArgs args)
{
UpdateInventory();
Game.OnUpdate += OnUpdate;
//Game.OnProcessPacket += Game_OnProcessPacket;
}
private static void OnUpdate(EventArgs args)
{
if (ObjectManager.Player.InFountain() && Environment.TickCount - LastUpdate > 500)
{
LastUpdate = Environment.TickCount;
Core.DelayAction(UpdateInventory, 300);
}
}
/*private static void Game_OnProcessPacket(GamePacketEventArgs args)
{
if (args.PacketData.GetPacketId().Equals(BuyItemAns))
{
Utility.DelayAction.Add(300, UpdateInventory);
}
}*/
private static void UpdateInventory()
{
if (Inventory.Count == 0)
{
Inventory = GetInventoryItems();
return;
}
if (Inventory.Count == ObjectManager.Player.InventoryItems.Length)
{
return;
}
var items = new List<ItemId>().Concat(Inventory).ToList();
foreach (var item in ObjectManager.Player.InventoryItems)
{
if (items.Contains(item.Id))
{
items.Remove(item.Id);
continue;
}
if (OnBuyItem != null)
{
OnBuyItem(item);
}
}
Chat.Print("lel");
Inventory.Clear();
Inventory = GetInventoryItems();
}
private static List<ItemId> GetInventoryItems()
{
return ObjectManager.Player.InventoryItems.Select(item => item.Id).ToList();
}
private static short GetPacketId(this IReadOnlyList<byte> data)
{
return (short)((data[1] << 8) | (data[0] << 0));
}
}
}
| 27.840426 | 94 | 0.537256 | [
"MIT"
] | Tingur/AGORAVAI | ARAMShopAI/BuyItemEvent.cs | 2,619 | C# |
// <auto-generated />
using System;
using ERP_Logistics.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ERP_Logistics.Migrations
{
[DbContext(typeof(StoreContext))]
[Migration("20201021200109_orderProducts2")]
partial class orderProducts2
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ERP_Logistics.Models.Address", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("City")
.HasColumnType("nvarchar(max)");
b.Property<string>("Country")
.HasColumnType("nvarchar(max)");
b.Property<string>("Door")
.HasColumnType("nvarchar(max)");
b.Property<string>("PostalCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("Street")
.HasColumnType("nvarchar(max)");
b.Property<int>("StreetNumber")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Addresses");
});
modelBuilder.Entity("ERP_Logistics.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClientId")
.HasColumnType("nvarchar(450)");
b.Property<DateTime?>("DateEnded")
.HasColumnType("datetime2");
b.Property<DateTime>("DateStarted")
.HasColumnType("datetime2");
b.Property<string>("EmployeeId")
.HasColumnType("nvarchar(450)");
b.Property<int>("State")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("EmployeeId");
b.ToTable("Orders");
});
modelBuilder.Entity("ERP_Logistics.Models.OrderProduct", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("OrderId")
.HasColumnType("int");
b.Property<int>("Quantity")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderProducts");
});
modelBuilder.Entity("ERP_Logistics.Models.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("Category")
.HasColumnType("int");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<int?>("OrderProductId")
.HasColumnType("int");
b.Property<int>("Price")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderProductId");
b.ToTable("Products");
});
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")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
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.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Discriminator")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
});
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(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
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(128)")
.HasMaxLength(128);
b.Property<string>("Name")
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("ERP_Logistics.Models.ApplicationUser", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.Property<int?>("AddressId")
.HasColumnType("int");
b.Property<string>("FullName")
.HasColumnType("nvarchar(max)");
b.Property<int>("Role")
.HasColumnType("int");
b.HasIndex("AddressId");
b.HasDiscriminator().HasValue("ApplicationUser");
});
modelBuilder.Entity("ERP_Logistics.Models.Employee", b =>
{
b.HasBaseType("ERP_Logistics.Models.ApplicationUser");
b.HasDiscriminator().HasValue("Employee");
});
modelBuilder.Entity("ERP_Logistics.Models.Order", b =>
{
b.HasOne("ERP_Logistics.Models.ApplicationUser", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId");
b.HasOne("ERP_Logistics.Models.Employee", "Employee")
.WithMany()
.HasForeignKey("EmployeeId");
});
modelBuilder.Entity("ERP_Logistics.Models.OrderProduct", b =>
{
b.HasOne("ERP_Logistics.Models.Order", "Order")
.WithMany("OrderProducts")
.HasForeignKey("OrderId");
});
modelBuilder.Entity("ERP_Logistics.Models.Product", b =>
{
b.HasOne("ERP_Logistics.Models.OrderProduct", null)
.WithMany("Products")
.HasForeignKey("OrderProductId");
});
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("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", 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("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ERP_Logistics.Models.ApplicationUser", b =>
{
b.HasOne("ERP_Logistics.Models.Address", "Address")
.WithMany()
.HasForeignKey("AddressId");
});
#pragma warning restore 612, 618
}
}
}
| 37.05765 | 125 | 0.461018 | [
"MIT"
] | Of3lia/OfiStore_ERP_Logistics | ERP_Logistics/Migrations/20201021200109_orderProducts2.Designer.cs | 16,715 | C# |
// Copyright (c) Josef Pihrt. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Xml.Linq;
namespace Snippetica.Xml
{
public static class XAttributeExtensions
{
public static string LocalName(this XAttribute attribute)
{
return attribute.Name.LocalName;
}
}
}
| 26.866667 | 160 | 0.694789 | [
"Apache-2.0"
] | JosefPihrt/Snippetica | src/Snippetica.Common/Xml/XAttributeExtensions.cs | 405 | C# |
namespace Microsoft.Azure.Management.StorSimple8000Series.Models
{
using Azure;
using Management;
using StorSimple8000Series;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Runtime;
using System.Runtime.Serialization;
/// <summary>
/// Defines values for DeviceConfigurationStatus.
/// </summary>
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public enum DeviceConfigurationStatus
{
[EnumMember(Value = "Complete")]
Complete,
[EnumMember(Value = "Pending")]
Pending
}
}
| 24.4 | 75 | 0.685246 | [
"MIT"
] | 0rland0Wats0n/azure-sdk-for-net | sdk/storsimple8000series/Microsoft.Azure.Management.StorSimple8000Series/src/Generated/Models/DeviceConfigurationStatus.cs | 610 | C# |
using System;
using Csla;
namespace ParentLoadROSoftDelete.Business.ERLevel
{
public partial class E09_CityColl
{
#region OnDeserialized actions
/*/// <summary>
/// This method is called on a newly deserialized object
/// after deserialization is complete.
/// </summary>
protected override void OnDeserialized()
{
base.OnDeserialized();
// add your custom OnDeserialized actions here.
}*/
#endregion
#region Implementation of DataPortal Hooks
//partial void OnFetchPre(DataPortalHookArgs args)
//{
// throw new NotImplementedException();
//}
//partial void OnFetchPost(DataPortalHookArgs args)
//{
// throw new NotImplementedException();
//}
#endregion
}
}
| 23.051282 | 65 | 0.562848 | [
"MIT"
] | CslaGenFork/CslaGenFork | trunk/Samples/DeepLoad/ParentLoadROSoftDelete.Business/ERLevel/E09_CityColl.cs | 899 | C# |
namespace ClothingStore.Server.Data.Configurations
{
using Data.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using static Infrastructure.EntityConfigConstants;
public class PictureConfig : IEntityTypeConfiguration<Picture>
{
public void Configure(EntityTypeBuilder<Picture> builder)
{
builder
.HasKey(p => p.Id);
builder
.Property(p => p.PicturePath)
.IsRequired()
.HasMaxLength(PicturePathMaxLength);
}
}
}
| 25.333333 | 66 | 0.626645 | [
"MIT"
] | deyanstoyanov10/Clothes-Store | ClothingStore.Server/ClothingStore.Server/Data/Configurations/PictureConfig.cs | 610 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;
using NUnit.Framework;
namespace WEbAddressbookTests
{
public class GroupHelper:HelperBase
{
public GroupHelper(ApplicationManager manager):base(manager)
{
}
public GroupHelper Create(GroupData group)
{
manager.Navigator.GoToGroupPage();
InitGroupCreation();
FillGroupForm(group);
SubmitCreation();
ReturnToGroupsPage();
return this;
}
public GroupHelper Modify(int p, GroupData newData)
{
manager.Navigator.GoToGroupPage();
SelectGroup(p);
InitGroupModification();
FillGroupForm(newData);
SubmitGroupModification();
ReturnToGroupsPage();
return this;
}
public GroupHelper Remove(int p)
{
manager.Navigator.GoToGroupPage();
SelectGroup(p);
RemoveGroup();
ReturnToGroupsPage();
return this;
}
public GroupHelper CreateIfNeed(int index)
{
manager.Navigator.GoToGroupPage();
if (!IsElementPresent(By.XPath("(//input[@name='selected[]'])[" + (index+1) + "]")))
{
GroupData neu = new GroupData("bbb");
Create(neu);
}
return this;
}
public GroupHelper ReturnToGroupsPage()
{
driver.FindElement(By.LinkText("groups")).Click();
return this;
}
public GroupHelper InitGroupCreation()
{
driver.FindElement(By.Name("new")).Click();
return this;
}
public int GetGroupCount()
{
return driver.FindElements(By.CssSelector("span.group")).Count;
}
public GroupHelper FillGroupForm(GroupData group)
{
Type(By.Name("group_name"), group.Name);
Type(By.Name("group_header"), group.Header);
Type(By.Name("group_footer"), group.Footer);
return this;
}
public GroupHelper SubmitCreation()
{
driver.FindElement(By.Name("submit")).Click();
groupCache = null;
return this;
}
public GroupHelper SelectGroup(int index)
{
driver.FindElement(By.XPath("(//input[@name='selected[]'])[" + (index+1) + "]")).Click();
return this;
}
public GroupHelper RemoveGroup()
{
driver.FindElement(By.Name("delete")).Click();
groupCache = null;
return this;
}
public GroupHelper SubmitGroupModification()
{
driver.FindElement(By.Name("update")).Click();
groupCache = null;
return this;
}
public GroupHelper InitGroupModification()
{
driver.FindElement(By.Name("edit")).Click();
return this;
}
private List <GroupData> groupCache = null;
public List<GroupData> GetGroupList()
{
if (groupCache == null)
{
groupCache = new List<GroupData>();
manager.Navigator.GoToGroupPage();
ICollection<IWebElement> elements = driver.FindElements(By.CssSelector("span.group"));
foreach (IWebElement element in elements)
{
groupCache.Add(new GroupData(null)
{
Id = element.FindElement(By.TagName("input")).GetAttribute("value")
});
}
string allGroupNames = driver.FindElement(By.CssSelector("div#content")).Text;
string [] parts = allGroupNames.Split('\n');
int shift = groupCache.Count - parts.Length;
for (int i = 0; i < groupCache.Count; i++)
{
if (i<shift)
{
groupCache[i].Name = "";
}
else
{
groupCache[i].Name = parts[i-shift].Trim();
}
}
}
return new List<GroupData> (groupCache);
}
}
}
| 29.632258 | 102 | 0.49619 | [
"Apache-2.0"
] | violettasmirnov/csharp_training | addressbook-web-tests/addressbook-web-tests/appmanager/GroupHelper.cs | 4,595 | C# |
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WordCount.WebService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WordCount.WebService")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("84ef84ad-13f8-48af-b1a9-cd464d52474c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] | 38.909091 | 100 | 0.668224 | [
"MIT"
] | kbulte/service-fabric-dotnet-getting-started | Services/WordCount/WordCount.WebService/Properties/AssemblyInfo.cs | 1,715 | C# |
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace Reddit.Things
{
[Serializable]
public class ImageUploadResult
{
[JsonProperty("errors")]
public List<string> Errors;
[JsonProperty("img_src")]
public string ImgSrc;
[JsonProperty("errors_values")]
public List<string> ErrorsValues;
}
}
| 19.2 | 41 | 0.651042 | [
"MIT"
] | EmielD/Reddit.NET | src/Reddit.NET/Things/ImageUploadResult.cs | 386 | C# |
// <auto-generated/>
#pragma warning disable 1591
namespace Test
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
}
#pragma warning restore 219
#pragma warning disable 0414
private static System.Object __o = null;
#pragma warning restore 0414
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder)
{
__o = Microsoft.AspNetCore.Components.RuntimeHelpers.TypeCheck<System.String>(Microsoft.AspNetCore.Components.BindMethods.GetValue(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
person.Name
#line default
#line hidden
#nullable disable
));
__o = new System.Action<System.String>(
__value => person.Name = __value);
builder.AddAttribute(-1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builder2) => {
}
));
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
__o = typeof(InputText);
#line default
#line hidden
#nullable disable
}
#pragma warning restore 1998
#nullable restore
#line 4 "x:\dir\subdir\Test\TestComponent.cshtml"
Person person = new Person();
#line default
#line hidden
#nullable disable
}
}
#pragma warning restore 1591
| 29.491228 | 143 | 0.681737 | [
"Apache-2.0"
] | baulig/AspNetCore-Tooling | src/Razor/test/RazorLanguage.Test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs | 1,681 | C# |
//
// Author:
// Aaron Bockover <abock@xamarin.com>
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Xamarin.Interactive.CodeAnalysis;
using Xamarin.Interactive.Events;
namespace Xamarin.Interactive.Editor.Events
{
sealed class ChangeEvent : EditorEvent, IDocumentDirtyEvent
{
public string Text { get; }
public ChangeEvent (IEditor source) : base (source)
{
}
public ChangeEvent (IEditor source, string text)
: base (source)
=> Text = text;
}
} | 23.32 | 63 | 0.650086 | [
"MIT"
] | Bhaskers-Blu-Org2/workbooks | Clients/Xamarin.Interactive.Client/Editor/Events/ChangeEvent.cs | 583 | 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 PutProduct.Data;
#nullable disable
namespace PutProduct.Data.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20220426232954_AddBalanceToUser1")]
partial class AddBalanceToUser1
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.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", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.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", (string)null);
});
modelBuilder.Entity("PutProduct.Data.Comment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<DateTime>("CommentDateTime")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime2");
b.Property<string>("DeletedBy")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("DeletedOn")
.HasColumnType("datetime2");
b.Property<string>("Message")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("ModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("ModifiedOn")
.HasColumnType("datetime2");
b.Property<int>("ProductId")
.HasColumnType("int");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("ProductId");
b.HasIndex("UserId");
b.ToTable("Comments");
});
modelBuilder.Entity("PutProduct.Data.Migrations.Discount", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<double>("DiscountValue")
.HasColumnType("float");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Discounts");
});
modelBuilder.Entity("PutProduct.Data.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int?>("DiscountId")
.HasColumnType("int");
b.Property<DateTime>("OrderTime")
.HasColumnType("datetime2");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<decimal>("totalPrice")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("DiscountId");
b.HasIndex("UserId");
b.ToTable("Orders");
});
modelBuilder.Entity("PutProduct.Data.OrderProducts", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("ProductId")
.HasColumnType("int");
b.Property<int>("qty")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProductId");
b.ToTable("OrderProducts");
});
modelBuilder.Entity("PutProduct.Data.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("CategoryId")
.HasColumnType("int");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime2");
b.Property<string>("DeletedBy")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("DeletedOn")
.HasColumnType("datetime2");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ImageUrl")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("ModifiedOn")
.HasColumnType("datetime2");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Products");
});
modelBuilder.Entity("PutProduct.Data.User", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<decimal>("Balance")
.HasColumnType("decimal(18,2)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("PutProduct.Data.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("PutProduct.Data.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("PutProduct.Data.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("PutProduct.Data.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PutProduct.Data.Comment", b =>
{
b.HasOne("PutProduct.Data.Product", "Product")
.WithMany("Comments")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PutProduct.Data.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("User");
});
modelBuilder.Entity("PutProduct.Data.Order", b =>
{
b.HasOne("PutProduct.Data.Migrations.Discount", "Discount")
.WithMany()
.HasForeignKey("DiscountId");
b.HasOne("PutProduct.Data.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Discount");
b.Navigation("User");
});
modelBuilder.Entity("PutProduct.Data.OrderProducts", b =>
{
b.HasOne("PutProduct.Data.Order", null)
.WithMany("OrderProducts")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PutProduct.Data.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
});
modelBuilder.Entity("PutProduct.Data.Product", b =>
{
b.HasOne("PutProduct.Data.User", "User")
.WithMany("Products")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("PutProduct.Data.User", b =>
{
b.OwnsOne("PutProduct.Data.Profile", "profile", b1 =>
{
b1.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b1.Property<string>("Bio")
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b1.Property<string>("EmailAddress")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.Property<string>("ImageUrl")
.HasColumnType("nvarchar(max)");
b1.Property<string>("Location")
.HasColumnType("nvarchar(max)");
b1.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.Property<string>("Website")
.HasColumnType("nvarchar(max)");
b1.HasKey("UserId");
b1.ToTable("AspNetUsers");
b1.WithOwner()
.HasForeignKey("UserId");
});
b.Navigation("profile")
.IsRequired();
});
modelBuilder.Entity("PutProduct.Data.Order", b =>
{
b.Navigation("OrderProducts");
});
modelBuilder.Entity("PutProduct.Data.Product", b =>
{
b.Navigation("Comments");
});
modelBuilder.Entity("PutProduct.Data.User", b =>
{
b.Navigation("Products");
});
#pragma warning restore 612, 618
}
}
}
| 35.761499 | 103 | 0.433927 | [
"Apache-2.0"
] | mohamedabotir/PutProduct | PutProduct/Data/Migrations/20220426232954_AddBalanceToUser1.Designer.cs | 20,994 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MixERP.Net.Core.Modules.Finance.Setup {
public partial class PaymentCards {
}
}
| 29.25 | 81 | 0.429487 | [
"MPL-2.0"
] | asine/mixerp | src/FrontEnd/Modules/Finance/Setup/PaymentCards.ascx.designer.cs | 470 | C# |
using Codeable.Foundation.Core;
using System;
using System.Collections.Generic;
using System.Text;
namespace Stencil.Domain
{
public partial class PaymentDetail : DomainModel
{
public PaymentDetail()
{
}
public Guid paymentdetail_id { get; set; }
public Guid account_id { get; set; }
public CardType card_type { get; set; }
public string card_number { get; set; }
public DateTime expire_date { get; set; }
public int cvv { get; set; }
public DateTime created_utc { get; set; }
public DateTime updated_utc { get; set; }
public DateTime? deleted_utc { get; set; }
public DateTime? sync_success_utc { get; set; }
public DateTime? sync_invalid_utc { get; set; }
public DateTime? sync_attempt_utc { get; set; }
public string sync_agent { get; set; }
public string sync_log { get; set; }
}
}
| 28.636364 | 55 | 0.619048 | [
"MIT"
] | DanMasterson1/stencil | Source/Stencil.Server/Stencil.Domain/Domain/PaymentDetail.cs | 945 | 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.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Microsoft.AspNet.Mvc.Abstractions;
using Microsoft.AspNet.Mvc.ActionConstraints;
using Microsoft.AspNet.Mvc.ApiExplorer;
using Microsoft.AspNet.Mvc.ApplicationModels;
using Microsoft.AspNet.Mvc.Core;
using Microsoft.AspNet.Mvc.Filters;
using Microsoft.AspNet.Mvc.Infrastructure;
using Microsoft.AspNet.Mvc.Routing;
using Microsoft.AspNet.Routing.Tree;
namespace Microsoft.AspNet.Mvc.Controllers
{
/// <summary>
/// Creates instances of <see cref="ControllerActionDescriptor"/> from <see cref="ApplicationModel"/>.
/// </summary>
public static class ControllerActionDescriptorBuilder
{
// This is the default order for attribute routes whose order calculated from
// the controller model is null.
private const int DefaultAttributeRouteOrder = 0;
/// <summary>
/// Creates instances of <see cref="ControllerActionDescriptor"/> from <see cref="ApplicationModel"/>.
/// </summary>
/// <param name="application">The <see cref="ApplicationModel"/>.</param>
/// <returns>The list of <see cref="ControllerActionDescriptor"/>.</returns>
public static IList<ControllerActionDescriptor> Build(ApplicationModel application)
{
var actions = new List<ControllerActionDescriptor>();
var hasAttributeRoutes = false;
var removalConstraints = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var methodInfoMap = new MethodToActionMap();
var routeTemplateErrors = new List<string>();
var attributeRoutingConfigurationErrors = new Dictionary<MethodInfo, string>();
foreach (var controller in application.Controllers)
{
// Only add properties which are explictly marked to bind.
// The attribute check is required for ModelBinder attribute.
var controllerPropertyDescriptors = controller.ControllerProperties
.Where(p => p.BindingInfo != null)
.Select(CreateParameterDescriptor)
.ToList();
foreach (var action in controller.Actions)
{
// Controllers with multiple [Route] attributes (or user defined implementation of
// IRouteTemplateProvider) will generate one action descriptor per IRouteTemplateProvider
// instance.
// Actions with multiple [Http*] attributes or other (IRouteTemplateProvider implementations
// have already been identified as different actions during action discovery.
var actionDescriptors = CreateActionDescriptors(application, controller, action);
foreach (var actionDescriptor in actionDescriptors)
{
actionDescriptor.ControllerName = controller.ControllerName;
actionDescriptor.ControllerTypeInfo = controller.ControllerType;
AddApiExplorerInfo(actionDescriptor, application, controller, action);
AddRouteConstraints(removalConstraints, actionDescriptor, controller, action);
AddProperties(actionDescriptor, action, controller, application);
actionDescriptor.BoundProperties = controllerPropertyDescriptors;
if (IsAttributeRoutedAction(actionDescriptor))
{
hasAttributeRoutes = true;
// An attribute routed action will ignore conventional routed constraints. We still
// want to provide these values as ambient values for link generation.
AddConstraintsAsDefaultRouteValues(actionDescriptor);
// Replaces tokens like [controller]/[action] in the route template with the actual values
// for this action.
ReplaceAttributeRouteTokens(actionDescriptor, routeTemplateErrors);
// Attribute routed actions will ignore conventional routed constraints. Instead they have
// a single route constraint "RouteGroup" associated with it.
ReplaceRouteConstraints(actionDescriptor);
}
}
methodInfoMap.AddToMethodInfo(action, actionDescriptors);
actions.AddRange(actionDescriptors);
}
}
var actionsByRouteName = new Dictionary<string, IList<ActionDescriptor>>(
StringComparer.OrdinalIgnoreCase);
// Keeps track of all the methods that we've validated to avoid visiting each action group
// more than once.
var validatedMethods = new HashSet<MethodInfo>();
foreach (var actionDescriptor in actions)
{
if (!validatedMethods.Contains(actionDescriptor.MethodInfo))
{
ValidateActionGroupConfiguration(
methodInfoMap,
actionDescriptor,
attributeRoutingConfigurationErrors);
validatedMethods.Add(actionDescriptor.MethodInfo);
}
if (!IsAttributeRoutedAction(actionDescriptor))
{
// Any attribute routes are in use, then non-attribute-routed action descriptors can't be
// selected when a route group returned by the route.
if (hasAttributeRoutes)
{
actionDescriptor.RouteConstraints.Add(new RouteDataActionConstraint(
TreeRouter.RouteGroupKey,
string.Empty));
}
// Add a route constraint with DenyKey for each constraint in the set to all the
// actions that don't have that constraint. For example, if a controller defines
// an area constraint, all actions that don't belong to an area must have a route
// constraint that prevents them from matching an incomming request.
AddRemovalConstraints(actionDescriptor, removalConstraints);
}
else
{
var attributeRouteInfo = actionDescriptor.AttributeRouteInfo;
if (attributeRouteInfo.Name != null)
{
// Build a map of attribute route name to action descriptors to ensure that all
// attribute routes with a given name have the same template.
AddActionToNamedGroup(actionsByRouteName, attributeRouteInfo.Name, actionDescriptor);
}
// We still want to add a 'null' for any constraint with DenyKey so that link generation
// works properly.
//
// Consider an action like { area = "", controller = "Home", action = "Index" }. Even if
// it's attribute routed, it needs to know that area must be null to generate a link.
foreach (var key in removalConstraints)
{
if (!actionDescriptor.RouteValueDefaults.ContainsKey(key))
{
actionDescriptor.RouteValueDefaults.Add(key, value: null);
}
}
}
}
if (attributeRoutingConfigurationErrors.Any())
{
var message = CreateAttributeRoutingAggregateErrorMessage(
attributeRoutingConfigurationErrors.Values);
throw new InvalidOperationException(message);
}
var namedRoutedErrors = ValidateNamedAttributeRoutedActions(actionsByRouteName);
if (namedRoutedErrors.Any())
{
var message = CreateAttributeRoutingAggregateErrorMessage(namedRoutedErrors);
throw new InvalidOperationException(message);
}
if (routeTemplateErrors.Any())
{
var message = CreateAttributeRoutingAggregateErrorMessage(routeTemplateErrors);
throw new InvalidOperationException(message);
}
return actions;
}
private static IList<ControllerActionDescriptor> CreateActionDescriptors(
ApplicationModel application,
ControllerModel controller,
ActionModel action)
{
var actionDescriptors = new List<ControllerActionDescriptor>();
// We check the action to see if the template allows combination behavior
// (It doesn't start with / or ~/) so that in the case where we have multiple
// [Route] attributes on the controller we don't end up creating multiple
if (action.AttributeRouteModel != null &&
action.AttributeRouteModel.IsAbsoluteTemplate)
{
// We're overriding the attribute routes on the controller, so filter out any metadata
// from controller level routes.
var actionDescriptor = CreateActionDescriptor(
action,
controllerAttributeRoute: null);
actionDescriptors.Add(actionDescriptor);
// If we're using an attribute route on the controller, then filter out any additional
// metadata from the 'other' attribute routes.
var controllerFilters = controller.Filters
.Where(c => !(c is IRouteTemplateProvider));
AddActionFilters(actionDescriptor, action.Filters, controllerFilters, application.Filters);
var controllerConstraints = controller.ActionConstraints
.Where(c => !(c is IRouteTemplateProvider));
AddActionConstraints(actionDescriptor, action, controllerConstraints);
}
else if (controller.AttributeRoutes != null &&
controller.AttributeRoutes.Count > 0)
{
// We're using the attribute routes from the controller
foreach (var controllerAttributeRoute in controller.AttributeRoutes)
{
var actionDescriptor = CreateActionDescriptor(
action,
controllerAttributeRoute);
actionDescriptors.Add(actionDescriptor);
// If we're using an attribute route on the controller, then filter out any additional
// metadata from the 'other' attribute routes.
var controllerFilters = controller.Filters
.Where(c => c == controllerAttributeRoute?.Attribute || !(c is IRouteTemplateProvider));
AddActionFilters(actionDescriptor, action.Filters, controllerFilters, application.Filters);
var controllerConstraints = controller.ActionConstraints
.Where(c => c == controllerAttributeRoute?.Attribute || !(c is IRouteTemplateProvider));
AddActionConstraints(actionDescriptor, action, controllerConstraints);
}
}
else
{
// No attribute routes on the controller
var actionDescriptor = CreateActionDescriptor(
action,
controllerAttributeRoute: null);
actionDescriptors.Add(actionDescriptor);
// If there's no attribute route on the controller, then we can use all of the filters/constraints
// on the controller.
AddActionFilters(actionDescriptor, action.Filters, controller.Filters, application.Filters);
AddActionConstraints(actionDescriptor, action, controller.ActionConstraints);
}
return actionDescriptors;
}
private static ControllerActionDescriptor CreateActionDescriptor(
ActionModel action,
AttributeRouteModel controllerAttributeRoute)
{
var parameterDescriptors = new List<ParameterDescriptor>();
foreach (var parameter in action.Parameters)
{
var parameterDescriptor = CreateParameterDescriptor(parameter);
parameterDescriptors.Add(parameterDescriptor);
}
var attributeRouteInfo = CreateAttributeRouteInfo(
action.AttributeRouteModel,
controllerAttributeRoute);
var actionDescriptor = new ControllerActionDescriptor()
{
Name = action.ActionName,
MethodInfo = action.ActionMethod,
Parameters = parameterDescriptors,
RouteConstraints = new List<RouteDataActionConstraint>(),
AttributeRouteInfo = attributeRouteInfo,
};
actionDescriptor.DisplayName = string.Format(
CultureInfo.InvariantCulture,
"{0}.{1}",
action.ActionMethod.DeclaringType.FullName,
action.ActionMethod.Name);
return actionDescriptor;
}
private static ParameterDescriptor CreateParameterDescriptor(ParameterModel parameterModel)
{
var parameterDescriptor = new ControllerParameterDescriptor()
{
Name = parameterModel.ParameterName,
ParameterType = parameterModel.ParameterInfo.ParameterType,
BindingInfo = parameterModel.BindingInfo,
ParameterInfo = parameterModel.ParameterInfo,
};
return parameterDescriptor;
}
private static ParameterDescriptor CreateParameterDescriptor(PropertyModel propertyModel)
{
var parameterDescriptor = new ControllerBoundPropertyDescriptor()
{
BindingInfo = propertyModel.BindingInfo,
Name = propertyModel.PropertyName,
ParameterType = propertyModel.PropertyInfo.PropertyType,
PropertyInfo = propertyModel.PropertyInfo,
};
return parameterDescriptor;
}
private static void AddApiExplorerInfo(
ControllerActionDescriptor actionDescriptor,
ApplicationModel application,
ControllerModel controller,
ActionModel action)
{
var isVisible =
action.ApiExplorer?.IsVisible ??
controller.ApiExplorer?.IsVisible ??
application.ApiExplorer?.IsVisible ??
false;
var isVisibleSetOnActionOrController =
action.ApiExplorer?.IsVisible ??
controller.ApiExplorer?.IsVisible ??
false;
// ApiExplorer isn't supported on conventional-routed actions, but we still allow you to configure
// it at the application level when you have a mix of controller types. We'll just skip over enabling
// ApiExplorer for conventional-routed controllers when this happens.
var isVisibleSetOnApplication = application.ApiExplorer?.IsVisible ?? false;
if (isVisibleSetOnActionOrController && !IsAttributeRoutedAction(actionDescriptor))
{
// ApiExplorer is only supported on attribute routed actions.
throw new InvalidOperationException(Resources.FormatApiExplorer_UnsupportedAction(
actionDescriptor.DisplayName));
}
else if (isVisibleSetOnApplication && !IsAttributeRoutedAction(actionDescriptor))
{
// This is the case where we're going to be lenient, just ignore it.
}
else if (isVisible)
{
Debug.Assert(IsAttributeRoutedAction(actionDescriptor));
var apiExplorerActionData = new ApiDescriptionActionData()
{
GroupName = action.ApiExplorer?.GroupName ?? controller.ApiExplorer?.GroupName,
};
actionDescriptor.SetProperty(apiExplorerActionData);
}
}
private static void AddProperties(
ControllerActionDescriptor actionDescriptor,
ActionModel action,
ControllerModel controller,
ApplicationModel application)
{
foreach (var item in application.Properties)
{
actionDescriptor.Properties[item.Key] = item.Value;
}
foreach (var item in controller.Properties)
{
actionDescriptor.Properties[item.Key] = item.Value;
}
foreach (var item in action.Properties)
{
actionDescriptor.Properties[item.Key] = item.Value;
}
}
private static void AddActionFilters(
ControllerActionDescriptor actionDescriptor,
IEnumerable<IFilterMetadata> actionFilters,
IEnumerable<IFilterMetadata> controllerFilters,
IEnumerable<IFilterMetadata> globalFilters)
{
actionDescriptor.FilterDescriptors =
actionFilters.Select(f => new FilterDescriptor(f, FilterScope.Action))
.Concat(controllerFilters.Select(f => new FilterDescriptor(f, FilterScope.Controller)))
.Concat(globalFilters.Select(f => new FilterDescriptor(f, FilterScope.Global)))
.OrderBy(d => d, FilterDescriptorOrderComparer.Comparer)
.ToList();
}
private static AttributeRouteInfo CreateAttributeRouteInfo(
AttributeRouteModel action,
AttributeRouteModel controller)
{
var combinedRoute = AttributeRouteModel.CombineAttributeRouteModel(
controller,
action);
if (combinedRoute == null)
{
return null;
}
else
{
return new AttributeRouteInfo()
{
Template = combinedRoute.Template,
Order = combinedRoute.Order ?? DefaultAttributeRouteOrder,
Name = combinedRoute.Name,
};
}
}
private static void AddActionConstraints(
ControllerActionDescriptor actionDescriptor,
ActionModel action,
IEnumerable<IActionConstraintMetadata> controllerConstraints)
{
var constraints = new List<IActionConstraintMetadata>();
var httpMethods = action.HttpMethods;
if (httpMethods != null && httpMethods.Count > 0)
{
constraints.Add(new HttpMethodConstraint(httpMethods));
}
if (action.ActionConstraints != null)
{
constraints.AddRange(action.ActionConstraints);
}
if (controllerConstraints != null)
{
constraints.AddRange(controllerConstraints);
}
if (constraints.Count > 0)
{
actionDescriptor.ActionConstraints = constraints;
}
}
public static void AddRouteConstraints(
ISet<string> removalConstraints,
ControllerActionDescriptor actionDescriptor,
ControllerModel controller,
ActionModel action)
{
// Apply all the constraints defined on the action, then controller (for example, [Area])
// to the actions. Also keep track of all the constraints that require preventing actions
// without the constraint to match. For example, actions without an [Area] attribute on their
// controller should not match when a value has been given for area when matching a url or
// generating a link.
foreach (var constraintAttribute in action.RouteConstraints)
{
if (constraintAttribute.BlockNonAttributedActions)
{
removalConstraints.Add(constraintAttribute.RouteKey);
}
// Skip duplicates
if (!HasConstraint(actionDescriptor.RouteConstraints, constraintAttribute.RouteKey))
{
actionDescriptor.RouteConstraints.Add(new RouteDataActionConstraint(
constraintAttribute.RouteKey,
constraintAttribute.RouteValue));
}
}
foreach (var constraintAttribute in controller.RouteConstraints)
{
if (constraintAttribute.BlockNonAttributedActions)
{
removalConstraints.Add(constraintAttribute.RouteKey);
}
// Skip duplicates - this also means that a value on the action will take precedence
if (!HasConstraint(actionDescriptor.RouteConstraints, constraintAttribute.RouteKey))
{
actionDescriptor.RouteConstraints.Add(new RouteDataActionConstraint(
constraintAttribute.RouteKey,
constraintAttribute.RouteValue));
}
}
// Lastly add the 'default' values
if (!HasConstraint(actionDescriptor.RouteConstraints, "action"))
{
actionDescriptor.RouteConstraints.Add(new RouteDataActionConstraint(
"action",
action.ActionName ?? string.Empty));
}
if (!HasConstraint(actionDescriptor.RouteConstraints, "controller"))
{
actionDescriptor.RouteConstraints.Add(new RouteDataActionConstraint(
"controller",
controller.ControllerName));
}
}
private static bool HasConstraint(IList<RouteDataActionConstraint> constraints, string routeKey)
{
return constraints.Any(
rc => string.Equals(rc.RouteKey, routeKey, StringComparison.OrdinalIgnoreCase));
}
private static void ReplaceRouteConstraints(ControllerActionDescriptor actionDescriptor)
{
var routeGroupValue = GetRouteGroupValue(
actionDescriptor.AttributeRouteInfo.Order,
actionDescriptor.AttributeRouteInfo.Template);
var routeConstraints = new List<RouteDataActionConstraint>();
routeConstraints.Add(new RouteDataActionConstraint(
TreeRouter.RouteGroupKey,
routeGroupValue));
actionDescriptor.RouteConstraints = routeConstraints;
}
private static void ReplaceAttributeRouteTokens(
ControllerActionDescriptor actionDescriptor,
IList<string> routeTemplateErrors)
{
try
{
actionDescriptor.AttributeRouteInfo.Template = AttributeRouteModel.ReplaceTokens(
actionDescriptor.AttributeRouteInfo.Template,
actionDescriptor.RouteValueDefaults);
if (actionDescriptor.AttributeRouteInfo.Name != null)
{
actionDescriptor.AttributeRouteInfo.Name = AttributeRouteModel.ReplaceTokens(
actionDescriptor.AttributeRouteInfo.Name,
actionDescriptor.RouteValueDefaults);
}
}
catch (InvalidOperationException ex)
{
// Routing will throw an InvalidOperationException here if we can't parse/replace tokens
// in the template.
var message = Resources.FormatAttributeRoute_IndividualErrorMessage(
actionDescriptor.DisplayName,
Environment.NewLine,
ex.Message);
routeTemplateErrors.Add(message);
}
}
private static void AddConstraintsAsDefaultRouteValues(ControllerActionDescriptor actionDescriptor)
{
foreach (var constraint in actionDescriptor.RouteConstraints)
{
// We don't need to do anything with attribute routing for 'catch all' behavior. Order
// and predecedence of attribute routes allow this kind of behavior.
if (constraint.KeyHandling == RouteKeyHandling.RequireKey ||
constraint.KeyHandling == RouteKeyHandling.DenyKey)
{
actionDescriptor.RouteValueDefaults.Add(constraint.RouteKey, constraint.RouteValue);
}
}
}
private static void AddRemovalConstraints(
ControllerActionDescriptor actionDescriptor,
ISet<string> removalConstraints)
{
foreach (var key in removalConstraints)
{
if (!HasConstraint(actionDescriptor.RouteConstraints, key))
{
actionDescriptor.RouteConstraints.Add(new RouteDataActionConstraint(
key,
string.Empty));
}
}
}
private static void AddActionToNamedGroup(
IDictionary<string, IList<ActionDescriptor>> actionsByRouteName,
string routeName,
ControllerActionDescriptor actionDescriptor)
{
IList<ActionDescriptor> namedActionGroup;
if (actionsByRouteName.TryGetValue(routeName, out namedActionGroup))
{
namedActionGroup.Add(actionDescriptor);
}
else
{
namedActionGroup = new List<ActionDescriptor>();
namedActionGroup.Add(actionDescriptor);
actionsByRouteName.Add(routeName, namedActionGroup);
}
}
private static bool IsAttributeRoutedAction(ControllerActionDescriptor actionDescriptor)
{
return actionDescriptor.AttributeRouteInfo?.Template != null;
}
private static IList<string> AddErrorNumbers(
IEnumerable<string> namedRoutedErrors)
{
return namedRoutedErrors
.Select((error, i) =>
Resources.FormatAttributeRoute_AggregateErrorMessage_ErrorNumber(
i + 1,
Environment.NewLine,
error))
.ToList();
}
private static IList<string> ValidateNamedAttributeRoutedActions(
IDictionary<string,
IList<ActionDescriptor>> actionsGroupedByRouteName)
{
var namedRouteErrors = new List<string>();
foreach (var kvp in actionsGroupedByRouteName)
{
// We are looking for attribute routed actions that have the same name but
// different route templates. We pick the first template of the group and
// we compare it against the rest of the templates that have that same name
// associated.
// The moment we find one that is different we report the whole group to the
// user in the error message so that he can see the different actions and the
// different templates for a given named attribute route.
var firstActionDescriptor = kvp.Value[0];
var firstTemplate = firstActionDescriptor.AttributeRouteInfo.Template;
for (var i = 1; i < kvp.Value.Count; i++)
{
var otherActionDescriptor = kvp.Value[i];
var otherActionTemplate = otherActionDescriptor.AttributeRouteInfo.Template;
if (!firstTemplate.Equals(otherActionTemplate, StringComparison.OrdinalIgnoreCase))
{
var descriptions = kvp.Value.Select(ad =>
Resources.FormatAttributeRoute_DuplicateNames_Item(
ad.DisplayName,
ad.AttributeRouteInfo.Template));
var errorDescription = string.Join(Environment.NewLine, descriptions);
var message = Resources.FormatAttributeRoute_DuplicateNames(
kvp.Key,
Environment.NewLine,
errorDescription);
namedRouteErrors.Add(message);
break;
}
}
}
return namedRouteErrors;
}
private static void ValidateActionGroupConfiguration(
IDictionary<MethodInfo, IDictionary<ActionModel, IList<ControllerActionDescriptor>>> methodMap,
ControllerActionDescriptor actionDescriptor,
IDictionary<MethodInfo, string> routingConfigurationErrors)
{
var hasAttributeRoutedActions = false;
var hasConventionallyRoutedActions = false;
var actionsForMethod = methodMap[actionDescriptor.MethodInfo];
foreach (var reflectedAction in actionsForMethod)
{
foreach (var action in reflectedAction.Value)
{
if (IsAttributeRoutedAction(action))
{
hasAttributeRoutedActions = true;
}
else
{
hasConventionallyRoutedActions = true;
}
}
}
// Validate that no method result in attribute and non attribute actions at the same time.
// By design, mixing attribute and conventionally actions in the same method is not allowed.
//
// This for example:
//
// [HttpGet]
// [HttpPost("Foo")]
// public void Foo() { }
if (hasAttributeRoutedActions && hasConventionallyRoutedActions)
{
var message = CreateMixedRoutedActionDescriptorsErrorMessage(
actionDescriptor,
actionsForMethod);
routingConfigurationErrors.Add(actionDescriptor.MethodInfo, message);
}
}
private static string CreateMixedRoutedActionDescriptorsErrorMessage(
ControllerActionDescriptor actionDescriptor,
IDictionary<ActionModel, IList<ControllerActionDescriptor>> actionsForMethod)
{
// Text to show as the attribute route template for conventionally routed actions.
var nullTemplate = Resources.AttributeRoute_NullTemplateRepresentation;
var actionDescriptions = new List<string>();
foreach (var action in actionsForMethod.SelectMany(kvp => kvp.Value))
{
var routeTemplate = action.AttributeRouteInfo?.Template ?? nullTemplate;
var verbs = action.ActionConstraints.OfType<HttpMethodConstraint>().FirstOrDefault()?.HttpMethods;
var formattedVerbs = string.Join(", ", verbs.OrderBy(v => v, StringComparer.Ordinal));
var description =
Resources.FormatAttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod_Item(
action.DisplayName,
routeTemplate,
formattedVerbs);
actionDescriptions.Add(description);
}
var methodFullName = string.Format(
CultureInfo.InvariantCulture,
"{0}.{1}",
actionDescriptor.MethodInfo.DeclaringType.FullName,
actionDescriptor.MethodInfo.Name);
// Sample error message:
//
// A method 'MyApplication.CustomerController.Index' must not define attributed actions and
// non attributed actions at the same time:
// Action: 'MyApplication.CustomerController.Index' - Route Template: 'Products' - HTTP Verbs: 'PUT'
// Action: 'MyApplication.CustomerController.Index' - Route Template: '(none)' - HTTP Verbs: 'POST'
//
// Use 'AcceptVerbsAttribute' to create a single route that allows multiple HTTP verbs and defines a route,
// or set a route template in all attributes that constrain HTTP verbs.
return
Resources.FormatAttributeRoute_MixedAttributeAndConventionallyRoutedActions_ForMethod(
methodFullName,
Environment.NewLine,
string.Join(Environment.NewLine, actionDescriptions));
}
private static string CreateAttributeRoutingAggregateErrorMessage(
IEnumerable<string> individualErrors)
{
var errorMessages = AddErrorNumbers(individualErrors);
var message = Resources.FormatAttributeRoute_AggregateErrorMessage(
Environment.NewLine,
string.Join(Environment.NewLine + Environment.NewLine, errorMessages));
return message;
}
private static string GetRouteGroupValue(int order, string template)
{
var group = string.Format(CultureInfo.InvariantCulture, "{0}-{1}", order, template);
return ("__route__" + group).ToUpperInvariant();
}
// We need to build a map of methods to reflected actions and reflected actions to
// action descriptors so that we can validate later that no method produced attribute
// and non attributed actions at the same time, and that no method that produced attribute
// routed actions has no attributes that implement IActionHttpMethodProvider and do not
// implement IRouteTemplateProvider. For example:
//
// public class ProductsController
// {
// [HttpGet("Products")]
// [HttpPost]
// public ActionResult Items(){ ... }
//
// [HttpGet("Products")]
// [CustomHttpMethods("POST, PUT")]
// public ActionResult List(){ ... }
// }
private class MethodToActionMap :
Dictionary<MethodInfo, IDictionary<ActionModel, IList<ControllerActionDescriptor>>>
{
public void AddToMethodInfo(
ActionModel action,
IList<ControllerActionDescriptor> actionDescriptors)
{
IDictionary<ActionModel, IList<ControllerActionDescriptor>> actionsForMethod = null;
if (TryGetValue(action.ActionMethod, out actionsForMethod))
{
actionsForMethod.Add(action, actionDescriptors);
}
else
{
var reflectedActionMap =
new Dictionary<ActionModel, IList<ControllerActionDescriptor>>();
reflectedActionMap.Add(action, actionDescriptors);
Add(action.ActionMethod, reflectedActionMap);
}
}
}
}
} | 44.481436 | 119 | 0.584875 | [
"Apache-2.0"
] | corefan/Mvc | src/Microsoft.AspNet.Mvc.Core/Controllers/ControllerActionDescriptorBuilder.cs | 35,941 | C# |
// The MIT License (MIT)
//
// Copyright (c) 2015-2018 Rasmus Mikkelsen
// Copyright (c) 2015-2018 eBay Software Foundation
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using EventFlow.Aggregates;
using EventFlow.Core;
namespace EventFlow.EventStores
{
public interface IEventStore
{
Task<IReadOnlyCollection<IDomainEvent<TAggregate, TIdentity>>> StoreAsync<TAggregate, TIdentity>(
TIdentity id,
IReadOnlyCollection<IUncommittedEvent> uncommittedDomainEvents,
ISourceId sourceId,
CancellationToken cancellationToken)
where TAggregate : IAggregateRoot<TIdentity>
where TIdentity : IIdentity;
Task<AllEventsPage> LoadAllEventsAsync(
GlobalPosition globalPosition,
int pageSize,
CancellationToken cancellationToken);
Task<IReadOnlyCollection<IDomainEvent<TAggregate, TIdentity>>> LoadEventsAsync<TAggregate, TIdentity>(
TIdentity id,
CancellationToken cancellationToken)
where TAggregate : IAggregateRoot<TIdentity>
where TIdentity : IIdentity;
Task<IReadOnlyCollection<IDomainEvent<TAggregate, TIdentity>>> LoadEventsAsync<TAggregate, TIdentity>(
TIdentity id,
int fromEventSequenceNumber,
CancellationToken cancellationToken)
where TAggregate : IAggregateRoot<TIdentity>
where TIdentity : IIdentity;
[Obsolete("Use IAggregateStore.LoadAsync instead")]
Task<TAggregate> LoadAggregateAsync<TAggregate, TIdentity>(
TIdentity id,
CancellationToken cancellationToken)
where TAggregate : IAggregateRoot<TIdentity>
where TIdentity : IIdentity;
Task DeleteAggregateAsync<TAggregate, TIdentity>(
TIdentity id,
CancellationToken cancellationToken)
where TAggregate : IAggregateRoot<TIdentity>
where TIdentity : IIdentity;
}
} | 42.932432 | 110 | 0.712622 | [
"MIT"
] | AntonSmolkov/EventFlow | Source/EventFlow/EventStores/IEventStore.cs | 3,179 | C# |
/*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
namespace Amazon.EC2.Model
{
/// <summary>
/// <para>Describes a network interface attachment.</para>
/// </summary>
public class NetworkInterfaceAttachment
{
private string attachmentId;
private string instanceId;
private string instanceOwnerId;
private int? deviceIndex;
private AttachmentStatus status;
private DateTime? attachTime;
private bool? deleteOnTermination;
/// <summary>
/// The ID of the network interface attachment.
///
/// </summary>
public string AttachmentId
{
get { return this.attachmentId; }
set { this.attachmentId = value; }
}
// Check to see if AttachmentId property is set
internal bool IsSetAttachmentId()
{
return this.attachmentId != null;
}
/// <summary>
/// The ID of the instance.
///
/// </summary>
public string InstanceId
{
get { return this.instanceId; }
set { this.instanceId = value; }
}
// Check to see if InstanceId property is set
internal bool IsSetInstanceId()
{
return this.instanceId != null;
}
/// <summary>
/// The AWS account ID of the owner of the instance.
///
/// </summary>
public string InstanceOwnerId
{
get { return this.instanceOwnerId; }
set { this.instanceOwnerId = value; }
}
// Check to see if InstanceOwnerId property is set
internal bool IsSetInstanceOwnerId()
{
return this.instanceOwnerId != null;
}
/// <summary>
/// The device index of the network interface attachment on the instance.
///
/// </summary>
public int DeviceIndex
{
get { return this.deviceIndex ?? default(int); }
set { this.deviceIndex = value; }
}
// Check to see if DeviceIndex property is set
internal bool IsSetDeviceIndex()
{
return this.deviceIndex.HasValue;
}
/// <summary>
/// The attachment state.
///
/// <para>
/// <b>Constraints:</b>
/// <list type="definition">
/// <item>
/// <term>Allowed Values</term>
/// <description>attaching, attached, detaching, detached</description>
/// </item>
/// </list>
/// </para>
/// </summary>
public AttachmentStatus Status
{
get { return this.status; }
set { this.status = value; }
}
// Check to see if Status property is set
internal bool IsSetStatus()
{
return this.status != null;
}
/// <summary>
/// The timestamp indicating when the attachment initiated.
///
/// </summary>
public DateTime AttachTime
{
get { return this.attachTime ?? default(DateTime); }
set { this.attachTime = value; }
}
// Check to see if AttachTime property is set
internal bool IsSetAttachTime()
{
return this.attachTime.HasValue;
}
/// <summary>
/// Indicates whether the network interface is deleted when the instance is terminated.
///
/// </summary>
public bool DeleteOnTermination
{
get { return this.deleteOnTermination ?? default(bool); }
set { this.deleteOnTermination = value; }
}
// Check to see if DeleteOnTermination property is set
internal bool IsSetDeleteOnTermination()
{
return this.deleteOnTermination.HasValue;
}
}
}
| 28.64375 | 95 | 0.554222 | [
"Apache-2.0"
] | virajs/aws-sdk-net | AWSSDK_DotNet35/Amazon.EC2/Model/NetworkInterfaceAttachment.cs | 4,583 | C# |
// --------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// --------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Microsoft.Oryx.Common;
using Microsoft.Oryx.Integration.Tests.Fixtures;
using Microsoft.Oryx.Tests.Common;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.Oryx.Integration.Tests
{
[Trait("category", "db")]
[Trait("db", "sqlserver")]
public class SqlServerIntegrationTests : PlatformEndToEndTestsBase
{
private const string DbServerHostnameEnvVarName = "SQLSERVER_DATABASE_HOST";
private const string DbServerUsernameEnvVarName = "SQLSERVER_DATABASE_USERNAME";
private const string DbServerPasswordEnvVarName = "SQLSERVER_DATABASE_PASSWORD";
private const string DbServerDatabaseEnvVarName = "SQLSERVER_DATABASE_NAME";
private const int ContainerPort = 3000;
private const string DefaultStartupFilePath = "./run.sh";
public SqlServerIntegrationTests(ITestOutputHelper output) : base(output, null)
{
}
[Fact]
public async Task NodeApp_MicrosoftSqlServerDB()
{
// Arrange
var appName = "node-mssql";
var hostDir = Path.Combine(_hostSamplesDir, "nodejs", appName);
var volume = DockerVolume.CreateMirror(hostDir);
var appDir = volume.ContainerDir;
var script = new ShellScriptBuilder()
.AddCommand($"oryx -appPath {appDir} -bindPort {ContainerPort}")
.AddCommand(DefaultStartupFilePath)
.ToString();
await EndToEndTestHelper.BuildRunAndAssertAppAsync(
appName,
_output,
new List<DockerVolume> { volume },
Settings.BuildImageName,
"oryx",
new[] { "build", appDir, "-l", "nodejs", "--language-version", "10.14" },
_imageHelper.GetTestRuntimeImage("node", "10.14"),
GetEnvironmentVariables(),
ContainerPort,
"/bin/bash",
new[]
{
"-c",
script
},
async (hostPort) =>
{
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Equal(
DbContainerFixtureBase.GetSampleDataAsJson(),
data.Trim(),
ignoreLineEndingDifferences: true,
ignoreWhiteSpaceDifferences: true);
});
}
[Fact]
public async Task Python37App_MicrosoftSqlServerDB()
{
// Arrange
var appName = "mssqlserver-sample";
var hostDir = Path.Combine(_hostSamplesDir, "python", appName);
var volume = DockerVolume.CreateMirror(hostDir);
var appDir = volume.ContainerDir;
var script = new ShellScriptBuilder()
.AddCommand($"oryx -appPath {appDir} -bindPort {ContainerPort}")
.AddCommand(DefaultStartupFilePath)
.ToString();
await EndToEndTestHelper.BuildRunAndAssertAppAsync(
appName,
_output,
new List<DockerVolume> { volume },
Settings.BuildImageName,
"oryx",
new[] { "build", appDir, "-l", "python", "--language-version", "3.7" },
_imageHelper.GetTestRuntimeImage("python", "3.7"),
GetEnvironmentVariables(),
ContainerPort,
"/bin/bash",
new[]
{
"-c",
script
},
async (hostPort) =>
{
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Equal(
DbContainerFixtureBase.GetSampleDataAsJson(),
data.Trim(),
ignoreLineEndingDifferences: true,
ignoreWhiteSpaceDifferences: true);
});
}
[Theory]
[InlineData("7.3")]
[InlineData("7.2")]
// pdo_sqlsrv only supports PHP >= 7.1
public async Task PhpApp_UsingPdo(string phpVersion)
{
// Arrange
var appName = "sqlsrv-example";
var hostDir = Path.Combine(_hostSamplesDir, "php", appName);
var volume = DockerVolume.CreateMirror(hostDir);
var appDir = volume.ContainerDir;
var script = new ShellScriptBuilder()
.AddCommand($"oryx -appPath {appDir} -bindPort {ContainerPort}")
.AddCommand(DefaultStartupFilePath)
.ToString();
await EndToEndTestHelper.BuildRunAndAssertAppAsync(
appName,
_output,
new List<DockerVolume> { volume },
Settings.BuildImageName,
"oryx",
new[] { "build", appDir, "-l", "php", "--language-version", phpVersion },
_imageHelper.GetTestRuntimeImage("php", phpVersion),
GetEnvironmentVariables(),
ContainerPort,
"/bin/bash",
new[]
{
"-c",
script
},
async (hostPort) =>
{
var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/");
Assert.Equal(
DbContainerFixtureBase.GetSampleDataAsJson(),
data.Trim(),
ignoreLineEndingDifferences: true,
ignoreWhiteSpaceDifferences: true);
});
}
private List<EnvironmentVariable> GetEnvironmentVariables()
{
return new List<EnvironmentVariable>
{
new EnvironmentVariable(
DbServerHostnameEnvVarName, Environment.GetEnvironmentVariable(DbServerHostnameEnvVarName)),
new EnvironmentVariable(
DbServerDatabaseEnvVarName, Environment.GetEnvironmentVariable(DbServerDatabaseEnvVarName)),
new EnvironmentVariable(
DbServerUsernameEnvVarName, Environment.GetEnvironmentVariable(DbServerUsernameEnvVarName)),
new EnvironmentVariable(
DbServerPasswordEnvVarName, Environment.GetEnvironmentVariable(DbServerPasswordEnvVarName)),
};
}
}
} | 41.476744 | 113 | 0.511915 | [
"MIT"
] | cormacpayne/Oryx | tests/Oryx.Integration.Tests/Database/SqlServerIntegrationTests.cs | 6,965 | C# |
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("citPOINT.OfferApp.Data.Web")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("citPOINT.OfferApp.Data.Web")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[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("2326ad00-b883-455f-88cb-0f5e90fee761")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 38.5 | 84 | 0.742424 | [
"MIT"
] | ivconsult/eNeg-OfferApp | citPOINT.OfferApp.Data.Web/Properties/AssemblyInfo.cs | 1,389 | C# |
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using JetBrains.Annotations;
using osu.Game.Audio;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.Formats
{
public class LegacyBeatmapEncoder
{
public const int LATEST_VERSION = 128;
/// <summary>
/// osu! is generally slower than taiko, so a factor is added to increase
/// speed. This must be used everywhere slider length or beat length is used.
/// </summary>
public const float LEGACY_TAIKO_VELOCITY_MULTIPLIER = 1.4f;
private readonly IBeatmap beatmap;
[CanBeNull]
private readonly ISkin skin;
/// <summary>
/// Creates a new <see cref="LegacyBeatmapEncoder"/>.
/// </summary>
/// <param name="beatmap">The beatmap to encode.</param>
/// <param name="skin">The beatmap's skin, used for encoding combo colours.</param>
public LegacyBeatmapEncoder(IBeatmap beatmap, [CanBeNull] ISkin skin)
{
this.beatmap = beatmap;
this.skin = skin;
if (beatmap.BeatmapInfo.RulesetID < 0 || beatmap.BeatmapInfo.RulesetID > 3)
throw new ArgumentException("Only beatmaps in the osu, taiko, catch, or mania rulesets can be encoded to the legacy beatmap format.", nameof(beatmap));
}
public void Encode(TextWriter writer)
{
writer.WriteLine($"osu file format v{LATEST_VERSION}");
writer.WriteLine();
handleGeneral(writer);
writer.WriteLine();
handleEditor(writer);
writer.WriteLine();
handleMetadata(writer);
writer.WriteLine();
handleDifficulty(writer);
writer.WriteLine();
handleEvents(writer);
writer.WriteLine();
handleControlPoints(writer);
writer.WriteLine();
handleColours(writer);
writer.WriteLine();
handleHitObjects(writer);
}
private void handleGeneral(TextWriter writer)
{
writer.WriteLine("[General]");
if (!string.IsNullOrEmpty(beatmap.Metadata.AudioFile)) writer.WriteLine(FormattableString.Invariant($"AudioFilename: {Path.GetFileName(beatmap.Metadata.AudioFile)}"));
writer.WriteLine(FormattableString.Invariant($"AudioLeadIn: {beatmap.BeatmapInfo.AudioLeadIn}"));
writer.WriteLine(FormattableString.Invariant($"PreviewTime: {beatmap.Metadata.PreviewTime}"));
writer.WriteLine(FormattableString.Invariant($"Countdown: {(int)beatmap.BeatmapInfo.Countdown}"));
writer.WriteLine(FormattableString.Invariant($"SampleSet: {toLegacySampleBank((beatmap.HitObjects.FirstOrDefault()?.SampleControlPoint ?? SampleControlPoint.DEFAULT).SampleBank)}"));
writer.WriteLine(FormattableString.Invariant($"StackLeniency: {beatmap.BeatmapInfo.StackLeniency}"));
writer.WriteLine(FormattableString.Invariant($"Mode: {beatmap.BeatmapInfo.RulesetID}"));
writer.WriteLine(FormattableString.Invariant($"LetterboxInBreaks: {(beatmap.BeatmapInfo.LetterboxInBreaks ? '1' : '0')}"));
// if (beatmap.BeatmapInfo.UseSkinSprites)
// writer.WriteLine(@"UseSkinSprites: 1");
// if (b.AlwaysShowPlayfield)
// writer.WriteLine(@"AlwaysShowPlayfield: 1");
// if (b.OverlayPosition != OverlayPosition.NoChange)
// writer.WriteLine(@"OverlayPosition: " + b.OverlayPosition);
// if (!string.IsNullOrEmpty(b.SkinPreference))
// writer.WriteLine(@"SkinPreference:" + b.SkinPreference);
if (beatmap.BeatmapInfo.EpilepsyWarning)
writer.WriteLine(@"EpilepsyWarning: 1");
if (beatmap.BeatmapInfo.CountdownOffset > 0)
writer.WriteLine(FormattableString.Invariant($@"CountdownOffset: {beatmap.BeatmapInfo.CountdownOffset}"));
if (beatmap.BeatmapInfo.RulesetID == 3)
writer.WriteLine(FormattableString.Invariant($"SpecialStyle: {(beatmap.BeatmapInfo.SpecialStyle ? '1' : '0')}"));
writer.WriteLine(FormattableString.Invariant($"WidescreenStoryboard: {(beatmap.BeatmapInfo.WidescreenStoryboard ? '1' : '0')}"));
if (beatmap.BeatmapInfo.SamplesMatchPlaybackRate)
writer.WriteLine(@"SamplesMatchPlaybackRate: 1");
}
private void handleEditor(TextWriter writer)
{
writer.WriteLine("[Editor]");
if (beatmap.BeatmapInfo.Bookmarks.Length > 0)
writer.WriteLine(FormattableString.Invariant($"Bookmarks: {string.Join(',', beatmap.BeatmapInfo.Bookmarks)}"));
writer.WriteLine(FormattableString.Invariant($"DistanceSpacing: {beatmap.BeatmapInfo.DistanceSpacing}"));
writer.WriteLine(FormattableString.Invariant($"BeatDivisor: {beatmap.BeatmapInfo.BeatDivisor}"));
writer.WriteLine(FormattableString.Invariant($"GridSize: {beatmap.BeatmapInfo.GridSize}"));
writer.WriteLine(FormattableString.Invariant($"TimelineZoom: {beatmap.BeatmapInfo.TimelineZoom}"));
}
private void handleMetadata(TextWriter writer)
{
writer.WriteLine("[Metadata]");
writer.WriteLine(FormattableString.Invariant($"Title: {beatmap.Metadata.Title}"));
if (!string.IsNullOrEmpty(beatmap.Metadata.TitleUnicode)) writer.WriteLine(FormattableString.Invariant($"TitleUnicode: {beatmap.Metadata.TitleUnicode}"));
writer.WriteLine(FormattableString.Invariant($"Artist: {beatmap.Metadata.Artist}"));
if (!string.IsNullOrEmpty(beatmap.Metadata.ArtistUnicode)) writer.WriteLine(FormattableString.Invariant($"ArtistUnicode: {beatmap.Metadata.ArtistUnicode}"));
writer.WriteLine(FormattableString.Invariant($"Creator: {beatmap.Metadata.Author.Username}"));
writer.WriteLine(FormattableString.Invariant($"Version: {beatmap.BeatmapInfo.DifficultyName}"));
if (!string.IsNullOrEmpty(beatmap.Metadata.Source)) writer.WriteLine(FormattableString.Invariant($"Source: {beatmap.Metadata.Source}"));
if (!string.IsNullOrEmpty(beatmap.Metadata.Tags)) writer.WriteLine(FormattableString.Invariant($"Tags: {beatmap.Metadata.Tags}"));
if (beatmap.BeatmapInfo.OnlineID != null) writer.WriteLine(FormattableString.Invariant($"BeatmapID: {beatmap.BeatmapInfo.OnlineID}"));
if (beatmap.BeatmapInfo.BeatmapSet?.OnlineID != null) writer.WriteLine(FormattableString.Invariant($"BeatmapSetID: {beatmap.BeatmapInfo.BeatmapSet.OnlineID}"));
}
private void handleDifficulty(TextWriter writer)
{
writer.WriteLine("[Difficulty]");
writer.WriteLine(FormattableString.Invariant($"HPDrainRate: {beatmap.Difficulty.DrainRate}"));
writer.WriteLine(FormattableString.Invariant($"CircleSize: {beatmap.Difficulty.CircleSize}"));
writer.WriteLine(FormattableString.Invariant($"OverallDifficulty: {beatmap.Difficulty.OverallDifficulty}"));
writer.WriteLine(FormattableString.Invariant($"ApproachRate: {beatmap.Difficulty.ApproachRate}"));
// Taiko adjusts the slider multiplier (see: LEGACY_TAIKO_VELOCITY_MULTIPLIER)
writer.WriteLine(beatmap.BeatmapInfo.RulesetID == 1
? FormattableString.Invariant($"SliderMultiplier: {beatmap.Difficulty.SliderMultiplier / LEGACY_TAIKO_VELOCITY_MULTIPLIER}")
: FormattableString.Invariant($"SliderMultiplier: {beatmap.Difficulty.SliderMultiplier}"));
writer.WriteLine(FormattableString.Invariant($"SliderTickRate: {beatmap.Difficulty.SliderTickRate}"));
}
private void handleEvents(TextWriter writer)
{
writer.WriteLine("[Events]");
if (!string.IsNullOrEmpty(beatmap.BeatmapInfo.Metadata.BackgroundFile))
writer.WriteLine(FormattableString.Invariant($"{(int)LegacyEventType.Background},0,\"{beatmap.BeatmapInfo.Metadata.BackgroundFile}\",0,0"));
foreach (var b in beatmap.Breaks)
writer.WriteLine(FormattableString.Invariant($"{(int)LegacyEventType.Break},{b.StartTime},{b.EndTime}"));
}
private void handleControlPoints(TextWriter writer)
{
if (beatmap.ControlPointInfo.Groups.Count == 0)
return;
var legacyControlPoints = new LegacyControlPointInfo();
foreach (var point in beatmap.ControlPointInfo.AllControlPoints)
legacyControlPoints.Add(point.Time, point.DeepClone());
writer.WriteLine("[TimingPoints]");
SampleControlPoint lastRelevantSamplePoint = null;
DifficultyControlPoint lastRelevantDifficultyPoint = null;
bool isOsuRuleset = beatmap.BeatmapInfo.RulesetID == 0;
// iterate over hitobjects and pull out all required sample and difficulty changes
extractDifficultyControlPoints(beatmap.HitObjects);
extractSampleControlPoints(beatmap.HitObjects);
// handle scroll speed, which is stored as "slider velocity" in legacy formats.
// this is relevant for scrolling ruleset beatmaps.
if (!isOsuRuleset)
{
foreach (var point in legacyControlPoints.EffectPoints)
legacyControlPoints.Add(point.Time, new DifficultyControlPoint { SliderVelocity = point.ScrollSpeed });
}
foreach (var group in legacyControlPoints.Groups)
{
var groupTimingPoint = group.ControlPoints.OfType<TimingControlPoint>().FirstOrDefault();
// If the group contains a timing control point, it needs to be output separately.
if (groupTimingPoint != null)
{
writer.Write(FormattableString.Invariant($"{groupTimingPoint.Time},"));
writer.Write(FormattableString.Invariant($"{groupTimingPoint.BeatLength},"));
outputControlPointAt(groupTimingPoint.Time, true);
}
// Output any remaining effects as secondary non-timing control point.
var difficultyPoint = legacyControlPoints.DifficultyPointAt(group.Time);
writer.Write(FormattableString.Invariant($"{group.Time},"));
writer.Write(FormattableString.Invariant($"{-100 / difficultyPoint.SliderVelocity},"));
outputControlPointAt(group.Time, false);
}
void outputControlPointAt(double time, bool isTimingPoint)
{
var samplePoint = legacyControlPoints.SamplePointAt(time);
var effectPoint = legacyControlPoints.EffectPointAt(time);
// Apply the control point to a hit sample to uncover legacy properties (e.g. suffix)
HitSampleInfo tempHitSample = samplePoint.ApplyTo(new ConvertHitObjectParser.LegacyHitSampleInfo(string.Empty));
// Convert effect flags to the legacy format
LegacyEffectFlags effectFlags = LegacyEffectFlags.None;
if (effectPoint.KiaiMode)
effectFlags |= LegacyEffectFlags.Kiai;
if (effectPoint.OmitFirstBarLine)
effectFlags |= LegacyEffectFlags.OmitFirstBarLine;
writer.Write(FormattableString.Invariant($"{(int)legacyControlPoints.TimingPointAt(time).TimeSignature},"));
writer.Write(FormattableString.Invariant($"{(int)toLegacySampleBank(tempHitSample.Bank)},"));
writer.Write(FormattableString.Invariant($"{toLegacyCustomSampleBank(tempHitSample)},"));
writer.Write(FormattableString.Invariant($"{tempHitSample.Volume},"));
writer.Write(FormattableString.Invariant($"{(isTimingPoint ? '1' : '0')},"));
writer.Write(FormattableString.Invariant($"{(int)effectFlags}"));
writer.WriteLine();
}
IEnumerable<DifficultyControlPoint> collectDifficultyControlPoints(IEnumerable<HitObject> hitObjects)
{
if (!isOsuRuleset)
yield break;
foreach (var hitObject in hitObjects)
{
yield return hitObject.DifficultyControlPoint;
foreach (var nested in collectDifficultyControlPoints(hitObject.NestedHitObjects))
yield return nested;
}
}
void extractDifficultyControlPoints(IEnumerable<HitObject> hitObjects)
{
foreach (var hDifficultyPoint in collectDifficultyControlPoints(hitObjects).OrderBy(dp => dp.Time))
{
if (!hDifficultyPoint.IsRedundant(lastRelevantDifficultyPoint))
{
legacyControlPoints.Add(hDifficultyPoint.Time, hDifficultyPoint);
lastRelevantDifficultyPoint = hDifficultyPoint;
}
}
}
IEnumerable<SampleControlPoint> collectSampleControlPoints(IEnumerable<HitObject> hitObjects)
{
foreach (var hitObject in hitObjects)
{
yield return hitObject.SampleControlPoint;
foreach (var nested in collectSampleControlPoints(hitObject.NestedHitObjects))
yield return nested;
}
}
void extractSampleControlPoints(IEnumerable<HitObject> hitObject)
{
foreach (var hSamplePoint in collectSampleControlPoints(hitObject).OrderBy(sp => sp.Time))
{
if (!hSamplePoint.IsRedundant(lastRelevantSamplePoint))
{
legacyControlPoints.Add(hSamplePoint.Time, hSamplePoint);
lastRelevantSamplePoint = hSamplePoint;
}
}
}
}
private void handleColours(TextWriter writer)
{
var colours = skin?.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value;
if (colours == null || colours.Count == 0)
return;
writer.WriteLine("[Colours]");
for (int i = 0; i < colours.Count; i++)
{
var comboColour = colours[i];
writer.Write(FormattableString.Invariant($"Combo{i}: "));
writer.Write(FormattableString.Invariant($"{(byte)(comboColour.R * byte.MaxValue)},"));
writer.Write(FormattableString.Invariant($"{(byte)(comboColour.G * byte.MaxValue)},"));
writer.Write(FormattableString.Invariant($"{(byte)(comboColour.B * byte.MaxValue)},"));
writer.Write(FormattableString.Invariant($"{(byte)(comboColour.A * byte.MaxValue)}"));
writer.WriteLine();
}
}
private void handleHitObjects(TextWriter writer)
{
writer.WriteLine("[HitObjects]");
if (beatmap.HitObjects.Count == 0)
return;
foreach (var h in beatmap.HitObjects)
handleHitObject(writer, h);
}
private void handleHitObject(TextWriter writer, HitObject hitObject)
{
Vector2 position = new Vector2(256, 192);
switch (beatmap.BeatmapInfo.RulesetID)
{
case 0:
case 2:
position = ((IHasPosition)hitObject).Position;
break;
case 3:
int totalColumns = (int)Math.Max(1, beatmap.Difficulty.CircleSize);
position.X = (int)Math.Ceiling(((IHasXPosition)hitObject).X * (512f / totalColumns));
break;
}
writer.Write(FormattableString.Invariant($"{position.X},"));
writer.Write(FormattableString.Invariant($"{position.Y},"));
writer.Write(FormattableString.Invariant($"{hitObject.StartTime},"));
writer.Write(FormattableString.Invariant($"{(int)getObjectType(hitObject)},"));
writer.Write(FormattableString.Invariant($"{(int)toLegacyHitSoundType(hitObject.Samples)},"));
if (hitObject is IHasPath path)
{
addPathData(writer, path, position);
writer.Write(getSampleBank(hitObject.Samples));
}
else
{
if (hitObject is IHasDuration)
addEndTimeData(writer, hitObject);
writer.Write(getSampleBank(hitObject.Samples));
}
writer.WriteLine();
}
private LegacyHitObjectType getObjectType(HitObject hitObject)
{
LegacyHitObjectType type = 0;
if (hitObject is IHasCombo combo)
{
type = (LegacyHitObjectType)(combo.ComboOffset << 4);
if (combo.NewCombo)
type |= LegacyHitObjectType.NewCombo;
}
switch (hitObject)
{
case IHasPath _:
type |= LegacyHitObjectType.Slider;
break;
case IHasDuration _:
if (beatmap.BeatmapInfo.RulesetID == 3)
type |= LegacyHitObjectType.Hold;
else
type |= LegacyHitObjectType.Spinner;
break;
default:
type |= LegacyHitObjectType.Circle;
break;
}
return type;
}
private void addPathData(TextWriter writer, IHasPath pathData, Vector2 position)
{
PathType? lastType = null;
for (int i = 0; i < pathData.Path.ControlPoints.Count; i++)
{
PathControlPoint point = pathData.Path.ControlPoints[i];
if (point.Type != null)
{
// We've reached a new (explicit) segment!
// Explicit segments have a new format in which the type is injected into the middle of the control point string.
// To preserve compatibility with osu-stable as much as possible, explicit segments with the same type are converted to use implicit segments by duplicating the control point.
// One exception are consecutive perfect curves, which aren't supported in osu!stable and can lead to decoding issues if encoded as implicit segments
bool needsExplicitSegment = point.Type != lastType || point.Type == PathType.PerfectCurve;
// Another exception to this is when the last two control points of the last segment were duplicated. This is not a scenario supported by osu!stable.
// Lazer does not add implicit segments for the last two control points of _any_ explicit segment, so an explicit segment is forced in order to maintain consistency with the decoder.
if (i > 1)
{
// We need to use the absolute control point position to determine equality, otherwise floating point issues may arise.
Vector2 p1 = position + pathData.Path.ControlPoints[i - 1].Position;
Vector2 p2 = position + pathData.Path.ControlPoints[i - 2].Position;
if ((int)p1.X == (int)p2.X && (int)p1.Y == (int)p2.Y)
needsExplicitSegment = true;
}
if (needsExplicitSegment)
{
switch (point.Type)
{
case PathType.Bezier:
writer.Write("B|");
break;
case PathType.Catmull:
writer.Write("C|");
break;
case PathType.PerfectCurve:
writer.Write("P|");
break;
case PathType.Linear:
writer.Write("L|");
break;
}
lastType = point.Type;
}
else
{
// New segment with the same type - duplicate the control point
writer.Write(FormattableString.Invariant($"{position.X + point.Position.X}:{position.Y + point.Position.Y}|"));
}
}
if (i != 0)
{
writer.Write(FormattableString.Invariant($"{position.X + point.Position.X}:{position.Y + point.Position.Y}"));
writer.Write(i != pathData.Path.ControlPoints.Count - 1 ? "|" : ",");
}
}
var curveData = pathData as IHasPathWithRepeats;
writer.Write(FormattableString.Invariant($"{(curveData?.RepeatCount ?? 0) + 1},"));
writer.Write(FormattableString.Invariant($"{pathData.Path.ExpectedDistance.Value ?? pathData.Path.Distance},"));
if (curveData != null)
{
for (int i = 0; i < curveData.NodeSamples.Count; i++)
{
writer.Write(FormattableString.Invariant($"{(int)toLegacyHitSoundType(curveData.NodeSamples[i])}"));
writer.Write(i != curveData.NodeSamples.Count - 1 ? "|" : ",");
}
for (int i = 0; i < curveData.NodeSamples.Count; i++)
{
writer.Write(getSampleBank(curveData.NodeSamples[i], true));
writer.Write(i != curveData.NodeSamples.Count - 1 ? "|" : ",");
}
}
}
private void addEndTimeData(TextWriter writer, HitObject hitObject)
{
var endTimeData = (IHasDuration)hitObject;
var type = getObjectType(hitObject);
char suffix = ',';
// Holds write the end time as if it's part of sample data.
if (type == LegacyHitObjectType.Hold)
suffix = ':';
writer.Write(FormattableString.Invariant($"{endTimeData.EndTime}{suffix}"));
}
private string getSampleBank(IList<HitSampleInfo> samples, bool banksOnly = false)
{
LegacySampleBank normalBank = toLegacySampleBank(samples.SingleOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)?.Bank);
LegacySampleBank addBank = toLegacySampleBank(samples.FirstOrDefault(s => !string.IsNullOrEmpty(s.Name) && s.Name != HitSampleInfo.HIT_NORMAL)?.Bank);
StringBuilder sb = new StringBuilder();
sb.Append(FormattableString.Invariant($"{(int)normalBank}:"));
sb.Append(FormattableString.Invariant($"{(int)addBank}"));
if (!banksOnly)
{
string customSampleBank = toLegacyCustomSampleBank(samples.FirstOrDefault(s => !string.IsNullOrEmpty(s.Name)));
string sampleFilename = samples.FirstOrDefault(s => string.IsNullOrEmpty(s.Name))?.LookupNames.First() ?? string.Empty;
int volume = samples.FirstOrDefault()?.Volume ?? 100;
sb.Append(':');
sb.Append(FormattableString.Invariant($"{customSampleBank}:"));
sb.Append(FormattableString.Invariant($"{volume}:"));
sb.Append(FormattableString.Invariant($"{sampleFilename}"));
}
return sb.ToString();
}
private LegacyHitSoundType toLegacyHitSoundType(IList<HitSampleInfo> samples)
{
LegacyHitSoundType type = LegacyHitSoundType.None;
foreach (var sample in samples)
{
switch (sample.Name)
{
case HitSampleInfo.HIT_WHISTLE:
type |= LegacyHitSoundType.Whistle;
break;
case HitSampleInfo.HIT_FINISH:
type |= LegacyHitSoundType.Finish;
break;
case HitSampleInfo.HIT_CLAP:
type |= LegacyHitSoundType.Clap;
break;
}
}
return type;
}
private LegacySampleBank toLegacySampleBank(string sampleBank)
{
switch (sampleBank?.ToLowerInvariant())
{
case "normal":
return LegacySampleBank.Normal;
case "soft":
return LegacySampleBank.Soft;
case "drum":
return LegacySampleBank.Drum;
default:
return LegacySampleBank.None;
}
}
private string toLegacyCustomSampleBank(HitSampleInfo hitSampleInfo)
{
if (hitSampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacy)
return legacy.CustomSampleBank.ToString(CultureInfo.InvariantCulture);
return "0";
}
}
}
| 46.26049 | 203 | 0.575866 | [
"MIT"
] | AbstractQbit/osu | osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs | 25,890 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using FileHelpers.DataLink;
using NPOI.HSSF.UserModel;
using System.Reflection;
using System.IO;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.HSSF.Util;
using NPOI.SS.Util.CellWalk;
using System.Threading;
using FileHelpers.Events;
using System.Globalization;
using System.Collections;
using NPOI.XSSF.UserModel;
namespace FileHelpers.ExcelNPOIStorage
{
/// <summary><para>This class implements the <see cref="DataStorage"/> for Microsoft Excel Files using the NPOI library.</para>
/// <para><b>WARNING you need to reference NPOI.dll in your project to use this feature.</b></para>
/// <para><b>To use this class you need to reference the FileHelpers.ExcelNPOIStorage.dll file.</b></para>
/// </summary>
/// <remarks><b>This class is contained in the FileHelpers.ExcelNPOIStorage.dll and need the NPOI.dll to work correctly.</b></remarks>
public sealed class ExcelNPOIStorage : ExcelStorageBase
{
//private readonly Missing mv = Missing.Value;
#region " Constructors "
/// <summary>Create a new ExcelStorage to work with the specified type</summary>
/// <param name="recordType">The type of records.</param>
public ExcelNPOIStorage(Type recordType)
: base(recordType) {}
/// <summary>Create a new ExcelStorage to work with the specified type</summary>
/// <param name="recordType">The type of records.</param>
/// <param name="startRow">The row of the first data cell. Begining in 1.</param>
/// <param name="startCol">The column of the first data cell. Begining in 1.</param>
public ExcelNPOIStorage(Type recordType, int startRow, int startCol)
: base(recordType, startRow, startCol) {}
/// <summary>Create a new ExcelStorage to work with the specified type</summary>
/// <param name="recordType">The type of records.</param>
/// <param name="startRow">The row of the first data cell. Begining in 1.</param>
/// <param name="startCol">The column of the first data cell. Begining in 1.</param>
/// <param name="fileName">The file path to work with.</param>
public ExcelNPOIStorage(Type recordType, string fileName, int startRow, int startCol)
: base(recordType, fileName, startRow, startCol) {}
#endregion
#region " Private Fields "
private IWorkbook mWorkbook;
private ISheet mSheet;
//private RecordInfo mRecordInfo;
#endregion
#region " Public Properties "
#endregion
#region " InitExcel "
private void InitExcel()
{
mWorkbook = null;
mSheet = null;
}
#endregion
#region " CloseAndCleanUp "
private void CloseAndCleanUp()
{
mSheet = null;
mWorkbook = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
#endregion
#region " OpenWorkbook "
private void OpenWorkbook(string filename)
{
FileInfo info = new FileInfo(filename);
if (info.Exists == false)
//?ExcelFileNotFound"Excel File '{0}' not found."
throw new FileHelpersException("FileHelperMsg_ExcelFileNotFound", new List<string>() { filename });
using (FileStream file = new FileStream(filename, FileMode.Open, FileAccess.Read)) {
var extension = Path.GetExtension(filename);
if (extension.ToLowerInvariant() == ".xlsx" || extension.ToLowerInvariant() == ".xlsm")
mWorkbook = new XSSFWorkbook(file);
else
mWorkbook = new HSSFWorkbook(file);
if (String.IsNullOrEmpty(SheetName))
mSheet = mWorkbook.GetSheetAt(mWorkbook.ActiveSheetIndex);
else {
try {
mSheet = mWorkbook.GetSheet(SheetName);
if (mSheet == null) {
//?XlSheetWasNotFound"The sheet '{0}' was not found in the workbook."
throw new ExcelBadUsageException("FileHelperMsg_XlSheetWasNotFound", new List<string>() { SheetName });
}
var sheetIndex = mWorkbook.GetSheetIndex(mSheet);
mWorkbook.SetActiveSheet(sheetIndex);
}
catch {
//?XlSheetWasNotFound"The sheet '{0}' was not found in the workbook."
throw new ExcelBadUsageException("FileHelperMsg_XlSheetWasNotFound", new List<string>() { SheetName });
}
}
}
}
#endregion
#region " CreateWorkbook methods "
private void OpenOrCreateWorkbook(string filename)
{
if (File.Exists(filename))
OpenWorkbook(filename);
else
CreateWorkbook(filename);
}
private void CreateWorkbook(string filename)
{
var extension = Path.GetExtension(filename);
if (extension.ToLowerInvariant() == ".xlsx")
mWorkbook = new XSSFWorkbook();
else if (extension.ToLowerInvariant() == ".xls")
mWorkbook = new HSSFWorkbook();
mSheet = mSheet = String.IsNullOrEmpty(SheetName) ? mWorkbook.CreateSheet() : mWorkbook.CreateSheet(SheetName);
mWorkbook.SetActiveSheet(0);
}
#endregion
#region " SaveWorkbook "
private void SaveWorkbook()
{
if (mWorkbook == null)
return;
using (var fileData = new FileStream(FileName, FileMode.Create))
mWorkbook.Write(fileData);
}
private void SaveWorkbook(string filename)
{
FileName = filename;
SaveWorkbook();
}
#endregion
#region " CellAsString "
/// <summary>
/// Get the string value of a cell
/// </summary>
/// <param name="row">Cell Row</param>
/// <param name="col">Cell Column</param>
/// <returns>Cell Value as string</returns>
protected override string CellAsString(object row, object col)
{
var rowO = mSheet.GetRow((int) row);
return rowO == null
? null
: this.CellAsString(rowO, (int) col);
}
private string CellAsString(IRow row, int col)
{
if (mSheet == null)
return null;
ICell cell = CellUtil.GetCell(row, col);
return cell.ToString();
}
#endregion
#region " ColLeter "
//static string _ColLetter( int col /* 0 origin */) {
// // col = [0...25]
// if( col >= 0 && col <= 25 )
// return ((char)('A' + col)).ToString();
// return "";
//}
//static string ColLetter( int col /* 1 Origin */) {
// if( col < 1 || col > 256 )
// throw new ExcelBadUsageException( "Column out of range; must be between 1 and 256" ); // Excel limits
// col--; // make 0 origin
// // good up to col ZZ
// int col2 = (col / 26) - 1;
// int col1 = (col % 26);
// return _ColLetter( col2 ) + _ColLetter( col1 );
//}
#endregion
#region " RowValues "
private object[] RowValues(int rowNum, int startCol, int numberOfCols)
{
if (mSheet == null)
return null;
if (numberOfCols == 1) {
IRow row = mSheet.GetRow(rowNum);
ICell cell = HSSFCellUtil.GetCell(row, startCol);
return new object[] {NPOIUtils.GetCellValue(cell)};
}
else {
CellRangeAddress range = new CellRangeAddress(rowNum, rowNum, startCol, startCol + numberOfCols - 1);
CellWalk cw = new CellWalk(mSheet, range);
cw.SetTraverseEmptyCells(true);
CellExtractor ce = new CellExtractor();
cw.Traverse(ce);
return ce.CellValues;
}
}
private void WriteRowValues(object[] values, int rowNum, int startCol)
{
if (mSheet == null)
return;
if (ColumnsHeaders.Count != 0)
{
rowNum++;
}
var row = mSheet.GetRow(rowNum);
if (row == null)
row = mSheet.CreateRow(rowNum);
for (int i = 0; i <= startCol + values.Length; i++) {
var cell = row.GetCell(i);
if (cell == null)
row.CreateCell(i);
}
CellRangeAddress range = new CellRangeAddress(rowNum, rowNum, startCol, startCol + values.Length - 1);
CellWalk cw = new CellWalk(mSheet, range);
cw.SetTraverseEmptyCells(true);
CellInserter ci = new CellInserter(new List<object>(values));
cw.Traverse(ci);
}
private void AddHeaderColumns(int startCol,int rowNum)
{
if (ColumnsHeaders.Count != 0)
{
if (mSheet == null)
return;
var row = mSheet.GetRow(rowNum);
if (row == null)
row = mSheet.CreateRow(rowNum);
for (int i = 0; i <= startCol + ColumnsHeaders.ToArray().Length; i++)
{
var cell = row.GetCell(i);
if (cell == null)
row.CreateCell(i);
}
CellRangeAddress range = new CellRangeAddress(StartRow == 0
? 0
: StartRow, StartRow == 0
? 0
: StartRow, startCol, startCol + ColumnsHeaders.ToArray().Length - 1);
CellWalk cw = new CellWalk(mSheet, range);
cw.SetTraverseEmptyCells(true);
CellInserter ci = new CellInserter(new List<object>(ColumnsHeaders));
cw.Traverse(ci);
}
}
#endregion
#region " InsertRecords "
/// <summary>Insert all the records in the specified Excel File.</summary>
/// <param name="records">The records to insert.</param>
public override void InsertRecords(object[] records)
{
if (records == null ||
records.Length == 0)
return;
CultureInfo oldCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
try {
int recordNumber = 0;
OnProgress(new ProgressEventArgs(0, records.Length));
InitExcel();
if (OverrideFile && File.Exists(FileName))
File.Delete(FileName);
if (!String.IsNullOrEmpty(TemplateFile)) {
if (File.Exists(TemplateFile) == false)
//?TemplateFileNotFound"Template file not found: '{0}'"
throw new ExcelBadUsageException("FileHelperMsg_TemplateFileNotFound", new List<string>() { TemplateFile });
if (String.Compare(TemplateFile, FileName, StringComparison.OrdinalIgnoreCase) != 0)
File.Copy(TemplateFile, FileName, true);
}
OpenOrCreateWorkbook(FileName);
AddHeaderColumns(StartColumn, StartRow);
for (int i = 0; i < records.Length; i++) {
recordNumber++;
OnProgress(new ProgressEventArgs(recordNumber, records.Length));
WriteRowValues(RecordToValues(records[i]), StartRow + i, StartColumn);
}
SaveWorkbook(FileName);
}
catch {
throw;
}
finally {
CloseAndCleanUp();
Thread.CurrentThread.CurrentCulture = oldCulture;
}
}
#endregion
#region " ExtractRecords "
/// <summary>Returns the records extracted from Excel file.</summary>
/// <returns>The extracted records.</returns>
public override object[] ExtractRecords()
{
if (String.IsNullOrEmpty(FileName))
//?WorkBookFileNotSpecified"You need to specify the WorkBookFile of the ExcelDataLink."
throw new ExcelBadUsageException("FileHelperMsg_WorkBookFileNotSpecified", null);
var res = new ArrayList();
CultureInfo oldCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
try {
int cRow = StartRow;
int recordNumber = 0;
OnProgress(new ProgressEventArgs(recordNumber, -1));
var colValues = new object[RecordFieldCount];
InitExcel();
OpenWorkbook(FileName);
while (ShouldStopOnRow(cRow) == false) {
try {
if (ShouldReadRowData(cRow)) {
recordNumber++;
OnProgress(new ProgressEventArgs(recordNumber, -1));
colValues = RowValues(cRow, StartColumn, RecordFieldCount);
object record = ValuesToRecord(colValues);
res.Add(record);
}
}
catch (Exception ex) {
switch (mErrorManager.ErrorMode) {
case ErrorMode.ThrowException:
throw;
case ErrorMode.IgnoreAndContinue:
break;
case ErrorMode.SaveAndContinue:
AddError(cRow, ex, ColumnsToValues(colValues));
break;
}
}
finally {
cRow++;
}
}
}
catch {
throw;
}
finally {
CloseAndCleanUp();
Thread.CurrentThread.CurrentCulture = oldCulture;
}
return (object[]) res.ToArray(RecordType);
}
#endregion
private static string ColumnsToValues(object[] values)
{
if (values == null ||
values.Length == 0)
return string.Empty;
string res = string.Empty;
if (values[0] != null)
res = values[0].ToString();
for (int i = 1; i < values.Length; i++) {
res += "," + (values[i] == null
? String.Empty
: values[i].ToString());
}
return res;
}
private class CellExtractor : ICellHandler
{
private List<object> _cells;
/// <summary>
/// Initializes a new instance of the CellExtractor class.
/// </summary>
public CellExtractor()
{
_cells = new List<object>();
}
public object[] CellValues
{
get { return _cells.ToArray(); }
}
#region ICellHandler Members
public void OnCell(ICell cell, ICellWalkContext ctx)
{
_cells.Add(NPOIUtils.GetCellValue(cell));
}
#endregion
}
private class CellInserter : ICellHandler
{
private List<object> _cells = null;
private List<object>.Enumerator _valuesEnumerator;
/// <summary>
/// Initializes a new instance of the CellInserter class.
/// </summary>
public CellInserter(List<object> cellValues)
{
_cells = cellValues;
_valuesEnumerator = _cells.GetEnumerator();
}
#region ICellHandler Members
public void OnCell(ICell cell, ICellWalkContext ctx)
{
if (_valuesEnumerator.MoveNext())
NPOIUtils.SetCellValue(cell, _valuesEnumerator.Current);
else
NPOIUtils.SetCellValue(cell, null);
}
#endregion
}
}
/// <summary>
/// Specifies the way links in the file are updated.
/// </summary>
public enum ExcelUpdateLinksMode
{
/// <summary>User specifies how links will be updated</summary>
UserPrompted = 1,
/// <summary>Never update links for this workbook on opening</summary>
NeverUpdate = 2,
/// <summary>Always update links for this workbook on opening</summary>
AlwaysUpdate = 3
}
}
| 34.720388 | 139 | 0.50014 | [
"MIT"
] | aim00ver/FileHelpers | FileHelpers.ExcelNPOIStorage/ExcelNPOIStorage.cs | 17,883 | C# |
/*
SoundCloud.NET Library For Sound Cloud Api Management.
Copyright (C) 2011 Haythem Tlili
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace SoundCloud.NET
{
/// <summary>
/// Common helpers.
/// </summary>
public static class Utils
{
#region Licenses
public const string NoRightsReserved = "no-rights-reserved";
public const string AllRightsReserved = "all-rights-reserved";
public const string CcBy = "cc-by";
public const string CcByNc = "cc-by-nc";
public const string CcByNd = "cc-by-nd";
public const string CcBySa = "cc-by-sa";
public const string CcByNcNd = "cc-by-nc-nd";
public const string CcByNcSa = "cc-by-nc-sa";
#endregion
#region Uri
/// <summary>
/// Returns an Uri after replacement of the format item with the corresponding string representation.
/// </summary>
///
/// <param name="uri">Input Uri.</param>
/// <param name="keys">Format items.</param>
public static Uri With(this Uri uri, params object[] keys)
{
return new Uri(string.Format(uri.ToString(), keys));
}
/// <summary>
/// Returns a Uri with authorization segment.
/// </summary>
///
/// <param name="baseUri">Input Uri.</param>
/// <param name="token">Token.</param>
public static Uri UriWithAuthorizedUri(this Uri baseUri, string token)
{
return baseUri.UriAppendingQueryString("oauth_token", token);
}
/// <summary>
/// Returns a Uri with authorization segment.
/// </summary>
/// <param name="baseUri">Input Uri.</param>
/// <param name="clientID">The client ID.</param>
/// <returns></returns>
public static Uri UriWithClientID(this Uri baseUri, string clientID)
{
return baseUri.UriAppendingQueryString("client_id", clientID);
}
/// <summary>
/// Adds query strings to a given uri.
/// </summary>
///
/// <param name="baseUri">Input uri.</param>
/// <param name="parameters">Dictionnary of^parameters to add.</param>
public static Uri UriAppendingParameters(this Uri baseUri, Dictionary<string, object> parameters)
{
var sb = new StringBuilder();
foreach (KeyValuePair<string, object> pair in parameters)
{
sb.AppendFormat("{0}={1}&", pair.Key, pair.Value);
}
return baseUri.UriAppendingQueryString(sb.ToString().TrimEnd('&'));
}
public static Uri UriAppendingQueryString(this Uri uri, string name, string value)
{
return
new UriBuilder(uri)
{
Query = (uri.Query + "&" + name + "=" + value).TrimStart('&')
}
.Uri;
}
public static Uri UriAppendingQueryString(this Uri uri, string querystring)
{
return
new UriBuilder(uri)
{
Query = (uri.Query + "&" + querystring).TrimStart('&')
}
.Uri;
}
#endregion Uri
}
} | 34 | 109 | 0.577426 | [
"MIT"
] | hamstercat/MediaBrowser.Channels | MediaBrowser.Plugins.SoundCloud/API/Utils.cs | 3,980 | C# |
namespace Water2D {
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using DynamicLight2D;
public struct microSpawn{
public Vector3 pos;
public int amount;
public Vector2 initVel;
public microSpawn(Vector3 pos, int amount, Vector2 initVel)
{
this.pos = pos;
this.amount = amount;
this.initVel = initVel;
}
}
public class Water2D_Spawner : MonoBehaviour
{
public static Water2D_Spawner instance;
void Awake()
{
if(instance == null)
instance = this;
}
[Title("Water 2D", 20f, 20)]
[Space(25f)]
/// <summary>
/// Drops objects array.
/// </summary>
public GameObject [] WaterDropsObjects;
/// <summary>
/// The size of each drop.
/// </summary>
[Range (0f,2f)] public float size = .45f;
/// <summary>
/// The life time of each particle.
/// </summary>
[Range (0f,100f)] public float LifeTime = 5f;
/// <summary>
/// The delay between particles emission.
/// </summary>
[Range (0f,.3f)] public float DelayBetweenParticles = 0.05f;
/// <summary>
/// The water material.
/// </summary>
[Header("Material & color")]
public Material WaterMaterial;
public Color FillColor = new Color(0f,112/255f,1f);
public Color StrokeColor = new Color(4/255f,156/255f,1f);
[Separator()]
[Header("Speed & direction")]
/// <summary>
/// The initial speed of particles after spawn.
/// </summary>
public Vector2 initSpeed = new Vector2(1f,-1.8f);
[Separator()]
[Header("Apply setup changes over lifetime")]
/// <summary>
/// The dynamic changes can be apply ?.
/// </summary>
public bool DynamicChanges = true;
[Space(20f)]
[Header("Runtime actions")]
[ButtonAttribute("Start!", "Water2D.Water2D_Spawner", "RunSpawner")]public bool btn_0;
static void RunSpawner()
{
instance.Spawn();
}
[ButtonAttribute("Stop", "Water2D.Water2D_Spawner", "JustStopSpawner")] public bool btn_1;
static void JustStopSpawner()
{
instance._breakLoop = true;
}
[ButtonAttribute("Stop and restore", "Water2D.Water2D_Spawner", "StopSpawner")] public bool btn_2;
static void StopSpawner()
{
instance.Restore();
}
[Separator()]
[ButtonAttribute("Help?", "Water2D.Water2D_Spawner", "askHelp")] public bool btn;
static void askHelp()
{
string email = "info@2ddlpro.com";
string subject = "Water 2D Help!";
Application.OpenURL("mailto:" + email + "?subject=" + subject + "&body=" + "");
}
bool _dynamic = true;
public bool Dynamic {get{return _dynamic;}
set{
_dynamic = value;
}
}
bool alreadySpawned = false;
public int AllBallsCount{ get; private set;}
public bool IsWaterInScene{ get; private set;}
int usableDropsCount;
int DefaultCount;
// MICRO SPWNS
// Used to make spawn in other positions with same properties (use same array of particles)
List<microSpawn> microSpawns;
bool _breakLoop = false;
GameObject _parent;
void Start()
{
//Application.targetFrameRate = 60;
_parent = new GameObject ("_metaBalls");
//_parent.hideFlags = HideFlags.HideInHierarchy;
WaterDropsObjects [0].transform.SetParent (_parent.transform);
WaterDropsObjects [0].transform.localScale = new Vector3 (size, size, 1f);
WaterDropsObjects [0].GetComponent<MetaballParticleClass>().Active = false;
for (int i = 1; i < WaterDropsObjects.Length; i++) {
WaterDropsObjects[i] = Instantiate(WaterDropsObjects[0], gameObject.transform.position, new Quaternion(0,0,0,0)) as GameObject;
WaterDropsObjects [i].GetComponent<MetaballParticleClass>().Active = false;
WaterDropsObjects [i].transform.SetParent (_parent.transform);
WaterDropsObjects [i].transform.localScale = new Vector3 (size, size, 1f);
WaterDropsObjects[i].layer = WaterDropsObjects[0].layer;
//WaterDropsObjects[i].SetActive(false);
}
WaterDropsObjects[0].SetActive(false);
AllBallsCount = WaterDropsObjects.Length;
microSpawns = new List<microSpawn>(5); // Up to 5 microspwawn
instance.Spawn();
}
public void RunMicroSpawn(Vector3 pos, int amount, Vector2 initVel)
{
addMicroSpawn (pos, amount, initVel);
executeMicroSpawns ();
}
public void addMicroSpawn(Vector3 pos, int amount, Vector2 initVel)
{
microSpawns.Add( new microSpawn (pos, amount, initVel));
}
public void Spawn(){
Spawn (DefaultCount);
}
public void Spawn(int count){
executeMicroSpawns ();
if (DelayBetweenParticles == 0f)
{
SpawnAll();
}
else {
StartCoroutine(loop(gameObject.transform.position, initSpeed, count));
}
}
public void SpawnAll() {
SpawnAllParticles(gameObject.transform.position, initSpeed, DefaultCount);
}
public void Spawn(int count, Vector3 pos){
executeMicroSpawns ();
StartCoroutine (loop(pos, initSpeed, count));
}
public void Spawn(int count, Vector3 pos, Vector2 InitVelocity, float delay = 0f){
executeMicroSpawns ();
StartCoroutine (loop(pos, InitVelocity, count, delay));
}
void executeMicroSpawns()
{
if (microSpawns == null)
return;
if (microSpawns.Count > 0 && microSpawns.Capacity > 0) {
for (int i = 0; i < microSpawns.Count; i++) {
//Spawn (microSpawns [i].amount, microSpawns [i].pos, microSpawns [i].initVel);
DynamicChanges = false;
StartCoroutine (loop(microSpawns [i].pos, microSpawns [i].initVel, microSpawns [i].amount ,0f));
}
microSpawns.Clear ();
}
}
public void Restore()
{
IsWaterInScene = false;
_breakLoop = true;
microSpawns.Clear ();
for (int i = 0; i < WaterDropsObjects.Length; i++) {
if (WaterDropsObjects [i].GetComponent<MetaballParticleClass> ().Active == true) {
WaterDropsObjects [i].GetComponent<MetaballParticleClass> ().Active = false;
}
WaterDropsObjects [i].GetComponent<MetaballParticleClass> ().witinTarget = false;
}
gameObject.transform.localEulerAngles = Vector3.zero;
initSpeed = new Vector2 (0, -2f);
DefaultCount = AllBallsCount;
usableDropsCount = DefaultCount;
//Dynamic = false;
}
IEnumerator loop(Vector3 _pos, Vector2 _initSpeed, int count = -1, float delay = 0f, bool waitBetweenDropSpawn = true){
yield return new WaitForSeconds (delay);
_breakLoop = false;
IsWaterInScene = true;
int auxCount = 0;
while (true) {
for (int i = 0; i < WaterDropsObjects.Length; i++) {
if (_breakLoop)
yield break;
MetaballParticleClass MetaBall = WaterDropsObjects [i].GetComponent<MetaballParticleClass> ();
if (MetaBall.Active == true)
continue;
MetaBall.LifeTime = LifeTime;
WaterDropsObjects [i].transform.position = transform.position;
MetaBall.Active = true;
MetaBall.witinTarget = false;
if (_initSpeed == Vector2.zero)
_initSpeed = initSpeed;
if (DynamicChanges) {
_initSpeed = initSpeed;
MetaBall.transform.localScale = new Vector3 (size, size, 1f);
SetWaterColor (FillColor, StrokeColor);
}
WaterDropsObjects [i].GetComponent<Rigidbody2D> ().velocity = _initSpeed;
// Count limiter
if (count > -1) {
auxCount++;
if (auxCount >= count && !Dynamic) {
yield break;
}
}
if(waitBetweenDropSpawn)
yield return new WaitForSeconds (DelayBetweenParticles);
}
yield return new WaitForEndOfFrame ();
alreadySpawned = true;
if (!Dynamic)
yield break;
}
}
void SpawnAllParticles(Vector3 _pos, Vector2 _initSpeed, int count = -1, float delay = 0f, bool waitBetweenDropSpawn = true)
{
IsWaterInScene = true;
int auxCount = 0;
// while (true)
//{
for (int i = 0; i < WaterDropsObjects.Length; i++)
{
MetaballParticleClass MetaBall = WaterDropsObjects[i].GetComponent<MetaballParticleClass>();
if (MetaBall.Active == true)
continue;
MetaBall.LifeTime = LifeTime;
WaterDropsObjects[i].transform.position = transform.position;
MetaBall.Active = true;
MetaBall.witinTarget = false;
if (_initSpeed == Vector2.zero)
_initSpeed = initSpeed;
if (DynamicChanges)
{
_initSpeed = initSpeed;
MetaBall.transform.localScale = new Vector3(size, size, 1f);
SetWaterColor(FillColor, StrokeColor);
}
WaterDropsObjects[i].GetComponent<Rigidbody2D>().velocity = _initSpeed;
// Count limiter
if (count > -1)
{
auxCount++;
if (auxCount >= count && !Dynamic)
{
break;
}
}
}
alreadySpawned = true;
// }
}
public void SetWaterColor(Color fill, Color stroke)
{
WaterMaterial.SetColor ("_Color", fill);
WaterMaterial.SetColor ("_StrokeColor", stroke);
}
}
} | 25.088312 | 132 | 0.600166 | [
"CC0-1.0"
] | RoachA/SDF_TESTS | SDF_TEST/Assets/Water2D/Core/Water2D_Spawner.cs | 9,661 | C# |
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using watchtower.Code.ExtensionMethods;
using watchtower.Models.Census;
namespace watchtower.Services.Census.Readers {
public class CensusDirectiveReader : ICensusReader<PsDirective> {
public override PsDirective? ReadEntry(JToken token) {
PsDirective dir = new PsDirective();
dir.ID = token.GetRequiredInt32("directive_id");
dir.TreeID = token.GetInt32("directive_tree_id", 0);
dir.TierID = token.GetInt32("directive_tier_id", 0);
dir.ObjectiveSetID = token.GetInt32("objective_set_id", 0);
dir.Name = token.SelectToken("name")?.GetString("en", "<missing name>") ?? "<missing name>";
dir.Description = token.SelectToken("description")?.GetString("en", "<missing description>") ?? "<missing description>";
dir.ImageSetID = token.GetInt32("image_set_id", 0);
dir.ImageID = token.GetInt32("image_id", 0);
return dir;
}
}
}
| 36.533333 | 132 | 0.663321 | [
"MIT"
] | Simacrus/honu | Services/Census/Readers/CensusDirectiveReader.cs | 1,096 | C# |
using System;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Query;
namespace EntityFramework.ExtensionUtilities.Extensions
{
public static class ExpressionUtilities
{
internal static void AddQueryFilter<T>(this EntityTypeBuilder entityTypeBuilder,
Expression<Func<T, bool>> expression)
{
var parameterType = Expression.Parameter(entityTypeBuilder.Metadata.ClrType);
var expressionFilter = ReplacingExpressionVisitor.Replace(
expression.Parameters.Single(), parameterType, expression.Body);
var currentQueryFilter = entityTypeBuilder.Metadata.GetQueryFilter();
if (currentQueryFilter != null)
{
var currentExpressionFilter = ReplacingExpressionVisitor.Replace(
currentQueryFilter.Parameters.Single(), parameterType, currentQueryFilter.Body);
expressionFilter = Expression.AndAlso(currentExpressionFilter, expressionFilter);
}
var lambdaExpression = Expression.Lambda(expressionFilter, parameterType);
entityTypeBuilder.HasQueryFilter(lambdaExpression);
}
internal static Expression<Func<T, bool>> CombineExpressions<T>(Expression<Func<T, bool>> expression1,
Expression<Func<T, bool>> expression2)
{
var body = Expression.AndAlso(expression1.Body, expression2.Body);
return Expression.Lambda<Func<T, bool>>(body, expression1.Parameters[0]);
}
// public static IQueryable<TEntity> IgnoreSoftDeleteFilter<TEntity>(
// this IQueryable<TEntity> baseQuery, string currentTenantId)
// where TEntity : class, ITenant<>
// {
// return baseQuery.IgnoreQueryFilters()
// .Where(x => x.TenantId == currentTenantId)
// }
}
} | 42.489362 | 110 | 0.674011 | [
"MIT"
] | direncancatalkaya/ExtendedMultitenancy | DRN.EntityFramework.ExtendedMultiTenancy/Extensions/ExpressionExtensions.cs | 1,999 | C# |
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Linq;
using System.Runtime.InteropServices;
using Yuzu;
using System.Runtime.CompilerServices;
namespace Lime
{
internal static class MeshBufferPools
{
public static readonly BufferPool Vertex = new BufferPool(BufferType.Vertex, true, 64 * 1024);
public static readonly BufferPool Index = new BufferPool(BufferType.Index, true, 64 * 1024);
}
[YuzuSpecializeWith(typeof(Lime.Mesh3D.Vertex))]
public unsafe partial class Mesh<T> : IMesh, IDisposable where T : unmanaged
{
private bool disposed;
[YuzuMember]
public int[] AttributeLocations;
[YuzuMember]
public T[] Vertices;
[YuzuMember]
[TangerineKeyframeColor(21)]
public ushort[] Indices;
[YuzuMember]
public PrimitiveTopology Topology = PrimitiveTopology.TriangleList;
public int VertexCount = -1;
public int IndexCount = -1;
public MeshDirtyFlags DirtyFlags = MeshDirtyFlags.All;
private VertexInputLayout inputLayout;
private Buffer vertexBuffer;
private Buffer indexBuffer;
public void Dispose()
{
if (!disposed) {
if (vertexBuffer != null) {
var vertexBufferCopy = vertexBuffer;
Window.Current.InvokeOnRendering(() => {
MeshBufferPools.Vertex.ReleaseBuffer(vertexBufferCopy);
});
vertexBuffer = null;
}
if (indexBuffer != null) {
var indexBufferCopy = indexBuffer;
Window.Current.InvokeOnRendering(() => {
MeshBufferPools.Index.ReleaseBuffer(indexBufferCopy);
});
indexBuffer = null;
}
disposed = true;
}
}
public Mesh<T> ShallowClone()
{
return (Mesh<T>)MemberwiseClone();
}
IMesh IMesh.ShallowClone() => ShallowClone();
public void Draw(int startVertex, int vertexCount)
{
PreDraw();
PlatformRenderer.Draw(Topology, startVertex, vertexCount);
}
public void DrawIndexed(int startIndex, int indexCount, int baseVertex = 0)
{
PreDraw();
PlatformRenderer.DrawIndexed(Topology, startIndex, indexCount, baseVertex);
}
private void PreDraw()
{
UpdateBuffers();
UpdateInputLayout();
PlatformRenderer.SetVertexInputLayout(inputLayout);
PlatformRenderer.SetVertexBuffer(0, vertexBuffer, 0);
PlatformRenderer.SetIndexBuffer(indexBuffer, 0, IndexFormat.Index16Bits);
}
public int GetEffectiveVertexCount()
{
return VertexCount >= 0 ? VertexCount : Vertices?.Length ?? 0;
}
public int GetEffectiveIndexCount()
{
return IndexCount >= 0 ? IndexCount : Indices?.Length ?? 0;
}
private void UpdateBuffers()
{
if ((DirtyFlags & MeshDirtyFlags.Vertices) != 0) {
var vertexCount = GetEffectiveVertexCount();
if (vertexBuffer == null || vertexBuffer.Size != vertexCount * sizeof(T)) {
if (vertexBuffer != null) {
MeshBufferPools.Vertex.ReleaseBuffer(vertexBuffer);
}
vertexBuffer = MeshBufferPools.Vertex.AcquireBuffer(vertexCount * sizeof(T));
}
vertexBuffer.SetData(0, Vertices, 0, vertexCount, BufferSetDataMode.Discard);
DirtyFlags &= ~MeshDirtyFlags.Vertices;
}
if ((DirtyFlags & MeshDirtyFlags.Indices) != 0) {
var indexCount = GetEffectiveIndexCount();
if (indexBuffer == null || indexBuffer.Size != indexCount * sizeof(ushort)) {
if (indexBuffer != null) {
MeshBufferPools.Index.ReleaseBuffer(indexBuffer);
}
indexBuffer = MeshBufferPools.Index.AcquireBuffer(indexCount * sizeof(ushort));
}
indexBuffer.SetData(0, Indices, 0, indexCount, BufferSetDataMode.Discard);
DirtyFlags &= ~MeshDirtyFlags.Indices;
}
}
private void UpdateInputLayout()
{
if (inputLayout == null || (DirtyFlags & MeshDirtyFlags.AttributeLocations) != 0) {
var bindings = new[] {
new VertexInputLayoutBinding {
Slot = 0,
Stride = sizeof(T)
}
};
var attributes = new List<VertexInputLayoutAttribute>();
foreach (var elementDescription in GetElementDescriptions()) {
attributes.Add(new VertexInputLayoutAttribute {
Slot = 0,
Location = AttributeLocations[attributes.Count],
Offset = elementDescription.Offset,
Format = elementDescription.Format,
});
}
inputLayout = VertexInputLayout.New(bindings, attributes.ToArray());
DirtyFlags &= ~MeshDirtyFlags.AttributeLocations;
}
}
[ThreadStatic]
private static ElementDescription[] elementDescriptions;
private static ElementDescription[] GetElementDescriptions()
{
if (elementDescriptions == null) {
elementDescriptions = GetElementDescriptionsFromReflection().ToArray();
}
return elementDescriptions;
}
private static IEnumerable<ElementDescription> GetElementDescriptionsFromReflection()
{
int offset = 0;
var result = GetElementDescription(typeof(T), ref offset);
if (result != null) {
yield return result;
yield break;
}
foreach (var field in typeof(T).GetFields()) {
var attrs = field.GetCustomAttributes(typeof(FieldOffsetAttribute), false);
if (attrs.Length > 0) {
offset = (attrs[0] as FieldOffsetAttribute).Value;
}
result = GetElementDescription(field.FieldType, ref offset);
if (result != null) {
yield return result;
} else {
throw new InvalidOperationException();
}
}
}
private static ElementDescription GetElementDescription(Type type, ref int offset)
{
ElementDescription result = null;
if (type == typeof(float)) {
result = new ElementDescription { Format = Format.R32_SFloat, Offset = offset };
offset += 4;
} else if (type == typeof(Vector2)) {
result = new ElementDescription { Format = Format.R32G32_SFloat, Offset = offset };
offset += 8;
} else if (type == typeof(Vector3)) {
result = new ElementDescription { Format = Format.R32G32B32_SFloat, Offset = offset };
offset += 12;
} else if (type == typeof(Vector4)) {
result = new ElementDescription { Format = Format.R32G32B32A32_SFloat, Offset = offset };
offset += 16;
} else if (type == typeof(Color4)) {
result = new ElementDescription { Format = Format.R8G8B8A8_UNorm, Offset = offset };
offset += 4;
} else if (type == typeof(Mesh3D.BlendIndices)) {
result = new ElementDescription { Format = Format.R32G32B32A32_SFloat, Offset = offset };
offset += 16;
} else if (type == typeof(Mesh3D.BlendWeights)) {
result = new ElementDescription { Format = Format.R32G32B32A32_SFloat, Offset = offset };
offset += 16;
}
return result;
}
private class ElementDescription
{
public Format Format;
public int Offset;
}
}
internal class BufferPool : IDisposable
{
private BufferType bufferType;
private bool dynamic;
private Stack<Buffer>[] pools;
public BufferPool(BufferType bufferType, bool dynamic, int maxSize)
{
this.bufferType = bufferType;
this.dynamic = dynamic;
pools = new Stack<Buffer>[GetSizeClass(maxSize) + 1];
for (var i = 0; i < pools.Length; i++) {
pools[i] = new Stack<Buffer>();
}
}
public void Dispose()
{
foreach (var p in pools) {
while (p.Count > 0) {
p.Pop().Dispose();
}
}
}
public Buffer AcquireBuffer(int size)
{
System.Diagnostics.Debug.Assert(size > 0);
var sizeClass = GetSizeClass(size);
if (sizeClass >= pools.Length) {
return new Buffer(bufferType, size, dynamic);
}
if (pools[sizeClass].Count > 0) {
return pools[sizeClass].Pop();
}
return new Buffer(bufferType, GetMaxSize(sizeClass), dynamic);
}
public void ReleaseBuffer(Buffer buffer)
{
if (buffer.Type != bufferType || buffer.Dynamic != dynamic) {
throw new ArgumentException(nameof(buffer));
}
var sizeClass = GetSizeClass(buffer.Size);
if (sizeClass < pools.Length) {
if (buffer.Size != GetMaxSize(sizeClass)) {
throw new ArgumentException(nameof(buffer));
}
pools[sizeClass].Push(buffer);
} else {
buffer.Dispose();
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int GetSizeClass(int size)
{
System.Diagnostics.Debug.Assert(size > 0);
// TODO: Use BitOperations.LeadingZeroCount when .net6 is available:
// return 32 - BitOperations.LeadingZeroCount(((uint)size - 1) >> 4);
return Log2SoftwareFallback((size - 1) >> 4) + 1;
}
// https://stackoverflow.com/questions/10439242/count-leading-zeroes-in-an-int32/10439333#10439333
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Log2SoftwareFallback(int x)
{
unchecked {
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
// Count the ones: http://aggregate.org/MAGIC/#Population%20Count%20(Ones%20Count)
x -= x >> 1 & 0x55555555;
x = (x >> 2 & 0x33333333) + (x & 0x33333333);
x = (x >> 4) + x & 0x0f0f0f0f;
x += x >> 8;
x += x >> 16;
//subtract # of 1s from 32
return (x & 0x0000003f) - 1;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int GetMaxSize(int sizeClass)
{
return 16 << sizeClass;
}
}
}
| 28.926045 | 100 | 0.679413 | [
"MIT"
] | game-forest/Citrus | Lime/Source/Graphics/Mesh.cs | 8,996 | C# |
using System.Collections.Generic;
using Kari.GeneratorCore;
using Kari.GeneratorCore.Workflow;
using Kari.Utils;
namespace Kari.Plugins.Terminal
{
public partial class ParsersAnalyzer : ICollectSymbols, IGenerateCode
{
public string DefinitionsNamespace => TerminalAdministrator.TerminalProject.GeneratedNamespaceName;
internal readonly List<CustomParserInfo> _customParserInfos = new List<CustomParserInfo>();
internal readonly List<CustomParserInfo> _customParserFunctionInfos = new List<CustomParserInfo>();
public void CollectSymbols(ProjectEnvironment environment)
{
string parsersFullyQualifiedClassName = ParserDatabase.GetFullyQualifiedParsersClassNameForProject(environment.Data);
foreach (var type in environment.TypesWithAttributes)
{
if (type.TryGetAttribute(ParserSymbols.ParserAttribute, environment.Logger, out var parserAttribute))
{
var info = new CustomParserInfo(type, parserAttribute, parsersFullyQualifiedClassName);
_customParserInfos.Add(info);
ParserDatabase.Instance.AddParser(info);
}
}
foreach (var method in environment.MethodsWithAttributes)
{
if (!method.IsStatic) continue;
if (method.TryGetAttribute(ParserSymbols.ParserAttribute, environment.Logger, out var parserAttribute))
{
var info = new CustomParserInfo(method, parserAttribute, parsersFullyQualifiedClassName);
_customParserFunctionInfos.Add(info);
ParserDatabase.Instance.AddParser(info);
}
}
}
internal static CodeBuilder TransformMaster()
{
var numberTypes = new string[]
{
"int", "long", "short", "sbyte",
"uint", "ulong", "ushort", "byte",
"double", "float", "decimal"
};
var numberTypesPascal = new string[]
{
"Int", "Long", "Short", "SByte",
"UInt", "ULong", "UShort", "Byte",
"Double", "Float", "Decimal"
};
var builder = CodeBuilder.Create();
builder.AppendLine("namespace ", TerminalAdministrator.TerminalProject.GeneratedNamespaceName);
builder.StartBlock();
builder.Append(@"/// <summary>
/// Encapsulates a method that does parsing.
/// This is cleaner with concrete types instead of the generic System.Func's or
/// even named delegates, plus these classes are mostly autogenerated.
/// </summary>
public interface IValueParser<T>
{
ParseSummary Parse(string input, out T result);
}
/// <summary>
/// Essentially, provides no-throw error handling for parsers.
/// </summary>
public readonly struct ParseSummary
{
public readonly string Message;
public bool IsError => Message != null;
public ParseSummary(string message) { Message = message; }
public static readonly ParseSummary Success = new ParseSummary(null);
public static ParseSummary TypeMismatch(string expectedTypeName, string actualInput) => new ParseSummary($""Expected input compatible with type {expectedTypeName}, got '{actualInput}'."");
}
public class BoolParser : IValueParser<bool>
{
public ParseSummary Parse(string input, out bool value) => Generated.Parsers.Parse(input, out value);
}
public class StringParser : IValueParser<string>
{
public ParseSummary Parse(string input, out string value)
{
value = input;
return ParseSummary.Success;
}
}
public static partial class Parsers
{
public static readonly BoolParser Bool = new BoolParser();
public static readonly StringParser String = new StringParser();
public static ParseSummary Parse(this string input, out bool result)
{
if (string.Compare(input, ""TRUE"", ignoreCase: true) == 0)
{
result = true;
return ParseSummary.Success;
}
if (string.Compare(input, ""FALSE"", ignoreCase: true) == 0)
{
result = false;
return ParseSummary.Success;
}
result = default;
return ParseSummary.TypeMismatch(""bool"", input);
}
");
builder.IncreaseIndent();
for (int i = 0; i < numberTypes.Length; i++)
{
string type = numberTypes[i];
string typePascal = numberTypesPascal[i];
string parserName = $"{typePascal}Parser";
builder.AppendLine($"public class {parserName} : IValueParser<{type}>");
builder.StartBlock();
builder.AppendLine($"public ParseSummary Parse(string input, out {type} value) => Parsers.Parse(input, out value);");
builder.EndBlock();
builder.AppendLine($"public static readonly {parserName} {typePascal} = new {parserName}();");
builder.AppendLine($"public static ParseSummary Parse(this string input, out {type} result");
builder.StartBlock();
builder.AppendLine($"if ({type}.TryParse(input, out result))");
builder.IncreaseIndent();
builder.AppendLine("return ParseSummary.Success;");
builder.DecreaseIndent();
builder.AppendLine($"return ParseSummary.TypeMismatch({type}input);");
builder.EndBlock();
}
builder.EndBlock();
builder.EndBlock();
return builder;
}
public void GenerateCode(ProjectEnvironmentData project, ref CodeBuilder builder)
{
if (_customParserFunctionInfos.Count == 0 && _customParserInfos.Count == 0)
return;
builder.AppendLine("namespace ", project.GeneratedNamespaceName);
builder.StartBlock();
builder.AppendLine("using ", DefinitionsNamespace);
builder.AppendLine("public static partial class Parsers");
builder.StartBlock();
foreach (var func in _customParserFunctionInfos)
{
var parserName = func.Name + "Parser";
builder.AppendLine($"public class {parserName} : IValueParser<{func.TypeName}>");
builder.StartBlock();
builder.AppendLine($"public ParseSummary Parse(string input, out {func.TypeName} value) => ",
$"{func.FullyQualifiedName}(input, out value);");
builder.AppendLine($"public static readonly {parserName} {func.Name} = new {parserName}();");
builder.EndBlock();
}
foreach (var parser in _customParserInfos)
{
builder.AppendLine($"public static readonly {parser.FullyQualifiedName} {parser.Name} = new {parser.FullyQualifiedName}();");
}
builder.EndBlock();
}
}
} | 41.079096 | 196 | 0.59084 | [
"MIT"
] | AntonC9018/Kari | source/Kari.Plugins/Terminal/Parsers/ParsersAnalyzer.cs | 7,271 | 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.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
namespace Microsoft.EntityFrameworkCore.SqlServer.Query.Internal
{
public class SqlServerSqlTranslatingExpressionVisitor : RelationalSqlTranslatingExpressionVisitor
{
private static readonly HashSet<string> _dateTimeDataTypes
= new HashSet<string>
{
"time",
"date",
"datetime",
"datetime2",
"datetimeoffset"
};
private static readonly HashSet<ExpressionType> _arithmeticOperatorTypes
= new HashSet<ExpressionType>
{
ExpressionType.Add,
ExpressionType.Subtract,
ExpressionType.Multiply,
ExpressionType.Divide,
ExpressionType.Modulo,
};
// TODO: Possibly make this protected in base
private readonly ISqlExpressionFactory _sqlExpressionFactory;
public SqlServerSqlTranslatingExpressionVisitor(
RelationalSqlTranslatingExpressionVisitorDependencies dependencies,
IModel model,
QueryableMethodTranslatingExpressionVisitor queryableMethodTranslatingExpressionVisitor)
: base(dependencies, model, queryableMethodTranslatingExpressionVisitor)
{
_sqlExpressionFactory = dependencies.SqlExpressionFactory;
}
protected override Expression VisitBinary(BinaryExpression binaryExpression)
{
var visitedExpression = (SqlExpression)base.VisitBinary(binaryExpression);
if (visitedExpression == null)
{
return null;
}
return visitedExpression is SqlBinaryExpression sqlBinary
&& _arithmeticOperatorTypes.Contains(sqlBinary.OperatorType)
&& (_dateTimeDataTypes.Contains(GetProviderType(sqlBinary.Left))
|| _dateTimeDataTypes.Contains(GetProviderType(sqlBinary.Right)))
? null
: visitedExpression;
}
public override SqlExpression TranslateLongCount(Expression expression = null)
{
// TODO: Translate Count with predicate for GroupBy
return _sqlExpressionFactory.ApplyDefaultTypeMapping(
_sqlExpressionFactory.Function("COUNT_BIG", new[] { _sqlExpressionFactory.Fragment("*") }, typeof(long)));
}
private static string GetProviderType(SqlExpression expression)
{
return expression.TypeMapping?.StoreType;
}
}
}
| 38.986667 | 122 | 0.655267 | [
"Apache-2.0"
] | skalpin/EntityFrameworkCore | src/EFCore.SqlServer/Query/Internal/SqlServerSqlTranslatingExpressionVisitor.cs | 2,926 | C# |
using Authorize.Model;
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace authorize.service.Helper
{
public class AutoMapperProfile : Profile
{
public AutoMapperProfile()
{
CreateMap<CustomerModel, Customer>();
CreateMap<Customer, CustomerModel>();
}
}
}
| 20.578947 | 49 | 0.672634 | [
"MIT"
] | AJEETX/dotnet2-microservices-docker-swagger | AuthorizeService/Helper/AutoMapperProfile.cs | 393 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Umbraco.Core.Auditing;
using Umbraco.Core.Events;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Services
{
/// <summary>
/// Represents the Macro Service, which is an easy access to operations involving <see cref="IMacro"/>
/// </summary>
public class MacroService : RepositoryService, IMacroService
{
public MacroService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory)
: base(provider, repositoryFactory, logger, eventMessagesFactory)
{
}
/// <summary>
/// Returns an enum <see cref="MacroTypes"/> based on the properties on the Macro
/// </summary>
/// <returns><see cref="MacroTypes"/></returns>
internal static MacroTypes GetMacroType(IMacro macro)
{
if (string.IsNullOrEmpty(macro.XsltPath) == false)
return MacroTypes.Xslt;
if (string.IsNullOrEmpty(macro.ScriptPath) == false)
{
//we need to check if the file path saved is a virtual path starting with ~/Views/MacroPartials, if so then this is
//a partial view macro, not a script macro
//we also check if the file exists in ~/App_Plugins/[Packagename]/Views/MacroPartials, if so then it is also a partial view.
return (macro.ScriptPath.InvariantStartsWith(SystemDirectories.MvcViews + "/MacroPartials/")
|| (Regex.IsMatch(macro.ScriptPath, "~/App_Plugins/.+?/Views/MacroPartials", RegexOptions.Compiled | RegexOptions.IgnoreCase)))
? MacroTypes.PartialView
: MacroTypes.Script;
}
if (string.IsNullOrEmpty(macro.ControlType) == false && macro.ControlType.InvariantContains(".ascx"))
return MacroTypes.UserControl;
if (string.IsNullOrEmpty(macro.ControlType) == false && string.IsNullOrEmpty(macro.ControlAssembly) == false)
return MacroTypes.CustomControl;
return MacroTypes.Unknown;
}
/// <summary>
/// Gets an <see cref="IMacro"/> object by its alias
/// </summary>
/// <param name="alias">Alias to retrieve an <see cref="IMacro"/> for</param>
/// <returns>An <see cref="IMacro"/> object</returns>
public IMacro GetByAlias(string alias)
{
using (var repository = RepositoryFactory.CreateMacroRepository(UowProvider.GetUnitOfWork()))
{
var q = new Query<IMacro>();
q.Where(macro => macro.Alias == alias);
return repository.GetByQuery(q).FirstOrDefault();
}
}
///// <summary>
///// Gets a list all available <see cref="IMacro"/> objects
///// </summary>
///// <param name="aliases">Optional array of aliases to limit the results</param>
///// <returns>An enumerable list of <see cref="IMacro"/> objects</returns>
//public IEnumerable<IMacro> GetAll(params string[] aliases)
//{
// using (var repository = RepositoryFactory.CreateMacroRepository(UowProvider.GetUnitOfWork()))
// {
// if (aliases.Any())
// {
// return GetAllByAliases(repository, aliases);
// }
// return repository.GetAll();
// }
//}
public IEnumerable<IMacro> GetAll(params int[] ids)
{
using (var repository = RepositoryFactory.CreateMacroRepository(UowProvider.GetUnitOfWork()))
{
return repository.GetAll(ids);
}
}
public IMacro GetById(int id)
{
using (var repository = RepositoryFactory.CreateMacroRepository(UowProvider.GetUnitOfWork()))
{
return repository.Get(id);
}
}
//private IEnumerable<IMacro> GetAllByAliases(IMacroRepository repo, IEnumerable<string> aliases)
//{
// foreach (var alias in aliases)
// {
// var q = new Query<IMacro>();
// q.Where(macro => macro.Alias == alias);
// yield return repo.GetByQuery(q).FirstOrDefault();
// }
//}
/// <summary>
/// Deletes an <see cref="IMacro"/>
/// </summary>
/// <param name="macro"><see cref="IMacro"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the macro</param>
public void Delete(IMacro macro, int userId = 0)
{
if (Deleting.IsRaisedEventCancelled(new DeleteEventArgs<IMacro>(macro), this))
return;
var uow = UowProvider.GetUnitOfWork();
using (var repository = RepositoryFactory.CreateMacroRepository(uow))
{
repository.Delete(macro);
uow.Commit();
Deleted.RaiseEvent(new DeleteEventArgs<IMacro>(macro, false), this);
}
Audit(AuditType.Delete, "Delete Macro performed by user", userId, -1);
}
/// <summary>
/// Saves an <see cref="IMacro"/>
/// </summary>
/// <param name="macro"><see cref="IMacro"/> to save</param>
/// <param name="userId">Optional Id of the user deleting the macro</param>
public void Save(IMacro macro, int userId = 0)
{
if (Saving.IsRaisedEventCancelled(new SaveEventArgs<IMacro>(macro), this))
return;
var uow = UowProvider.GetUnitOfWork();
using (var repository = RepositoryFactory.CreateMacroRepository(uow))
{
repository.AddOrUpdate(macro);
uow.Commit();
Saved.RaiseEvent(new SaveEventArgs<IMacro>(macro, false), this);
}
Audit(AuditType.Save, "Save Macro performed by user", userId, -1);
}
///// <summary>
///// Gets a list all available <see cref="IMacroPropertyType"/> plugins
///// </summary>
///// <returns>An enumerable list of <see cref="IMacroPropertyType"/> objects</returns>
//public IEnumerable<IMacroPropertyType> GetMacroPropertyTypes()
//{
// return MacroPropertyTypeResolver.Current.MacroPropertyTypes;
//}
///// <summary>
///// Gets an <see cref="IMacroPropertyType"/> by its alias
///// </summary>
///// <param name="alias">Alias to retrieve an <see cref="IMacroPropertyType"/> for</param>
///// <returns>An <see cref="IMacroPropertyType"/> object</returns>
//public IMacroPropertyType GetMacroPropertyTypeByAlias(string alias)
//{
// return MacroPropertyTypeResolver.Current.MacroPropertyTypes.FirstOrDefault(x => x.Alias == alias);
//}
private void Audit(AuditType type, string message, int userId, int objectId)
{
var uow = UowProvider.GetUnitOfWork();
using (var auditRepo = RepositoryFactory.CreateAuditRepository(uow))
{
auditRepo.AddOrUpdate(new AuditItem(objectId, message, type, userId));
uow.Commit();
}
}
#region Event Handlers
/// <summary>
/// Occurs before Delete
/// </summary>
public static event TypedEventHandler<IMacroService, DeleteEventArgs<IMacro>> Deleting;
/// <summary>
/// Occurs after Delete
/// </summary>
public static event TypedEventHandler<IMacroService, DeleteEventArgs<IMacro>> Deleted;
/// <summary>
/// Occurs before Save
/// </summary>
public static event TypedEventHandler<IMacroService, SaveEventArgs<IMacro>> Saving;
/// <summary>
/// Occurs after Save
/// </summary>
public static event TypedEventHandler<IMacroService, SaveEventArgs<IMacro>> Saved;
#endregion
}
} | 39.549296 | 163 | 0.584639 | [
"MIT"
] | ClaytonWang/Umbraco-CMS | src/Umbraco.Core/Services/MacroService.cs | 8,424 | C# |
using System.Dynamic;
using DigitalSkynet.DotnetCore.Helpers.Razor;
using DigitalSkynet.DotnetCore.Tests.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
namespace DigitalSkynet.DotnetCore.Tests.Razor
{
public class RazorTests : BaseTest
{
private readonly IRazorHelper _razorHelper;
private const string Model = "I'm a string passed to view as a model";
private const string ViewBagString = "I'm a string passed to view as a model";
public RazorTests()
{
_razorHelper = ServiceProvider.GetRequiredService<IRazorHelper>();
}
[Fact]
public async Task TestViewRender_ExistingView_TextMatches()
{
var result = await _razorHelper.RenderViewToStringAsync("Test.cshtml", Model);
Assert.Equal(Model, result);
}
[Fact]
public async Task TestViewRenderWithoutModel_ExistingView_TextMatches()
{
var result = await _razorHelper.RenderViewToStringAsync("TestWithoutModel.cshtml");
Assert.Equal("I am a view rendered using razor engine", result);
}
[Fact]
public async Task TestViewRenderWithViewBag_ExistingView_TextMatches()
{
dynamic viewBag = new ExpandoObject();
viewBag.viewBagString = ViewBagString;
var result = await _razorHelper.RenderViewToStringAsync("TestWithViewBag.cshtml", Model, viewBag);
Assert.Equal($"{Model} {ViewBagString}", result);
}
}
} | 32.957447 | 110 | 0.668819 | [
"MIT"
] | DigitalSkynet/DigitalSkynet.DotnetCore.Api | src/DigitalSkynet.DotnetCore.Tests/Razor/RazorTests.cs | 1,549 | 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.
namespace System.Web.Http.ApiExplorer
{
public class AmbiguousActionController : ApiController
{
// The actions GetItem and Get and potentially be ambiguous under
// route "api/{controller}" because they're both GET api/AmbiguousAction
public void GetItem()
{
}
public void Get()
{
}
public bool Post(int id)
{
return true;
}
}
} | 25.541667 | 111 | 0.616639 | [
"Apache-2.0"
] | 1508553303/AspNetWebStack | test/System.Web.Http.Integration.Test/ApiExplorer/Controllers/AmbiguousActionController.cs | 615 | C# |
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using IRunes.Data;
using IRunes.Models;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
using SIS.HTTP.Requests;
using SIS.HTTP.Responses;
namespace IRunes.App.Controllers
{
public class UsersController : BaseController
{
private string HashPassword(string password)
{
using (SHA256 sha256Hash = SHA256.Create())
{
return Encoding.UTF8.GetString(sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(password)));
}
}
public IHttpResponse Login(IHttpRequest httpRequest)
{
return this.View();
}
public IHttpResponse LoginConfirm(IHttpRequest httpRequest)
{
using (var context = new RunesDbContext())
{
string username = ((ISet<string>) httpRequest.FormData["username"]).FirstOrDefault();
string password = ((ISet<string>) httpRequest.FormData["password"]).FirstOrDefault();
User userFromDb = context.Users.FirstOrDefault(user => (user.Username == username
|| user.Email == username)
&& user.Password == this.HashPassword(password));
if (userFromDb == null)
{
return this.Redirect("/Users/Login");
}
this.SignIn(httpRequest, userFromDb);
}
return this.Redirect("/");
}
public IHttpResponse Register(IHttpRequest httpRequest)
{
return this.View();
}
public IHttpResponse RegisterConfirm(IHttpRequest httpRequest)
{
using (var context = new RunesDbContext())
{
string username = ((ISet<string>)httpRequest.FormData["username"]).FirstOrDefault();
string password = ((ISet<string>)httpRequest.FormData["password"]).FirstOrDefault();
string confirmPassword = ((ISet<string>)httpRequest.FormData["confirmPassword"]).FirstOrDefault();
string email = ((ISet<string>)httpRequest.FormData["email"]).FirstOrDefault();
if (password != confirmPassword)
{
return this.Redirect("/Users/Register");
}
User user = new User
{
Username = username,
Password = this.HashPassword(password),
Email = email
};
context.Users.Add(user);
context.SaveChanges();
}
return this.Redirect("/Users/Login");
}
public IHttpResponse Logout(IHttpRequest httpRequest)
{
this.SignOut(httpRequest);
return this.Redirect("/");
}
}
}
| 33.263736 | 120 | 0.539478 | [
"MIT"
] | MrPIvanov/SoftUni | 16-C# Web Basics/10_WORKSHOP - WEB APPLICATION. ADVANCED CSS - BOOTSTRAP/Solution/Apps/IRunes/IRunes.App/Controllers/UsersController.cs | 3,029 | C# |
/* This is a .NET port of the Douglas Crockford's JSMin 'C' project. *
* In addition to original functionality was added support of Angular
* binding expressions minification.
*
* The author's copyright message is reproduced below.
*/
/* jsmin.c
2019-10-30
Copyright (C) 2002 Douglas Crockford (www.crockford.com)
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 shall be used for Good, not Evil.
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.IO;
using System.Text;
using AdvancedStringBuilder;
namespace WebMarkupMin.Core.DouglasCrockford
{
/// <summary>
/// The JavaScript Minifier
/// </summary>
internal sealed class JsMinifier
{
const int EOF = -1;
private StringReader _reader;
private StringWriter _writer;
private int _theA;
private int _theB;
private int _lookAhead = EOF;
private int _theX = EOF;
private int _theY = EOF;
/// <summary>
/// Synchronizer of minification
/// </summary>
private readonly object _minificationSynchronizer = new object();
/// <summary>
/// Removes a comments and unnecessary whitespace from JavaScript code
/// </summary>
/// <param name="content">JavaScript content</param>
/// <returns>Minified JavaScript content</returns>
public string Minify(string content)
{
return Minify(content, false);
}
/// <summary>
/// Removes a comments and unnecessary whitespace from JavaScript code
/// </summary>
/// <param name="content">JavaScript content</param>
/// <param name="isAngularBindingExpression">Flag whether the content is Angular binding expression</param>
/// <returns>Minified JavaScript content</returns>
public string Minify(string content, bool isAngularBindingExpression)
{
string minifiedContent;
lock (_minificationSynchronizer)
{
_theA = 0;
_theB = 0;
_lookAhead = EOF;
_theX = EOF;
_theY = EOF;
var stringBuilderPool = StringBuilderPool.Shared;
StringBuilder sb = stringBuilderPool.Rent(content.Length);
_reader = new StringReader(content);
_writer = new StringWriter(sb);
try
{
StartMinification(isAngularBindingExpression /*WMM+*/);
_writer.Flush();
minifiedContent = sb.TrimStart().ToString();
}
catch (JsMinificationException)
{
throw;
}
finally
{
_reader.Dispose();
_reader = null;
_writer.Dispose();
_writer = null;
stringBuilderPool.Return(sb);
}
}
return minifiedContent;
}
/// <summary>
/// Returns a true if the character is a letter, digit, underscore, dollar sign, or non-ASCII character
/// </summary>
/// <param name="codeunit">The character</param>
/// <returns>Result of check</returns>
private static bool IsAlphanum(int codeunit)
{
return (
(codeunit >= 'a' && codeunit <= 'z')
|| (codeunit >= '0' && codeunit <= '9')
|| (codeunit >= 'A' && codeunit <= 'Z')
|| codeunit == '_'
|| codeunit == '$'
|| codeunit == '\\'
|| codeunit > 126
);
}
/// <summary>
/// Returns a next character from input stream. Watch out for lookahead.
/// If the character is a control character, translate it to a space or linefeed.
/// </summary>
/// <returns>The character</returns>
private int Get()
{
int codeunit = _lookAhead;
_lookAhead = EOF;
if (codeunit == EOF)
{
codeunit = _reader.Read();
}
if (codeunit >= ' ' || codeunit == '\n' || codeunit == EOF)
{
return codeunit;
}
if (codeunit == '\r')
{
return '\n';
}
return ' ';
}
/// <summary>
/// Gets a next character without advancing
/// </summary>
/// <returns>The character</returns>
private int Peek()
{
_lookAhead = Get();
return _lookAhead;
}
/// <summary>
/// Gets a next character, excluding comments.
/// <code>Peek()</code> is used to see if a '/' is followed by a '/' or '*'.
/// </summary>
/// <returns>The character</returns>
private int Next()
{
int codeunit = Get();
if (codeunit == '/')
{
switch (Peek())
{
case '/':
for (;;)
{
codeunit = Get();
if (codeunit <= '\n')
{
break;
}
}
break;
case '*':
Get();
while (codeunit != ' ')
{
switch (Get())
{
case '*':
if (Peek() == '/')
{
Get();
codeunit = ' ';
}
break;
case EOF:
throw new JsMinificationException("Unterminated comment.");
}
}
break;
}
}
_theY = _theX;
_theX = codeunit;
return codeunit;
}
/// <summary>
/// Do something! What you do is determined by the argument:
/// 1 - Output A. Copy B to A. Get the next B.
/// 2 - Copy B to A. Get the next B. (Delete A).
/// 3 - Get the next B. (Delete B).
/// <code>Action</code> treats a string as a single character.
/// <code>Action</code> recognizes a regular expression if it is preceded by the likes of
/// <code>(</code> or <code>,</code> or <code>=</code>.
/// </summary>
/// <param name="determined">Action type</param>
private void Action(int determined)
{
if (determined == 1)
{
Put(_theA);
if (
(_theY == '\n' || _theY == ' ')
&& (_theA == '+' || _theA == '-' || _theA == '*' || _theA == '/')
&& (_theB == '+' || _theB == '-' || _theB == '*' || _theB == '/')
)
{
Put(_theY);
}
}
if (determined <= 2)
{
_theA = _theB;
if (_theA == '\'' || _theA == '"' || _theA == '`')
{
for (;;)
{
Put(_theA);
_theA = Get();
if (_theA == _theB)
{
break;
}
if (_theA == '\\')
{
Put(_theA);
_theA = Get();
}
if (_theA == EOF)
{
throw new JsMinificationException("Unterminated string literal.");
}
}
}
}
if (determined <= 3)
{
_theB = Next();
if (_theB == '/' && (
_theA == '(' || _theA == ',' || _theA == '=' || _theA == ':'
|| _theA == '[' || _theA == '!' || _theA == '&' || _theA == '|'
|| _theA == '?' || _theA == '+' || _theA == '-' || _theA == '~'
|| _theA == '*' || _theA == '/' || _theA == '{' || _theA == '}'
|| _theA == ';'
))
{
Put(_theA);
if (_theA == '/' || _theA == '*')
{
Put(' ');
}
Put(_theB);
for (;;)
{
_theA = Get();
if (_theA == '[')
{
for (;;)
{
Put(_theA);
_theA = Get();
if (_theA == ']')
{
break;
}
if (_theA == '\\')
{
Put(_theA);
_theA = Get();
}
if (_theA == EOF)
{
throw new JsMinificationException("Unterminated set in Regular Expression literal.");
}
}
}
else if (_theA == '/')
{
switch (Peek())
{
case '/':
case '*':
throw new JsMinificationException("Unterminated set in Regular Expression literal.");
}
break;
}
else if (_theA == '\\')
{
Put(_theA);
_theA = Get();
}
if (_theA == EOF) {
throw new JsMinificationException("Unterminated Regular Expression literal.");
}
Put(_theA);
}
_theB = Next();
}
}
}
/// <summary>
/// Copies a input to the output, deleting the characters which are insignificant to JavaScript.
/// Comments will be removed. Tabs will be replaced with spaces.
/// Carriage returns will be replaced with linefeeds. Most spaces and linefeeds will be removed.
/// </summary>
/// <param name="isAngularBindingExpression">Flag whether the content is Angular binding expression</param>
private void StartMinification(bool isAngularBindingExpression /*WMM+*/)
{
if (Peek() == 0xEF)
{
Get();
Get();
Get();
}
_theA = '\n';
Action(3);
while (_theA != EOF)
{
switch (_theA)
{
case ' ':
Action(
IsAlphanum(_theB)
|| (isAngularBindingExpression && IsAngularOneTimeBinding(_theB, Peek())) //WMM+
? 1
: 2
);
break;
case '\n':
switch (_theB)
{
case '{':
case '[':
case '(':
case '+':
case '-':
case '!':
case '~':
Action(1);
break;
case ' ':
Action(3);
break;
default:
Action(
IsAlphanum(_theB)
|| (isAngularBindingExpression && IsAngularOneTimeBinding(_theB, Peek())) //WMM+
? 1
: 2
);
break;
}
break;
default:
switch (_theB)
{
case ' ':
Action(
IsAlphanum(_theA)
|| (isAngularBindingExpression && _theA == ']' && IsAlphanum(Peek())) //WMM+
? 1
: 3
);
break;
case '\n':
switch (_theA)
{
case '}':
case ']':
case ')':
case '+':
case '-':
case '"':
case '\'':
case '`':
Action(1);
break;
default:
Action(
IsAlphanum(_theA)
? 1
: 3
);
break;
}
break;
default:
Action(1);
break;
}
break;
}
}
}
#region Methods for substitution methods of the C language
/// <summary>
/// Puts a character to output stream
/// </summary>
/// <param name="c">The character</param>
private void Put(int c)
{
_writer.Write((char)c);
}
#endregion
#region Methods for working with Angular-specific syntax constructs
/// <summary>
/// Checks whether the sequence of characters is Angular one-time binding
/// </summary>
/// <param name="firstCodeunit">The first character</param>
/// <param name="secondCodeunit">The second character</param>
/// <returns>Result of check</returns>
private static bool IsAngularOneTimeBinding(int firstCodeunit, int secondCodeunit) //WMM+
{ //WMM+
return firstCodeunit == ':' && secondCodeunit == ':'; //WMM+
} //WMM+
#endregion
}
} | 22.39596 | 109 | 0.550063 | [
"Apache-2.0"
] | alan-strickland/WebMarkupMin | src/WebMarkupMin.Core/DouglasCrockford/JsMinifier.cs | 11,088 | 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 cognito-idp-2016-04-18.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.CognitoIdentityProvider.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.CognitoIdentityProvider.Model.Internal.MarshallTransformations
{
/// <summary>
/// ListResourceServers Request Marshaller
/// </summary>
public class ListResourceServersRequestMarshaller : IMarshaller<IRequest, ListResourceServersRequest> , 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((ListResourceServersRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(ListResourceServersRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.CognitoIdentityProvider");
string target = "AWSCognitoIdentityProviderService.ListResourceServers";
request.Headers["X-Amz-Target"] = target;
request.Headers["Content-Type"] = "application/x-amz-json-1.1";
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2016-04-18";
request.HttpMethod = "POST";
request.ResourcePath = "/";
using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
{
JsonWriter writer = new JsonWriter(stringWriter);
writer.WriteObjectStart();
var context = new JsonMarshallerContext(request, writer);
if(publicRequest.IsSetMaxResults())
{
context.Writer.WritePropertyName("MaxResults");
context.Writer.Write(publicRequest.MaxResults);
}
if(publicRequest.IsSetNextToken())
{
context.Writer.WritePropertyName("NextToken");
context.Writer.Write(publicRequest.NextToken);
}
if(publicRequest.IsSetUserPoolId())
{
context.Writer.WritePropertyName("UserPoolId");
context.Writer.Write(publicRequest.UserPoolId);
}
writer.WriteObjectEnd();
string snippet = stringWriter.ToString();
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);
}
return request;
}
private static ListResourceServersRequestMarshaller _instance = new ListResourceServersRequestMarshaller();
internal static ListResourceServersRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static ListResourceServersRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 36.155172 | 153 | 0.624225 | [
"Apache-2.0"
] | ChristopherButtars/aws-sdk-net | sdk/src/Services/CognitoIdentityProvider/Generated/Model/Internal/MarshallTransformations/ListResourceServersRequestMarshaller.cs | 4,194 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Fabric;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Microsoft.Omex.Extensions.Abstractions;
using Microsoft.Omex.Extensions.Abstractions.Activities;
namespace Microsoft.Omex.Extensions.Diagnostics.HealthChecks
{
internal class HttpEndpointHealthCheck : AbstractHealthCheck<HttpHealthCheckParameters>
{
private const string Host = "localhost";
public static string HttpClientLogicalName { get; } = "HttpEndpointHealthCheckHttpClient";
private readonly IHttpClientFactory m_httpClientFactory;
private readonly IAccessor<ServiceContext> m_accessor;
private Uri? m_uriToCheck;
public HttpEndpointHealthCheck(
HttpHealthCheckParameters parameters,
IHttpClientFactory httpClientFactory,
IAccessor<ServiceContext> accessor,
ILogger<HttpEndpointHealthCheck> logger,
ITimedScopeProvider scopeProvider)
: base(parameters, logger, scopeProvider)
{
m_httpClientFactory = httpClientFactory;
m_accessor = accessor;
}
protected override async Task<HealthCheckResult> CheckHealthInternalAsync(HealthCheckContext context, CancellationToken token)
{
string checkName = context.Registration.Name;
if (m_accessor.Value == null)
{
Logger.LogWarning(Tag.Create(), "'{0}' check executed before ServiceContext provided", checkName);
return new HealthCheckResult(HealthStatus.Degraded, "Not initialized");
}
if (m_uriToCheck == null)
{
int port = m_accessor.Value.CodePackageActivationContext.GetEndpoint(Parameters.EndpointName).Port;
UriBuilder builder = new UriBuilder(Parameters.Scheme, Host, port, Parameters.RelativeUri.ToString());
m_uriToCheck = builder.Uri;
}
HttpClient httpClient = m_httpClientFactory.CreateClient(HttpClientLogicalName);
HttpRequestMessage request = new HttpRequestMessage(Parameters.Method, m_uriToCheck);
HttpResponseMessage? response = await httpClient.SendAsync(request, token).ConfigureAwait(false);
HealthStatus healthStatus = HealthStatus.Unhealthy;
string description = string.Empty;
if (response != null)
{
if (response.StatusCode == Parameters.ExpectedStatus)
{
healthStatus = HealthStatus.Healthy;
}
else
{
Logger.LogWarning(Tag.Create(), "'{0}' is unhealthy, expected request result {1}, actual {2}",
checkName, Parameters.ExpectedStatus, response.StatusCode);
// attach response to description only if check is not healthy to improve performance
description = await response.Content.ReadAsStringAsync();
}
}
HealthCheckResult result = new HealthCheckResult(healthStatus, description, data: Parameters.ReportData);
if (Parameters.AdditionalCheck != null && response != null)
{
Logger.LogInformation(Tag.Create(), "'{0}' check result will be overridden by {1}",
checkName, nameof(HttpHealthCheckParameters.AdditionalCheck));
result = Parameters.AdditionalCheck(response, result);
}
return result;
}
}
}
| 33.15625 | 128 | 0.764373 | [
"MIT"
] | ling1726/Omex | src/Extensions/Diagnostics.HealthChecks/Internal/HttpEndpointHealthCheck.cs | 3,185 | C# |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: MethodCollectionResponse.cs.tt
namespace Microsoft.Graph
{
using System.Collections.Generic;
using System.Text.Json.Serialization;
/// <summary>
/// The type CertificateConnectorDetailsGetHealthMetricTimeSeriesCollectionResponse.
/// </summary>
public class CertificateConnectorDetailsGetHealthMetricTimeSeriesCollectionResponse
{
/// <summary>
/// Gets or sets the <see cref="ICertificateConnectorDetailsGetHealthMetricTimeSeriesCollectionPage"/> value.
/// </summary>
[JsonPropertyName("value")]
public ICertificateConnectorDetailsGetHealthMetricTimeSeriesCollectionPage Value { get; set; }
/// <summary>
/// Gets or sets the nextLink string value.
/// </summary>
[JsonPropertyName("@odata.nextLink")]
[JsonConverter(typeof(NextLinkConverter))]
public string NextLink { get; set; }
/// <summary>
/// Gets or sets additional data.
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalData { get; set; }
}
}
| 38.775 | 153 | 0.60864 | [
"MIT"
] | ScriptBox99/msgraph-beta-sdk-dotnet | src/Microsoft.Graph/Generated/requests/CertificateConnectorDetailsGetHealthMetricTimeSeriesCollectionResponse.cs | 1,551 | C# |
using AutoMapper;
namespace Quantumart.QP8.BLL.Services.DTO
{
public class DTOMapper
{
public static void CreateAllMappings(IMapperConfigurationExpression cfg)
{
cfg.CreateMap<Folder, EntityTreeItem>(MemberList.Destination)
.ForMember(data => data.Alias, opt => opt.MapFrom(src => src.OutputName))
;
}
}
}
| 25.866667 | 89 | 0.621134 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | QuantumArt/QP | bll/Services/DTO/DTOMapper.cs | 390 | C# |
/*******************************************************************************
* 命名空间: SF.Data.Repository
*
* 功 能: N/A
* 类 名: IRoleRepository
*
* Ver 变更日期 负责人 变更内容
* ───────────────────────────────────
* V0.01 2016/11/11 15:18:03 疯狂蚂蚁 初版
*
* Copyright (c) 2016 SF 版权所有
* Description: SF快速开发平台
* Website:http://www.mayisite.com
*********************************************************************************/
using Microsoft.EntityFrameworkCore;
using SF.Core.EFCore.UoW;
using SF.Entitys;
using System.Linq;
namespace SF.Data.Repository
{
public class PermissionRepository : EFCoreQueryableRepository<PermissionEntity, long>, IPermissionRepository
{
public PermissionRepository(DbContext context) : base(context)
{
}
public override IQueryable<PermissionEntity> QueryById(long id)
{
return Query().Where(e => e.Id == id);
}
}
}
| 25.472222 | 112 | 0.520174 | [
"Apache-2.0"
] | blueskybcl/SF-Boilerplate | SF.Data/Repository/Implementation/PermissionRepository.cs | 1,065 | 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.ServiceCatalog;
using Amazon.ServiceCatalog.Model;
namespace Amazon.PowerShell.Cmdlets.SC
{
/// <summary>
/// Lists the account IDs that have access to the specified portfolio.
///
///
/// <para>
/// A delegated admin can list the accounts that have access to the shared portfolio.
/// Note that if a delegated admin is de-registered, they can no longer perform this operation.
/// </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", "SCPortfolioAccessList")]
[OutputType("System.String")]
[AWSCmdlet("Calls the AWS Service Catalog ListPortfolioAccess API operation.", Operation = new[] {"ListPortfolioAccess"}, SelectReturnType = typeof(Amazon.ServiceCatalog.Model.ListPortfolioAccessResponse))]
[AWSCmdletOutput("System.String or Amazon.ServiceCatalog.Model.ListPortfolioAccessResponse",
"This cmdlet returns a collection of System.String objects.",
"The service call response (type Amazon.ServiceCatalog.Model.ListPortfolioAccessResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class GetSCPortfolioAccessListCmdlet : AmazonServiceCatalogClientCmdlet, IExecutor
{
#region Parameter AcceptLanguage
/// <summary>
/// <para>
/// <para>The language code.</para><ul><li><para><code>en</code> - English (default)</para></li><li><para><code>jp</code> - Japanese</para></li><li><para><code>zh</code> - Chinese</para></li></ul>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String AcceptLanguage { get; set; }
#endregion
#region Parameter OrganizationParentId
/// <summary>
/// <para>
/// <para>The ID of an organization node the portfolio is shared with. All children of this
/// node with an inherited portfolio share will be returned.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String OrganizationParentId { get; set; }
#endregion
#region Parameter PortfolioId
/// <summary>
/// <para>
/// <para>The portfolio identifier.</para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)]
#else
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String PortfolioId { get; set; }
#endregion
#region Parameter PageSize
/// <summary>
/// <para>
/// <para>The maximum number of items to return with this call.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? PageSize { get; set; }
#endregion
#region Parameter PageToken
/// <summary>
/// <para>
/// <para>The page token for the next set of results. To retrieve the first set of results,
/// use null.</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 '-PageToken $null' for the first call and '-PageToken $AWSHistory.LastServiceResponse.NextPageToken' for subsequent calls.
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("NextToken")]
public System.String PageToken { get; set; }
#endregion
#region Parameter Select
/// <summary>
/// Use the -Select parameter to control the cmdlet output. The default value is 'AccountIds'.
/// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.ServiceCatalog.Model.ListPortfolioAccessResponse).
/// Specifying the name of a property of type Amazon.ServiceCatalog.Model.ListPortfolioAccessResponse 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; } = "AccountIds";
#endregion
#region Parameter PassThru
/// <summary>
/// Changes the cmdlet behavior to return the value passed to the PortfolioId parameter.
/// The -PassThru parameter is deprecated, use -Select '^PortfolioId' instead. This parameter will be removed in a future version.
/// </summary>
[System.Obsolete("The -PassThru parameter is deprecated, use -Select '^PortfolioId' instead. This parameter will be removed in a future version.")]
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter PassThru { get; set; }
#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 PageToken
/// 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);
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
if (ParameterWasBound(nameof(this.Select)))
{
context.Select = CreateSelectDelegate<Amazon.ServiceCatalog.Model.ListPortfolioAccessResponse, GetSCPortfolioAccessListCmdlet>(Select) ??
throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
if (this.PassThru.IsPresent)
{
throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select));
}
}
else if (this.PassThru.IsPresent)
{
context.Select = (response, cmdlet) => this.PortfolioId;
}
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
context.AcceptLanguage = this.AcceptLanguage;
context.OrganizationParentId = this.OrganizationParentId;
context.PageSize = this.PageSize;
context.PageToken = this.PageToken;
context.PortfolioId = this.PortfolioId;
#if MODULAR
if (this.PortfolioId == null && ParameterWasBound(nameof(this.PortfolioId)))
{
WriteWarning("You are passing $null as a value for parameter PortfolioId which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
// allow further manipulation of loaded context prior to processing
PostExecutionContextLoad(context);
var output = Execute(context) as CmdletOutput;
ProcessOutput(output);
}
#region IExecutor Members
public object Execute(ExecutorContext context)
{
var cmdletContext = context as CmdletContext;
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent;
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
// create request and set iteration invariants
var request = new Amazon.ServiceCatalog.Model.ListPortfolioAccessRequest();
if (cmdletContext.AcceptLanguage != null)
{
request.AcceptLanguage = cmdletContext.AcceptLanguage;
}
if (cmdletContext.OrganizationParentId != null)
{
request.OrganizationParentId = cmdletContext.OrganizationParentId;
}
if (cmdletContext.PageSize != null)
{
request.PageSize = cmdletContext.PageSize.Value;
}
if (cmdletContext.PortfolioId != null)
{
request.PortfolioId = cmdletContext.PortfolioId;
}
// Initialize loop variant and commence piping
var _nextToken = cmdletContext.PageToken;
var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.PageToken));
var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
do
{
request.PageToken = _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.NextPageToken;
}
catch (Exception e)
{
output = new CmdletOutput { ErrorResponse = e };
}
ProcessOutput(output);
} while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken));
if (useParameterSelect)
{
WriteObject(cmdletContext.Select(null, this));
}
return null;
}
public ExecutorContext CreateContext()
{
return new CmdletContext();
}
#endregion
#region AWS Service Operation Call
private Amazon.ServiceCatalog.Model.ListPortfolioAccessResponse CallAWSServiceOperation(IAmazonServiceCatalog client, Amazon.ServiceCatalog.Model.ListPortfolioAccessRequest request)
{
Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Service Catalog", "ListPortfolioAccess");
try
{
#if DESKTOP
return client.ListPortfolioAccess(request);
#elif CORECLR
return client.ListPortfolioAccessAsync(request).GetAwaiter().GetResult();
#else
#error "Unknown build edition"
#endif
}
catch (AmazonServiceException exc)
{
var webException = exc.InnerException as System.Net.WebException;
if (webException != null)
{
throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
}
throw;
}
}
#endregion
internal partial class CmdletContext : ExecutorContext
{
public System.String AcceptLanguage { get; set; }
public System.String OrganizationParentId { get; set; }
public System.Int32? PageSize { get; set; }
public System.String PageToken { get; set; }
public System.String PortfolioId { get; set; }
public System.Func<Amazon.ServiceCatalog.Model.ListPortfolioAccessResponse, GetSCPortfolioAccessListCmdlet, object> Select { get; set; } =
(response, cmdlet) => response.AccountIds;
}
}
}
| 46.299035 | 282 | 0.604834 | [
"Apache-2.0"
] | QPC-database/aws-tools-for-powershell | modules/AWSPowerShell/Cmdlets/ServiceCatalog/Basic/Get-SCPortfolioAccessList-Cmdlet.cs | 14,399 | 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 kinesis-video-media-2017-09-30.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.KinesisVideoMedia.Model
{
/// <summary>
/// This is the response object from the GetMedia operation.
/// </summary>
public partial class GetMediaResponse : AmazonWebServiceResponse
{
private string _contentType;
private Stream _payload;
/// <summary>
/// Gets and sets the property ContentType.
/// <para>
/// The content type of the requested media.
/// </para>
/// </summary>
public string ContentType
{
get { return this._contentType; }
set { this._contentType = value; }
}
// Check to see if ContentType property is set
internal bool IsSetContentType()
{
return this._contentType != null;
}
/// <summary>
/// Gets and sets the property Payload.
/// <para>
/// The payload Kinesis Video Streams returns is a sequence of chunks from the specified
/// stream. For information about the chunks, see . The chunks that Kinesis Video Streams
/// returns in the <code>GetMedia</code> call also include the following additional Matroska
/// (MKV) tags:
/// </para>
/// <ul> <li>
/// <para>
/// AWS_KINESISVIDEO_CONTINUATION_TOKEN (UTF-8 string) - In the event your <code>GetMedia</code>
/// call terminates, you can use this continuation token in your next request to get the
/// next chunk where the last request terminated.
/// </para>
/// </li> <li>
/// <para>
/// AWS_KINESISVIDEO_MILLIS_BEHIND_NOW (UTF-8 string) - Client applications can use this
/// tag value to determine how far behind the chunk returned in the response is from the
/// latest chunk on the stream.
/// </para>
/// </li> <li>
/// <para>
/// AWS_KINESISVIDEO_FRAGMENT_NUMBER - Fragment number returned in the chunk.
/// </para>
/// </li> <li>
/// <para>
/// AWS_KINESISVIDEO_SERVER_TIMESTAMP - Server time stamp of the fragment.
/// </para>
/// </li> <li>
/// <para>
/// AWS_KINESISVIDEO_PRODUCER_TIMESTAMP - Producer time stamp of the fragment.
/// </para>
/// </li> </ul>
/// <para>
/// The following tags will be present if an error occurs:
/// </para>
/// <ul> <li>
/// <para>
/// AWS_KINESISVIDEO_ERROR_CODE - String description of an error that caused GetMedia
/// to stop.
/// </para>
/// </li> <li>
/// <para>
/// AWS_KINESISVIDEO_ERROR_ID: Integer code of the error.
/// </para>
/// </li> </ul>
/// <para>
/// The error codes are as follows:
/// </para>
/// <ul> <li>
/// <para>
/// 3002 - Error writing to the stream
/// </para>
/// </li> <li>
/// <para>
/// 4000 - Requested fragment is not found
/// </para>
/// </li> <li>
/// <para>
/// 4500 - Access denied for the stream's KMS key
/// </para>
/// </li> <li>
/// <para>
/// 4501 - Stream's KMS key is disabled
/// </para>
/// </li> <li>
/// <para>
/// 4502 - Validation error on the Stream's KMS key
/// </para>
/// </li> <li>
/// <para>
/// 4503 - KMS key specified in the stream is unavailable
/// </para>
/// </li> <li>
/// <para>
/// 4504 - Invalid usage of the KMS key specified in the stream
/// </para>
/// </li> <li>
/// <para>
/// 4505 - Invalid state of the KMS key specified in the stream
/// </para>
/// </li> <li>
/// <para>
/// 4506 - Unable to find the KMS key specified in the stream
/// </para>
/// </li> <li>
/// <para>
/// 5000 - Internal error
/// </para>
/// </li> </ul>
/// </summary>
public Stream Payload
{
get { return this._payload; }
set { this._payload = value; }
}
// Check to see if Payload property is set
internal bool IsSetPayload()
{
return this._payload != null;
}
}
} | 33.04375 | 117 | 0.53641 | [
"Apache-2.0"
] | Bio2hazard/aws-sdk-net | sdk/src/Services/KinesisVideoMedia/Generated/Model/GetMediaResponse.cs | 5,287 | 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 codedeploy-2014-10-06.normal.json service model.
*/
using System;
using System.Net;
using Amazon.Runtime;
namespace Amazon.CodeDeploy.Model
{
///<summary>
/// CodeDeploy exception
/// </summary>
#if !PCL && !CORECLR
[Serializable]
#endif
public class InvalidIgnoreApplicationStopFailuresValueException : AmazonCodeDeployException
{
/// <summary>
/// Constructs a new InvalidIgnoreApplicationStopFailuresValueException with the specified error
/// message.
/// </summary>
/// <param name="message">
/// Describes the error encountered.
/// </param>
public InvalidIgnoreApplicationStopFailuresValueException(string message)
: base(message) {}
/// <summary>
/// Construct instance of InvalidIgnoreApplicationStopFailuresValueException
/// </summary>
/// <param name="message"></param>
/// <param name="innerException"></param>
public InvalidIgnoreApplicationStopFailuresValueException(string message, Exception innerException)
: base(message, innerException) {}
/// <summary>
/// Construct instance of InvalidIgnoreApplicationStopFailuresValueException
/// </summary>
/// <param name="innerException"></param>
public InvalidIgnoreApplicationStopFailuresValueException(Exception innerException)
: base(innerException) {}
/// <summary>
/// Construct instance of InvalidIgnoreApplicationStopFailuresValueException
/// </summary>
/// <param name="message"></param>
/// <param name="innerException"></param>
/// <param name="errorType"></param>
/// <param name="errorCode"></param>
/// <param name="requestId"></param>
/// <param name="statusCode"></param>
public InvalidIgnoreApplicationStopFailuresValueException(string message, Exception innerException, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode)
: base(message, innerException, errorType, errorCode, requestId, statusCode) {}
/// <summary>
/// Construct instance of InvalidIgnoreApplicationStopFailuresValueException
/// </summary>
/// <param name="message"></param>
/// <param name="errorType"></param>
/// <param name="errorCode"></param>
/// <param name="requestId"></param>
/// <param name="statusCode"></param>
public InvalidIgnoreApplicationStopFailuresValueException(string message, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode)
: base(message, errorType, errorCode, requestId, statusCode) {}
#if !PCL && !CORECLR
/// <summary>
/// Constructs a new instance of the InvalidIgnoreApplicationStopFailuresValueException class with serialized data.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is null. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0). </exception>
protected InvalidIgnoreApplicationStopFailuresValueException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
#endif
}
} | 46.463918 | 192 | 0.675172 | [
"Apache-2.0"
] | Bio2hazard/aws-sdk-net | sdk/src/Services/CodeDeploy/Generated/Model/InvalidIgnoreApplicationStopFailuresValueException.cs | 4,507 | C# |
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif
using UnityEngine;
namespace UnityTemplateProjects
{
public class SimpleCameraController : MonoBehaviour
{
class CameraState
{
public float yaw;
public float pitch;
public float roll;
public float x;
public float y;
public float z;
public void SetFromTransform(Transform t)
{
pitch = t.eulerAngles.x;
yaw = t.eulerAngles.y;
roll = t.eulerAngles.z;
x = t.position.x;
y = t.position.y;
z = t.position.z;
}
public void Translate(Vector3 translation)
{
Vector3 rotatedTranslation = Quaternion.Euler(pitch, yaw, roll) * translation;
x += rotatedTranslation.x;
y += rotatedTranslation.y;
z += rotatedTranslation.z;
}
public void LerpTowards(CameraState target, float positionLerpPct, float rotationLerpPct)
{
yaw = Mathf.Lerp(yaw, target.yaw, rotationLerpPct);
pitch = Mathf.Lerp(pitch, target.pitch, rotationLerpPct);
roll = Mathf.Lerp(roll, target.roll, rotationLerpPct);
x = Mathf.Lerp(x, target.x, positionLerpPct);
y = Mathf.Lerp(y, target.y, positionLerpPct);
z = Mathf.Lerp(z, target.z, positionLerpPct);
}
public void UpdateTransform(Transform t)
{
t.eulerAngles = new Vector3(pitch, yaw, roll);
t.position = new Vector3(x, y, z);
}
}
CameraState m_TargetCameraState = new CameraState();
CameraState m_InterpolatingCameraState = new CameraState();
[Header("Movement Settings")]
[Tooltip("Exponential boost factor on translation, controllable by mouse wheel.")]
public float boost = 3.5f;
[Tooltip("Time it takes to interpolate camera position 99% of the way to the target."), Range(0.001f, 1f)]
public float positionLerpTime = 0.2f;
[Header("Rotation Settings")]
[Tooltip("X = Change in mouse position.\nY = Multiplicative factor for camera rotation.")]
public AnimationCurve mouseSensitivityCurve = new AnimationCurve(new Keyframe(0f, 0.5f, 0f, 5f), new Keyframe(1f, 2.5f, 0f, 0f));
[Tooltip("Time it takes to interpolate camera rotation 99% of the way to the target."), Range(0.001f, 1f)]
public float rotationLerpTime = 0.01f;
[Tooltip("Whether or not to invert our Y axis for mouse input to rotation.")]
public bool invertY = false;
#if ENABLE_INPUT_SYSTEM
InputAction movementAction;
InputAction verticalMovementAction;
InputAction lookAction;
InputAction boostFactorAction;
bool mouseRightButtonPressed;
void Start()
{
var map = new InputActionMap("Simple Camera Controller");
lookAction = map.AddAction("look", binding: "<Mouse>/delta");
movementAction = map.AddAction("move", binding: "<Gamepad>/leftStick");
verticalMovementAction = map.AddAction("Vertical Movement");
boostFactorAction = map.AddAction("Boost Factor", binding: "<Mouse>/scroll");
lookAction.AddBinding("<Gamepad>/rightStick").WithProcessor("scaleVector2(x=15, y=15)");
movementAction.AddCompositeBinding("Dpad")
.With("Up", "<Keyboard>/w")
.With("Up", "<Keyboard>/upArrow")
.With("Down", "<Keyboard>/s")
.With("Down", "<Keyboard>/downArrow")
.With("Left", "<Keyboard>/a")
.With("Left", "<Keyboard>/leftArrow")
.With("Right", "<Keyboard>/d")
.With("Right", "<Keyboard>/rightArrow");
verticalMovementAction.AddCompositeBinding("Dpad")
.With("Up", "<Keyboard>/pageUp")
.With("Down", "<Keyboard>/pageDown")
.With("Up", "<Keyboard>/e")
.With("Down", "<Keyboard>/q")
.With("Up", "<Gamepad>/rightshoulder")
.With("Down", "<Gamepad>/leftshoulder");
boostFactorAction.AddBinding("<Gamepad>/Dpad").WithProcessor("scaleVector2(x=1, y=4)");
movementAction.Enable();
lookAction.Enable();
verticalMovementAction.Enable();
boostFactorAction.Enable();
}
#endif
void OnEnable()
{
m_TargetCameraState.SetFromTransform(transform);
m_InterpolatingCameraState.SetFromTransform(transform);
}
Vector3 GetInputTranslationDirection()
{
Vector3 direction = Vector3.zero;
#if ENABLE_INPUT_SYSTEM
var moveDelta = movementAction.ReadValue<Vector2>();
direction.x = moveDelta.x;
direction.z = moveDelta.y;
direction.y = verticalMovementAction.ReadValue<Vector2>().y;
#else
if (Input.GetKey(KeyCode.W))
{
direction += Vector3.forward;
}
if (Input.GetKey(KeyCode.S))
{
direction += Vector3.back;
}
if (Input.GetKey(KeyCode.A))
{
direction += Vector3.left;
}
if (Input.GetKey(KeyCode.D))
{
direction += Vector3.right;
}
if (Input.GetKey(KeyCode.Q))
{
direction += Vector3.down;
}
if (Input.GetKey(KeyCode.E))
{
direction += Vector3.up;
}
#endif
return direction;
}
void Update()
{
// Hide and lock cursor when right mouse button pressed
if (IsRightMouseButtonDown())
{
Cursor.lockState = CursorLockMode.Locked;
}
// Unlock and show cursor when right mouse button released
if (IsRightMouseButtonUp())
{
Cursor.visible = true;
Cursor.lockState = CursorLockMode.None;
}
// Rotation
if (IsCameraRotationAllowed())
{
var mouseMovement = GetInputLookRotation() * Time.deltaTime * 5;
if (invertY)
mouseMovement.y = -mouseMovement.y;
var mouseSensitivityFactor = mouseSensitivityCurve.Evaluate(mouseMovement.magnitude);
m_TargetCameraState.yaw += mouseMovement.x * mouseSensitivityFactor;
m_TargetCameraState.pitch += mouseMovement.y * mouseSensitivityFactor;
}
// Translation
var translation = GetInputTranslationDirection() * Time.deltaTime;
// Speed up movement when shift key held
if (IsBoostPressed())
{
translation *= 10.0f;
}
// Modify movement by a boost factor (defined in Inspector and modified in play mode through the mouse scroll wheel)
boost += GetBoostFactor();
translation *= Mathf.Pow(2.0f, boost);
m_TargetCameraState.Translate(translation);
// Framerate-independent interpolation
// Calculate the lerp amount, such that we get 99% of the way to our target in the specified time
var positionLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / positionLerpTime) * Time.deltaTime);
var rotationLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / rotationLerpTime) * Time.deltaTime);
m_InterpolatingCameraState.LerpTowards(m_TargetCameraState, positionLerpPct, rotationLerpPct);
m_InterpolatingCameraState.UpdateTransform(transform);
}
float GetBoostFactor()
{
#if ENABLE_INPUT_SYSTEM
return boostFactorAction.ReadValue<Vector2>().y * 0.01f;
#else
return Input.mouseScrollDelta.y * 0.2f;
#endif
}
Vector2 GetInputLookRotation()
{
#if ENABLE_INPUT_SYSTEM
return lookAction.ReadValue<Vector2>();
#else
return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")) * 10;
#endif
}
bool IsBoostPressed()
{
#if ENABLE_INPUT_SYSTEM
bool boost = Keyboard.current != null ? Keyboard.current.leftShiftKey.isPressed : false;
boost |= Gamepad.current != null ? Gamepad.current.xButton.isPressed : false;
return boost;
#else
return Input.GetKey(KeyCode.LeftShift);
#endif
}
bool IsEscapePressed()
{
#if ENABLE_INPUT_SYSTEM
return Keyboard.current != null ? Keyboard.current.escapeKey.isPressed : false;
#else
return Input.GetKey(KeyCode.Escape);
#endif
}
bool IsCameraRotationAllowed()
{
#if ENABLE_INPUT_SYSTEM
bool canRotate = Mouse.current != null ? Mouse.current.rightButton.isPressed : false;
canRotate |= Gamepad.current != null ? Gamepad.current.rightStick.ReadValue().magnitude > 0 : false;
return canRotate;
#else
return Input.GetMouseButton(1);
#endif
}
bool IsRightMouseButtonDown()
{
#if ENABLE_INPUT_SYSTEM
return Mouse.current != null ? Mouse.current.rightButton.isPressed : false;
#else
return Input.GetMouseButtonDown(1);
#endif
}
bool IsRightMouseButtonUp()
{
#if ENABLE_INPUT_SYSTEM
return Mouse.current != null ? !Mouse.current.rightButton.isPressed : false;
#else
return Input.GetMouseButtonUp(1);
#endif
}
}
} | 34.922535 | 137 | 0.564832 | [
"MIT"
] | Avatarchik/advanced-level-editor | Assets/Scripts/SimpleCameraController.cs | 9,920 | C# |
using System;
using System.Collections.Generic;
namespace Lockethot.Collections.Generic
{
public class CloneableStack<T> : Stack<T>, ICloneableCollection
{
#region Constructors
public CloneableStack() : base () { }
public CloneableStack(Stack<T> raw = null) : base()
{
if (raw != null)
{
foreach (var item in raw)
{
Push(item);
}
}
}
#endregion
#region Interface Implementations
public object Clone()
{
var ret = new CloneableStack<T>();
foreach(var item in this)
{
ret.Push((item is ICloneable) ? (T)((ICloneable)item).Clone() : item);
}
return ret;
}
public object BaseData()
{
var ret = new Stack<T>();
foreach(var item in this)
{
ret.Push(item);
}
return ret;
}
public object BaseDataClone()
{
var ret = new Stack<T>();
foreach (var item in this)
{
ret.Push((item is ICloneable) ? (T)((ICloneable)item).Clone() : item);
}
return ret;
}
#endregion
}
}
| 23.946429 | 86 | 0.446682 | [
"MIT"
] | Lockethot/LockeCS | Collections/Generic/CloneableStack.cs | 1,343 | C# |
using Microsoft.Maui.Graphics;
namespace InputKit.Shared.Helpers;
public static class ColorExtensions
{
/// <summary>
/// Defines a surface color will be black or white.
/// </summary>
/// <param name="color">Background color</param>
/// <returns>Surface color on background color</returns>
public static Color ToSurfaceColor(this Color color)
{
if (color.Red + color.Green + color.Blue >= 1.8)
return Colors.Black;
else
return Colors.White;
}
}
| 26.05 | 60 | 0.635317 | [
"MIT"
] | enisn/Xamarin.Forms.InputK | src/InputKit/Shared/Helpers/ColorExtensions.cs | 523 | C# |
using Cfg.StartServer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ET
{
public class StartServerComponent : Entity
{
public static StartServerComponent Instance;
public MultiMap<int, StartSceneData> Gates = new MultiMap<int, StartSceneData>();
public MultiMap<int, StartSceneData> ProcessScenes = new MultiMap<int, StartSceneData>();
public Dictionary<long, Dictionary<string, StartSceneData>> ZoneScenesByName = new Dictionary<long, Dictionary<string, StartSceneData>>();
public StartSceneData LocationConfig;
public List<StartSceneData> Robots = new List<StartSceneData>();
public Dictionary<int,StartProcessData> ProcessDatas = new Dictionary<int, StartProcessData>();
public Dictionary<int,StartSceneData> SceneDatas = new Dictionary<int, StartSceneData>();
}
}
| 34.142857 | 146 | 0.719665 | [
"MIT"
] | kteong1012/Arthas | Robot/Hotfix/Module/StartServer/StartServerComponent.cs | 958 | C# |
#region BSD License
/*
*
* Original BSD 3-Clause License (https://github.com/ComponentFactory/Krypton/blob/master/LICENSE)
* © Component Factory Pty Ltd, 2006 - 2016, (Version 4.5.0.0) All rights reserved.
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2021. All rights reserved.
*
*/
#endregion
namespace Krypton.Toolkit
{
internal class KryptonCheckedListBoxActionList : DesignerActionList
{
#region Instance Fields
private readonly KryptonCheckedListBox _checkedListBox;
private readonly IComponentChangeService _service;
#endregion
#region Identity
/// <summary>
/// Initialize a new instance of the KryptonCheckedListBoxActionList class.
/// </summary>
/// <param name="owner">Designer that owns this action list instance.</param>
public KryptonCheckedListBoxActionList(KryptonCheckedListBoxDesigner owner)
: base(owner.Component)
{
// Remember the list box instance
_checkedListBox = owner.Component as KryptonCheckedListBox;
// Cache service used to notify when a property has changed
_service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
}
#endregion
#region Public
/// <summary>
/// Gets and sets the style used for list items.
/// </summary>
public ButtonStyle ItemStyle
{
get => _checkedListBox.ItemStyle;
set
{
if (_checkedListBox.ItemStyle != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.ItemStyle, value);
_checkedListBox.ItemStyle = value;
}
}
}
/// <summary>
/// Gets and sets the background drawing style.
/// </summary>
public PaletteBackStyle BackStyle
{
get => _checkedListBox.BackStyle;
set
{
if (_checkedListBox.BackStyle != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.BackStyle, value);
_checkedListBox.BackStyle = value;
}
}
}
/// <summary>
/// Gets and sets the border drawing style.
/// </summary>
public PaletteBorderStyle BorderStyle
{
get => _checkedListBox.BorderStyle;
set
{
if (_checkedListBox.BorderStyle != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.BorderStyle, value);
_checkedListBox.BorderStyle = value;
}
}
}
/// <summary>Gets or sets the context menu strip.</summary>
/// <value>The context menu strip.</value>
public ContextMenuStrip ContextMenuStrip
{
get => _checkedListBox.ContextMenuStrip;
set
{
if (_checkedListBox.ContextMenuStrip != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.ContextMenuStrip, value);
_checkedListBox.ContextMenuStrip = value;
}
}
}
/// <summary>
/// Gets and sets the selection mode.
/// </summary>
public CheckedSelectionMode SelectionMode
{
get => _checkedListBox.SelectionMode;
set
{
if (_checkedListBox.SelectionMode != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.SelectionMode, value);
_checkedListBox.SelectionMode = value;
}
}
}
/// <summary>
/// Gets and sets the selection mode.
/// </summary>
public bool Sorted
{
get => _checkedListBox.Sorted;
set
{
if (_checkedListBox.Sorted != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.Sorted, value);
_checkedListBox.Sorted = value;
}
}
}
/// <summary>
/// Gets and sets the check on click setting.
/// </summary>
public bool CheckOnClick
{
get => _checkedListBox.CheckOnClick;
set
{
if (_checkedListBox.CheckOnClick != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.CheckOnClick, value);
_checkedListBox.CheckOnClick = value;
}
}
}
/// <summary>
/// Gets and sets the palette mode.
/// </summary>
public PaletteMode PaletteMode
{
get => _checkedListBox.PaletteMode;
set
{
if (_checkedListBox.PaletteMode != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.PaletteMode, value);
_checkedListBox.PaletteMode = value;
}
}
}
/// <summary>Gets or sets the font.</summary>
/// <value>The font.</value>
public Font ShortTextFont
{
get => _checkedListBox.StateCommon.Item.Content.ShortText.Font;
set
{
if (_checkedListBox.StateCommon.Item.Content.ShortText.Font != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.StateCommon.Item.Content.ShortText.Font, value);
_checkedListBox.StateCommon.Item.Content.ShortText.Font = value;
}
}
}
/// <summary>Gets or sets the font.</summary>
/// <value>The font.</value>
public Font LongTextFont
{
get => _checkedListBox.StateCommon.Item.Content.LongText.Font;
set
{
if (_checkedListBox.StateCommon.Item.Content.LongText.Font != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.StateCommon.Item.Content.LongText.Font, value);
_checkedListBox.StateCommon.Item.Content.LongText.Font = value;
}
}
}
/// <summary>Gets or sets the corner radius.</summary>
/// <value>The corner radius.</value>
[DefaultValue(GlobalStaticValues.PRIMARY_CORNER_ROUNDING_VALUE)]
public float CornerRadius
{
get => _checkedListBox.StateCommon.Border.Rounding;
set
{
if (_checkedListBox.StateCommon.Border.Rounding != value)
{
_service.OnComponentChanged(_checkedListBox, null, _checkedListBox.StateCommon.Border.Rounding, value);
_checkedListBox.StateCommon.Border.Rounding = value;
}
}
}
#endregion
#region Public Override
/// <summary>
/// Returns the collection of DesignerActionItem objects contained in the list.
/// </summary>
/// <returns>A DesignerActionItem array that contains the items in this list.</returns>
public override DesignerActionItemCollection GetSortedActionItems()
{
// Create a new collection for holding the single item we want to create
DesignerActionItemCollection actions = new();
// This can be null when deleting a control instance at design time
if (_checkedListBox != null)
{
// Add the list of list box specific actions
actions.Add(new DesignerActionHeaderItem("Appearance"));
actions.Add(new DesignerActionPropertyItem("BackStyle", "Back Style", "Appearance", "Style used to draw background."));
actions.Add(new DesignerActionPropertyItem("BorderStyle", "Border Style", "Appearance", "Style used to draw the border."));
actions.Add(new DesignerActionPropertyItem("ContextMenuStrip", "Context Menu Strip", "Appearance", "The context menu strip for the control."));
actions.Add(new DesignerActionPropertyItem("ItemStyle", "Item Style", "Appearance", "How to display list items."));
actions.Add(new DesignerActionPropertyItem("ShortTextFont", "Short Text Font", "Appearance", "The short text font."));
actions.Add(new DesignerActionPropertyItem("LongTextFont", "Long Text Font", "Appearance", "The long text font."));
actions.Add(new DesignerActionPropertyItem("CornerRadius", "Corner Rounding Radius", "Appearance", "The corner rounding radius of the control."));
actions.Add(new DesignerActionHeaderItem("Behavior"));
actions.Add(new DesignerActionPropertyItem("SelectionMode", "Selection Mode", "Behavior", "Determines the selection mode."));
actions.Add(new DesignerActionPropertyItem("Sorted", "Sorted", "Behavior", "Should items be sorted according to string."));
actions.Add(new DesignerActionPropertyItem("CheckOnClick", "CheckOnClick", "Behavior", "Should clicking an item toggle its checked state."));
actions.Add(new DesignerActionHeaderItem("Visuals"));
actions.Add(new DesignerActionPropertyItem("PaletteMode", "Palette", "Visuals", "Palette applied to drawing"));
}
return actions;
}
#endregion
}
}
| 37.784091 | 162 | 0.57193 | [
"BSD-3-Clause"
] | Krypton-Suite/Standard-Toolk | Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonCheckedListBoxActionList.cs | 9,978 | C# |
/*
* Copyright(c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Tizen.NUI.Binding;
using Tizen.NUI.Binding.Internals;
namespace Tizen.NUI
{
/**
* @brief Event arguments that passed via NUIApplicationInit signal
*
*/
internal class NUIApplicationInitEventArgs : EventArgs
{
private Application _application;
/**
* @brief Application - is the application that is being initialized
*
*/
public Application Application
{
get
{
return _application;
}
set
{
_application = value;
}
}
}
/**
* @brief Event arguments that passed via NUIApplicationTerminate signal
*
*/
internal class NUIApplicationTerminatingEventArgs : EventArgs
{
private Application _application;
/**
* @brief Application - is the application that is being Terminated
*
*/
public Application Application
{
get
{
return _application;
}
set
{
_application = value;
}
}
}
/**
* @brief Event arguments that passed via NUIApplicationPause signal
*
*/
internal class NUIApplicationPausedEventArgs : EventArgs
{
private Application _application;
/**
* @brief Application - is the application that is being Paused
*
*/
public Application Application
{
get
{
return _application;
}
set
{
_application = value;
}
}
}
/**
* @brief Event arguments that passed via NUIApplicationResume signal
*
*/
internal class NUIApplicationResumedEventArgs : EventArgs
{
private Application _application;
/**
* @brief Application - is the application that is being Resumed
*
*/
public Application Application
{
get
{
return _application;
}
set
{
_application = value;
}
}
}
/**
* @brief Event arguments that passed via NUIApplicationReset signal
*
*/
internal class NUIApplicationResetEventArgs : EventArgs
{
private Application _application;
/**
* @brief Application - is the application that is being Reset
*
*/
public Application Application
{
get
{
return _application;
}
set
{
_application = value;
}
}
}
/**
* @brief Event arguments that passed via NUIApplicationLanguageChanged signal
*
*/
internal class NUIApplicationLanguageChangedEventArgs : EventArgs
{
private Application _application;
/**
* @brief Application - is the application that is being affected with Device's language change
*
*/
public Application Application
{
get
{
return _application;
}
set
{
_application = value;
}
}
}
/**
* @brief Event arguments that passed via NUIApplicationRegionChanged signal
*
*/
internal class NUIApplicationRegionChangedEventArgs : EventArgs
{
private Application _application;
/**
* @brief Application - is the application that is being affected with Device's region change
*
*/
public Application Application
{
get
{
return _application;
}
set
{
_application = value;
}
}
}
/**
* @brief Event arguments that passed via NUIApplicationBatteryLow signal
*
*/
internal class NUIApplicationBatteryLowEventArgs : EventArgs
{
private Application.BatteryStatus _status;
/**
* @brief Application - is the application that is being affected when the battery level of the device is low
*
*/
public Application.BatteryStatus BatteryStatus
{
get
{
return _status;
}
set
{
_status = value;
}
}
}
/**
* @brief Event arguments that passed via NUIApplicationMemoryLow signal
*
*/
internal class NUIApplicationMemoryLowEventArgs : EventArgs
{
private Application.MemoryStatus _status;
/**
* @brief Application - is the application that is being affected when the memory level of the device is low
*
*/
public Application.MemoryStatus MemoryStatus
{
get
{
return _status;
}
set
{
_status = value;
}
}
}
/**
* @brief Event arguments that passed via NUIApplicationAppControl signal
*
*/
internal class NUIApplicationAppControlEventArgs : EventArgs
{
private Application _application;
private IntPtr _voidp;
/**
* @brief Application - is the application that is receiving the launch request from another application
*
*/
public Application Application
{
get
{
return _application;
}
set
{
_application = value;
}
}
/**
* @brief VoidP - contains the information about why the application is launched
*
*/
public IntPtr VoidP
{
get
{
return _voidp;
}
set
{
_voidp = value;
}
}
}
/// <summary>
/// A class to get resources in current application.
/// </summary>
public class GetResourcesProvider
{
/// <summary>
/// Get resources in current application.
/// </summary>
static public IResourcesProvider Get()
{
return Tizen.NUI.Application.Current;
}
}
internal class Application : BaseHandle, IResourcesProvider, IElementConfiguration<Application>
{
static Application s_current;
ReadOnlyCollection<Element> _logicalChildren;
static SemaphoreSlim SaveSemaphore = new SemaphoreSlim(1, 1);
[EditorBrowsable(EditorBrowsableState.Never)]
public static void SetCurrentApplication(Application value) => Current = value;
public static Application Current
{
get { return s_current; }
set
{
if (s_current == value)
return;
if (value == null)
s_current = null; //Allow to reset current for unittesting
s_current = value;
}
}
internal override ReadOnlyCollection<Element> LogicalChildrenInternal
{
get { return _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
}
internal IResourceDictionary SystemResources { get; }
ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
ResourceDictionary _resources;
public bool IsResourcesCreated => _resources != null;
public delegate void resChangeCb(object sender, ResourcesChangedEventArgs e);
static private Dictionary<object, Dictionary<resChangeCb, int>> resourceChangeCallbackDict = new Dictionary<object, Dictionary<resChangeCb, int>>();
static public void AddResourceChangedCallback(object handle, resChangeCb cb)
{
Dictionary<resChangeCb, int> cbDict;
resourceChangeCallbackDict.TryGetValue(handle, out cbDict);
if (null == cbDict)
{
cbDict = new Dictionary<resChangeCb, int>();
resourceChangeCallbackDict.Add(handle, cbDict);
}
if (false == cbDict.ContainsKey(cb))
{
cbDict.Add(cb, 0);
}
}
internal override void OnResourcesChanged(object sender, ResourcesChangedEventArgs e)
{
base.OnResourcesChanged(sender, e);
foreach (KeyValuePair<object, Dictionary<resChangeCb, int>> resourcePair in resourceChangeCallbackDict)
{
foreach (KeyValuePair<resChangeCb, int> cbPair in resourcePair.Value)
{
cbPair.Key(sender, e);
}
}
}
public ResourceDictionary XamlResources
{
get
{
if (_resources != null)
return _resources;
_resources = new ResourceDictionary();
int hashCode = _resources.GetHashCode();
((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
return _resources;
}
set
{
if (_resources == value)
return;
OnPropertyChanging();
if (_resources != null)
((IResourceDictionary)_resources).ValuesChanged -= OnResourcesChanged;
_resources = value;
OnResourcesChanged(value);
if (_resources != null)
((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
OnPropertyChanged();
}
}
protected override void OnParentSet()
{
throw new InvalidOperationException("Setting a Parent on Application is invalid.");
}
[EditorBrowsable(EditorBrowsableState.Never)]
public static bool IsApplicationOrNull(Element element)
{
return element == null || element is Application;
}
internal override void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
{
if (!((IResourcesProvider)this).IsResourcesCreated || XamlResources.Count == 0)
{
base.OnParentResourcesChanged(values);
return;
}
var innerKeys = new HashSet<string>();
var changedResources = new List<KeyValuePair<string, object>>();
foreach (KeyValuePair<string, object> c in XamlResources)
innerKeys.Add(c.Key);
foreach (KeyValuePair<string, object> value in values)
{
if (innerKeys.Add(value.Key))
changedResources.Add(value);
}
OnResourcesChanged(changedResources);
}
internal Application(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Application_SWIGUpcast(cPtr), cMemoryOwn)
{
SetCurrentApplication(this);
s_current = this;
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Application obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
protected override void Dispose(DisposeTypes type)
{
if (disposed)
{
return;
}
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
if (_applicationInitEventCallbackDelegate != null)
{
this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate);
}
if (_applicationTerminateEventCallbackDelegate != null)
{
this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate);
}
if (_applicationPauseEventCallbackDelegate != null)
{
this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate);
}
if (_applicationResumeEventCallbackDelegate != null)
{
this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate);
}
if (_applicationResetEventCallbackDelegate != null)
{
this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate);
}
if (_applicationLanguageChangedEventCallbackDelegate != null)
{
this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate);
}
if (_applicationRegionChangedEventCallbackDelegate != null)
{
this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate);
}
if (_applicationBatteryLowEventCallbackDelegate != null)
{
this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate);
}
if (_applicationMemoryLowEventCallbackDelegate != null)
{
this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate);
}
if (_applicationAppControlEventCallbackDelegate != null)
{
this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate);
}
base.Dispose(type);
}
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
Interop.Application.delete_Application(swigCPtr);
}
/// <since_tizen> 4 </since_tizen>
public enum BatteryStatus
{
Normal,
CriticallyLow,
PowerOff
};
/// <since_tizen> 4 </since_tizen>
public enum MemoryStatus
{
Normal,
Low,
CriticallyLow
};
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationInitEventCallbackDelegate(IntPtr application);
private DaliEventHandler<object, NUIApplicationInitEventArgs> _applicationInitEventHandler;
private NUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationTerminateEventCallbackDelegate(IntPtr application);
private DaliEventHandler<object, NUIApplicationTerminatingEventArgs> _applicationTerminateEventHandler;
private NUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationPauseEventCallbackDelegate(IntPtr application);
private DaliEventHandler<object, NUIApplicationPausedEventArgs> _applicationPauseEventHandler;
private NUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationResumeEventCallbackDelegate(IntPtr application);
private DaliEventHandler<object, NUIApplicationResumedEventArgs> _applicationResumeEventHandler;
private NUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationResetEventCallbackDelegate(IntPtr application);
private DaliEventHandler<object, NUIApplicationResetEventArgs> _applicationResetEventHandler;
private NUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application);
private DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> _applicationLanguageChangedEventHandler;
private NUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationRegionChangedEventCallbackDelegate(IntPtr application);
private DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> _applicationRegionChangedEventHandler;
private NUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationBatteryLowEventCallbackDelegate(BatteryStatus status);
private DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> _applicationBatteryLowEventHandler;
private NUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationMemoryLowEventCallbackDelegate(MemoryStatus status);
private DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> _applicationMemoryLowEventHandler;
private NUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp);
private DaliEventHandler<object, NUIApplicationAppControlEventArgs> _applicationAppControlEventHandler;
private NUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate;
/**
* @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. Initialized signal is emitted when application is initialised
*/
public event DaliEventHandler<object, NUIApplicationInitEventArgs> Initialized
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationInitEventHandler == null)
{
_applicationInitEventHandler += value;
_applicationInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationInit);
this.InitSignal().Connect(_applicationInitEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationInitEventHandler != null)
{
this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate);
}
_applicationInitEventHandler -= value;
}
}
}
// Callback for Application InitSignal
private void OnApplicationInit(IntPtr data)
{
// Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
DisposeQueue.Instance.Initialize();
if (_applicationInitEventHandler != null)
{
NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
e.Application = this;
_applicationInitEventHandler.Invoke(this, e);
}
}
/**
* @brief Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. Terminated signal is emitted when application is terminating
*/
public event DaliEventHandler<object, NUIApplicationTerminatingEventArgs> Terminating
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationTerminateEventHandler == null)
{
_applicationTerminateEventHandler += value;
_applicationTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTerminate);
this.TerminateSignal().Connect(_applicationTerminateEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationTerminateEventHandler != null)
{
this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate);
}
_applicationTerminateEventHandler -= value;
}
}
}
// Callback for Application TerminateSignal
private void OnNUIApplicationTerminate(IntPtr data)
{
if (_applicationTerminateEventHandler != null)
{
NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
e.Application = this;
_applicationTerminateEventHandler.Invoke(this, e);
}
List<Window> windows = GetWindowList();
foreach (Window window in windows)
{
window?.DisconnectNativeSignals();
}
}
/**
* @brief Event for Paused signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. Paused signal is emitted when application is paused
*/
public event DaliEventHandler<object, NUIApplicationPausedEventArgs> Paused
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationPauseEventHandler == null)
{
_applicationPauseEventHandler += value;
_applicationPauseEventCallbackDelegate = new NUIApplicationPauseEventCallbackDelegate(OnNUIApplicationPause);
this.PauseSignal().Connect(_applicationPauseEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationPauseEventHandler != null)
{
this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate);
}
_applicationPauseEventHandler -= value;
}
}
}
// Callback for Application PauseSignal
private void OnNUIApplicationPause(IntPtr data)
{
if (_applicationPauseEventHandler != null)
{
NUIApplicationPausedEventArgs e = new NUIApplicationPausedEventArgs();
e.Application = this;
_applicationPauseEventHandler.Invoke(this, e);
}
}
/**
* @brief Event for Resumed signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. Resumed signal is emitted when application is resumed
*/
public event DaliEventHandler<object, NUIApplicationResumedEventArgs> Resumed
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationResumeEventHandler == null)
{
_applicationResumeEventHandler += value;
_applicationResumeEventCallbackDelegate = new NUIApplicationResumeEventCallbackDelegate(OnNUIApplicationResume);
this.ResumeSignal().Connect(_applicationResumeEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationResumeEventHandler != null)
{
this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate);
}
_applicationResumeEventHandler -= value;
}
}
}
// Callback for Application ResumeSignal
private void OnNUIApplicationResume(IntPtr data)
{
if (_applicationResumeEventHandler != null)
{
NUIApplicationResumedEventArgs e = new NUIApplicationResumedEventArgs();
e.Application = this;
_applicationResumeEventHandler.Invoke(this, e);
}
}
/**
* @brief Event for Reset signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. Reset signal is emitted when application is reset
*/
public new event DaliEventHandler<object, NUIApplicationResetEventArgs> Reset
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationResetEventHandler == null)
{
_applicationResetEventHandler += value;
_applicationResetEventCallbackDelegate = new NUIApplicationResetEventCallbackDelegate(OnNUIApplicationReset);
this.ResetSignal().Connect(_applicationResetEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationResetEventHandler != null)
{
this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate);
}
_applicationResetEventHandler -= value;
}
}
}
// Callback for Application ResetSignal
private void OnNUIApplicationReset(IntPtr data)
{
if (_applicationResetEventHandler != null)
{
NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs();
e.Application = this;
_applicationResetEventHandler.Invoke(this, e);
}
}
/**
* @brief Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. LanguageChanged signal is emitted when the region of the device is changed.
*/
public event DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> LanguageChanged
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationLanguageChangedEventHandler == null)
{
_applicationLanguageChangedEventHandler += value;
_applicationLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationLanguageChanged);
this.LanguageChangedSignal().Connect(_applicationLanguageChangedEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationLanguageChangedEventHandler != null)
{
this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate);
}
_applicationLanguageChangedEventHandler -= value;
}
}
}
// Callback for Application LanguageChangedSignal
private void OnNUIApplicationLanguageChanged(IntPtr data)
{
if (_applicationLanguageChangedEventHandler != null)
{
NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
e.Application = this;
_applicationLanguageChangedEventHandler.Invoke(this, e);
}
}
/**
* @brief Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. RegionChanged signal is emitted when the region of the device is changed.
*/
public event DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> RegionChanged
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationRegionChangedEventHandler == null)
{
_applicationRegionChangedEventHandler += value;
_applicationRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationRegionChanged);
this.RegionChangedSignal().Connect(_applicationRegionChangedEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationRegionChangedEventHandler != null)
{
this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate);
}
_applicationRegionChangedEventHandler -= value;
}
}
}
// Callback for Application RegionChangedSignal
private void OnNUIApplicationRegionChanged(IntPtr data)
{
if (_applicationRegionChangedEventHandler != null)
{
NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
e.Application = this;
_applicationRegionChangedEventHandler.Invoke(this, e);
}
}
/**
* @brief Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. BatteryLow signal is emitted when the battery level of the device is low.
*/
public event DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> BatteryLow
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationBatteryLowEventHandler == null)
{
_applicationBatteryLowEventHandler += value;
_applicationBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationBatteryLow);
this.BatteryLowSignal().Connect(_applicationBatteryLowEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationBatteryLowEventHandler != null)
{
this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate);
}
_applicationBatteryLowEventHandler -= value;
}
}
}
// Callback for Application BatteryLowSignal
private void OnNUIApplicationBatteryLow(BatteryStatus status)
{
lock (this)
{
NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
// Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
e.BatteryStatus = status;
_applicationBatteryLowEventHandler?.Invoke(this, e);
}
}
/**
* @brief Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. MemoryLow signal is emitted when the memory level of the device is low.
*/
public event DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> MemoryLow
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationMemoryLowEventHandler == null)
{
_applicationMemoryLowEventHandler += value;
_applicationMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationMemoryLow);
this.MemoryLowSignal().Connect(_applicationMemoryLowEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationMemoryLowEventHandler != null)
{
this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate);
}
_applicationMemoryLowEventHandler -= value;
}
}
}
// Callback for Application MemoryLowSignal
private void OnNUIApplicationMemoryLow(MemoryStatus status)
{
lock (this)
{
NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
// Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
e.MemoryStatus = status;
_applicationMemoryLowEventHandler?.Invoke(this, e);
}
}
/**
* @brief Event for AppControl signal which can be used to subscribe/unsubscribe the event handler
* provided by the user. AppControl signal is emitted when another application sends a launch request to the application.
*/
public event DaliEventHandler<object, NUIApplicationAppControlEventArgs> AppControl
{
add
{
lock (this)
{
// Restricted to only one listener
if (_applicationAppControlEventHandler == null)
{
_applicationAppControlEventHandler += value;
_applicationAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationAppControl);
this.AppControlSignal().Connect(_applicationAppControlEventCallbackDelegate);
}
}
}
remove
{
lock (this)
{
if (_applicationAppControlEventHandler != null)
{
this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate);
}
_applicationAppControlEventHandler -= value;
}
}
}
// Callback for Application AppControlSignal
private void OnNUIApplicationAppControl(IntPtr application, IntPtr voidp)
{
if (_applicationAppControlEventHandler != null)
{
NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
e.VoidP = voidp;
e.Application = this;
_applicationAppControlEventHandler.Invoke(this, e);
}
}
protected static Application _instance; // singleton
public static Application Instance
{
get
{
return _instance;
}
}
public static Application GetApplicationFromPtr(global::System.IntPtr cPtr)
{
if (cPtr == global::System.IntPtr.Zero)
{
return null;
}
Application ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Application;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Application NewApplication()
{
return NewApplication("", Application.WindowMode.Opaque);
}
public static Application NewApplication(string stylesheet)
{
return NewApplication(stylesheet, Application.WindowMode.Opaque);
}
public static Application NewApplication(string stylesheet, Application.WindowMode windowMode)
{
// register all Views with the type registry, so that can be created / styled via JSON
//ViewRegistryHelper.Initialize(); //moved to Application side.
if(_instance)
{
return _instance;
}
Application ret = New(1, stylesheet, windowMode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
// set the singleton
_instance = ret;
return ret;
}
public static Application NewApplication(string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
{
if (_instance)
{
return _instance;
}
Application ret = New(1, stylesheet, windowMode, positionSize);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
// set the singleton
_instance = ret;
return ret;
}
public static Application NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode)
{
if (_instance)
{
return _instance;
}
Application ret = New(args, stylesheet, (Application.WindowMode)windowMode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
// set the singleton
_instance = ret;
return _instance;
}
public static Application NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
{
if (_instance)
{
return _instance;
}
Application ret = New(args, stylesheet, (Application.WindowMode)windowMode, positionSize);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
// set the singleton
_instance = ret;
return _instance;
}
/// <summary>
/// Ensures that the function passed in is called from the main loop when it is idle.
/// </summary>
/// <param name="func">The function to call</param>
/// <returns>true if added successfully, false otherwise</returns>
public bool AddIdle(System.Delegate func)
{
System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
System.IntPtr ip2 = Interop.Application.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip));
bool ret = Interop.Application.Application_AddIdle(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/**
* Outer::outer_method(int)
*/
public static Application New()
{
Application ret = new Application(Interop.Application.Application_New__SWIG_0(), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Application New(int argc)
{
Application ret = new Application(Interop.Application.Application_New__SWIG_1(argc), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Application New(int argc, string stylesheet)
{
Application ret = new Application(Interop.Application.Application_New__SWIG_2(argc, stylesheet), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Application New(int argc, string stylesheet, Application.WindowMode windowMode)
{
Application ret = new Application(Interop.Application.Application_New__SWIG_3(argc, stylesheet, (int)windowMode), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
s_current = ret;
return ret;
}
public static Application New(string[] args, string stylesheet, Application.WindowMode windowMode)
{
Application ret = null;
int argc = 0;
string argvStr = "";
try
{
argc = args.Length;
argvStr = string.Join(" ", args);
}
catch (Exception exception)
{
Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, msg : " + exception.Message);
Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
throw;
}
ret = new Application(NDalicPINVOKE.Application_New__MANUAL_4(argc, argvStr, stylesheet, (int)windowMode), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Application New(int argc, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
{
Application ret = new Application(Interop.Application.Application_New__SWIG_4(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static Application New(string[] args, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
{
Application ret = null;
int argc = 0;
string argvStr = "";
try
{
argc = args.Length;
argvStr = string.Join(" ", args);
}
catch (Exception exception)
{
Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, msg : " + exception.Message);
Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
throw;
}
ret = new Application(NDalicPINVOKE.Application_New_WithWindowSizePosition(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Application() : this(Interop.Application.new_Application__SWIG_0(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
public Application(Application application) : this(Interop.Application.new_Application__SWIG_1(Application.getCPtr(application)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
public Application Assign(Application application)
{
Application ret = new Application(Interop.Application.Application_Assign(swigCPtr, Application.getCPtr(application)), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public void MainLoop()
{
NDalicPINVOKE.Application_MainLoop__SWIG_0(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
public void Lower()
{
Interop.Application.Application_Lower(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
public void Quit()
{
Interop.Application.Application_Quit(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback)
{
bool ret = Interop.Application.Application_AddIdle(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public Window GetWindow()
{
Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Application.Application_GetWindow(swigCPtr)) as Window;
if(ret == null)
{
ret = new Window(Interop.Application.Application_GetWindow(swigCPtr), true);
}
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static string GetResourcePath()
{
string ret = Interop.Application.Application_GetResourcePath();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public string GetLanguage()
{
string ret = Interop.Application.Application_GetLanguage(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public string GetRegion()
{
string ret = Interop.Application.Application_GetRegion(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
[EditorBrowsable(EditorBrowsableState.Never)]
public static List<Window> GetWindowList()
{
uint ListSize = Interop.Application.Application_GetWindowsListSize();
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
List<Window> WindowList = new List<Window>();
for( uint i = 0; i < ListSize; ++i )
{
Window currWin = Registry.GetManagedBaseHandleFromNativePtr(Interop.Application.Application_GetWindowsFromList(i)) as Window;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
if(currWin)
{
WindowList.Add(currWin);
}
}
return WindowList;
}
internal ApplicationSignal InitSignal()
{
ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_InitSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ApplicationSignal TerminateSignal()
{
ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_TerminateSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ApplicationSignal PauseSignal()
{
ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_PauseSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ApplicationSignal ResumeSignal()
{
ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResumeSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ApplicationSignal ResetSignal()
{
ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResetSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ApplicationControlSignal AppControlSignal()
{
ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.Application_AppControlSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ApplicationSignal LanguageChangedSignal()
{
ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_LanguageChangedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ApplicationSignal RegionChangedSignal()
{
ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_RegionChangedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal LowBatterySignalType BatteryLowSignal()
{
LowBatterySignalType ret = new LowBatterySignalType(NDalicPINVOKE.Application_LowBatterySignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal LowMemorySignalType MemoryLowSignal()
{
LowMemorySignalType ret = new LowMemorySignalType(NDalicPINVOKE.Application_LowMemorySignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <since_tizen> 3 </since_tizen>
public enum WindowMode
{
Opaque = 0,
Transparent = 1
}
}
}
| 37.054111 | 171 | 0.59475 | [
"Apache-2.0",
"MIT"
] | hjhun/TizenFX | src/Tizen.NUI/src/internal/Application.cs | 52,728 | C# |
using System.Net.Http;
using System.Threading.Tasks;
using BizzebeeSharp.Entities;
using BizzebeeSharp.Extensions;
using BizzebeeSharp.Filters;
using BizzebeeSharp.Infrastructure;
namespace BizzebeeSharp.Services.ProductBundled
{
public class ProductBundledService : BizzebeeService
{
/// <summary>
/// Creates a new instance of <see cref="ProductBundledService" />.
/// </summary>
/// <param name="myBizzebeeUrl">The shop's *.mystrweb.se/api/vX URL.</param>
/// <param name="shopAccessToken">An API access token for the shop.</param>
public ProductBundledService(string myBizzebeeUrl, string shopAccessToken) : base(myBizzebeeUrl, shopAccessToken)
{
}
/// <summary>
/// Return a list of bundled products. Max 100 per call.
/// </summary>
/// <param name="productId">The product id of product.</param>
/// <returns></returns>
public virtual async Task<BundledProductsModelCollection> ListAsync(int productId, BundledProductFilter filter = null)
{
var req = PrepareRequest($"products/{productId}/bundled-products");
if (filter != null) req.QueryParams.AddRange(filter.ToParameters());
return await ExecuteRequestAsync<BundledProductsModelCollection>(req, HttpMethod.Get, rootElement: "");
}
/// <summary>
/// Retrieves the <see cref="BundledProductsModel" /> with the given bundled id.
/// </summary>
/// <param name="productId">The product id of product.</param>
/// <param name="bundledProductId">bundled product id of product.</param>
/// <param name="include">
/// If you want to include child data in the result. Example: ? include=languages (to include
/// language based data such as category names, description, etc). Available includes: languages
/// </param>
/// <returns>The <see cref="BundledProductsModel" />.</returns>
public virtual async Task<BundledProductsModel> GetAsync(int productId, int bundledProductId,
string include = null)
{
var req = PrepareRequest($"products/{productId}/bundled-products/{bundledProductId}");
if (!string.IsNullOrEmpty(include)) req.QueryParams.Add("include", include);
return await ExecuteRequestAsync<BundledProductsModel>(req, HttpMethod.Get, rootElement: "data");
}
/// <summary>
/// Creates a new <see cref="BundledProductsModel" /> on the store.
/// </summary>
/// <param name="productId">The product id of product.</param>
/// <param name="bundledProductModel">A new <see cref="BundledProductsModel" />. Id should be set to null.</param>
/// <returns>The new <see cref="BundledProductsModel" />.</returns>
public virtual async Task<BundledProductsModel> CreateAsync(int productId,
BundledProductsModel bundledProductModel)
{
var req = PrepareRequest($"products/{productId}/bundled-products");
var body = bundledProductModel.ToDictionary();
var content = new JsonContent(body);
return await ExecuteRequestAsync<BundledProductsModel>(req, HttpMethod.Post, content, "data");
}
/// <summary>
/// Deletes a product bundled product
/// </summary>
/// <param name="productId">The product id of product.</param>
/// <param name="bundledProductId">bundled product id of product.</param>
public virtual async Task DeleteAsync(int productId, int bundledProductId)
{
var req = PrepareRequest($"products/{productId}/bundled-products/{bundledProductId}");
await ExecuteRequestAsync(req, HttpMethod.Delete);
}
/// <summary>
/// Updates the given <see cref="BundledProductsModel" />.
/// </summary>
/// <param name="productId">The product id of product.</param>
/// <param name="bundledProductId">bundled product id of product.</param>
/// <param name="bundleProductModel">The <see cref="BundledProductsModel" /> to update.</param>
/// <returns>The updated <see cref="BundledProductsModel" />.</returns>
public virtual async Task<BundledProductsModel> UpdateAsync(int productId, int bundledProductId,
BundledProductsModel bundleProductModel)
{
var req = PrepareRequest($"products/{productId}/bundled-products/{bundledProductId}");
var body = bundleProductModel.ToDictionary();
var content = new JsonContent(body);
return await ExecuteRequestAsync<BundledProductsModel>(req, HttpMethod.Put, content, "data");
}
}
} | 46.911765 | 126 | 0.642215 | [
"MIT"
] | PrimePenguin/BizzebeeSharp | BizzebeeSharp/Services/ProductBundled/ProductBundledService.cs | 4,787 | C# |
using System;
using System.Reactive.Concurrency;
using NBitcoin;
using ReactiveUI;
using System.Reactive.Linq;
using Avalonia.Controls;
using WalletWasabi.Fluent.ViewModels.AddWallet;
using WalletWasabi.Fluent.ViewModels.Dialogs.Base;
using WalletWasabi.Fluent.ViewModels.NavBar;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Fluent.ViewModels.Search;
using WalletWasabi.Fluent.ViewModels.Settings;
using WalletWasabi.Fluent.ViewModels.TransactionBroadcasting;
using WalletWasabi.Fluent.ViewModels.HelpAndSupport;
using WalletWasabi.Fluent.ViewModels.OpenDirectory;
using WalletWasabi.Logging;
using WalletWasabi.Fluent.ViewModels.StatusBar;
namespace WalletWasabi.Fluent.ViewModels
{
public partial class MainViewModel : ViewModelBase
{
private readonly SettingsPageViewModel _settingsPage;
private readonly SearchPageViewModel _searchPage;
private readonly PrivacyModeViewModel _privacyMode;
private readonly AddWalletPageViewModel _addWalletPage;
[AutoNotify] private bool _isMainContentEnabled;
[AutoNotify] private bool _isDialogScreenEnabled;
[AutoNotify] private bool _isFullScreenEnabled;
[AutoNotify] private DialogScreenViewModel _dialogScreen;
[AutoNotify] private DialogScreenViewModel _fullScreen;
[AutoNotify] private DialogScreenViewModel _compactDialogScreen;
[AutoNotify] private NavBarViewModel _navBar;
[AutoNotify] private StatusBarViewModel _statusBar;
[AutoNotify] private string _title = "Wasabi Wallet";
[AutoNotify] private WindowState _windowState;
public MainViewModel()
{
_windowState = (WindowState)Enum.Parse(typeof(WindowState), Services.UiConfig.WindowState);
_dialogScreen = new DialogScreenViewModel();
_fullScreen = new DialogScreenViewModel(NavigationTarget.FullScreen);
_compactDialogScreen = new DialogScreenViewModel(NavigationTarget.CompactDialogScreen);
MainScreen = new TargettedNavigationStack(NavigationTarget.HomeScreen);
NavigationState.Register(MainScreen, DialogScreen, FullScreen, CompactDialogScreen);
_isMainContentEnabled = true;
_isDialogScreenEnabled = true;
_isFullScreenEnabled = true;
_statusBar = new StatusBarViewModel();
UiServices.Initialize();
_addWalletPage = new AddWalletPageViewModel();
_settingsPage = new SettingsPageViewModel();
_privacyMode = new PrivacyModeViewModel();
_searchPage = new SearchPageViewModel();
_navBar = new NavBarViewModel(MainScreen);
NavigationManager.RegisterType(_navBar);
RegisterCategories(_searchPage);
RegisterViewModels();
RxApp.MainThreadScheduler.Schedule(async () => await _navBar.InitialiseAsync());
_searchPage.Initialise();
this.WhenAnyValue(x => x.WindowState)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(windowState => Services.UiConfig.WindowState = windowState.ToString());
this.WhenAnyValue(x => x.DialogScreen!.IsDialogOpen)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x => IsMainContentEnabled = !x);
this.WhenAnyValue(x => x.FullScreen!.IsDialogOpen)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x => IsMainContentEnabled = !x);
this.WhenAnyValue(x => x.CompactDialogScreen!.IsDialogOpen)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x => IsMainContentEnabled = !x);
if (!Services.WalletManager.HasWallet())
{
_dialogScreen.To(_addWalletPage, NavigationMode.Clear);
}
}
public TargettedNavigationStack MainScreen { get; }
public static MainViewModel? Instance { get; internal set; }
public void ClearStacks()
{
MainScreen.Clear();
DialogScreen.Clear();
FullScreen.Clear();
}
public void Initialize()
{
StatusBar.Initialize();
if (Services.Config.Network != Network.Main)
{
Title += $" - {Services.Config.Network}";
}
}
private void RegisterViewModels()
{
SearchPageViewModel.Register(_searchPage);
PrivacyModeViewModel.Register(_privacyMode);
AddWalletPageViewModel.Register(_addWalletPage);
SettingsPageViewModel.Register(_settingsPage);
GeneralSettingsTabViewModel.RegisterLazy(
() =>
{
_settingsPage.SelectedTab = 0;
return _settingsPage;
});
PrivacySettingsTabViewModel.RegisterLazy(
() =>
{
_settingsPage.SelectedTab = 1;
return _settingsPage;
});
NetworkSettingsTabViewModel.RegisterLazy(
() =>
{
_settingsPage.SelectedTab = 2;
return _settingsPage;
});
BitcoinTabSettingsViewModel.RegisterLazy(
() =>
{
_settingsPage.SelectedTab = 3;
return _settingsPage;
});
AboutViewModel.RegisterLazy(() => new AboutViewModel());
BroadcastTransactionViewModel.RegisterAsyncLazy(
async () =>
{
var dialogResult = await DialogScreen.NavigateDialogAsync(new LoadTransactionViewModel(Services.Config.Network));
if (dialogResult.Result is { })
{
return new BroadcastTransactionViewModel(Services.Config.Network,
dialogResult.Result);
}
return null;
});
RxApp.MainThreadScheduler.Schedule(async () =>
{
try
{
await Services.LegalChecker.WaitAndGetLatestDocumentAsync();
LegalDocumentsViewModel.RegisterAsyncLazy(async () =>
{
var document = await Services.LegalChecker.WaitAndGetLatestDocumentAsync();
return new LegalDocumentsViewModel(document.Content);
});
_searchPage.RegisterSearchEntry(LegalDocumentsViewModel.MetaData);
}
catch (Exception ex)
{
if (ex is not OperationCanceledException)
{
Logger.LogError("Failed to get Legal documents.", ex);
}
}
});
UserSupportViewModel.RegisterLazy(() => new UserSupportViewModel());
BugReportLinkViewModel.RegisterLazy(() => new BugReportLinkViewModel());
DocsLinkViewModel.RegisterLazy(() => new DocsLinkViewModel());
OpenDataFolderViewModel.RegisterLazy(() => new OpenDataFolderViewModel());
OpenWalletsFolderViewModel.RegisterLazy(() => new OpenWalletsFolderViewModel());
OpenLogsViewModel.RegisterLazy(() => new OpenLogsViewModel());
OpenTorLogsViewModel.RegisterLazy(() => new OpenTorLogsViewModel());
OpenConfigFileViewModel.RegisterLazy(() => new OpenConfigFileViewModel());
}
private static void RegisterCategories(SearchPageViewModel searchPage)
{
searchPage.RegisterCategory("General", 0);
searchPage.RegisterCategory("Settings", 1);
searchPage.RegisterCategory("Help & Support", 2);
searchPage.RegisterCategory("Open", 3);
}
}
}
| 30.942584 | 118 | 0.751044 | [
"MIT"
] | 0racl3z/WalletWasabi | WalletWasabi.Fluent/ViewModels/MainViewModel.cs | 6,467 | C# |
using System;
namespace SysCommand.Mapping
{
/// <summary>
/// Map of argument
/// </summary>
public class ArgumentMap
{
/// <summary>
/// Represent the member name
/// </summary>
public string MapName { get; private set; }
/// <summary>
/// Argument long name
/// </summary>
public string LongName { get; private set; }
/// <summary>
/// Argument short name
/// </summary>
public char? ShortName { get; private set; }
/// <summary>
/// Argument type
/// </summary>
public Type Type { get; private set; }
/// <summary>
/// Check if property has default value
/// </summary>
public bool HasDefaultValue { get; private set; }
/// <summary>
/// Get default value
/// </summary>
public object DefaultValue { get; private set; }
/// <summary>
/// If true, this property isn't required
/// </summary>
public bool IsOptional { get; private set; }
/// <summary>
/// Help text
/// </summary>
public string HelpText { get; private set; }
/// <summary>
/// Displays the default value or the label "required" at the end of the sentence help.
/// </summary>
public bool ShowHelpComplement { get; private set; }
/// <summary>
/// If the command accept positional arguments for properties, then you can set the positional order if you want.
/// </summary>
public int? Position { get; private set; }
/// <summary>
/// Target instance (owner class)
/// </summary>
public object Target { get; private set; }
/// <summary>
/// Target member (PropertyInfo or ParameterInfo)
/// </summary>
public object TargetMember { get; private set; }
/// <summary>
/// Initialize
/// </summary>
/// <param name="target">Target instance (owner class)</param>
/// <param name="targetMember">Target member (PropertyInfo or ParameterInfo)</param>
/// <param name="mapName">Represent the member name</param>
/// <param name="longName">Argument long name</param>
/// <param name="shortName">Argument short name</param>
/// <param name="type">Argument type</param>
/// <param name="isOptional">If true, this property isn't required</param>
/// <param name="hasDefaultValue">Check if property has default value</param>
/// <param name="defaultValue">Get default value</param>
/// <param name="helpText">Help text</param>
/// <param name="showHelpComplement">Displays the default value or the label "required" at the end of the sentence help.</param>
/// <param name="position">If the command accept positional arguments for properties, then you can set the positional order if you want.</param>
public ArgumentMap(object target, object targetMember, string mapName, string longName, char? shortName, Type type, bool isOptional, bool hasDefaultValue, object defaultValue, string helpText, bool showHelpComplement, int? position)
{
this.Target = target;
this.TargetMember = targetMember;
this.MapName = mapName;
this.LongName = longName;
this.ShortName = shortName;
this.Type = type;
this.IsOptional = isOptional;
this.HasDefaultValue = hasDefaultValue;
this.DefaultValue = defaultValue;
this.HelpText = helpText;
this.ShowHelpComplement = showHelpComplement;
this.Position = position;
}
public override string ToString()
{
return "[" + this.MapName + ", " + this.Type + "]";
}
}
}
| 36.317757 | 240 | 0.574627 | [
"MIT"
] | juniorgasparotto/SysCommand | src/SysCommand/Core/Model/Mapping/Argument/ArgumentMap.cs | 3,888 | C# |
////////////////////////////////////////////////////////////////////////////////
//NUnit tests for "EF Core Provider for LCPI OLE DB"
// IBProvider and Contributors. 20.01.2021.
//
// (short)integer_column==smallint_column
//
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using xdb=lcpi.data.oledb;
namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D3.Query.CastAs.SET_001.NullableSingle.Double{
////////////////////////////////////////////////////////////////////////////////
using T_SOURCE_VALUE=System.Nullable<System.Single>;
using T_TARGET_VALUE=System.Double;
////////////////////////////////////////////////////////////////////////////////
//class TestSet__N010__const_with_null__as_object
public static class TestSet__N010__const_with_null__as_object
{
private const string c_NameOf__TABLE="TEST_MODIFY_ROW2";
private const string c_NameOf__COL_SOURCE="COL_FLOAT";
private const string c_NameOf__COL_TARGET="COL2_DOUBLE";
private const string c_NameOf__TARGET_SQL_TYPE="DOUBLE PRECISION";
private sealed class MyContext:TestBaseDbContext
{
[Table(c_NameOf__TABLE)]
public sealed class TEST_RECORD
{
[Key]
[Column("TEST_ID")]
public System.Int64? TEST_ID { get; set; }
[Column(c_NameOf__COL_SOURCE)]
public T_SOURCE_VALUE COL_SOURCE { get; set; }
[Column(c_NameOf__COL_TARGET)]
public T_TARGET_VALUE? COL_TARGET { get; set; }
};//class TEST_RECORD
//----------------------------------------------------------------------
public DbSet<TEST_RECORD> testTable { get; set; }
//----------------------------------------------------------------------
public MyContext(xdb.OleDbTransaction tr)
:base(tr)
{
}//MyContext
};//class MyContext
//-----------------------------------------------------------------------
[Test]
public static void Test_100__null()
{
using(var cn=LocalCnHelper.CreateCn())
{
cn.Open();
using(var tr=cn.BeginTransaction())
{
//insert new record in external transaction
using(var db=new MyContext(tr))
{
System.Int64? testID=Helper__InsertRow(db,null,null);
var recs=db.testTable.Where(r => (T_TARGET_VALUE)(object)new T_SOURCE_VALUE()==(T_TARGET_VALUE)(object)r.COL_TARGET && r.TEST_ID==testID);
int nRecs=0;
foreach(var r in recs)
{
Assert.AreEqual
(0,
nRecs);
++nRecs;
Assert.IsTrue
(r.TEST_ID.HasValue);
Assert.AreEqual
(testID,
r.TEST_ID.Value);
Assert.AreEqual
(null,
r.COL_SOURCE);
Assert.AreEqual
(null,
r.COL_TARGET);
}//foreach r
db.CheckTextOfLastExecutedCommand
(new TestSqlTemplate()
.T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_SOURCE).T(", ").N("t",c_NameOf__COL_TARGET).EOL()
.T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL()
.T("WHERE (").N("t",c_NameOf__COL_TARGET).IS_NULL().T(") AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"));
Assert.AreEqual
(1,
nRecs);
}//using db
tr.Rollback();
}//using tr
}//using cn
}//Test_100__null
//-----------------------------------------------------------------------
private static System.Int64 Helper__InsertRow(MyContext db,
T_SOURCE_VALUE valueForColSource,
T_TARGET_VALUE? valueForColTarget)
{
var newRecord=new MyContext.TEST_RECORD();
newRecord.COL_SOURCE =valueForColSource;
newRecord.COL_TARGET =valueForColTarget;
db.testTable.Add(newRecord);
db.SaveChanges();
db.CheckTextOfLastExecutedCommand
(new TestSqlTemplate()
.T("INSERT INTO ").N(c_NameOf__TABLE).T(" (").N(c_NameOf__COL_SOURCE).T(", ").N(c_NameOf__COL_TARGET).T(")").EOL()
.T("VALUES (").P("p0").T(", ").P("p1").T(")").EOL()
.T("RETURNING ").N("TEST_ID").EOL()
.T("INTO ").P("p2").T(";"));
Assert.IsTrue
(newRecord.TEST_ID.HasValue);
Console.WriteLine("TEST_ID: {0}",newRecord.TEST_ID.Value);
return newRecord.TEST_ID.Value;
}//Helper__InsertRow
};//class TestSet__N010__const_with_null__as_object
////////////////////////////////////////////////////////////////////////////////
}//namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D3.Query.CastAs.SET_001.NullableSingle.Double
| 30.013245 | 143 | 0.577449 | [
"MIT"
] | ibprovider/Lcpi.EFCore.LcpiOleDb | Tests/General/Source/Work/DBMS/Firebird/V03_0_0/D3/Query/CastAs/SET_001/NullableSingle/Double/TestSet__N010__const_with_null__as_object.cs | 4,534 | C# |
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms.Design;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.PropertyGrid
{
[TestFixture]
public class FileNamePropertyDescriptorTestFixture
{
WixXmlAttributePropertyDescriptor propertyDescriptor;
EditorAttribute editorAttribute;
[TestFixtureSetUp]
public void SetUpFixture()
{
WixXmlAttribute attribute = new WixXmlAttribute("Id", WixXmlAttributeType.FileName);
propertyDescriptor = new WixXmlAttributePropertyDescriptor(attribute);
editorAttribute = WixBindingTestsHelper.GetEditorAttribute(propertyDescriptor.Attributes);
}
[Test]
public void EditorAttributeAdded()
{
Assert.IsNotNull(editorAttribute);
}
[Test]
public void EditorAttributeBaseTypeName()
{
Assert.AreEqual(typeof(UITypeEditor).AssemblyQualifiedName, editorAttribute.EditorBaseTypeName);
}
[Test]
public void EditorAttributeTypeName()
{
Assert.AreEqual(typeof(RelativeFileNameEditor).AssemblyQualifiedName, editorAttribute.EditorTypeName);
}
}
}
| 28.404255 | 105 | 0.792509 | [
"MIT"
] | Plankankul/SharpDevelop-w-Framework | src/AddIns/BackendBindings/WixBinding/Test/PropertyGrid/FileNamePropertyDescriptorTestFixture.cs | 1,337 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18034
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WpfPulsatingCircleAnimation.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfPulsatingCircleAnimation.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
| 34.208333 | 178 | 0.693463 | [
"MIT"
] | bpe78/WpfExamples | src/WpfPulsatingCircleAnimation/WpfPulsatingCircleAnimation/Properties/Resources.Designer.cs | 2,465 | C# |
/*********************************************
作者:曹旭升
QQ:279060597
访问博客了解详细介绍及更多内容:
http://blog.shengxunwei.com
**********************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Sheng.SailingEase.Core.Development
{
class DeleteDataDevEditorAdapter : EventEditorAdapterAbstract
{
private Panels _parameterPanels;
public Panels ParameterPanels
{
get
{
return this._parameterPanels;
}
set
{
this._parameterPanels = value;
}
}
public DeleteDataDevEditorAdapter(EventBase hostEvent)
: base(hostEvent)
{
}
protected override void CreateEditorNode()
{
this.ParameterPanels = new Panels();
ParameterPanels.General = new UserControlEventEditorPanel_DeleteData_General(this);
ParameterPanels.DataEntity = new UserControlEventEditorPanel_DeleteData_DataEntity(this);
ParameterPanels.SqlRegex = new UserControlEventEditorPanel_DeleteData_SqlRegex(this);
this.EventEditorPanelList = new List<IEventEditorPanel>();
this.EventEditorPanelList.Add(ParameterPanels.General);
this.EventEditorPanelList.Add(ParameterPanels.DataEntity);
this.EventEditorPanelList.Add(ParameterPanels.SqlRegex);
}
public class Panels
{
private UserControlEventEditorPanel_DeleteData_General general;
public UserControlEventEditorPanel_DeleteData_General General
{
get
{
return this.general;
}
set
{
this.general = value;
}
}
private UserControlEventEditorPanel_DeleteData_DataEntity dataEntity;
public UserControlEventEditorPanel_DeleteData_DataEntity DataEntity
{
get
{
return this.dataEntity;
}
set
{
this.dataEntity = value;
}
}
private UserControlEventEditorPanel_DeleteData_SqlRegex sqlRegex;
public UserControlEventEditorPanel_DeleteData_SqlRegex SqlRegex
{
get
{
return this.sqlRegex;
}
set
{
this.sqlRegex = value;
}
}
}
}
}
| 33.253012 | 102 | 0.510145 | [
"MIT"
] | ckalvin-hub/Sheng.Winform.IDE | SourceCode/Source/Core.Development/Event/Events/DeleteData/DeleteDataDevEditorAdapter.cs | 2,808 | C# |
using System;
using FluentAssertions;
using Xunit;
namespace Networking.Tests.OctetsTests
{
public class Octets_Method_GetUInt32_Test
{
[Fact]
public void GetUInt32()
{
var octets = new Octets
{
Bytes = new Byte[] {
0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF
}
};
octets.GetUInt32(0).Should().Be(19088743);
octets.GetUInt32(4).Should().Be(2309737967);
octets.IsLittleEndian = true;
octets.GetUInt32(0).Should().Be(1732584193);
octets.GetUInt32(4).Should().Be(4023233417);
}
}
}
| 23.266667 | 56 | 0.514327 | [
"MIT"
] | heshang233/networking | test/networking.core.tests/OctetsTests/Octets_Method_GetUInt32_Test.cs | 698 | C# |
using System;
using System.Linq;
namespace _07.Tuple
{
class Program
{
static void Main(string[] args)
{
string[] personName = Console
.ReadLine()
.Split()
.ToArray();
string[] nameAndAmountBeer = Console
.ReadLine()
.Split()
.ToArray();
double[] integerAndDoubleNum = Console
.ReadLine()
.Split()
.Select(double.Parse)
.ToArray();
string concatName = personName[0] +" "+ personName[1];
var tuple1 = new Tuple<string, string>(concatName, personName[2]);
Tuple<string, int> tuple2 = new Tuple<string, int>(nameAndAmountBeer[0], int.Parse(nameAndAmountBeer[1]));
Tuple<double, double> tuple3 = new Tuple<double, double>(integerAndDoubleNum[0], integerAndDoubleNum[1]);
Console.WriteLine(tuple1);
Console.WriteLine(tuple2);
Console.WriteLine(tuple3);
}
}
}
| 33.138889 | 118 | 0.468567 | [
"MIT"
] | Anzzhhela98/CSharp-Advanced | C# Advanced/07.Generics/Exercise Generics/07.Tuple/Program.cs | 1,195 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.