content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|
using System;
class SumIntegers
{
static void Main()
{
string numbers = Console.ReadLine();
string[] numbersS = numbers.Split(' ');
int sum = 0;
for (int i = 0; i < numbersS.Length; i++)
{
sum += int.Parse(numbersS[i]);
}
Console.WriteLine(sum);
}
} | 20.6875 | 49 | 0.498489 | [
"MIT"
] | zachdimitrov/Homework | CSharp-Part-2/05.ClassesAndObjects/08.SumIntegers/SumIntegers.cs | 333 | C# |
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Formatting;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace CodeCracker.Design
{
[ExportCodeFixProvider("CodeCrackerRethrowExceptionCodeFixProvider", LanguageNames.CSharp), Shared]
public class NameOfCodeFixProvider : CodeFixProvider
{
public override ImmutableArray<string> GetFixableDiagnosticIds()
{
return ImmutableArray.Create(NameOfAnalyzer.DiagnosticId);
}
public override FixAllProvider GetFixAllProvider()
{
return WellKnownFixAllProviders.BatchFixer;
}
public sealed override async Task ComputeFixesAsync(CodeFixContext context)
{
var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
var diagnostic = context.Diagnostics.First();
var diagnosticSpan = diagnostic.Location.SourceSpan;
var stringLiteral = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<LiteralExpressionSyntax>().FirstOrDefault();
if (stringLiteral != null)
context.RegisterFix(CodeAction.Create("Use nameof()", c => MakeNameOfAsync(context.Document, stringLiteral, c)), diagnostic);
}
private async Task<Document> MakeNameOfAsync(Document document, LiteralExpressionSyntax stringLiteral, CancellationToken cancelationToken)
{
var newNameof = SyntaxFactory.ParseExpression($"nameof({stringLiteral.Token.ValueText})")
.WithLeadingTrivia(stringLiteral.GetLeadingTrivia())
.WithTrailingTrivia(stringLiteral.GetTrailingTrivia())
.WithAdditionalAnnotations(Formatter.Annotation);
var root = await document.GetSyntaxRootAsync(cancelationToken);
var newRoot = root.ReplaceNode(stringLiteral, newNameof);
return document.WithSyntaxRoot(newRoot);
}
}
} | 46.571429 | 146 | 0.705083 | [
"Apache-2.0"
] | sqdavid/code-cracker | src/CSharp/CodeCracker/Design/NameOfCodeFixProvider.cs | 2,284 | C# |
//--------------------------------------------------------
// This code is generated by AutoFastGenerator.
// You should not modify the code.
//--------------------------------------------------------
namespace FlowScriptEngineBasicExtension.FlowSourceObjects.Enumerable
{
public partial class RangeWithStartIndexFlowSourceObject
{
public override object GetPropertyValue(string propertyName)
{
switch (propertyName)
{
case "Range":
return Range;
default:
return null;
}
}
protected override void SetPropertyValue(string propertyName, object value)
{
switch (propertyName)
{
case "EndIndex":
EndIndex = (System.Int32)value;
break;
case "StartIndex":
StartIndex = (System.Int32)value;
break;
}
}
}
}
| 28.305556 | 83 | 0.452404 | [
"Apache-2.0"
] | KHCmaster/PPD | Win/FlowScriptEngineBasicExtension/FlowSourceObjects/Enumerable/RangeWithStartIndexFlowSourceObject.AutoFast.cs | 1,021 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using Microsoft.Identity.Client.Core;
using Microsoft.Identity.Client;
using Microsoft.Identity.Client.Instance;
using Microsoft.Identity.Test.Common;
using Microsoft.Identity.Test.Common.Core.Mocks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Identity.Test.Common.Core.Helpers;
namespace Microsoft.Identity.Test.Unit.CoreTests.InstanceTests
{
[TestClass]
[DeploymentItem("Resources\\OpenidConfiguration.json")]
[DeploymentItem("Resources\\OpenidConfiguration-MissingFields.json")]
[DeploymentItem("Resources\\OpenidConfigurationCommon.json")]
public class AadAuthorityTests : TestBase
{
[TestMethod]
public void SuccessfulValidationTest()
{
using (var harness = CreateTestHarness())
{
// add mock response for instance validation
harness.HttpManager.AddMockHandler(
new MockHttpMessageHandler
{
ExpectedMethod = HttpMethod.Get,
ExpectedUrl = "https://login.microsoftonline.com/common/discovery/instance",
ExpectedQueryParams = new Dictionary<string, string>
{
{"api-version", "1.1"},
{
"authorization_endpoint",
"https%3A%2F%2Flogin.microsoftonline.in%2Fmytenant.com%2Foauth2%2Fv2.0%2Fauthorize"
},
},
ResponseMessage = MockHelpers.CreateSuccessResponseMessage(
"{\"tenant_discovery_endpoint\":\"https://login.microsoftonline.in/mytenant.com/.well-known/openid-configuration\"}")
});
// add mock response for tenant endpoint discovery
harness.HttpManager.AddMockHandler(
new MockHttpMessageHandler
{
ExpectedMethod = HttpMethod.Get,
ExpectedUrl = "https://login.microsoftonline.in/mytenant.com/v2.0/.well-known/openid-configuration",
ResponseMessage = MockHelpers.CreateSuccessResponseMessage(
File.ReadAllText(ResourceHelper.GetTestResourceRelativePath("OpenidConfiguration.json")))
});
Authority instance = Authority.CreateAuthority(harness.ServiceBundle, "https://login.microsoftonline.in/mytenant.com", true);
Assert.IsNotNull(instance);
Assert.AreEqual(instance.AuthorityInfo.AuthorityType, AuthorityType.Aad);
var resolver = new AuthorityEndpointResolutionManager(harness.ServiceBundle);
var endpoints = resolver.ResolveEndpointsAsync(
instance.AuthorityInfo,
null,
new RequestContext(harness.ServiceBundle, Guid.NewGuid()))
.GetAwaiter().GetResult();
Assert.AreEqual(
"https://login.microsoftonline.com/6babcaad-604b-40ac-a9d7-9fd97c0b779f/oauth2/v2.0/authorize",
endpoints.AuthorizationEndpoint);
Assert.AreEqual(
"https://login.microsoftonline.com/6babcaad-604b-40ac-a9d7-9fd97c0b779f/oauth2/v2.0/token",
endpoints.TokenEndpoint);
Assert.AreEqual("https://sts.windows.net/6babcaad-604b-40ac-a9d7-9fd97c0b779f/", endpoints.SelfSignedJwtAudience);
Assert.AreEqual("https://login.microsoftonline.in/common/userrealm/", instance.AuthorityInfo.UserRealmUriPrefix);
}
}
[TestMethod]
public void ValidationOffSuccessTest()
{
using (var harness = CreateTestHarness())
{
// add mock response for tenant endpoint discovery
harness.HttpManager.AddMockHandler(
new MockHttpMessageHandler
{
ExpectedMethod = HttpMethod.Get,
ExpectedUrl = "https://login.microsoftonline.in/mytenant.com/v2.0/.well-known/openid-configuration",
ResponseMessage = MockHelpers.CreateSuccessResponseMessage(
File.ReadAllText(ResourceHelper.GetTestResourceRelativePath("OpenidConfiguration.json")))
});
Authority instance = Authority.CreateAuthority(harness.ServiceBundle, "https://login.microsoftonline.in/mytenant.com");
Assert.IsNotNull(instance);
Assert.AreEqual(instance.AuthorityInfo.AuthorityType, AuthorityType.Aad);
var resolver = new AuthorityEndpointResolutionManager(harness.ServiceBundle);
var endpoints = resolver.ResolveEndpointsAsync(
instance.AuthorityInfo,
null,
new RequestContext(harness.ServiceBundle, Guid.NewGuid()))
.ConfigureAwait(false).GetAwaiter().GetResult();
Assert.AreEqual(
"https://login.microsoftonline.com/6babcaad-604b-40ac-a9d7-9fd97c0b779f/oauth2/v2.0/authorize",
endpoints.AuthorizationEndpoint);
Assert.AreEqual(
"https://login.microsoftonline.com/6babcaad-604b-40ac-a9d7-9fd97c0b779f/oauth2/v2.0/token",
endpoints.TokenEndpoint);
Assert.AreEqual("https://sts.windows.net/6babcaad-604b-40ac-a9d7-9fd97c0b779f/", endpoints.SelfSignedJwtAudience);
}
}
[TestMethod]
public void CreateEndpointsWithCommonTenantTest()
{
using (var harness = CreateTestHarness())
{
// add mock response for tenant endpoint discovery
harness.HttpManager.AddMockHandler(
new MockHttpMessageHandler
{
ExpectedMethod = HttpMethod.Get,
ExpectedUrl = "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration",
ResponseMessage = MockHelpers.CreateSuccessResponseMessage(
File.ReadAllText(ResourceHelper.GetTestResourceRelativePath("OpenidConfigurationCommon.json")))
});
Authority instance = Authority.CreateAuthority(harness.ServiceBundle, "https://login.microsoftonline.com/common");
Assert.IsNotNull(instance);
Assert.AreEqual(instance.AuthorityInfo.AuthorityType, AuthorityType.Aad);
var resolver = new AuthorityEndpointResolutionManager(harness.ServiceBundle);
var endpoints = resolver.ResolveEndpointsAsync(
instance.AuthorityInfo,
null,
new RequestContext(harness.ServiceBundle, Guid.NewGuid()))
.ConfigureAwait(false).GetAwaiter().GetResult();
Assert.AreEqual("https://login.microsoftonline.com/common/oauth2/v2.0/authorize", endpoints.AuthorizationEndpoint);
Assert.AreEqual("https://login.microsoftonline.com/common/oauth2/v2.0/token", endpoints.TokenEndpoint);
Assert.AreEqual("https://login.microsoftonline.com/common/v2.0", endpoints.SelfSignedJwtAudience);
}
}
[TestMethod]
public void SelfSignedJwtAudienceEndpointValidationTest()
{
string common = TestConstants.Common;
string tenantSpecific = TestConstants.TenantId;
string issuerCommonWithTenant = "https://login.microsoftonline.com/{tenant}/v2.0";
string issuerCommonWithTenantId = "https://login.microsoftonline.com/{tenantid}/v2.0";
string issuerTenantSpecific = $"https://login.microsoftonline.com/{tenantSpecific}/v2.0";
string jwtAudienceEndpointCommon = $"https://login.microsoftonline.com/{common}/v2.0";
CheckCorrectJwtAudienceEndpointIsCreatedFromIssuer(issuerCommonWithTenant, common, jwtAudienceEndpointCommon);
CheckCorrectJwtAudienceEndpointIsCreatedFromIssuer(issuerCommonWithTenantId, common, jwtAudienceEndpointCommon);
CheckCorrectJwtAudienceEndpointIsCreatedFromIssuer(issuerTenantSpecific, common, issuerTenantSpecific);
}
[TestMethod]
public void FailedValidationTest()
{
using (var harness = CreateTestHarness())
{
// add mock response for instance validation
harness.HttpManager.AddMockHandler(
new MockHttpMessageHandler
{
ExpectedMethod = HttpMethod.Get,
ExpectedUrl = "https://login.microsoftonline.com/common/discovery/instance",
ExpectedQueryParams = new Dictionary<string, string>
{
{"api-version", "1.1"},
{
"authorization_endpoint",
"https%3A%2F%2Flogin.microsoft0nline.com%2Fmytenant.com%2Foauth2%2Fv2.0%2Fauthorize"
},
},
ResponseMessage = MockHelpers.CreateFailureMessage(
HttpStatusCode.BadRequest,
"{\"error\":\"invalid_instance\"," + "\"error_description\":\"AADSTS50049: " +
"Unknown or invalid instance. Trace " + "ID: b9d0894d-a9a4-4dba-b38e-8fb6a009bc00 " +
"Correlation ID: 34f7b4cf-4fa2-4f35-a59b" + "-54b6f91a9c94 Timestamp: 2016-08-23 " +
"20:45:49Z\",\"error_codes\":[50049]," + "\"timestamp\":\"2016-08-23 20:45:49Z\"," +
"\"trace_id\":\"b9d0894d-a9a4-4dba-b38e-8f" + "b6a009bc00\",\"correlation_id\":\"34f7b4cf-" +
"4fa2-4f35-a59b-54b6f91a9c94\"}")
});
Authority instance = Authority.CreateAuthority(harness.ServiceBundle, "https://login.microsoft0nline.com/mytenant.com", true);
Assert.IsNotNull(instance);
Assert.AreEqual(instance.AuthorityInfo.AuthorityType, AuthorityType.Aad);
try
{
var resolver = new AuthorityEndpointResolutionManager(harness.ServiceBundle);
var endpoints = resolver.ResolveEndpointsAsync(
instance.AuthorityInfo,
null,
new RequestContext(harness.ServiceBundle, Guid.NewGuid()))
.ConfigureAwait(false).GetAwaiter().GetResult();
Assert.Fail("validation should have failed here");
}
catch (Exception exc)
{
Assert.IsTrue(exc is MsalServiceException);
Assert.AreEqual(((MsalServiceException)exc).ErrorCode, "invalid_instance");
}
}
}
[TestMethod]
public void FailedValidationMissingFieldsTest()
{
using (var harness = CreateTestHarness())
{
// add mock response for instance validation
harness.HttpManager.AddMockHandler(
new MockHttpMessageHandler
{
ExpectedMethod = HttpMethod.Get,
ExpectedUrl = "https://login.windows.net/common/discovery/instance",
ExpectedQueryParams = new Dictionary<string, string>
{
{"api-version", "1.0"},
{"authorization_endpoint", "https://login.microsoft0nline.com/mytenant.com/oauth2/v2.0/authorize"},
},
ResponseMessage = MockHelpers.CreateSuccessResponseMessage("{}")
});
Authority instance = Authority.CreateAuthority(harness.ServiceBundle, "https://login.microsoft0nline.com/mytenant.com");
Assert.IsNotNull(instance);
Assert.AreEqual(instance.AuthorityInfo.AuthorityType, AuthorityType.Aad);
try
{
var resolver = new AuthorityEndpointResolutionManager(harness.ServiceBundle);
var endpoints = resolver.ResolveEndpointsAsync(
instance.AuthorityInfo,
null,
new RequestContext(harness.ServiceBundle, Guid.NewGuid()))
.ConfigureAwait(false).GetAwaiter().GetResult();
Assert.Fail("validation should have failed here");
}
catch (Exception exc)
{
Assert.IsNotNull(exc);
}
}
}
[TestMethod]
public void FailedTenantDiscoveryMissingEndpointsTest()
{
using (var harness = CreateTestHarness())
{
// add mock response for tenant endpoint discovery
harness.HttpManager.AddMockHandler(
new MockHttpMessageHandler
{
ExpectedMethod = HttpMethod.Get,
ExpectedUrl = "https://login.microsoftonline.in/mytenant.com/v2.0/.well-known/openid-configuration",
ResponseMessage =
MockHelpers.CreateSuccessResponseMessage(
File.ReadAllText(ResourceHelper.GetTestResourceRelativePath("OpenidConfiguration-MissingFields.json")))
});
Authority instance = Authority.CreateAuthority(harness.ServiceBundle, "https://login.microsoftonline.in/mytenant.com");
Assert.IsNotNull(instance);
Assert.AreEqual(instance.AuthorityInfo.AuthorityType, AuthorityType.Aad);
try
{
var resolver = new AuthorityEndpointResolutionManager(harness.ServiceBundle);
var endpoints = resolver.ResolveEndpointsAsync(
instance.AuthorityInfo,
null,
new RequestContext(harness.ServiceBundle, Guid.NewGuid()))
.ConfigureAwait(false).GetAwaiter().GetResult();
Assert.Fail("validation should have failed here");
}
catch (MsalClientException exc)
{
Assert.AreEqual(MsalError.TenantDiscoveryFailedError, exc.ErrorCode);
}
}
}
[TestMethod]
public void CanonicalAuthorityInitTest()
{
var serviceBundle = TestCommon.CreateDefaultServiceBundle();
const string UriNoPort = "https://login.microsoftonline.in/mytenant.com";
const string UriNoPortTailSlash = "https://login.microsoftonline.in/mytenant.com/";
const string UriDefaultPort = "https://login.microsoftonline.in:443/mytenant.com";
const string UriCustomPort = "https://login.microsoftonline.in:444/mytenant.com";
const string UriCustomPortTailSlash = "https://login.microsoftonline.in:444/mytenant.com/";
var authority = Authority.CreateAuthority(serviceBundle, UriNoPort);
Assert.AreEqual(UriNoPortTailSlash, authority.AuthorityInfo.CanonicalAuthority);
authority = Authority.CreateAuthority(serviceBundle, UriDefaultPort);
Assert.AreEqual(UriNoPortTailSlash, authority.AuthorityInfo.CanonicalAuthority);
authority = Authority.CreateAuthority(serviceBundle, UriCustomPort);
Assert.AreEqual(UriCustomPortTailSlash, authority.AuthorityInfo.CanonicalAuthority);
}
[TestMethod]
public void TenantSpecificAuthorityInitTest()
{
var host = String.Concat("https://", TestConstants.ProductionPrefNetworkEnvironment);
var expectedAuthority = String.Concat(host, "/" , TestConstants.TenantId, "/");
var publicClient = PublicClientApplicationBuilder.Create(TestConstants.ClientId)
.WithAuthority(host, TestConstants.TenantId)
.BuildConcrete();
Assert.AreEqual(publicClient.Authority, expectedAuthority);
publicClient = PublicClientApplicationBuilder.Create(TestConstants.ClientId)
.WithAuthority(host, new Guid(TestConstants.TenantId))
.BuildConcrete();
Assert.AreEqual(publicClient.Authority, expectedAuthority);
publicClient = PublicClientApplicationBuilder.Create(TestConstants.ClientId)
.WithAuthority(new Uri(expectedAuthority))
.BuildConcrete();
Assert.AreEqual(publicClient.Authority, expectedAuthority);
}
[TestMethod]
public void MalformedAuthorityInitTest()
{
PublicClientApplication publicClient = null;
var expectedAuthority = String.Concat("https://", TestConstants.ProductionPrefNetworkEnvironment, "/", TestConstants.TenantId, "/");
//Check bad URI format
var host = String.Concat("test", TestConstants.ProductionPrefNetworkEnvironment, "/");
var fullAuthority = String.Concat(host, TestConstants.TenantId);
AssertException.Throws<UriFormatException>(() =>
{
publicClient = PublicClientApplicationBuilder.Create(TestConstants.ClientId)
.WithAuthority(fullAuthority)
.BuildConcrete();
});
//Check empty path segments
host = String.Concat("https://", TestConstants.ProductionPrefNetworkEnvironment, "/");
fullAuthority = String.Concat(host, TestConstants.TenantId, "//");
publicClient = PublicClientApplicationBuilder.Create(TestConstants.ClientId)
.WithAuthority(host, new Guid(TestConstants.TenantId))
.BuildConcrete();
Assert.AreEqual(publicClient.Authority, expectedAuthority);
//Check additional path segments
fullAuthority = String.Concat(host , TestConstants.TenantId, "/ABCD!@#$TEST//");
publicClient = PublicClientApplicationBuilder.Create(TestConstants.ClientId)
.WithAuthority(new Uri(fullAuthority))
.BuildConcrete();
Assert.AreEqual(publicClient.Authority, expectedAuthority);
}
[TestMethod]
public void TenantAuthorityDoesNotChange()
{
// no change because initial authority is tenanted
AuthorityTestHelper.AuthorityDoesNotUpdateTenant(
TestConstants.AuthorityUtidTenant, TestConstants.Utid);
}
[TestMethod]
public void TenantlessAuthorityChanges()
{
Authority authority = AuthorityTestHelper.CreateAuthorityFromUrl(
TestConstants.AuthorityCommonTenant);
Assert.AreEqual("common", authority.GetTenantId());
string updatedAuthority = authority.GetTenantedAuthority(TestConstants.Utid);
Assert.AreEqual(TestConstants.AuthorityUtidTenant, updatedAuthority);
Assert.AreEqual(updatedAuthority, TestConstants.AuthorityUtidTenant);
authority.UpdateWithTenant(TestConstants.Utid);
Assert.AreEqual(authority.AuthorityInfo.CanonicalAuthority, TestConstants.AuthorityUtidTenant);
}
private void CheckCorrectJwtAudienceEndpointIsCreatedFromIssuer(string issuer, string tenantId, string expectedJwtAudience)
{
var resolver = new AuthorityEndpointResolutionManager(null);
TenantDiscoveryResponse tenantDiscoveryResponse = new TenantDiscoveryResponse();
tenantDiscoveryResponse.Issuer = issuer;
string selfSignedJwtAudience = resolver.ReplaceNonTenantSpecificValueWithTenant(tenantDiscoveryResponse, tenantId);
Assert.AreEqual(expectedJwtAudience, selfSignedJwtAudience);
}
}
}
| 51.007282 | 145 | 0.583773 | [
"MIT"
] | deisterhold/microsoft-authentication-library-for-dotnet | tests/Microsoft.Identity.Test.Unit.net45/CoreTests/InstanceTests/AadAuthorityTests.cs | 21,017 | C# |
using System;
using System.Collections.Specialized;
using EPiServer;
namespace Forte.EpiResponsivePicture.ResizedImage
{
public static class UrlBuilderExtensions
{
public static UrlBuilder Clone(this UrlBuilder builder)
{
return new UrlBuilder(builder.ToString());
}
public static UrlBuilder Add(this UrlBuilder target, string key, string value)
{
if (target == null)
throw new ArgumentNullException(nameof(target));
if (!target.IsEmpty)
target.QueryCollection.Add(key, value);
return target;
}
public static UrlBuilder Add(this UrlBuilder target, NameValueCollection collection)
{
if (target == null)
throw new ArgumentNullException(nameof(target));
if (!target.IsEmpty)
target.QueryCollection.Add(collection);
return target;
}
public static UrlBuilder Remove(this UrlBuilder target, string key)
{
if (target == null)
throw new ArgumentNullException(nameof(target));
if (!target.IsEmpty && target.QueryCollection[key] != null)
target.QueryCollection.Remove(key);
return target;
}
public static UrlBuilder Width(this UrlBuilder target, int width)
{
return target.Add("w", width.ToString());
}
public static UrlBuilder Height(this UrlBuilder target, int height)
{
return target.Add("h", height.ToString());
}
public static UrlBuilder Quality(this UrlBuilder target, int quality)
{
return target.Add("quality", quality.ToString());
}
public static UrlBuilder Crop(this UrlBuilder target, CropSettings settings)
{
return target.Add("crop", settings.ToString());
}
public static UrlBuilder Zoom(this UrlBuilder target, double zoom)
{
return target.Add("zoom", zoom.ToString("0.##"));
}
public static UrlBuilder Mode(this UrlBuilder target, ScaleMode mode)
{
if (mode == ScaleMode.Default) return target;
return target.Add("mode", mode.ToString().ToLowerInvariant());
}
public static UrlBuilder Format(this UrlBuilder target, ResizedImageFormat format)
{
if (format == ResizedImageFormat.Preserve)
target.QueryCollection.Remove("format");
else
target.Add("format", format.ToString().ToLowerInvariant());
return target;
}
}
} | 32.621951 | 92 | 0.59028 | [
"MIT"
] | fortedigital/EpiResponsivePicture | EpiResponsivePicture/ResizedImage/UrlBuilderExtensions.cs | 2,675 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Azure.IoT.ModelsRepository;
using Microsoft.Azure.DigitalTwins.Parser;
using Microsoft.IoT.ModelsRepository.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.IoT.ModelsRepository.CommandLine
{
internal class RepoProvider
{
readonly ModelsRepositoryClient _repositoryClient;
readonly string _repoLocationUriStr;
readonly Uri _repoLocationUri;
public RepoProvider(string repoLocationUriStr)
{
_repoLocationUriStr = repoLocationUriStr;
if (IsRelativePath(_repoLocationUriStr))
{
_repoLocationUriStr = Path.GetFullPath(_repoLocationUriStr);
}
_repoLocationUri = new Uri(_repoLocationUriStr);
_repositoryClient = new ModelsRepositoryClient(_repoLocationUri);
}
public async Task<List<string>> ExpandModel(FileInfo modelFile)
{
string dtmi = ParsingUtils.GetRootId(modelFile);
return await ExpandModel(dtmi);
}
/// <summary>
/// Uses a combination of the Model Parser and DMR Client to produce expanded model format.
/// This method is implemented such that the Model Parser will drive model dependency resolution,
/// as opposed to the DMR client doing so.
/// </summary>
public async Task<List<string>> ExpandModel(string dtmi)
{
var dependentReferences = new Dictionary<string, string>();
IDictionary<string, string> rootGetModelsResult = await _repositoryClient.GetModelsAsync(dtmi, ModelDependencyResolution.Disabled);
dependentReferences.Add(dtmi, rootGetModelsResult[dtmi]);
var parser = new ModelParser
{
DtmiResolver = async (IReadOnlyCollection<Dtmi> dtmis) =>
{
IEnumerable<string> dtmiStrings = dtmis.Select(s => s.AbsoluteUri);
IDictionary<string, string> getModelsResult =
await _repositoryClient.GetModelsAsync(dtmiStrings, ModelDependencyResolution.Disabled);
foreach (KeyValuePair<string, string> model in getModelsResult)
{
if (!dependentReferences.ContainsKey(model.Key))
{
dependentReferences.Add(model.Key, model.Value);
}
}
return getModelsResult.Values.ToList();
}
};
await parser.ParseAsync(rootGetModelsResult.Values.ToList());
return ConvertToExpanded(dtmi, dependentReferences);
}
private List<string> ConvertToExpanded(string rootDtmi, IDictionary<string, string> models)
{
var result = new List<string>
{
models[rootDtmi]
};
models.Remove(rootDtmi);
result.AddRange(models.Values);
return result;
}
public ModelParser GetDtdlParser()
{
var parser = new ModelParser
{
DtmiResolver = _repositoryClient.ParserDtmiResolver
};
return parser;
}
// TODO: Convert to instance method.
public static bool IsRelativePath(string repositoryPath)
{
bool validUri = Uri.TryCreate(repositoryPath, UriKind.Relative, out Uri testUri);
return validUri && testUri != null;
}
public bool IsRemoteEndpoint()
{
bool validUri = Uri.TryCreate(_repoLocationUriStr, UriKind.Absolute, out Uri testUri);
return validUri && testUri != null && testUri.Scheme != "file";
}
public Uri RepoLocationUri
{
get { return _repoLocationUri; }
}
}
}
| 36.324324 | 143 | 0.603423 | [
"MIT"
] | Azure/iot-plugandplay-models-tools | clients/dotnet/Microsoft.IoT.ModelsRepository.CommandLine/src/RepoProvider.cs | 4,034 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace CocontroladorAPI.DTOs
{
public class TraComprasDTO
{
public int Idcompra { get; set; }
public decimal? PrecioTotal { get; set; }
public DateTime? FechaCompra { get; set; }
public bool Pagado { get; set; }
public int Idusuario { get; set; }
public virtual MtoCatUsuariosDTO IdusuarioNavigation { get; set; }
public virtual List<TraConceptoCompraDTO> TraConceptoCompra { get; set; }
}
}
| 28.15 | 81 | 0.671403 | [
"MIT"
] | CETI-2020A-8D1/Cocontrolador-Web-API | DTOs/TraComprasDTO.cs | 565 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息是通过以下项进行控制的
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("NewMusic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("NewMusic")]
[assembly: AssemblyCopyright("版权所有(C) Microsoft 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 将使此程序集中的类型
// 对 COM 组件不可见。如果需要
// 从 COM 访问此程序集中的某个类型,请针对该类型将 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID
[assembly: Guid("67251308-95cf-4979-9dfa-44d7181269d4")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 内部版本号
// 修订版本
//
// 你可以指定所有值,也可以让修订版本和内部版本号采用默认值,
// 方法是按如下所示使用 "*":
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 25.805556 | 56 | 0.727664 | [
"MIT"
] | 1305779886/homework42 | NewMusic/NewMusic/Properties/AssemblyInfo.cs | 1,301 | C# |
namespace Ange.Application.Room.Queries.GetRoomsList
{
using System;
using MediatR;
public class GetRoomListQuery : IRequest<RoomListViewModel>
{
public string Title { get; set; }
public Guid Resident { get; set; }
}
} | 23.181818 | 63 | 0.662745 | [
"MIT"
] | v4rden/Ange | Ange.Application/Room/Queries/GetRoomsList/GetRoomListQuery.cs | 255 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
using Amazon.Lambda.Core;
using Amazon.Lambda.TestUtilities;
using NorthwindLambda;
namespace NorthwindLambda.Tests
{
public class FunctionTest
{
[Fact]
public void TestToUpperFunction()
{
// Invoke the lambda function and confirm the string was upper cased.
var function = new Function();
var context = new TestLambdaContext();
var upperCase = function.FunctionHandlerAsync("hello world", context);
Assert.Equal("HELLO WORLD", upperCase);
}
}
}
| 22.931034 | 82 | 0.661654 | [
"MIT"
] | kejvi-doko/CleanArchitecture | NorthwindLambda.Tests/FunctionTest.cs | 665 | C# |
using UnityEngine;
public class WorldCursor : MonoBehaviour
{
private MeshRenderer meshRenderer;
// Use this for initialization
void Start()
{
// Grab the mesh renderer that's on the same object as this script.
meshRenderer = this.gameObject.GetComponentInChildren<MeshRenderer>();
}
// Update is called once per frame
void Update()
{
// Do a raycast into the world based on the user's
// head position and orientation.
var headPosition = Camera.main.transform.position;
var gazeDirection = Camera.main.transform.forward;
RaycastHit hitInfo;
if (Physics.Raycast(headPosition, gazeDirection, out hitInfo))
{
// If the raycast hit a hologram...
// Display the cursor mesh.
meshRenderer.enabled = true;
// Move the cursor to the point where the raycast hit.
this.transform.position = hitInfo.point;
// Rotate the cursor to hug the surface of the hologram.
this.transform.rotation = Quaternion.FromToRotation(Vector3.up, hitInfo.normal);
}
else
{
// If the raycast did not hit a hologram, hide the cursor mesh.
meshRenderer.enabled = false;
}
}
}
| 25.318182 | 83 | 0.720826 | [
"MIT"
] | kaiomagalhaes/hololens-academy-101 | Origami/Assets/Scripts/WorldCursor.cs | 1,116 | C# |
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System.Collections.Generic;
using UnityEditor.IMGUI.Controls;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Rendering;
namespace UnityEditor
{
[CustomEditor(typeof(SkinnedMeshRenderer))]
[CanEditMultipleObjects]
internal class SkinnedMeshRendererEditor : RendererEditorBase
{
class Styles
{
public static readonly GUIContent legacyClampBlendShapeWeightsInfo = EditorGUIUtility.TrTextContent("Note that BlendShape weight range is clamped. This can be disabled in Player Settings.");
public static readonly GUIContent meshNotSupportingSkinningInfo = EditorGUIUtility.TrTextContent("The assigned mesh doesn't support skinning. A valid setup requires bone weights with bind pose or blend shapes. If you do not need either of these, use a MeshRenderer instead.");
public static readonly GUIContent bounds = EditorGUIUtility.TrTextContent("Bounds");
public static readonly GUIContent quality = EditorGUIUtility.TrTextContent("Quality", "Number of bones to use per vertex during skinning.");
public static readonly GUIContent updateWhenOffscreen = EditorGUIUtility.TrTextContent("Update When Offscreen", "If an accurate bounding volume representation should be calculated every frame. ");
public static readonly GUIContent mesh = EditorGUIUtility.TrTextContent("Mesh");
public static readonly GUIContent rootBone = EditorGUIUtility.TrTextContent("Root Bone");
}
private SerializedProperty m_AABB;
private SerializedProperty m_DirtyAABB;
private SerializedProperty m_BlendShapeWeights;
private SerializedProperty m_Quality;
private SerializedProperty m_UpdateWhenOffscreen;
private SerializedProperty m_Mesh;
private SerializedProperty m_RootBone;
private BoxBoundsHandle m_BoundsHandle = new BoxBoundsHandle();
public override void OnEnable()
{
base.OnEnable();
m_AABB = serializedObject.FindProperty("m_AABB");
m_DirtyAABB = serializedObject.FindProperty("m_DirtyAABB");
m_BlendShapeWeights = serializedObject.FindProperty("m_BlendShapeWeights");
m_Quality = serializedObject.FindProperty("m_Quality");
m_UpdateWhenOffscreen = serializedObject.FindProperty("m_UpdateWhenOffscreen");
m_Mesh = serializedObject.FindProperty("m_Mesh");
m_RootBone = serializedObject.FindProperty("m_RootBone");
m_BoundsHandle.SetColor(Handles.s_BoundingBoxHandleColor);
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditMode.DoEditModeInspectorModeButton(
EditMode.SceneViewEditMode.Collider,
"Edit Bounds",
PrimitiveBoundsHandle.editModeButton,
this
);
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(m_AABB, Styles.bounds);
// If we set m_AABB then we need to set m_DirtyAABB to false
if (EditorGUI.EndChangeCheck())
m_DirtyAABB.boolValue = false;
OnBlendShapeUI();
EditorGUILayout.PropertyField(m_Quality, Styles.quality);
EditorGUILayout.PropertyField(m_UpdateWhenOffscreen, Styles.updateWhenOffscreen);
OnMeshUI();
EditorGUILayout.PropertyField(m_RootBone, Styles.rootBone);
DrawMaterials();
LightingSettingsGUI(false);
RayTracingSettingsGUI();
OtherSettingsGUI(false, true);
serializedObject.ApplyModifiedProperties();
}
internal override Bounds GetWorldBoundsOfTarget(Object targetObject)
{
return ((SkinnedMeshRenderer)targetObject).bounds;
}
public void OnMeshUI()
{
SkinnedMeshRenderer renderer = (SkinnedMeshRenderer)target;
EditorGUILayout.PropertyField(m_Mesh, Styles.mesh);
if (renderer.sharedMesh != null)
{
bool haveClothComponent = renderer.gameObject.GetComponent<Cloth>() != null;
if (!haveClothComponent && renderer.sharedMesh.blendShapeCount == 0 && (renderer.sharedMesh.boneWeights.Length == 0 || renderer.sharedMesh.bindposes.Length == 0))
{
EditorGUILayout.HelpBox(Styles.meshNotSupportingSkinningInfo.text, MessageType.Info);
}
}
}
public void OnBlendShapeUI()
{
SkinnedMeshRenderer renderer = (SkinnedMeshRenderer)target;
int blendShapeCount = renderer.sharedMesh == null ? 0 : renderer.sharedMesh.blendShapeCount;
if (blendShapeCount == 0)
return;
GUIContent content = new GUIContent();
content.text = "BlendShapes";
EditorGUILayout.PropertyField(m_BlendShapeWeights, content, false);
if (!m_BlendShapeWeights.isExpanded)
return;
EditorGUI.indentLevel++;
if (PlayerSettings.legacyClampBlendShapeWeights)
EditorGUILayout.HelpBox(Styles.legacyClampBlendShapeWeightsInfo.text, MessageType.Info);
Mesh m = renderer.sharedMesh;
int arraySize = m_BlendShapeWeights.arraySize;
for (int i = 0; i < blendShapeCount; i++)
{
content.text = m.GetBlendShapeName(i);
// Calculate the min and max values for the slider from the frame blendshape weights
float sliderMin = 0f, sliderMax = 0f;
int frameCount = m.GetBlendShapeFrameCount(i);
for (int j = 0; j < frameCount; j++)
{
float frameWeight = m.GetBlendShapeFrameWeight(i, j);
sliderMin = Mathf.Min(frameWeight, sliderMin);
sliderMax = Mathf.Max(frameWeight, sliderMax);
}
// The SkinnedMeshRenderer blendshape weights array size can be out of sync with the size defined in the mesh
// (default values in that case are 0)
// The desired behaviour is to resize the blendshape array on edit.
// Default path when the blend shape array size is big enough.
if (i < arraySize)
EditorGUILayout.Slider(m_BlendShapeWeights.GetArrayElementAtIndex(i), sliderMin, sliderMax, float.MinValue, float.MaxValue, content);
// Fall back to 0 based editing &
else
{
EditorGUI.BeginChangeCheck();
float value = EditorGUILayout.Slider(content, 0f, sliderMin, sliderMax, float.MinValue, float.MaxValue);
if (EditorGUI.EndChangeCheck())
{
m_BlendShapeWeights.arraySize = blendShapeCount;
arraySize = blendShapeCount;
m_BlendShapeWeights.GetArrayElementAtIndex(i).floatValue = value;
}
}
}
EditorGUI.indentLevel--;
}
public void OnSceneGUI()
{
if (!target)
return;
SkinnedMeshRenderer renderer = (SkinnedMeshRenderer)target;
if (renderer.updateWhenOffscreen)
{
Bounds bounds = renderer.bounds;
Vector3 center = bounds.center;
Vector3 size = bounds.size;
Handles.DrawWireCube(center, size);
}
else
{
using (new Handles.DrawingScope(renderer.actualRootBone.localToWorldMatrix))
{
Bounds bounds = renderer.localBounds;
m_BoundsHandle.center = bounds.center;
m_BoundsHandle.size = bounds.size;
// only display interactive handles if edit mode is active
m_BoundsHandle.handleColor = EditMode.editMode == EditMode.SceneViewEditMode.Collider && EditMode.IsOwner(this) ?
m_BoundsHandle.wireframeColor : Color.clear;
EditorGUI.BeginChangeCheck();
m_BoundsHandle.DrawHandle();
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(renderer, "Resize Bounds");
renderer.localBounds = new Bounds(m_BoundsHandle.center, m_BoundsHandle.size);
}
}
}
}
}
}
| 42.413462 | 288 | 0.61562 | [
"Unlicense"
] | HelloWindows/AccountBook | client/framework/UnityCsReference-master/Editor/Mono/Inspector/SkinnedMeshRendererEditor.cs | 8,822 | C# |
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Xyz.TForce.MiniCasher.Data.Migrations.Accounting;
namespace Xyz.TForce.MiniCasher.Data.Migrations.Accounting.npgsql
{
[DbContext(typeof(AccountingPostgreSqlDbContext))]
[Migration("00000000000001_Initialize")]
partial class Initialize
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ChangeDetector.SkipDetectChanges", "true")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
#pragma warning restore 612, 618
}
}
}
| 39.148148 | 108 | 0.746452 | [
"Apache-2.0"
] | tforcexyz/mini-casher | src/TfxMiniCasher.Data.Migrations/Accounting/npgsql/00000000000001_Initialize.Designer.cs | 1,057 | C# |
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MasteringEFCore.Performance.Starter.Models
{
public class Blog
{
public int Id { get; set; }
[Required(ErrorMessage = "Title is required")]
public string Title { get; set; }
[Required(ErrorMessage = "Subtitle is required")]
public string Subtitle { get; set; }
public string Description { get; set; }
[Required(ErrorMessage = "Url is required")]
[Url(ErrorMessage = "Provide a valid url")]
public string Url { get; set; }
public DateTime CreatedAt { get; set; }
//[ConcurrencyCheck]
public DateTime ModifiedAt { get; set; }
public int CreatedBy { get; set; }
public int ModifiedBy { get; set; }
public int? CategoryId { get; set; }
[JsonIgnore]
public ICollection<Post> Posts { get; set; }
//[Timestamp]
//public byte[] Timestamp { get; set; }
}
}
| 31.171429 | 57 | 0.623281 | [
"MIT"
] | PacktPublishing/Mastering-Entity-Framework-Core | Chapter 11/Starter/MasteringEFCore.Performance.Starter/Models/Blog.cs | 1,093 | C# |
namespace BackgroundService.NET.CronHostService;
public interface ICronHost
{
Task ExecuteAsync(CancellationToken cancellationToken);
} | 23.5 | 59 | 0.836879 | [
"MIT"
] | Ben757/BackgroundService.NET | BackgroundService.NET/CronHostService/ICronHost.cs | 143 | C# |
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
using NewRelic.Agent.Core.Attributes;
using NewRelic.Agent.Core.Segments;
using NewRelic.Agent.Core.Segments.Tests;
using NewRelic.Agent.Core.Wrapper.AgentWrapperApi.Data;
using NewRelic.Core;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using Telerik.JustMock;
namespace NewRelic.Agent.Core.Transactions
{
public class TestImmutableTransactionMetadata : IImmutableTransactionMetadata
{
public string Uri { get; }
public string OriginalUri { get; }
public string ReferrerUri { get; }
public TimeSpan? QueueTime { get; }
public int? HttpResponseStatusCode { get; }
public AttributeValueCollection UserAndRequestAttributes { get; }
public IEnumerable<string> CrossApplicationAlternatePathHashes { get; }
public string CrossApplicationReferrerTransactionGuid { get; }
public string CrossApplicationReferrerPathHash { get; }
public string CrossApplicationPathHash { get; }
public string CrossApplicationReferrerProcessId { get; }
public string CrossApplicationReferrerTripId { get; }
public float CrossApplicationResponseTimeInSeconds { get; }
public bool HasOutgoingTraceHeaders { get; }
public int? HttpResponseSubStatusCode { get; }
public string SyntheticsResourceId { get; }
public string SyntheticsJobId { get; }
public string SyntheticsMonitorId { get; }
public bool IsSynthetics { get; }
public bool HasCatResponseHeaders { get; }
public float Priority { get; }
public IReadOnlyTransactionErrorState ReadOnlyTransactionErrorState { get; }
public TestImmutableTransactionMetadata(
string uri,
string originalUri,
string referrerUri,
TimeSpan? queueTime,
AttributeValueCollection userAndRequestAttributes,
ITransactionErrorState transactionErrorState,
int? httpResponseStatusCode,
int? httpResponseSubStatusCode,
string crossApplicationReferrerPathHash,
string crossApplicationPathHash,
IEnumerable<string> crossApplicationPathHashes,
string crossApplicationReferrerTransactionGuid,
string crossApplicationReferrerProcessId,
string crossApplicationReferrerTripId,
float crossApplicationResponseTimeInSeconds,
bool hasOutgoingTraceHeaders,
string syntheticsResourceId,
string syntheticsJobId,
string syntheticsMonitorId,
bool isSynthetics,
bool hasCatResponseHeaders,
float priority)
{
Uri = uri;
OriginalUri = originalUri;
ReferrerUri = referrerUri;
QueueTime = queueTime;
UserAndRequestAttributes = userAndRequestAttributes;
ReadOnlyTransactionErrorState = transactionErrorState;
HttpResponseStatusCode = httpResponseStatusCode;
HttpResponseSubStatusCode = httpResponseSubStatusCode;
CrossApplicationReferrerPathHash = crossApplicationReferrerPathHash;
CrossApplicationPathHash = crossApplicationPathHash;
CrossApplicationAlternatePathHashes = crossApplicationPathHashes.ToList();
CrossApplicationReferrerTransactionGuid = crossApplicationReferrerTransactionGuid;
CrossApplicationReferrerProcessId = crossApplicationReferrerProcessId;
CrossApplicationReferrerTripId = crossApplicationReferrerTripId;
CrossApplicationResponseTimeInSeconds = crossApplicationResponseTimeInSeconds;
HasOutgoingTraceHeaders = hasOutgoingTraceHeaders;
SyntheticsResourceId = syntheticsResourceId;
SyntheticsJobId = syntheticsJobId;
SyntheticsMonitorId = syntheticsMonitorId;
IsSynthetics = isSynthetics;
HasCatResponseHeaders = hasCatResponseHeaders;
Priority = priority;
}
}
public class ImmutableTransactionBuilder
{
private ITransactionName _transactionName = TransactionName.ForWebTransaction("foo", "bar");
public ImmutableTransactionBuilder IsWebTransaction(string category, string name)
{
_transactionName = TransactionName.ForWebTransaction(category, name);
return this;
}
public ImmutableTransactionBuilder IsOtherTransaction(string category, string name)
{
_transactionName = TransactionName.ForOtherTransaction(category, name);
return this;
}
private float _priority = 0.5f;
public ImmutableTransactionBuilder WithPriority(float priority)
{
_priority = priority;
return this;
}
private string _distributedTraceGuid;
private string _distributedTraceTraceId;
private bool _distributedTraceSampled = false;
private bool _hasIncomingDistributedTracePayload;
public ImmutableTransactionBuilder WithDistributedTracing(string distributedTraceGuid, string distributedTraceTraceId, bool distributedTraceSampled, bool hasIncomingDistributedTracePayload)
{
_distributedTraceGuid = distributedTraceGuid;
_distributedTraceTraceId = distributedTraceTraceId;
_distributedTraceSampled = distributedTraceSampled;
_hasIncomingDistributedTracePayload = hasIncomingDistributedTracePayload;
return this;
}
private DistributedTracing.ITracingState _tracingState;
public ImmutableTransactionBuilder WithW3CTracing(string guid, string parentId, List<string> vendorStateEntries)
{
_tracingState = Mock.Create<DistributedTracing.ITracingState>();
Mock.Arrange(() => _tracingState.Guid).Returns(guid);
Mock.Arrange(() => _tracingState.ParentId).Returns(parentId);
Mock.Arrange(() => _tracingState.VendorStateEntries).Returns(vendorStateEntries);
Mock.Arrange(() => _tracingState.HasDataForParentAttributes).Returns(true);
Mock.Arrange(() => _tracingState.Timestamp).Returns(DateTime.UtcNow);
Mock.Arrange(() => _tracingState.TransportDuration).Returns(TimeSpan.FromMilliseconds(1));
Mock.Arrange(() => _tracingState.AccountId).Returns("accountId");
Mock.Arrange(() => _tracingState.AppId).Returns("appId");
Mock.Arrange(() => _tracingState.TransportType).Returns(Extensions.Providers.Wrapper.TransportType.Kafka);
return this;
}
private DateTime _startTime = new DateTime(2018, 7, 18, 7, 0, 0, DateTimeKind.Utc); // unixtime = 1531897200000
public ImmutableTransactionBuilder WithStartTime(DateTime startTime)
{
_startTime = startTime;
return this;
}
private string _transactionGuid = GuidGenerator.GenerateNewRelicGuid();
public ImmutableTransactionBuilder WithTransactionGuid(string transactionGuid)
{
_transactionGuid = transactionGuid;
return this;
}
//Transactions should always have a root segment
private List<Segment> _segments = new List<Segment>() { SimpleSegmentDataTests.createSimpleSegmentBuilder(TimeSpan.Zero, TimeSpan.Zero, 0, null, new MethodCallData("typeName", "methodName", 1), Enumerable.Empty<KeyValuePair<string, object>>(), "MyMockedRootNode", false) };
public ImmutableTransactionBuilder WithSegments(List<Segment> segments)
{
_segments = segments;
return this;
}
public ImmutableTransactionBuilder WithExceptionFromSegment(Segment segmentWithError)
{
_transactionErrorState.AddExceptionData(segmentWithError.ErrorData);
_transactionErrorState.TrySetSpanIdForErrorData(segmentWithError.ErrorData, segmentWithError.SpanId);
return this;
}
private TimeSpan _duration = TimeSpan.FromSeconds(1);
public ImmutableTransactionBuilder WithDuration(TimeSpan duration)
{
_duration = duration;
return this;
}
private TimeSpan? _responseTime = null;
public ImmutableTransactionBuilder WithResponseTime(TimeSpan responseTime)
{
_responseTime = responseTime;
return this;
}
public ImmutableTransactionBuilder WithNoResponseTime()
{
_responseTime = null;
return this;
}
private string _crossApplicationReferrerPathHash;
private string _crossApplicationPathHash;
private List<string> _crossApplicationPathHashes = new List<string>();
private string _crossApplicationReferrerTransactionGuid;
private string _crossApplicationReferrerProcessId;
private string _crossApplicationReferrerTripId;
private float _crossApplicationResponseTimeInSeconds;
public ImmutableTransactionBuilder WithCrossApplicationData(string crossApplicationReferrerPathHash = "crossApplicationReferrerPathHash", string crossApplicationPathHash = "crossApplicationPathHash", List<string> crossApplicationPathHashes = null, string crossApplicationReferrerTransactionGuid = "crossApplicationReferrerTransactionGuid", string crossApplicationReferrerProcessId = "crossApplicationReferrerProcessId", string crossApplicationReferrerTripId = "crossApplicationReferrerTripId", float crossApplicationResponseTimeInSeconds = 0)
{
_crossApplicationReferrerPathHash = crossApplicationReferrerPathHash;
_crossApplicationPathHash = crossApplicationPathHash;
_crossApplicationPathHashes = crossApplicationPathHashes ?? new List<string>();
_crossApplicationReferrerTransactionGuid = crossApplicationReferrerTransactionGuid;
_crossApplicationReferrerProcessId = crossApplicationReferrerProcessId;
_crossApplicationReferrerTripId = crossApplicationReferrerTripId;
_crossApplicationResponseTimeInSeconds = crossApplicationResponseTimeInSeconds;
return this;
}
private ITransactionErrorState _transactionErrorState = new TransactionErrorState();
public ImmutableTransaction Build()
{
var metadata = new TestImmutableTransactionMetadata(
uri: "uri",
originalUri: "originalUri",
referrerUri: "referrerUri",
queueTime: new TimeSpan(1),
userAndRequestAttributes: new AttributeValueCollection(AttributeValueCollection.AllTargetModelTypes),
transactionErrorState: _transactionErrorState,
httpResponseStatusCode: 200,
httpResponseSubStatusCode: 201,
crossApplicationReferrerPathHash: _crossApplicationReferrerPathHash,
crossApplicationPathHash: _crossApplicationPathHash,
crossApplicationPathHashes: new List<string>(),
crossApplicationReferrerTransactionGuid: _crossApplicationReferrerTransactionGuid,
crossApplicationReferrerProcessId: _crossApplicationReferrerProcessId,
crossApplicationReferrerTripId: _crossApplicationReferrerTripId,
crossApplicationResponseTimeInSeconds: _crossApplicationResponseTimeInSeconds,
hasOutgoingTraceHeaders: false,
syntheticsResourceId: "syntheticsResourceId",
syntheticsJobId: "syntheticsJobId",
syntheticsMonitorId: "syntheticsMonitorId",
isSynthetics: false,
hasCatResponseHeaders: false,
priority: _priority);;
var attribDefSvc = new AttributeDefinitionService((f) => new AttributeDefinitions(f));
return new ImmutableTransaction(_transactionName, _segments, metadata, _startTime, _duration, _responseTime, _transactionGuid, true, true, false, 0.5f, _distributedTraceSampled, _distributedTraceTraceId, _tracingState, attribDefSvc.AttributeDefs);
}
}
}
| 45.191176 | 550 | 0.70135 | [
"Apache-2.0"
] | JoshuaColeman/newrelic-dotnet-agent | tests/Agent/UnitTests/Core.UnitTest/Transactions/ImmutableTransactionBuilder.cs | 12,292 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineBookStore
{
public partial class MainWindow : Form
{
public static ShoppingCart cart = new ShoppingCart(LoginedUser.getInstance().Customer.CustomerID,
0, "", ShoppingCart.ItemsToPurchase);
/// <summary>
/// This function is constructor.
/// </summary>
public MainWindow()
{
InitializeComponent();
timerTime.Start();
timerWelcomeString.Start();
}
/// <summary>
/// This function starts to work when this form is created on runtime.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MainWindow_Load(object sender, EventArgs e)
{
try
{
lblWelcome.Text = Util.WelcomeLabel();
btnDashboard.BackColor = Color.Teal;
pnlContainer.Controls.Add(Util.FillDashboardScreen());
pnlContainer.Controls.Add(Util.FillUC_BooksList(Util.FillBooksList()));
pnlContainer.Controls.Add(Util.FillUC_MusicCDList(Util.FillMusicCDList()));
pnlContainer.Controls.Add(Util.FillUC_MagazineList(Util.FillMagazineList()));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
/// <summary>
/// This function works every second.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timerTime_Tick(object sender, EventArgs e)
{
if (UC_ShoppingItem.CancelControl == true)
{
btnMyCart_Click(sender, e);
UC_ShoppingItem.CancelControl = false;
}
if (UC_ShoppingItem.TotalPaymentControl == true)
{
btnMyCart_Click(sender, e);
UC_ShoppingItem.TotalPaymentControl = false;
}
DateTime date = DateTime.Now;
lblTime.Text = DateTime.Now.ToLongTimeString();
lblDate.Text = date.ToString("dd/MM/yyyy");
}
/// <summary>
/// This function works every 250 ms and welcome label scrolling.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timerWelcomeString_Tick(object sender, EventArgs e)
{
lblWelcome.Text = lblWelcome.Text.Substring(1) + lblWelcome.Text.Substring(0, 1);
}
/// <summary>
/// This functions close this form and creates Loginform and runs.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnLogOut_Click(object sender, EventArgs e)
{
Logger.log("Click to Log Out button");
MainWindow.cart.cancelOrder();
this.Hide();
LoginForm tempLoginForm = new LoginForm();
tempLoginForm.Show();
}
/// <summary>
/// This function brings user control dashboard to front.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void btnDashboard_Click(object sender, EventArgs e)
{
Logger.log("Click to Dashboard button");
btnDashboard.BackColor = Color.Teal;
btnBooks.BackColor = Color.LightBlue;
btnMusicCDs.BackColor = Color.LightBlue;
btnMagazine.BackColor = Color.LightBlue;
btnMyOrders.BackColor = Color.LightBlue;
btnMyCart.BackColor = Color.LightBlue;
btnSetting.BackColor = Color.LightBlue;
pnlSelectedButton.Visible = true;
pnlSelectedButton.Location = new Point(0, 0);
if (pnlContainer.Controls["UC_Dashboard"] == null)
{
UC_Dashboard ucD = new UC_Dashboard();
ucD.Dock = DockStyle.Fill;
pnlContainer.Controls.Add(ucD);
}
pnlContainer.Controls["UC_Dashboard"].BringToFront();
}
/// <summary>
/// This function brings user control books to front.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnBooks_Click(object sender, EventArgs e)
{
Logger.log("Click to Books button");
btnDashboard.BackColor = Color.LightBlue;
btnBooks.BackColor = Color.Teal;
btnMusicCDs.BackColor = Color.LightBlue;
btnMagazine.BackColor = Color.LightBlue;
btnMyOrders.BackColor = Color.LightBlue;
btnMyCart.BackColor = Color.LightBlue;
btnSetting.BackColor = Color.LightBlue;
pnlSelectedButton.Visible = true;
pnlSelectedButton.Location = new Point(0, 60);
pnlContainer.Controls["UC_Books"].BringToFront();
}
/// <summary>
/// This function brings user control musicCDs to front.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnMusicCDs_Click(object sender, EventArgs e)
{
Logger.log("Click to MusicCDs button");
btnDashboard.BackColor = Color.LightBlue;
btnBooks.BackColor = Color.LightBlue;
btnMusicCDs.BackColor = Color.Teal;
btnMagazine.BackColor = Color.LightBlue;
btnMyOrders.BackColor = Color.LightBlue;
btnMyCart.BackColor = Color.LightBlue;
pnlSelectedButton.Visible = true;
pnlSelectedButton.Location = new Point(0, 120);
if (pnlContainer.Controls["UC_MusicCDs"] == null)
{
UC_MusicCDs ucCD = new UC_MusicCDs();
ucCD.Dock = DockStyle.Fill;
pnlContainer.Controls.Add(ucCD);
}
pnlContainer.Controls["UC_MusicCDs"].BringToFront();
}
/// <summary>
/// This function brings user control magazines to front.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnMagazine_Click(object sender, EventArgs e)
{
Logger.log("Click to Magazine button");
btnDashboard.BackColor = Color.LightBlue;
btnBooks.BackColor = Color.LightBlue;
btnMusicCDs.BackColor = Color.LightBlue;
btnMagazine.BackColor = Color.Teal;
btnMyOrders.BackColor = Color.LightBlue;
btnMyCart.BackColor = Color.LightBlue;
btnSetting.BackColor = Color.LightBlue;
pnlSelectedButton.Visible = true;
pnlSelectedButton.Location = new Point(0, 180);
if (pnlContainer.Controls["UC_Magazines"] == null)
{
UC_Magazines ucM = new UC_Magazines();
ucM.Dock = DockStyle.Fill;
pnlContainer.Controls.Add(ucM);
}
pnlContainer.Controls["UC_Magazines"].BringToFront();
}
/// <summary>
/// This function exit from the application.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
Logger.log("Click to Main Window Exit Button.");
}
/// <summary>
/// This function brings user control settings to front.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSettings_Click(object sender, EventArgs e)
{
Logger.log("Click to Settings Button.");
btnDashboard.BackColor = Color.LightBlue;
btnBooks.BackColor = Color.LightBlue;
btnMusicCDs.BackColor = Color.LightBlue;
btnMagazine.BackColor = Color.LightBlue;
btnMyOrders.BackColor = Color.LightBlue;
btnMyCart.BackColor = Color.LightBlue;
btnSetting.BackColor = Color.Teal;
pnlSelectedButton.Visible = true;
pnlSelectedButton.Location = new Point(0, 360);
if (LoginedUser.getInstance().Customer.Username == "admin")
{
if (pnlContainer.Controls["UC_AdminControl"] == null)
{
UC_AdminControl ucAC = new UC_AdminControl();
ucAC.Dock = DockStyle.Fill;
pnlContainer.Controls.Add(ucAC);
}
pnlContainer.Controls["UC_AdminControl"].BringToFront();
}
else
{
if (pnlContainer.Controls["UC_CustomerSettings"] == null)
{
UC_CustomerSettings ucCS = new UC_CustomerSettings();
ucCS.Dock = DockStyle.Fill;
pnlContainer.Controls.Add(ucCS);
}
pnlContainer.Controls["UC_CustomerSettings"].BringToFront();
}
}
/// <summary>
/// This function brings user control my orders to front.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnMyOrders_Click(object sender, EventArgs e)
{
Logger.log("Click to My Orders Button.");
btnDashboard.BackColor = Color.LightBlue;
btnBooks.BackColor = Color.LightBlue;
btnMusicCDs.BackColor = Color.LightBlue;
btnMagazine.BackColor = Color.LightBlue;
btnMyOrders.BackColor = Color.Teal;
btnMyCart.BackColor = Color.LightBlue;
btnSetting.BackColor = Color.LightBlue;
pnlSelectedButton.Visible = true;
pnlSelectedButton.Location = new Point(0, 240);
if (pnlContainer.Controls["UC_MyOrders"] == null)
{
UC_MyOrders ucM = new UC_MyOrders();
ucM.Dock = DockStyle.Fill;
pnlContainer.Controls.Add(ucM);
}
pnlContainer.Controls["UC_MyOrders"].BringToFront();
}
/// <summary>
/// This function brings user control my cart to front.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnMyCart_Click(object sender, EventArgs e)
{
Logger.log("Click to My Cart Button.");
btnDashboard.BackColor = Color.LightBlue;
btnBooks.BackColor = Color.LightBlue;
btnMusicCDs.BackColor = Color.LightBlue;
btnMagazine.BackColor = Color.LightBlue;
btnMyOrders.BackColor = Color.LightBlue;
btnMyCart.BackColor = Color.Teal;
btnSetting.BackColor = Color.LightBlue;
pnlSelectedButton.Visible = true;
pnlSelectedButton.Location = new Point(0, 300);
if (pnlContainer.Controls["UC_ShoppingList"] == null)
{
pnlContainer.Controls.Add(Util.FillShoppingListScreen());
}
else
{
pnlContainer.Controls.RemoveByKey("UC_ShoppingList");
pnlContainer.Controls.Add(Util.FillShoppingListScreen());
}
pnlContainer.Controls["UC_ShoppingList"].BringToFront();
}
}
}
| 40.769231 | 105 | 0.560635 | [
"MIT"
] | ardasdasdas/OnlineBookStore | OnlineBookStore/OnlineBookStore/MainWindow.cs | 11,662 | C# |
#region License Header
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Modifications Copyright 2018 Quantler B.V.
*
*/
#endregion License Header
using Quantler.Data.Bars;
using System;
namespace Quantler.Indicators.CandlestickPatterns
{
/// <summary>
/// Separating Lines candlestick pattern indicator
/// </summary>
/// <remarks>
/// Must have:
/// - first candle: black (white) candle
/// - second candle: bullish(bearish) belt hold with the same open as the prior candle
/// The meaning of "long body" and "very short shadow" of the belt hold is specified with SetCandleSettings
/// The returned value is positive(+1) when bullish or negative(-1) when bearish;
/// The user should consider that separating lines is significant when coming in a trend and the belt hold has
/// the same direction of the trend, while this function does not consider it
/// </remarks>
public class SeparatingLines : CandlestickPattern
{
#region Private Fields
private readonly int _bodyLongAveragePeriod;
private readonly int _equalAveragePeriod;
private readonly int _shadowVeryShortAveragePeriod;
private decimal _bodyLongPeriodTotal;
private decimal _equalPeriodTotal;
private decimal _shadowVeryShortPeriodTotal;
#endregion Private Fields
#region Public Constructors
/// <summary>
/// Initializes a new instance of the <see cref="SeparatingLines"/> class using the specified name.
/// </summary>
/// <param name="name">The name of this indicator</param>
public SeparatingLines(string name)
: base(name, Math.Max(Math.Max(CandleSettings.Get(CandleSettingType.ShadowVeryShort).AveragePeriod, CandleSettings.Get(CandleSettingType.BodyLong).AveragePeriod),
CandleSettings.Get(CandleSettingType.Equal).AveragePeriod) + 1 + 1)
{
_shadowVeryShortAveragePeriod = CandleSettings.Get(CandleSettingType.ShadowVeryShort).AveragePeriod;
_bodyLongAveragePeriod = CandleSettings.Get(CandleSettingType.BodyLong).AveragePeriod;
_equalAveragePeriod = CandleSettings.Get(CandleSettingType.Equal).AveragePeriod;
}
/// <summary>
/// Initializes a new instance of the <see cref="SeparatingLines"/> class.
/// </summary>
public SeparatingLines()
: this("SEPARATINGLINES")
{
}
#endregion Public Constructors
#region Public Properties
/// <summary>
/// Gets a flag indicating when this indicator is ready and fully initialized
/// </summary>
public override bool IsReady =>
Samples >= Period;
#endregion Public Properties
#region Public Methods
/// <summary>
/// Resets this indicator to its initial state
/// </summary>
public override void Reset()
{
_shadowVeryShortPeriodTotal = 0m;
_bodyLongPeriodTotal = 0m;
_equalPeriodTotal = 0m;
base.Reset();
}
#endregion Public Methods
#region Protected Methods
/// <summary>
/// Computes the next value of this indicator from the given state
/// </summary>
/// <param name="window">The window of data held in this indicator</param>
/// <param name="input">The input given to the indicator</param>
/// <returns>A new value for this indicator</returns>
protected override decimal ComputeNextValue(IReadOnlyWindow<DataPointBar> window, DataPointBar input)
{
if (!IsReady)
{
if (Samples >= Period - _shadowVeryShortAveragePeriod)
{
_shadowVeryShortPeriodTotal += GetCandleRange(CandleSettingType.ShadowVeryShort, input);
}
if (Samples >= Period - _bodyLongAveragePeriod)
{
_bodyLongPeriodTotal += GetCandleRange(CandleSettingType.BodyLong, input);
}
if (Samples >= Period - _equalAveragePeriod)
{
_equalPeriodTotal += GetCandleRange(CandleSettingType.Equal, window[1]);
}
return 0m;
}
decimal value;
if (
// opposite candles
(int)GetCandleColor(window[1]) == -(int)GetCandleColor(input) &&
// same open
input.Open <= window[1].Open + GetCandleAverage(CandleSettingType.Equal, _equalPeriodTotal, window[1]) &&
input.Open >= window[1].Open - GetCandleAverage(CandleSettingType.Equal, _equalPeriodTotal, window[1]) &&
// belt hold: long body
GetRealBody(input) > GetCandleAverage(CandleSettingType.BodyLong, _bodyLongPeriodTotal, input) &&
(
// with no lower shadow if bullish
(GetCandleColor(input) == CandleColor.White &&
GetLowerShadow(input) < GetCandleAverage(CandleSettingType.ShadowVeryShort, _shadowVeryShortPeriodTotal, input)
)
||
// with no upper shadow if bearish
(GetCandleColor(input) == CandleColor.Black &&
GetUpperShadow(input) < GetCandleAverage(CandleSettingType.ShadowVeryShort, _shadowVeryShortPeriodTotal, input)
)
)
)
value = (int)GetCandleColor(input);
else
value = 0m;
// add the current range and subtract the first range: this is done after the pattern recognition
// when avgPeriod is not 0, that means "compare with the previous candles" (it excludes the current candle)
_shadowVeryShortPeriodTotal += GetCandleRange(CandleSettingType.ShadowVeryShort, input) -
GetCandleRange(CandleSettingType.ShadowVeryShort, window[_shadowVeryShortAveragePeriod]);
_bodyLongPeriodTotal += GetCandleRange(CandleSettingType.BodyLong, input) -
GetCandleRange(CandleSettingType.BodyLong, window[_bodyLongAveragePeriod]);
_equalPeriodTotal += GetCandleRange(CandleSettingType.Equal, window[1]) -
GetCandleRange(CandleSettingType.Equal, window[_equalAveragePeriod + 1]);
return value;
}
#endregion Protected Methods
}
} | 41.222857 | 174 | 0.629332 | [
"Apache-2.0"
] | Quantler/Core | Quantler.Indicators/CandlestickPatterns/SeparatingLines.cs | 7,216 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNative.Network.V20190401.Inputs
{
/// <summary>
/// Properties of the network rule.
/// </summary>
public sealed class AzureFirewallNetworkRuleArgs : Pulumi.ResourceArgs
{
/// <summary>
/// Description of the rule.
/// </summary>
[Input("description")]
public Input<string>? Description { get; set; }
[Input("destinationAddresses")]
private InputList<string>? _destinationAddresses;
/// <summary>
/// List of destination IP addresses.
/// </summary>
public InputList<string> DestinationAddresses
{
get => _destinationAddresses ?? (_destinationAddresses = new InputList<string>());
set => _destinationAddresses = value;
}
[Input("destinationPorts")]
private InputList<string>? _destinationPorts;
/// <summary>
/// List of destination ports.
/// </summary>
public InputList<string> DestinationPorts
{
get => _destinationPorts ?? (_destinationPorts = new InputList<string>());
set => _destinationPorts = value;
}
/// <summary>
/// Name of the network rule.
/// </summary>
[Input("name")]
public Input<string>? Name { get; set; }
[Input("protocols")]
private InputList<Union<string, Pulumi.AzureNative.Network.V20190401.AzureFirewallNetworkRuleProtocol>>? _protocols;
/// <summary>
/// Array of AzureFirewallNetworkRuleProtocols.
/// </summary>
public InputList<Union<string, Pulumi.AzureNative.Network.V20190401.AzureFirewallNetworkRuleProtocol>> Protocols
{
get => _protocols ?? (_protocols = new InputList<Union<string, Pulumi.AzureNative.Network.V20190401.AzureFirewallNetworkRuleProtocol>>());
set => _protocols = value;
}
[Input("sourceAddresses")]
private InputList<string>? _sourceAddresses;
/// <summary>
/// List of source IP addresses for this rule.
/// </summary>
public InputList<string> SourceAddresses
{
get => _sourceAddresses ?? (_sourceAddresses = new InputList<string>());
set => _sourceAddresses = value;
}
public AzureFirewallNetworkRuleArgs()
{
}
}
}
| 32.301205 | 150 | 0.610966 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/dotnet/Network/V20190401/Inputs/AzureFirewallNetworkRuleArgs.cs | 2,681 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Cuadrantes.Controllers
{
[Route("api/[controller]")]
public class SeguridadController : Controller
{
[HttpPost]
public string IniciarSesion(string usuario, string clave)
{
return string.Empty;
}
[HttpPost]
public string Registro(string cedula, DateTime fechaExpedicion,
string telefono, string correo)
{
return string.Empty;
}
}
} | 24.458333 | 71 | 0.638842 | [
"MIT"
] | adejo2220/WorkshopToolsForAPI | Workshop/Cuadrantes/Cuadrantes/Controllers/SeguridadController.cs | 589 | C# |
using System;
using BencodeNET.Exceptions;
using BencodeNET.IO;
using BencodeNET.Objects;
using BencodeNET.Parsing;
using FluentAssertions;
using NSubstitute;
using NSubstitute.ExceptionExtensions;
using Xunit;
namespace BencodeNET.Tests.Parsing
{
public partial class BDictionaryParserTests
{
[Theory]
[InlineAutoMockedData("d4:spam3:egge")]
public void CanParseSimple(string bencode, IBencodeParser bparser)
{
// Arange
var key = new BString("key");
var value = new BString("value");
bparser.Parse<BString>(Arg.Any<BencodeReader>())
.Returns(key);
bparser.Parse(Arg.Any<BencodeReader>())
.Returns(value)
.AndSkipsAhead(bencode.Length - 2);
// Act
var parser = new BDictionaryParser(bparser);
var bdictionary = parser.ParseString(bencode);
// Assert
bdictionary.Count.Should().Be(1);
bdictionary.Should().ContainKey(key);
bdictionary[key].Should().BeSameAs(value);
}
[Theory]
[InlineAutoMockedData("de")]
public void CanParseEmptyDictionary(string bencode, IBencodeParser bparser)
{
var parser = new BDictionaryParser(bparser);
var bdictionary = parser.ParseString(bencode);
bdictionary.Count.Should().Be(0);
}
[Theory]
[InlineAutoMockedData("")]
[InlineAutoMockedData("d")]
public void BelowMinimumLength2_ThrowsInvalidBencodeException(string bencode, IBencodeParser bparser)
{
var parser = new BDictionaryParser(bparser);
Action action = () => parser.ParseString(bencode);
action.Should().Throw<InvalidBencodeException<BDictionary>>().WithMessage("*Invalid length*");
}
[Theory]
[InlineAutoMockedData("")]
[InlineAutoMockedData("d")]
public void BelowMinimumLength2_WhenStreamLengthNotSupported_ThrowsInvalidBencodeException(string bencode, IBencodeParser bparser)
{
var stream = new LengthNotSupportedStream(bencode);
var parser = new BDictionaryParser(bparser);
Action action = () => parser.Parse(stream);
action.Should().Throw<InvalidBencodeException<BDictionary>>();
}
[Theory]
[InlineAutoMockedData("ade")]
[InlineAutoMockedData(":de")]
[InlineAutoMockedData("-de")]
[InlineAutoMockedData("1de")]
public void InvalidFirstChar_ThrowsInvalidBencodeException(string bencode, IBencodeParser bparser)
{
var parser = new BDictionaryParser(bparser);
Action action = () => parser.ParseString(bencode);
action.Should().Throw<InvalidBencodeException<BDictionary>>().WithMessage("*Unexpected character*");
}
[Theory]
[InlineAutoMockedData("da")]
[InlineAutoMockedData("d4:spam3:egg")]
[InlineAutoMockedData("d ")]
public void MissingEndChar_ThrowsInvalidBencodeException(string bencode, IBencodeParser bparser, BString someKey, IBObject someValue)
{
// Arrange
bparser.Parse<BString>(Arg.Any<BencodeReader>())
.Returns(someKey);
bparser.Parse(Arg.Any<BencodeReader>())
.Returns(someValue)
.AndSkipsAhead(bencode.Length - 1);
// Act
var parser = new BDictionaryParser(bparser);
Action action = () => parser.ParseString(bencode);
// Assert
action.Should().Throw<InvalidBencodeException<BDictionary>>().WithMessage("*Missing end character of object*");
}
[Theory]
[InlineAutoMockedData]
public void InvalidKey_ThrowsInvalidBencodeException(IBencodeParser bparser)
{
bparser.Parse<BString>(Arg.Any<BencodeReader>()).Throws<BencodeException>();
var parser = new BDictionaryParser(bparser);
Action action = () => parser.ParseString("di42ee");
action.Should().Throw<InvalidBencodeException<BDictionary>>().WithMessage("*Could not parse dictionary key*");
}
[Theory]
[InlineAutoMockedData]
public void InvalidValue_ThrowsInvalidBencodeException(IBencodeParser bparser, BString someKey)
{
bparser.Parse<BString>(Arg.Any<BencodeReader>()).Returns(someKey);
bparser.Parse(Arg.Any<BencodeReader>()).Throws<BencodeException>();
var parser = new BDictionaryParser(bparser);
Action action = () => parser.ParseString("di42ee");
action.Should().Throw<InvalidBencodeException<BDictionary>>().WithMessage("*Could not parse dictionary value*");
}
[Theory]
[InlineAutoMockedData]
public void DuplicateKey_ThrowsInvalidBencodeException(IBencodeParser bparser, BString someKey, BString someValue)
{
bparser.Parse<BString>(Arg.Any<BencodeReader>()).Returns(someKey, someKey);
bparser.Parse(Arg.Any<BencodeReader>()).Returns(someValue);
var parser = new BDictionaryParser(bparser);
Action action = () => parser.ParseString("di42ee");
action.Should().Throw<InvalidBencodeException<BDictionary>>().WithMessage("*The dictionary already contains the key*");
}
}
}
| 36.099338 | 141 | 0.628875 | [
"Unlicense"
] | djon2003/BencodeNET | BencodeNET.Tests/Parsing/BDictionaryParserTests.cs | 5,453 | C# |
namespace PSCredentialManager.Common.Enum
{
public enum CredType : uint
{
Generic = 1,
DomainPassword = 2,
DomainCertificate = 3,
DomainVisiblePassword = 4,
GenericCertificate = 5,
DomainExtended = 6,
Maximum = 7, // Maximum supported cred type
MaximumEx = (Maximum + 1000), // Allow new applications to run on old OSes
}
}
| 27.133333 | 83 | 0.597052 | [
"MIT"
] | davotronic5000/PowerShell_Credential_Manager | PSCredentialManager.Object/Enum/Cred-Type.cs | 409 | C# |
namespace _03.Card_Power
{
public enum Suit
{
Clubs,
Diamonds = 13,
Hearts = 26,
Spades = 39
}
} | 14.4 | 25 | 0.465278 | [
"MIT"
] | zrusev/SoftUni_2016 | 06. C# OOP Advanced - July 2017/04. Enums And Attributes/04. Enums And Attributes - Exercise/Exercises Enums and Attributes/03. Card Power/Suit.cs | 146 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter {
using System;
using System.Reflection;
/// <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", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resource {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resource() {
}
/// <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 (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Resources.Resource", typeof(Resource).GetTypeInfo().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;
}
}
/// <summary>
/// Looks up a localized string similar to MSTestAdapterV2.
/// </summary>
internal static string AttachmentSetDisplayName {
get {
return ResourceManager.GetString("AttachmentSetDisplayName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exception occurred while enumerating DataSourceAttribute on "{0}.{1}": {2}.
/// </summary>
internal static string CannotEnumerateDataSourceAttribute {
get {
return ResourceManager.GetString("CannotEnumerateDataSourceAttribute", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A test method can only contain one DataSourceAttribute, but found {2} on "{0}.{1}"..
/// </summary>
internal static string CannotEnumerateDataSourceAttribute_MoreThenOneDefined {
get {
return ResourceManager.GetString("CannotEnumerateDataSourceAttribute_MoreThenOneDefined", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exception occurred while enumerating IDataSource attribute on "{0}.{1}": {2}.
/// </summary>
internal static string CannotEnumerateIDataSourceAttribute {
get {
return ResourceManager.GetString("CannotEnumerateIDataSourceAttribute", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exception occurred while expanding IDataSource rows from attribute on "{0}.{1}": {2}.
/// </summary>
internal static string CannotExpandIDataSourceAttribute {
get {
return ResourceManager.GetString("CannotExpandIDataSourceAttribute", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Data on index {0} for "{1}" cannot be serialized. All data provided through "IDataSource" should be serializable. If you need to test non-serializable data sources, please make sure you add "TestDataSourceDiscovery" attribute on your test assembly and set the discovery option to "DuringExecution"..
/// </summary>
internal static string CannotExpandIDataSourceAttribute_CannotSerialize {
get {
return ResourceManager.GetString("CannotExpandIDataSourceAttribute_CannotSerialize", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Display name "{2}" on indexes {0} and {1} are duplicate. Display names should be unique..
/// </summary>
internal static string CannotExpandIDataSourceAttribute_DuplicateDisplayName {
get {
return ResourceManager.GetString("CannotExpandIDataSourceAttribute_DuplicateDisplayName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The parameter should not be null or empty..
/// </summary>
internal static string Common_CannotBeNullOrEmpty {
get {
return ResourceManager.GetString("Common_CannotBeNullOrEmpty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The parameter must be greater than zero..
/// </summary>
internal static string Common_MustBeGreaterThanZero {
get {
return ResourceManager.GetString("Common_MustBeGreaterThanZero", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to MSTestAdapter failed to discover tests in class '{0}' of assembly '{1}' because {2}..
/// </summary>
internal static string CouldNotInspectTypeDuringDiscovery {
get {
return ResourceManager.GetString("CouldNotInspectTypeDuringDiscovery", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to MSTestAdapter failed to discover tests in class '{0}' of assembly '{1}'. Reason {2}..
/// </summary>
internal static string CouldNotInspectTypeDuringDiscovery1 {
get {
return ResourceManager.GetString("CouldNotInspectTypeDuringDiscovery1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} (Data Row {1}).
/// </summary>
internal static string DataDrivenResultDisplayName {
get {
return ResourceManager.GetString("DataDrivenResultDisplayName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Debug Trace:.
/// </summary>
internal static string DebugTraceBanner {
get {
return ResourceManager.GetString("DebugTraceBanner", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to [MSTest][Discovery][{0}] {1}.
/// </summary>
internal static string DiscoveryWarning {
get {
return ResourceManager.GetString("DiscoveryWarning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}: {1}.
/// </summary>
internal static string EnumeratorLoadTypeErrorFormat {
get {
return ResourceManager.GetString("EnumeratorLoadTypeErrorFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to "{0}": (Failed to get exception description due to an exception of type "{1}"..
/// </summary>
internal static string ExceptionOccuredWhileGettingTheExceptionDescription {
get {
return ResourceManager.GetString("ExceptionOccuredWhileGettingTheExceptionDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exceptions thrown:.
/// </summary>
internal static string ExceptionsThrown {
get {
return ResourceManager.GetString("ExceptionsThrown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Test '{0}' execution has been aborted..
/// </summary>
internal static string Execution_Test_Cancelled {
get {
return ResourceManager.GetString("Execution_Test_Cancelled", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Test '{0}' exceeded execution timeout period..
/// </summary>
internal static string Execution_Test_Timeout {
get {
return ResourceManager.GetString("Execution_Test_Timeout", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to get attribute cache. Ignoring attribute inheritance and falling into 'type defines Attribute model', so that we have some data..
/// </summary>
internal static string FailedFetchAttributeCache {
get {
return ResourceManager.GetString("FailedFetchAttributeCache", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Getting custom attributes for type {0} threw exception (will ignore and use the reflection way): {1}.
/// </summary>
internal static string FailedToGetCustomAttribute {
get {
return ResourceManager.GetString("FailedToGetCustomAttribute", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid value '{0}' specified for 'ClassCleanupLifecycle'. Supported scopes are {1}..
/// </summary>
internal static string InvalidClassCleanupLifecycleValue {
get {
return ResourceManager.GetString("InvalidClassCleanupLifecycleValue", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid value '{0}' specified for 'Scope'. Supported scopes are {1}..
/// </summary>
internal static string InvalidParallelScopeValue {
get {
return ResourceManager.GetString("InvalidParallelScopeValue", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid value '{0}' specified for 'Workers'. The value should be a non-negative integer..
/// </summary>
internal static string InvalidParallelWorkersValue {
get {
return ResourceManager.GetString("InvalidParallelWorkersValue", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid settings '{0}'. Unexpected XmlAttribute: '{1}'..
/// </summary>
internal static string InvalidSettingsXmlAttribute {
get {
return ResourceManager.GetString("InvalidSettingsXmlAttribute", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid settings '{0}'. Unexpected XmlElement: '{1}'..
/// </summary>
internal static string InvalidSettingsXmlElement {
get {
return ResourceManager.GetString("InvalidSettingsXmlElement", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter..
/// </summary>
internal static string LegacyScenariosNotSupportedWarning {
get {
return ResourceManager.GetString("LegacyScenariosNotSupportedWarning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An older version of MSTestV2 package is loaded in assembly, test discovery might fail to discover all data tests if they depend on `.runsettings` file..
/// </summary>
internal static string OlderTFMVersionFound {
get {
return ResourceManager.GetString("OlderTFMVersionFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An older version of MSTestV2 package is loaded in assembly, test cleanup methods might not run as expected. Please make sure all your test projects references MSTest packages newer then version 2.2.8..
/// </summary>
internal static string OlderTFMVersionFoundClassCleanup {
get {
return ResourceManager.GetString("OlderTFMVersionFoundClassCleanup", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Running tests in any of the provided sources is not supported for the selected platform.
/// </summary>
internal static string SourcesNotSupported {
get {
return ResourceManager.GetString("SourcesNotSupported", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to discover tests from assembly {0}. Reason:{1}.
/// </summary>
internal static string TestAssembly_AssemblyDiscoveryFailure {
get {
return ResourceManager.GetString("TestAssembly_AssemblyDiscoveryFailure", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to File does not exist: {0}.
/// </summary>
internal static string TestAssembly_FileDoesNotExist {
get {
return ResourceManager.GetString("TestAssembly_FileDoesNotExist", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to TestContext cannot be Null..
/// </summary>
internal static string TestContextIsNull {
get {
return ResourceManager.GetString("TestContextIsNull", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to TestContext Messages:.
/// </summary>
internal static string TestContextMessageBanner {
get {
return ResourceManager.GetString("TestContextMessageBanner", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Test method {0} was not found..
/// </summary>
internal static string TestNotFound {
get {
return ResourceManager.GetString("TestNotFound", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to MSTest Executor: Test Parallelization enabled for {0} (Workers: {1}, Scope: {2})..
/// </summary>
internal static string TestParallelizationBanner {
get {
return ResourceManager.GetString("TestParallelizationBanner", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unable to load types from the test source '{0}'. Some or all of the tests in this source may not be discovered.
///Error: {1}.
/// </summary>
internal static string TypeLoadFailed {
get {
return ResourceManager.GetString("TypeLoadFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Assembly Cleanup method {0}.{1} failed. Error Message: {2}. StackTrace: {3}.
/// </summary>
internal static string UTA_AssemblyCleanupMethodWasUnsuccesful {
get {
return ResourceManager.GetString("UTA_AssemblyCleanupMethodWasUnsuccesful", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Assembly Initialization method {0}.{1} threw exception. {2}: {3}. Aborting test execution..
/// </summary>
internal static string UTA_AssemblyInitMethodThrows {
get {
return ResourceManager.GetString("UTA_AssemblyInitMethodThrows", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Class Cleanup method {0}.{1} failed. Error Message: {2}. Stack Trace: {3}.
/// </summary>
internal static string UTA_ClassCleanupMethodWasUnsuccesful {
get {
return ResourceManager.GetString("UTA_ClassCleanupMethodWasUnsuccesful", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Class Initialization method {0}.{1} threw exception. {2}: {3}..
/// </summary>
internal static string UTA_ClassInitMethodThrows {
get {
return ResourceManager.GetString("UTA_ClassInitMethodThrows", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Method {0}.{1} has wrong signature. The method must be static, public, does not return a value and should not take any parameter. Additionally, if you are using async-await in method then return-type must be Task..
/// </summary>
internal static string UTA_ClassOrAssemblyCleanupMethodHasWrongSignature {
get {
return ResourceManager.GetString("UTA_ClassOrAssemblyCleanupMethodHasWrongSignature", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Method {0}.{1} has wrong signature. The method must be static, public, does not return a value and should take a single parameter of type TestContext. Additionally, if you are using async-await in method then return-type must be Task..
/// </summary>
internal static string UTA_ClassOrAssemblyInitializeMethodHasWrongSignature {
get {
return ResourceManager.GetString("UTA_ClassOrAssemblyInitializeMethodHasWrongSignature", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to TestCleanup method {0}.{1} threw exception. {2}: {3}..
/// </summary>
internal static string UTA_CleanupMethodThrows {
get {
return ResourceManager.GetString("UTA_CleanupMethodThrows", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error calling Test Cleanup method for test class {0}: {1}.
/// </summary>
internal static string UTA_CleanupMethodThrowsGeneralError {
get {
return ResourceManager.GetString("UTA_CleanupMethodThrowsGeneralError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to TestCleanup Stack Trace.
/// </summary>
internal static string UTA_CleanupStackTrace {
get {
return ResourceManager.GetString("UTA_CleanupStackTrace", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to --- End of inner exception stack trace ---.
/// </summary>
internal static string UTA_EndOfInnerExceptionTrace {
get {
return ResourceManager.GetString("UTA_EndOfInnerExceptionTrace", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA015: A generic method cannot be a test method. {0}.{1} has invalid signature.
/// </summary>
internal static string UTA_ErrorGenericTestMethod {
get {
return ResourceManager.GetString("UTA_ErrorGenericTestMethod", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA007: Method {1} defined in class {0} does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2().
/// </summary>
internal static string UTA_ErrorIncorrectTestMethodSignature {
get {
return ResourceManager.GetString("UTA_ErrorIncorrectTestMethodSignature", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA031: class {0} does not have valid TestContext property. TestContext must be of type TestContext, must be non-static, public and must not be read-only. For example: public TestContext TestContext..
/// </summary>
internal static string UTA_ErrorInValidTestContextSignature {
get {
return ResourceManager.GetString("UTA_ErrorInValidTestContextSignature", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA054: {0}.{1} has invalid Timeout attribute. The timeout must be a valid integer value and cannot be less than 0..
/// </summary>
internal static string UTA_ErrorInvalidTimeout {
get {
return ResourceManager.GetString("UTA_ErrorInvalidTimeout", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA014: {0}: Cannot define more than one method with the AssemblyCleanup attribute inside an assembly..
/// </summary>
internal static string UTA_ErrorMultiAssemblyClean {
get {
return ResourceManager.GetString("UTA_ErrorMultiAssemblyClean", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA013: {0}: Cannot define more than one method with the AssemblyInitialize attribute inside an assembly..
/// </summary>
internal static string UTA_ErrorMultiAssemblyInit {
get {
return ResourceManager.GetString("UTA_ErrorMultiAssemblyInit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA026: {0}: Cannot define more than one method with the ClassCleanup attribute inside a class..
/// </summary>
internal static string UTA_ErrorMultiClassClean {
get {
return ResourceManager.GetString("UTA_ErrorMultiClassClean", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA025: {0}: Cannot define more than one method with the ClassInitialize attribute inside a class..
/// </summary>
internal static string UTA_ErrorMultiClassInit {
get {
return ResourceManager.GetString("UTA_ErrorMultiClassInit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA024: {0}: Cannot define more than one method with the TestCleanup attribute..
/// </summary>
internal static string UTA_ErrorMultiClean {
get {
return ResourceManager.GetString("UTA_ErrorMultiClean", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA018: {0}: Cannot define more than one method with the TestInitialize attribute..
/// </summary>
internal static string UTA_ErrorMultiInit {
get {
return ResourceManager.GetString("UTA_ErrorMultiInit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA001: TestClass attribute defined on non-public class {0}.
/// </summary>
internal static string UTA_ErrorNonPublicTestClass {
get {
return ResourceManager.GetString("UTA_ErrorNonPublicTestClass", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA023: {0}: Cannot define predefined property {2} on method {1}..
/// </summary>
internal static string UTA_ErrorPredefinedTestProperty {
get {
return ResourceManager.GetString("UTA_ErrorPredefinedTestProperty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA022: {0}.{1}: The custom property "{2}" is already defined. Using "{3}" as value..
/// </summary>
internal static string UTA_ErrorTestPropertyAlreadyDefined {
get {
return ResourceManager.GetString("UTA_ErrorTestPropertyAlreadyDefined", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to UTA021: {0}: Null or empty custom property defined on method {1}. The custom property must have a valid name..
/// </summary>
internal static string UTA_ErrorTestPropertyNullOrEmpty {
get {
return ResourceManager.GetString("UTA_ErrorTestPropertyNullOrEmpty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}.
/// </summary>
internal static string UTA_ExecuteThrewException {
get {
return ResourceManager.GetString("UTA_ExecuteThrewException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The ExpectedException attribute defined on test method {0}.{1} threw an exception during construction.
///{2}.
/// </summary>
internal static string UTA_ExpectedExceptionAttributeConstructionException {
get {
return ResourceManager.GetString("UTA_ExpectedExceptionAttributeConstructionException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to obtain the exception thrown by test method {0}.{1}..
/// </summary>
internal static string UTA_FailedToGetTestMethodException {
get {
return ResourceManager.GetString("UTA_FailedToGetTestMethodException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Initialization method {0}.{1} threw exception. {2}..
/// </summary>
internal static string UTA_InitMethodThrows {
get {
return ResourceManager.GetString("UTA_InitMethodThrows", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unable to create instance of class {0}. Error: {1}..
/// </summary>
internal static string UTA_InstanceCreationError {
get {
return ResourceManager.GetString("UTA_InstanceCreationError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Method {0}.{1} does not exist..
/// </summary>
internal static string UTA_MethodDoesNotExists {
get {
return ResourceManager.GetString("UTA_MethodDoesNotExists", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The test method {0}.{1} has multiple attributes derived from ExpectedExceptionBaseAttribute defined on it. Only one such attribute is allowed..
/// </summary>
internal static string UTA_MultipleExpectedExceptionsOnTestMethod {
get {
return ResourceManager.GetString("UTA_MultipleExpectedExceptionsOnTestMethod", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unable to get default constructor for class {0}..
/// </summary>
internal static string UTA_NoDefaultConstructor {
get {
return ResourceManager.GetString("UTA_NoDefaultConstructor", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor..
/// </summary>
internal static string UTA_NoTestResult {
get {
return ResourceManager.GetString("UTA_NoTestResult", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unable to find property {0}.TestContext. Error:{1}..
/// </summary>
internal static string UTA_TestContextLoadError {
get {
return ResourceManager.GetString("UTA_TestContextLoadError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unable to set TestContext property for the class {0}. Error: {1}..
/// </summary>
internal static string UTA_TestContextSetError {
get {
return ResourceManager.GetString("UTA_TestContextSetError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The {0}.TestContext has incorrect type..
/// </summary>
internal static string UTA_TestContextTypeMismatchLoadError {
get {
return ResourceManager.GetString("UTA_TestContextTypeMismatchLoadError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Method {0}.{1} has wrong signature. The method must be non-static, public, does not return a value and should not take any parameter. Additionally, if you are using async-await in method then return-type must be Task..
/// </summary>
internal static string UTA_TestInitializeAndCleanupMethodHasWrongSignature {
get {
return ResourceManager.GetString("UTA_TestInitializeAndCleanupMethodHasWrongSignature", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Only data driven test methods can have parameters. Did you intend to use [DataRow] or [DynamicData]?.
/// </summary>
internal static string UTA_TestMethodExpectedParameters {
get {
return ResourceManager.GetString("UTA_TestMethodExpectedParameters", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Test method {0}.{1} threw exception:
///{2}.
/// </summary>
internal static string UTA_TestMethodThrows {
get {
return ResourceManager.GetString("UTA_TestMethodThrows", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unable to get type {0}. Error: {1}..
/// </summary>
internal static string UTA_TypeLoadError {
get {
return ResourceManager.GetString("UTA_TypeLoadError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The called code threw an exception that was caught, but the exception value was null.
/// </summary>
internal static string UTA_UserCodeThrewNullValueException {
get {
return ResourceManager.GetString("UTA_UserCodeThrewNullValueException", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} For UWP projects, if you are using UI objects in test consider using [UITestMethod] attribute instead of [TestMethod] to execute test in UI thread..
/// </summary>
internal static string UTA_WrongThread {
get {
return ResourceManager.GetString("UTA_WrongThread", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to (Failed to get the message for an exception of type {0} due to an exception.).
/// </summary>
internal static string UTF_FailedToGetExceptionMessage {
get {
return ResourceManager.GetString("UTF_FailedToGetExceptionMessage", resourceCulture);
}
}
}
}
| 44.722081 | 438 | 0.599359 | [
"MIT"
] | Microsoft/testfx | src/Adapter/MSTest.CoreAdapter/Resources/Resource.Designer.cs | 35,243 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using ZeraSystems.CodeNanite.Expansion;
using ZeraSystems.CodeStencil.Contracts;
namespace ZeraSystems.DevExtremeAspCore
{
/// <summary>
/// </summary>
[Export(typeof(ICodeStencilCodeNanite))]
[CodeStencilCodeNanite(new[]
{
// 0 - Publisher: This is the name of the publisher
"ZERA Systems Inc.",
// 1 - Title: This is the title of the Code Nanite
"Generates PopulateMode method",
// 2 - Details: This is the description of the Code Nanite/Plugin
"This code nanite will generate the PopulateMode method",
// 3 - Version Number
"1.0",
// 4 - Label: Label of the Code Nanite
"PopulateModel",
// 5 - Namespace
"ZeraSystems.DevExtremeAspCore",
// 6 - Release Date
"07/24/2020",
// 7 - Name to use for Expander Label
"DX_POPULATE_MODEL",
// 8 - Indicates that the Nanite is Schema Dependent
"1",
// 9 - RESERVED
"",
// 10 - link to Online Help
""
})]
public partial class PopulateModel : ExpansionBase, ICodeStencilCodeNanite
{
public string Input { get; set; }
public string Output { get; set; }
public int Counter { get; set; }
public List<string> OutputList { get; set; }
public List<ISchemaItem> SchemaItem { get; set; }
public List<IExpander> Expander { get; set; }
public List<string> InputList { get; set; }
public void ExecutePlugin()
{
Initializer(SchemaItem, Expander);
MainFunction();
//Output = ExpandedText.ToString();
}
}
}
| 34.964912 | 78 | 0.525339 | [
"MIT"
] | codetstencil/DevExtremeAspCore | src/DevExtremeAspCore/PopulateModel.cs | 1,993 | C# |
using System.IO;
using System.Collections.Generic;
using System.Threading;
using NetcoreDbgTestCore;
namespace NetcoreDbgTestCore.MI
{
public class MILocalDebuggerClient : DebuggerClient
{
public MILocalDebuggerClient(StreamWriter input, StreamReader output)
: base(ProtocolType.MI)
{
DebuggerInput = input;
DebuggerOutput = output;
GetInput = new AutoResetEvent(false);
GotInput = new AutoResetEvent(false);
InputThread = new Thread(ReaderThread);
InputThread.IsBackground = true;
InputThread.Start();
}
public override bool DoHandshake(int timeout)
{
string[] output = ReceiveOutputLines(timeout);
return output != null && output.Length == 1;
}
public override bool Send(string command)
{
DebuggerInput.WriteLine(command);
return true;
}
public override string[] Receive(int timeout)
{
return ReceiveOutputLines(timeout);
}
public override void Close()
{
DebuggerInput.Close();
DebuggerOutput.Close();
}
private void ReaderThread() {
while (true) {
GetInput.WaitOne();
InputString = DebuggerOutput.ReadLine();
GotInput.Set();
}
}
string[] ReceiveOutputLines(int timeout)
{
var output = new List<string>();
while (true) {
GetInput.Set();
bool success = GotInput.WaitOne(timeout);
if (!success)
throw new DebuggerNotResponsesException();
if (InputString == null) {
return null;
}
output.Add(InputString);
if (InputString == "(gdb)") {
break;
}
}
return output.ToArray();
}
StreamWriter DebuggerInput;
StreamReader DebuggerOutput;
private Thread InputThread;
private AutoResetEvent GetInput, GotInput;
private string InputString;
}
}
| 25.850575 | 77 | 0.528679 | [
"MIT"
] | SunburstApps/netcoredbg | test-suite/NetcoreDbgTest/MI/MILocalDebuggerClient.cs | 2,249 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Walking : MonoBehaviour {
[SerializeField] private float speed;
private bool walkRight = true;
// Update is called once per frame
void Update() {
if(walkRight)
this.transform.position = Vector3.MoveTowards(this.transform.position, this.transform.position + new Vector3(speed * Time.deltaTime, 0), speed * Time.deltaTime);
else
this.transform.position = Vector3.MoveTowards(this.transform.position, this.transform.position - new Vector3(speed * Time.deltaTime, 0), speed * Time.deltaTime);
RaycastHit2D hit = Physics2D.Raycast(transform.position - Vector3.up, -Vector2.up, 5, 1 << LayerMask.NameToLayer("Default"));
if(hit.collider == null) {
this.GetComponent<CharacterController2D>().Flip();
walkRight = !walkRight;
}
}
}
| 38.666667 | 173 | 0.679957 | [
"MIT"
] | kevincrans/Cupheads | Assets/Enemies/Walking.cs | 930 | C# |
using System.Collections.Generic;
using System.Linq;
namespace AnyService
{
public static class WorkContextExtensions
{
public static T GetFirstParameter<T>(this WorkContext workContext, string parameterName)
{
return GetParameterByIndex<T>(workContext, parameterName, 0);
}
public static T GetParameterByIndex<T>(this WorkContext workContext, string parameterName, int index)
{
if (!workContext.Parameters.TryGetValue(parameterName, out object value))
return default;
return (value as IEnumerable<T>).ElementAt(index);
}
}
} | 33.631579 | 109 | 0.668232 | [
"MIT"
] | saturn72/AnyService | src/AnyService/WorkContextExtensions.cs | 641 | C# |
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated code. DO NOT EDIT!
namespace Google.Cloud.Talent.V4Beta1.Snippets
{
using Google.Api.Gax;
using Google.Api.Gax.Grpc;
using apis = Google.Cloud.Talent.V4Beta1;
using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
/// <summary>Generated snippets</summary>
public class GeneratedCompanyServiceClientSnippets
{
/// <summary>Snippet for CreateCompanyAsync</summary>
public async Task CreateCompanyAsync()
{
// Snippet: CreateCompanyAsync(TenantOrProjectNameOneof,Company,CallSettings)
// Additional: CreateCompanyAsync(TenantOrProjectNameOneof,Company,CancellationToken)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]"));
Company company = new Company();
// Make the request
Company response = await companyServiceClient.CreateCompanyAsync(parent, company);
// End snippet
}
/// <summary>Snippet for CreateCompany</summary>
public void CreateCompany()
{
// Snippet: CreateCompany(TenantOrProjectNameOneof,Company,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]"));
Company company = new Company();
// Make the request
Company response = companyServiceClient.CreateCompany(parent, company);
// End snippet
}
/// <summary>Snippet for CreateCompanyAsync</summary>
public async Task CreateCompanyAsync_RequestObject()
{
// Snippet: CreateCompanyAsync(CreateCompanyRequest,CallSettings)
// Additional: CreateCompanyAsync(CreateCompanyRequest,CancellationToken)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCompanyRequest request = new CreateCompanyRequest
{
ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
Company = new Company(),
};
// Make the request
Company response = await companyServiceClient.CreateCompanyAsync(request);
// End snippet
}
/// <summary>Snippet for CreateCompany</summary>
public void CreateCompany_RequestObject()
{
// Snippet: CreateCompany(CreateCompanyRequest,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
CreateCompanyRequest request = new CreateCompanyRequest
{
ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
Company = new Company(),
};
// Make the request
Company response = companyServiceClient.CreateCompany(request);
// End snippet
}
/// <summary>Snippet for GetCompanyAsync</summary>
public async Task GetCompanyAsync()
{
// Snippet: GetCompanyAsync(CompanyNameOneof,CallSettings)
// Additional: GetCompanyAsync(CompanyNameOneof,CancellationToken)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
CompanyNameOneof name = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]"));
// Make the request
Company response = await companyServiceClient.GetCompanyAsync(name);
// End snippet
}
/// <summary>Snippet for GetCompany</summary>
public void GetCompany()
{
// Snippet: GetCompany(CompanyNameOneof,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
CompanyNameOneof name = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]"));
// Make the request
Company response = companyServiceClient.GetCompany(name);
// End snippet
}
/// <summary>Snippet for GetCompanyAsync</summary>
public async Task GetCompanyAsync_RequestObject()
{
// Snippet: GetCompanyAsync(GetCompanyRequest,CallSettings)
// Additional: GetCompanyAsync(GetCompanyRequest,CancellationToken)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
GetCompanyRequest request = new GetCompanyRequest
{
CompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
};
// Make the request
Company response = await companyServiceClient.GetCompanyAsync(request);
// End snippet
}
/// <summary>Snippet for GetCompany</summary>
public void GetCompany_RequestObject()
{
// Snippet: GetCompany(GetCompanyRequest,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
GetCompanyRequest request = new GetCompanyRequest
{
CompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
};
// Make the request
Company response = companyServiceClient.GetCompany(request);
// End snippet
}
/// <summary>Snippet for UpdateCompanyAsync</summary>
public async Task UpdateCompanyAsync()
{
// Snippet: UpdateCompanyAsync(Company,CallSettings)
// Additional: UpdateCompanyAsync(Company,CancellationToken)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
Company company = new Company();
// Make the request
Company response = await companyServiceClient.UpdateCompanyAsync(company);
// End snippet
}
/// <summary>Snippet for UpdateCompany</summary>
public void UpdateCompany()
{
// Snippet: UpdateCompany(Company,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
Company company = new Company();
// Make the request
Company response = companyServiceClient.UpdateCompany(company);
// End snippet
}
/// <summary>Snippet for UpdateCompanyAsync</summary>
public async Task UpdateCompanyAsync_RequestObject()
{
// Snippet: UpdateCompanyAsync(UpdateCompanyRequest,CallSettings)
// Additional: UpdateCompanyAsync(UpdateCompanyRequest,CancellationToken)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCompanyRequest request = new UpdateCompanyRequest
{
Company = new Company(),
};
// Make the request
Company response = await companyServiceClient.UpdateCompanyAsync(request);
// End snippet
}
/// <summary>Snippet for UpdateCompany</summary>
public void UpdateCompany_RequestObject()
{
// Snippet: UpdateCompany(UpdateCompanyRequest,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
UpdateCompanyRequest request = new UpdateCompanyRequest
{
Company = new Company(),
};
// Make the request
Company response = companyServiceClient.UpdateCompany(request);
// End snippet
}
/// <summary>Snippet for DeleteCompanyAsync</summary>
public async Task DeleteCompanyAsync()
{
// Snippet: DeleteCompanyAsync(CompanyNameOneof,CallSettings)
// Additional: DeleteCompanyAsync(CompanyNameOneof,CancellationToken)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
CompanyNameOneof name = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]"));
// Make the request
await companyServiceClient.DeleteCompanyAsync(name);
// End snippet
}
/// <summary>Snippet for DeleteCompany</summary>
public void DeleteCompany()
{
// Snippet: DeleteCompany(CompanyNameOneof,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
CompanyNameOneof name = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]"));
// Make the request
companyServiceClient.DeleteCompany(name);
// End snippet
}
/// <summary>Snippet for DeleteCompanyAsync</summary>
public async Task DeleteCompanyAsync_RequestObject()
{
// Snippet: DeleteCompanyAsync(DeleteCompanyRequest,CallSettings)
// Additional: DeleteCompanyAsync(DeleteCompanyRequest,CancellationToken)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteCompanyRequest request = new DeleteCompanyRequest
{
CompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
};
// Make the request
await companyServiceClient.DeleteCompanyAsync(request);
// End snippet
}
/// <summary>Snippet for DeleteCompany</summary>
public void DeleteCompany_RequestObject()
{
// Snippet: DeleteCompany(DeleteCompanyRequest,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
DeleteCompanyRequest request = new DeleteCompanyRequest
{
CompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")),
};
// Make the request
companyServiceClient.DeleteCompany(request);
// End snippet
}
/// <summary>Snippet for ListCompaniesAsync</summary>
public async Task ListCompaniesAsync()
{
// Snippet: ListCompaniesAsync(TenantOrProjectNameOneof,string,int?,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]"));
// Make the request
PagedAsyncEnumerable<ListCompaniesResponse, Company> response =
companyServiceClient.ListCompaniesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Company item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCompaniesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company item in page)
{
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Company> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Company item in singlePage)
{
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
// End snippet
}
/// <summary>Snippet for ListCompanies</summary>
public void ListCompanies()
{
// Snippet: ListCompanies(TenantOrProjectNameOneof,string,int?,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]"));
// Make the request
PagedEnumerable<ListCompaniesResponse, Company> response =
companyServiceClient.ListCompanies(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Company item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCompaniesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company item in page)
{
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Company> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Company item in singlePage)
{
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
// End snippet
}
/// <summary>Snippet for ListCompaniesAsync</summary>
public async Task ListCompaniesAsync_RequestObject()
{
// Snippet: ListCompaniesAsync(ListCompaniesRequest,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync();
// Initialize request argument(s)
ListCompaniesRequest request = new ListCompaniesRequest
{
ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
};
// Make the request
PagedAsyncEnumerable<ListCompaniesResponse, Company> response =
companyServiceClient.ListCompaniesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Company item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCompaniesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company item in page)
{
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Company> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Company item in singlePage)
{
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
// End snippet
}
/// <summary>Snippet for ListCompanies</summary>
public void ListCompanies_RequestObject()
{
// Snippet: ListCompanies(ListCompaniesRequest,CallSettings)
// Create client
CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
// Initialize request argument(s)
ListCompaniesRequest request = new ListCompaniesRequest
{
ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
};
// Make the request
PagedEnumerable<ListCompaniesResponse, Company> response =
companyServiceClient.ListCompanies(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Company item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCompaniesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Company item in page)
{
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Company> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Company item in singlePage)
{
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
// End snippet
}
}
}
| 44.571121 | 122 | 0.612301 | [
"Apache-2.0"
] | ArulMozhiVaradan/google-cloud-dotnet | apis/Google.Cloud.Talent.V4Beta1/Google.Cloud.Talent.V4Beta1.Snippets/CompanyServiceClientSnippets.g.cs | 20,681 | C# |
using System;
using UnityEngine;
namespace ScreenManager
{
[Serializable]
public class ScreenComponent
{
public ScreenType Type;
public GameObject Root;
}
} | 16.833333 | 34 | 0.628713 | [
"MIT"
] | CrArher/HakatonFinalClient | Assets/Scripts/ScreenManager/ScreenComponent.cs | 204 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Co_nnecto.Controllers
{
public class HomeController : ApplicationBaseController
{
public ActionResult Index()
{
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
public ActionResult FAQs()
{
ViewBag.Message = "A list of our most asked questions.";
return View();
}
}
} | 18.75 | 68 | 0.56 | [
"MIT"
] | Kleida10/Connecto | Controllers/HomeController.cs | 602 | C# |
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/chromeos/moblab/v1beta1/resources.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Chromeos.Moblab.V1Beta1 {
/// <summary>Holder for reflection information generated from google/chromeos/moblab/v1beta1/resources.proto</summary>
public static partial class ResourcesReflection {
#region Descriptor
/// <summary>File descriptor for google/chromeos/moblab/v1beta1/resources.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static ResourcesReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Ci5nb29nbGUvY2hyb21lb3MvbW9ibGFiL3YxYmV0YTEvcmVzb3VyY2VzLnBy",
"b3RvEh5nb29nbGUuY2hyb21lb3MubW9ibGFiLnYxYmV0YTEaGWdvb2dsZS9h",
"cGkvcmVzb3VyY2UucHJvdG8iaAoLQnVpbGRUYXJnZXQSDAoEbmFtZRgBIAEo",
"CTpL6kFICiljaHJvbWVvc21vYmxhYi5nb29nbGVhcGlzLmNvbS9CdWlsZFRh",
"cmdldBIbYnVpbGRUYXJnZXRzL3tidWlsZF90YXJnZXR9ImsKBU1vZGVsEgwK",
"BG5hbWUYASABKAk6VOpBUQojY2hyb21lb3Ntb2JsYWIuZ29vZ2xlYXBpcy5j",
"b20vTW9kZWwSKmJ1aWxkVGFyZ2V0cy97YnVpbGRfdGFyZ2V0fS9tb2RlbHMv",
"e21vZGVsfSJfCglNaWxlc3RvbmUSDAoEbmFtZRgBIAEoCTpE6kFBCidjaHJv",
"bWVvc21vYmxhYi5nb29nbGVhcGlzLmNvbS9NaWxlc3RvbmUSFm1pbGVzdG9u",
"ZXMve21pbGVzdG9uZX0ioAQKBUJ1aWxkEgwKBG5hbWUYASABKAkSPwoJbWls",
"ZXN0b25lGAIgASgJQiz6QSkKJ2Nocm9tZW9zbW9ibGFiLmdvb2dsZWFwaXMu",
"Y29tL01pbGVzdG9uZRIVCg1idWlsZF92ZXJzaW9uGAMgASgJEkEKBnN0YXR1",
"cxgEIAEoDjIxLmdvb2dsZS5jaHJvbWVvcy5tb2JsYWIudjFiZXRhMS5CdWls",
"ZC5CdWlsZFN0YXR1cxI9CgR0eXBlGAUgASgOMi8uZ29vZ2xlLmNocm9tZW9z",
"Lm1vYmxhYi52MWJldGExLkJ1aWxkLkJ1aWxkVHlwZRIOCgZicmFuY2gYBiAB",
"KAkSGwoTcndfZmlybXdhcmVfdmVyc2lvbhgHIAEoCSJZCgtCdWlsZFN0YXR1",
"cxIcChhCVUlMRF9TVEFUVVNfVU5TUEVDSUZJRUQQABIICgRQQVNTEAESCAoE",
"RkFJTBACEgsKB1JVTk5JTkcQAxILCgdBQk9SVEVEEAQiQgoJQnVpbGRUeXBl",
"EhoKFkJVSUxEX1RZUEVfVU5TUEVDSUZJRUQQABILCgdSRUxFQVNFEAESDAoI",
"RklSTVdBUkUQAjpj6kFgCiNjaHJvbWVvc21vYmxhYi5nb29nbGVhcGlzLmNv",
"bS9CdWlsZBI5YnVpbGRUYXJnZXRzL3tidWlsZF90YXJnZXR9L21vZGVscy97",
"bW9kZWx9L2J1aWxkcy97YnVpbGR9Io0CCg1CdWlsZEFydGlmYWN0EgwKBG5h",
"bWUYASABKAkSNwoFYnVpbGQYAiABKAlCKPpBJQojY2hyb21lb3Ntb2JsYWIu",
"Z29vZ2xlYXBpcy5jb20vQnVpbGQSDgoGYnVja2V0GAMgASgJEgwKBHBhdGgY",
"BCABKAkSFAoMb2JqZWN0X2NvdW50GAUgASgNOoAB6kF9CitjaHJvbWVvc21v",
"YmxhYi5nb29nbGVhcGlzLmNvbS9CdWlsZEFydGlmYWN0Ek5idWlsZFRhcmdl",
"dHMve2J1aWxkX3RhcmdldH0vbW9kZWxzL3ttb2RlbH0vYnVpbGRzL3tidWls",
"ZH0vYXJ0aWZhY3RzL3thcnRpZmFjdH1CfgoiY29tLmdvb2dsZS5jaHJvbWVv",
"cy5tb2JsYWIudjFiZXRhMUIOUmVzb3VyY2VzUHJvdG9IAVABWkRnb29nbGUu",
"Z29sYW5nLm9yZy9nZW5wcm90by9nb29nbGVhcGlzL2Nocm9tZW9zL21vYmxh",
"Yi92MWJldGExO21vYmxhYmIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Api.ResourceReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Chromeos.Moblab.V1Beta1.BuildTarget), global::Google.Chromeos.Moblab.V1Beta1.BuildTarget.Parser, new[]{ "Name" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Chromeos.Moblab.V1Beta1.Model), global::Google.Chromeos.Moblab.V1Beta1.Model.Parser, new[]{ "Name" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Chromeos.Moblab.V1Beta1.Milestone), global::Google.Chromeos.Moblab.V1Beta1.Milestone.Parser, new[]{ "Name" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Chromeos.Moblab.V1Beta1.Build), global::Google.Chromeos.Moblab.V1Beta1.Build.Parser, new[]{ "Name", "Milestone", "BuildVersion", "Status", "Type", "Branch", "RwFirmwareVersion" }, null, new[]{ typeof(global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus), typeof(global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType) }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Chromeos.Moblab.V1Beta1.BuildArtifact), global::Google.Chromeos.Moblab.V1Beta1.BuildArtifact.Parser, new[]{ "Name", "Build", "Bucket", "Path", "ObjectCount" }, null, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
/// Resource that represents a build target.
/// </summary>
public sealed partial class BuildTarget : pb::IMessage<BuildTarget>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<BuildTarget> _parser = new pb::MessageParser<BuildTarget>(() => new BuildTarget());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<BuildTarget> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Chromeos.Moblab.V1Beta1.ResourcesReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public BuildTarget() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public BuildTarget(BuildTarget other) : this() {
name_ = other.name_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public BuildTarget Clone() {
return new BuildTarget(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// The resource name of the build target.
/// Format: buildTargets/{build_target}
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as BuildTarget);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(BuildTarget other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(BuildTarget other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
}
}
}
#endif
}
/// <summary>
/// Resource that represents a model. Each model belongs to a build target. For
/// non-unified build, the model name is the same as its build target name.
/// </summary>
public sealed partial class Model : pb::IMessage<Model>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Model> _parser = new pb::MessageParser<Model>(() => new Model());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Model> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Chromeos.Moblab.V1Beta1.ResourcesReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Model() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Model(Model other) : this() {
name_ = other.name_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Model Clone() {
return new Model(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// The resource name of the model.
/// Format: buildTargets/{build_target}/models/{model}
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as Model);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(Model other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(Model other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
}
}
}
#endif
}
/// <summary>
/// Resource that represents a chrome OS milestone.
/// </summary>
public sealed partial class Milestone : pb::IMessage<Milestone>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Milestone> _parser = new pb::MessageParser<Milestone>(() => new Milestone());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Milestone> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Chromeos.Moblab.V1Beta1.ResourcesReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Milestone() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Milestone(Milestone other) : this() {
name_ = other.name_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Milestone Clone() {
return new Milestone(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// The resource name of the milestone.
/// Format: milestones/{milestone}
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as Milestone);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(Milestone other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(Milestone other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
}
}
}
#endif
}
/// <summary>
/// Resource that represents a build for the given build target, model, milestone
/// and build version.
/// </summary>
public sealed partial class Build : pb::IMessage<Build>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Build> _parser = new pb::MessageParser<Build>(() => new Build());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Build> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Chromeos.Moblab.V1Beta1.ResourcesReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Build() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Build(Build other) : this() {
name_ = other.name_;
milestone_ = other.milestone_;
buildVersion_ = other.buildVersion_;
status_ = other.status_;
type_ = other.type_;
branch_ = other.branch_;
rwFirmwareVersion_ = other.rwFirmwareVersion_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Build Clone() {
return new Build(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// The resource name of the build.
/// Format: buildTargets/{build_target}/models/{model}/builds/{build}
/// Example: buildTargets/octopus/models/bobba/builds/1234.0.0
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "milestone" field.</summary>
public const int MilestoneFieldNumber = 2;
private string milestone_ = "";
/// <summary>
/// The milestone that owns the build.
/// Format: milestones/{milestone}
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Milestone {
get { return milestone_; }
set {
milestone_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "build_version" field.</summary>
public const int BuildVersionFieldNumber = 3;
private string buildVersion_ = "";
/// <summary>
/// The build version of the build, e.g. 1234.0.0.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string BuildVersion {
get { return buildVersion_; }
set {
buildVersion_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "status" field.</summary>
public const int StatusFieldNumber = 4;
private global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus status_ = global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus.Unspecified;
/// <summary>
/// The status of the build.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus Status {
get { return status_; }
set {
status_ = value;
}
}
/// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 5;
private global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType type_ = global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType.Unspecified;
/// <summary>
/// The type of the build.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType Type {
get { return type_; }
set {
type_ = value;
}
}
/// <summary>Field number for the "branch" field.</summary>
public const int BranchFieldNumber = 6;
private string branch_ = "";
/// <summary>
/// The branch of the build.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Branch {
get { return branch_; }
set {
branch_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "rw_firmware_version" field.</summary>
public const int RwFirmwareVersionFieldNumber = 7;
private string rwFirmwareVersion_ = "";
/// <summary>
/// The read write firmware version of the software that is flashed to the chip
/// on the Chrome OS device.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string RwFirmwareVersion {
get { return rwFirmwareVersion_; }
set {
rwFirmwareVersion_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as Build);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(Build other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (Milestone != other.Milestone) return false;
if (BuildVersion != other.BuildVersion) return false;
if (Status != other.Status) return false;
if (Type != other.Type) return false;
if (Branch != other.Branch) return false;
if (RwFirmwareVersion != other.RwFirmwareVersion) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Milestone.Length != 0) hash ^= Milestone.GetHashCode();
if (BuildVersion.Length != 0) hash ^= BuildVersion.GetHashCode();
if (Status != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus.Unspecified) hash ^= Status.GetHashCode();
if (Type != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType.Unspecified) hash ^= Type.GetHashCode();
if (Branch.Length != 0) hash ^= Branch.GetHashCode();
if (RwFirmwareVersion.Length != 0) hash ^= RwFirmwareVersion.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Milestone.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Milestone);
}
if (BuildVersion.Length != 0) {
output.WriteRawTag(26);
output.WriteString(BuildVersion);
}
if (Status != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus.Unspecified) {
output.WriteRawTag(32);
output.WriteEnum((int) Status);
}
if (Type != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType.Unspecified) {
output.WriteRawTag(40);
output.WriteEnum((int) Type);
}
if (Branch.Length != 0) {
output.WriteRawTag(50);
output.WriteString(Branch);
}
if (RwFirmwareVersion.Length != 0) {
output.WriteRawTag(58);
output.WriteString(RwFirmwareVersion);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Milestone.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Milestone);
}
if (BuildVersion.Length != 0) {
output.WriteRawTag(26);
output.WriteString(BuildVersion);
}
if (Status != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus.Unspecified) {
output.WriteRawTag(32);
output.WriteEnum((int) Status);
}
if (Type != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType.Unspecified) {
output.WriteRawTag(40);
output.WriteEnum((int) Type);
}
if (Branch.Length != 0) {
output.WriteRawTag(50);
output.WriteString(Branch);
}
if (RwFirmwareVersion.Length != 0) {
output.WriteRawTag(58);
output.WriteString(RwFirmwareVersion);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (Milestone.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Milestone);
}
if (BuildVersion.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(BuildVersion);
}
if (Status != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus.Unspecified) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Status);
}
if (Type != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType.Unspecified) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type);
}
if (Branch.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Branch);
}
if (RwFirmwareVersion.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(RwFirmwareVersion);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(Build other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.Milestone.Length != 0) {
Milestone = other.Milestone;
}
if (other.BuildVersion.Length != 0) {
BuildVersion = other.BuildVersion;
}
if (other.Status != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus.Unspecified) {
Status = other.Status;
}
if (other.Type != global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType.Unspecified) {
Type = other.Type;
}
if (other.Branch.Length != 0) {
Branch = other.Branch;
}
if (other.RwFirmwareVersion.Length != 0) {
RwFirmwareVersion = other.RwFirmwareVersion;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Milestone = input.ReadString();
break;
}
case 26: {
BuildVersion = input.ReadString();
break;
}
case 32: {
Status = (global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus) input.ReadEnum();
break;
}
case 40: {
Type = (global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType) input.ReadEnum();
break;
}
case 50: {
Branch = input.ReadString();
break;
}
case 58: {
RwFirmwareVersion = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Milestone = input.ReadString();
break;
}
case 26: {
BuildVersion = input.ReadString();
break;
}
case 32: {
Status = (global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildStatus) input.ReadEnum();
break;
}
case 40: {
Type = (global::Google.Chromeos.Moblab.V1Beta1.Build.Types.BuildType) input.ReadEnum();
break;
}
case 50: {
Branch = input.ReadString();
break;
}
case 58: {
RwFirmwareVersion = input.ReadString();
break;
}
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the Build message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
/// <summary>
/// The build status types.
/// </summary>
public enum BuildStatus {
/// <summary>
/// No build status is specified.
/// </summary>
[pbr::OriginalName("BUILD_STATUS_UNSPECIFIED")] Unspecified = 0,
/// <summary>
/// Complete Status: The build passed.
/// </summary>
[pbr::OriginalName("PASS")] Pass = 1,
/// <summary>
/// Complete Status: The build failed.
/// </summary>
[pbr::OriginalName("FAIL")] Fail = 2,
/// <summary>
/// Intermediate Status: The build is still running.
/// </summary>
[pbr::OriginalName("RUNNING")] Running = 3,
/// <summary>
/// Complete Status: The build was aborted.
/// </summary>
[pbr::OriginalName("ABORTED")] Aborted = 4,
}
/// <summary>
/// The build types.
/// </summary>
public enum BuildType {
/// <summary>
/// Invalid build type.
/// </summary>
[pbr::OriginalName("BUILD_TYPE_UNSPECIFIED")] Unspecified = 0,
/// <summary>
/// The release build.
/// </summary>
[pbr::OriginalName("RELEASE")] Release = 1,
/// <summary>
/// The firmware build.
/// </summary>
[pbr::OriginalName("FIRMWARE")] Firmware = 2,
}
}
#endregion
}
/// <summary>
/// Resource that represents a build artifact stored in Google Cloud Storage for
/// the given build target, model, build version and bucket.
/// </summary>
public sealed partial class BuildArtifact : pb::IMessage<BuildArtifact>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<BuildArtifact> _parser = new pb::MessageParser<BuildArtifact>(() => new BuildArtifact());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<BuildArtifact> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Chromeos.Moblab.V1Beta1.ResourcesReflection.Descriptor.MessageTypes[4]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public BuildArtifact() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public BuildArtifact(BuildArtifact other) : this() {
name_ = other.name_;
build_ = other.build_;
bucket_ = other.bucket_;
path_ = other.path_;
objectCount_ = other.objectCount_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public BuildArtifact Clone() {
return new BuildArtifact(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// The resource name of the build artifact.
/// Format:
/// buildTargets/{build_target}/models/{model}/builds/{build}/artifacts/{artifact}
/// Example:
/// buildTargets/octopus/models/bobba/builds/1234.0.0/artifacts/chromeos-moblab-peng-staging
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "build" field.</summary>
public const int BuildFieldNumber = 2;
private string build_ = "";
/// <summary>
/// The build metadata of the build artifact.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Build {
get { return build_; }
set {
build_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "bucket" field.</summary>
public const int BucketFieldNumber = 3;
private string bucket_ = "";
/// <summary>
/// The bucket that stores the build artifact.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Bucket {
get { return bucket_; }
set {
bucket_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "path" field.</summary>
public const int PathFieldNumber = 4;
private string path_ = "";
/// <summary>
/// The path of the build artifact in the bucket.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Path {
get { return path_; }
set {
path_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "object_count" field.</summary>
public const int ObjectCountFieldNumber = 5;
private uint objectCount_;
/// <summary>
/// The number of objects in the build artifact folder. The object number can
/// be used to calculated the stage progress by comparing the source build
/// artifact with the destination build artifact.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public uint ObjectCount {
get { return objectCount_; }
set {
objectCount_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as BuildArtifact);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(BuildArtifact other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (Build != other.Build) return false;
if (Bucket != other.Bucket) return false;
if (Path != other.Path) return false;
if (ObjectCount != other.ObjectCount) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Build.Length != 0) hash ^= Build.GetHashCode();
if (Bucket.Length != 0) hash ^= Bucket.GetHashCode();
if (Path.Length != 0) hash ^= Path.GetHashCode();
if (ObjectCount != 0) hash ^= ObjectCount.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Build.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Build);
}
if (Bucket.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Bucket);
}
if (Path.Length != 0) {
output.WriteRawTag(34);
output.WriteString(Path);
}
if (ObjectCount != 0) {
output.WriteRawTag(40);
output.WriteUInt32(ObjectCount);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Build.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Build);
}
if (Bucket.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Bucket);
}
if (Path.Length != 0) {
output.WriteRawTag(34);
output.WriteString(Path);
}
if (ObjectCount != 0) {
output.WriteRawTag(40);
output.WriteUInt32(ObjectCount);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (Build.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Build);
}
if (Bucket.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Bucket);
}
if (Path.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Path);
}
if (ObjectCount != 0) {
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(ObjectCount);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(BuildArtifact other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.Build.Length != 0) {
Build = other.Build;
}
if (other.Bucket.Length != 0) {
Bucket = other.Bucket;
}
if (other.Path.Length != 0) {
Path = other.Path;
}
if (other.ObjectCount != 0) {
ObjectCount = other.ObjectCount;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Build = input.ReadString();
break;
}
case 26: {
Bucket = input.ReadString();
break;
}
case 34: {
Path = input.ReadString();
break;
}
case 40: {
ObjectCount = input.ReadUInt32();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Build = input.ReadString();
break;
}
case 26: {
Bucket = input.ReadString();
break;
}
case 34: {
Path = input.ReadString();
break;
}
case 40: {
ObjectCount = input.ReadUInt32();
break;
}
}
}
}
#endif
}
#endregion
}
#endregion Designer generated code
| 35.866447 | 413 | 0.650293 | [
"Apache-2.0"
] | googleapis/googleapis-gen | google/chromeos/moblab/v1beta1/google-cloud-chromeos-moblab-v1beta1-csharp/Google.Chromeos.Moblab.V1Beta1/Resources.g.cs | 54,517 | C# |
using Microsoft.Extensions.Options;
using Tingle.EventBus.Transports.RabbitMQ;
namespace Microsoft.Extensions.DependencyInjection;
/// <summary>
/// Extension methods on <see cref="EventBusBuilder"/> for RabbitMQ.
/// </summary>
public static class EventBusBuilderExtensions
{
/// <summary>
/// Add RabbitMQ as the underlying transport for the Event Bus.
/// </summary>
/// <param name="builder"></param>
/// <param name="configure"></param>
/// <returns></returns>
public static EventBusBuilder AddRabbitMqTransport(this EventBusBuilder builder, Action<RabbitMqTransportOptions> configure)
{
if (builder == null) throw new ArgumentNullException(nameof(builder));
if (configure is null) throw new ArgumentNullException(nameof(configure));
var services = builder.Services;
// configure the options for RabbitMQ
services.Configure(configure);
services.AddSingleton<IPostConfigureOptions<RabbitMqTransportOptions>, RabbitMqPostConfigureOptions>();
// register the transport
builder.AddTransport<RabbitMqTransport, RabbitMqTransportOptions>();
return builder;
}
}
| 34.558824 | 128 | 0.714043 | [
"MIT"
] | BarryCao-2009/eventbus | src/Tingle.EventBus.Transports.RabbitMQ/EventBusBuilderExtensions.cs | 1,177 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PIM_4_PERIODO.View.__Tela_Principal__.Chat;
namespace PIM_4_PERIODO.View.__Tela_Principal__.Sac
{
public partial class Tela_Sac : Form
{
public Tela_Sac()
{
InitializeComponent();
}
private void Atendimento_Btn_Click(object sender, EventArgs e)
{
Sac_Label.Hide();
Atendimento_Btn.Hide();
Tela_Chat Chat = new Tela_Chat();
Panel PainelCentral = new Panel();
PainelCentral.Dock = DockStyle.Fill;
Chat.TopLevel = false;
Chat.AutoScroll = true;
Chat.Show();
PainelCentral.Controls.Add(Chat);
PainelCentral.Show();
this.Controls.Add(PainelCentral);
}
}
}
| 24.243902 | 70 | 0.6167 | [
"Apache-2.0"
] | Caiocesar173/PIM_4_Periodo | PIM 4 PERIODO/View/Tela Principal/Sac/Tela_Sac.cs | 996 | C# |
/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud.Bmvpc.V20180625.Models
{
using Newtonsoft.Json;
using System.Collections.Generic;
using TencentCloud.Common;
public class DescribeVpnConnectionsRequest : AbstractModel
{
/// <summary>
/// VPN通道实例ID。形如:bmvpnx-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定VpnConnectionIds和Filters。
/// </summary>
[JsonProperty("VpnConnectionIds")]
public string[] VpnConnectionIds{ get; set; }
/// <summary>
/// 过滤条件,详见下表:实例过滤条件表。每次请求的Filters的上限为10,Filter.Values的上限为5。参数不支持同时指定VpnConnectionIds和Filters。
/// <li>vpc-id - String - (过滤条件)VPC实例ID形如:vpc-f49l6u0z。</li>
/// <li>state - String - (过滤条件 VPN状态:creating,available,createfailed,changing,changefailed,deleting,deletefailed。</li>
/// <li>zone - String - (过滤条件)VPN所在可用区,形如:ap-guangzhou-2。</li>
/// </summary>
[JsonProperty("Filters")]
public Filter[] Filters{ get; set; }
/// <summary>
/// 偏移量,默认为0。关于Offset的更进一步介绍请参考 API 简介中的相关小节。
/// </summary>
[JsonProperty("Offset")]
public ulong? Offset{ get; set; }
/// <summary>
/// 返回数量,默认为20,最大值为100。
/// </summary>
[JsonProperty("Limit")]
public ulong? Limit{ get; set; }
/// <summary>
/// VPN网关实例ID
/// </summary>
[JsonProperty("VpnGatewayId")]
public string VpnGatewayId{ get; set; }
/// <summary>
/// VPN通道名称
/// </summary>
[JsonProperty("VpnConnectionName")]
public string VpnConnectionName{ get; set; }
/// <summary>
/// 排序字段, 支持"CreateTime"排序
/// </summary>
[JsonProperty("OrderField")]
public string OrderField{ get; set; }
/// <summary>
/// 排序方向, “asc”、“desc”
/// </summary>
[JsonProperty("OrderDirection")]
public string OrderDirection{ get; set; }
/// <summary>
/// For internal usage only. DO NOT USE IT.
/// </summary>
public override void ToMap(Dictionary<string, string> map, string prefix)
{
this.SetParamArraySimple(map, prefix + "VpnConnectionIds.", this.VpnConnectionIds);
this.SetParamArrayObj(map, prefix + "Filters.", this.Filters);
this.SetParamSimple(map, prefix + "Offset", this.Offset);
this.SetParamSimple(map, prefix + "Limit", this.Limit);
this.SetParamSimple(map, prefix + "VpnGatewayId", this.VpnGatewayId);
this.SetParamSimple(map, prefix + "VpnConnectionName", this.VpnConnectionName);
this.SetParamSimple(map, prefix + "OrderField", this.OrderField);
this.SetParamSimple(map, prefix + "OrderDirection", this.OrderDirection);
}
}
}
| 35.760417 | 126 | 0.617827 | [
"Apache-2.0"
] | TencentCloud/tencentcloud-sdk-dotnet | TencentCloud/Bmvpc/V20180625/Models/DescribeVpnConnectionsRequest.cs | 3,807 | C# |
using System;
namespace OrchardCore.Data.Documents
{
/// <summary>
/// The <see cref="Exception"/> that is thrown if <see cref="IDocumentStore.CommitAsync"/> fails.
/// </summary>
public class DocumentStoreCommitException : Exception
{
/// <summary>
/// Creates a new instance of <see cref="DocumentStoreCommitException"/> with the specified
/// exception message.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public DocumentStoreCommitException(string message) : base(message)
{
}
/// <summary>
/// Creates a new instance of <see cref="DocumentStoreCommitException"/> with the specified
/// exception message and inner exception.
/// </summary>
/// <param name="message">The message that describes the error.</param>
/// <param name="innerException">The inner <see cref="Exception"/>.</param>
public DocumentStoreCommitException(string message, Exception innerException) : base(message, innerException)
{
}
}
}
| 37.2 | 117 | 0.632616 | [
"BSD-3-Clause"
] | 1051324354/OrchardCore | src/OrchardCore/OrchardCore.Data.Abstractions/Documents/DocumentStoreCommitException.cs | 1,116 | C# |
using CMS.DocumentEngine.Types.Generic;
using PartialWidgetPage;
namespace Generic
{
public class CustomPartialWidgetRenderingRetriever : IPartialWidgetRenderingRetriever
{
public ParitalWidgetRendering GetRenderingViewComponent(string ClassName, int DocumentID = 0)
{
/*if (ClassName.Equals(Tab.CLASS_NAME))
{
return new ParitalWidgetRendering()
{
ViewComponentData = new { },
ViewComponentName = "TabComponent",
SetContextPriorToCall = true
};
}
if (ClassName.Equals(ShareableContent.CLASS_NAME))
{
return new ParitalWidgetRendering()
{
ViewComponentData = new { Testing = "Hello" },
ViewComponentName = "ShareableContentComponent",
SetContextPriorToCall = true
};
}*/
return null;
}
}
}
| 30.294118 | 101 | 0.535922 | [
"MIT"
] | HBSTech/Kentico13CoreBaseline | MVC/MVC/RepositoryLibrary/Implementation/CustomPartialWidgetRenderingRetriever.cs | 1,032 | C# |
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Klaus Potzesny (mailto:Klaus.Potzesny@pdfsharp.com)
//
// Copyright (c) 2001-2009 empira Software GmbH, Cologne (Germany)
//
// http://www.pdfsharp.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using PdfSharp.Drawing;
using MigraDoc;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.IO;
using System.Windows.Markup;
using Color = MigraDoc.DocumentObjectModel.Color;
namespace MigraDoc.Rendering.Windows
{
/// <summary>
/// Interaction logic for DocumentPreview.xaml
/// </summary>
public partial class DocumentPreview : UserControl
{
/// <summary>
/// Initializes a new instance of the <see cref="DocumentPreview"/> class.
/// </summary>
public DocumentPreview()
{
InitializeComponent();
Width = Double.NaN;
Height = Double.NaN;
//this.preview.SetRenderEvent(new PdfSharp.Forms.PagePreview.RenderEvent(RenderPage));
}
/// <summary>
/// Gets or sets a DDL string or file.
/// </summary>
public string Ddl
{
get { return ddl; }
set
{
ddl = value;
DdlUpdated();
}
}
string ddl;
///////// <summary>
///////// Sets a delegate that is invoked when the preview needs to be painted.
///////// </summary>
//////public void SetRenderEvent(RenderEvent renderEvent)
//////{
////// this.renderEvent = renderEvent;
////// Invalidate();
//////}
//////RenderEvent renderEvent;
/// <summary>
/// Gets or sets the current page.
/// </summary>
public int Page
{
get { return page; }
set
{
try
{
if (this.viewer != null)
{
if (this.page != value)
{
this.page = value;
//PageInfo pageInfo = this.renderer.formattedDocument.GetPageInfo(this.page);
//if (pageInfo.Orientation == PdfSharp.PageOrientation.Portrait)
// this.viewer.PageSize = new Size((int)pageInfo.Width, (int)pageInfo.Height);
//else
// this.viewer.PageSize = new Size((int)pageInfo.Height, (int)pageInfo.Width);
//this.viewer.Invalidate();
//OnPageChanged(new EventArgs());
}
}
else
this.page = -1;
}
catch { }
}
}
int page;
/// <summary>
/// Gets the number of pages of the underlying formatted document.
/// </summary>
public int PageCount
{
get
{
if (this.renderer != null)
return this.renderer.FormattedDocument.PageCount;
return 0;
}
}
/// <summary>
/// Goes to the first page.
/// </summary>
public void FirstPage()
{
if (this.renderer != null)
{
Page = 1;
this.viewer.GoToPage(1);
}
}
/// <summary>
/// Goes to the next page.
/// </summary>
public void NextPage()
{
if (this.renderer != null && this.page < PageCount)
{
Page++;
//this.preview.Invalidate();
//OnPageChanged(new EventArgs());
}
}
/// <summary>
/// Goes to the previous page.
/// </summary>
public void PrevPage()
{
if (this.renderer != null && this.page > 1)
{
Page--;
}
}
/// <summary>
/// Goes to the last page.
/// </summary>
public void LastPage()
{
if (this.renderer != null)
{
Page = PageCount;
//this.preview.Invalidate();
//OnPageChanged(new EventArgs());
}
}
/// <summary>
/// Called when the Ddl property has changed.
/// </summary>
void DdlUpdated()
{
if (this.ddl != null)
{
this.document = DdlReader.DocumentFromString(this.ddl);
this.renderer = new DocumentRenderer(document);
//this.renderer.PrivateFonts = this.privateFonts;
this.renderer.PrepareDocument();
//IDocumentPaginatorSource source = this.documentViewer.Document;
//IDocumentPaginatorSource source = this.documentViewer.Document;
int pageCount = this.renderer.FormattedDocument.PageCount;
if (pageCount == 0)
return;
// HACK: hardcoded A4 size
//double pageWidth = XUnit.FromMillimeter(210).Presentation;
//double pageHeight = XUnit.FromMillimeter(297).Presentation;
//Size a4 = new Size(pageWidth, pageHeight);
XUnit pageWidth, pageHeight;
Size size96 = GetSizeOfPage(1, out pageWidth, out pageHeight);
FixedDocument fixedDocument = new FixedDocument();
fixedDocument.DocumentPaginator.PageSize = size96;
for (int pageNumber = 1; pageNumber <= pageCount; pageNumber++)
{
try
{
size96 = GetSizeOfPage(1, out pageWidth, out pageHeight);
DrawingVisual dv = new DrawingVisual();
DrawingContext dc = dv.RenderOpen();
//XGraphics gfx = XGraphics.FromDrawingContext(dc, new XSize(XUnit.FromMillimeter(210).Point, XUnit.FromMillimeter(297).Point), XGraphicsUnit.Point);
XGraphics gfx = XGraphics.FromDrawingContext(dc, new XSize(pageWidth.Point, pageHeight.Presentation), XGraphicsUnit.Point);
this.renderer.RenderPage(gfx, pageNumber, PageRenderOptions.All);
dc.Close();
// Create page content
PageContent pageContent = new PageContent();
pageContent.Width = size96.Width;
pageContent.Height = size96.Height;
FixedPage fixedPage = new FixedPage();
fixedPage.Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(0xFE, 0xFE, 0xFE));
UIElement visual = new DrawingVisualPresenter(dv);
FixedPage.SetLeft(visual, 0);
FixedPage.SetTop(visual, 0);
fixedPage.Width = size96.Width;
fixedPage.Height =size96.Height;
fixedPage.Children.Add(visual);
fixedPage.Measure(size96);
fixedPage.Arrange(new Rect(new Point(), size96));
fixedPage.UpdateLayout();
((IAddChild)pageContent).AddChild(fixedPage);
fixedDocument.Pages.Add(pageContent);
}
catch (Exception)
{
// eat exception
}
this.viewer.Document = fixedDocument;
}
}
else
this.viewer.Document = null;
}
Size GetSizeOfPage(int page, out XUnit width, out XUnit height)
{
PageInfo pageInfo = this.renderer.formattedDocument.GetPageInfo(page);
if (pageInfo.Orientation == PdfSharp.PageOrientation.Portrait)
{
width = pageInfo.Width;
height = pageInfo.Height;
}
else
{
width = pageInfo.Height;
height = pageInfo.Width;
}
return new Size(width.Presentation, height.Presentation);
}
/// <summary>
/// Gets or sets the MigraDoc document that is previewed in this control.
/// </summary>
public Document Document
{
get { return this.document; }
set
{
if (value != null)
{
this.document = value;
this.renderer = new DocumentRenderer(value);
this.renderer.PrepareDocument();
Page = 1;
//this.preview.Invalidate();
}
else
{
this.document = null;
this.renderer = null;
//this.preview.Invalidate();
}
}
}
Document document;
/// <summary>
/// Gets the underlying DocumentRenderer of the document currently in preview, or null, if no rederer exists.
/// You can use this renderer for printing or creating PDF file. This evades the necessity to format the
/// document a second time when you want to print it and convert it into PDF.
/// </summary>
public DocumentRenderer Renderer
{
get { return this.renderer; }
}
DocumentRenderer renderer;
/// <summary>
/// Helper class to render a single visual.
/// </summary>
public class DrawingVisualPresenter : FrameworkElement
{
/// <summary>
/// Initializes a new instance of the <see cref="DrawingVisualPresenter"/> class.
/// </summary>
public DrawingVisualPresenter(DrawingVisual visual)
{
this.visual = visual;
}
/// <summary>
/// Gets the number of visual child elements within this element, which is 1 in this class.
/// </summary>
protected override int VisualChildrenCount
{
get { return 1; }
}
/// <summary>
/// Overrides <see cref="M:System.Windows.Media.Visual.GetVisualChild(System.Int32)"/>, and returns a child at the specified index from a collection of child elements.
/// </summary>
protected override Visual GetVisualChild(int index)
{
if (index != 0)
throw new ArgumentOutOfRangeException("index");
return visual;
}
readonly DrawingVisual visual;
}
}
}
| 29.613445 | 173 | 0.608872 | [
"MIT"
] | HiraokaHyperTools/PDFsharp | MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering.Windows/DocumentPreview.xaml.cs | 10,574 | C# |
// This is a modified version of the code from https://github.com/Flufd/NanoDotNet/blob/master/NanoDotNet/NanoRpcClient.cs
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
namespace Nano.Net
{
public class RpcClient
{
public string NodeAddress { get; }
private readonly HttpClient _httpClient = new HttpClient();
private readonly JsonSerializerSettings _jsonSerializerSettings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
ContractResolver = new DefaultContractResolver()
{
NamingStrategy = new SnakeCaseNamingStrategy()
}
};
/// <summary>
/// Create a new RpcClient connected to a local node.
/// </summary>
public RpcClient()
{
NodeAddress = "http://localhost:7076";
}
/// <summary>
/// Initialize rpc with a specific uri.
/// </summary>
/// <param name="nodeUri">Example: Http://192.168.0.1:7076</param>
public RpcClient(string nodeUri)
{
NodeAddress = nodeUri;
}
private async Task<T> RpcRequestAsync<T>(object request)
{
var content = new StringContent(JsonConvert.SerializeObject(request, _jsonSerializerSettings), Encoding.UTF8, "application/json");
HttpResponseMessage response = await _httpClient.PostAsync(NodeAddress, content);
string json = await response.Content.ReadAsStringAsync();
if (json.Contains("\"error\":"))
{
JObject errorMessage = JObject.Parse(json);
throw new RpcException(errorMessage["error"]?.ToString());
}
return JsonConvert.DeserializeObject<T>(json);
}
// Raw node RPC calls
/// <summary>
/// Get information about a Nano account.
/// </summary>
public async Task<AccountInfoResponse> AccountInfoAsync(string address, bool representative = true, bool pending = true, bool weight = true, bool confirmed = true)
{
try
{
return await RpcRequestAsync<AccountInfoResponse>(new
{
Action = "account_info",
Account = address,
Representative = representative,
Pending = pending,
Weight = weight,
IncludeConfirmed = confirmed
});
}
catch (RpcException exception)
{
if (exception.OriginalError == "Account not found")
throw new UnopenedAccountException();
else
throw;
}
}
public async Task<AccountsFrontiersResponse> AccountsFrontiersAsync(string[] accounts)
{
return await RpcRequestAsync<AccountsFrontiersResponse>(new
{
Action = "accounts_frontiers",
Accounts = accounts
});
}
public async Task<AccountHistoryResponse> AccountHistoryAsync(string address, int count = 10)
{
return await RpcRequestAsync<AccountHistoryResponse>(new
{
Action = "account_history",
Account = address,
Count = count
});
}
/// <summary>
/// Generate a work nonce for a hash using the node.
/// </summary>
/// <remarks>
/// WARNING: This command is usually disabled on public nodes. You need to use your own node.
/// </remarks>
public async Task<WorkGenerateResponse> WorkGenerateAsync(string hash, string difficulty = null)
{
return await RpcRequestAsync<WorkGenerateResponse>(new
{
Action = "work_generate",
Hash = hash,
Difficulty = difficulty
});
}
/// <summary>
/// Check whether work is valid for block.
/// ValidAll is true if the work is valid at the current network difficulty (work can be used for any block).
/// ValidReceive is true if the work is valid for use in a receive block.
/// </summary>
public async Task<WorkValidateResponse> ValidateWorkAsync(string work, string hash)
{
return await RpcRequestAsync<WorkValidateResponse>(new
{
Action = "work_validate",
Work = work,
Hash = hash
});
}
/// <summary>
/// Gets the pending/receivable blocks for an account.
/// </summary>
public async Task<ReceivableBlocksResponse> PendingBlocksAsync(string address, int count = 5)
{
var pendingBlocks = await RpcRequestAsync<ReceivableBlocksResponse>(new
{
Action = "pending",
Account = address,
Count = count.ToString(),
Source = true,
IncludeOnlyConfirmed = true
});
if (pendingBlocks?.PendingBlocks != null)
foreach ((string key, ReceivableBlock value) in pendingBlocks?.PendingBlocks)
value.Hash = key;
return pendingBlocks;
}
public async Task<BlockInfoResponse> BlockInfoAsync(string hash)
{
return await RpcRequestAsync<BlockInfoResponse>(new
{
Action = "block_info",
json_block = "true",
Hash = hash
});
}
/// <summary>
/// Publishes a Block to the network.
/// </summary>
/// <exception cref="Exception">If the block signature or work nonce hasn't been set.</exception>
public async Task<ProcessResponse> ProcessAsync(Block block)
{
if (block.Signature is null)
throw new IncompleteBlockException("This block hasn't been signed yet.");
if (block.Work is null)
throw new IncompleteBlockException("The PoW nonce for this block hasn't been set.");
return await RpcRequestAsync<ProcessResponse>(new
{
Action = "process",
JsonBlock = true,
Subtype = block.Subtype,
Block = block
});
}
public async Task<AccountsBalancesResponse> AccountsBalancesAsync(string[] accounts)
{
return await RpcRequestAsync<AccountsBalancesResponse>(new
{
Action = "accounts_balances",
Accounts = accounts
});
}
/// <summary>
/// Returns a list of confirmed block hashes which have not yet been received by these accounts
/// </summary>
public async Task<AccountsPendingResponse> AccountsPendingAsync(string[] accounts, int count = 5)
{
var receivableBlocks = await RpcRequestAsync<AccountsPendingResponse>(new
{
Action = "accounts_pending",
Accounts = accounts,
Source = true,
Count = count
});
// AccountsPendingResponse.Blocks is null if the requested accounts have no receivable blocks
receivableBlocks.Blocks ??= new Dictionary<string, Dictionary<string, ReceivableBlock>>();
foreach (var address in receivableBlocks.Blocks)
{
if (address.Value is null)
continue;
foreach (var block in address.Value)
block.Value.Hash = block.Key;
}
return receivableBlocks;
}
// Custom calls
/// <summary>
/// Update an Account object's properties with relevant information from the network.
/// </summary>
public async Task UpdateAccountAsync(Account account)
{
AccountInfoResponse accountInfo;
try
{
accountInfo = await AccountInfoAsync(account.Address);
}
catch (UnopenedAccountException)
{
account.Opened = false;
account.Frontier = new string('0', 64);
account.Balance = Amount.FromRaw("0");
account.Representative = account.Address;
return;
}
account.Opened = true;
account.Frontier = accountInfo.Frontier;
account.Balance = Amount.FromRaw(accountInfo.Balance);
account.Representative = accountInfo.Representative;
}
}
}
| 34.546512 | 171 | 0.55189 | [
"MIT"
] | RestoreMonarchy/Nano.Net | Nano.Net/RpcClient.cs | 8,915 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp
{
internal sealed partial class LocalRewriter
{
public override BoundNode VisitConditionalAccess(BoundConditionalAccess node)
{
// Never returns null when used is true.
return RewriteConditionalAccess(node, used: true)!;
}
public override BoundNode VisitLoweredConditionalAccess(BoundLoweredConditionalAccess node)
{
throw ExceptionUtilities.Unreachable;
}
// null when currently enclosing conditional access node
// is not supposed to be lowered.
private BoundExpression? _currentConditionalAccessTarget;
private int _currentConditionalAccessID;
private enum ConditionalAccessLoweringKind
{
LoweredConditionalAccess,
Conditional,
ConditionalCaptureReceiverByVal
}
// IL gen can generate more compact code for certain conditional accesses
// by utilizing stack dup/pop instructions
internal BoundExpression? RewriteConditionalAccess(BoundConditionalAccess node, bool used)
{
Debug.Assert(!_inExpressionLambda);
Debug.Assert(node.AccessExpression.Type is { });
var loweredReceiver = this.VisitExpression(node.Receiver);
Debug.Assert(loweredReceiver.Type is { });
var receiverType = loweredReceiver.Type;
// Check trivial case
if (loweredReceiver.IsDefaultValue() && receiverType.IsReferenceType)
{
return _factory.Default(node.Type);
}
ConditionalAccessLoweringKind loweringKind;
// dynamic receivers are not directly supported in codegen and need to be lowered to a conditional
var lowerToConditional = node.AccessExpression.Type.IsDynamic();
if (!lowerToConditional)
{
// trivial cases are directly supported in IL gen
loweringKind = ConditionalAccessLoweringKind.LoweredConditionalAccess;
}
else if (CanChangeValueBetweenReads(loweredReceiver))
{
// NOTE: dynamic operations historically do not propagate mutations
// to the receiver if that happens to be a value type
// so we can capture receiver by value in dynamic case regardless of
// the type of receiver
// Nullable receivers are immutable so should be captured by value as well.
loweringKind = ConditionalAccessLoweringKind.ConditionalCaptureReceiverByVal;
}
else
{
loweringKind = ConditionalAccessLoweringKind.Conditional;
}
var previousConditionalAccessTarget = _currentConditionalAccessTarget;
var currentConditionalAccessID = ++_currentConditionalAccessID;
LocalSymbol? temp = null;
switch (loweringKind)
{
case ConditionalAccessLoweringKind.LoweredConditionalAccess:
_currentConditionalAccessTarget = new BoundConditionalReceiver(
loweredReceiver.Syntax,
currentConditionalAccessID,
receiverType);
break;
case ConditionalAccessLoweringKind.Conditional:
_currentConditionalAccessTarget = loweredReceiver;
break;
case ConditionalAccessLoweringKind.ConditionalCaptureReceiverByVal:
temp = _factory.SynthesizedLocal(receiverType);
_currentConditionalAccessTarget = _factory.Local(temp);
break;
default:
throw ExceptionUtilities.UnexpectedValue(loweringKind);
}
BoundExpression? loweredAccessExpression;
if (used)
{
loweredAccessExpression = this.VisitExpression(node.AccessExpression);
}
else
{
loweredAccessExpression = this.VisitUnusedExpression(node.AccessExpression);
if (loweredAccessExpression == null)
{
return null;
}
}
Debug.Assert(loweredAccessExpression != null);
Debug.Assert(loweredAccessExpression.Type is { });
_currentConditionalAccessTarget = previousConditionalAccessTarget;
TypeSymbol type = this.VisitType(node.Type);
TypeSymbol nodeType = node.Type;
TypeSymbol accessExpressionType = loweredAccessExpression.Type;
if (accessExpressionType.IsVoidType())
{
type = nodeType = accessExpressionType;
}
if (!TypeSymbol.Equals(accessExpressionType, nodeType, TypeCompareKind.ConsiderEverything2) && nodeType.IsNullableType())
{
Debug.Assert(TypeSymbol.Equals(accessExpressionType, nodeType.GetNullableUnderlyingType(), TypeCompareKind.ConsiderEverything2));
loweredAccessExpression = _factory.New((NamedTypeSymbol)nodeType, loweredAccessExpression);
}
else
{
Debug.Assert(TypeSymbol.Equals(accessExpressionType, nodeType, TypeCompareKind.ConsiderEverything2) ||
(nodeType.IsVoidType() && !used));
}
BoundExpression result;
var objectType = _compilation.GetSpecialType(SpecialType.System_Object);
switch (loweringKind)
{
case ConditionalAccessLoweringKind.LoweredConditionalAccess:
Debug.Assert(loweredReceiver.Type is { });
result = new BoundLoweredConditionalAccess(
node.Syntax,
loweredReceiver,
receiverType.IsNullableType() ?
UnsafeGetNullableMethod(node.Syntax, loweredReceiver.Type, SpecialMember.System_Nullable_T_get_HasValue) :
null,
loweredAccessExpression,
null,
currentConditionalAccessID,
type);
break;
case ConditionalAccessLoweringKind.ConditionalCaptureReceiverByVal:
// capture the receiver into a temp
Debug.Assert(temp is { });
loweredReceiver = _factory.MakeSequence(
_factory.AssignmentExpression(_factory.Local(temp), loweredReceiver),
_factory.Local(temp));
goto case ConditionalAccessLoweringKind.Conditional;
case ConditionalAccessLoweringKind.Conditional:
{
// (object)r != null ? access : default(T)
var condition = _factory.ObjectNotEqual(
_factory.Convert(objectType, loweredReceiver),
_factory.Null(objectType));
var consequence = loweredAccessExpression;
result = RewriteConditionalOperator(node.Syntax,
condition,
consequence,
_factory.Default(nodeType),
null,
nodeType,
isRef: false);
if (temp != null)
{
result = _factory.MakeSequence(temp, result);
}
}
break;
default:
throw ExceptionUtilities.UnexpectedValue(loweringKind);
}
return result;
}
public override BoundNode VisitConditionalReceiver(BoundConditionalReceiver node)
{
var newtarget = _currentConditionalAccessTarget;
Debug.Assert(newtarget is { Type: { } });
if (newtarget.Type.IsNullableType())
{
newtarget = MakeOptimizedGetValueOrDefault(node.Syntax, newtarget);
}
return newtarget;
}
}
}
| 39.808219 | 145 | 0.571461 | [
"MIT"
] | 333fred/roslyn | src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ConditionalAccess.cs | 8,720 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MediaCategorie
{
static class Program
{
/// <summary>
/// Punto di ingresso principale dell'applicazione.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
| 22.565217 | 65 | 0.620424 | [
"Apache-2.0"
] | LucaMazzei88/CefiCourse | Prova di Esame/MediaCategorie/MediaCategorie/Program.cs | 521 | C# |
using ISAAR.MSolve.LinearAlgebra.Commons;
using ISAAR.MSolve.LinearAlgebra.Vectors;
namespace ISAAR.MSolve.LinearAlgebra.Matrices.Operators
{
/// <summary>
/// Efficient implementation for permutation matrices, namely matrices that change the order of vector entries, matrix rows
/// or matrix columns.
/// Authors: Serafeim Bakalakos
/// </summary>
public class PermutationMatrix
{
private readonly int order;
private readonly int[] data;
private PermutationMatrix(int order, int[] data)
{
this.order = order;
this.data = data;
}
/// <summary>
/// The number of columns of the permutation matrix.
/// </summary>
public int NumColumns { get { return order; } }
/// <summary>
/// The number of rows of the permutation matrix.
/// </summary>
public int NumRows { get { return order; } }
/// <summary>
/// Initializes a new instance of <see cref="PermutationMatrix"/> that is equal to the identity matrix, namely a square
/// matrix with non-diagonal entries being equal to 0 and diagonal entries being equal to 1. This permutation does not
/// change modify the vector/matrix it is applied to. However, it can be used as a starting point to define other
/// permutations.
/// </summary>
/// <param name="order">The number of rows/columns of the identity matrix.</param>
public static PermutationMatrix CreateIdentity(int order)
{
var data = new int[order];
for (int i = 0; i < order; ++i) data[i] = i;
return new PermutationMatrix(order, data);
}
/// <summary>
/// Modifies this <see cref="PermutationMatrix"/> instance, such that it defines a row-exchange operation:
/// <paramref name="rowIdx1"/> becomes <paramref name="rowIdx2"/> and vice versa.
/// </summary>
/// <param name="rowIdx1">The index of the first row to exchange.</param>
/// <param name="rowIdx2">The index of the second row to exchange.</param>
public void ExchangeRows(int rowIdx1, int rowIdx2)
{
int swap = data[rowIdx1];
data[rowIdx1] = data[rowIdx2];
data[rowIdx2] = swap;
}
/// <summary>
/// Multiplies this permutation matrix or its transpose with a vector: result = oper(this) * <paramref name="vector"/>.
/// This is equivalent to applying the permutation defined by this <see cref="PermutationMatrix"/> to
/// <paramref name="vector"/>. If (<paramref name="transposeThis"/> == true) this permutation is new-to-old:
/// result[i] = <paramref name="vector"/>[permutation[i]]. Otherwise it is old-to-new:
/// result[permutation[i]] = <paramref name="vector"/>[i]
/// </summary>
/// <param name="vector">A vector with <see cref="IIndexable1D.Length"/> being equal to the <see cref="NumColumns"/>
/// of oper(this).</param>
/// <param name="transposeThis">If true, oper(this) = transpose(this). Otherwise oper(this) = this.</param>
/// <exception cref="NonMatchingDimensionsException">Thrown if the <see cref="IIndexable1D.Length"/> of
/// <paramref name="vector"/> is different than the <see cref="NumColumns"/> of oper(this).</exception>
public Vector MultiplyRight(Vector vector, bool transposeThis)
{
Preconditions.CheckMultiplicationDimensions(order, vector.Length);
var result = new double[order];
if (transposeThis)
{
for (int i = 0; i < order; ++i) result[i] = vector[data[i]]; // Verify this
}
else
{
for (int i = 0; i < order; ++i) result[data[i]] = vector[i];
}
return Vector.CreateFromArray(result, false);
}
}
}
| 45.045455 | 128 | 0.597124 | [
"Apache-2.0"
] | TheoChristo/MSolve.Bio | ISAAR.MSolve.LinearAlgebra/Matrices/Operators/PermutationMatrix.cs | 3,966 | C# |
namespace Termie
{
partial class AboutBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox));
this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.logoPictureBox = new System.Windows.Forms.PictureBox();
this.labelProductName = new System.Windows.Forms.Label();
this.labelVersion = new System.Windows.Forms.Label();
this.labelCopyright = new System.Windows.Forms.Label();
this.labelCompanyName = new System.Windows.Forms.Label();
this.textBoxDescription = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.tableLayoutPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit();
this.SuspendLayout();
//
// tableLayoutPanel
//
this.tableLayoutPanel.ColumnCount = 2;
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F));
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F));
this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0);
this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0);
this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1);
this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2);
this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3);
this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4);
this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5);
this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 6;
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.tableLayoutPanel.Size = new System.Drawing.Size(417, 265);
this.tableLayoutPanel.TabIndex = 0;
//
// logoPictureBox
//
this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image")));
this.logoPictureBox.Location = new System.Drawing.Point(3, 3);
this.logoPictureBox.Name = "logoPictureBox";
this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6);
this.logoPictureBox.Size = new System.Drawing.Size(131, 259);
this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.logoPictureBox.TabIndex = 12;
this.logoPictureBox.TabStop = false;
//
// labelProductName
//
this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelProductName.Location = new System.Drawing.Point(143, 0);
this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17);
this.labelProductName.Name = "labelProductName";
this.labelProductName.Size = new System.Drawing.Size(271, 17);
this.labelProductName.TabIndex = 19;
this.labelProductName.Text = "Product Name";
this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// labelVersion
//
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelVersion.Location = new System.Drawing.Point(143, 26);
this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17);
this.labelVersion.Name = "labelVersion";
this.labelVersion.Size = new System.Drawing.Size(271, 17);
this.labelVersion.TabIndex = 0;
this.labelVersion.Text = "Version";
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// labelCopyright
//
this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelCopyright.Location = new System.Drawing.Point(143, 52);
this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17);
this.labelCopyright.Name = "labelCopyright";
this.labelCopyright.Size = new System.Drawing.Size(271, 17);
this.labelCopyright.TabIndex = 21;
this.labelCopyright.Text = "Copyright";
this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// labelCompanyName
//
this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill;
this.labelCompanyName.Location = new System.Drawing.Point(143, 78);
this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0);
this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 17);
this.labelCompanyName.Name = "labelCompanyName";
this.labelCompanyName.Size = new System.Drawing.Size(271, 17);
this.labelCompanyName.TabIndex = 22;
this.labelCompanyName.Text = "Company Name";
this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// textBoxDescription
//
this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBoxDescription.Location = new System.Drawing.Point(143, 107);
this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.textBoxDescription.Multiline = true;
this.textBoxDescription.Name = "textBoxDescription";
this.textBoxDescription.ReadOnly = true;
this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxDescription.Size = new System.Drawing.Size(271, 126);
this.textBoxDescription.TabIndex = 23;
this.textBoxDescription.TabStop = false;
this.textBoxDescription.Text = "Description";
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.okButton.Location = new System.Drawing.Point(339, 239);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 24;
this.okButton.Text = "&OK";
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// AboutBox
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(435, 283);
this.Controls.Add(this.tableLayoutPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutBox";
this.Padding = new System.Windows.Forms.Padding(9);
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "AboutBox";
this.tableLayoutPanel.ResumeLayout(false);
this.tableLayoutPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
private System.Windows.Forms.PictureBox logoPictureBox;
private System.Windows.Forms.Label labelProductName;
private System.Windows.Forms.Label labelVersion;
private System.Windows.Forms.Label labelCopyright;
private System.Windows.Forms.Label labelCompanyName;
private System.Windows.Forms.TextBox textBoxDescription;
private System.Windows.Forms.Button okButton;
}
}
| 55.031915 | 159 | 0.642567 | [
"Unlicense"
] | EIDOSDATA/Awexome_Ray | SerialCommunication_CS/REF DATA/Termie/AboutBox.Designer.cs | 10,346 | 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 synthetics-2017-10-11.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.Synthetics.Model
{
/// <summary>
/// Container for the parameters to the UntagResource operation.
/// Removes one or more tags from the specified canary.
/// </summary>
public partial class UntagResourceRequest : AmazonSyntheticsRequest
{
private string _resourceArn;
private List<string> _tagKeys = new List<string>();
/// <summary>
/// Gets and sets the property ResourceArn.
/// <para>
/// The ARN of the canary that you're removing tags from.
/// </para>
///
/// <para>
/// The ARN format of a canary is <code>arn:aws:synthetics:<i>Region</i>:<i>account-id</i>:canary:<i>canary-name</i>
/// </code>.
/// </para>
/// </summary>
[AWSProperty(Required=true)]
public string ResourceArn
{
get { return this._resourceArn; }
set { this._resourceArn = value; }
}
// Check to see if ResourceArn property is set
internal bool IsSetResourceArn()
{
return this._resourceArn != null;
}
/// <summary>
/// Gets and sets the property TagKeys.
/// <para>
/// The list of tag keys to remove from the resource.
/// </para>
/// </summary>
[AWSProperty(Required=true, Min=1, Max=50)]
public List<string> TagKeys
{
get { return this._tagKeys; }
set { this._tagKeys = value; }
}
// Check to see if TagKeys property is set
internal bool IsSetTagKeys()
{
return this._tagKeys != null && this._tagKeys.Count > 0;
}
}
} | 31.072289 | 124 | 0.609151 | [
"Apache-2.0"
] | NGL321/aws-sdk-net | sdk/src/Services/Synthetics/Generated/Model/UntagResourceRequest.cs | 2,579 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
public class Engine
{
private NationsBuilder nation;
public Engine()
{
this.nation = new NationsBuilder();
}
public void Run()
{
var command = Console.ReadLine();
while (command != "Quit")
{
var param = command.Split().ToList();
var commandWord = param[0];
param.RemoveAt(0);
switch (commandWord)
{
case "Bender":
nation.AssignBender(param);
break;
case "Monument":
nation.AssignMonument(param);
break;
case "Status":
Console.WriteLine(nation.GetStatus(param[0]));
break;
case "War":
nation.IssueWar(param[0]);
break;
}
command = Console.ReadLine();
}
Console.WriteLine(nation.GetWarsRecord());
}
} | 23.12766 | 66 | 0.450782 | [
"MIT"
] | NadiaKaradjova/SoftUni | C# OOP Basics/Exam Preparation II/Avatar/Core/Engine.cs | 1,089 | C# |
using System;
using MikhailKhalizev.Processor.x86.BinToCSharp;
namespace MikhailKhalizev.Max.Program
{
public partial class RawProgram
{
[MethodInfo("0x1012_09c8-2718019e")]
public void Method_1012_09c8()
{
ii(0x1012_09c8, 5); push(0x24); /* push 0x24 */
ii(0x1012_09cd, 5); call(Definitions.sys_check_available_stack_size, 0x4_5380);/* call 0x10165d52 */
ii(0x1012_09d2, 1); push(ebx); /* push ebx */
ii(0x1012_09d3, 1); push(ecx); /* push ecx */
ii(0x1012_09d4, 1); push(edx); /* push edx */
ii(0x1012_09d5, 1); push(esi); /* push esi */
ii(0x1012_09d6, 1); push(edi); /* push edi */
ii(0x1012_09d7, 1); push(ebp); /* push ebp */
ii(0x1012_09d8, 2); mov(ebp, esp); /* mov ebp, esp */
ii(0x1012_09da, 6); sub(esp, 8); /* sub esp, 0x8 */
ii(0x1012_09e0, 3); mov(memd[ss, ebp - 4], eax); /* mov [ebp-0x4], eax */
ii(0x1012_09e3, 3); mov(eax, memd[ss, ebp - 4]); /* mov eax, [ebp-0x4] */
ii(0x1012_09e6, 4); mov(ax, memw[ds, eax + 15]); /* mov ax, [eax+0xf] */
ii(0x1012_09ea, 3); mov(memd[ss, ebp - 8], eax); /* mov [ebp-0x8], eax */
ii(0x1012_09ed, 3); mov(eax, memd[ss, ebp - 8]); /* mov eax, [ebp-0x8] */
ii(0x1012_09f0, 2); mov(esp, ebp); /* mov esp, ebp */
ii(0x1012_09f2, 1); pop(ebp); /* pop ebp */
ii(0x1012_09f3, 1); pop(edi); /* pop edi */
ii(0x1012_09f4, 1); pop(esi); /* pop esi */
ii(0x1012_09f5, 1); pop(edx); /* pop edx */
ii(0x1012_09f6, 1); pop(ecx); /* pop ecx */
ii(0x1012_09f7, 1); pop(ebx); /* pop ebx */
ii(0x1012_09f8, 1); ret(); /* ret */
}
}
}
| 63.540541 | 114 | 0.395151 | [
"Apache-2.0"
] | mikhail-khalizev/max | source/MikhailKhalizev.Max/source/Program/Auto/z-1012-09c8.cs | 2,351 | C# |
using Core;
using System.Collections.Generic;
namespace Action
{
public interface IActionInfo : IEventDispatcher
{
ActionType type { get; }
ActionState state { get; set; }
bool paused { get; set; }
float speed { get; set; }
float progress { get; set; }
bool ready { get; set; }
DependType[] dependTypes { get; }
string[] dependDescripts { get; }
string[] dependActorIndexes { get; set; }
void InjectDepends(object[] depends);
bool IsDependValid();
void InjectCondition(ConditionType type, float val = 0);
IActionInfo Clone();
ICollection<ICondition> Keys { get; }
ICollection<IActionInfo> Values { get; }
IActionInfo this[ICondition key] { get; set; }
void Add(ICondition key, IActionInfo value);
bool ContainsKey(ICondition key);
bool Remove(ICondition key);
void Clear();
}
}
| 20.795918 | 65 | 0.564279 | [
"MIT"
] | SylarLi/ActionEditor | ActionEditor/Assets/Runtime/Action/Core/IActionInfo.cs | 1,021 | C# |
using Altinn.Platform.Register.Models;
using System.Threading.Tasks;
namespace LocalTest.Services.Register.Interface
{
/// <summary>
/// Interface handling methods for operations related to parties
/// </summary>
public interface IParties
{
/// <summary>
/// Method that fetches a party based on a party id
/// </summary>
/// <param name="partyId">The party id</param>
/// <returns></returns>
Task<Party> GetParty(int partyId);
/// <summary>
/// Method that looks up a party id based on social security number or organisation number.
/// </summary>
/// <param name="lookupValue">SSN or org number</param>
/// <returns></returns>
Task<int> LookupPartyIdBySSNOrOrgNo(string lookupValue);
/// <summary>
/// Method that fetches a party based on social security number or organisation number.
/// </summary>
/// <param name="lookupValue">SSN or org number</param>
/// <returns></returns>
Task<Party> LookupPartyBySSNOrOrgNo(string lookupValue);
}
}
| 33.787879 | 99 | 0.617937 | [
"BSD-3-Clause"
] | Altinn/altinn-studio | src/development/LocalTest/Services/Register/Interface/IParties.cs | 1,115 | C# |
/* ****************************************************************************
*
* Copyright (c) Microsoft Corporation.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0. A
* copy of the license can be found in the License.html file at the root of this distribution. If
* you cannot locate the Apache License, Version 2.0, please send an email to
* vspython@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
* by the terms of the Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*
* ***************************************************************************/
using System;
namespace Microsoft.PythonTools.Profiling {
public class AvailableProject {
private readonly EnvDTE.Project _project;
public AvailableProject(EnvDTE.Project project) {
_project = project;
}
public string Name {
get {
return _project.Name;
}
}
public Guid Guid {
get {
return new Guid(_project.Properties.Item("Guid").Value as string);
}
}
public override string ToString() {
return Name;
}
}
}
| 30.372093 | 98 | 0.545942 | [
"Apache-2.0"
] | rsumner33/PTVS | Release/Product/Python/Profiling/Profiling/AvailableProject.cs | 1,308 | C# |
// <auto-generated />
using System;
using FMS.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace FMS.Migrations
{
[DbContext(typeof(FMSDbContext))]
partial class FMSDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.1-servicing-10028")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Abp.Application.Editions.Edition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.HasKey("Id");
b.ToTable("AbpEditions");
});
modelBuilder.Entity("Abp.Application.Features.FeatureSetting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.ToTable("AbpFeatures");
b.HasDiscriminator<string>("Discriminator").HasValue("FeatureSetting");
});
modelBuilder.Entity("Abp.Auditing.AuditLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BrowserInfo")
.HasMaxLength(512);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<string>("CustomData")
.HasMaxLength(2000);
b.Property<string>("Exception")
.HasMaxLength(2000);
b.Property<int>("ExecutionDuration");
b.Property<DateTime>("ExecutionTime");
b.Property<int?>("ImpersonatorTenantId");
b.Property<long?>("ImpersonatorUserId");
b.Property<string>("MethodName")
.HasMaxLength(256);
b.Property<string>("Parameters")
.HasMaxLength(1024);
b.Property<string>("ReturnValue");
b.Property<string>("ServiceName")
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "ExecutionDuration");
b.HasIndex("TenantId", "ExecutionTime");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpAuditLogs");
});
modelBuilder.Entity("Abp.Authorization.PermissionSetting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<bool>("IsGranted");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpPermissions");
b.HasDiscriminator<string>("Discriminator").HasValue("PermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType")
.HasMaxLength(256);
b.Property<string>("ClaimValue");
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("TenantId", "ClaimType");
b.ToTable("AbpRoleClaims");
});
modelBuilder.Entity("Abp.Authorization.Users.UserAccount", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("EmailAddress")
.HasMaxLength(256);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.Property<long?>("UserLinkId");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("EmailAddress");
b.HasIndex("UserName");
b.HasIndex("TenantId", "EmailAddress");
b.HasIndex("TenantId", "UserId");
b.HasIndex("TenantId", "UserName");
b.ToTable("AbpUserAccounts");
});
modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType")
.HasMaxLength(256);
b.Property<string>("ClaimValue");
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "ClaimType");
b.ToTable("AbpUserClaims");
});
modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "UserId");
b.HasIndex("TenantId", "LoginProvider", "ProviderKey");
b.ToTable("AbpUserLogins");
});
modelBuilder.Entity("Abp.Authorization.Users.UserLoginAttempt", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BrowserInfo")
.HasMaxLength(512);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<byte>("Result");
b.Property<string>("TenancyName")
.HasMaxLength(64);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.Property<string>("UserNameOrEmailAddress")
.HasMaxLength(255);
b.HasKey("Id");
b.HasIndex("UserId", "TenantId");
b.HasIndex("TenancyName", "UserNameOrEmailAddress", "Result");
b.ToTable("AbpUserLoginAttempts");
});
modelBuilder.Entity("Abp.Authorization.Users.UserOrganizationUnit", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<bool>("IsDeleted");
b.Property<long>("OrganizationUnitId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "OrganizationUnitId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserOrganizationUnits");
});
modelBuilder.Entity("Abp.Authorization.Users.UserRole", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "RoleId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserRoles");
});
modelBuilder.Entity("Abp.Authorization.Users.UserToken", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime?>("ExpireDate");
b.Property<string>("LoginProvider")
.HasMaxLength(128);
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.Property<string>("Value")
.HasMaxLength(512);
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Abp.BackgroundJobs.BackgroundJobInfo", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<bool>("IsAbandoned");
b.Property<string>("JobArgs")
.IsRequired()
.HasMaxLength(1048576);
b.Property<string>("JobType")
.IsRequired()
.HasMaxLength(512);
b.Property<DateTime?>("LastTryTime");
b.Property<DateTime>("NextTryTime");
b.Property<byte>("Priority");
b.Property<short>("TryCount");
b.HasKey("Id");
b.HasIndex("IsAbandoned", "NextTryTime");
b.ToTable("AbpBackgroundJobs");
});
modelBuilder.Entity("Abp.Configuration.Setting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.Property<string>("Value")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Abp.EntityHistory.EntityChange", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("ChangeTime");
b.Property<byte>("ChangeType");
b.Property<long>("EntityChangeSetId");
b.Property<string>("EntityId")
.HasMaxLength(48);
b.Property<string>("EntityTypeFullName")
.HasMaxLength(192);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("EntityChangeSetId");
b.HasIndex("EntityTypeFullName", "EntityId");
b.ToTable("AbpEntityChanges");
});
modelBuilder.Entity("Abp.EntityHistory.EntityChangeSet", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BrowserInfo")
.HasMaxLength(512);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<string>("ExtensionData");
b.Property<int?>("ImpersonatorTenantId");
b.Property<long?>("ImpersonatorUserId");
b.Property<string>("Reason")
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "CreationTime");
b.HasIndex("TenantId", "Reason");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpEntityChangeSets");
});
modelBuilder.Entity("Abp.EntityHistory.EntityPropertyChange", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long>("EntityChangeId");
b.Property<string>("NewValue")
.HasMaxLength(512);
b.Property<string>("OriginalValue")
.HasMaxLength(512);
b.Property<string>("PropertyName")
.HasMaxLength(96);
b.Property<string>("PropertyTypeFullName")
.HasMaxLength(192);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("EntityChangeId");
b.ToTable("AbpEntityPropertyChanges");
});
modelBuilder.Entity("Abp.Localization.ApplicationLanguage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("Icon")
.HasMaxLength(128);
b.Property<bool>("IsDeleted");
b.Property<bool>("IsDisabled");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(10);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpLanguages");
});
modelBuilder.Entity("Abp.Localization.ApplicationLanguageText", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("LanguageName")
.IsRequired()
.HasMaxLength(10);
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Source")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(67108864);
b.HasKey("Id");
b.HasIndex("TenantId", "Source", "LanguageName", "Key");
b.ToTable("AbpLanguageTexts");
});
modelBuilder.Entity("Abp.Notifications.NotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Data")
.HasMaxLength(1048576);
b.Property<string>("DataTypeName")
.HasMaxLength(512);
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("ExcludedUserIds")
.HasMaxLength(131072);
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(96);
b.Property<byte>("Severity");
b.Property<string>("TenantIds")
.HasMaxLength(131072);
b.Property<string>("UserIds")
.HasMaxLength(131072);
b.HasKey("Id");
b.ToTable("AbpNotifications");
});
modelBuilder.Entity("Abp.Notifications.NotificationSubscriptionInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("NotificationName")
.HasMaxLength(96);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("NotificationName", "EntityTypeName", "EntityId", "UserId");
b.HasIndex("TenantId", "NotificationName", "EntityTypeName", "EntityId", "UserId");
b.ToTable("AbpNotificationSubscriptions");
});
modelBuilder.Entity("Abp.Notifications.TenantNotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Data")
.HasMaxLength(1048576);
b.Property<string>("DataTypeName")
.HasMaxLength(512);
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(96);
b.Property<byte>("Severity");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("AbpTenantNotifications");
});
modelBuilder.Entity("Abp.Notifications.UserNotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<int>("State");
b.Property<int?>("TenantId");
b.Property<Guid>("TenantNotificationId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId", "State", "CreationTime");
b.ToTable("AbpUserNotifications");
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(95);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(128);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<long?>("ParentId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("TenantId", "Code");
b.ToTable("AbpOrganizationUnits");
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnitRole", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<bool>("IsDeleted");
b.Property<long>("OrganizationUnitId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "OrganizationUnitId");
b.HasIndex("TenantId", "RoleId");
b.ToTable("AbpOrganizationUnitRoles");
});
modelBuilder.Entity("FMS.Authorization.Roles.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(5000);
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<bool>("IsDefault");
b.Property<bool>("IsDeleted");
b.Property<bool>("IsStatic");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(32);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenantId", "NormalizedName");
b.ToTable("AbpRoles");
});
modelBuilder.Entity("FMS.Authorization.Users.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("AuthenticationSource")
.HasMaxLength(64);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("EmailAddress")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("EmailConfirmationCode")
.HasMaxLength(328);
b.Property<bool>("IsActive");
b.Property<bool>("IsDeleted");
b.Property<bool>("IsEmailConfirmed");
b.Property<bool>("IsLockoutEnabled");
b.Property<bool>("IsPhoneNumberConfirmed");
b.Property<bool>("IsTwoFactorEnabled");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<DateTime?>("LockoutEndDateUtc");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("NormalizedEmailAddress")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("PasswordResetCode")
.HasMaxLength(328);
b.Property<string>("PhoneNumber")
.HasMaxLength(32);
b.Property<string>("SecurityStamp")
.HasMaxLength(128);
b.Property<string>("Surname")
.IsRequired()
.HasMaxLength(64);
b.Property<int?>("TenantId");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenantId", "NormalizedEmailAddress");
b.HasIndex("TenantId", "NormalizedUserName");
b.ToTable("AbpUsers");
});
modelBuilder.Entity("FMS.Currencies.Currency", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("Symbol")
.IsRequired()
.HasMaxLength(4);
b.Property<int>("TenantId");
b.HasKey("Id");
b.ToTable("AppCurrencies");
});
modelBuilder.Entity("FMS.MultiTenancy.Tenant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConnectionString")
.HasMaxLength(1024);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<int?>("EditionId");
b.Property<bool>("IsActive");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("TenancyName")
.IsRequired()
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("EditionId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenancyName");
b.ToTable("AbpTenants");
});
modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b =>
{
b.HasBaseType("Abp.Application.Features.FeatureSetting");
b.Property<int>("EditionId");
b.HasIndex("EditionId", "Name");
b.ToTable("AbpFeatures");
b.HasDiscriminator().HasValue("EditionFeatureSetting");
});
modelBuilder.Entity("Abp.MultiTenancy.TenantFeatureSetting", b =>
{
b.HasBaseType("Abp.Application.Features.FeatureSetting");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpFeatures");
b.HasDiscriminator().HasValue("TenantFeatureSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b =>
{
b.HasBaseType("Abp.Authorization.PermissionSetting");
b.Property<int>("RoleId");
b.HasIndex("RoleId");
b.ToTable("AbpPermissions");
b.HasDiscriminator().HasValue("RolePermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b =>
{
b.HasBaseType("Abp.Authorization.PermissionSetting");
b.Property<long>("UserId");
b.HasIndex("UserId");
b.ToTable("AbpPermissions");
b.HasDiscriminator().HasValue("UserPermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b =>
{
b.HasOne("FMS.Authorization.Roles.Role")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b =>
{
b.HasOne("FMS.Authorization.Users.User")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b =>
{
b.HasOne("FMS.Authorization.Users.User")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserRole", b =>
{
b.HasOne("FMS.Authorization.Users.User")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserToken", b =>
{
b.HasOne("FMS.Authorization.Users.User")
.WithMany("Tokens")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Configuration.Setting", b =>
{
b.HasOne("FMS.Authorization.Users.User")
.WithMany("Settings")
.HasForeignKey("UserId");
});
modelBuilder.Entity("Abp.EntityHistory.EntityChange", b =>
{
b.HasOne("Abp.EntityHistory.EntityChangeSet")
.WithMany("EntityChanges")
.HasForeignKey("EntityChangeSetId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.EntityHistory.EntityPropertyChange", b =>
{
b.HasOne("Abp.EntityHistory.EntityChange")
.WithMany("PropertyChanges")
.HasForeignKey("EntityChangeId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b =>
{
b.HasOne("Abp.Organizations.OrganizationUnit", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
});
modelBuilder.Entity("FMS.Authorization.Roles.Role", b =>
{
b.HasOne("FMS.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("FMS.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("FMS.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("FMS.Authorization.Users.User", b =>
{
b.HasOne("FMS.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("FMS.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("FMS.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("FMS.MultiTenancy.Tenant", b =>
{
b.HasOne("FMS.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("FMS.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("Abp.Application.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId");
b.HasOne("FMS.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b =>
{
b.HasOne("Abp.Application.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b =>
{
b.HasOne("FMS.Authorization.Roles.Role")
.WithMany("Permissions")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b =>
{
b.HasOne("FMS.Authorization.Users.User")
.WithMany("Permissions")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
| 31.571318 | 103 | 0.435264 | [
"MIT"
] | Watapapz/FMS | aspnet-core/src/FMS.EntityFrameworkCore/Migrations/FMSDbContextModelSnapshot.cs | 40,729 | C# |
using System;
using System.IO;
using Abp.Reflection.Extensions;
namespace demoFirstApp
{
/// <summary>
/// Central point for application version.
/// </summary>
public class AppVersionHelper
{
/// <summary>
/// Gets current version of the application.
/// It's also shown in the web page.
/// </summary>
public const string Version = "5.5.0.0";
/// <summary>
/// Gets release (last build) date of the application.
/// It's shown in the web page.
/// </summary>
public static DateTime ReleaseDate => LzyReleaseDate.Value;
private static readonly Lazy<DateTime> LzyReleaseDate = new Lazy<DateTime>(() => new FileInfo(typeof(AppVersionHelper).GetAssembly().Location).LastWriteTime);
}
}
| 29.62963 | 166 | 0.6225 | [
"MIT"
] | MatiasDevop/abp-netcore | aspnet-core/src/demoFirstApp.Core/AppVersionHelper.cs | 802 | C# |
using System;
using CssUI.DOM.Nodes;
namespace CssUI.CSS
{
/// <summary>
/// Represents a styling property which always resolves to an floating point number
/// </summary>
public class NumberProperty : LengthProperty
{
#region Value Overrides
public new double Actual => base.Actual.AsDecimal();
#endregion
#region Constructors
public NumberProperty(AtomicName<ECssPropertyID> CssName, ICssElement Owner, WeakReference<CssComputedStyle> Source, bool Locked)
: base(CssName, Owner, Source, Locked)
{
}
#endregion
}
}
| 26.956522 | 138 | 0.65 | [
"MIT"
] | dsisco11/CssUI | CssUI/CSS/Properties/Typed Properties/NumberProperty.cs | 622 | C# |
// using System;
// using System.Collections.Generic;
// using System.IO;
// using System.Text;
// using System.Threading;
// using System.Threading.Tasks;
// namespace JetBlack.MessageBus.Common.IO
// {
// public static class StreamReadExtensions
// {
// public static Int32 ReadInt32(this Stream stream)
// {
// return stream.ReadFully(new byte[4]).ToInt32();
// }
// public static async Task<Int32> ReadInt32Async(this Stream stream, CancellationToken token)
// {
// return (await stream.ReadFullyAsync(new byte[4], token)).ToInt32();
// }
// public static Int64 ReadInt64(this Stream stream)
// {
// return stream.ReadFully(new byte[8]).ToInt64();
// }
// public static async Task<Int64> ReadInt64Async(this Stream stream, CancellationToken token)
// {
// return (await stream.ReadFullyAsync(new byte[8], token)).ToInt64();
// }
// public static byte[] ReadByteArray(this Stream stream)
// {
// var nbytes = stream.ReadInt32();
// var data = new byte[nbytes];
// var offset = 0;
// while (nbytes > 0)
// {
// var bytesRead = stream.Read(data, offset, nbytes);
// if (bytesRead == 0)
// throw new EndOfStreamException();
// nbytes -= bytesRead;
// offset += bytesRead;
// }
// return data;
// }
// public static async Task<byte[]> ReadByteArrayAsync(this Stream stream, CancellationToken token)
// {
// var nbytes = await stream.ReadInt32Async(token);
// var data = new byte[nbytes];
// var offset = 0;
// while (nbytes > 0)
// {
// var bytesRead = await stream.ReadAsync(data, offset, nbytes, token);
// if (bytesRead == 0)
// throw new EndOfStreamException();
// nbytes -= bytesRead;
// offset += bytesRead;
// }
// return data;
// }
// public static IList<byte[]> ReadArrayOfByteArrays(this Stream stream)
// {
// var count = stream.ReadInt32();
// if (count == 0)
// return null;
// var array = new byte[count][];
// for (var i = 0; i < count; ++i)
// array[i] = stream.ReadByteArray();
// return array;
// }
// public static async Task<IList<byte[]>> ReadArrayOfByteArraysAsync(this Stream stream, CancellationToken token)
// {
// var count = await stream.ReadInt32Async(token);
// if (count == 0)
// return null;
// var array = new byte[count][];
// for (var i = 0; i < count; ++i)
// array[i] = await stream.ReadByteArrayAsync(token);
// return array;
// }
// public static async Task<IList<string>> ReadArrayOfStringsAsync(this Stream stream, CancellationToken token)
// {
// var count = await stream.ReadInt32Async(token);
// if (count == 0)
// return null;
// var array = new string[count];
// for (var i = 0; i < count; ++i)
// array[i] = await stream.ReadStringAsync(token);
// return array;
// }
// public static string ReadString(this Stream stream)
// {
// return ReadString(stream, Encoding.UTF8);
// }
// public static string ReadString(this Stream stream, Encoding encoding)
// {
// var len = stream.ReadInt32();
// return encoding.GetString(stream.ReadFully(new byte[len]));
// }
// public static async Task<string> ReadStringAsync(this Stream stream, CancellationToken token)
// {
// return await ReadStringAsync(stream, Encoding.UTF8, token);
// }
// public static async Task<string> ReadStringAsync(this Stream stream, Encoding encoding, CancellationToken token)
// {
// var len = await stream.ReadInt32Async(token);
// return encoding.GetString(await stream.ReadFullyAsync(new byte[len], token));
// }
// public static byte[] ReadFully(this Stream stream, byte[] buf)
// {
// return stream.ReadFully(buf, 0, buf.Length);
// }
// public static byte[] ReadFully(this Stream stream, byte[] buf, int off, int len)
// {
// if (len < 0)
// throw new IndexOutOfRangeException();
// var n = 0;
// while (n < len)
// {
// var count = stream.Read(buf, off + n, len - n);
// if (count < 0)
// throw new EndOfStreamException();
// n += count;
// }
// return buf;
// }
// public static async Task<byte[]> ReadFullyAsync(this Stream stream, byte[] buf, CancellationToken token)
// {
// return await stream.ReadFullyAsync(buf, 0, buf.Length, token);
// }
// public static async Task<byte[]> ReadFullyAsync(this Stream stream, byte[] buf, int off, int len, CancellationToken token)
// {
// if (len < 0)
// throw new IndexOutOfRangeException();
// var n = 0;
// while (n < len)
// {
// var count = await stream.ReadAsync(buf, off + n, len - n, token);
// if (count < 0)
// throw new EndOfStreamException();
// n += count;
// }
// return buf;
// }
// }
// }
| 36.823171 | 134 | 0.487498 | [
"Apache-2.0"
] | rob-blackbourn/scratch-dotnet | JetBlack.MessageBus/JetBlack.MessageBus.Common/IO/StreamReadExtensions.cs | 6,041 | C# |
////////////////////////////////////////////////////////////////////////////////
//NUnit tests for "EF Core Provider for LCPI OLE DB"
// IBProvider and Contributors. 02.05.2021.
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.Operators.SET_001.GreaterThan.Complete.NullableDECIMAL_6_1.Int64{
////////////////////////////////////////////////////////////////////////////////
using T_DATA1 =System.Nullable<System.Decimal>;
using T_DATA2 =System.Int64;
using T_DATA1_U=System.Decimal;
using T_DATA2_U=System.Int64;
////////////////////////////////////////////////////////////////////////////////
//class TestSet_001__fields__03__NV
public static class TestSet_001__fields__03__NV
{
private const string c_NameOf__TABLE ="TEST_MODIFY_ROW2";
private const string c_NameOf__COL_DATA1 ="COL_DEC_6_1";
private const string c_NameOf__COL_DATA2 ="COL2_BIGINT";
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_DATA1,TypeName="DECIMAL(6,1)")]
public T_DATA1 COL_DATA1 { get; set; }
[Column(c_NameOf__COL_DATA2)]
public T_DATA2 COL_DATA2 { 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_001()
{
using(var cn=LocalCnHelper.CreateCn())
{
cn.Open();
using(var tr=cn.BeginTransaction())
{
//insert new record in external transaction
using(var db=new MyContext(tr))
{
const T_DATA2_U c_value2=4;
System.Int64? testID=Helper__InsertRow(db,null,c_value2);
var recs=db.testTable.Where(r => (r.COL_DATA1 /*OP{*/ > /*}OP*/ r.COL_DATA2) && r.TEST_ID==testID);
foreach(var r in recs)
{
TestServices.ThrowSelectedRow();
}//foreach r
db.CheckTextOfLastExecutedCommand
(new TestSqlTemplate()
.T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL()
.T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL()
.T("WHERE (").N("t",c_NameOf__COL_DATA1).T(" > ").N("t",c_NameOf__COL_DATA2).T(") AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"));
}//using db
tr.Rollback();
}//using tr
}//using cn
}//Test_001
//-----------------------------------------------------------------------
[Test]
public static void Test_002()
{
using(var cn=LocalCnHelper.CreateCn())
{
cn.Open();
using(var tr=cn.BeginTransaction())
{
//insert new record in external transaction
using(var db=new MyContext(tr))
{
const T_DATA2_U c_value2=4;
System.Int64? testID=Helper__InsertRow(db,null,c_value2);
var recs=db.testTable.Where(r => !(r.COL_DATA1 /*OP{*/ > /*}OP*/ r.COL_DATA2) && r.TEST_ID==testID);
foreach(var r in recs)
{
TestServices.ThrowSelectedRow();
}//foreach r
db.CheckTextOfLastExecutedCommand
(new TestSqlTemplate()
.T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL()
.T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL()
.T("WHERE NOT (").N("t",c_NameOf__COL_DATA1).T(" > ").N("t",c_NameOf__COL_DATA2).T(") AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"));
}//using db
tr.Rollback();
}//using tr
}//using cn
}//Test_002
//Helper methods --------------------------------------------------------
private static System.Int64 Helper__InsertRow(MyContext db,
T_DATA1 valueForColData1,
T_DATA2 valueForColData2)
{
var newRecord=new MyContext.TEST_RECORD();
newRecord.COL_DATA1 =valueForColData1;
newRecord.COL_DATA2 =valueForColData2;
db.testTable.Add(newRecord);
db.SaveChanges();
db.CheckTextOfLastExecutedCommand
(new TestSqlTemplate()
.T("INSERT INTO ").N(c_NameOf__TABLE).T(" (").N(c_NameOf__COL_DATA1).T(", ").N(c_NameOf__COL_DATA2).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_001__fields__03__NV
////////////////////////////////////////////////////////////////////////////////
}//namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D3.Query.Operators.SET_001.GreaterThan.Complete.NullableDECIMAL_6_1.Int64
| 32.670807 | 155 | 0.570722 | [
"MIT"
] | ibprovider/Lcpi.EFCore.LcpiOleDb | Tests/General/Source/Work/DBMS/Firebird/V03_0_0/D3/Query/Operators/SET_001/GreaterThan/Complete/NullableDECIMAL_6_1/Int64/TestSet_001__fields__03__NV.cs | 5,262 | 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("EFaturaGoruntuleyici")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EFaturaGoruntuleyici")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("0433f1a3-09c6-420a-b0b9-63dd03a01837")]
// 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.189189 | 84 | 0.748054 | [
"MIT"
] | erhankiyakk/EFaturaGoruntuleyici | EFaturaGoruntuleyici/Properties/AssemblyInfo.cs | 1,416 | C# |
// --- DebugCommands ----------------------------------------------------------
// MIT License
//
// Copyright (c) 2020 Joel Schroyen
//
// 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.Reflection;
using UnityEngine;
public class DebugCommands : MonoBehaviour {
private static DebugCommands s_Instance;
public static DebugCommands Instance {
get {
if (s_Instance == null) {
DebugCommands foundDebugCommands = FindObjectOfType<DebugCommands>();
if (foundDebugCommands != null) {
s_Instance = foundDebugCommands;
} else {
GameObject instance = new GameObject("DebugCommands", typeof(DebugCommands));
DontDestroyOnLoad(instance);
s_Instance = instance.GetComponent<DebugCommands>();
}
}
return s_Instance;
}
}
[Header("GUI Display")]
[SerializeField] private Vector2 m_Offset = new Vector2(10, 10);
[SerializeField] private float m_Width = 200;
[SerializeField] private float m_LineHeight = 20;
[SerializeField, Range(0, 1)] private float m_BackgroundAlpha = 0.4f;
private static GUIStyle s_BoxStyle;
private static Texture2D s_BackgroundTexture;
private GUIStyle BoxStyle {
get {
if (s_BoxStyle == null) {
s_BoxStyle = CreateBoxStyle();
}
return s_BoxStyle;
}
}
private void Awake() {
if (!Application.isEditor) {
enabled = false;
}
if (s_Instance != null && s_Instance != this) {
Debug.LogError("DebugCommands Instance should not already exist!", this);
}
s_Instance = this;
}
public class Command {
public Action Callback;
public KeyCode KeyCode;
public Command(Action callback, KeyCode keyCode) {
Callback = callback;
KeyCode = keyCode;
}
}
private List<Command> m_Commands = new List<Command>();
//TODO maybe we should instead bind many actions to a single key if desired and they're all called.
//TODO support keyboard modifiers, any combination of ctrl+shift+alt
//TODO add groups, and pages
public Command AddDebugCommand(Action callback, KeyCode keyCode) {
foreach (Command command in m_Commands) {
if (command.KeyCode == keyCode) {
string name = command.Callback.GetMethodInfo().Name;
Debug.LogWarning("Debug command " + name + " with keycode " + command.KeyCode + " already exists.");
return null;
}
}
Command newCommand = new Command(callback, keyCode);
m_Commands.Add(newCommand);
return newCommand;
}
public void RemoveCommand(Command command) {
m_Commands.Remove(command);
}
public void RemoveCommand(Action callback) {
for (int i = m_Commands.Count - 1; i >= 0; i--) {
Command command = m_Commands[i];
if (command.Callback == callback) {
m_Commands.Remove(command);
}
}
}
private void Update() {
foreach (Command command in m_Commands) {
if (Input.GetKeyDown(command.KeyCode)) {
command.Callback();
}
}
}
private void OnGUI() {
int debugCommands = m_Commands.Count;
float totalHeight = debugCommands * m_LineHeight;
if (debugCommands == 0) {
return;
}
Vector2 topLeftCorner = new Vector2(Screen.width - m_Offset.x - m_Width - 20, Screen.height - m_Offset.y - totalHeight - 20);
GUI.Box(new Rect(topLeftCorner.x, topLeftCorner.y, m_Width, totalHeight + 20), GUIContent.none, BoxStyle);
for (int i = 0; i < debugCommands; i++) {
Command command = m_Commands[i];
string name = command.Callback.GetMethodInfo().Name;
string key = command.KeyCode.ToString();
string display = name + ": " + key;
GUI.Label(new Rect(topLeftCorner.x + 10.0f, topLeftCorner.y + 10.0f + i * m_LineHeight, m_Width, m_LineHeight), display);
}
}
private void OnValidate() {
s_BoxStyle = null;
}
private GUIStyle CreateBoxStyle() {
GUIStyle boxStyle = new GUIStyle(GUI.skin.box);
s_BackgroundTexture = new Texture2D(2, 2);
Color[] pix = new Color[2*2];
for (int i = 0; i < pix.Length; i++) {
pix[i] = new Color(0, 0, 0, m_BackgroundAlpha);
}
s_BackgroundTexture.SetPixels(pix);
s_BackgroundTexture.Apply();
boxStyle.normal.background = s_BackgroundTexture;
return boxStyle;
}
} | 34.656977 | 133 | 0.604764 | [
"MIT"
] | thatnzguy/DebugCommands | Assets/Plugins/DebugCommands/DebugCommands.cs | 5,963 | C# |
using MedicalGroup.Domains;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MedicalGroup.ViewModels
{
public class PacienteViewModel
{
public Usuarios Usuario { get; set; }
public Pacientes Paciente { get; set; }
}
}
| 20.4 | 47 | 0.715686 | [
"Unlicense"
] | danielroncaglia/Medical-Group | API/MedicalGroup/ViewModels/PacienteViewModel.cs | 308 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using Telerik.JustDecompiler.Ast;
using Telerik.JustDecompiler.Ast.Statements;
using Telerik.JustDecompiler.Decompiler;
using Telerik.JustDecompiler.Ast.Expressions;
using Mono.Cecil.Cil;
using Mono.Cecil;
namespace Telerik.JustDecompiler.Steps
{
class RebuildForeachStatements : BaseCodeVisitor, IDecompilationStep
{
private bool insideTry;
private bool foundEnumeratorAssignment;
private bool foundWhile;
private Expression foreachCollection;
private VariableDefinition foreachVariable;
private BlockStatement foreachBody;
private VariableReference theEnumerator;
private TryStatement theTry;
private ForEachStatement @foreach;
private TypeReference foreachVariableType;
private ExpressionStatement enumeratorAssignmentStatement;
private bool shouldAdd;
private bool isEnumeratorUsedInsideForEach;
private MethodSpecificContext methodContext;
private readonly HashSet<VariableDefinition> foreachVariables = new HashSet<VariableDefinition>();
private readonly List<Instruction> foreachVariableInstructions = new List<Instruction>();
private readonly List<Instruction> foreachCollectionInstructions = new List<Instruction>();
private IEnumerable<Instruction> foreachConditionInstructions;
public RebuildForeachStatements()
{
this.insideTry = false;
this.foundEnumeratorAssignment = false;
this.foundWhile = false;
}
public BlockStatement Process(DecompilationContext context, BlockStatement body)
{
this.methodContext = context.MethodContext;
ClearState();
this.foreachBody = new BlockStatement();
Visit(body);
return body;
}
public override void VisitBlockStatement(BlockStatement node)
{
for (int i = 0; i < node.Statements.Count; i++)
{
int oldCount = node.Statements.Count;
Visit(node.Statements[i]);
int newCount = node.Statements.Count;
if (oldCount > newCount)
{
i -= oldCount - newCount;
}
}
}
public override void VisitTryStatement(TryStatement node)
{
if (!foundEnumeratorAssignment)
{
insideTry = false;
base.VisitTryStatement(node);
return;
}
if (CanContainForeach(node))
{
insideTry = true;
theTry = node;
base.VisitTryStatement(node);
}
insideTry = false;
}
public override void VisitExpressionStatement(ExpressionStatement node)
{
if (!foundWhile)
{
if (IsEnumeratorAssignment(node.Expression))
{
foundEnumeratorAssignment = true;
enumeratorAssignmentStatement = node;
return;
}
}
else
{
if (node.Expression is BinaryExpression)
{
if (!IsForeachVariableAssignment(node.Expression as BinaryExpression))
{
if (shouldAdd)
{
foreachBody.AddStatement(node);
}
}
}
else if (node.Expression is MethodInvocationExpression || node.Expression is PropertyReferenceExpression)
{
if (IsGetCurrent(node.Expression))
{
//covers the case where the foreach variable is not used
this.foreachVariableType = node.Expression.ExpressionType;
}
else
{
if (shouldAdd)
{
foreachBody.AddStatement(node);
}
}
}
else if (node.Expression is CastExpression)
{
CastExpression theCast = node.Expression as CastExpression;
if (IsGetCurrent(theCast.Expression))
{
this.foreachVariableType = theCast.ExpressionType;
}
else
{
if (shouldAdd)
{
foreachBody.AddStatement(node);
}
}
}
else if (node.Expression is BoxExpression)
{
BoxExpression theBox = node.Expression as BoxExpression;
if (IsGetCurrent(theBox.BoxedExpression))
{
this.foreachVariableType = theBox.BoxedAs;
}
else
{
if (shouldAdd)
{
foreachBody.AddStatement(node);
}
}
}
else
{
if (shouldAdd)
{
foreachBody.AddStatement(node);
}
}
}
}
public override void VisitMethodInvocationExpression(MethodInvocationExpression node)
{
if (!foundWhile && (IsGetCurrent(node) || IsMoveNextCall(node)))
{
ClearState();
}
else
{
if (IsGetCurrent(node))
{
foreachVariableType = node.ExpressionType;
}
}
}
public override void VisitPropertyReferenceExpression(PropertyReferenceExpression node)
{
if (!foundWhile && IsGetCurrent(node))
{
//TryStatement ts = theTry;
ClearState();
//theTry = ts;
//insideTry = ts != null;
}
else
{
if (IsGetCurrent(node))
{
foreachVariableType = node.ExpressionType;
}
}
}
public override void VisitWhileStatement(WhileStatement node)
{
if (foundEnumeratorAssignment && insideTry)
{
if (IsForeach(node))
{
BlockStatement tryParent = theTry.Parent as BlockStatement;
if (tryParent == null || tryParent != enumeratorAssignmentStatement.Parent ||
tryParent.Statements.IndexOf(enumeratorAssignmentStatement) + 1 != tryParent.Statements.IndexOf(theTry))
{
ClearState();
base.VisitWhileStatement(node);
return;
}
foreachConditionInstructions = node.Condition.UnderlyingSameMethodInstructions;
foundWhile = true;
shouldAdd = true;
foreach (Statement st in node.Body.Statements)
{
if (!(st is ExpressionStatement))
{
foreachBody.AddStatement(st);
//TODO: Must traverse the statement tree, in order to find GetCurrent method and obtain the type of the foreach
}
else
{
VisitExpressionStatement(st as ExpressionStatement);
}
if (foreachVariableType == null)
{
ForeachElementTypeFinder fet = new ForeachElementTypeFinder(theEnumerator);
fet.Visit(st);
foreachVariableType = fet.ResultingType;
}
}
if (foreachVariableType != null)
{
AttachForeach();
if (isEnumeratorUsedInsideForEach)
{
ClearState();
base.VisitWhileStatement(node);
}
}
else
{
//this can happen if enumerator.get_Current is not called anywhere in the loop.
//in this case there is no foreach.
//think of a better way to
ClearState();
base.VisitWhileStatement(node);
}
}
else
{
ClearState();
base.VisitWhileStatement(node);
}
}
else
{
base.VisitWhileStatement(node);
}
}
private void AttachForeach()
{
GenerateForeachStatement();
if (!isEnumeratorUsedInsideForEach)
{
BlockStatement parentBlock = theTry.Parent as BlockStatement;
parentBlock.Statements.Remove(enumeratorAssignmentStatement);
int tryIndex = parentBlock.Statements.IndexOf(theTry);
parentBlock.Statements.RemoveAt(tryIndex);
parentBlock.AddStatementAt(tryIndex, @foreach);
YieldStateMachineCodeRemover ysmcr = new YieldStateMachineCodeRemover(@foreach, theEnumerator);
ysmcr.ProcessForEachStatement();
CopyLabel();
CheckVariable();
ClearState();
VisitForEachStatement(parentBlock.Statements[tryIndex] as ForEachStatement);
}
}
private void CheckVariable()
{
if (foreachVariables.Contains(foreachVariable))
{
VariableDefinition oldForeachVariable = foreachVariable;
foreachVariable = new VariableDefinition(foreachVariable.VariableType);
foreachVariableInstructions.Clear();
this.methodContext.Variables.Add(foreachVariable);
this.methodContext.VariablesToRename.Add(foreachVariable);
ForeachVariableChanger variableChanger = new ForeachVariableChanger(oldForeachVariable, foreachVariable);
variableChanger.Visit(@foreach);
}
foreachVariables.Add(foreachVariable);
}
private void CopyLabel()
{
if(theTry.Label != string.Empty)
{
@foreach.Label = theTry.Label;
}
else if(theTry.Try.Label != string.Empty)
{
@foreach.Label = theTry.Try.Label;
}
else if(theTry.Try.Statements[0].Label != string.Empty)
{
@foreach.Label = theTry.Try.Statements[0].Label;
}
}
private void ClearState()
{
insideTry = false;
foundEnumeratorAssignment = false;
foundWhile = false;
foreachCollection = null;
foreachVariable = null;
foreachVariableInstructions.Clear();
foreachCollectionInstructions.Clear();
foreachBody = new BlockStatement();
theEnumerator = null;
theTry = null;
@foreach = null;
enumeratorAssignmentStatement = null;
foreachVariableType = null;
isEnumeratorUsedInsideForEach = false;
foreachConditionInstructions = null;
}
private void GenerateForeachStatement()
{
if (foreachVariable == null)
{
foreachVariable = new VariableDefinition(foreachVariableType);
foreachVariableInstructions.Clear();
this.methodContext.VariablesToRename.Add(foreachVariable);
}
VariableDeclarationExpression vd = new VariableDeclarationExpression(foreachVariable, foreachVariableInstructions);
Expression foreachCollectionExpression = foreachCollection.CloneAndAttachInstructions(foreachCollectionInstructions);
if (foreachCollectionExpression is BaseReferenceExpression)
{
foreachCollectionExpression = new ThisReferenceExpression(this.methodContext.Method.DeclaringType, foreachCollectionExpression.UnderlyingSameMethodInstructions);
}
@foreach = new ForEachStatement(vd, foreachCollectionExpression, foreachBody, foreachConditionInstructions, theTry.Finally.UnderlyingSameMethodInstructions);
GetCurrentFixer gcf = new GetCurrentFixer(theEnumerator, foreachVariable);
gcf.Visit(@foreach);
IsEnumeratorUsedVisitor enumeratorUsedVisitor = new IsEnumeratorUsedVisitor(theEnumerator);
enumeratorUsedVisitor.Visit(@foreach);
isEnumeratorUsedInsideForEach = enumeratorUsedVisitor.IsEnumeratorUsed;
}
private bool IsForeach(WhileStatement node)
{
if (node.Condition is UnaryExpression)
{
UnaryExpression unary = node.Condition as UnaryExpression;
if (unary.Operator == UnaryOperator.None && unary.Operand is MethodInvocationExpression)
{
MethodInvocationExpression expr = unary.Operand as MethodInvocationExpression;
return IsMoveNextCall(expr);
}
}
return false;
}
private bool IsMoveNextCall(MethodInvocationExpression invocation)
{
if (invocation == null)
{
return false;
}
if (invocation.MethodExpression.Method.Name == "MoveNext")
{
VariableReferenceExpression target = invocation.MethodExpression.Target as VariableReferenceExpression;
if (target != null)
{
if (target.Variable == theEnumerator)
{
return true;
}
}
}
return false;
}
private bool IsForeachVariableAssignment(BinaryExpression assignment)
{
if (assignment == null)
{
return false;
}
Expression getCurrentInvocation;
if (assignment.Right is CastExpression)
{
getCurrentInvocation = (assignment.Right as CastExpression).Expression;
}
else if (assignment.Right is MethodInvocationExpression || assignment.Right is PropertyReferenceExpression)
{
getCurrentInvocation = assignment.Right;
}
else
{
return false;
}
if (IsGetCurrent(getCurrentInvocation))
{
VariableReferenceExpression variable = assignment.Left as VariableReferenceExpression;
if (variable == null)
{
return false;
}
foreachVariable = variable.Variable.Resolve();
foreachVariableInstructions.AddRange(assignment.UnderlyingSameMethodInstructions);
foreachVariableType = assignment.Right.ExpressionType;
return true;
}
return false;
}
private bool IsGetCurrent(Expression expression)
{
MethodInvocationExpression methodInvocation = expression as MethodInvocationExpression;
if (methodInvocation == null)
{
PropertyReferenceExpression propertyExpression = expression as PropertyReferenceExpression;
return propertyExpression!=null && propertyExpression.Property.Name == "Current";
}
if (methodInvocation.MethodExpression.Target as VariableReferenceExpression == null || methodInvocation.MethodExpression.Method.Name != "get_Current")
{
return false;
}
if ((methodInvocation.MethodExpression.Target as VariableReferenceExpression).Variable != theEnumerator)
{
return false;
}
return true;
}
private bool IsEnumeratorAssignment(Expression expression)
{
BinaryExpression assignment = expression as BinaryExpression;
if (assignment == null || !assignment.IsAssignmentExpression)
{
return false;
}
Expression right = assignment.Right;
MethodInvocationExpression supposedGetEnumerator;
if (right is MethodInvocationExpression)
{
supposedGetEnumerator = right as MethodInvocationExpression;
if (IsGetEnumerator(supposedGetEnumerator))
{
if (assignment.Left as VariableReferenceExpression == null)
{
return false;
}
foreachCollectionInstructions.Clear();
foreachCollectionInstructions.AddRange(assignment.Left.UnderlyingSameMethodInstructions);
foreachCollectionInstructions.AddRange(assignment.MappedInstructions);
foreachCollectionInstructions.AddRange(supposedGetEnumerator.InvocationInstructions);
theEnumerator = (assignment.Left as VariableReferenceExpression).Variable;
return true;
}
}
return false;
}
private bool IsGetEnumerator(MethodInvocationExpression supposedGetEnumerator)
{
if (supposedGetEnumerator.MethodExpression.Method.Name != "GetEnumerator")
{
return false;
}
if (supposedGetEnumerator.MethodExpression.Target == null)
{
return false;
}
this.foreachCollection = supposedGetEnumerator.MethodExpression.Target;
return true;
}
private bool CanContainForeach(TryStatement tryStatement)
{
if ((tryStatement.CatchClauses.Count == 0) &&
(tryStatement.Try.Statements.Count == 1) &&
(tryStatement.Finally != null) &&
((tryStatement.Finally.Body.Statements.Count == 1) ||
(tryStatement.Finally.Body.Statements.Count == 2)))
{
return IsValidFinally(tryStatement.Finally.Body);
}
return false;
}
private bool IsValidFinally(BlockStatement blockStatement)
{
IfStatement supposedIf;
if (blockStatement.Statements.Count == 1)
{
supposedIf = blockStatement.Statements[0] as IfStatement;
if (supposedIf == null)
{
ExpressionStatement supposedDispose = blockStatement.Statements[0] as ExpressionStatement;
if (supposedDispose == null)
{
return false;
}
return IsEnumeratorDispose(supposedDispose.Expression as MethodInvocationExpression);
}
}
else
{
supposedIf = blockStatement.Statements[1] as IfStatement;
}
if (supposedIf == null)
{
return false;
}
if (supposedIf.Then.Statements.Count == 1)
{
ExpressionStatement supposedDispose = supposedIf.Then.Statements[0] as ExpressionStatement;
if (supposedDispose == null)
{
return false;
}
return IsEnumeratorDispose(supposedDispose.Expression as MethodInvocationExpression);
}
return false;
}
private bool IsEnumeratorDispose(MethodInvocationExpression methodInvocationExpression)
{
if (methodInvocationExpression == null)
{
return false;
}
if (methodInvocationExpression.MethodExpression.Method.Name == "Dispose")
{
return true;
}
return false;
}
private class IsEnumeratorUsedVisitor : BaseCodeVisitor
{
private readonly VariableReference enumerator;
public bool IsEnumeratorUsed { get; set; }
public IsEnumeratorUsedVisitor(VariableReference enumerator)
{
this.enumerator = enumerator;
this.IsEnumeratorUsed = false;
}
public override void VisitMethodInvocationExpression(MethodInvocationExpression node)
{
if (node.MethodExpression.Target is VariableReferenceExpression)
{
if ((node.MethodExpression.Target as VariableReferenceExpression).Variable == enumerator)
{
if (node.MethodExpression.Method.Name != "get_Current")
{
IsEnumeratorUsed = true;
}
}
}
base.VisitMethodInvocationExpression(node);
}
public override void VisitPropertyReferenceExpression(PropertyReferenceExpression node)
{
if (node.Property.Name != "Current")
{
VariableReferenceExpression nodeTarget = node.Target as VariableReferenceExpression;
if (nodeTarget != null && nodeTarget.Variable == enumerator)
{
IsEnumeratorUsed = true;
}
}
base.VisitPropertyReferenceExpression(node);
}
public override void VisitVariableReferenceExpression(VariableReferenceExpression node)
{
if (node.Variable == enumerator)
{
IsEnumeratorUsed = true;
}
base.VisitVariableReferenceExpression(node);
}
}
private class GetCurrentFixer : BaseCodeTransformer
{
private readonly VariableReference enumerator;
private readonly VariableReference foreachVariable;
public GetCurrentFixer(VariableReference enumerator, VariableReference foreachVariable)
{
this.enumerator = enumerator;
this.foreachVariable = foreachVariable;
}
public override ICodeNode VisitMethodInvocationExpression(MethodInvocationExpression node)
{
if (node.MethodExpression.Target is VariableReferenceExpression)
{
if ((node.MethodExpression.Target as VariableReferenceExpression).Variable == enumerator)
{
if (node.MethodExpression.Method.Name == "get_Current")
{
return new VariableReferenceExpression(foreachVariable, null);
}
}
}
return base.VisitMethodInvocationExpression(node);
}
public override ICodeNode VisitPropertyReferenceExpression(PropertyReferenceExpression node)
{
if (node.Property.Name == "Current")
{
VariableReferenceExpression nodeTarget = node.Target as VariableReferenceExpression;
if (nodeTarget != null && nodeTarget.Variable == enumerator)
{
return new VariableReferenceExpression(foreachVariable, null);
}
}
return base.VisitPropertyReferenceExpression(node);
}
}
private class ForeachElementTypeFinder : BaseCodeVisitor
{
private readonly VariableReference theEnumerator;
public TypeReference ResultingType { get;set; }
public ForeachElementTypeFinder(VariableReference theEnumerator)
{
this.theEnumerator = theEnumerator;
}
public override void VisitTryStatement(TryStatement node)
{
}
public override void VisitMethodInvocationExpression(MethodInvocationExpression node)
{
if (IsGetCurrent(node))
{
ResultingType = node.ExpressionType;
}
base.VisitMethodInvocationExpression(node);
}
public override void VisitPropertyReferenceExpression(PropertyReferenceExpression node)
{
if (IsGetCurrent(node))
{
ResultingType = node.ExpressionType;
}
base.VisitPropertyReferenceExpression(node);
}
private bool IsGetCurrent(Expression expression)
{
MethodInvocationExpression methodInvocation = expression as MethodInvocationExpression;
if (methodInvocation == null)
{
PropertyReferenceExpression propertyExpression = expression as PropertyReferenceExpression;
return propertyExpression != null && propertyExpression.Property.Name == "Current";
}
if (methodInvocation.MethodExpression.Target as VariableReferenceExpression == null || methodInvocation.MethodExpression.Method.Name != "get_Current")
{
return false;
}
if ((methodInvocation.MethodExpression.Target as VariableReferenceExpression).Variable != theEnumerator)
{
return false;
}
return true;
}
}
private class ForeachVariableChanger : BaseCodeVisitor
{
private readonly VariableDefinition oldVariable;
private readonly VariableDefinition newVariable;
public ForeachVariableChanger(VariableDefinition oldVariable, VariableDefinition newVariable)
{
this.oldVariable = oldVariable;
this.newVariable = newVariable;
}
public override void VisitVariableDeclarationExpression(VariableDeclarationExpression node)
{
if (node.Variable == oldVariable)
{
node.Variable = newVariable;
}
}
public override void VisitVariableReferenceExpression(VariableReferenceExpression node)
{
if (node.Variable == oldVariable)
{
node.Variable = newVariable;
}
}
}
/// <summary>
/// This class takes care for removing redundant code from the yield state machine.
/// </summary>
private class YieldStateMachineCodeRemover
{
private ForEachStatement @foreach;
private VariableReference enumeratorVariable;
public YieldStateMachineCodeRemover(ForEachStatement @foreach, VariableReference enumeratorVariable)
{
this.@foreach = @foreach;
this.enumeratorVariable = enumeratorVariable;
}
public void ProcessForEachStatement()
{
RemoveLastForeachStatementIfNeeded();
RemoveFirstSuccessorIfNeeded();
}
private void RemoveLastForeachStatementIfNeeded()
{
if (@foreach.Body.Statements.Count == 0)
{
return;
}
ExpressionStatement expressionStatement = @foreach.Body.Statements.Last() as ExpressionStatement;
if (expressionStatement == null)
{
return;
}
BinaryExpression binaryExpression = expressionStatement.Expression as BinaryExpression;
if (binaryExpression == null)
{
return;
}
if (!binaryExpression.IsAssignmentExpression)
{
return;
}
VariableReferenceExpression variableRef = binaryExpression.Left as VariableReferenceExpression;
if (variableRef == null || variableRef.Variable != @foreach.Variable.Variable)
{
return;
}
LiteralExpression literalExpression = binaryExpression.Right as LiteralExpression;
if (literalExpression != null && literalExpression.Value == null)
{
RemoveStatement(this.@foreach.Body.Statements, expressionStatement);
return;
}
DefaultObjectExpression defaultObjectExpression = binaryExpression.Right as DefaultObjectExpression;
if (defaultObjectExpression != null)
{
RemoveStatement(this.@foreach.Body.Statements, expressionStatement);
return;
}
}
private void RemoveFirstSuccessorIfNeeded()
{
BlockStatement block = @foreach.Parent as BlockStatement;
int foreachIndex = block.Statements.IndexOf(@foreach);
if (block.Statements.Count <= foreachIndex + 1)
{
return;
}
ExpressionStatement expressionStatement = block.Statements[foreachIndex + 1] as ExpressionStatement;
if (expressionStatement == null)
{
return;
}
BinaryExpression binaryExpression = expressionStatement.Expression as BinaryExpression;
if (binaryExpression == null)
{
return;
}
VariableReferenceExpression variableRef = binaryExpression.Left as VariableReferenceExpression;
if (variableRef == null)
{
return;
}
if (variableRef.Variable != this.enumeratorVariable)
{
return;
}
LiteralExpression literal = binaryExpression.Right as LiteralExpression;
if (literal != null && literal.Value == null)
{
RemoveStatement(block.Statements, expressionStatement);
}
ObjectCreationExpression objectCreation = binaryExpression.Right as ObjectCreationExpression;
if (objectCreation != null)
{
RemoveStatement(block.Statements, expressionStatement);
}
}
private void RemoveStatement(StatementCollection collection, Statement statement)
{
collection.Remove(statement);
}
}
}
}
| 36.689125 | 167 | 0.542479 | [
"ECL-2.0",
"Apache-2.0"
] | GiGatR00n/JustDecompileEngine | Cecil.Decompiler/Steps/RebuildForeachStatements.cs | 31,041 | C# |
using NodaTime;
using System;
using System.Collections.Generic;
using System.Text;
namespace SimplerSoftware.EntityFrameworkCore.SqlServer.NodaTime.Tests.Models
{
public class RaceSplit
{
public int Id { get; set; }
public Instant TimeStampInstant { get; set; }
public OffsetDateTime TimeStampOffsetDateTime { get; set; }
public LocalDateTime TimeStampLocalDateTime { get; set; }
public LocalTime TimeStampLocalTime { get; set; }
}
}
| 23.428571 | 77 | 0.703252 | [
"MIT"
] | BerkleyInsuranceCompany-APAC/EFCore.SqlServer.NodaTime | src/SimplerSoftware.EntityFrameworkCore.SqlServer.NodaTime.Tests/Models/RaceSplit.cs | 494 | C# |
using ClosedXML.Excel;
using konito_project.Attributes;
using konito_project.Exceptions;
using konito_project.Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace konito_project.WorkBook {
public class TradingWorkBook : YearMonthlyWorkBook<Trading> {
private AccountType accountType;
protected override string DefaultPath => $"./db/{accountType}실적";
public TradingWorkBook(int year, int month, AccountType accountType) {
this.accountType = accountType;
ChangeYear(year);
ChangeMonth(month);
}
public int GetTotalyPrice() => GetAllRecords().Sum(x => x.Price);
}
}
| 26.785714 | 78 | 0.706667 | [
"Apache-2.0"
] | GyuCheol/konito_project | src/konito_project/WorkBook/TradingWorkBook.cs | 756 | C# |
namespace WebServer {
class OneEnv {
public string Key { get; private set; }
public string Val { get; private set; }
public OneEnv(string key, string val) {
Key = key;
Val = val;
}
}
}
| 22.727273 | 47 | 0.508 | [
"Apache-2.0"
] | JoshuWats/bjd5 | WebServer/OneEnv.cs | 252 | C# |
//
// Copyright (C) 2010 Novell Inc. http://novell.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 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;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows.Markup;
using System.Xaml;
using System.Xaml.Schema;
using System.Xml;
using NUnit.Framework;
using CategoryAttribute = NUnit.Framework.CategoryAttribute;
namespace MonoTests.System.Xaml
{
[TestFixture]
public class XamlXmlReaderTest : XamlReaderTestBase
{
// read test
XamlReader GetReader (string filename)
{
return new XamlXmlReader (XmlReader.Create (Path.Combine ("Test/XmlFiles", filename), new XmlReaderSettings () { CloseInput =true }));
}
void ReadTest (string filename)
{
var r = GetReader (filename);
while (!r.IsEof)
r.Read ();
}
[Test]
public void SchemaContext ()
{
Assert.AreNotEqual (XamlLanguage.Type.SchemaContext, new XamlXmlReader (XmlReader.Create (new StringReader ("<root/>"))).SchemaContext, "#1");
}
[Test]
public void Read_Int32 ()
{
ReadTest ("Int32.xml");
}
[Test]
public void Read_DateTime ()
{
ReadTest ("DateTime.xml");
}
[Test]
public void Read_TimeSpan ()
{
ReadTest ("TimeSpan.xml");
}
[Test]
public void Read_ArrayInt32 ()
{
ReadTest ("Array_Int32.xml");
}
[Test]
public void Read_DictionaryInt32String ()
{
ReadTest ("Dictionary_Int32_String.xml");
}
[Test]
public void Read_DictionaryStringType ()
{
ReadTest ("Dictionary_String_Type.xml");
}
[Test]
public void Read_SilverlightApp1 ()
{
ReadTest ("SilverlightApp1.xaml");
}
[Test]
public void Read_Guid ()
{
ReadTest ("Guid.xml");
}
[Test]
public void Read_GuidFactoryMethod ()
{
ReadTest ("GuidFactoryMethod.xml");
}
[Test]
public void ReadInt32Details ()
{
var r = GetReader ("Int32.xml");
Assert.IsTrue (r.Read (), "ns#1");
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2");
Assert.AreEqual (XamlLanguage.Xaml2006Namespace, r.Namespace.Namespace, "ns#3");
Assert.IsTrue (r.Read (), "so#1");
Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#2");
Assert.AreEqual (XamlLanguage.Int32, r.Type, "so#3");
ReadBase (r);
Assert.IsTrue (r.Read (), "sinit#1");
Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sinit#2");
Assert.AreEqual (XamlLanguage.Initialization, r.Member, "sinit#3");
Assert.IsTrue (r.Read (), "vinit#1");
Assert.AreEqual (XamlNodeType.Value, r.NodeType, "vinit#2");
Assert.AreEqual ("5", r.Value, "vinit#3"); // string
Assert.IsTrue (r.Read (), "einit#1");
Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "einit#2");
Assert.IsTrue (r.Read (), "eo#1");
Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "eo#2");
Assert.IsFalse (r.Read (), "end");
}
[Test]
public void ReadDateTimeDetails ()
{
var r = GetReader ("DateTime.xml");
Assert.IsTrue (r.Read (), "ns#1");
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2");
Assert.AreEqual ("clr-namespace:System;assembly=mscorlib", r.Namespace.Namespace, "ns#3");
Assert.IsTrue (r.Read (), "so#1");
Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#2");
Assert.AreEqual (r.SchemaContext.GetXamlType (typeof (DateTime)), r.Type, "so#3");
ReadBase (r);
Assert.IsTrue (r.Read (), "sinit#1");
Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sinit#2");
Assert.AreEqual (XamlLanguage.Initialization, r.Member, "sinit#3");
Assert.IsTrue (r.Read (), "vinit#1");
Assert.AreEqual (XamlNodeType.Value, r.NodeType, "vinit#2");
Assert.AreEqual ("2010-04-14", r.Value, "vinit#3"); // string
Assert.IsTrue (r.Read (), "einit#1");
Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "einit#2");
Assert.IsTrue (r.Read (), "eo#1");
Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "eo#2");
Assert.IsFalse (r.Read (), "end");
}
[Test]
public void ReadGuidFactoryMethodDetails ()
{
var r = GetReader ("GuidFactoryMethod.xml");
Assert.IsTrue (r.Read (), "ns#1");
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2");
Assert.AreEqual ("clr-namespace:System;assembly=mscorlib", r.Namespace.Namespace, "ns#3");
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "ns#4");
Assert.IsTrue (r.Read (), "ns2#1");
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns2#2");
Assert.AreEqual (XamlLanguage.Xaml2006Namespace, r.Namespace.Namespace, "ns2#3");
Assert.AreEqual ("x", r.Namespace.Prefix, "ns2#4");
Assert.IsTrue (r.Read (), "so#1");
Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#2");
var xt = r.SchemaContext.GetXamlType (typeof (Guid));
Assert.AreEqual (xt, r.Type, "so#3");
ReadBase (r);
Assert.IsTrue (r.Read (), "sfactory#1");
Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sfactory#2");
Assert.AreEqual (XamlLanguage.FactoryMethod, r.Member, "sfactory#3");
Assert.IsTrue (r.Read (), "vfactory#1");
Assert.AreEqual (XamlNodeType.Value, r.NodeType, "vfactory#2");
Assert.AreEqual ("Parse", r.Value, "vfactory#3"); // string
Assert.IsTrue (r.Read (), "efactory#1");
Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "efactory#2");
Assert.IsTrue (r.Read (), "sarg#1");
Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sarg#2");
Assert.AreEqual (XamlLanguage.Arguments, r.Member, "sarg#3");
Assert.IsTrue (r.Read (), "sarg1#1");
Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "sarg1#2");
Assert.AreEqual (XamlLanguage.String, r.Type, "sarg1#3");
Assert.IsTrue (r.Read (), "sInit#1");
Assert.AreEqual (XamlNodeType.StartMember, r.NodeType, "sInit#2");
Assert.AreEqual (XamlLanguage.Initialization, r.Member, "sInit#3");
Assert.IsTrue (r.Read (), "varg1#1");
Assert.AreEqual (XamlNodeType.Value, r.NodeType, "varg1#2");
Assert.AreEqual ("9c3345ec-8922-4662-8e8d-a4e41f47cf09", r.Value, "varg1#3");
Assert.IsTrue (r.Read (), "eInit#1");
Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "eInit#2");
Assert.IsTrue (r.Read (), "earg1#1");
Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "earg1#2");
Assert.IsTrue (r.Read (), "earg#1");
Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "earg#2");
Assert.IsTrue (r.Read (), "eo#1");
Assert.AreEqual (XamlNodeType.EndObject, r.NodeType, "eo#2");
Assert.IsFalse (r.Read (), "end");
}
[Test]
public void ReadEventStore ()
{
var r = GetReader ("EventStore2.xml");
var xt = r.SchemaContext.GetXamlType (typeof (EventStore));
var xm = xt.GetMember ("Event1");
Assert.IsNotNull (xt, "premise#1");
Assert.IsNotNull (xm, "premise#2");
Assert.IsTrue (xm.IsEvent, "premise#3");
while (true) {
r.Read ();
if (r.Member != null && r.Member.IsEvent)
break;
if (r.IsEof)
Assert.Fail ("Items did not appear");
}
Assert.AreEqual (xm, r.Member, "#x1");
Assert.AreEqual ("Event1", r.Member.Name, "#x2");
Assert.IsTrue (r.Read (), "#x11");
Assert.AreEqual (XamlNodeType.Value, r.NodeType, "#x12");
Assert.AreEqual ("Method1", r.Value, "#x13");
Assert.IsTrue (r.Read (), "#x21");
Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#x22");
xm = xt.GetMember ("Event2");
Assert.IsTrue (r.Read (), "#x31");
Assert.AreEqual (xm, r.Member, "#x32");
Assert.AreEqual ("Event2", r.Member.Name, "#x33");
Assert.IsTrue (r.Read (), "#x41");
Assert.AreEqual (XamlNodeType.Value, r.NodeType, "#x42");
Assert.AreEqual ("Method2", r.Value, "#x43");
Assert.IsTrue (r.Read (), "#x51");
Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#x52");
Assert.IsTrue (r.Read (), "#x61");
Assert.AreEqual ("Event1", r.Member.Name, "#x62");
Assert.IsTrue (r.Read (), "#x71");
Assert.AreEqual (XamlNodeType.Value, r.NodeType, "#x72");
Assert.AreEqual ("Method3", r.Value, "#x73"); // nonexistent, but no need to raise an error.
Assert.IsTrue (r.Read (), "#x81");
Assert.AreEqual (XamlNodeType.EndMember, r.NodeType, "#x82");
while (!r.IsEof)
r.Read ();
r.Close ();
}
// common XamlReader tests.
[Test]
public void Read_String ()
{
var r = GetReader ("String.xml");
Read_String (r);
}
[Test]
public void WriteNullMemberAsObject ()
{
var r = GetReader ("TestClass4.xml");
WriteNullMemberAsObject (r, null);
}
[Test]
public void StaticMember ()
{
var r = GetReader ("TestClass5.xml");
StaticMember (r);
}
[Test]
public void Skip ()
{
var r = GetReader ("String.xml");
Skip (r);
}
[Test]
public void Skip2 ()
{
var r = GetReader ("String.xml");
Skip2 (r);
}
[Test]
public void Read_XmlDocument ()
{
var doc = new XmlDocument ();
doc.LoadXml ("<root xmlns='urn:foo'><elem attr='val' /></root>");
// note that corresponding XamlXmlWriter is untested yet.
var r = GetReader ("XmlDocument.xml");
Read_XmlDocument (r);
}
[Test]
public void Read_NonPrimitive ()
{
var r = GetReader ("NonPrimitive.xml");
Read_NonPrimitive (r);
}
[Test]
public void Read_TypeExtension ()
{
var r = GetReader ("Type.xml");
Read_TypeOrTypeExtension (r, null, XamlLanguage.Type.GetMember ("Type"));
}
[Test]
public void Read_Type2 ()
{
var r = GetReader ("Type2.xml");
Read_TypeOrTypeExtension2 (r, null, XamlLanguage.Type.GetMember ("Type"));
}
[Test]
public void Read_Reference ()
{
var r = GetReader ("Reference.xml");
Read_Reference (r);
}
[Test]
public void Read_Null ()
{
var r = GetReader ("NullExtension.xml");
Read_NullOrNullExtension (r, null);
}
[Test]
public void Read_StaticExtension ()
{
var r = GetReader ("StaticExtension.xml");
Read_StaticExtension (r, XamlLanguage.Static.GetMember ("Member"));
}
[Test]
public void Read_ListInt32 ()
{
var r = GetReader ("List_Int32.xml");
Read_ListInt32 (r, null, new int [] {5, -3, int.MaxValue, 0}.ToList ());
}
[Test]
public void Read_ListInt32_2 ()
{
var r = GetReader ("List_Int32_2.xml");
Read_ListInt32 (r, null, new int [0].ToList ());
}
[Test]
public void Read_ListType ()
{
var r = GetReader ("List_Type.xml");
Read_ListType (r, false);
}
[Test]
public void Read_ListArray ()
{
var r = GetReader ("List_Array.xml");
Read_ListArray (r);
}
[Test]
public void Read_ArrayList ()
{
var r = GetReader ("ArrayList.xml");
Read_ArrayList (r);
}
[Test]
public void Read_Array ()
{
var r = GetReader ("ArrayExtension.xml");
Read_ArrayOrArrayExtensionOrMyArrayExtension (r, null, typeof (ArrayExtension));
}
[Test]
public void Read_MyArrayExtension ()
{
var r = GetReader ("MyArrayExtension.xml");
Read_ArrayOrArrayExtensionOrMyArrayExtension (r, null, typeof (MyArrayExtension));
}
[Test]
public void Read_ArrayExtension2 ()
{
var r = GetReader ("ArrayExtension2.xml");
Read_ArrayExtension2 (r);
}
[Test]
public void Read_CustomMarkupExtension ()
{
var r = GetReader ("MyExtension.xml");
Read_CustomMarkupExtension (r);
}
[Test]
public void Read_CustomMarkupExtension2 ()
{
var r = GetReader ("MyExtension2.xml");
Read_CustomMarkupExtension2 (r);
}
[Test]
public void Read_CustomMarkupExtension3 ()
{
var r = GetReader ("MyExtension3.xml");
Read_CustomMarkupExtension3 (r);
}
[Test]
public void Read_CustomMarkupExtension4 ()
{
var r = GetReader ("MyExtension4.xml");
Read_CustomMarkupExtension4 (r);
}
[Test]
public void Read_CustomMarkupExtension6 ()
{
var r = GetReader ("MyExtension6.xml");
Read_CustomMarkupExtension6 (r);
}
[Test]
public void Read_ArgumentAttributed ()
{
var obj = new ArgumentAttributed ("foo", "bar");
var r = GetReader ("ArgumentAttributed.xml");
Read_ArgumentAttributed (r, obj);
}
[Test]
public void Read_Dictionary ()
{
var obj = new Dictionary<string,object> ();
obj ["Foo"] = 5.0;
obj ["Bar"] = -6.5;
var r = GetReader ("Dictionary_String_Double.xml");
Read_Dictionary (r);
}
[Test]
public void Read_Dictionary2 ()
{
var obj = new Dictionary<string,Type> ();
obj ["Foo"] = typeof (int);
obj ["Bar"] = typeof (Dictionary<Type,XamlType>);
var r = GetReader ("Dictionary_String_Type_2.xml");
Read_Dictionary2 (r, XamlLanguage.Type.GetMember ("Type"));
}
[Test]
public void PositionalParameters2 ()
{
var r = GetReader ("PositionalParametersWrapper.xml");
PositionalParameters2 (r);
}
[Test]
public void ComplexPositionalParameters ()
{
var r = GetReader ("ComplexPositionalParameterWrapper.xml");
ComplexPositionalParameters (r);
}
[Test]
public void Read_ListWrapper ()
{
var r = GetReader ("ListWrapper.xml");
Read_ListWrapper (r);
}
[Test]
public void Read_ListWrapper2 () // read-write list member.
{
var r = GetReader ("ListWrapper2.xml");
Read_ListWrapper2 (r);
}
[Test]
public void Read_ContentIncluded ()
{
var r = GetReader ("ContentIncluded.xml");
Read_ContentIncluded (r);
}
[Test]
public void Read_PropertyDefinition ()
{
var r = GetReader ("PropertyDefinition.xml");
Read_PropertyDefinition (r);
}
[Test]
public void Read_StaticExtensionWrapper ()
{
var r = GetReader ("StaticExtensionWrapper.xml");
Read_StaticExtensionWrapper (r);
}
[Test]
public void Read_TypeExtensionWrapper ()
{
var r = GetReader ("TypeExtensionWrapper.xml");
Read_TypeExtensionWrapper (r);
}
[Test]
public void Read_NamedItems ()
{
var r = GetReader ("NamedItems.xml");
Read_NamedItems (r, false);
}
[Test]
public void Read_NamedItems2 ()
{
var r = GetReader ("NamedItems2.xml");
Read_NamedItems2 (r, false);
}
[Test]
public void Read_XmlSerializableWrapper ()
{
var r = GetReader ("XmlSerializableWrapper.xml");
Read_XmlSerializableWrapper (r, false);
}
[Test]
public void Read_XmlSerializable ()
{
var r = GetReader ("XmlSerializable.xml");
Read_XmlSerializable (r);
}
[Test]
public void Read_ListXmlSerializable ()
{
var r = GetReader ("List_XmlSerializable.xml");
Read_ListXmlSerializable (r);
}
[Test]
public void Read_AttachedProperty ()
{
var r = GetReader ("AttachedProperty.xml");
Read_AttachedProperty (r);
}
[Test]
public void Read_AbstractWrapper ()
{
var r = GetReader ("AbstractContainer.xml");
while (!r.IsEof)
r.Read ();
}
[Test]
public void Read_ReadOnlyPropertyContainer ()
{
var r = GetReader ("ReadOnlyPropertyContainer.xml");
while (!r.IsEof)
r.Read ();
}
}
}
| 25.456 | 145 | 0.662036 | [
"Apache-2.0"
] | dvmarshall/mono | mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs | 15,910 | C# |
using RockSnifferGui.Common;
using RockSnifferGui.Model;
using RockSnifferLib.Sniffing;
using System.Collections.ObjectModel;
using System.Windows.Input;
namespace RockSnifferGui.Controls
{
public class PlayHistoryGridViewModel : GenericViewModel
{
private ObservableCollection<SongPlayInstance> songPlays = new ObservableCollection<SongPlayInstance>();
private SongPlayInstance selectedSongInstance;
private SongDetails selectedSong;
private ICommand selectSongCommand;
public ObservableCollection<SongPlayInstance> SongPlays
{
get => this.songPlays;
set
{
this.SetProperty(ref this.songPlays, value, "SongPlays");
}
}
public SongPlayInstance SelectedSongInstance
{
get => this.selectedSongInstance;
set
{
this.SetProperty(ref this.selectedSongInstance, value, "SelectedSongInstance");
}
}
public SongDetails SelectedSong
{
get => this.selectedSong;
set
{
this.SetProperty(ref this.selectedSong, value, "SelectedSong");
}
}
public ICommand SelectSongCommand
{
get => this.selectSongCommand;
set
{
this.SetProperty(ref this.selectSongCommand, value, "SelectSongCommand");
}
}
}
}
| 27.462963 | 112 | 0.596763 | [
"MIT"
] | hunterpankey/RockSnifferGui | Controls/PlayHistoryGridViewModel.cs | 1,485 | C# |
using Guardian.Features.Commands.Impl;
using Guardian.Features.Commands.Impl.MasterClient;
using Guardian.Features.Commands.Impl.Debug;
using Guardian.Features.Commands.Impl.RC;
using Guardian.Features.Commands.Impl.RC.MasterClient;
namespace Guardian.Features.Commands
{
class CommandManager : FeatureManager<Command>
{
public override void Load()
{
// Normal
base.Add(new CommandHelp());
base.Add(new CommandClear());
base.Add(new CommandIgnore());
base.Add(new CommandMute());
base.Add(new CommandRageQuit());
base.Add(new CommandRejoin());
base.Add(new CommandReloadConfig());
base.Add(new CommandSay());
base.Add(new CommandScreenshot());
base.Add(new CommandSetGuild());
base.Add(new CommandSetLighting());
base.Add(new CommandSetName());
base.Add(new CommandTranslate());
base.Add(new CommandUnignore());
base.Add(new CommandUnmute());
base.Add(new CommandWhois());
// MasterClient
base.Add(new CommandDifficulty());
base.Add(new CommandGamemode());
base.Add(new CommandGuestBeGone());
base.Add(new CommandKill());
base.Add(new CommandScatterTitans());
base.Add(new CommandSetMap());
base.Add(new CommandSetTitans());
base.Add(new CommandTeleport());
// Debug
base.Add(new CommandLogProperties());
// RC MasterClient
base.Add(new CommandAso());
base.Add(new CommandBanlist());
base.Add(new CommandPause());
base.Add(new CommandRestart());
base.Add(new CommandRevive());
base.Add(new CommandRoom());
base.Add(new CommandUnpause());
// RC
base.Add(new CommandBan());
base.Add(new CommandIgnoreList());
base.Add(new CommandKick());
base.Add(new CommandPM());
base.Add(new CommandResetKD());
base.Add(new CommandRules());
base.Add(new CommandSpectate());
base.Add(new CommandTeam());
base.Add(new CommandUnban());
GuardianClient.Logger.Debug($"Registered {Elements.Count} commands.");
}
public void HandleCommand(InRoomChat irc)
{
string[] args = irc.inputLine.Trim().Substring(1).Split(' ');
Command command = base.Find(args[0]);
if (command != null)
{
if (!command.MasterClient || PhotonNetwork.isMasterClient)
{
command.Execute(irc, args.Length > 1 ? args.CopyOfRange(1, args.Length) : new string[0]);
}
else
{
irc.AddLine("Command requires MasterClient!".AsColor("FF0000"));
}
}
else if (args[0].Length > 0)
{
irc.AddLine($"Command '{args[0]}' not found.".AsColor("FF4444"));
}
}
}
}
| 35.244444 | 109 | 0.539092 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | suhtiva/guardian | Assembly-CSharp/Guardian/Features/Commands/CommandManager.cs | 3,174 | 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.Linq;
using osu.Framework.Input;
using osu.Game.Beatmaps;
using osu.Game.Input.Handlers;
using osu.Game.Replays;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Configuration;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Replays;
using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play;
using osuTK;
namespace osu.Game.Rulesets.Osu.UI
{
public class DrawableOsuRuleset : DrawableRuleset<OsuHitObject>
{
protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config;
public DrawableOsuRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
: base(ruleset, beatmap, mods)
{
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; // always show the gameplay cursor
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(this);
protected override Playfield CreatePlayfield() => new OsuPlayfield();
protected override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo);
public override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new OsuPlayfieldAdjustmentContainer();
protected override ResumeOverlay CreateResumeOverlay() => new OsuResumeOverlay();
public override DrawableHitObject<OsuHitObject> CreateDrawableRepresentation(OsuHitObject h)
{
switch (h)
{
case HitCircle circle:
return new DrawableHitCircle(circle);
case Slider slider:
return new DrawableSlider(slider);
case Spinner spinner:
return new DrawableSpinner(spinner);
}
return null;
}
protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new OsuFramedReplayInputHandler(replay);
public override double GameplayStartTime
{
get
{
if (Objects.FirstOrDefault() is OsuHitObject first)
return first.StartTime - Math.Max(2000, first.TimePreempt);
return 0;
}
}
}
}
| 35.064935 | 132 | 0.667778 | [
"MIT"
] | jun112561/osu | osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs | 2,626 | C# |
using InvoiceXpress.Json;
using System.Text.Json.Serialization;
namespace InvoiceXpress.Payloads;
/// <summary />
[JsonConverter( typeof( GuideDataPayloadConverter ) )]
public class GuideDataPayload
{
public GuideData Guide { get; set; } = default!;
}
| 21.583333 | 54 | 0.752896 | [
"MIT"
] | filipetoscano/invoice-express | src/InvoiceXpress/Payloads/GuideDataPayload.cs | 261 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// La información general sobre un ensamblado se controla mediante el siguiente
// conjunto de atributos. Cambie estos atributos para modificar la información
// asociada con un ensamblado.
[assembly: AssemblyTitle("Laberinto")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Laberinto")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Si establece ComVisible como false, los tipos de este ensamblado no estarán visibles
// para los componentes COM. Si necesita obtener acceso a un tipo de este ensamblado desde
// COM, establezca el atributo ComVisible como true en este tipo.
[assembly: ComVisible(false)]
// El siguiente GUID sirve como identificador de typelib si este proyecto se expone a COM
[assembly: Guid("6e89a2fb-3e99-45e7-b0a9-dc1cede72f23")]
// La información de versión de un ensamblado consta de los cuatro valores siguientes:
//
// Versión principal
// Versión secundaria
// Número de compilación
// Revisión
//
// Puede especificar todos los valores o establecer como predeterminados los números de compilación y de revisión
// mediante el carácter '*', como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 42 | 115 | 0.7426 | [
"MIT"
] | barbosaGonzalez/Juego-de-Laberinto-WII | Laberinto/Properties/AssemblyInfo.cs | 1,572 | C# |
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
// 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("AWSSDK.CodeStarconnections")]
#if BCL35
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - AWS CodeStar connections. Public beta for Bitbucket Cloud support in AWS CodePipeline through integration with AWS CodeStar connections.")]
#elif BCL45
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (4.5) - AWS CodeStar connections. Public beta for Bitbucket Cloud support in AWS CodePipeline through integration with AWS CodeStar connections.")]
#elif NETSTANDARD13
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (NetStandard 1.3) - AWS CodeStar connections. Public beta for Bitbucket Cloud support in AWS CodePipeline through integration with AWS CodeStar connections.")]
#elif NETSTANDARD20
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (NetStandard 2.0) - AWS CodeStar connections. Public beta for Bitbucket Cloud support in AWS CodePipeline through integration with AWS CodeStar connections.")]
#elif NETCOREAPP3_1
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (.NET Core 3.1) - AWS CodeStar connections. Public beta for Bitbucket Cloud support in AWS CodePipeline through integration with AWS CodeStar connections.")]
#else
#error Unknown platform constant - unable to set correct AssemblyDescription
#endif
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Amazon Web Services SDK for .NET")]
[assembly: AssemblyCompany("Amazon.com, Inc")]
[assembly: AssemblyCopyright("Copyright 2009-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.")]
[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)]
// 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("3.3")]
[assembly: AssemblyFileVersion("3.5.0.2")]
[assembly: System.CLSCompliant(true)]
#if BCL
[assembly: System.Security.AllowPartiallyTrustedCallers]
#endif | 51.660377 | 228 | 0.780131 | [
"Apache-2.0"
] | DetlefGolze/aws-sdk-net | sdk/src/Services/CodeStarconnections/Properties/AssemblyInfo.cs | 2,738 | C# |
namespace Coop.Entity.Interface
{
public interface IAnimal
{
public bool IsReadyForPregnancy();
public bool IsPregnant();
public int NewBornMaleCount();
public int NewBornFemaleCount();
}
} | 18.230769 | 42 | 0.637131 | [
"MIT"
] | kivanckara/Coop-Case | Coop.Entity/Interface/IAnimal.cs | 239 | C# |
// Copyright 2016-2018, Pulumi Corporation
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
namespace Pulumi
{
/// <summary>
/// <see cref="Config"/> is a bag of related configuration state. Each bag contains any number
/// of configuration variables, indexed by simple keys, and each has a name that uniquely
/// identifies it; two bags with different names do not share values for variables that
/// otherwise share the same key. For example, a bag whose name is <c>pulumi:foo</c>, with keys
/// <c>a</c>, <c>b</c>, and <c>c</c>, is entirely separate from a bag whose name is
/// <c>pulumi:bar</c> with the same simple key names. Each key has a fully qualified names,
/// such as <c>pulumi:foo:a</c>, ..., and <c>pulumi:bar:a</c>, respectively.
/// </summary>
public sealed partial class Config
{
/// <summary>
/// <see cref="_name"/> is the configuration bag's logical name and uniquely identifies it.
/// The default is the name of the current project.
/// </summary>
private readonly string _name;
/// <summary>
/// Creates a new <see cref="Config"/> instance. <paramref name="name"/> is the
/// configuration bag's logical name and uniquely identifies it. The default is the name of
/// the current project.
/// </summary>
public Config(string? name = null)
{
if (name == null)
{
name = Deployment.Instance.ProjectName;
}
if (name.EndsWith(":config", StringComparison.Ordinal))
{
name = name[0..^":config".Length];
}
_name = name;
}
[return: NotNullIfNotNull("value")]
private static Output<T>? MakeClassSecret<T>(T? value) where T : class
=> value == null ? null : Output.CreateSecret(value);
private static Output<T>? MakeStructSecret<T>(T? value) where T : struct
=> value == null ? null : MakeStructSecret(value.Value);
private static Output<T> MakeStructSecret<T>(T value) where T : struct
=> Output.CreateSecret(value);
/// <summary>
/// Loads an optional configuration value by its key, or <see langword="null"/> if it doesn't exist.
/// </summary>
public string? Get(string key)
=> Deployment.InternalInstance.GetConfig(FullKey(key));
/// <summary>
/// Loads an optional configuration value by its key, marking it as a secret, or <see
/// langword="null"/> if it doesn't exist.
/// </summary>
public Output<string>? GetSecret(string key)
=> MakeClassSecret(Get(key));
/// <summary>
/// Loads an optional configuration value, as a boolean, by its key, or null if it doesn't exist.
/// If the configuration value isn't a legal boolean, this function will throw an error.
/// </summary>
public bool? GetBoolean(string key)
{
var v = Get(key);
return v == null ? default(bool?) :
v == "true" ? true :
v == "false" ? false : throw new ConfigTypeException(FullKey(key), v, nameof(Boolean));
}
/// <summary>
/// Loads an optional configuration value, as a boolean, by its key, making it as a secret or
/// null if it doesn't exist. If the configuration value isn't a legal boolean, this
/// function will throw an error.
/// </summary>
public Output<bool>? GetSecretBoolean(string key)
=> MakeStructSecret(GetBoolean(key));
/// <summary>
/// Loads an optional configuration value, as a number, by its key, or null if it doesn't exist.
/// If the configuration value isn't a legal number, this function will throw an error.
/// </summary>
public int? GetInt32(string key)
{
var v = Get(key);
return v == null
? default(int?)
: int.TryParse(v, out var result)
? result
: throw new ConfigTypeException(FullKey(key), v, nameof(Int32));
}
/// <summary>
/// Loads an optional configuration value, as a number, by its key, marking it as a secret
/// or null if it doesn't exist.
/// If the configuration value isn't a legal number, this function will throw an error.
/// </summary>
public Output<int>? GetSecretInt32(string key)
=> MakeStructSecret(GetInt32(key));
/// <summary>
/// Loads an optional configuration value, as an object, by its key, or null if it doesn't
/// exist. This works by taking the value associated with <paramref name="key"/> and passing
/// it to <see cref="JsonSerializer.Deserialize{TValue}(string, JsonSerializerOptions)"/>.
/// </summary>
[return: MaybeNull]
public T GetObject<T>(string key)
{
var v = Get(key);
try
{
return v == null ? default : JsonSerializer.Deserialize<T>(v);
}
catch (JsonException ex)
{
throw new ConfigTypeException(FullKey(key), v, typeof(T).FullName!, ex);
}
}
/// <summary>
/// Loads an optional configuration value, as an object, by its key, marking it as a secret
/// or null if it doesn't exist. This works by taking the value associated with <paramref
/// name="key"/> and passing it to <see cref="JsonSerializer.Deserialize{TValue}(string,
/// JsonSerializerOptions)"/>.
/// </summary>
public Output<T>? GetSecretObject<T>(string key)
{
var v = Get(key);
if (v == null)
return null;
return Output.CreateSecret(GetObject<T>(key)!);
}
/// <summary>
/// Loads a configuration value by its given key. If it doesn't exist, an error is thrown.
/// </summary>
public string Require(string key)
=> Get(key) ?? throw new ConfigMissingException(FullKey(key));
/// <summary>
/// Loads a configuration value by its given key, marking it as a secret. If it doesn't exist, an error
/// is thrown.
/// </summary>
public Output<string> RequireSecret(string key)
=> MakeClassSecret(Require(key));
/// <summary>
/// Loads a configuration value, as a boolean, by its given key. If it doesn't exist, or the
/// configuration value is not a legal boolean, an error is thrown.
/// </summary>
public bool RequireBoolean(string key)
=> GetBoolean(key) ?? throw new ConfigMissingException(FullKey(key));
/// <summary>
/// Loads a configuration value, as a boolean, by its given key, marking it as a secret.
/// If it doesn't exist, or the configuration value is not a legal boolean, an error is thrown.
/// </summary>
public Output<bool> RequireSecretBoolean(string key)
=> MakeStructSecret(RequireBoolean(key));
/// <summary>
/// Loads a configuration value, as a number, by its given key. If it doesn't exist, or the
/// configuration value is not a legal number, an error is thrown.
/// </summary>
public int RequireInt32(string key)
=> GetInt32(key) ?? throw new ConfigMissingException(FullKey(key));
/// <summary>
/// Loads a configuration value, as a number, by its given key, marking it as a secret.
/// If it doesn't exist, or the configuration value is not a legal number, an error is thrown.
/// </summary>
public Output<int> RequireSecretInt32(string key)
=> MakeStructSecret(RequireInt32(key));
/// <summary>
/// Loads a configuration value as a JSON string and deserializes the JSON into an object.
/// object. If it doesn't exist, or the configuration value cannot be converted using <see
/// cref="JsonSerializer.Deserialize{TValue}(string, JsonSerializerOptions)"/>, an error is
/// thrown.
/// </summary>
public T RequireObject<T>(string key)
{
var v = Get(key);
if (v == null)
throw new ConfigMissingException(FullKey(key));
return GetObject<T>(key)!;
}
/// <summary>
/// Loads a configuration value as a JSON string and deserializes the JSON into a JavaScript
/// object, marking it as a secret. If it doesn't exist, or the configuration value cannot
/// be converted using <see cref="JsonSerializer.Deserialize{TValue}(string,
/// JsonSerializerOptions)"/>. an error is thrown.
/// </summary>
public Output<T> RequireSecretObject<T>(string key)
=> Output.CreateSecret(RequireObject<T>(key));
/// <summary>
/// Turns a simple configuration key into a fully resolved one, by prepending the bag's name.
/// </summary>
private string FullKey(string key)
=> $"{_name}:{key}";
}
}
| 42.522936 | 112 | 0.583819 | [
"Apache-2.0"
] | RichardWLaub/pulumi | sdk/dotnet/Pulumi/Config.cs | 9,270 | C# |
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace TattooViewer
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
| 18.111111 | 42 | 0.705521 | [
"MIT"
] | MeTaXaS4/TattooViewer | TattooViewer/App.xaml.cs | 328 | C# |
using ExcelMapper.Abstractions;
using Xunit;
namespace ExcelMapper.Fallbacks.Tests
{
public class FixedValueFallbackTests
{
[Theory]
[InlineData(null)]
[InlineData(1)]
[InlineData("value")]
public void Ctor_Default(object value)
{
var fallback = new FixedValueFallback(value);
Assert.Same(value, value);
object result = fallback.PerformFallback(null, 0, new ReadCellValueResult(), null);
Assert.Same(value, result);
}
}
}
| 24.590909 | 95 | 0.608133 | [
"MIT"
] | joao29a/excel-mapper | tests/ExcelMapper/Fallbacks/FixedValueFallbackTests.cs | 543 | C# |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Gcp.ServiceAccount
{
/// <summary>
/// When managing IAM roles, you can treat a service account either as a resource or as an identity. This resource is to add iam policy bindings to a service account resource, such as allowing the members to run operations as or modify the service account. To configure permissions for a service account on other GCP resources, use the google_project_iam set of resources.
///
/// Three different resources help you manage your IAM policy for a service account. Each of these resources serves a different use case:
///
/// * `gcp.serviceAccount.IAMPolicy`: Authoritative. Sets the IAM policy for the service account and replaces any existing policy already attached.
/// * `gcp.serviceAccount.IAMBinding`: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the service account are preserved.
/// * `gcp.serviceAccount.IAMMember`: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the service account are preserved.
///
/// > **Note:** `gcp.serviceAccount.IAMPolicy` **cannot** be used in conjunction with `gcp.serviceAccount.IAMBinding` and `gcp.serviceAccount.IAMMember` or they will fight over what your policy should be.
///
/// > **Note:** `gcp.serviceAccount.IAMBinding` resources **can be** used in conjunction with `gcp.serviceAccount.IAMMember` resources **only if** they do not grant privilege to the same role.
///
/// ## google\_service\_account\_iam\_policy
///
/// ```csharp
/// using Pulumi;
/// using Gcp = Pulumi.Gcp;
///
/// class MyStack : Stack
/// {
/// public MyStack()
/// {
/// var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
/// {
/// Bindings =
/// {
/// new Gcp.Organizations.Inputs.GetIAMPolicyBindingArgs
/// {
/// Role = "roles/iam.serviceAccountUser",
/// Members =
/// {
/// "user:jane@example.com",
/// },
/// },
/// },
/// }));
/// var sa = new Gcp.ServiceAccount.Account("sa", new Gcp.ServiceAccount.AccountArgs
/// {
/// AccountId = "my-service-account",
/// DisplayName = "A service account that only Jane can interact with",
/// });
/// var admin_account_iam = new Gcp.ServiceAccount.IAMPolicy("admin-account-iam", new Gcp.ServiceAccount.IAMPolicyArgs
/// {
/// ServiceAccountId = sa.Name,
/// PolicyData = admin.Apply(admin => admin.PolicyData),
/// });
/// }
///
/// }
/// ```
///
/// ## google\_service\_account\_iam\_binding
///
/// ```csharp
/// using Pulumi;
/// using Gcp = Pulumi.Gcp;
///
/// class MyStack : Stack
/// {
/// public MyStack()
/// {
/// var sa = new Gcp.ServiceAccount.Account("sa", new Gcp.ServiceAccount.AccountArgs
/// {
/// AccountId = "my-service-account",
/// DisplayName = "A service account that only Jane can use",
/// });
/// var admin_account_iam = new Gcp.ServiceAccount.IAMBinding("admin-account-iam", new Gcp.ServiceAccount.IAMBindingArgs
/// {
/// ServiceAccountId = sa.Name,
/// Role = "roles/iam.serviceAccountUser",
/// Members =
/// {
/// "user:jane@example.com",
/// },
/// });
/// }
///
/// }
/// ```
///
/// With IAM Conditions:
///
/// ```csharp
/// using Pulumi;
/// using Gcp = Pulumi.Gcp;
///
/// class MyStack : Stack
/// {
/// public MyStack()
/// {
/// var sa = new Gcp.ServiceAccount.Account("sa", new Gcp.ServiceAccount.AccountArgs
/// {
/// AccountId = "my-service-account",
/// DisplayName = "A service account that only Jane can use",
/// });
/// var admin_account_iam = new Gcp.ServiceAccount.IAMBinding("admin-account-iam", new Gcp.ServiceAccount.IAMBindingArgs
/// {
/// Condition = new Gcp.ServiceAccount.Inputs.IAMBindingConditionArgs
/// {
/// Description = "Expiring at midnight of 2019-12-31",
/// Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
/// Title = "expires_after_2019_12_31",
/// },
/// Members =
/// {
/// "user:jane@example.com",
/// },
/// Role = "roles/iam.serviceAccountUser",
/// ServiceAccountId = sa.Name,
/// });
/// }
///
/// }
/// ```
///
/// ## google\_service\_account\_iam\_member
///
/// ```csharp
/// using Pulumi;
/// using Gcp = Pulumi.Gcp;
///
/// class MyStack : Stack
/// {
/// public MyStack()
/// {
/// var @default = Output.Create(Gcp.Compute.GetDefaultServiceAccount.InvokeAsync());
/// var sa = new Gcp.ServiceAccount.Account("sa", new Gcp.ServiceAccount.AccountArgs
/// {
/// AccountId = "my-service-account",
/// DisplayName = "A service account that Jane can use",
/// });
/// var admin_account_iam = new Gcp.ServiceAccount.IAMMember("admin-account-iam", new Gcp.ServiceAccount.IAMMemberArgs
/// {
/// ServiceAccountId = sa.Name,
/// Role = "roles/iam.serviceAccountUser",
/// Member = "user:jane@example.com",
/// });
/// // Allow SA service account use the default GCE account
/// var gce_default_account_iam = new Gcp.ServiceAccount.IAMMember("gce-default-account-iam", new Gcp.ServiceAccount.IAMMemberArgs
/// {
/// ServiceAccountId = @default.Apply(@default => @default.Name),
/// Role = "roles/iam.serviceAccountUser",
/// Member = sa.Email.Apply(email => $"serviceAccount:{email}"),
/// });
/// }
///
/// }
/// ```
///
/// With IAM Conditions:
///
/// ```csharp
/// using Pulumi;
/// using Gcp = Pulumi.Gcp;
///
/// class MyStack : Stack
/// {
/// public MyStack()
/// {
/// var sa = new Gcp.ServiceAccount.Account("sa", new Gcp.ServiceAccount.AccountArgs
/// {
/// AccountId = "my-service-account",
/// DisplayName = "A service account that Jane can use",
/// });
/// var admin_account_iam = new Gcp.ServiceAccount.IAMMember("admin-account-iam", new Gcp.ServiceAccount.IAMMemberArgs
/// {
/// Condition = new Gcp.ServiceAccount.Inputs.IAMMemberConditionArgs
/// {
/// Description = "Expiring at midnight of 2019-12-31",
/// Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
/// Title = "expires_after_2019_12_31",
/// },
/// Member = "user:jane@example.com",
/// Role = "roles/iam.serviceAccountUser",
/// ServiceAccountId = sa.Name,
/// });
/// }
///
/// }
/// ```
///
/// ## Import
///
/// Service account IAM resources can be imported using the project, service account email, role, member identity, and condition (beta).
///
/// ```sh
/// $ pulumi import gcp:serviceAccount/iAMBinding:IAMBinding admin-account-iam projects/{your-project-id}/serviceAccounts/{your-service-account-email}
/// ```
///
/// ```sh
/// $ pulumi import gcp:serviceAccount/iAMBinding:IAMBinding admin-account-iam "projects/{your-project-id}/serviceAccounts/{your-service-account-email} roles/iam.serviceAccountUser"
/// ```
///
/// ```sh
/// $ pulumi import gcp:serviceAccount/iAMBinding:IAMBinding admin-account-iam "projects/{your-project-id}/serviceAccounts/{your-service-account-email} roles/editor user:foo@example.com"
/// ```
///
/// -> **Custom Roles**If you're importing a IAM resource with a custom role, make sure to use the full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`. With conditions
///
/// ```sh
/// $ pulumi import gcp:serviceAccount/iAMBinding:IAMBinding admin-account-iam "projects/{your-project-id}/serviceAccounts/{your-service-account-email} roles/iam.serviceAccountUser expires_after_2019_12_31"
/// ```
///
/// ```sh
/// $ pulumi import gcp:serviceAccount/iAMBinding:IAMBinding admin-account-iam "projects/{your-project-id}/serviceAccounts/{your-service-account-email} roles/iam.serviceAccountUser user:foo@example.com expires_after_2019_12_31"
/// ```
/// </summary>
[GcpResourceType("gcp:serviceAccount/iAMBinding:IAMBinding")]
public partial class IAMBinding : Pulumi.CustomResource
{
/// <summary>
/// An [IAM Condition](https://cloud.google.com/iam/docs/conditions-overview) for a given binding.
/// Structure is documented below.
/// </summary>
[Output("condition")]
public Output<Outputs.IAMBindingCondition?> Condition { get; private set; } = null!;
/// <summary>
/// (Computed) The etag of the service account IAM policy.
/// </summary>
[Output("etag")]
public Output<string> Etag { get; private set; } = null!;
[Output("members")]
public Output<ImmutableArray<string>> Members { get; private set; } = null!;
/// <summary>
/// The role that should be applied. Only one
/// `gcp.serviceAccount.IAMBinding` can be used per role. Note that custom roles must be of the format
/// `[projects|organizations]/{parent-name}/roles/{role-name}`.
/// </summary>
[Output("role")]
public Output<string> Role { get; private set; } = null!;
/// <summary>
/// The fully-qualified name of the service account to apply policy to.
/// </summary>
[Output("serviceAccountId")]
public Output<string> ServiceAccountId { get; private set; } = null!;
/// <summary>
/// Create a IAMBinding resource with the given unique name, arguments, and options.
/// </summary>
///
/// <param name="name">The unique name of the resource</param>
/// <param name="args">The arguments used to populate this resource's properties</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public IAMBinding(string name, IAMBindingArgs args, CustomResourceOptions? options = null)
: base("gcp:serviceAccount/iAMBinding:IAMBinding", name, args ?? new IAMBindingArgs(), MakeResourceOptions(options, ""))
{
}
private IAMBinding(string name, Input<string> id, IAMBindingState? state = null, CustomResourceOptions? options = null)
: base("gcp:serviceAccount/iAMBinding:IAMBinding", name, state, MakeResourceOptions(options, id))
{
}
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
{
var defaultOptions = new CustomResourceOptions
{
Version = Utilities.Version,
};
var merged = CustomResourceOptions.Merge(defaultOptions, options);
// Override the ID if one was specified for consistency with other language SDKs.
merged.Id = id ?? merged.Id;
return merged;
}
/// <summary>
/// Get an existing IAMBinding resource's state with the given name, ID, and optional extra
/// properties used to qualify the lookup.
/// </summary>
///
/// <param name="name">The unique name of the resulting resource.</param>
/// <param name="id">The unique provider ID of the resource to lookup.</param>
/// <param name="state">Any extra arguments used during the lookup.</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public static IAMBinding Get(string name, Input<string> id, IAMBindingState? state = null, CustomResourceOptions? options = null)
{
return new IAMBinding(name, id, state, options);
}
}
public sealed class IAMBindingArgs : Pulumi.ResourceArgs
{
/// <summary>
/// An [IAM Condition](https://cloud.google.com/iam/docs/conditions-overview) for a given binding.
/// Structure is documented below.
/// </summary>
[Input("condition")]
public Input<Inputs.IAMBindingConditionArgs>? Condition { get; set; }
[Input("members", required: true)]
private InputList<string>? _members;
public InputList<string> Members
{
get => _members ?? (_members = new InputList<string>());
set => _members = value;
}
/// <summary>
/// The role that should be applied. Only one
/// `gcp.serviceAccount.IAMBinding` can be used per role. Note that custom roles must be of the format
/// `[projects|organizations]/{parent-name}/roles/{role-name}`.
/// </summary>
[Input("role", required: true)]
public Input<string> Role { get; set; } = null!;
/// <summary>
/// The fully-qualified name of the service account to apply policy to.
/// </summary>
[Input("serviceAccountId", required: true)]
public Input<string> ServiceAccountId { get; set; } = null!;
public IAMBindingArgs()
{
}
}
public sealed class IAMBindingState : Pulumi.ResourceArgs
{
/// <summary>
/// An [IAM Condition](https://cloud.google.com/iam/docs/conditions-overview) for a given binding.
/// Structure is documented below.
/// </summary>
[Input("condition")]
public Input<Inputs.IAMBindingConditionGetArgs>? Condition { get; set; }
/// <summary>
/// (Computed) The etag of the service account IAM policy.
/// </summary>
[Input("etag")]
public Input<string>? Etag { get; set; }
[Input("members")]
private InputList<string>? _members;
public InputList<string> Members
{
get => _members ?? (_members = new InputList<string>());
set => _members = value;
}
/// <summary>
/// The role that should be applied. Only one
/// `gcp.serviceAccount.IAMBinding` can be used per role. Note that custom roles must be of the format
/// `[projects|organizations]/{parent-name}/roles/{role-name}`.
/// </summary>
[Input("role")]
public Input<string>? Role { get; set; }
/// <summary>
/// The fully-qualified name of the service account to apply policy to.
/// </summary>
[Input("serviceAccountId")]
public Input<string>? ServiceAccountId { get; set; }
public IAMBindingState()
{
}
}
}
| 43.077333 | 376 | 0.566423 | [
"ECL-2.0",
"Apache-2.0"
] | la3mmchen/pulumi-gcp | sdk/dotnet/ServiceAccount/IAMBinding.cs | 16,154 | C# |
using System.Collections;
using UnityEngine;
using UnityEditor;
using UVNF.Core.UI;
using UVNF.Extensions;
namespace UVNF.Core.Story.Audio
{
public class BackgroundMusicElement : StoryElement
{
public override string ElementName => "Background Music";
public override Color32 DisplayColor => _displayColor;
private Color32 _displayColor = new Color32().Audio();
public override StoryElementTypes Type => StoryElementTypes.Audio;
public AudioClip BackgroundMusic;
public bool Crossfade = true;
public float CrossfadeTime = 1f;
public float Volume;
#if UNITY_EDITOR
public override void DisplayLayout(Rect layoutRect, GUIStyle label)
{
BackgroundMusic = EditorGUILayout.ObjectField(BackgroundMusic, typeof(AudioClip), false) as AudioClip;
Crossfade = GUILayout.Toggle(Crossfade, "Crossfade");
if (Crossfade)
CrossfadeTime = EditorGUILayout.FloatField("Crossfade Time", CrossfadeTime);
if (CrossfadeTime < 0) CrossfadeTime = 0;
Volume = EditorGUILayout.Slider("Volume", Volume, 0f, 1f);
}
#endif
public override IEnumerator Execute(UVNFManager managerCallback, UVNFCanvas canvas)
{
if (Crossfade)
managerCallback.AudioManager.CrossfadeBackgroundMusic(BackgroundMusic, CrossfadeTime);
else
managerCallback.AudioManager.PlayBackgroundMusic(BackgroundMusic);
yield return null;
}
}
} | 32.416667 | 114 | 0.671594 | [
"MIT"
] | Velorexe/UDSF | Project/Assets/UVNF/Scripts/Core/Story/Elements/Audio/BackgroundMusicElement.cs | 1,558 | C# |
using System;
using Serilog;
using Microsoft.AspNetCore.Mvc;
using Its.Onix.Erp.Models;
using Its.Onix.Core.Business;
using Its.Onix.Core.Factories;
using Its.Onix.Core.Smtp;
using Its.Onix.Core.Notifications;
using Magnum.Web.Utils;
using Magnum.Api.Utils;
namespace Magnum.Web.Controllers
{
[AutoValidateAntiforgeryToken]
public class ContactUsController : BaseController
{
[HttpGet("Contact")]
public IActionResult Contact()
{
return View();
}
[HttpPost("Contact/Save")]
public IActionResult SaveContactUs(MContactUs form)
{
string token = GetCpatchaToken();
string validationMessage = ValidateContactUsForm(form, token);
if (validationMessage != null)
{
ViewBag.Message = validationMessage;
}
else
{
IBusinessOperationManipulate<MContactUs> operation = GetSaveContactUsOperation();
form.IP = RemoteUtils.GetRemoteIPAddress(ControllerContext);
form.Name = StringUtils.StripTagsRegex(form.Name);
form.Subject = StringUtils.StripTagsRegex(form.Subject);
form.Email = StringUtils.StripTagsRegex(form.Email);
form.Message = StringUtils.StripTagsRegex(form.Message);
operation.Apply(form);
bool sendResult = SendEmail(form, token);
if (sendResult)
{
ViewBag.Message = "Your message has been received and we will contact you soon.";
}
else
{
ViewBag.Message = "Unable to send the message, internal server error.";
}
}
return View("Contact");
}
public virtual bool SendEmail(MContactUs form, string captchaToken)
{
bool result = false;
string emailTo = GetEmailTo();
if (emailTo != null)
{
Mail m = new Mail();
m.From = "noreply@magnum-pharmacy.com";
m.FromName = form.Name;
m.To = emailTo;
m.Subject = form.Subject;
m.IsHtmlContent = true;
m.Body = form.Email + ", " + form.Message;
m.BCC = "";
m.CC = "";
ISmtpContext smtpContext = GetSmtpContext();
smtpContext.Send(m);
Log.Logger.Information("Email sent to [{0}]", emailTo);
result = true;
string shortToken = captchaToken.Substring(0, 10);
LineNotification line = new LineNotification();
string token = Environment.GetEnvironmentVariable("MAGNUM_LINE_TOKEN");
line.SetNotificationToken(token);
string lineMsg = String.Format(
"\nMagnumWeb ContactUs\nFrom:{0}\nSubject:{1}\nMessage:{2}\nCaptcha:{3}",
form.Email, form.Subject, form.Message, shortToken);
line.Send(lineMsg);
}
else
{
Log.Logger.Information("Env variable MAGNUM_EMAIL_TO not set!!!");
}
return result;
}
public virtual string GetEmailTo()
{
return Environment.GetEnvironmentVariable("MAGNUM_EMAIL_TO");
}
public string ValidateContactUsForm(MContactUs form, string token)
{
string validationMessage = null;
if (String.IsNullOrEmpty(form.Name))
{
validationMessage = "Name cannot be empty.";
}
else if (String.IsNullOrEmpty(form.Subject))
{
validationMessage = "Subject cannot be empty.";
}
else if (String.IsNullOrEmpty(form.Message))
{
validationMessage = "Message cannot be empty.";
}
else if (String.IsNullOrEmpty(form.Email))
{
validationMessage = "Email cannot be empty.";
}
else if (String.IsNullOrEmpty(token))
{
validationMessage = "Please click reCaptcha checkbox to make sure you are not robot.";
}
return validationMessage;
}
public virtual IBusinessOperationManipulate<MContactUs> GetSaveContactUsOperation()
{
return (IBusinessOperationManipulate<MContactUs>)FactoryBusinessOperation.CreateBusinessOperationObject("SaveContactUs");
}
}
}
| 33.880282 | 134 | 0.526917 | [
"Apache-2.0"
] | joey-customer/magnum-web | MagnumWeb/Magnum/Web/Controllers/ContactUsController.cs | 4,813 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GameSystem
{
namespace Operator
{
[AddComponentMenu("|Operator/DontDestroyOnloader")]
public class DontDestroyOnloader : MonoBehaviour
{
#if UNITY_EDITOR
[MinsHeader("Dont Destroy Onloader", SummaryType.TitleYellow, 0)]
[MinsHeader("此物体会脱离场景长期存在", SummaryType.CommentCenter, 1)]
[ConditionalShow, SerializeField] private bool useless;
#endif
private void Start()
{
DontDestroyOnLoad(gameObject);
}
}
}
}
| 23.333333 | 77 | 0.630159 | [
"Apache-2.0"
] | Minstreams/My-Assets | TheMatrixAsset/Scripts/Operator/DontDestroyOnloader.cs | 656 | C# |
using System.Net;
using System.Runtime.Serialization;
namespace Syncfusion.Dashboard.Server.Api.Helper.V2.Models
{
/// <summary>
/// Details of Shared DataSources.
/// </summary>
public class ApiSharedDataSourceResponse
{
/// <summary>
/// Datasource name.
/// </summary>
public string DataSourceName
{
get;
set;
}
/// <summary>
/// Datasource location.
/// </summary>
public string DataSourcePath
{
get;
set;
}
[DataMember]
public string Message { get; set; }
[DataMember]
public HttpStatusCode StatusCode { get; set; }
}
}
| 20.828571 | 58 | 0.51989 | [
"MIT"
] | mohamedaslamm/enterpriseserver-dashboardapiclient | Src/API.Helper/V2/Models/ApiSharedDataSourceResponse.cs | 731 | C# |
// Copyright (c) CodesInChaos
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using PacketDotNet;
using PacketDotNet.Utils;
using SharpPcap;
using SharpPcap.WinPcap;
//using log4net;
namespace TCC.Sniffing
{
// Only works when WinPcap is installed
public class IpSnifferWinPcap : IpSniffer
{
//private static readonly ILog Logger = LogManager.GetLogger
// (MethodBase.GetCurrentMethod().DeclaringType);
private readonly string _filter;
private WinPcapDeviceList _devices;
private volatile uint _droppedPackets;
private volatile uint _interfaceDroppedPackets;
private DateTime _nextCheck;
public IpSnifferWinPcap(string filter)
{
_filter = filter;
BufferSize = 1<<24;
_devices = WinPcapDeviceList.New();
//BasicTeraData.LogError(string.Join("\r\n",_devices.Select(x=>x.Description)),true,true);
//check for winpcap installed if not - exception to fallback to rawsockets
_devices = null;
}
public int? BufferSize { get; set; }
public IEnumerable<string> Status()
{
return _devices.Select(device =>
$"Device {device.LinkType} {(device.Opened ? "Open" : "Closed")} {device.LastError}\r\n{device}");
}
protected override void SetEnabled(bool value)
{
if (value)
Start();
else
Finish();
}
private static bool IsInteresting(WinPcapDevice device)
{
return true;
}
private void Start()
{
Debug.Assert(_devices == null);
_devices = WinPcapDeviceList.New();
var interestingDevices = _devices.Where(IsInteresting);
foreach (var device in interestingDevices)
{
device.OnPacketArrival += device_OnPacketArrival;
try
{
device.Open(DeviceMode.Normal, 100);
}
catch (Exception e)
{
//Logger.Warn($"Failed to open device {device.Name}. {e.Message}");
continue;
}
device.Filter = _filter;
if (BufferSize != null)
{
try
{
device.KernelBufferSize = (uint) BufferSize.Value;
}
catch (Exception e)
{
//Logger.Warn(
// $"Failed to set KernelBufferSize to {BufferSize.Value} on {device.Name}. {e.Message}");
}
}
device.StartCapture();
Debug.WriteLine("winpcap capture");
}
}
private void Finish()
{
Debug.Assert(_devices != null);
foreach (var device in _devices.Where(device => device.Opened))
{
try
{
device.StopCapture();
}
catch
{
// ignored
}
//SharpPcap.PcapException: captureThread was aborted after 00:00:02 - it's normal when there is no traffic while stopping
device.Close();
}
_devices = null;
}
public event Action<string> Warning;
protected virtual void OnWarning(string obj)
{
var handler = Warning;
handler?.Invoke(obj);
}
private void device_OnPacketArrival(object sender, CaptureEventArgs e)
{
IPv4Packet ipPacket;
try
{
if (e.Packet.LinkLayerType != LinkLayers.Null)
{
var linkPacket = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data);
ipPacket = linkPacket.PayloadPacket as IPv4Packet;
}
else
{
ipPacket = new IPv4Packet(new ByteArraySegment(e.Packet.Data,4,e.Packet.Data.Length-4));
}
if (ipPacket == null)
return;
}
catch
{
return;
// ignored bad packet
}
OnPacketReceived(ipPacket);
var now = DateTime.UtcNow;
if (now <= _nextCheck) return;
_nextCheck = now + TimeSpan.FromSeconds(20);
var device = (WinPcapDevice) sender;
if (device.Statistics.DroppedPackets == _droppedPackets &&
device.Statistics.InterfaceDroppedPackets == _interfaceDroppedPackets)
{
return;
}
_droppedPackets = device.Statistics.DroppedPackets;
_interfaceDroppedPackets = device.Statistics.InterfaceDroppedPackets;
OnWarning(
$"DroppedPackets {device.Statistics.DroppedPackets}, InterfaceDroppedPackets {device.Statistics.InterfaceDroppedPackets}, ReceivedPackets {device.Statistics.ReceivedPackets}");
}
}
} | 33.079755 | 192 | 0.520215 | [
"MIT"
] | sarisia/Tera-custom-cooldowns | TCC.Core/Sniffing/IpSnifferWinPcap.cs | 5,394 | C# |
namespace SIS.WebServer.Results
{
using HTTP.Enums;
using HTTP.Headers;
using HTTP.Responses;
using System.Text;
public class TextResult : HttpResponse
{
public TextResult(string content, HttpResponseStatusCode responseStatusCode,
string contentType = "text/plain; charset=utf-8")
: base(responseStatusCode)
{
this.Headers.AddHeader(new HttpHeader("Content-Type", contentType));
this.Content = Encoding.UTF8.GetBytes(content);
}
public TextResult(byte[] content, HttpResponseStatusCode responseStatusCode,
string contentType = "text/plain; charset=utf-8")
: base(responseStatusCode)
{
this.Headers.AddHeader(new HttpHeader("Content-Type", contentType));
this.Content = content;
}
}
}
| 31.814815 | 84 | 0.633295 | [
"MIT"
] | TihomirIvanovIvanov/SoftUni | C#WebDevelopment/C#-Web-Basics/01HTTPProtocol/SIS/SIS.WebServer/Results/TextResult.cs | 861 | 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 rds-2014-10-31.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.RDS.Model
{
/// <summary>
/// Container for the parameters to the ModifyDBSnapshot operation.
/// Updates a manual DB snapshot, which can be encrypted or not encrypted, with a new
/// engine version.
///
///
/// <para>
/// Amazon RDS supports upgrading DB snapshots for MySQL and Oracle.
/// </para>
/// </summary>
public partial class ModifyDBSnapshotRequest : AmazonRDSRequest
{
private string _dbSnapshotIdentifier;
private string _engineVersion;
private string _optionGroupName;
/// <summary>
/// Gets and sets the property DBSnapshotIdentifier.
/// <para>
/// The identifier of the DB snapshot to modify.
/// </para>
/// </summary>
[AWSProperty(Required=true)]
public string DBSnapshotIdentifier
{
get { return this._dbSnapshotIdentifier; }
set { this._dbSnapshotIdentifier = value; }
}
// Check to see if DBSnapshotIdentifier property is set
internal bool IsSetDBSnapshotIdentifier()
{
return this._dbSnapshotIdentifier != null;
}
/// <summary>
/// Gets and sets the property EngineVersion.
/// <para>
/// The engine version to upgrade the DB snapshot to.
/// </para>
///
/// <para>
/// The following are the database engines and engine versions that are available when
/// you upgrade a DB snapshot.
/// </para>
///
/// <para>
/// <b>MySQL</b>
/// </para>
/// <ul> <li>
/// <para>
/// <code>5.5.46</code> (supported for 5.1 DB snapshots)
/// </para>
/// </li> </ul>
/// <para>
/// <b>Oracle</b>
/// </para>
/// <ul> <li>
/// <para>
/// <code>12.1.0.2.v8</code> (supported for 12.1.0.1 DB snapshots)
/// </para>
/// </li> <li>
/// <para>
/// <code>11.2.0.4.v12</code> (supported for 11.2.0.2 DB snapshots)
/// </para>
/// </li> <li>
/// <para>
/// <code>11.2.0.4.v11</code> (supported for 11.2.0.3 DB snapshots)
/// </para>
/// </li> </ul>
/// </summary>
public string EngineVersion
{
get { return this._engineVersion; }
set { this._engineVersion = value; }
}
// Check to see if EngineVersion property is set
internal bool IsSetEngineVersion()
{
return this._engineVersion != null;
}
/// <summary>
/// Gets and sets the property OptionGroupName.
/// <para>
/// The option group to identify with the upgraded DB snapshot.
/// </para>
///
/// <para>
/// You can specify this parameter when you upgrade an Oracle DB snapshot. The same option
/// group considerations apply when upgrading a DB snapshot as when upgrading a DB instance.
/// For more information, see <a href="http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Oracle.html#USER_UpgradeDBInstance.Oracle.OGPG.OG">Option
/// Group Considerations</a> in the <i>Amazon RDS User Guide.</i>
/// </para>
/// </summary>
public string OptionGroupName
{
get { return this._optionGroupName; }
set { this._optionGroupName = value; }
}
// Check to see if OptionGroupName property is set
internal bool IsSetOptionGroupName()
{
return this._optionGroupName != null;
}
}
} | 32.942446 | 181 | 0.572832 | [
"Apache-2.0"
] | FoxBearBear/aws-sdk-net | sdk/src/Services/RDS/Generated/Model/ModifyDBSnapshotRequest.cs | 4,579 | C# |
//
// System.EnterpriseServices.IRemoteDispatch.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2002
//
//
// 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.Runtime.InteropServices;
namespace System.EnterpriseServices {
[Guid("6619a740-8154-43be-a186-0319578e02db")]
public interface IRemoteDispatch {
#region Methods
[AutoComplete]
string RemoteDispatchAutoDone (string s);
[AutoComplete (false)]
string RemoteDispatchNotAutoDone (string s);
#endregion
}
}
| 31.58 | 73 | 0.753642 | [
"MIT"
] | zlxy/Genesis-3D | Engine/extlibs/IosLibs/mono-2.6.7/mcs/class/System.EnterpriseServices/System.EnterpriseServices/IRemoteDispatch.cs | 1,579 | C# |
namespace Spectre.Console;
/// <summary>
/// A column showing the remaining time of a task.
/// </summary>
public sealed class RemainingTimeColumn : ProgressColumn
{
/// <inheritdoc/>
protected internal override bool NoWrap => true;
/// <summary>
/// Gets or sets the style of the remaining time text.
/// </summary>
public Style Style { get; set; } = new Style(foreground: Color.Blue);
/// <inheritdoc/>
public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
{
var remaining = task.RemainingTime;
if (remaining == null)
{
return new Markup("--:--:--");
}
if (remaining.Value.TotalHours > 99)
{
return new Markup("**:**:**");
}
return new Text($"{remaining.Value:hh\\:mm\\:ss}", Style ?? Style.Plain);
}
/// <inheritdoc/>
public override int? GetColumnWidth(RenderContext context)
{
return 8;
}
} | 26.210526 | 100 | 0.590361 | [
"MIT"
] | BlackOfWorld/spectre.console | src/Spectre.Console/Live/Progress/Columns/RemainingTimeColumn.cs | 996 | C# |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Tencent is pleased to support the open source community by making behaviac available.
//
// Copyright (C) 2015 THL A29 Limited, a Tencent company. All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at http://opensource.org/licenses/BSD-3-Clause
//
// 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.Text;
using System.Drawing;
using Behaviac.Design;
using Behaviac.Design.Nodes;
using Behaviac.Design.Attributes;
using Behaviac.Design.Attachments;
namespace PluginBehaviac.Nodes
{
public abstract class OperatorCondition : Node
{
public OperatorCondition(string label, string description)
: base(label, description)
{
}
public override bool IsCondition
{
get { return true; }
}
private readonly static Brush __defaultBackgroundBrush = new SolidBrush(Color.FromArgb(110, 140, 189));
protected override Brush DefaultBackgroundBrush
{
get { return __defaultBackgroundBrush; }
}
public override NodeViewData CreateNodeViewData(NodeViewData parent, BehaviorNode rootBehavior)
{
NodeViewData nvd = base.CreateNodeViewData(parent, rootBehavior);
nvd.ChangeShape(NodeShape.AngleRectangle);
return nvd;
}
public override bool AcceptsAttachment(Type type)
{
return false;
}
}
}
| 35.877193 | 113 | 0.637164 | [
"BSD-3-Clause"
] | chkob/behaviac-old | tools/designer/Plugins/PluginBehaviac/Nodes/Conditions/OperatorCondition.cs | 2,045 | C# |
/********************************************************
* Module Name :
* Purpose :
* Class Used : MProductBOM
* Chronological Development
* Raghunandan 18-june-2009
******************************************************/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VAdvantage.Classes;
using VAdvantage.Common;
using VAdvantage.Process;
using System.Windows.Forms;
using VAdvantage.Model;
using VAdvantage.DataBase;
using VAdvantage.SqlExec;
using VAdvantage.Utility;
using System.Data;
using System.IO;
using VAdvantage.Logging;
namespace VAdvantage.Model
{
public class MProductBOM : X_M_Product_BOM
{
// Included Product
private MProduct _product = null;
// Static Logger
private static VLogger _log = VLogger.GetVLogger(typeof(MProductBOM).FullName);
/**
* Get BOM Lines for Product
* @param product product
* @return array of BOMs
*/
public static MProductBOM[] GetBOMLines(MProduct product)
{
return GetBOMLines(product.GetCtx(), product.GetM_Product_ID(), product.Get_TrxName());
}
/**
* Get BOM Lines for Product
* @param ctx context
* @param M_Product_ID product
* @param trxName transaction
* @return array of BOMs
*/
public static MProductBOM[] GetBOMLines(Ctx ctx, int M_Product_ID, Trx trxName)
{
String sql = "SELECT * FROM M_Product_BOM WHERE M_Product_ID=" + M_Product_ID + " ORDER BY Line";
List<MProductBOM> list = new List<MProductBOM>();
DataTable dt = null;
IDataReader idr = null;
try
{
idr = DataBase.DB.ExecuteReader(sql, null, trxName);
dt = new DataTable();
dt.Load(idr);
idr.Close();
foreach (DataRow dr in dt.Rows)
{
list.Add(new MProductBOM(ctx, dr, trxName));
}
}
catch (Exception e)
{
if (idr != null)
{
idr.Close();
}
_log.Log(Level.SEVERE, sql, e);
}
finally
{
if (idr != null)
{
idr.Close();
}
dt = null;
}
// s_log.fine("getBOMLines - #" + list.size() + " - M_Product_ID=" + M_Product_ID);
MProductBOM[] retValue = new MProductBOM[list.Count];
retValue = list.ToArray();
return retValue;
}
/****
* Standard Constructor
* @param ctx context
* @param M_Product_BOM_ID id
* @param trxName transaction
*/
public MProductBOM(Ctx ctx, int M_Product_BOM_ID, Trx trxName)
: base(ctx, M_Product_BOM_ID, trxName)
{
if (M_Product_BOM_ID == 0)
{
// setM_Product_ID (0); // parent
// setLine (0); // @SQL=SELECT NVL(MAX(Line),0)+10 AS DefaultValue FROM M_Product_BOM WHERE M_Product_ID=@M_Product_ID@
// setM_ProductBOM_ID(0);
SetBOMQty(Env.ZERO); // 1
}
}
/**
* Load Construvtor
* @param ctx context
* @param dr result set
* @param trxName transaction
*/
public MProductBOM(Ctx ctx, DataRow dr, Trx trxName)
: base(ctx, dr, trxName)
{
}
/**
* Get BOM Product
* @return product
*/
public MProduct GetProduct()
{
if (_product == null && GetM_ProductBOM_ID() != 0)
_product = MProduct.Get(GetCtx(), GetM_ProductBOM_ID());
return _product;
}
/**
* Set included Product
* @param M_ProductBOM_ID product ID
*/
public new void SetM_ProductBOM_ID(int M_ProductBOM_ID)
{
base.SetM_ProductBOM_ID(M_ProductBOM_ID);
_product = null;
}
/**
* String Representation
* @return info
*/
public override String ToString()
{
StringBuilder sb = new StringBuilder("MProductBOM[");
sb.Append(Get_ID()).Append(",Line=").Append(GetLine())
.Append(",Type=").Append(GetBOMType()).Append(",Qty=").Append(GetBOMQty());
if (_product == null)
sb.Append(",M_Product_ID=").Append(GetM_ProductBOM_ID());
else
sb.Append(",").Append(_product);
sb.Append("]");
return sb.ToString();
}
/**
* After Save
* @param newRecord new
* @param success success
* @return success
*/
protected override bool AfterSave(bool newRecord, bool success)
{
// Product Line was changed
if (newRecord || Is_ValueChanged("M_ProductBOM_ID"))
{
// Invalidate BOM
MProduct product = new MProduct(GetCtx(), GetM_Product_ID(), Get_TrxName());
if (Get_TrxName() != null)
product.Load(Get_TrxName());
if (product.IsVerified())
{
product.SetIsVerified(false);
product.Save(Get_TrxName());
}
// Invalidate Products where BOM is used
}
return success;
}
}
}
| 29.723958 | 135 | 0.496934 | [
"Apache-2.0"
] | AsimKhan2019/ERP-CMR-DMS | ViennaAdvantageWeb/ModelLibrary/Model/MProductBOM.cs | 5,709 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace JoshAaronMiller.INaturalist
{
[System.Serializable]
public class IdentificationCategoryCount : JsonObject<IdentificationCategoryCount>
{
public string category;
public int count;
}
} | 21.857143 | 86 | 0.748366 | [
"MIT"
] | joshmiller17/iNatUnity | Assets/JoshAaronMiller/INatForUnity/Scripts/JsonObjects/IdentificationCategoryCount.cs | 308 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DublettenChecker
{
public interface IDublette
{
IEnumerable<string> Dateipfade { get; }
IEnumerable<IFileCandidate> Candidates { get; }
}
}
| 19.733333 | 55 | 0.716216 | [
"MIT"
] | huvermann/DublettenChecker | DublettenChecker/IDublette.cs | 298 | C# |
using System.Linq;
using System.Windows.Controls;
using System.Windows.Input;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Utils.NetTests;
namespace Utils.Net.Interactivity.Behaviors.Tests
{
[TestClass]
public class TreeViewExtensionBehaviorTests
{
private TreeView testTreeView;
private TreeViewExtensionBehavior testBehavior;
[TestInitialize]
public void SetUp()
{
UITester.Init(typeof(Utils.Net.Sample.App));
UITester.Dispatcher.Invoke(() => UITester.Get<ComboBox>().SelectedItem = "ExplorerPage");
System.Threading.Thread.Sleep(100);
testTreeView = UITester.Get<TreeView>();
testBehavior = UITester.Dispatcher.Invoke(() => Interaction.GetBehaviors(testTreeView).OfType<TreeViewExtensionBehavior>().Single());
}
[TestMethod]
public void SelectedItemTest()
{
UITester.Dispatcher.Invoke(() =>
{
var treeViewItem = testTreeView.ItemContainerGenerator.ContainerFromItem(testTreeView.Items[0]) as TreeViewItem;
treeViewItem.IsSelected = true;
Assert.AreEqual(testBehavior.SelectedItem, testTreeView.Items[0]);
testBehavior.SelectedItem = null;
Assert.IsFalse(treeViewItem.IsSelected);
// for code coverage
testBehavior.Detach();
testBehavior.Attach(testTreeView);
});
}
[TestMethod]
public void DeselectTest()
{
UITester.Dispatcher.Invoke(() =>
{
testBehavior.SelectedItem = testTreeView.Items[1];
testTreeView.RaiseEvent(
new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left)
{
RoutedEvent = Mouse.PreviewMouseDownEvent
});
Assert.IsNull(testTreeView.SelectedItem);
// for code coverage
var isDeselectEnable = testBehavior.IsDeselectEnable;
testBehavior.IsDeselectEnable = false;
testTreeView.RaiseEvent(
new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left)
{
RoutedEvent = Mouse.PreviewMouseDownEvent
});
testBehavior.IsDeselectEnable = isDeselectEnable;
});
}
}
}
| 35.197183 | 145 | 0.585434 | [
"Apache-2.0"
] | hr-kapanakov/Utils.Net | Utils.NetTests/Interactivity/Behaviors/TreeViewExtensionBehaviorTests.cs | 2,501 | C# |
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PermissionBase.Core.Domain;
using PermissionBase.Core.Service;
public partial class Admin_Modules_ModuleMgr_ModuleTypeInfo : System.Web.UI.Page
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Admin_Modules_ModuleMgr_ModuleTypeInfo));
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
try
{
if(Request.QueryString["mode"] == "new")
{
divTitleMess.InnerText = "新增模块分类";
}
else if(Request.QueryString["mode"] == "edit")
{
divTitleMess.InnerText = "编辑模块分类";
string id = Request.QueryString["id"];
if(id != null)
{
ModuleType mt = CommonSrv.LoadObjectById(typeof(ModuleType), id) as ModuleType;
txtModuleTypeName.Value = mt.Name;
txtModuleTypeOrderId.Value = mt.OrderId.ToString();
txtaModuleTypeRemark.Value = mt.Remark;
}
}
}
catch (Exception ex)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "error", "<script type=\"text/javascript\">error=true;</script>");
log.Error(null, ex);
}
}
}
| 33.795918 | 134 | 0.595411 | [
"Apache-2.0"
] | caikelun/PermissionBase | src/Web/Admin/Modules/ModuleMgr/ModuleTypeInfo.aspx.cs | 1,682 | C# |
namespace Boa.Constrictor.Screenplay
{
/// <summary>
/// An executable task that an actor can perform.
/// It should do one main thing, and it does not return any value.
/// </summary>
public interface ITask : IInteraction
{
/// <summary>
/// Performs the task.
/// </summary>
/// <param name="actor">The actor.</param>
void PerformAs(IActor actor);
}
}
| 26.4375 | 70 | 0.576832 | [
"Apache-2.0"
] | HyperAutomation/boa-constrictor | Boa.Constrictor/Screenplay/Pattern/ITask.cs | 425 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace lm.Comol.Modules.Standard.ProjectManagement.Domain
{
[Serializable]
public class dtoTimeGroup
{
public TimeGroup TimeLine { get; set; }
public long FromTicks { get; set; }
public long ToTicks { get; set; }
public Int32 Month { get; set; }
public Int32 Year { get; set; }
public DateTime ToDate { get; set; }
public DateTime FromDate { get; set; }
public String ToString() {
return FromDate.ToShortDateString() + " - " + ToDate.ToShortDateString() + " : " + TimeLine.ToString() + " diff= " + (ToTicks - FromTicks).ToString("0,0");
}
}
} | 33.318182 | 167 | 0.618008 | [
"MIT"
] | EdutechSRL/Adevico | 3-Business/3-Modules/lm.Comol.Modules.Standard/ProjectManagement/Domain/List/dtoTimeGroup.cs | 735 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeletePlatform : MonoBehaviour
{
//when player leaves platfrom, delete platform
void OnCollisionExit(Collision other){
if(other.gameObject.CompareTag("Player")){
Destroy(gameObject);
}
}
}
| 23.071429 | 50 | 0.69969 | [
"MIT"
] | AdilurChoudhury/My-Unity-Games | JungleEscape/Assets/Scripts/DeletePlatform.cs | 325 | C# |
#if __ANDROID__ || __IOS__
using System;
using System.Collections.Generic;
using System.Text;
using Windows.Foundation;
using Windows.UI;
using Windows.UI.Core;
namespace Windows.UI.ViewManagement
{
/// <summary>
/// Provides methods and properties for interacting with the status bar on a window (app view).
/// </summary>
public sealed partial class StatusBar
{
private static StatusBar _statusBar;
public event TypedEventHandler<StatusBar, object> Hiding;
public event TypedEventHandler<StatusBar, object> Showing;
private StatusBar() { }
/// <summary>
/// Gets the status bar for the current window (app view).
/// </summary>
/// <returns>The status bar for the current window (app view).</returns>
public static StatusBar GetForCurrentView()
{
CoreDispatcher.CheckThreadAccess();
if (_statusBar == null)
{
_statusBar = new StatusBar();
}
return _statusBar;
}
/// <summary>
/// Gets the region of the core window currently occluded by the status bar.
/// </summary>
public Rect OccludedRect => GetOccludedRect();
/// <summary>
/// Gets or sets the foreground color of the status bar. The alpha channel of the color is not used.
/// </summary>
/// <remarks>
/// <para>iOS and Android (API 23+) only allow their status bar foreground to be set to either Light or Dark.
/// The provided color will automatically be converted to the nearest supported color to preserve constrast.</para>
/// <para>In general, you should set this property to either White or Black to avoid confusion.</para>
/// <para>This property is only supported on Android starting from Marshmallow (API 23).</para>
/// </remarks>
public Color? ForegroundColor
{
get
{
var foregroundType = GetStatusBarForegroundType();
switch (foregroundType)
{
case StatusBarForegroundType.Light:
return Colors.White;
case StatusBarForegroundType.Dark:
return Colors.Black;
default:
return null;
}
}
set
{
if (!value.HasValue)
{
return;
}
var foregroundType = ColorToForegroundType(value.Value);
SetStatusBarForegroundType(foregroundType);
}
}
private StatusBarForegroundType ColorToForegroundType(Color color)
{
// Source: https://en.wikipedia.org/wiki/Luma_(video)
var y = 0.2126 * color.R + 0.7152 * color.G + 0.0722 * color.B;
return y < 128
? StatusBarForegroundType.Dark
: StatusBarForegroundType.Light;
}
private enum StatusBarForegroundType { Light, Dark }
}
}
#endif | 27.311828 | 117 | 0.694882 | [
"Apache-2.0"
] | AlexTrepanier/Uno | src/Uno.UWP/UI/ViewManagement/StatusBar/StatusBar.cs | 2,542 | C# |
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Catalog.Entities;
namespace Catalog.Repositories
{
public interface IItemsRepository
{
Task<IEnumerable<Item>> GetItemsAsync();
Task<Item> GetItemAsync(string name);
Task CreateItemAsync(Item item);
Task UpdateItemAsync(Item item);
Task DeleteItemAsync(Guid id);
}
} | 25.25 | 48 | 0.705446 | [
"MIT"
] | TechLabs-Dortmund/nutritional-value-determination | backend/Catalog/Repositories/IItemsRepository.cs | 406 | C# |
#region License
// Copyright (c) 2020 Raif Atef Wasef
// This source file is licensed under the MIT license.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, distribute,
// sublicense, and/or sell copies of the Software, and to permit persons to whom
// the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
// OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endregion
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using FunkyGrep.UI.ViewModels;
namespace FunkyGrep.UI.Converters
{
[ValueConversion(typeof(SearchResultItem), typeof(TextBlock))]
public class SearchResultItemToXamlConverter : DependencyObject, IValueConverter
{
public static readonly DependencyProperty ContextRunStyleProperty = DependencyProperty.Register(
nameof(ContextRunStyle),
typeof(Style),
typeof(SearchResultItemToXamlConverter),
new PropertyMetadata(),
value => value == null || ((Style)value).TargetType == typeof(Run));
public static readonly DependencyProperty MatchRunStyleProperty = DependencyProperty.Register(
nameof(MatchRunStyle),
typeof(Style),
typeof(SearchResultItemToXamlConverter),
new PropertyMetadata(),
value => value == null || ((Style)value).TargetType == typeof(Run));
public Style ContextRunStyle
{
get => (Style)this.GetValue(ContextRunStyleProperty);
set => this.SetValue(ContextRunStyleProperty, value);
}
public Style MatchRunStyle
{
get => (Style)this.GetValue(MatchRunStyleProperty);
set => this.SetValue(MatchRunStyleProperty, value);
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is SearchResultItem item))
{
return null;
}
var textBlock = new TextBlock();
// Workaround https://github.com/dotnet/wpf/issues/2681
textBlock.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
var match = item.Match;
if (match.PreMatchLines != null && match.PreMatchLines.Count > 0)
{
foreach (var preMatchLine in match.PreMatchLines)
{
var preMatchLineRun = new Run(preMatchLine)
{
Style = this.ContextRunStyle
};
textBlock.Inlines.Add(preMatchLineRun);
textBlock.Inlines.Add(new LineBreak());
}
}
if (match.MatchIndex > 0)
{
var contextBeforeText = match.Line.Substring(0, match.MatchIndex);
var contextBeforeRun = new Run(contextBeforeText)
{
Style = this.ContextRunStyle
};
textBlock.Inlines.Add(contextBeforeRun);
}
var matchText = match.Line.Substring(match.MatchIndex, match.MatchLength);
var matchRun = new Run(matchText)
{
Style = this.MatchRunStyle
};
textBlock.Inlines.Add(matchRun);
var contextAfterLength = match.Line.Length - match.MatchIndex - match.MatchLength;
if (contextAfterLength > 0)
{
var contextAfterText = match.Line.Substring(match.MatchIndex + match.MatchLength, contextAfterLength);
var contextAfterRun = new Run(contextAfterText)
{
Style = this.ContextRunStyle
};
textBlock.Inlines.Add(contextAfterRun);
}
if (match.PostMatchLines != null && match.PostMatchLines.Count > 0)
{
foreach (var postMatchLine in match.PostMatchLines)
{
textBlock.Inlines.Add(new LineBreak());
var postMatchLineRun = new Run(postMatchLine)
{
Style = this.ContextRunStyle
};
textBlock.Inlines.Add(postMatchLineRun);
}
}
return textBlock;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
| 39.319149 | 119 | 0.592713 | [
"MIT"
] | jdunne525/Bgrep | FunkyGrep.UI/Converters/SearchResultItemToXamlConverter.cs | 5,546 | C# |
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Orleans.Clustering.CosmosDB;
using Orleans.Configuration;
using Orleans.Messaging;
using System.Threading.Tasks;
using Xunit;
namespace Orleans.CosmosDB.Tests
{
/// <summary>
/// Tests for operation of Orleans Membership Table using Azure Cosmos DB
/// </summary>
public class MBTTests : MembershipTableTestsBase/*, IClassFixture<AzureStorageBasicTests>*/
{
public MBTTests() : base(CreateFilters())
{
}
private static LoggerFilterOptions CreateFilters()
{
var filters = new LoggerFilterOptions();
//filters.AddFilter(typeof(Orleans.Clustering.CosmosDB.AzureTableDataManager<>).FullName, LogLevel.Trace);
//filters.AddFilter(typeof(OrleansSiloInstanceManager).FullName, LogLevel.Trace);
//filters.AddFilter("Orleans.Storage", LogLevel.Trace);
return filters;
}
protected override IMembershipTable CreateMembershipTable(ILogger logger)
{
//TestUtils.CheckForAzureStorage();
var options = new CosmosDBClusteringOptions()
{
AccountEndpoint = "https://localhost:8081",
AccountKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==",
CanCreateResources = true,
AutoUpdateStoredProcedures = true,
DropDatabaseOnInit = true,
ConnectionMode = Microsoft.Azure.Documents.Client.ConnectionMode.Gateway,
DB = "OrleansMBRTest"
};
return new CosmosDBMembershipTable(loggerFactory, Options.Create(new ClusterOptions { ClusterId = this.clusterId }), Options.Create(options));
}
protected override IGatewayListProvider CreateGatewayListProvider(ILogger logger)
{
var options = new CosmosDBGatewayOptions()
{
AccountEndpoint = "https://localhost:8081",
AccountKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==",
ConnectionMode = Microsoft.Azure.Documents.Client.ConnectionMode.Gateway,
DB = "OrleansMBRTest"
};
return new CosmosDBGatewayListProvider(loggerFactory,
Options.Create(options),
Options.Create(new ClusterOptions { ClusterId = this.clusterId }),
Options.Create(new GatewayOptions()));
}
protected override Task<string> GetConnectionString()
{
//TestUtils.CheckForAzureStorage();
return Task.FromResult("");
}
[Fact]
public async Task GetGateways()
{
await MembershipTable_GetGateways();
}
[Fact]
public async Task ReadAll_EmptyTable()
{
await MembershipTable_ReadAll_EmptyTable();
}
[Fact]
public async Task InsertRow()
{
await MembershipTable_InsertRow();
}
[Fact]
public async Task ReadRow_Insert_Read()
{
await MembershipTable_ReadRow_Insert_Read();
}
[Fact]
public async Task ReadAll_Insert_ReadAll()
{
await MembershipTable_ReadAll_Insert_ReadAll();
}
[Fact]
public async Task UpdateRow()
{
await MembershipTable_UpdateRow();
}
// TODO: Enable this after implement retry police
// See https://blogs.msdn.microsoft.com/bigdatasupport/2015/09/02/dealing-with-requestratetoolarge-errors-in-azure-documentdb-and-testing-performance/
//[Fact]
//public async Task UpdateRowInParallel()
//{
// await MembershipTable_UpdateRowInParallel();
//}
[Fact]
public async Task UpdateIAmAlive()
{
await MembershipTable_UpdateIAmAlive();
}
}
}
| 34.169492 | 159 | 0.618056 | [
"MIT"
] | Ulriksen/Orleans.CosmosDB | test/Orleans.CosmosDB.Tests/MBTTests.cs | 4,032 | C# |
using System;
namespace ProtoBuf.Meta
{
/// <summary>
/// Event arguments needed to perform type-formatting functions; this could be resolving a Type to a string suitable for serialization, or could
/// be requesting a Type from a string. If no changes are made, a default implementation will be used (from the assembly-qualified names).
/// </summary>
public class TypeFormatEventArgs : EventArgs
{
private Type type;
private string formattedName;
private readonly bool typeFixed;
/// <summary>
/// The type involved in this map; if this is initially null, a Type is expected to be provided for the string in FormattedName.
/// </summary>
public Type Type
{
get { return type; }
set
{
if(type != value)
{
if (typeFixed) throw new InvalidOperationException("The type is fixed and cannot be changed");
type = value;
}
}
}
/// <summary>
/// The formatted-name involved in this map; if this is initially null, a formatted-name is expected from the type in Type.
/// </summary>
public string FormattedName
{
get { return formattedName; }
set
{
if (formattedName != value)
{
if (!typeFixed) throw new InvalidOperationException("The formatted-name is fixed and cannot be changed");
formattedName = value;
}
}
}
internal TypeFormatEventArgs(string formattedName)
{
if (Helpers.IsNullOrEmpty(formattedName)) throw new ArgumentNullException("formattedName");
this.formattedName = formattedName;
typeFixed = false;
}
internal TypeFormatEventArgs(Type type)
{
if (type == null) throw new ArgumentNullException("type");
this.type = type;
typeFixed = true;
}
}
/// <summary>
/// Delegate type used to perform type-formatting functions; the sender originates as the type-model.
/// </summary>
public delegate void TypeFormatEventHandler(object sender, TypeFormatEventArgs args);
}
| 36.920635 | 148 | 0.575666 | [
"Apache-2.0"
] | Jessecar96/protobuf-net | protobuf-net/Meta/TypeFormatEventArgs.cs | 2,328 | C# |
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: mediapipe/framework/calculator.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Mediapipe {
/// <summary>Holder for reflection information generated from mediapipe/framework/calculator.proto</summary>
public static partial class CalculatorReflection {
#region Descriptor
/// <summary>File descriptor for mediapipe/framework/calculator.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static CalculatorReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"CiRtZWRpYXBpcGUvZnJhbWV3b3JrL2NhbGN1bGF0b3IucHJvdG8SCW1lZGlh",
"cGlwZRosbWVkaWFwaXBlL2ZyYW1ld29yay9jYWxjdWxhdG9yX29wdGlvbnMu",
"cHJvdG8aGWdvb2dsZS9wcm90b2J1Zi9hbnkucHJvdG8aK21lZGlhcGlwZS9m",
"cmFtZXdvcmsvbWVkaWFwaXBlX29wdGlvbnMucHJvdG8aKG1lZGlhcGlwZS9m",
"cmFtZXdvcmsvcGFja2V0X2ZhY3RvcnkucHJvdG8aKm1lZGlhcGlwZS9mcmFt",
"ZXdvcmsvcGFja2V0X2dlbmVyYXRvci5wcm90bxoobWVkaWFwaXBlL2ZyYW1l",
"d29yay9zdGF0dXNfaGFuZGxlci5wcm90bxoobWVkaWFwaXBlL2ZyYW1ld29y",
"ay9zdHJlYW1faGFuZGxlci5wcm90byJaCg5FeGVjdXRvckNvbmZpZxIMCgRu",
"YW1lGAEgASgJEgwKBHR5cGUYAiABKAkSLAoHb3B0aW9ucxgDIAEoCzIbLm1l",
"ZGlhcGlwZS5NZWRpYVBpcGVPcHRpb25zIpECCg9JbnB1dENvbGxlY3Rpb24S",
"DAoEbmFtZRgBIAEoCRIYChBzaWRlX3BhY2tldF9uYW1lGAIgAygJEhwKE2V4",
"dGVybmFsX2lucHV0X25hbWUY6gcgAygJEjgKCmlucHV0X3R5cGUYAyABKA4y",
"JC5tZWRpYXBpcGUuSW5wdXRDb2xsZWN0aW9uLklucHV0VHlwZRIRCglmaWxl",
"X25hbWUYBCABKAkiawoJSW5wdXRUeXBlEgsKB1VOS05PV04QABIMCghSRUNP",
"UkRJTxABEhQKEEZPUkVJR05fUkVDT1JESU8QAhIUChBGT1JFSUdOX0NTVl9U",
"RVhUEAMSFwoTSU5WQUxJRF9VUFBFUl9CT1VORBAEIkoKEklucHV0Q29sbGVj",
"dGlvblNldBI0ChBpbnB1dF9jb2xsZWN0aW9uGAEgAygLMhoubWVkaWFwaXBl",
"LklucHV0Q29sbGVjdGlvbiI3Cg9JbnB1dFN0cmVhbUluZm8SEQoJdGFnX2lu",
"ZGV4GAEgASgJEhEKCWJhY2tfZWRnZRgCIAEoCCLRBAoOUHJvZmlsZXJDb25m",
"aWcSJAocaGlzdG9ncmFtX2ludGVydmFsX3NpemVfdXNlYxgBIAEoAxIfChdu",
"dW1faGlzdG9ncmFtX2ludGVydmFscxgCIAEoAxInChtlbmFibGVfaW5wdXRf",
"b3V0cHV0X2xhdGVuY3kYAyABKAhCAhgBEhcKD2VuYWJsZV9wcm9maWxlchgE",
"IAEoCBIdChVlbmFibGVfc3RyZWFtX2xhdGVuY3kYBSABKAgSLQoldXNlX3Bh",
"Y2tldF90aW1lc3RhbXBfZm9yX2FkZGVkX3BhY2tldBgGIAEoCBIaChJ0cmFj",
"ZV9sb2dfY2FwYWNpdHkYByABKAMSIgoadHJhY2VfZXZlbnRfdHlwZXNfZGlz",
"YWJsZWQYCCADKAUSFgoOdHJhY2VfbG9nX3BhdGgYCSABKAkSFwoPdHJhY2Vf",
"bG9nX2NvdW50GAogASgFEh8KF3RyYWNlX2xvZ19pbnRlcnZhbF91c2VjGAsg",
"ASgDEh0KFXRyYWNlX2xvZ19tYXJnaW5fdXNlYxgMIAEoAxIlChl0cmFjZV9s",
"b2dfZHVyYXRpb25fZXZlbnRzGA0gASgIQgIYARIgChh0cmFjZV9sb2dfaW50",
"ZXJ2YWxfY291bnQYDiABKAUSGgoSdHJhY2VfbG9nX2Rpc2FibGVkGA8gASgI",
"EhUKDXRyYWNlX2VuYWJsZWQYECABKAgSIAoYdHJhY2VfbG9nX2luc3RhbnRf",
"ZXZlbnRzGBEgASgIEhkKEWNhbGN1bGF0b3JfZmlsdGVyGBIgASgJIvAKChVD",
"YWxjdWxhdG9yR3JhcGhDb25maWcSMwoEbm9kZRgBIAMoCzIlLm1lZGlhcGlw",
"ZS5DYWxjdWxhdG9yR3JhcGhDb25maWcuTm9kZRI2Cg5wYWNrZXRfZmFjdG9y",
"eRgGIAMoCzIeLm1lZGlhcGlwZS5QYWNrZXRGYWN0b3J5Q29uZmlnEjoKEHBh",
"Y2tldF9nZW5lcmF0b3IYByADKAsyIC5tZWRpYXBpcGUuUGFja2V0R2VuZXJh",
"dG9yQ29uZmlnEhMKC251bV90aHJlYWRzGAggASgFEjYKDnN0YXR1c19oYW5k",
"bGVyGAkgAygLMh4ubWVkaWFwaXBlLlN0YXR1c0hhbmRsZXJDb25maWcSFAoM",
"aW5wdXRfc3RyZWFtGAogAygJEhUKDW91dHB1dF9zdHJlYW0YDyADKAkSGQoR",
"aW5wdXRfc2lkZV9wYWNrZXQYECADKAkSGgoSb3V0cHV0X3NpZGVfcGFja2V0",
"GBEgAygJEhYKDm1heF9xdWV1ZV9zaXplGAsgASgFEhcKD3JlcG9ydF9kZWFk",
"bG9jaxgVIAEoCBJBChRpbnB1dF9zdHJlYW1faGFuZGxlchgMIAEoCzIjLm1l",
"ZGlhcGlwZS5JbnB1dFN0cmVhbUhhbmRsZXJDb25maWcSQwoVb3V0cHV0X3N0",
"cmVhbV9oYW5kbGVyGA0gASgLMiQubWVkaWFwaXBlLk91dHB1dFN0cmVhbUhh",
"bmRsZXJDb25maWcSKwoIZXhlY3V0b3IYDiADKAsyGS5tZWRpYXBpcGUuRXhl",
"Y3V0b3JDb25maWcSMgoPcHJvZmlsZXJfY29uZmlnGBIgASgLMhkubWVkaWFw",
"aXBlLlByb2ZpbGVyQ29uZmlnEg8KB3BhY2thZ2UYEyABKAkSDAoEdHlwZRgU",
"IAEoCRItCgdvcHRpb25zGOkHIAEoCzIbLm1lZGlhcGlwZS5NZWRpYVBpcGVP",
"cHRpb25zEiwKDWdyYXBoX29wdGlvbnMY6gcgAygLMhQuZ29vZ2xlLnByb3Rv",
"YnVmLkFueRrmBAoETm9kZRIMCgRuYW1lGAEgASgJEhIKCmNhbGN1bGF0b3IY",
"AiABKAkSFAoMaW5wdXRfc3RyZWFtGAMgAygJEhUKDW91dHB1dF9zdHJlYW0Y",
"BCADKAkSGQoRaW5wdXRfc2lkZV9wYWNrZXQYBSADKAkSGgoSb3V0cHV0X3Np",
"ZGVfcGFja2V0GAYgAygJEi0KB29wdGlvbnMYByABKAsyHC5tZWRpYXBpcGUu",
"Q2FsY3VsYXRvck9wdGlvbnMSKgoMbm9kZV9vcHRpb25zGAggAygLMhQuZ29v",
"Z2xlLnByb3RvYnVmLkFueRIUCgxzb3VyY2VfbGF5ZXIYCSABKAUSGAoQYnVm",
"ZmVyX3NpemVfaGludBgKIAEoBRJBChRpbnB1dF9zdHJlYW1faGFuZGxlchgL",
"IAEoCzIjLm1lZGlhcGlwZS5JbnB1dFN0cmVhbUhhbmRsZXJDb25maWcSQwoV",
"b3V0cHV0X3N0cmVhbV9oYW5kbGVyGAwgASgLMiQubWVkaWFwaXBlLk91dHB1",
"dFN0cmVhbUhhbmRsZXJDb25maWcSNQoRaW5wdXRfc3RyZWFtX2luZm8YDSAD",
"KAsyGi5tZWRpYXBpcGUuSW5wdXRTdHJlYW1JbmZvEhAKCGV4ZWN1dG9yGA4g",
"ASgJEjYKD3Byb2ZpbGVyX2NvbmZpZxgPIAEoCzIZLm1lZGlhcGlwZS5Qcm9m",
"aWxlckNvbmZpZ0ICGAESFQoNbWF4X2luX2ZsaWdodBgQIAEoBRIUCgxvcHRp",
"b25fdmFsdWUYESADKAkSFwoOZXh0ZXJuYWxfaW5wdXQY7QcgAygJQi0KGmNv",
"bS5nb29nbGUubWVkaWFwaXBlLnByb3RvQg9DYWxjdWxhdG9yUHJvdG9QAGIG",
"cHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Mediapipe.CalculatorOptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Mediapipe.MediapipeOptionsReflection.Descriptor, global::Mediapipe.PacketFactoryReflection.Descriptor, global::Mediapipe.PacketGeneratorReflection.Descriptor, global::Mediapipe.StatusHandlerReflection.Descriptor, global::Mediapipe.StreamHandlerReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Mediapipe.ExecutorConfig), global::Mediapipe.ExecutorConfig.Parser, new[]{ "Name", "Type", "Options" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Mediapipe.InputCollection), global::Mediapipe.InputCollection.Parser, new[]{ "Name", "SidePacketName", "ExternalInputName", "InputType", "FileName" }, null, new[]{ typeof(global::Mediapipe.InputCollection.Types.InputType) }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Mediapipe.InputCollectionSet), global::Mediapipe.InputCollectionSet.Parser, new[]{ "InputCollection" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Mediapipe.InputStreamInfo), global::Mediapipe.InputStreamInfo.Parser, new[]{ "TagIndex", "BackEdge" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Mediapipe.ProfilerConfig), global::Mediapipe.ProfilerConfig.Parser, new[]{ "HistogramIntervalSizeUsec", "NumHistogramIntervals", "EnableInputOutputLatency", "EnableProfiler", "EnableStreamLatency", "UsePacketTimestampForAddedPacket", "TraceLogCapacity", "TraceEventTypesDisabled", "TraceLogPath", "TraceLogCount", "TraceLogIntervalUsec", "TraceLogMarginUsec", "TraceLogDurationEvents", "TraceLogIntervalCount", "TraceLogDisabled", "TraceEnabled", "TraceLogInstantEvents", "CalculatorFilter" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Mediapipe.CalculatorGraphConfig), global::Mediapipe.CalculatorGraphConfig.Parser, new[]{ "Node", "PacketFactory", "PacketGenerator", "NumThreads", "StatusHandler", "InputStream", "OutputStream", "InputSidePacket", "OutputSidePacket", "MaxQueueSize", "ReportDeadlock", "InputStreamHandler", "OutputStreamHandler", "Executor", "ProfilerConfig", "Package", "Type", "Options", "GraphOptions" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Mediapipe.CalculatorGraphConfig.Types.Node), global::Mediapipe.CalculatorGraphConfig.Types.Node.Parser, new[]{ "Name", "Calculator", "InputStream", "OutputStream", "InputSidePacket", "OutputSidePacket", "Options", "NodeOptions", "SourceLayer", "BufferSizeHint", "InputStreamHandler", "OutputStreamHandler", "InputStreamInfo", "Executor", "ProfilerConfig", "MaxInFlight", "OptionValue", "ExternalInput" }, null, null, null, null)})
}));
}
#endregion
}
#region Messages
/// <summary>
/// Describes a MediaPipe Executor.
/// </summary>
public sealed partial class ExecutorConfig : pb::IMessage<ExecutorConfig>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ExecutorConfig> _parser = new pb::MessageParser<ExecutorConfig>(() => new ExecutorConfig());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<ExecutorConfig> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Mediapipe.CalculatorReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ExecutorConfig() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ExecutorConfig(ExecutorConfig other) : this() {
name_ = other.name_;
type_ = other.type_;
options_ = other.options_ != null ? other.options_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ExecutorConfig Clone() {
return new ExecutorConfig(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// The name of the executor (used by a CalculatorGraphConfig::Node or
/// PacketGeneratorConfig to specify which executor it will execute on).
/// This field must be unique within a CalculatorGraphConfig. If this field
/// is omitted or is an empty string, the ExecutorConfig describes the
/// default executor.
///
/// NOTE: The names "default" and "gpu" are reserved and must not be used.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 2;
private string type_ = "";
/// <summary>
/// The registered type of the executor. For example: "ThreadPoolExecutor".
/// The framework will create an executor of this type (with the options in
/// the options field) for the CalculatorGraph.
///
/// The ExecutorConfig for the default executor may omit this field and let
/// the framework choose an appropriate executor type. Note: If the options
/// field is used in this case, it should contain the
/// ThreadPoolExecutorOptions.
///
/// If the ExecutorConfig for an additional (non-default) executor omits this
/// field, the executor must be created outside the CalculatorGraph and
/// passed to the CalculatorGraph for use.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Type {
get { return type_; }
set {
type_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 3;
private global::Mediapipe.MediaPipeOptions options_;
/// <summary>
/// The options passed to the Executor. The extension in the options field
/// must match the type field. For example, if the type field is
/// "ThreadPoolExecutor", then the options field should contain the
/// ThreadPoolExecutorOptions.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.MediaPipeOptions Options {
get { return options_; }
set {
options_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as ExecutorConfig);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(ExecutorConfig other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (Type != other.Type) return false;
if (!object.Equals(Options, other.Options)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Type.Length != 0) hash ^= Type.GetHashCode();
if (options_ != null) hash ^= Options.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Type.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Type);
}
if (options_ != null) {
output.WriteRawTag(26);
output.WriteMessage(Options);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Type.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Type);
}
if (options_ != null) {
output.WriteRawTag(26);
output.WriteMessage(Options);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (Type.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Type);
}
if (options_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(ExecutorConfig other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.Type.Length != 0) {
Type = other.Type;
}
if (other.options_ != null) {
if (options_ == null) {
Options = new global::Mediapipe.MediaPipeOptions();
}
Options.MergeFrom(other.Options);
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Type = input.ReadString();
break;
}
case 26: {
if (options_ == null) {
Options = new global::Mediapipe.MediaPipeOptions();
}
input.ReadMessage(Options);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Type = input.ReadString();
break;
}
case 26: {
if (options_ == null) {
Options = new global::Mediapipe.MediaPipeOptions();
}
input.ReadMessage(Options);
break;
}
}
}
}
#endif
}
/// <summary>
/// A collection of input data to a CalculatorGraph.
/// </summary>
public sealed partial class InputCollection : pb::IMessage<InputCollection>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<InputCollection> _parser = new pb::MessageParser<InputCollection>(() => new InputCollection());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<InputCollection> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Mediapipe.CalculatorReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public InputCollection() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public InputCollection(InputCollection other) : this() {
name_ = other.name_;
sidePacketName_ = other.sidePacketName_.Clone();
externalInputName_ = other.externalInputName_.Clone();
inputType_ = other.inputType_;
fileName_ = other.fileName_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public InputCollection Clone() {
return new InputCollection(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// The name of the input collection. Name must match [a-z_][a-z0-9_]*
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "side_packet_name" field.</summary>
public const int SidePacketNameFieldNumber = 2;
private static readonly pb::FieldCodec<string> _repeated_sidePacketName_codec
= pb::FieldCodec.ForString(18);
private readonly pbc::RepeatedField<string> sidePacketName_ = new pbc::RepeatedField<string>();
/// <summary>
/// The names of each side packet. The number of side_packet_name
/// must match the number of packets generated by the input file.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> SidePacketName {
get { return sidePacketName_; }
}
/// <summary>Field number for the "external_input_name" field.</summary>
public const int ExternalInputNameFieldNumber = 1002;
private static readonly pb::FieldCodec<string> _repeated_externalInputName_codec
= pb::FieldCodec.ForString(8018);
private readonly pbc::RepeatedField<string> externalInputName_ = new pbc::RepeatedField<string>();
/// <summary>
/// DEPRECATED: old way of referring to side_packet_name.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> ExternalInputName {
get { return externalInputName_; }
}
/// <summary>Field number for the "input_type" field.</summary>
public const int InputTypeFieldNumber = 3;
private global::Mediapipe.InputCollection.Types.InputType inputType_ = global::Mediapipe.InputCollection.Types.InputType.Unknown;
/// <summary>
/// Sets the source of the input collection data.
/// The default value is UNKNOWN.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.InputCollection.Types.InputType InputType {
get { return inputType_; }
set {
inputType_ = value;
}
}
/// <summary>Field number for the "file_name" field.</summary>
public const int FileNameFieldNumber = 4;
private string fileName_ = "";
/// <summary>
/// A file name pointing to the data. The format of the data is
/// specified by the "input_type" field. Multiple shards may be
/// specified using @N or glob expressions.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string FileName {
get { return fileName_; }
set {
fileName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as InputCollection);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(InputCollection other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if(!sidePacketName_.Equals(other.sidePacketName_)) return false;
if(!externalInputName_.Equals(other.externalInputName_)) return false;
if (InputType != other.InputType) return false;
if (FileName != other.FileName) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
hash ^= sidePacketName_.GetHashCode();
hash ^= externalInputName_.GetHashCode();
if (InputType != global::Mediapipe.InputCollection.Types.InputType.Unknown) hash ^= InputType.GetHashCode();
if (FileName.Length != 0) hash ^= FileName.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
sidePacketName_.WriteTo(output, _repeated_sidePacketName_codec);
if (InputType != global::Mediapipe.InputCollection.Types.InputType.Unknown) {
output.WriteRawTag(24);
output.WriteEnum((int) InputType);
}
if (FileName.Length != 0) {
output.WriteRawTag(34);
output.WriteString(FileName);
}
externalInputName_.WriteTo(output, _repeated_externalInputName_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
sidePacketName_.WriteTo(ref output, _repeated_sidePacketName_codec);
if (InputType != global::Mediapipe.InputCollection.Types.InputType.Unknown) {
output.WriteRawTag(24);
output.WriteEnum((int) InputType);
}
if (FileName.Length != 0) {
output.WriteRawTag(34);
output.WriteString(FileName);
}
externalInputName_.WriteTo(ref output, _repeated_externalInputName_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
size += sidePacketName_.CalculateSize(_repeated_sidePacketName_codec);
size += externalInputName_.CalculateSize(_repeated_externalInputName_codec);
if (InputType != global::Mediapipe.InputCollection.Types.InputType.Unknown) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) InputType);
}
if (FileName.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(FileName);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(InputCollection other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
sidePacketName_.Add(other.sidePacketName_);
externalInputName_.Add(other.externalInputName_);
if (other.InputType != global::Mediapipe.InputCollection.Types.InputType.Unknown) {
InputType = other.InputType;
}
if (other.FileName.Length != 0) {
FileName = other.FileName;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
sidePacketName_.AddEntriesFrom(input, _repeated_sidePacketName_codec);
break;
}
case 24: {
InputType = (global::Mediapipe.InputCollection.Types.InputType) input.ReadEnum();
break;
}
case 34: {
FileName = input.ReadString();
break;
}
case 8018: {
externalInputName_.AddEntriesFrom(input, _repeated_externalInputName_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
sidePacketName_.AddEntriesFrom(ref input, _repeated_sidePacketName_codec);
break;
}
case 24: {
InputType = (global::Mediapipe.InputCollection.Types.InputType) input.ReadEnum();
break;
}
case 34: {
FileName = input.ReadString();
break;
}
case 8018: {
externalInputName_.AddEntriesFrom(ref input, _repeated_externalInputName_codec);
break;
}
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the InputCollection message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
/// <summary>
/// The input can be specified in several ways.
/// </summary>
public enum InputType {
/// <summary>
/// An invalid default value. This value is guaranteed to be the
/// lowest enum value (i.e. don't add negative enum values).
/// </summary>
[pbr::OriginalName("UNKNOWN")] Unknown = 0,
/// <summary>
/// A recordio where each record is a serialized PacketManagerConfig.
/// Each PacketManagerConfig must have the same number of packet
/// factories in it as the number of side packet names. Furthermore,
/// the output side packet name field in each PacketFactoryConfig
/// must not be set. This is the most general input, and allows
/// multiple side packet values to be set in arbitrarily complicated
/// ways before each run.
/// </summary>
[pbr::OriginalName("RECORDIO")] Recordio = 1,
/// <summary>
/// A recordio where each record is a serialized packet payload.
/// For example a recordio of serialized OmniaFeature protos dumped
/// from Omnia.
/// </summary>
[pbr::OriginalName("FOREIGN_RECORDIO")] ForeignRecordio = 2,
/// <summary>
/// A text file where each line is a comma separated list. The number
/// of elements for each csv string must be the same as the number
/// of side_packet_name (and the order must match). Each line must
/// be less than 1MiB in size. Lines comprising of only whitespace
/// or only whitespace and a pound comment will be skipped.
/// </summary>
[pbr::OriginalName("FOREIGN_CSV_TEXT")] ForeignCsvText = 3,
/// <summary>
/// This and all higher values are invalid. Update this value to
/// always be larger than any other enum values you add.
/// </summary>
[pbr::OriginalName("INVALID_UPPER_BOUND")] InvalidUpperBound = 4,
}
}
#endregion
}
/// <summary>
/// A convenient way to specify a number of InputCollections.
/// </summary>
public sealed partial class InputCollectionSet : pb::IMessage<InputCollectionSet>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<InputCollectionSet> _parser = new pb::MessageParser<InputCollectionSet>(() => new InputCollectionSet());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<InputCollectionSet> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Mediapipe.CalculatorReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public InputCollectionSet() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public InputCollectionSet(InputCollectionSet other) : this() {
inputCollection_ = other.inputCollection_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public InputCollectionSet Clone() {
return new InputCollectionSet(this);
}
/// <summary>Field number for the "input_collection" field.</summary>
public const int InputCollectionFieldNumber = 1;
private static readonly pb::FieldCodec<global::Mediapipe.InputCollection> _repeated_inputCollection_codec
= pb::FieldCodec.ForMessage(10, global::Mediapipe.InputCollection.Parser);
private readonly pbc::RepeatedField<global::Mediapipe.InputCollection> inputCollection_ = new pbc::RepeatedField<global::Mediapipe.InputCollection>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Mediapipe.InputCollection> InputCollection {
get { return inputCollection_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as InputCollectionSet);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(InputCollectionSet other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if(!inputCollection_.Equals(other.inputCollection_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
hash ^= inputCollection_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
inputCollection_.WriteTo(output, _repeated_inputCollection_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
inputCollection_.WriteTo(ref output, _repeated_inputCollection_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
size += inputCollection_.CalculateSize(_repeated_inputCollection_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(InputCollectionSet other) {
if (other == null) {
return;
}
inputCollection_.Add(other.inputCollection_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
inputCollection_.AddEntriesFrom(input, _repeated_inputCollection_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
inputCollection_.AddEntriesFrom(ref input, _repeated_inputCollection_codec);
break;
}
}
}
}
#endif
}
/// <summary>
/// Additional information about an input stream.
/// </summary>
public sealed partial class InputStreamInfo : pb::IMessage<InputStreamInfo>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<InputStreamInfo> _parser = new pb::MessageParser<InputStreamInfo>(() => new InputStreamInfo());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<InputStreamInfo> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Mediapipe.CalculatorReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public InputStreamInfo() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public InputStreamInfo(InputStreamInfo other) : this() {
tagIndex_ = other.tagIndex_;
backEdge_ = other.backEdge_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public InputStreamInfo Clone() {
return new InputStreamInfo(this);
}
/// <summary>Field number for the "tag_index" field.</summary>
public const int TagIndexFieldNumber = 1;
private string tagIndex_ = "";
/// <summary>
/// A description of the input stream.
/// This description uses the Calculator visible specification of
/// a stream. The format is a tag, then an index with both being
/// optional. If the tag is missing it is assumed to be "" and if
/// the index is missing then it is assumed to be 0. If the index
/// is provided then a colon (':') must be used.
/// Examples:
/// "TAG" -> tag "TAG", index 0
/// "" -> tag "", index 0
/// ":0" -> tag "", index 0
/// ":3" -> tag "", index 3
/// "VIDEO:0" -> tag "VIDEO", index 0
/// "VIDEO:2" -> tag "VIDEO", index 2
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string TagIndex {
get { return tagIndex_; }
set {
tagIndex_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "back_edge" field.</summary>
public const int BackEdgeFieldNumber = 2;
private bool backEdge_;
/// <summary>
/// Whether the input stream is a back edge.
/// By default, MediaPipe requires graphs to be acyclic and treats cycles in a
/// graph as errors. To allow MediaPipe to accept a cyclic graph, set the
/// back_edge fields of the input streams that are back edges to true. A
/// cyclic graph usually has an obvious forward direction, and a back edge
/// goes in the opposite direction. For a formal definition of a back edge,
/// please see https://en.wikipedia.org/wiki/Depth-first_search.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool BackEdge {
get { return backEdge_; }
set {
backEdge_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as InputStreamInfo);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(InputStreamInfo other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (TagIndex != other.TagIndex) return false;
if (BackEdge != other.BackEdge) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (TagIndex.Length != 0) hash ^= TagIndex.GetHashCode();
if (BackEdge != false) hash ^= BackEdge.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (TagIndex.Length != 0) {
output.WriteRawTag(10);
output.WriteString(TagIndex);
}
if (BackEdge != false) {
output.WriteRawTag(16);
output.WriteBool(BackEdge);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (TagIndex.Length != 0) {
output.WriteRawTag(10);
output.WriteString(TagIndex);
}
if (BackEdge != false) {
output.WriteRawTag(16);
output.WriteBool(BackEdge);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (TagIndex.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(TagIndex);
}
if (BackEdge != false) {
size += 1 + 1;
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(InputStreamInfo other) {
if (other == null) {
return;
}
if (other.TagIndex.Length != 0) {
TagIndex = other.TagIndex;
}
if (other.BackEdge != false) {
BackEdge = other.BackEdge;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
TagIndex = input.ReadString();
break;
}
case 16: {
BackEdge = input.ReadBool();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
TagIndex = input.ReadString();
break;
}
case 16: {
BackEdge = input.ReadBool();
break;
}
}
}
}
#endif
}
/// <summary>
/// Configs for the profiler for a calculator. Not applicable to subgraphs.
/// </summary>
public sealed partial class ProfilerConfig : pb::IMessage<ProfilerConfig>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ProfilerConfig> _parser = new pb::MessageParser<ProfilerConfig>(() => new ProfilerConfig());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<ProfilerConfig> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Mediapipe.CalculatorReflection.Descriptor.MessageTypes[4]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ProfilerConfig() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ProfilerConfig(ProfilerConfig other) : this() {
histogramIntervalSizeUsec_ = other.histogramIntervalSizeUsec_;
numHistogramIntervals_ = other.numHistogramIntervals_;
enableInputOutputLatency_ = other.enableInputOutputLatency_;
enableProfiler_ = other.enableProfiler_;
enableStreamLatency_ = other.enableStreamLatency_;
usePacketTimestampForAddedPacket_ = other.usePacketTimestampForAddedPacket_;
traceLogCapacity_ = other.traceLogCapacity_;
traceEventTypesDisabled_ = other.traceEventTypesDisabled_.Clone();
traceLogPath_ = other.traceLogPath_;
traceLogCount_ = other.traceLogCount_;
traceLogIntervalUsec_ = other.traceLogIntervalUsec_;
traceLogMarginUsec_ = other.traceLogMarginUsec_;
traceLogDurationEvents_ = other.traceLogDurationEvents_;
traceLogIntervalCount_ = other.traceLogIntervalCount_;
traceLogDisabled_ = other.traceLogDisabled_;
traceEnabled_ = other.traceEnabled_;
traceLogInstantEvents_ = other.traceLogInstantEvents_;
calculatorFilter_ = other.calculatorFilter_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ProfilerConfig Clone() {
return new ProfilerConfig(this);
}
/// <summary>Field number for the "histogram_interval_size_usec" field.</summary>
public const int HistogramIntervalSizeUsecFieldNumber = 1;
private long histogramIntervalSizeUsec_;
/// <summary>
/// Size of the runtimes histogram intervals (in microseconds) to generate the
/// histogram of the Process() time. The last interval extends to +inf.
/// If not specified, the interval is 1000000 usec = 1 sec.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long HistogramIntervalSizeUsec {
get { return histogramIntervalSizeUsec_; }
set {
histogramIntervalSizeUsec_ = value;
}
}
/// <summary>Field number for the "num_histogram_intervals" field.</summary>
public const int NumHistogramIntervalsFieldNumber = 2;
private long numHistogramIntervals_;
/// <summary>
/// Number of intervals to generate the histogram of the Process() runtime.
/// If not specified, one interval is used.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long NumHistogramIntervals {
get { return numHistogramIntervals_; }
set {
numHistogramIntervals_ = value;
}
}
/// <summary>Field number for the "enable_input_output_latency" field.</summary>
public const int EnableInputOutputLatencyFieldNumber = 3;
private bool enableInputOutputLatency_;
/// <summary>
/// TODO: clean up after migration to MediaPipeProfiler.
/// DEPRECATED: If true, the profiler also profiles the input output latency.
/// Should be true only if the packet timestamps corresponds to the
/// microseconds wall time from epoch.
/// </summary>
[global::System.ObsoleteAttribute]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool EnableInputOutputLatency {
get { return enableInputOutputLatency_; }
set {
enableInputOutputLatency_ = value;
}
}
/// <summary>Field number for the "enable_profiler" field.</summary>
public const int EnableProfilerFieldNumber = 4;
private bool enableProfiler_;
/// <summary>
/// If true, the profiler starts profiling when graph is initialized.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool EnableProfiler {
get { return enableProfiler_; }
set {
enableProfiler_ = value;
}
}
/// <summary>Field number for the "enable_stream_latency" field.</summary>
public const int EnableStreamLatencyFieldNumber = 5;
private bool enableStreamLatency_;
/// <summary>
/// If true, the profiler also profiles the stream latency and input-output
/// latency.
/// No-op if enable_profiler is false.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool EnableStreamLatency {
get { return enableStreamLatency_; }
set {
enableStreamLatency_ = value;
}
}
/// <summary>Field number for the "use_packet_timestamp_for_added_packet" field.</summary>
public const int UsePacketTimestampForAddedPacketFieldNumber = 6;
private bool usePacketTimestampForAddedPacket_;
/// <summary>
/// If true, the profiler uses packet timestamp (as production time and source
/// production time) for packets added by calling
/// CalculatorGraph::AddPacketToInputStream().
/// If false, uses profiler's clock.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool UsePacketTimestampForAddedPacket {
get { return usePacketTimestampForAddedPacket_; }
set {
usePacketTimestampForAddedPacket_ = value;
}
}
/// <summary>Field number for the "trace_log_capacity" field.</summary>
public const int TraceLogCapacityFieldNumber = 7;
private long traceLogCapacity_;
/// <summary>
/// The maximum number of trace events buffered in memory.
/// The default value buffers up to 20000 events.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long TraceLogCapacity {
get { return traceLogCapacity_; }
set {
traceLogCapacity_ = value;
}
}
/// <summary>Field number for the "trace_event_types_disabled" field.</summary>
public const int TraceEventTypesDisabledFieldNumber = 8;
private static readonly pb::FieldCodec<int> _repeated_traceEventTypesDisabled_codec
= pb::FieldCodec.ForInt32(66);
private readonly pbc::RepeatedField<int> traceEventTypesDisabled_ = new pbc::RepeatedField<int>();
/// <summary>
/// Trace event types that are not logged.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<int> TraceEventTypesDisabled {
get { return traceEventTypesDisabled_; }
}
/// <summary>Field number for the "trace_log_path" field.</summary>
public const int TraceLogPathFieldNumber = 9;
private string traceLogPath_ = "";
/// <summary>
/// The output directory and base-name prefix for trace log files.
/// Log files are written to: StrCat(trace_log_path, index, ".binarypb")
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string TraceLogPath {
get { return traceLogPath_; }
set {
traceLogPath_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "trace_log_count" field.</summary>
public const int TraceLogCountFieldNumber = 10;
private int traceLogCount_;
/// <summary>
/// The number of trace log files retained.
/// The trace log files are named "trace_0.log" through "trace_k.log".
/// The default value specifies 2 output files retained.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int TraceLogCount {
get { return traceLogCount_; }
set {
traceLogCount_ = value;
}
}
/// <summary>Field number for the "trace_log_interval_usec" field.</summary>
public const int TraceLogIntervalUsecFieldNumber = 11;
private long traceLogIntervalUsec_;
/// <summary>
/// The interval in microseconds between trace log output.
/// The default value specifies trace log output once every 0.5 sec.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long TraceLogIntervalUsec {
get { return traceLogIntervalUsec_; }
set {
traceLogIntervalUsec_ = value;
}
}
/// <summary>Field number for the "trace_log_margin_usec" field.</summary>
public const int TraceLogMarginUsecFieldNumber = 12;
private long traceLogMarginUsec_;
/// <summary>
/// The interval in microseconds between TimeNow and the highest times
/// included in trace log output. This margin allows time for events
/// to be appended to the TraceBuffer.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long TraceLogMarginUsec {
get { return traceLogMarginUsec_; }
set {
traceLogMarginUsec_ = value;
}
}
/// <summary>Field number for the "trace_log_duration_events" field.</summary>
public const int TraceLogDurationEventsFieldNumber = 13;
private bool traceLogDurationEvents_;
/// <summary>
/// Deprecated, replaced by trace_log_instant_events.
/// </summary>
[global::System.ObsoleteAttribute]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool TraceLogDurationEvents {
get { return traceLogDurationEvents_; }
set {
traceLogDurationEvents_ = value;
}
}
/// <summary>Field number for the "trace_log_interval_count" field.</summary>
public const int TraceLogIntervalCountFieldNumber = 14;
private int traceLogIntervalCount_;
/// <summary>
/// The number of trace log intervals per file. The total log duration is:
/// trace_log_interval_usec * trace_log_file_count * trace_log_interval_count.
/// The default value specifies 10 intervals per file.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int TraceLogIntervalCount {
get { return traceLogIntervalCount_; }
set {
traceLogIntervalCount_ = value;
}
}
/// <summary>Field number for the "trace_log_disabled" field.</summary>
public const int TraceLogDisabledFieldNumber = 15;
private bool traceLogDisabled_;
/// <summary>
/// An option to turn ON/OFF writing trace files to disk. Saving trace files to
/// disk is enabled by default.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool TraceLogDisabled {
get { return traceLogDisabled_; }
set {
traceLogDisabled_ = value;
}
}
/// <summary>Field number for the "trace_enabled" field.</summary>
public const int TraceEnabledFieldNumber = 16;
private bool traceEnabled_;
/// <summary>
/// If true, tracer timing events are recorded and reported.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool TraceEnabled {
get { return traceEnabled_; }
set {
traceEnabled_ = value;
}
}
/// <summary>Field number for the "trace_log_instant_events" field.</summary>
public const int TraceLogInstantEventsFieldNumber = 17;
private bool traceLogInstantEvents_;
/// <summary>
/// False specifies an event for each calculator invocation.
/// True specifies a separate event for each start and finish time.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool TraceLogInstantEvents {
get { return traceLogInstantEvents_; }
set {
traceLogInstantEvents_ = value;
}
}
/// <summary>Field number for the "calculator_filter" field.</summary>
public const int CalculatorFilterFieldNumber = 18;
private string calculatorFilter_ = "";
/// <summary>
/// Limits calculator-profile histograms to a subset of calculators.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string CalculatorFilter {
get { return calculatorFilter_; }
set {
calculatorFilter_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as ProfilerConfig);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(ProfilerConfig other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (HistogramIntervalSizeUsec != other.HistogramIntervalSizeUsec) return false;
if (NumHistogramIntervals != other.NumHistogramIntervals) return false;
if (EnableInputOutputLatency != other.EnableInputOutputLatency) return false;
if (EnableProfiler != other.EnableProfiler) return false;
if (EnableStreamLatency != other.EnableStreamLatency) return false;
if (UsePacketTimestampForAddedPacket != other.UsePacketTimestampForAddedPacket) return false;
if (TraceLogCapacity != other.TraceLogCapacity) return false;
if(!traceEventTypesDisabled_.Equals(other.traceEventTypesDisabled_)) return false;
if (TraceLogPath != other.TraceLogPath) return false;
if (TraceLogCount != other.TraceLogCount) return false;
if (TraceLogIntervalUsec != other.TraceLogIntervalUsec) return false;
if (TraceLogMarginUsec != other.TraceLogMarginUsec) return false;
if (TraceLogDurationEvents != other.TraceLogDurationEvents) return false;
if (TraceLogIntervalCount != other.TraceLogIntervalCount) return false;
if (TraceLogDisabled != other.TraceLogDisabled) return false;
if (TraceEnabled != other.TraceEnabled) return false;
if (TraceLogInstantEvents != other.TraceLogInstantEvents) return false;
if (CalculatorFilter != other.CalculatorFilter) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (HistogramIntervalSizeUsec != 0L) hash ^= HistogramIntervalSizeUsec.GetHashCode();
if (NumHistogramIntervals != 0L) hash ^= NumHistogramIntervals.GetHashCode();
if (EnableInputOutputLatency != false) hash ^= EnableInputOutputLatency.GetHashCode();
if (EnableProfiler != false) hash ^= EnableProfiler.GetHashCode();
if (EnableStreamLatency != false) hash ^= EnableStreamLatency.GetHashCode();
if (UsePacketTimestampForAddedPacket != false) hash ^= UsePacketTimestampForAddedPacket.GetHashCode();
if (TraceLogCapacity != 0L) hash ^= TraceLogCapacity.GetHashCode();
hash ^= traceEventTypesDisabled_.GetHashCode();
if (TraceLogPath.Length != 0) hash ^= TraceLogPath.GetHashCode();
if (TraceLogCount != 0) hash ^= TraceLogCount.GetHashCode();
if (TraceLogIntervalUsec != 0L) hash ^= TraceLogIntervalUsec.GetHashCode();
if (TraceLogMarginUsec != 0L) hash ^= TraceLogMarginUsec.GetHashCode();
if (TraceLogDurationEvents != false) hash ^= TraceLogDurationEvents.GetHashCode();
if (TraceLogIntervalCount != 0) hash ^= TraceLogIntervalCount.GetHashCode();
if (TraceLogDisabled != false) hash ^= TraceLogDisabled.GetHashCode();
if (TraceEnabled != false) hash ^= TraceEnabled.GetHashCode();
if (TraceLogInstantEvents != false) hash ^= TraceLogInstantEvents.GetHashCode();
if (CalculatorFilter.Length != 0) hash ^= CalculatorFilter.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (HistogramIntervalSizeUsec != 0L) {
output.WriteRawTag(8);
output.WriteInt64(HistogramIntervalSizeUsec);
}
if (NumHistogramIntervals != 0L) {
output.WriteRawTag(16);
output.WriteInt64(NumHistogramIntervals);
}
if (EnableInputOutputLatency != false) {
output.WriteRawTag(24);
output.WriteBool(EnableInputOutputLatency);
}
if (EnableProfiler != false) {
output.WriteRawTag(32);
output.WriteBool(EnableProfiler);
}
if (EnableStreamLatency != false) {
output.WriteRawTag(40);
output.WriteBool(EnableStreamLatency);
}
if (UsePacketTimestampForAddedPacket != false) {
output.WriteRawTag(48);
output.WriteBool(UsePacketTimestampForAddedPacket);
}
if (TraceLogCapacity != 0L) {
output.WriteRawTag(56);
output.WriteInt64(TraceLogCapacity);
}
traceEventTypesDisabled_.WriteTo(output, _repeated_traceEventTypesDisabled_codec);
if (TraceLogPath.Length != 0) {
output.WriteRawTag(74);
output.WriteString(TraceLogPath);
}
if (TraceLogCount != 0) {
output.WriteRawTag(80);
output.WriteInt32(TraceLogCount);
}
if (TraceLogIntervalUsec != 0L) {
output.WriteRawTag(88);
output.WriteInt64(TraceLogIntervalUsec);
}
if (TraceLogMarginUsec != 0L) {
output.WriteRawTag(96);
output.WriteInt64(TraceLogMarginUsec);
}
if (TraceLogDurationEvents != false) {
output.WriteRawTag(104);
output.WriteBool(TraceLogDurationEvents);
}
if (TraceLogIntervalCount != 0) {
output.WriteRawTag(112);
output.WriteInt32(TraceLogIntervalCount);
}
if (TraceLogDisabled != false) {
output.WriteRawTag(120);
output.WriteBool(TraceLogDisabled);
}
if (TraceEnabled != false) {
output.WriteRawTag(128, 1);
output.WriteBool(TraceEnabled);
}
if (TraceLogInstantEvents != false) {
output.WriteRawTag(136, 1);
output.WriteBool(TraceLogInstantEvents);
}
if (CalculatorFilter.Length != 0) {
output.WriteRawTag(146, 1);
output.WriteString(CalculatorFilter);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (HistogramIntervalSizeUsec != 0L) {
output.WriteRawTag(8);
output.WriteInt64(HistogramIntervalSizeUsec);
}
if (NumHistogramIntervals != 0L) {
output.WriteRawTag(16);
output.WriteInt64(NumHistogramIntervals);
}
if (EnableInputOutputLatency != false) {
output.WriteRawTag(24);
output.WriteBool(EnableInputOutputLatency);
}
if (EnableProfiler != false) {
output.WriteRawTag(32);
output.WriteBool(EnableProfiler);
}
if (EnableStreamLatency != false) {
output.WriteRawTag(40);
output.WriteBool(EnableStreamLatency);
}
if (UsePacketTimestampForAddedPacket != false) {
output.WriteRawTag(48);
output.WriteBool(UsePacketTimestampForAddedPacket);
}
if (TraceLogCapacity != 0L) {
output.WriteRawTag(56);
output.WriteInt64(TraceLogCapacity);
}
traceEventTypesDisabled_.WriteTo(ref output, _repeated_traceEventTypesDisabled_codec);
if (TraceLogPath.Length != 0) {
output.WriteRawTag(74);
output.WriteString(TraceLogPath);
}
if (TraceLogCount != 0) {
output.WriteRawTag(80);
output.WriteInt32(TraceLogCount);
}
if (TraceLogIntervalUsec != 0L) {
output.WriteRawTag(88);
output.WriteInt64(TraceLogIntervalUsec);
}
if (TraceLogMarginUsec != 0L) {
output.WriteRawTag(96);
output.WriteInt64(TraceLogMarginUsec);
}
if (TraceLogDurationEvents != false) {
output.WriteRawTag(104);
output.WriteBool(TraceLogDurationEvents);
}
if (TraceLogIntervalCount != 0) {
output.WriteRawTag(112);
output.WriteInt32(TraceLogIntervalCount);
}
if (TraceLogDisabled != false) {
output.WriteRawTag(120);
output.WriteBool(TraceLogDisabled);
}
if (TraceEnabled != false) {
output.WriteRawTag(128, 1);
output.WriteBool(TraceEnabled);
}
if (TraceLogInstantEvents != false) {
output.WriteRawTag(136, 1);
output.WriteBool(TraceLogInstantEvents);
}
if (CalculatorFilter.Length != 0) {
output.WriteRawTag(146, 1);
output.WriteString(CalculatorFilter);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (HistogramIntervalSizeUsec != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(HistogramIntervalSizeUsec);
}
if (NumHistogramIntervals != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(NumHistogramIntervals);
}
if (EnableInputOutputLatency != false) {
size += 1 + 1;
}
if (EnableProfiler != false) {
size += 1 + 1;
}
if (EnableStreamLatency != false) {
size += 1 + 1;
}
if (UsePacketTimestampForAddedPacket != false) {
size += 1 + 1;
}
if (TraceLogCapacity != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(TraceLogCapacity);
}
size += traceEventTypesDisabled_.CalculateSize(_repeated_traceEventTypesDisabled_codec);
if (TraceLogPath.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(TraceLogPath);
}
if (TraceLogCount != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(TraceLogCount);
}
if (TraceLogIntervalUsec != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(TraceLogIntervalUsec);
}
if (TraceLogMarginUsec != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(TraceLogMarginUsec);
}
if (TraceLogDurationEvents != false) {
size += 1 + 1;
}
if (TraceLogIntervalCount != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(TraceLogIntervalCount);
}
if (TraceLogDisabled != false) {
size += 1 + 1;
}
if (TraceEnabled != false) {
size += 2 + 1;
}
if (TraceLogInstantEvents != false) {
size += 2 + 1;
}
if (CalculatorFilter.Length != 0) {
size += 2 + pb::CodedOutputStream.ComputeStringSize(CalculatorFilter);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(ProfilerConfig other) {
if (other == null) {
return;
}
if (other.HistogramIntervalSizeUsec != 0L) {
HistogramIntervalSizeUsec = other.HistogramIntervalSizeUsec;
}
if (other.NumHistogramIntervals != 0L) {
NumHistogramIntervals = other.NumHistogramIntervals;
}
if (other.EnableInputOutputLatency != false) {
EnableInputOutputLatency = other.EnableInputOutputLatency;
}
if (other.EnableProfiler != false) {
EnableProfiler = other.EnableProfiler;
}
if (other.EnableStreamLatency != false) {
EnableStreamLatency = other.EnableStreamLatency;
}
if (other.UsePacketTimestampForAddedPacket != false) {
UsePacketTimestampForAddedPacket = other.UsePacketTimestampForAddedPacket;
}
if (other.TraceLogCapacity != 0L) {
TraceLogCapacity = other.TraceLogCapacity;
}
traceEventTypesDisabled_.Add(other.traceEventTypesDisabled_);
if (other.TraceLogPath.Length != 0) {
TraceLogPath = other.TraceLogPath;
}
if (other.TraceLogCount != 0) {
TraceLogCount = other.TraceLogCount;
}
if (other.TraceLogIntervalUsec != 0L) {
TraceLogIntervalUsec = other.TraceLogIntervalUsec;
}
if (other.TraceLogMarginUsec != 0L) {
TraceLogMarginUsec = other.TraceLogMarginUsec;
}
if (other.TraceLogDurationEvents != false) {
TraceLogDurationEvents = other.TraceLogDurationEvents;
}
if (other.TraceLogIntervalCount != 0) {
TraceLogIntervalCount = other.TraceLogIntervalCount;
}
if (other.TraceLogDisabled != false) {
TraceLogDisabled = other.TraceLogDisabled;
}
if (other.TraceEnabled != false) {
TraceEnabled = other.TraceEnabled;
}
if (other.TraceLogInstantEvents != false) {
TraceLogInstantEvents = other.TraceLogInstantEvents;
}
if (other.CalculatorFilter.Length != 0) {
CalculatorFilter = other.CalculatorFilter;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
HistogramIntervalSizeUsec = input.ReadInt64();
break;
}
case 16: {
NumHistogramIntervals = input.ReadInt64();
break;
}
case 24: {
EnableInputOutputLatency = input.ReadBool();
break;
}
case 32: {
EnableProfiler = input.ReadBool();
break;
}
case 40: {
EnableStreamLatency = input.ReadBool();
break;
}
case 48: {
UsePacketTimestampForAddedPacket = input.ReadBool();
break;
}
case 56: {
TraceLogCapacity = input.ReadInt64();
break;
}
case 66:
case 64: {
traceEventTypesDisabled_.AddEntriesFrom(input, _repeated_traceEventTypesDisabled_codec);
break;
}
case 74: {
TraceLogPath = input.ReadString();
break;
}
case 80: {
TraceLogCount = input.ReadInt32();
break;
}
case 88: {
TraceLogIntervalUsec = input.ReadInt64();
break;
}
case 96: {
TraceLogMarginUsec = input.ReadInt64();
break;
}
case 104: {
TraceLogDurationEvents = input.ReadBool();
break;
}
case 112: {
TraceLogIntervalCount = input.ReadInt32();
break;
}
case 120: {
TraceLogDisabled = input.ReadBool();
break;
}
case 128: {
TraceEnabled = input.ReadBool();
break;
}
case 136: {
TraceLogInstantEvents = input.ReadBool();
break;
}
case 146: {
CalculatorFilter = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
HistogramIntervalSizeUsec = input.ReadInt64();
break;
}
case 16: {
NumHistogramIntervals = input.ReadInt64();
break;
}
case 24: {
EnableInputOutputLatency = input.ReadBool();
break;
}
case 32: {
EnableProfiler = input.ReadBool();
break;
}
case 40: {
EnableStreamLatency = input.ReadBool();
break;
}
case 48: {
UsePacketTimestampForAddedPacket = input.ReadBool();
break;
}
case 56: {
TraceLogCapacity = input.ReadInt64();
break;
}
case 66:
case 64: {
traceEventTypesDisabled_.AddEntriesFrom(ref input, _repeated_traceEventTypesDisabled_codec);
break;
}
case 74: {
TraceLogPath = input.ReadString();
break;
}
case 80: {
TraceLogCount = input.ReadInt32();
break;
}
case 88: {
TraceLogIntervalUsec = input.ReadInt64();
break;
}
case 96: {
TraceLogMarginUsec = input.ReadInt64();
break;
}
case 104: {
TraceLogDurationEvents = input.ReadBool();
break;
}
case 112: {
TraceLogIntervalCount = input.ReadInt32();
break;
}
case 120: {
TraceLogDisabled = input.ReadBool();
break;
}
case 128: {
TraceEnabled = input.ReadBool();
break;
}
case 136: {
TraceLogInstantEvents = input.ReadBool();
break;
}
case 146: {
CalculatorFilter = input.ReadString();
break;
}
}
}
}
#endif
}
/// <summary>
/// Describes the topology and function of a MediaPipe Graph. The graph of
/// Nodes must be a Directed Acyclic Graph (DAG) except as annotated by
/// "back_edge" in InputStreamInfo. Use a mediapipe::CalculatorGraph object to
/// run the graph.
/// </summary>
public sealed partial class CalculatorGraphConfig : pb::IMessage<CalculatorGraphConfig>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CalculatorGraphConfig> _parser = new pb::MessageParser<CalculatorGraphConfig>(() => new CalculatorGraphConfig());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<CalculatorGraphConfig> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Mediapipe.CalculatorReflection.Descriptor.MessageTypes[5]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public CalculatorGraphConfig() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public CalculatorGraphConfig(CalculatorGraphConfig other) : this() {
node_ = other.node_.Clone();
packetFactory_ = other.packetFactory_.Clone();
packetGenerator_ = other.packetGenerator_.Clone();
numThreads_ = other.numThreads_;
statusHandler_ = other.statusHandler_.Clone();
inputStream_ = other.inputStream_.Clone();
outputStream_ = other.outputStream_.Clone();
inputSidePacket_ = other.inputSidePacket_.Clone();
outputSidePacket_ = other.outputSidePacket_.Clone();
maxQueueSize_ = other.maxQueueSize_;
reportDeadlock_ = other.reportDeadlock_;
inputStreamHandler_ = other.inputStreamHandler_ != null ? other.inputStreamHandler_.Clone() : null;
outputStreamHandler_ = other.outputStreamHandler_ != null ? other.outputStreamHandler_.Clone() : null;
executor_ = other.executor_.Clone();
profilerConfig_ = other.profilerConfig_ != null ? other.profilerConfig_.Clone() : null;
package_ = other.package_;
type_ = other.type_;
options_ = other.options_ != null ? other.options_.Clone() : null;
graphOptions_ = other.graphOptions_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public CalculatorGraphConfig Clone() {
return new CalculatorGraphConfig(this);
}
/// <summary>Field number for the "node" field.</summary>
public const int NodeFieldNumber = 1;
private static readonly pb::FieldCodec<global::Mediapipe.CalculatorGraphConfig.Types.Node> _repeated_node_codec
= pb::FieldCodec.ForMessage(10, global::Mediapipe.CalculatorGraphConfig.Types.Node.Parser);
private readonly pbc::RepeatedField<global::Mediapipe.CalculatorGraphConfig.Types.Node> node_ = new pbc::RepeatedField<global::Mediapipe.CalculatorGraphConfig.Types.Node>();
/// <summary>
/// The nodes.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Mediapipe.CalculatorGraphConfig.Types.Node> Node {
get { return node_; }
}
/// <summary>Field number for the "packet_factory" field.</summary>
public const int PacketFactoryFieldNumber = 6;
private static readonly pb::FieldCodec<global::Mediapipe.PacketFactoryConfig> _repeated_packetFactory_codec
= pb::FieldCodec.ForMessage(50, global::Mediapipe.PacketFactoryConfig.Parser);
private readonly pbc::RepeatedField<global::Mediapipe.PacketFactoryConfig> packetFactory_ = new pbc::RepeatedField<global::Mediapipe.PacketFactoryConfig>();
/// <summary>
/// Create a side packet using a PacketFactory. This side packet is
/// created as close to the worker that does the work as possible. A
/// PacketFactory is basically a PacketGenerator that takes no input side
/// packets and produces a single output side packet.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Mediapipe.PacketFactoryConfig> PacketFactory {
get { return packetFactory_; }
}
/// <summary>Field number for the "packet_generator" field.</summary>
public const int PacketGeneratorFieldNumber = 7;
private static readonly pb::FieldCodec<global::Mediapipe.PacketGeneratorConfig> _repeated_packetGenerator_codec
= pb::FieldCodec.ForMessage(58, global::Mediapipe.PacketGeneratorConfig.Parser);
private readonly pbc::RepeatedField<global::Mediapipe.PacketGeneratorConfig> packetGenerator_ = new pbc::RepeatedField<global::Mediapipe.PacketGeneratorConfig>();
/// <summary>
/// Configs for PacketGenerators. Generators take zero or more
/// input side packets and produce any number of output side
/// packets. For example, MediaDecoderCalculator takes an input
/// side packet with type DeletingFile. However, most users want
/// to specify videos by ContentIdHex (i.e. video id). By using
/// the VideoIdToLocalFileGenerator, a user can specify a video id
/// (as a string) and obtain a DeletingFile to use with the decoder.
/// PacketGenerators can take as a input side packet the output side
/// packet of another PacketGenerator. The graph of PacketGenerators
/// must be a directed acyclic graph.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Mediapipe.PacketGeneratorConfig> PacketGenerator {
get { return packetGenerator_; }
}
/// <summary>Field number for the "num_threads" field.</summary>
public const int NumThreadsFieldNumber = 8;
private int numThreads_;
/// <summary>
/// Number of threads for running calculators in multithreaded mode.
/// If not specified, the scheduler will pick an appropriate number
/// of threads depending on the number of available processors.
/// To run on the calling thread, specify "ApplicationThreadExecutor"
/// see: http://g3doc/mediapipe/g3doc/running.md.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int NumThreads {
get { return numThreads_; }
set {
numThreads_ = value;
}
}
/// <summary>Field number for the "status_handler" field.</summary>
public const int StatusHandlerFieldNumber = 9;
private static readonly pb::FieldCodec<global::Mediapipe.StatusHandlerConfig> _repeated_statusHandler_codec
= pb::FieldCodec.ForMessage(74, global::Mediapipe.StatusHandlerConfig.Parser);
private readonly pbc::RepeatedField<global::Mediapipe.StatusHandlerConfig> statusHandler_ = new pbc::RepeatedField<global::Mediapipe.StatusHandlerConfig>();
/// <summary>
/// Configs for StatusHandlers that will be called after each call to
/// Run() on the graph. StatusHandlers take zero or more input side
/// packets and the absl::Status returned by a graph run. For example,
/// a StatusHandler could store information about graph failures and
/// their causes for later monitoring. Note that graph failures during
/// initialization may cause required input side packets (created by a
/// PacketFactory or PacketGenerator) to be missing. In these cases,
/// the handler with missing input side packets will be skipped.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Mediapipe.StatusHandlerConfig> StatusHandler {
get { return statusHandler_; }
}
/// <summary>Field number for the "input_stream" field.</summary>
public const int InputStreamFieldNumber = 10;
private static readonly pb::FieldCodec<string> _repeated_inputStream_codec
= pb::FieldCodec.ForString(82);
private readonly pbc::RepeatedField<string> inputStream_ = new pbc::RepeatedField<string>();
/// <summary>
/// Specify input streams to the entire graph. Streams specified here may have
/// packets added to them using CalculatorGraph::AddPacketToInputStream. This
/// works much like a source calculator, except that the source is outside of
/// the mediapipe graph.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> InputStream {
get { return inputStream_; }
}
/// <summary>Field number for the "output_stream" field.</summary>
public const int OutputStreamFieldNumber = 15;
private static readonly pb::FieldCodec<string> _repeated_outputStream_codec
= pb::FieldCodec.ForString(122);
private readonly pbc::RepeatedField<string> outputStream_ = new pbc::RepeatedField<string>();
/// <summary>
/// Output streams for the graph when used as a subgraph.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> OutputStream {
get { return outputStream_; }
}
/// <summary>Field number for the "input_side_packet" field.</summary>
public const int InputSidePacketFieldNumber = 16;
private static readonly pb::FieldCodec<string> _repeated_inputSidePacket_codec
= pb::FieldCodec.ForString(130);
private readonly pbc::RepeatedField<string> inputSidePacket_ = new pbc::RepeatedField<string>();
/// <summary>
/// Input side packets for the graph when used as a subgraph.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> InputSidePacket {
get { return inputSidePacket_; }
}
/// <summary>Field number for the "output_side_packet" field.</summary>
public const int OutputSidePacketFieldNumber = 17;
private static readonly pb::FieldCodec<string> _repeated_outputSidePacket_codec
= pb::FieldCodec.ForString(138);
private readonly pbc::RepeatedField<string> outputSidePacket_ = new pbc::RepeatedField<string>();
/// <summary>
/// Output side packets for the graph when used as a subgraph.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> OutputSidePacket {
get { return outputSidePacket_; }
}
/// <summary>Field number for the "max_queue_size" field.</summary>
public const int MaxQueueSizeFieldNumber = 11;
private int maxQueueSize_;
/// <summary>
/// Maximum queue size of any input stream in the graph. This can be used to
/// control the memory usage of a MediaPipe graph by preventing fast sources
/// from flooding the graph with packets. Any source that is connected to an
/// input stream that has hit its maximum capacity will not be scheduled until
/// the queue size falls under the specified limits, or if the scheduler queue
/// is empty and no other nodes are running (to prevent possible deadlocks due
/// to a incorrectly specified value). This global parameter is set to 100
/// packets by default to enable pipelining. If any node indicates that it
/// buffers packets before emitting them, then the max(node_buffer_size,
/// max_queue_size) is used. Set this parameter to -1 to disable throttling
/// (i.e. the graph will use as much memory as it requires). If not specified,
/// the limit is 100 packets.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int MaxQueueSize {
get { return maxQueueSize_; }
set {
maxQueueSize_ = value;
}
}
/// <summary>Field number for the "report_deadlock" field.</summary>
public const int ReportDeadlockFieldNumber = 21;
private bool reportDeadlock_;
/// <summary>
/// If true, the graph run fails with an error when throttling prevents all
/// calculators from running. If false, max_queue_size for an input stream
/// is adjusted when throttling prevents all calculators from running.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool ReportDeadlock {
get { return reportDeadlock_; }
set {
reportDeadlock_ = value;
}
}
/// <summary>Field number for the "input_stream_handler" field.</summary>
public const int InputStreamHandlerFieldNumber = 12;
private global::Mediapipe.InputStreamHandlerConfig inputStreamHandler_;
/// <summary>
/// Config for this graph's InputStreamHandler.
/// If unspecified, the framework will automatically install the default
/// handler, which works as follows.
/// The calculator's Process() method is called for timestamp t when:
/// - at least one stream has a packet available at t; and,
/// - all other streams either have packets at t, or it is known that they will
/// not have packets at t (i.e. their next timestamp bound is greater than t).
/// The handler then provides all available packets with timestamp t, with no
/// preprocessing.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.InputStreamHandlerConfig InputStreamHandler {
get { return inputStreamHandler_; }
set {
inputStreamHandler_ = value;
}
}
/// <summary>Field number for the "output_stream_handler" field.</summary>
public const int OutputStreamHandlerFieldNumber = 13;
private global::Mediapipe.OutputStreamHandlerConfig outputStreamHandler_;
/// <summary>
/// Config for this graph's OutputStreamHandler.
/// If unspecified, the default output stream handler will be automatically
/// installed by the framework which does not modify any outgoing packets.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.OutputStreamHandlerConfig OutputStreamHandler {
get { return outputStreamHandler_; }
set {
outputStreamHandler_ = value;
}
}
/// <summary>Field number for the "executor" field.</summary>
public const int ExecutorFieldNumber = 14;
private static readonly pb::FieldCodec<global::Mediapipe.ExecutorConfig> _repeated_executor_codec
= pb::FieldCodec.ForMessage(114, global::Mediapipe.ExecutorConfig.Parser);
private readonly pbc::RepeatedField<global::Mediapipe.ExecutorConfig> executor_ = new pbc::RepeatedField<global::Mediapipe.ExecutorConfig>();
/// <summary>
/// Configs for Executors.
/// The names of the executors must be distinct. The default executor, whose
/// name is the empty string, is predefined. The num_threads field of the
/// CalculatorGraphConfig specifies the number of threads in the default
/// executor. If the config for the default executor is specified, the
/// CalculatorGraphConfig must not have the num_threads field.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Mediapipe.ExecutorConfig> Executor {
get { return executor_; }
}
/// <summary>Field number for the "profiler_config" field.</summary>
public const int ProfilerConfigFieldNumber = 18;
private global::Mediapipe.ProfilerConfig profilerConfig_;
/// <summary>
/// The default profiler-config for all calculators. If set, this defines the
/// profiling settings such as num_histogram_intervals for every calculator in
/// the graph. Each of these settings can be overridden by the
/// |profiler_config| specified for a node.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.ProfilerConfig ProfilerConfig {
get { return profilerConfig_; }
set {
profilerConfig_ = value;
}
}
/// <summary>Field number for the "package" field.</summary>
public const int PackageFieldNumber = 19;
private string package_ = "";
/// <summary>
/// The namespace used for class name lookup within this graph.
/// An unqualified or partially qualified class name is looked up in
/// this namespace first and then in enclosing namespaces.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Package {
get { return package_; }
set {
package_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 20;
private string type_ = "";
/// <summary>
/// The type name for the graph config, used for registering and referencing
/// the graph config.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Type {
get { return type_; }
set {
type_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 1001;
private global::Mediapipe.MediaPipeOptions options_;
/// <summary>
/// The types and default values for graph options, in proto2 syntax.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.MediaPipeOptions Options {
get { return options_; }
set {
options_ = value;
}
}
/// <summary>Field number for the "graph_options" field.</summary>
public const int GraphOptionsFieldNumber = 1002;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Any> _repeated_graphOptions_codec
= pb::FieldCodec.ForMessage(8018, global::Google.Protobuf.WellKnownTypes.Any.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Any> graphOptions_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Any>();
/// <summary>
/// The types and default values for graph options, in proto3 syntax.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Any> GraphOptions {
get { return graphOptions_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as CalculatorGraphConfig);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(CalculatorGraphConfig other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if(!node_.Equals(other.node_)) return false;
if(!packetFactory_.Equals(other.packetFactory_)) return false;
if(!packetGenerator_.Equals(other.packetGenerator_)) return false;
if (NumThreads != other.NumThreads) return false;
if(!statusHandler_.Equals(other.statusHandler_)) return false;
if(!inputStream_.Equals(other.inputStream_)) return false;
if(!outputStream_.Equals(other.outputStream_)) return false;
if(!inputSidePacket_.Equals(other.inputSidePacket_)) return false;
if(!outputSidePacket_.Equals(other.outputSidePacket_)) return false;
if (MaxQueueSize != other.MaxQueueSize) return false;
if (ReportDeadlock != other.ReportDeadlock) return false;
if (!object.Equals(InputStreamHandler, other.InputStreamHandler)) return false;
if (!object.Equals(OutputStreamHandler, other.OutputStreamHandler)) return false;
if(!executor_.Equals(other.executor_)) return false;
if (!object.Equals(ProfilerConfig, other.ProfilerConfig)) return false;
if (Package != other.Package) return false;
if (Type != other.Type) return false;
if (!object.Equals(Options, other.Options)) return false;
if(!graphOptions_.Equals(other.graphOptions_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
hash ^= node_.GetHashCode();
hash ^= packetFactory_.GetHashCode();
hash ^= packetGenerator_.GetHashCode();
if (NumThreads != 0) hash ^= NumThreads.GetHashCode();
hash ^= statusHandler_.GetHashCode();
hash ^= inputStream_.GetHashCode();
hash ^= outputStream_.GetHashCode();
hash ^= inputSidePacket_.GetHashCode();
hash ^= outputSidePacket_.GetHashCode();
if (MaxQueueSize != 0) hash ^= MaxQueueSize.GetHashCode();
if (ReportDeadlock != false) hash ^= ReportDeadlock.GetHashCode();
if (inputStreamHandler_ != null) hash ^= InputStreamHandler.GetHashCode();
if (outputStreamHandler_ != null) hash ^= OutputStreamHandler.GetHashCode();
hash ^= executor_.GetHashCode();
if (profilerConfig_ != null) hash ^= ProfilerConfig.GetHashCode();
if (Package.Length != 0) hash ^= Package.GetHashCode();
if (Type.Length != 0) hash ^= Type.GetHashCode();
if (options_ != null) hash ^= Options.GetHashCode();
hash ^= graphOptions_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
node_.WriteTo(output, _repeated_node_codec);
packetFactory_.WriteTo(output, _repeated_packetFactory_codec);
packetGenerator_.WriteTo(output, _repeated_packetGenerator_codec);
if (NumThreads != 0) {
output.WriteRawTag(64);
output.WriteInt32(NumThreads);
}
statusHandler_.WriteTo(output, _repeated_statusHandler_codec);
inputStream_.WriteTo(output, _repeated_inputStream_codec);
if (MaxQueueSize != 0) {
output.WriteRawTag(88);
output.WriteInt32(MaxQueueSize);
}
if (inputStreamHandler_ != null) {
output.WriteRawTag(98);
output.WriteMessage(InputStreamHandler);
}
if (outputStreamHandler_ != null) {
output.WriteRawTag(106);
output.WriteMessage(OutputStreamHandler);
}
executor_.WriteTo(output, _repeated_executor_codec);
outputStream_.WriteTo(output, _repeated_outputStream_codec);
inputSidePacket_.WriteTo(output, _repeated_inputSidePacket_codec);
outputSidePacket_.WriteTo(output, _repeated_outputSidePacket_codec);
if (profilerConfig_ != null) {
output.WriteRawTag(146, 1);
output.WriteMessage(ProfilerConfig);
}
if (Package.Length != 0) {
output.WriteRawTag(154, 1);
output.WriteString(Package);
}
if (Type.Length != 0) {
output.WriteRawTag(162, 1);
output.WriteString(Type);
}
if (ReportDeadlock != false) {
output.WriteRawTag(168, 1);
output.WriteBool(ReportDeadlock);
}
if (options_ != null) {
output.WriteRawTag(202, 62);
output.WriteMessage(Options);
}
graphOptions_.WriteTo(output, _repeated_graphOptions_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
node_.WriteTo(ref output, _repeated_node_codec);
packetFactory_.WriteTo(ref output, _repeated_packetFactory_codec);
packetGenerator_.WriteTo(ref output, _repeated_packetGenerator_codec);
if (NumThreads != 0) {
output.WriteRawTag(64);
output.WriteInt32(NumThreads);
}
statusHandler_.WriteTo(ref output, _repeated_statusHandler_codec);
inputStream_.WriteTo(ref output, _repeated_inputStream_codec);
if (MaxQueueSize != 0) {
output.WriteRawTag(88);
output.WriteInt32(MaxQueueSize);
}
if (inputStreamHandler_ != null) {
output.WriteRawTag(98);
output.WriteMessage(InputStreamHandler);
}
if (outputStreamHandler_ != null) {
output.WriteRawTag(106);
output.WriteMessage(OutputStreamHandler);
}
executor_.WriteTo(ref output, _repeated_executor_codec);
outputStream_.WriteTo(ref output, _repeated_outputStream_codec);
inputSidePacket_.WriteTo(ref output, _repeated_inputSidePacket_codec);
outputSidePacket_.WriteTo(ref output, _repeated_outputSidePacket_codec);
if (profilerConfig_ != null) {
output.WriteRawTag(146, 1);
output.WriteMessage(ProfilerConfig);
}
if (Package.Length != 0) {
output.WriteRawTag(154, 1);
output.WriteString(Package);
}
if (Type.Length != 0) {
output.WriteRawTag(162, 1);
output.WriteString(Type);
}
if (ReportDeadlock != false) {
output.WriteRawTag(168, 1);
output.WriteBool(ReportDeadlock);
}
if (options_ != null) {
output.WriteRawTag(202, 62);
output.WriteMessage(Options);
}
graphOptions_.WriteTo(ref output, _repeated_graphOptions_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
size += node_.CalculateSize(_repeated_node_codec);
size += packetFactory_.CalculateSize(_repeated_packetFactory_codec);
size += packetGenerator_.CalculateSize(_repeated_packetGenerator_codec);
if (NumThreads != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(NumThreads);
}
size += statusHandler_.CalculateSize(_repeated_statusHandler_codec);
size += inputStream_.CalculateSize(_repeated_inputStream_codec);
size += outputStream_.CalculateSize(_repeated_outputStream_codec);
size += inputSidePacket_.CalculateSize(_repeated_inputSidePacket_codec);
size += outputSidePacket_.CalculateSize(_repeated_outputSidePacket_codec);
if (MaxQueueSize != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(MaxQueueSize);
}
if (ReportDeadlock != false) {
size += 2 + 1;
}
if (inputStreamHandler_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(InputStreamHandler);
}
if (outputStreamHandler_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(OutputStreamHandler);
}
size += executor_.CalculateSize(_repeated_executor_codec);
if (profilerConfig_ != null) {
size += 2 + pb::CodedOutputStream.ComputeMessageSize(ProfilerConfig);
}
if (Package.Length != 0) {
size += 2 + pb::CodedOutputStream.ComputeStringSize(Package);
}
if (Type.Length != 0) {
size += 2 + pb::CodedOutputStream.ComputeStringSize(Type);
}
if (options_ != null) {
size += 2 + pb::CodedOutputStream.ComputeMessageSize(Options);
}
size += graphOptions_.CalculateSize(_repeated_graphOptions_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(CalculatorGraphConfig other) {
if (other == null) {
return;
}
node_.Add(other.node_);
packetFactory_.Add(other.packetFactory_);
packetGenerator_.Add(other.packetGenerator_);
if (other.NumThreads != 0) {
NumThreads = other.NumThreads;
}
statusHandler_.Add(other.statusHandler_);
inputStream_.Add(other.inputStream_);
outputStream_.Add(other.outputStream_);
inputSidePacket_.Add(other.inputSidePacket_);
outputSidePacket_.Add(other.outputSidePacket_);
if (other.MaxQueueSize != 0) {
MaxQueueSize = other.MaxQueueSize;
}
if (other.ReportDeadlock != false) {
ReportDeadlock = other.ReportDeadlock;
}
if (other.inputStreamHandler_ != null) {
if (inputStreamHandler_ == null) {
InputStreamHandler = new global::Mediapipe.InputStreamHandlerConfig();
}
InputStreamHandler.MergeFrom(other.InputStreamHandler);
}
if (other.outputStreamHandler_ != null) {
if (outputStreamHandler_ == null) {
OutputStreamHandler = new global::Mediapipe.OutputStreamHandlerConfig();
}
OutputStreamHandler.MergeFrom(other.OutputStreamHandler);
}
executor_.Add(other.executor_);
if (other.profilerConfig_ != null) {
if (profilerConfig_ == null) {
ProfilerConfig = new global::Mediapipe.ProfilerConfig();
}
ProfilerConfig.MergeFrom(other.ProfilerConfig);
}
if (other.Package.Length != 0) {
Package = other.Package;
}
if (other.Type.Length != 0) {
Type = other.Type;
}
if (other.options_ != null) {
if (options_ == null) {
Options = new global::Mediapipe.MediaPipeOptions();
}
Options.MergeFrom(other.Options);
}
graphOptions_.Add(other.graphOptions_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
node_.AddEntriesFrom(input, _repeated_node_codec);
break;
}
case 50: {
packetFactory_.AddEntriesFrom(input, _repeated_packetFactory_codec);
break;
}
case 58: {
packetGenerator_.AddEntriesFrom(input, _repeated_packetGenerator_codec);
break;
}
case 64: {
NumThreads = input.ReadInt32();
break;
}
case 74: {
statusHandler_.AddEntriesFrom(input, _repeated_statusHandler_codec);
break;
}
case 82: {
inputStream_.AddEntriesFrom(input, _repeated_inputStream_codec);
break;
}
case 88: {
MaxQueueSize = input.ReadInt32();
break;
}
case 98: {
if (inputStreamHandler_ == null) {
InputStreamHandler = new global::Mediapipe.InputStreamHandlerConfig();
}
input.ReadMessage(InputStreamHandler);
break;
}
case 106: {
if (outputStreamHandler_ == null) {
OutputStreamHandler = new global::Mediapipe.OutputStreamHandlerConfig();
}
input.ReadMessage(OutputStreamHandler);
break;
}
case 114: {
executor_.AddEntriesFrom(input, _repeated_executor_codec);
break;
}
case 122: {
outputStream_.AddEntriesFrom(input, _repeated_outputStream_codec);
break;
}
case 130: {
inputSidePacket_.AddEntriesFrom(input, _repeated_inputSidePacket_codec);
break;
}
case 138: {
outputSidePacket_.AddEntriesFrom(input, _repeated_outputSidePacket_codec);
break;
}
case 146: {
if (profilerConfig_ == null) {
ProfilerConfig = new global::Mediapipe.ProfilerConfig();
}
input.ReadMessage(ProfilerConfig);
break;
}
case 154: {
Package = input.ReadString();
break;
}
case 162: {
Type = input.ReadString();
break;
}
case 168: {
ReportDeadlock = input.ReadBool();
break;
}
case 8010: {
if (options_ == null) {
Options = new global::Mediapipe.MediaPipeOptions();
}
input.ReadMessage(Options);
break;
}
case 8018: {
graphOptions_.AddEntriesFrom(input, _repeated_graphOptions_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
node_.AddEntriesFrom(ref input, _repeated_node_codec);
break;
}
case 50: {
packetFactory_.AddEntriesFrom(ref input, _repeated_packetFactory_codec);
break;
}
case 58: {
packetGenerator_.AddEntriesFrom(ref input, _repeated_packetGenerator_codec);
break;
}
case 64: {
NumThreads = input.ReadInt32();
break;
}
case 74: {
statusHandler_.AddEntriesFrom(ref input, _repeated_statusHandler_codec);
break;
}
case 82: {
inputStream_.AddEntriesFrom(ref input, _repeated_inputStream_codec);
break;
}
case 88: {
MaxQueueSize = input.ReadInt32();
break;
}
case 98: {
if (inputStreamHandler_ == null) {
InputStreamHandler = new global::Mediapipe.InputStreamHandlerConfig();
}
input.ReadMessage(InputStreamHandler);
break;
}
case 106: {
if (outputStreamHandler_ == null) {
OutputStreamHandler = new global::Mediapipe.OutputStreamHandlerConfig();
}
input.ReadMessage(OutputStreamHandler);
break;
}
case 114: {
executor_.AddEntriesFrom(ref input, _repeated_executor_codec);
break;
}
case 122: {
outputStream_.AddEntriesFrom(ref input, _repeated_outputStream_codec);
break;
}
case 130: {
inputSidePacket_.AddEntriesFrom(ref input, _repeated_inputSidePacket_codec);
break;
}
case 138: {
outputSidePacket_.AddEntriesFrom(ref input, _repeated_outputSidePacket_codec);
break;
}
case 146: {
if (profilerConfig_ == null) {
ProfilerConfig = new global::Mediapipe.ProfilerConfig();
}
input.ReadMessage(ProfilerConfig);
break;
}
case 154: {
Package = input.ReadString();
break;
}
case 162: {
Type = input.ReadString();
break;
}
case 168: {
ReportDeadlock = input.ReadBool();
break;
}
case 8010: {
if (options_ == null) {
Options = new global::Mediapipe.MediaPipeOptions();
}
input.ReadMessage(Options);
break;
}
case 8018: {
graphOptions_.AddEntriesFrom(ref input, _repeated_graphOptions_codec);
break;
}
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the CalculatorGraphConfig message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
/// <summary>
/// A single node in the DAG.
/// </summary>
public sealed partial class Node : pb::IMessage<Node>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Node> _parser = new pb::MessageParser<Node>(() => new Node());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Node> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Mediapipe.CalculatorGraphConfig.Descriptor.NestedTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Node() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Node(Node other) : this() {
name_ = other.name_;
calculator_ = other.calculator_;
inputStream_ = other.inputStream_.Clone();
outputStream_ = other.outputStream_.Clone();
inputSidePacket_ = other.inputSidePacket_.Clone();
outputSidePacket_ = other.outputSidePacket_.Clone();
options_ = other.options_ != null ? other.options_.Clone() : null;
nodeOptions_ = other.nodeOptions_.Clone();
sourceLayer_ = other.sourceLayer_;
bufferSizeHint_ = other.bufferSizeHint_;
inputStreamHandler_ = other.inputStreamHandler_ != null ? other.inputStreamHandler_.Clone() : null;
outputStreamHandler_ = other.outputStreamHandler_ != null ? other.outputStreamHandler_.Clone() : null;
inputStreamInfo_ = other.inputStreamInfo_.Clone();
executor_ = other.executor_;
profilerConfig_ = other.profilerConfig_ != null ? other.profilerConfig_.Clone() : null;
maxInFlight_ = other.maxInFlight_;
optionValue_ = other.optionValue_.Clone();
externalInput_ = other.externalInput_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Node Clone() {
return new Node(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// The name of the node. This field is optional and doesn't generally
/// need to be specified, but does improve error messaging.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "calculator" field.</summary>
public const int CalculatorFieldNumber = 2;
private string calculator_ = "";
/// <summary>
/// The registered type of a calculator (provided via REGISTER_CALCULATOR),
/// or of a subgraph (via REGISTER_MEDIAPIPE_GRAPH).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Calculator {
get { return calculator_; }
set {
calculator_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "input_stream" field.</summary>
public const int InputStreamFieldNumber = 3;
private static readonly pb::FieldCodec<string> _repeated_inputStream_codec
= pb::FieldCodec.ForString(26);
private readonly pbc::RepeatedField<string> inputStream_ = new pbc::RepeatedField<string>();
/// <summary>
/// String(s) representing "TAG:name" of the stream(s) from which the current
/// node will get its inputs. "TAG:" part is optional, see above.
/// A calculator with no input stream is a source.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> InputStream {
get { return inputStream_; }
}
/// <summary>Field number for the "output_stream" field.</summary>
public const int OutputStreamFieldNumber = 4;
private static readonly pb::FieldCodec<string> _repeated_outputStream_codec
= pb::FieldCodec.ForString(34);
private readonly pbc::RepeatedField<string> outputStream_ = new pbc::RepeatedField<string>();
/// <summary>
/// String(s) representing "TAG:name" of the stream(s) produced by this node.
/// "TAG:" part is optional, see above. These must be different from any
/// other output_streams specified for other nodes in the graph.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> OutputStream {
get { return outputStream_; }
}
/// <summary>Field number for the "input_side_packet" field.</summary>
public const int InputSidePacketFieldNumber = 5;
private static readonly pb::FieldCodec<string> _repeated_inputSidePacket_codec
= pb::FieldCodec.ForString(42);
private readonly pbc::RepeatedField<string> inputSidePacket_ = new pbc::RepeatedField<string>();
/// <summary>
/// String(s) representing "TAG:name" of the input side packet(s).
/// "TAG:" part is optional, see above.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> InputSidePacket {
get { return inputSidePacket_; }
}
/// <summary>Field number for the "output_side_packet" field.</summary>
public const int OutputSidePacketFieldNumber = 6;
private static readonly pb::FieldCodec<string> _repeated_outputSidePacket_codec
= pb::FieldCodec.ForString(50);
private readonly pbc::RepeatedField<string> outputSidePacket_ = new pbc::RepeatedField<string>();
/// <summary>
/// String(s) representing "TAG:name" of the output side packet(s). Only
/// used by subgraphs.
/// "TAG:" part is optional, see above.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> OutputSidePacket {
get { return outputSidePacket_; }
}
/// <summary>Field number for the "options" field.</summary>
public const int OptionsFieldNumber = 7;
private global::Mediapipe.CalculatorOptions options_;
/// <summary>
/// The options passed to the Calculator, in proto2 syntax.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.CalculatorOptions Options {
get { return options_; }
set {
options_ = value;
}
}
/// <summary>Field number for the "node_options" field.</summary>
public const int NodeOptionsFieldNumber = 8;
private static readonly pb::FieldCodec<global::Google.Protobuf.WellKnownTypes.Any> _repeated_nodeOptions_codec
= pb::FieldCodec.ForMessage(66, global::Google.Protobuf.WellKnownTypes.Any.Parser);
private readonly pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Any> nodeOptions_ = new pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Any>();
/// <summary>
/// The options passed to the Calculator, in proto3 syntax.
/// Each node_options message must have a different message type.
/// If the same message type is specified in |options| and |node_options|,
/// only the message in |options| is used.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Google.Protobuf.WellKnownTypes.Any> NodeOptions {
get { return nodeOptions_; }
}
/// <summary>Field number for the "source_layer" field.</summary>
public const int SourceLayerFieldNumber = 9;
private int sourceLayer_;
/// <summary>
/// For a Source Calculator (i.e. a calculator with no inputs),
/// this is the "layer" on which the calculator is executed. For a
/// non-source calculator (i.e. a calculator with one or more input
/// streams) this field has no effect. The sources on each layer
/// are completely exhausted before Process() is called on any source
/// calculator on a higher numbered layer.
/// Example:
/// Decoder -> Median Frame (requires all frames) -> Image Subtraction
/// --------------------------------------->
/// The entire video will be buffered on the edge from the decoder
/// to the Image subtraction. To fix this problem, layers can be used.
/// Decoder (layer 0) -> Median Frame -> Image Subtraction
/// Decoder (layer 1) ----------------->
/// The frames from layer 0 will no longer be buffered, but the video
/// will be decoded again instead. Note, that different options can
/// be used in the second decoder.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int SourceLayer {
get { return sourceLayer_; }
set {
sourceLayer_ = value;
}
}
/// <summary>Field number for the "buffer_size_hint" field.</summary>
public const int BufferSizeHintFieldNumber = 10;
private int bufferSizeHint_;
/// <summary>
/// Optional parameter that allows the user to indicate to the scheduler that
/// this node has a buffering behavior (i.e. waits for a bunch of packets
/// before emitting any) and specify the size of the buffer that is built up.
/// The scheduler will then try to keep the maximum size of any input queues
/// in the graph to remain below the maximum of all buffer_size_hints and
/// max_queue_size (if specified). The ideal value is typically something
/// larger than the actual number of buffered packets to maintain pipelining.
/// The default value 0 indicates that the node has no buffering behavior.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int BufferSizeHint {
get { return bufferSizeHint_; }
set {
bufferSizeHint_ = value;
}
}
/// <summary>Field number for the "input_stream_handler" field.</summary>
public const int InputStreamHandlerFieldNumber = 11;
private global::Mediapipe.InputStreamHandlerConfig inputStreamHandler_;
/// <summary>
/// Config for this node's InputStreamHandler.
/// If unspecified, the graph-level input stream handler will be used.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.InputStreamHandlerConfig InputStreamHandler {
get { return inputStreamHandler_; }
set {
inputStreamHandler_ = value;
}
}
/// <summary>Field number for the "output_stream_handler" field.</summary>
public const int OutputStreamHandlerFieldNumber = 12;
private global::Mediapipe.OutputStreamHandlerConfig outputStreamHandler_;
/// <summary>
/// Config for this node's OutputStreamHandler.
/// If unspecified, the graph-level output stream handler will be used.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.OutputStreamHandlerConfig OutputStreamHandler {
get { return outputStreamHandler_; }
set {
outputStreamHandler_ = value;
}
}
/// <summary>Field number for the "input_stream_info" field.</summary>
public const int InputStreamInfoFieldNumber = 13;
private static readonly pb::FieldCodec<global::Mediapipe.InputStreamInfo> _repeated_inputStreamInfo_codec
= pb::FieldCodec.ForMessage(106, global::Mediapipe.InputStreamInfo.Parser);
private readonly pbc::RepeatedField<global::Mediapipe.InputStreamInfo> inputStreamInfo_ = new pbc::RepeatedField<global::Mediapipe.InputStreamInfo>();
/// <summary>
/// Additional information about an input stream. The |name| field of the
/// InputStreamInfo must match an input_stream.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Mediapipe.InputStreamInfo> InputStreamInfo {
get { return inputStreamInfo_; }
}
/// <summary>Field number for the "executor" field.</summary>
public const int ExecutorFieldNumber = 14;
private string executor_ = "";
/// <summary>
/// Set the executor which the calculator will execute on.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Executor {
get { return executor_; }
set {
executor_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "profiler_config" field.</summary>
public const int ProfilerConfigFieldNumber = 15;
private global::Mediapipe.ProfilerConfig profilerConfig_;
/// <summary>
/// TODO: Remove from Node when switched to Profiler.
/// DEPRECATED: Configs for the profiler.
/// </summary>
[global::System.ObsoleteAttribute]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Mediapipe.ProfilerConfig ProfilerConfig {
get { return profilerConfig_; }
set {
profilerConfig_ = value;
}
}
/// <summary>Field number for the "max_in_flight" field.</summary>
public const int MaxInFlightFieldNumber = 16;
private int maxInFlight_;
/// <summary>
/// The maximum number of invocations that can be executed in parallel.
/// If not specified, the limit is one invocation.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int MaxInFlight {
get { return maxInFlight_; }
set {
maxInFlight_ = value;
}
}
/// <summary>Field number for the "option_value" field.</summary>
public const int OptionValueFieldNumber = 17;
private static readonly pb::FieldCodec<string> _repeated_optionValue_codec
= pb::FieldCodec.ForString(138);
private readonly pbc::RepeatedField<string> optionValue_ = new pbc::RepeatedField<string>();
/// <summary>
/// Defines an option value for this Node from graph options or packets.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> OptionValue {
get { return optionValue_; }
}
/// <summary>Field number for the "external_input" field.</summary>
public const int ExternalInputFieldNumber = 1005;
private static readonly pb::FieldCodec<string> _repeated_externalInput_codec
= pb::FieldCodec.ForString(8042);
private readonly pbc::RepeatedField<string> externalInput_ = new pbc::RepeatedField<string>();
/// <summary>
/// DEPRECATED: For backwards compatibility we allow users to
/// specify the old name for "input_side_packet" in proto configs.
/// These are automatically converted to input_side_packets during
/// config canonicalization.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> ExternalInput {
get { return externalInput_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as Node);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(Node other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (Calculator != other.Calculator) return false;
if(!inputStream_.Equals(other.inputStream_)) return false;
if(!outputStream_.Equals(other.outputStream_)) return false;
if(!inputSidePacket_.Equals(other.inputSidePacket_)) return false;
if(!outputSidePacket_.Equals(other.outputSidePacket_)) return false;
if (!object.Equals(Options, other.Options)) return false;
if(!nodeOptions_.Equals(other.nodeOptions_)) return false;
if (SourceLayer != other.SourceLayer) return false;
if (BufferSizeHint != other.BufferSizeHint) return false;
if (!object.Equals(InputStreamHandler, other.InputStreamHandler)) return false;
if (!object.Equals(OutputStreamHandler, other.OutputStreamHandler)) return false;
if(!inputStreamInfo_.Equals(other.inputStreamInfo_)) return false;
if (Executor != other.Executor) return false;
if (!object.Equals(ProfilerConfig, other.ProfilerConfig)) return false;
if (MaxInFlight != other.MaxInFlight) return false;
if(!optionValue_.Equals(other.optionValue_)) return false;
if(!externalInput_.Equals(other.externalInput_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (Calculator.Length != 0) hash ^= Calculator.GetHashCode();
hash ^= inputStream_.GetHashCode();
hash ^= outputStream_.GetHashCode();
hash ^= inputSidePacket_.GetHashCode();
hash ^= outputSidePacket_.GetHashCode();
if (options_ != null) hash ^= Options.GetHashCode();
hash ^= nodeOptions_.GetHashCode();
if (SourceLayer != 0) hash ^= SourceLayer.GetHashCode();
if (BufferSizeHint != 0) hash ^= BufferSizeHint.GetHashCode();
if (inputStreamHandler_ != null) hash ^= InputStreamHandler.GetHashCode();
if (outputStreamHandler_ != null) hash ^= OutputStreamHandler.GetHashCode();
hash ^= inputStreamInfo_.GetHashCode();
if (Executor.Length != 0) hash ^= Executor.GetHashCode();
if (profilerConfig_ != null) hash ^= ProfilerConfig.GetHashCode();
if (MaxInFlight != 0) hash ^= MaxInFlight.GetHashCode();
hash ^= optionValue_.GetHashCode();
hash ^= externalInput_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Calculator.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Calculator);
}
inputStream_.WriteTo(output, _repeated_inputStream_codec);
outputStream_.WriteTo(output, _repeated_outputStream_codec);
inputSidePacket_.WriteTo(output, _repeated_inputSidePacket_codec);
outputSidePacket_.WriteTo(output, _repeated_outputSidePacket_codec);
if (options_ != null) {
output.WriteRawTag(58);
output.WriteMessage(Options);
}
nodeOptions_.WriteTo(output, _repeated_nodeOptions_codec);
if (SourceLayer != 0) {
output.WriteRawTag(72);
output.WriteInt32(SourceLayer);
}
if (BufferSizeHint != 0) {
output.WriteRawTag(80);
output.WriteInt32(BufferSizeHint);
}
if (inputStreamHandler_ != null) {
output.WriteRawTag(90);
output.WriteMessage(InputStreamHandler);
}
if (outputStreamHandler_ != null) {
output.WriteRawTag(98);
output.WriteMessage(OutputStreamHandler);
}
inputStreamInfo_.WriteTo(output, _repeated_inputStreamInfo_codec);
if (Executor.Length != 0) {
output.WriteRawTag(114);
output.WriteString(Executor);
}
if (profilerConfig_ != null) {
output.WriteRawTag(122);
output.WriteMessage(ProfilerConfig);
}
if (MaxInFlight != 0) {
output.WriteRawTag(128, 1);
output.WriteInt32(MaxInFlight);
}
optionValue_.WriteTo(output, _repeated_optionValue_codec);
externalInput_.WriteTo(output, _repeated_externalInput_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (Calculator.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Calculator);
}
inputStream_.WriteTo(ref output, _repeated_inputStream_codec);
outputStream_.WriteTo(ref output, _repeated_outputStream_codec);
inputSidePacket_.WriteTo(ref output, _repeated_inputSidePacket_codec);
outputSidePacket_.WriteTo(ref output, _repeated_outputSidePacket_codec);
if (options_ != null) {
output.WriteRawTag(58);
output.WriteMessage(Options);
}
nodeOptions_.WriteTo(ref output, _repeated_nodeOptions_codec);
if (SourceLayer != 0) {
output.WriteRawTag(72);
output.WriteInt32(SourceLayer);
}
if (BufferSizeHint != 0) {
output.WriteRawTag(80);
output.WriteInt32(BufferSizeHint);
}
if (inputStreamHandler_ != null) {
output.WriteRawTag(90);
output.WriteMessage(InputStreamHandler);
}
if (outputStreamHandler_ != null) {
output.WriteRawTag(98);
output.WriteMessage(OutputStreamHandler);
}
inputStreamInfo_.WriteTo(ref output, _repeated_inputStreamInfo_codec);
if (Executor.Length != 0) {
output.WriteRawTag(114);
output.WriteString(Executor);
}
if (profilerConfig_ != null) {
output.WriteRawTag(122);
output.WriteMessage(ProfilerConfig);
}
if (MaxInFlight != 0) {
output.WriteRawTag(128, 1);
output.WriteInt32(MaxInFlight);
}
optionValue_.WriteTo(ref output, _repeated_optionValue_codec);
externalInput_.WriteTo(ref output, _repeated_externalInput_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (Calculator.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Calculator);
}
size += inputStream_.CalculateSize(_repeated_inputStream_codec);
size += outputStream_.CalculateSize(_repeated_outputStream_codec);
size += inputSidePacket_.CalculateSize(_repeated_inputSidePacket_codec);
size += outputSidePacket_.CalculateSize(_repeated_outputSidePacket_codec);
if (options_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options);
}
size += nodeOptions_.CalculateSize(_repeated_nodeOptions_codec);
if (SourceLayer != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(SourceLayer);
}
if (BufferSizeHint != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(BufferSizeHint);
}
if (inputStreamHandler_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(InputStreamHandler);
}
if (outputStreamHandler_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(OutputStreamHandler);
}
size += inputStreamInfo_.CalculateSize(_repeated_inputStreamInfo_codec);
if (Executor.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Executor);
}
if (profilerConfig_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(ProfilerConfig);
}
if (MaxInFlight != 0) {
size += 2 + pb::CodedOutputStream.ComputeInt32Size(MaxInFlight);
}
size += optionValue_.CalculateSize(_repeated_optionValue_codec);
size += externalInput_.CalculateSize(_repeated_externalInput_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(Node other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.Calculator.Length != 0) {
Calculator = other.Calculator;
}
inputStream_.Add(other.inputStream_);
outputStream_.Add(other.outputStream_);
inputSidePacket_.Add(other.inputSidePacket_);
outputSidePacket_.Add(other.outputSidePacket_);
if (other.options_ != null) {
if (options_ == null) {
Options = new global::Mediapipe.CalculatorOptions();
}
Options.MergeFrom(other.Options);
}
nodeOptions_.Add(other.nodeOptions_);
if (other.SourceLayer != 0) {
SourceLayer = other.SourceLayer;
}
if (other.BufferSizeHint != 0) {
BufferSizeHint = other.BufferSizeHint;
}
if (other.inputStreamHandler_ != null) {
if (inputStreamHandler_ == null) {
InputStreamHandler = new global::Mediapipe.InputStreamHandlerConfig();
}
InputStreamHandler.MergeFrom(other.InputStreamHandler);
}
if (other.outputStreamHandler_ != null) {
if (outputStreamHandler_ == null) {
OutputStreamHandler = new global::Mediapipe.OutputStreamHandlerConfig();
}
OutputStreamHandler.MergeFrom(other.OutputStreamHandler);
}
inputStreamInfo_.Add(other.inputStreamInfo_);
if (other.Executor.Length != 0) {
Executor = other.Executor;
}
if (other.profilerConfig_ != null) {
if (profilerConfig_ == null) {
ProfilerConfig = new global::Mediapipe.ProfilerConfig();
}
ProfilerConfig.MergeFrom(other.ProfilerConfig);
}
if (other.MaxInFlight != 0) {
MaxInFlight = other.MaxInFlight;
}
optionValue_.Add(other.optionValue_);
externalInput_.Add(other.externalInput_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Calculator = input.ReadString();
break;
}
case 26: {
inputStream_.AddEntriesFrom(input, _repeated_inputStream_codec);
break;
}
case 34: {
outputStream_.AddEntriesFrom(input, _repeated_outputStream_codec);
break;
}
case 42: {
inputSidePacket_.AddEntriesFrom(input, _repeated_inputSidePacket_codec);
break;
}
case 50: {
outputSidePacket_.AddEntriesFrom(input, _repeated_outputSidePacket_codec);
break;
}
case 58: {
if (options_ == null) {
Options = new global::Mediapipe.CalculatorOptions();
}
input.ReadMessage(Options);
break;
}
case 66: {
nodeOptions_.AddEntriesFrom(input, _repeated_nodeOptions_codec);
break;
}
case 72: {
SourceLayer = input.ReadInt32();
break;
}
case 80: {
BufferSizeHint = input.ReadInt32();
break;
}
case 90: {
if (inputStreamHandler_ == null) {
InputStreamHandler = new global::Mediapipe.InputStreamHandlerConfig();
}
input.ReadMessage(InputStreamHandler);
break;
}
case 98: {
if (outputStreamHandler_ == null) {
OutputStreamHandler = new global::Mediapipe.OutputStreamHandlerConfig();
}
input.ReadMessage(OutputStreamHandler);
break;
}
case 106: {
inputStreamInfo_.AddEntriesFrom(input, _repeated_inputStreamInfo_codec);
break;
}
case 114: {
Executor = input.ReadString();
break;
}
case 122: {
if (profilerConfig_ == null) {
ProfilerConfig = new global::Mediapipe.ProfilerConfig();
}
input.ReadMessage(ProfilerConfig);
break;
}
case 128: {
MaxInFlight = input.ReadInt32();
break;
}
case 138: {
optionValue_.AddEntriesFrom(input, _repeated_optionValue_codec);
break;
}
case 8042: {
externalInput_.AddEntriesFrom(input, _repeated_externalInput_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
Calculator = input.ReadString();
break;
}
case 26: {
inputStream_.AddEntriesFrom(ref input, _repeated_inputStream_codec);
break;
}
case 34: {
outputStream_.AddEntriesFrom(ref input, _repeated_outputStream_codec);
break;
}
case 42: {
inputSidePacket_.AddEntriesFrom(ref input, _repeated_inputSidePacket_codec);
break;
}
case 50: {
outputSidePacket_.AddEntriesFrom(ref input, _repeated_outputSidePacket_codec);
break;
}
case 58: {
if (options_ == null) {
Options = new global::Mediapipe.CalculatorOptions();
}
input.ReadMessage(Options);
break;
}
case 66: {
nodeOptions_.AddEntriesFrom(ref input, _repeated_nodeOptions_codec);
break;
}
case 72: {
SourceLayer = input.ReadInt32();
break;
}
case 80: {
BufferSizeHint = input.ReadInt32();
break;
}
case 90: {
if (inputStreamHandler_ == null) {
InputStreamHandler = new global::Mediapipe.InputStreamHandlerConfig();
}
input.ReadMessage(InputStreamHandler);
break;
}
case 98: {
if (outputStreamHandler_ == null) {
OutputStreamHandler = new global::Mediapipe.OutputStreamHandlerConfig();
}
input.ReadMessage(OutputStreamHandler);
break;
}
case 106: {
inputStreamInfo_.AddEntriesFrom(ref input, _repeated_inputStreamInfo_codec);
break;
}
case 114: {
Executor = input.ReadString();
break;
}
case 122: {
if (profilerConfig_ == null) {
ProfilerConfig = new global::Mediapipe.ProfilerConfig();
}
input.ReadMessage(ProfilerConfig);
break;
}
case 128: {
MaxInFlight = input.ReadInt32();
break;
}
case 138: {
optionValue_.AddEntriesFrom(ref input, _repeated_optionValue_codec);
break;
}
case 8042: {
externalInput_.AddEntriesFrom(ref input, _repeated_externalInput_codec);
break;
}
}
}
}
#endif
}
}
#endregion
}
#endregion
}
#endregion Designer generated code
| 41.330259 | 975 | 0.651898 | [
"MIT"
] | MrTrotta2010/clibras-frontend | Packages/com.github.homuler.mediapipe/Runtime/Scripts/Protobuf/Calculator.cs | 161,312 | C# |
using Lucene.Net.Index;
using Lucene.Net.Search;
using Lucene.Net.Spatial.Prefix.Tree;
using Lucene.Net.Util;
using Spatial4n.Core.Shapes;
using System.IO;
namespace Lucene.Net.Spatial.Prefix
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <summary>
/// A Filter matching documents that have an <see cref="SpatialRelation.INTERSECTS"/>
/// (i.e. not DISTINCT) relationship with a provided query shape.
///
/// @lucene.internal
/// </summary>
public class IntersectsPrefixTreeFilter : AbstractVisitingPrefixTreeFilter
{
private readonly bool hasIndexedLeaves;
public IntersectsPrefixTreeFilter(IShape queryShape, string fieldName,
SpatialPrefixTree grid, int detailLevel,
int prefixGridScanLevel, bool hasIndexedLeaves)
: base(queryShape, fieldName, grid, detailLevel, prefixGridScanLevel)
{
this.hasIndexedLeaves = hasIndexedLeaves;
}
public override bool Equals(object o)
{
return base.Equals(o) && hasIndexedLeaves == ((IntersectsPrefixTreeFilter)o).hasIndexedLeaves;
}
/// <summary>
/// LUCENENET specific: need to override GetHashCode to
/// prevent a compiler warning and realistically, the hash code
/// should work similarly to Equals.
/// </summary>
public override int GetHashCode()
{
int h = base.GetHashCode();
h ^= hasIndexedLeaves.GetHashCode(); // reversible
return h;
}
/// <exception cref="IOException"></exception>
public override DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs)
{
return new VisitorTemplateAnonymousHelper(this, context, acceptDocs, hasIndexedLeaves).GetDocIdSet();
}
#region Nested type: VisitorTemplateAnonymousHelper
private sealed class VisitorTemplateAnonymousHelper : VisitorTemplate
{
private FixedBitSet results;
public VisitorTemplateAnonymousHelper(IntersectsPrefixTreeFilter outerInstance, AtomicReaderContext context, IBits acceptDocs, bool hasIndexedLeaves)
: base(outerInstance, context, acceptDocs, hasIndexedLeaves)
{
}
protected internal override void Start()
{
results = new FixedBitSet(m_maxDoc);
}
protected internal override DocIdSet Finish()
{
return results;
}
protected internal override bool Visit(Cell cell)
{
if (cell.ShapeRel == SpatialRelation.WITHIN || cell.Level == m_outerInstance.m_detailLevel)
{
CollectDocs(results);
return false;
}
return true;
}
protected internal override void VisitLeaf(Cell cell)
{
CollectDocs(results);
}
protected internal override void VisitScanned(Cell cell)
{
if (m_outerInstance.m_queryShape.Relate(cell.Shape).Intersects())
{
CollectDocs(results);
}
}
}
#endregion
}
} | 36.417391 | 161 | 0.60936 | [
"Apache-2.0"
] | Ref12/lucenenet | src/Lucene.Net.Spatial/Prefix/IntersectsPrefixTreeFilter.cs | 4,188 | 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("FisherYates")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FisherYates")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("34533248-aa45-4879-8eff-c55a879d10eb")]
// 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.702703 | 84 | 0.744803 | [
"BSD-3-Clause"
] | aloisdg/algo | Algo/FisherYates/Properties/AssemblyInfo.cs | 1,398 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Xunit;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests.IncrementalParsing
{
public class BinaryExpressionChanges
{
// This test is an exception to the others as * will be assumed to be a pointer type in an
// expression syntax. To make this parse correctly, the multiplication must be in a location
// that is definitely an expression (i.e. an assignment expression)
[Fact]
public void PlusToMultiply()
{
string text = @"class C{
void M() {
int x = y + 2;
}
}";
var oldTree = SyntaxFactory.ParseSyntaxTree(text);
var newTree = oldTree.WithReplaceFirst("+", "*");
var type = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax;
var method = type.Members[0] as MethodDeclarationSyntax;
var block = method.Body;
var statement = block.Statements[0] as LocalDeclarationStatementSyntax;
var expression = statement.Declaration.Variables[0].Initializer.Value as BinaryExpressionSyntax;
Assert.Equal(SyntaxKind.MultiplyExpression, expression.Kind());
}
[Fact]
public void PlusToMinus()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.SubtractExpression);
}
[Fact]
public void PlusToDivide()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.DivideExpression);
}
[Fact]
public void PlusToModulo()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.ModuloExpression);
}
[Fact]
public void PlusToLeftShift()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.LeftShiftExpression);
}
[Fact]
public void PlusToRightShift()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.RightShiftExpression);
}
[Fact]
public void PlusToLogicalOr()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.LogicalOrExpression);
}
[Fact]
public void PlusToLogicalAnd()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.LogicalAndExpression);
}
[Fact]
public void PlusToBitwiseAnd()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.BitwiseAndExpression);
}
[Fact]
public void PlusToBitwiseOr()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.BitwiseOrExpression);
}
[Fact]
public void PlusToExclusiveOr()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.ExclusiveOrExpression);
}
[Fact]
public void PlusToEquals()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.EqualsExpression);
}
[Fact]
public void PlusToNotEquals()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.NotEqualsExpression);
}
[Fact]
public void PlusToLessThan()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.LessThanExpression);
}
[Fact]
public void PlusToLessThanEqualTo()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.LessThanOrEqualExpression);
}
[Fact]
public void PlusToGreaterThan()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.GreaterThanExpression);
}
[Fact]
public void PlusToGreaterThanEqualTo()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.GreaterThanOrEqualExpression);
}
[Fact]
public void PlusToAs()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.AsExpression);
}
[Fact]
public void PlusToIs()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.IsExpression);
}
[Fact]
public void PlusToCoalesce()
{
MakeBinOpChange(SyntaxKind.AddExpression, SyntaxKind.CoalesceExpression);
}
[Fact]
public void DotToArrow()
{
MakeMemberAccessChange(SyntaxKind.SimpleMemberAccessExpression, SyntaxKind.PointerMemberAccessExpression);
}
[Fact]
public void ArrowToDot()
{
MakeMemberAccessChange(SyntaxKind.PointerMemberAccessExpression, SyntaxKind.SimpleMemberAccessExpression);
}
#region Helpers
private static void MakeMemberAccessChange(SyntaxKind oldStyle, SyntaxKind newStyle)
{
MakeChange(oldStyle, newStyle);
MakeChange(oldStyle, newStyle, options: TestOptions.Script);
MakeChange(oldStyle, newStyle, topLevel: true, options: TestOptions.Script);
}
private static void MakeBinOpChange(SyntaxKind oldStyle, SyntaxKind newStyle)
{
MakeChange(oldStyle, newStyle);
MakeChange(oldStyle, newStyle, options: TestOptions.Script);
MakeChange(oldStyle, newStyle, topLevel: true, options: TestOptions.Script);
}
private static void MakeChange(SyntaxKind oldSyntaxKind, SyntaxKind newSyntaxKind, bool topLevel = false, CSharpParseOptions options = null)
{
string oldName = GetExpressionString(oldSyntaxKind);
string newName = GetExpressionString(newSyntaxKind);
string topLevelStatement = "x " + oldName + " y";
// Be warned when changing the fields here
var code = @"class C { void m() {
" + topLevelStatement + @";
}}";
var oldTree = SyntaxFactory.ParseSyntaxTree(topLevel ? topLevelStatement : code, options: options);
// Make the change to the node
var newTree = oldTree.WithReplaceFirst(oldName, newName);
var treeNode = topLevel ? GetGlobalExpressionNode(newTree) : GetExpressionNode(newTree);
Assert.Equal(treeNode.Kind(), newSyntaxKind);
}
private static ExpressionSyntax GetExpressionNode(SyntaxTree newTree)
{
TypeDeclarationSyntax classType = newTree.GetCompilationUnitRoot().Members[0] as TypeDeclarationSyntax;
MethodDeclarationSyntax method = classType.Members[0] as MethodDeclarationSyntax;
var block = method.Body;
var statement = block.Statements[0] as ExpressionStatementSyntax;
return statement.Expression;
}
private static ExpressionSyntax GetGlobalExpressionNode(SyntaxTree newTree)
{
var statementType = newTree.GetCompilationUnitRoot().Members[0] as GlobalStatementSyntax;
Assert.True(statementType.AttributeLists.Count == 0);
Assert.True(statementType.Modifiers.Count == 0);
var statement = statementType.Statement as ExpressionStatementSyntax;
return statement.Expression;
}
private static string GetExpressionString(SyntaxKind oldStyle)
{
switch (oldStyle)
{
case SyntaxKind.AddExpression:
return "+";
case SyntaxKind.SubtractExpression:
return "-";
case SyntaxKind.MultiplyExpression:
return " * ";
case SyntaxKind.DivideExpression:
return "/";
case SyntaxKind.ModuloExpression:
return "%";
case SyntaxKind.LeftShiftExpression:
return "<<";
case SyntaxKind.RightShiftExpression:
return ">>";
case SyntaxKind.LogicalOrExpression:
return "||";
case SyntaxKind.LogicalAndExpression:
return "&&";
case SyntaxKind.BitwiseOrExpression:
return "|";
case SyntaxKind.BitwiseAndExpression:
return "&";
case SyntaxKind.ExclusiveOrExpression:
return "^";
case SyntaxKind.EqualsExpression:
return "==";
case SyntaxKind.NotEqualsExpression:
return "!=";
case SyntaxKind.LessThanExpression:
return "<";
case SyntaxKind.LessThanOrEqualExpression:
return "<=";
case SyntaxKind.GreaterThanExpression:
return ">";
case SyntaxKind.GreaterThanOrEqualExpression:
return ">=";
case SyntaxKind.AsExpression:
return " as ";
case SyntaxKind.IsExpression:
return " is ";
case SyntaxKind.CoalesceExpression:
return "??";
case SyntaxKind.SimpleMemberAccessExpression:
return ".";
case SyntaxKind.PointerMemberAccessExpression:
return "->";
default:
throw new Exception("unexpected Type given");
}
}
#endregion
}
}
| 36.162963 | 161 | 0.590844 | [
"Apache-2.0"
] | 20chan/roslyn | src/Compilers/CSharp/Test/Syntax/IncrementalParsing/BinaryExpression.cs | 9,766 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.