hexsha
stringlengths
40
40
size
int64
30
1.05M
ext
stringclasses
24 values
lang
stringclasses
5 values
max_stars_repo_path
stringlengths
4
355
max_stars_repo_name
stringlengths
5
110
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
sequence
max_stars_count
float64
1
208k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
355
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
sequence
max_issues_count
float64
1
77k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
355
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
sequence
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
30
1.05M
avg_line_length
float64
2.67
1.04M
max_line_length
int64
9
1.04M
alphanum_fraction
float64
0.01
1
1e043b2f10cc664834fe820a974eb1711b7d3b14
8,259
cs
C#
src/contrib/Analyzers/AR/ArabicAnalyzer.cs
danipen/lucene.net
205912d9a763df16f503279eb36a453f7c884dc2
[ "Apache-2.0" ]
2
2017-02-23T15:16:08.000Z
2021-11-24T13:44:52.000Z
src/contrib/Analyzers/AR/ArabicAnalyzer.cs
danipen/lucene.net
205912d9a763df16f503279eb36a453f7c884dc2
[ "Apache-2.0" ]
5
2019-08-07T09:05:30.000Z
2021-04-13T07:38:20.000Z
src/contrib/Analyzers/AR/ArabicAnalyzer.cs
danipen/lucene.net
205912d9a763df16f503279eb36a453f7c884dc2
[ "Apache-2.0" ]
9
2017-04-12T19:01:40.000Z
2021-02-18T16:35:13.000Z
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.IO; using System.Collections; using System.Linq; using Lucene.Net.Analysis; using Version = Lucene.Net.Util.Version; using Lucene.Net.Support.Compatibility; namespace Lucene.Net.Analysis.AR { /* * <see cref="Analyzer"/> for Arabic. * <p/> * This analyzer implements light-stemming as specified by: * <i> * Light Stemming for Arabic Information Retrieval * </i> * http://www.mtholyoke.edu/~lballest/Pubs/arab_stem05.pdf * <p/> * The analysis package contains three primary components: * <ul> * <li><see cref="ArabicNormalizationFilter"/>: Arabic orthographic normalization.</li> * <li><see cref="ArabicStemFilter"/>: Arabic light stemming</li> * <li>Arabic stop words file: a set of default Arabic stop words.</li> * </ul> * */ public class ArabicAnalyzer : Analyzer { /* * File containing default Arabic stopwords. * * Default stopword list is from http://members.unine.ch/jacques.savoy/clef/index.html * The stopword list is BSD-Licensed. */ public static string DEFAULT_STOPWORD_FILE = "ArabicStopWords.txt"; /* * Contains the stopwords used with the StopFilter. */ private readonly ISet<string> stoptable; /*<summary> * The comment character in the stopwords file. All lines prefixed with this will be ignored * </summary> */ [Obsolete("Use WordListLoader.GetWordSet(FileInfo, string) directly")] public static string STOPWORDS_COMMENT = "#"; /// <summary> /// Returns an unmodifiable instance of the default stop-words set /// </summary> /// <returns>Returns an unmodifiable instance of the default stop-words set</returns> public static ISet<string> GetDefaultStopSet() { return DefaultSetHolder.DEFAULT_STOP_SET; } private static class DefaultSetHolder { internal static ISet<string> DEFAULT_STOP_SET; static DefaultSetHolder() { try { DEFAULT_STOP_SET = LoadDefaultStopWordSet(); } catch (System.IO.IOException) { // default set should always be present as it is part of the // distribution (JAR) throw new Exception("Unable to load default stopword set"); } } internal static ISet<string> LoadDefaultStopWordSet() { using (StreamReader reader = new StreamReader(System.Reflection.Assembly.GetAssembly(typeof(ArabicAnalyzer)).GetManifestResourceStream("Lucene.Net.Analysis.AR." + DEFAULT_STOPWORD_FILE))) { return CharArraySet.UnmodifiableSet(CharArraySet.Copy(WordlistLoader.GetWordSet(reader, STOPWORDS_COMMENT))); } } } private Version matchVersion; /* * Builds an analyzer with the default stop words: <see cref="DEFAULT_STOPWORD_FILE"/>. */ public ArabicAnalyzer(Version matchVersion) : this(matchVersion, DefaultSetHolder.DEFAULT_STOP_SET) { } /// <summary> /// Builds an analyzer with the given stop words. /// </summary> /// <param name="matchVersion">Lucene compatibility version</param> /// <param name="stopwords">a stopword set</param> public ArabicAnalyzer(Version matchVersion, ISet<string> stopwords) { stoptable = CharArraySet.UnmodifiableSet(CharArraySet.Copy(stopwords)); this.matchVersion = matchVersion; } /* * Builds an analyzer with the given stop words. */ [Obsolete("Use ArabicAnalyzer(Version, Set) instead")] public ArabicAnalyzer(Version matchVersion, params string[] stopwords) : this(matchVersion, StopFilter.MakeStopSet(stopwords)) { } /* * Builds an analyzer with the given stop words. */ [Obsolete("Use ArabicAnalyzer(Version, Set) instead")] public ArabicAnalyzer(Version matchVersion, IDictionary<string, string> stopwords) : this(matchVersion, stopwords.Keys.ToArray()) { } /* * Builds an analyzer with the given stop words. Lines can be commented out using <see cref="STOPWORDS_COMMENT"/> */ public ArabicAnalyzer(Version matchVersion, FileInfo stopwords) : this(matchVersion, WordlistLoader.GetWordSet(stopwords, STOPWORDS_COMMENT)) { } /* * Creates a <see cref="TokenStream"/> which tokenizes all the text in the provided <see cref="TextReader"/>. * * <returns>A <see cref="TokenStream"/> built from an <see cref="ArabicLetterTokenizer"/> filtered with * <see cref="LowerCaseFilter"/>, <see cref="StopFilter"/>, <see cref="ArabicNormalizationFilter"/> * and <see cref="ArabicStemFilter"/>.</returns> */ public override TokenStream TokenStream(string fieldName, TextReader reader) { TokenStream result = new ArabicLetterTokenizer(reader); result = new LowerCaseFilter(result); // the order here is important: the stopword list is not normalized! result = new StopFilter(StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion), result, stoptable); result = new ArabicNormalizationFilter(result); result = new ArabicStemFilter(result); return result; } private class SavedStreams { internal Tokenizer Source; internal TokenStream Result; }; /* * Returns a (possibly reused) <see cref="TokenStream"/> which tokenizes all the text * in the provided <see cref="TextReader"/>. * * <returns>A <see cref="TokenStream"/> built from an <see cref="ArabicLetterTokenizer"/> filtered with * <see cref="LowerCaseFilter"/>, <see cref="StopFilter"/>, <see cref="ArabicNormalizationFilter"/> * and <see cref="ArabicStemFilter"/>.</returns> */ public override TokenStream ReusableTokenStream(string fieldName, TextReader reader) { SavedStreams streams = (SavedStreams)PreviousTokenStream; if (streams == null) { streams = new SavedStreams(); streams.Source = new ArabicLetterTokenizer(reader); streams.Result = new LowerCaseFilter(streams.Source); // the order here is important: the stopword list is not normalized! streams.Result = new StopFilter(StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion), streams.Result, stoptable); streams.Result = new ArabicNormalizationFilter(streams.Result); streams.Result = new ArabicStemFilter(streams.Result); PreviousTokenStream = streams; } else { streams.Source.Reset(reader); } return streams.Result; } } }
39.898551
203
0.613028
1e05f0ee49dca31ccf81a088b02e7bed57088da7
2,309
cshtml
C#
WebUI/Views/Variables/Add.cshtml
adoconnection/AspNetDeploy
310ce15d31f002bf855805dd2a46f5e6c5c56738
[ "Apache-2.0" ]
11
2015-06-05T09:41:22.000Z
2019-09-04T07:04:34.000Z
WebUI/Views/Variables/Add.cshtml
adoconnection/AspNetDeploy
310ce15d31f002bf855805dd2a46f5e6c5c56738
[ "Apache-2.0" ]
null
null
null
WebUI/Views/Variables/Add.cshtml
adoconnection/AspNetDeploy
310ce15d31f002bf855805dd2a46f5e6c5c56738
[ "Apache-2.0" ]
1
2016-09-28T12:20:10.000Z
2016-09-28T12:20:10.000Z
@using Environment = AspNetDeploy.Model.Environment @model AspNetDeploy.WebUI.Models.VariableEditModel @{ ViewBag.Title = "Index"; ViewBag.PageClass = "variablesPage"; Layout = "~/Views/Shared/_Layout.cshtml"; Environment environment = this.ViewBag.Environment; } <div class="container"> <div>@Html.ActionLink("Назад", "Details", "Environments", new { id = environment.Id }, new {})</div> <h1>Add variable on @environment.Name</h1> <hr /> @using (Html.BeginForm("Save", "Variables", new { }, FormMethod.Post, new { Class = "form-horizontal" })) { @Html.AntiForgeryToken() @Html.HiddenFor( m => m.EnvironmentId) @Html.HiddenFor(m => m.MachineId) <div class="row"> <div class="col-md-12 "> <div class="form-group"> <label class="col-sm-2 control-label">Name</label> <div class="col-sm-10"> @Html.TextBoxFor(m => m.Name, new { Class = "form-control", placeholder = "Name" }) @Html.ValidationMessageFor(m => m.Name) </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">Value</label> <div class="col-sm-10"> @Html.TextAreaFor(m => m.Value, new { Class = "form-control", placeholder = "", style="height:400px" }) @Html.ValidationMessageFor(m => m.Value) </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-2"> <div class="checkbox"> <label> @Html.CheckBoxFor(m => m.IsSensitive, new { }) Is sensitive @Html.ValidationMessageFor(m => m.IsSensitive) </label> </div> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-8"> <button type="submit" class="btn btn-default">Save</button> </div> </div> </div> </div> } </div>
37.241935
127
0.470333
1e06a5f9ed8203d3315d63a8d4e52d145d03406e
1,965
cs
C#
Workday.RevenueManagement/Salary_Over_The_Cap_Type_DataType.cs
matteofabbri/Workday.WebServices
a7fbcd3f484e6887dbf578b0e54f86bb70c5feb0
[ "MIT" ]
18
2018-11-08T21:28:42.000Z
2022-02-24T21:48:23.000Z
Workday.RevenueManagement/Salary_Over_The_Cap_Type_DataType.cs
matteofabbri/Workday.WebServices
a7fbcd3f484e6887dbf578b0e54f86bb70c5feb0
[ "MIT" ]
3
2019-08-15T13:19:02.000Z
2022-02-16T08:48:10.000Z
Workday.RevenueManagement/Salary_Over_The_Cap_Type_DataType.cs
matteofabbri/Workday.WebServices
a7fbcd3f484e6887dbf578b0e54f86bb70c5feb0
[ "MIT" ]
5
2019-08-22T15:21:59.000Z
2022-02-14T19:05:48.000Z
using System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Xml.Serialization; namespace Workday.RevenueManagement { [GeneratedCode("System.Xml", "4.6.1590.0"), DesignerCategory("code"), DebuggerStepThrough, XmlType(Namespace = "urn:com.workday/bsvc")] [Serializable] public class Salary_Over_The_Cap_Type_DataType : INotifyPropertyChanged { private string salary_Over_The_Cap_Type_IDField; private string salary_Over_The_Cap_Type_NameField; private bool inactiveField; private bool inactiveFieldSpecified; [method: CompilerGenerated] [CompilerGenerated] public event PropertyChangedEventHandler PropertyChanged; [XmlElement(Order = 0)] public string Salary_Over_The_Cap_Type_ID { get { return this.salary_Over_The_Cap_Type_IDField; } set { this.salary_Over_The_Cap_Type_IDField = value; this.RaisePropertyChanged("Salary_Over_The_Cap_Type_ID"); } } [XmlElement(Order = 1)] public string Salary_Over_The_Cap_Type_Name { get { return this.salary_Over_The_Cap_Type_NameField; } set { this.salary_Over_The_Cap_Type_NameField = value; this.RaisePropertyChanged("Salary_Over_The_Cap_Type_Name"); } } [XmlElement(Order = 2)] public bool Inactive { get { return this.inactiveField; } set { this.inactiveField = value; this.RaisePropertyChanged("Inactive"); } } [XmlIgnore] public bool InactiveSpecified { get { return this.inactiveFieldSpecified; } set { this.inactiveFieldSpecified = value; this.RaisePropertyChanged("InactiveSpecified"); } } protected void RaisePropertyChanged(string propertyName) { PropertyChangedEventHandler propertyChanged = this.PropertyChanged; if (propertyChanged != null) { propertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } }
21.358696
136
0.738422
1e071b177915dca8191a2c024570d39ab1fd1f95
3,870
cs
C#
src/Nest/Cluster/ClusterReroute/Commands/AllocateClusterRerouteCommandBase.cs
jslicer/elasticsearch-net
8948a9e2a9e87843f9f91c42e2806fd1d3f2a818
[ "Apache-2.0" ]
null
null
null
src/Nest/Cluster/ClusterReroute/Commands/AllocateClusterRerouteCommandBase.cs
jslicer/elasticsearch-net
8948a9e2a9e87843f9f91c42e2806fd1d3f2a818
[ "Apache-2.0" ]
null
null
null
src/Nest/Cluster/ClusterReroute/Commands/AllocateClusterRerouteCommandBase.cs
jslicer/elasticsearch-net
8948a9e2a9e87843f9f91c42e2806fd1d3f2a818
[ "Apache-2.0" ]
null
null
null
using Newtonsoft.Json; namespace Nest { public interface IAllocateClusterRerouteCommand : IClusterRerouteCommand { [JsonProperty("index")] IndexName Index { get; set; } [JsonProperty("shard")] int Shard { get; set; } [JsonProperty("node")] string Node { get; set; } } public interface IAllocateReplicaClusterRerouteCommand : IAllocateClusterRerouteCommand { } public interface IAllocateEmptyPrimaryRerouteCommand : IAllocateClusterRerouteCommand { [JsonProperty("accept_data_loss")] bool AcceptDataLoss { get; set; } } public interface IAllocateStalePrimaryRerouteCommand : IAllocateClusterRerouteCommand { [JsonProperty("accept_data_loss")] bool AcceptDataLoss { get; set; } } public abstract class AllocateClusterRerouteCommandBase : IAllocateClusterRerouteCommand { public abstract string Name { get; } public IndexName Index { get; set; } public int Shard { get; set; } public string Node { get; set; } } public class AllocateReplicaClusterRerouteCommand : AllocateClusterRerouteCommandBase, IAllocateReplicaClusterRerouteCommand { public override string Name => "allocate_replica"; } public class AllocateEmptyPrimaryRerouteCommand : AllocateClusterRerouteCommandBase, IAllocateEmptyPrimaryRerouteCommand { public override string Name => "allocate_empty_primary"; public bool AcceptDataLoss { get; set; } } public class AllocateStalePrimaryRerouteCommand : AllocateClusterRerouteCommandBase, IAllocateStalePrimaryRerouteCommand { public override string Name => "allocate_stale_primary"; public bool AcceptDataLoss { get; set; } } public abstract class AllocateClusterRerouteCommandDescriptorBase<TDescriptor, TInterface> : DescriptorBase<TDescriptor, TInterface>, IAllocateClusterRerouteCommand where TDescriptor : AllocateClusterRerouteCommandDescriptorBase<TDescriptor, TInterface>, TInterface, IAllocateClusterRerouteCommand where TInterface : class, IAllocateClusterRerouteCommand { string IClusterRerouteCommand.Name => Name; public abstract string Name { get; } IndexName IAllocateClusterRerouteCommand.Index { get; set; } int IAllocateClusterRerouteCommand.Shard { get; set; } string IAllocateClusterRerouteCommand.Node { get; set; } public TDescriptor Index(IndexName index) => Assign(a => a.Index = index); public TDescriptor Index<T>() where T : class => Assign(a => a.Index = typeof(T)); public TDescriptor Shard(int shard) => Assign(a => a.Shard = shard); public TDescriptor Node(string node) => Assign(a => a.Node = node); } public class AllocateReplicaClusterRerouteCommandDescriptor : AllocateClusterRerouteCommandDescriptorBase<AllocateReplicaClusterRerouteCommandDescriptor, IAllocateReplicaClusterRerouteCommand>, IAllocateReplicaClusterRerouteCommand { public override string Name => "allocate_replica"; } public class AllocateEmptyPrimaryRerouteCommandDescriptor : AllocateClusterRerouteCommandDescriptorBase<AllocateEmptyPrimaryRerouteCommandDescriptor, IAllocateEmptyPrimaryRerouteCommand>, IAllocateEmptyPrimaryRerouteCommand { public override string Name => "allocate_empty_primary"; bool IAllocateEmptyPrimaryRerouteCommand.AcceptDataLoss { get; set; } public AllocateEmptyPrimaryRerouteCommandDescriptor AcceptDataLoss(bool acceptDataLoss) => Assign(a => a.AcceptDataLoss = acceptDataLoss); } public class AllocateStalePrimaryRerouteCommandDescriptor : AllocateClusterRerouteCommandDescriptorBase<AllocateStalePrimaryRerouteCommandDescriptor, IAllocateStalePrimaryRerouteCommand>, IAllocateStalePrimaryRerouteCommand { public override string Name => "allocate_stale_primary"; bool IAllocateStalePrimaryRerouteCommand.AcceptDataLoss { get; set; } public AllocateStalePrimaryRerouteCommandDescriptor AcceptDataLoss(bool acceptDataLoss) => Assign(a => a.AcceptDataLoss = acceptDataLoss); } }
34.247788
173
0.803876
1e09e84fa9624736ef43510275064c6f048660cf
1,535
cs
C#
sdk/dotnet/WafV2/Inputs/WebAclRuleStatementNotStatementStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementTextTransformationArgs.cs
alexbowers/pulumi-aws
7dbdb03b1e4f7c0d51d5b5d17233ff4465c3eff5
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/dotnet/WafV2/Inputs/WebAclRuleStatementNotStatementStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementTextTransformationArgs.cs
alexbowers/pulumi-aws
7dbdb03b1e4f7c0d51d5b5d17233ff4465c3eff5
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/dotnet/WafV2/Inputs/WebAclRuleStatementNotStatementStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementTextTransformationArgs.cs
alexbowers/pulumi-aws
7dbdb03b1e4f7c0d51d5b5d17233ff4465c3eff5
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.Aws.WafV2.Inputs { public sealed class WebAclRuleStatementNotStatementStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementTextTransformationArgs : Pulumi.ResourceArgs { /// <summary> /// The relative processing order for multiple transformations that are defined for a rule statement. AWS WAF processes all transformations, from lowest priority to highest, before inspecting the transformed content. /// </summary> [Input("priority", required: true)] public Input<int> Priority { get; set; } = null!; /// <summary> /// The transformation to apply, you can specify the following types: `NONE`, `COMPRESS_WHITE_SPACE`, `HTML_ENTITY_DECODE`, `LOWERCASE`, `CMD_LINE`, `URL_DECODE`. See the [documentation](https://docs.aws.amazon.com/waf/latest/APIReference/API_TextTransformation.html) for more details. /// </summary> [Input("type", required: true)] public Input<string> Type { get; set; } = null!; public WebAclRuleStatementNotStatementStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementTextTransformationArgs() { } } }
47.96875
293
0.730945
1e0b185327f483bbf1ffe4e6215acf36684e509f
3,815
cs
C#
src/IdHelper/IdWorker/IdWorker.cs
JTOne123/IdHelper
e06a956c5d696af32a4bdff7ad66a2a392d6b4a0
[ "Apache-2.0" ]
85
2019-09-11T14:46:48.000Z
2022-01-22T07:40:32.000Z
src/IdHelper/IdWorker/IdWorker.cs
JTOne123/IdHelper
e06a956c5d696af32a4bdff7ad66a2a392d6b4a0
[ "Apache-2.0" ]
1
2019-10-09T14:19:16.000Z
2019-10-10T01:12:07.000Z
src/IdHelper/IdWorker/IdWorker.cs
JTOne123/IdHelper
e06a956c5d696af32a4bdff7ad66a2a392d6b4a0
[ "Apache-2.0" ]
28
2019-09-12T02:11:36.000Z
2022-01-22T07:40:39.000Z
using System; namespace Coldairarrow.Util { /// <summary> /// https://github.com/ccollie/snowflake-net /// </summary> internal class IdWorker { public const long Twepoch = 1288834974657L; const int WorkerIdBits = 10; const int DatacenterIdBits = 0; const int SequenceBits = 12; const long MaxWorkerId = -1L ^ (-1L << WorkerIdBits); const long MaxDatacenterId = -1L ^ (-1L << DatacenterIdBits); private const int WorkerIdShift = SequenceBits; private const int DatacenterIdShift = SequenceBits + WorkerIdBits; public const int TimestampLeftShift = SequenceBits + WorkerIdBits + DatacenterIdBits; private const long SequenceMask = -1L ^ (-1L << SequenceBits); private long _sequence = 0L; private long _lastTimestamp = -1L; public IdWorker(long workerId, long sequence = 0L) { WorkerId = workerId; DatacenterId = 0; _sequence = sequence; // sanity check for workerId if (workerId > MaxWorkerId || workerId < 0) { throw new ArgumentException(String.Format("worker Id can't be greater than {0} or less than 0", MaxWorkerId)); } //if (datacenterId > MaxDatacenterId || datacenterId < 0) //{ // throw new ArgumentException(String.Format("datacenter Id can't be greater than {0} or less than 0", MaxDatacenterId)); //} //log.info( // String.Format("worker starting. timestamp left shift {0}, datacenter id bits {1}, worker id bits {2}, sequence bits {3}, workerid {4}", // TimestampLeftShift, DatacenterIdBits, WorkerIdBits, SequenceBits, workerId) // ); } public long WorkerId { get; protected set; } public long DatacenterId { get; protected set; } public long Sequence { get { return _sequence; } internal set { _sequence = value; } } // def get_timestamp() = System.currentTimeMillis readonly object _lock = new Object(); public virtual long NextId() { lock (_lock) { var timestamp = TimeGen(); if (timestamp < _lastTimestamp) { //exceptionCounter.incr(1); //log.Error("clock is moving backwards. Rejecting requests until %d.", _lastTimestamp); throw new InvalidSystemClock(String.Format( "Clock moved backwards. Refusing to generate id for {0} milliseconds", _lastTimestamp - timestamp)); } if (_lastTimestamp == timestamp) { _sequence = (_sequence + 1) & SequenceMask; if (_sequence == 0) { timestamp = TilNextMillis(_lastTimestamp); } } else { _sequence = 0; } _lastTimestamp = timestamp; var id = ((timestamp - Twepoch) << TimestampLeftShift) | (DatacenterId << DatacenterIdShift) | (WorkerId << WorkerIdShift) | _sequence; return id; } } protected virtual long TilNextMillis(long lastTimestamp) { var timestamp = TimeGen(); while (timestamp <= lastTimestamp) { timestamp = TimeGen(); } return timestamp; } protected virtual long TimeGen() { return System.CurrentTimeMillis(); } } }
33.464912
153
0.520577
1e0c1efb465759c999362380a37cd7d5c06813ad
6,534
cs
C#
IL2CXX.Tests/MarshalTests.cs
shin1m/IL2CXX
b69d39a18756d10eaca96913e263a58e75bf2d3f
[ "Unlicense", "MIT" ]
4
2021-03-11T22:13:36.000Z
2022-02-10T05:34:28.000Z
IL2CXX.Tests/MarshalTests.cs
shin1m/IL2CXX
b69d39a18756d10eaca96913e263a58e75bf2d3f
[ "Unlicense", "MIT" ]
null
null
null
IL2CXX.Tests/MarshalTests.cs
shin1m/IL2CXX
b69d39a18756d10eaca96913e263a58e75bf2d3f
[ "Unlicense", "MIT" ]
null
null
null
using System; using System.Numerics; using System.Runtime.InteropServices; using NUnit.Framework; namespace IL2CXX.Tests { [Parallelizable] class MarshalTests { struct Point { public int X; public int Y; } static int SizeOfType() { var n = Marshal.SizeOf<Point>(); Console.WriteLine($"{n}"); return n == 8 ? 0 : 1; } static int SizeOfInstance() { var n = Marshal.SizeOf(new Point { X = 0, Y = 1 }); Console.WriteLine($"{n}"); return n == 8 ? 0 : 1; } [StructLayout(LayoutKind.Sequential, Pack = 4)] struct Name { public string First; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] public string Last; } static int SizeOfByValTStr() { var n = Marshal.SizeOf<Name>(); Console.WriteLine($"{n}"); return n == Marshal.SizeOf<IntPtr>() + 4 ? 0 : 1; } static int StructureToPtr() { var p = Marshal.AllocHGlobal(Marshal.SizeOf<Name>()); try { Marshal.StructureToPtr(new Name { First = "abcdefgh", Last = "ABCDEFGH" }, p, false); var name = Marshal.PtrToStructure<Name>(p); return name.First == "abcdefgh" && name.Last == "ABC" ? 0 : 1; } finally { Marshal.DestroyStructure<Name>(p); Marshal.FreeHGlobal(p); } } [StructLayout(LayoutKind.Explicit)] struct Union { [FieldOffset(4)] public int X; [FieldOffset(4)] public int Y; } static int Explicit() { var x = new Union { X = 1 }; x.Y = 2; return x.X == 2 ? 0 : 1; } [StructLayout(LayoutKind.Explicit)] struct UnionWithReference { [FieldOffset(8)] public string X; [FieldOffset(8)] public string Y; } static int ExplicitWithReference() { var x = new UnionWithReference { X = "foo" }; x.Y = "bar"; return x.X == "bar" ? 0 : 1; } [StructLayout(LayoutKind.Explicit)] struct Child { [FieldOffset(0)] public Vector3 Min; [FieldOffset(12)] public int Index; [FieldOffset(16)] public Vector3 Max; [FieldOffset(28)] public int Count; } [StructLayout(LayoutKind.Explicit)] struct Node { [FieldOffset(0)] public Child A; [FieldOffset(32)] public Child B; } static int ExplicitComposite() { var x = new Node { B = { Count = 1 } }; var y = x; return x.B.Count == 1 ? 0 : 1; } static void Foo(IntPtr x, IntPtr y) { } static int GetFunctionPointerForDelegate() => Marshal.GetFunctionPointerForDelegate((Action<IntPtr, IntPtr>)Foo) == IntPtr.Zero ? 1 : 0; delegate IntPtr BarDelegate(IntPtr x, ref IntPtr y); static IntPtr Bar(IntPtr x, ref IntPtr y) => new IntPtr((int)x + (int)y); static int GetDelegateForFunctionPointer() { var p = Marshal.GetFunctionPointerForDelegate((BarDelegate)Bar); var d = Marshal.GetDelegateForFunctionPointer<BarDelegate>(p); var y = new IntPtr(2); if (d(new IntPtr(1), ref y) != new IntPtr(3)) return 1; return p == Marshal.GetFunctionPointerForDelegate(d) ? 0 : 1; } struct utsname { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string sysname; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string nodename; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string release; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string version; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string machine; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string extra; } [DllImport("libc")] static extern void uname(out utsname name); static int Parameter() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return 0; uname(out var name); Console.WriteLine($"sysname: {name.sysname}"); Console.WriteLine($"nodename: {name.nodename}"); Console.WriteLine($"release: {name.release}"); Console.WriteLine($"version: {name.version}"); Console.WriteLine($"machine: {name.machine}"); return 0; } static int Run(string[] arguments) => arguments[1] switch { nameof(SizeOfType) => SizeOfType(), nameof(SizeOfInstance) => SizeOfInstance(), nameof(SizeOfByValTStr) => SizeOfByValTStr(), nameof(StructureToPtr) => StructureToPtr(), nameof(Explicit) => Explicit(), nameof(ExplicitWithReference) => ExplicitWithReference(), nameof(ExplicitComposite) => ExplicitComposite(), nameof(GetFunctionPointerForDelegate) => GetFunctionPointerForDelegate(), nameof(GetDelegateForFunctionPointer) => GetDelegateForFunctionPointer(), nameof(Parameter) => Parameter(), _ => -1 }; string build; [OneTimeSetUp] public void OneTimeSetUp() => build = Utilities.Build(Run); [Test] public void Test( [Values( nameof(SizeOfType), nameof(SizeOfInstance), nameof(SizeOfByValTStr), nameof(StructureToPtr), nameof(Explicit), nameof(ExplicitWithReference), nameof(ExplicitComposite), nameof(GetFunctionPointerForDelegate), nameof(GetDelegateForFunctionPointer), nameof(Parameter) )] string name, [Values] bool cooperative ) => Utilities.Run(build, cooperative, name); } }
32.834171
102
0.514539
1e0c7bda1abad5b59959d73c78f7e852ac798b6d
19,826
cs
C#
BTDB/EventStoreLayer/DictionaryTypeDescriptor.cs
klesta490/BTDB
bcb09cd3a8928dc72470531350c6e48ee4170e47
[ "MIT" ]
null
null
null
BTDB/EventStoreLayer/DictionaryTypeDescriptor.cs
klesta490/BTDB
bcb09cd3a8928dc72470531350c6e48ee4170e47
[ "MIT" ]
null
null
null
BTDB/EventStoreLayer/DictionaryTypeDescriptor.cs
klesta490/BTDB
bcb09cd3a8928dc72470531350c6e48ee4170e47
[ "MIT" ]
null
null
null
using BTDB.FieldHandler; using BTDB.IL; using BTDB.ODBLayer; using BTDB.StreamLayer; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; namespace BTDB.EventStoreLayer; class DictionaryTypeDescriptor : ITypeDescriptor, IPersistTypeDescriptor { readonly ITypeDescriptorCallbacks _typeSerializers; Type? _type; Type? _keyType; Type? _valueType; ITypeDescriptor? _keyDescriptor; ITypeDescriptor? _valueDescriptor; string? _name; readonly ITypeConvertorGenerator _convertorGenerator; public DictionaryTypeDescriptor(ITypeDescriptorCallbacks typeSerializers, Type type) { _convertorGenerator = typeSerializers.ConvertorGenerator; _typeSerializers = typeSerializers; _type = type; var genericArguments = type.GetGenericArguments(); _keyType = genericArguments[0]; _valueType = genericArguments[1]; } public DictionaryTypeDescriptor(ITypeDescriptorCallbacks typeSerializers, ref SpanReader reader, DescriptorReader nestedDescriptorReader) : this(typeSerializers, nestedDescriptorReader(ref reader), nestedDescriptorReader(ref reader)) { } DictionaryTypeDescriptor(ITypeDescriptorCallbacks typeSerializers, ITypeDescriptor keyDesc, ITypeDescriptor valueDesc) { _convertorGenerator = typeSerializers.ConvertorGenerator; _typeSerializers = typeSerializers; InitFromKeyValueDescriptors(keyDesc, valueDesc); } void InitFromKeyValueDescriptors(ITypeDescriptor keyDescriptor, ITypeDescriptor valueDescriptor) { if (_keyDescriptor == keyDescriptor && _valueDescriptor == valueDescriptor && _name != null) return; _keyDescriptor = keyDescriptor; _valueDescriptor = valueDescriptor; if ((_keyDescriptor.Name?.Length ?? 0) == 0 || (_valueDescriptor.Name?.Length ?? 0) == 0) return; Sealed = _keyDescriptor.Sealed && _valueDescriptor.Sealed; Name = $"Dictionary<{_keyDescriptor.Name}, {_valueDescriptor.Name}>"; } public bool Equals(ITypeDescriptor other) { return Equals(other, new HashSet<ITypeDescriptor>(ReferenceEqualityComparer<ITypeDescriptor>.Instance)); } public string Name { get { if (_name == null) InitFromKeyValueDescriptors(_keyDescriptor!, _valueDescriptor!); return _name!; } private set => _name = value; } public bool FinishBuildFromType(ITypeDescriptorFactory factory) { var keyDescriptor = factory.Create(_keyType!); if (keyDescriptor == null) return false; var valueDescriptor = factory.Create(_valueType!); if (valueDescriptor == null) return false; InitFromKeyValueDescriptors(keyDescriptor, valueDescriptor); return true; } public void BuildHumanReadableFullName(StringBuilder text, HashSet<ITypeDescriptor> stack, uint indent) { text.Append("Dictionary<"); _keyDescriptor!.BuildHumanReadableFullName(text, stack, indent); text.Append(", "); _valueDescriptor!.BuildHumanReadableFullName(text, stack, indent); text.Append(">"); } public bool Equals(ITypeDescriptor other, HashSet<ITypeDescriptor> stack) { var o = other as DictionaryTypeDescriptor; if (o == null) return false; return _keyDescriptor!.Equals(o._keyDescriptor!, stack) && _valueDescriptor!.Equals(o._valueDescriptor!, stack); } public Type GetPreferredType() { if (_type == null) { _keyType = _typeSerializers.LoadAsType(_keyDescriptor!); _valueType = _typeSerializers.LoadAsType(_valueDescriptor!); _type = typeof(IDictionary<,>).MakeGenericType(_keyType, _valueType); } return _type; } static Type GetInterface(Type type) => type.GetInterface("IOrderedDictionary`2") ?? type.GetInterface("IDictionary`2") ?? type; public Type GetPreferredType(Type targetType) { if (_type == targetType) return _type; var targetIDictionary = GetInterface(targetType); var targetTypeArguments = targetIDictionary.GetGenericArguments(); var keyType = _typeSerializers.LoadAsType(_keyDescriptor!, targetTypeArguments[0]); var valueType = _typeSerializers.LoadAsType(_valueDescriptor!, targetTypeArguments[1]); return targetType.GetGenericTypeDefinition().MakeGenericType(keyType, valueType); } public bool AnyOpNeedsCtx() { return !_keyDescriptor!.StoredInline || !_valueDescriptor!.StoredInline || _keyDescriptor.AnyOpNeedsCtx() || _valueDescriptor.AnyOpNeedsCtx(); } public void GenerateLoad(IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx, Action<IILGen> pushDescriptor, Type targetType) { if (targetType == typeof(object)) targetType = GetPreferredType(); var localCount = ilGenerator.DeclareLocal(typeof(int)); var targetIDictionary = GetInterface(targetType); var targetTypeArguments = targetIDictionary.GetGenericArguments(); var keyType = _typeSerializers.LoadAsType(_keyDescriptor!, targetTypeArguments[0]); var valueType = _typeSerializers.LoadAsType(_valueDescriptor!, targetTypeArguments[1]); var dictionaryTypeGenericDefinition = targetType.InheritsOrImplements(typeof(IOrderedDictionary<,>)) ? typeof(OrderedDictionaryWithDescriptor<,>) : typeof(DictionaryWithDescriptor<,>); var dictionaryType = dictionaryTypeGenericDefinition.MakeGenericType(keyType, valueType); if (!targetType.IsAssignableFrom(dictionaryType)) throw new InvalidOperationException(); var localDict = ilGenerator.DeclareLocal(dictionaryType); var loadFinished = ilGenerator.DefineLabel(); var next = ilGenerator.DefineLabel(); ilGenerator .Ldnull() .Stloc(localDict) .Do(pushReader) .Call(typeof(SpanReader).GetMethod(nameof(SpanReader.ReadVUInt32))!) .ConvI4() .Dup() .LdcI4(1) .Sub() .Stloc(localCount) .Brfalse(loadFinished) .Ldloc(localCount) .Do(pushDescriptor) .Newobj(dictionaryType.GetConstructor(new[] { typeof(int), typeof(ITypeDescriptor) })!) .Stloc(localDict) .Mark(next) .Ldloc(localCount) .Brfalse(loadFinished) .Ldloc(localCount) .LdcI4(1) .Sub() .Stloc(localCount) .Ldloc(localDict); _keyDescriptor.GenerateLoadEx(ilGenerator, pushReader, pushCtx, il => il.Do(pushDescriptor).LdcI4(0).Callvirt(() => default(ITypeDescriptor).NestedType(0)), keyType, _convertorGenerator); _valueDescriptor.GenerateLoadEx(ilGenerator, pushReader, pushCtx, il => il.Do(pushDescriptor).LdcI4(1).Callvirt(() => default(ITypeDescriptor).NestedType(0)), valueType, _convertorGenerator); ilGenerator .Callvirt(dictionaryType.GetMethod(nameof(IDictionary.Add))!) .Br(next) .Mark(loadFinished) .Ldloc(localDict) .Castclass(targetType); } public ITypeNewDescriptorGenerator? BuildNewDescriptorGenerator() { if (_keyDescriptor!.Sealed && _valueDescriptor!.Sealed) return null; return new TypeNewDescriptorGenerator(this); } class TypeNewDescriptorGenerator : ITypeNewDescriptorGenerator { readonly DictionaryTypeDescriptor _owner; public TypeNewDescriptorGenerator(DictionaryTypeDescriptor owner) { _owner = owner; } public void GenerateTypeIterator(IILGen ilGenerator, Action<IILGen> pushObj, Action<IILGen> pushCtx, Type type) { var finish = ilGenerator.DefineLabel(); var next = ilGenerator.DefineLabel(); if (type == typeof(object)) type = _owner.GetPreferredType(); var targetIDictionary = GetInterface(type); var targetTypeArguments = targetIDictionary.GetGenericArguments(); var keyType = _owner._typeSerializers.LoadAsType(_owner._keyDescriptor!, targetTypeArguments[0]); var valueType = _owner._typeSerializers.LoadAsType(_owner._valueDescriptor!, targetTypeArguments[1]); if (_owner._type == null) _owner._type = type; var isDict = type.GetGenericTypeDefinition() == typeof(Dictionary<,>); var typeAsIDictionary = isDict ? type : typeof(IDictionary<,>).MakeGenericType(keyType, valueType); var getEnumeratorMethod = isDict ? typeAsIDictionary.GetMethods() .Single( m => m.Name == nameof(IEnumerable.GetEnumerator) && m.ReturnType.IsValueType && m.GetParameters().Length == 0) : typeAsIDictionary.GetInterface("IEnumerable`1")!.GetMethod(nameof(IEnumerable.GetEnumerator)); var typeAsIEnumerator = getEnumeratorMethod!.ReturnType; var currentGetter = typeAsIEnumerator.GetProperty(nameof(IEnumerator.Current))!.GetGetMethod(); var typeKeyValuePair = currentGetter!.ReturnType; var localEnumerator = ilGenerator.DeclareLocal(typeAsIEnumerator); var localPair = ilGenerator.DeclareLocal(typeKeyValuePair); ilGenerator .Do(pushObj) .Castclass(typeAsIDictionary) .Callvirt(getEnumeratorMethod) .Stloc(localEnumerator) .Try() .Mark(next) .Do(il => { if (isDict) { il .Ldloca(localEnumerator) .Call(typeAsIEnumerator.GetMethod(nameof(IEnumerator.MoveNext))!); } else { il .Ldloc(localEnumerator) .Callvirt(() => default(IEnumerator).MoveNext()); } }) .Brfalse(finish) .Do(il => { if (isDict) { il .Ldloca(localEnumerator) .Call(currentGetter); } else { il .Ldloc(localEnumerator) .Callvirt(currentGetter); } }) .Stloc(localPair); if (!_owner._keyDescriptor.Sealed) { ilGenerator .Do(pushCtx) .Ldloca(localPair) .Call(typeKeyValuePair.GetProperty("Key")!.GetGetMethod()!) .Callvirt(typeof(IDescriptorSerializerLiteContext).GetMethod(nameof(IDescriptorSerializerLiteContext.StoreNewDescriptors))!); } if (!_owner._valueDescriptor.Sealed) { ilGenerator .Do(pushCtx) .Ldloca(localPair) .Call(typeKeyValuePair.GetProperty("Value")!.GetGetMethod()!) .Callvirt(typeof(IDescriptorSerializerLiteContext).GetMethod(nameof(IDescriptorSerializerLiteContext.StoreNewDescriptors))!); } ilGenerator .Br(next) .Mark(finish) .Finally() .Do(il => { if (isDict) { il .Ldloca(localEnumerator) .Constrained(typeAsIEnumerator); } else { il.Ldloc(localEnumerator); } }) .Callvirt(() => default(IDisposable).Dispose()) .EndTry(); } } public ITypeDescriptor? NestedType(int index) { return index switch { 0 => _keyDescriptor, 1 => _valueDescriptor, _ => null }; } public void MapNestedTypes(Func<ITypeDescriptor, ITypeDescriptor> map) { InitFromKeyValueDescriptors(map(_keyDescriptor), map(_valueDescriptor)); } public bool Sealed { get; private set; } public bool StoredInline => true; public bool LoadNeedsHelpWithConversion => false; public void ClearMappingToType() { _type = null; _keyType = null; _valueType = null; } public bool ContainsField(string name) { return false; } public IEnumerable<KeyValuePair<string, ITypeDescriptor>> Fields => Array.Empty<KeyValuePair<string, ITypeDescriptor>>(); public void Persist(ref SpanWriter writer, DescriptorWriter nestedDescriptorWriter) { nestedDescriptorWriter(ref writer, _keyDescriptor!); nestedDescriptorWriter(ref writer, _valueDescriptor!); } public void GenerateSave(IILGen ilGenerator, Action<IILGen> pushWriter, Action<IILGen> pushCtx, Action<IILGen> pushValue, Type saveType) { var notnull = ilGenerator.DefineLabel(); var completeFinish = ilGenerator.DefineLabel(); var notDictionary = ilGenerator.DefineLabel(); var keyType = saveType.GetGenericArguments()[0]; var valueType = saveType.GetGenericArguments()[1]; var typeAsIDictionary = typeof(IDictionary<,>).MakeGenericType(keyType, valueType); var typeAsICollection = typeAsIDictionary.GetInterface("ICollection`1"); var localDict = ilGenerator.DeclareLocal(typeAsIDictionary); ilGenerator .Do(pushValue) .Castclass(typeAsIDictionary) .Stloc(localDict) .Ldloc(localDict) .Brtrue(notnull) .Do(pushWriter) .Call(typeof(SpanWriter).GetMethod(nameof(SpanWriter.WriteByteZero))!) .Br(completeFinish) .Mark(notnull) .Do(pushWriter) .Ldloc(localDict) .Callvirt(typeAsICollection!.GetProperty(nameof(ICollection.Count))!.GetGetMethod()!) .LdcI4(1) .Add() .Call(typeof(SpanWriter).GetMethod(nameof(SpanWriter.WriteVUInt32))!); { var typeAsDictionary = typeof(Dictionary<,>).MakeGenericType(keyType, valueType); var getEnumeratorMethod = typeAsDictionary.GetMethods() .Single(m => m.Name == nameof(IEnumerable.GetEnumerator) && m.ReturnType.IsValueType && m.GetParameters().Length == 0); var typeAsIEnumerator = getEnumeratorMethod.ReturnType; var currentGetter = typeAsIEnumerator.GetProperty(nameof(IEnumerator.Current))!.GetGetMethod(); var typeKeyValuePair = currentGetter!.ReturnType; var localEnumerator = ilGenerator.DeclareLocal(typeAsIEnumerator); var localPair = ilGenerator.DeclareLocal(typeKeyValuePair); var finish = ilGenerator.DefineLabel(); var next = ilGenerator.DefineLabel(); ilGenerator .Ldloc(localDict) .Isinst(typeAsDictionary) .Brfalse(notDictionary) .Ldloc(localDict) .Castclass(typeAsDictionary) .Callvirt(getEnumeratorMethod) .Stloc(localEnumerator) .Try() .Mark(next) .Ldloca(localEnumerator) .Call(typeAsIEnumerator.GetMethod(nameof(IEnumerator.MoveNext))!) .Brfalse(finish) .Ldloca(localEnumerator) .Call(currentGetter) .Stloc(localPair); _keyDescriptor!.GenerateSaveEx(ilGenerator, pushWriter, pushCtx, il => il.Ldloca(localPair).Call(typeKeyValuePair.GetProperty("Key")!.GetGetMethod()!), keyType); _valueDescriptor!.GenerateSaveEx(ilGenerator, pushWriter, pushCtx, il => il.Ldloca(localPair).Call(typeKeyValuePair.GetProperty("Value")!.GetGetMethod()!), valueType); ilGenerator .Br(next) .Mark(finish) .Finally() .Ldloca(localEnumerator) .Constrained(typeAsIEnumerator) .Callvirt(() => default(IDisposable).Dispose()) .EndTry() .Br(completeFinish); } { var getEnumeratorMethod = typeAsIDictionary.GetInterface("IEnumerable`1")!.GetMethod(nameof(IEnumerable.GetEnumerator)); var typeAsIEnumerator = getEnumeratorMethod!.ReturnType; var currentGetter = typeAsIEnumerator.GetProperty(nameof(IEnumerator.Current))!.GetGetMethod(); var typeKeyValuePair = currentGetter!.ReturnType; var localEnumerator = ilGenerator.DeclareLocal(typeAsIEnumerator); var localPair = ilGenerator.DeclareLocal(typeKeyValuePair); var finish = ilGenerator.DefineLabel(); var next = ilGenerator.DefineLabel(); ilGenerator .Mark(notDictionary) .Ldloc(localDict) .Callvirt(getEnumeratorMethod) .Stloc(localEnumerator) .Try() .Mark(next) .Ldloc(localEnumerator) .Callvirt(() => default(IEnumerator).MoveNext()) .Brfalse(finish) .Ldloc(localEnumerator) .Callvirt(currentGetter) .Stloc(localPair); _keyDescriptor.GenerateSaveEx(ilGenerator, pushWriter, pushCtx, il => il.Ldloca(localPair).Call(typeKeyValuePair.GetProperty("Key")!.GetGetMethod()!), keyType); _valueDescriptor.GenerateSaveEx(ilGenerator, pushWriter, pushCtx, il => il.Ldloca(localPair).Call(typeKeyValuePair.GetProperty("Value")!.GetGetMethod()!), valueType); ilGenerator .Br(next) .Mark(finish) .Finally() .Ldloc(localEnumerator) .Callvirt(() => default(IDisposable).Dispose()) .EndTry() .Mark(completeFinish); } } public void GenerateSkip(IILGen ilGenerator, Action<IILGen> pushReader, Action<IILGen> pushCtx) { var localCount = ilGenerator.DeclareLocal(typeof(uint)); var skipFinished = ilGenerator.DefineLabel(); var next = ilGenerator.DefineLabel(); ilGenerator .Do(pushReader) .Call(typeof(SpanReader).GetMethod(nameof(SpanReader.ReadVUInt32))!) .Stloc(localCount) .Ldloc(localCount) .Brfalse(skipFinished) .Mark(next) .Ldloc(localCount) .LdcI4(1) .Sub() .Stloc(localCount) .Ldloc(localCount) .Brfalse(skipFinished); _keyDescriptor!.GenerateSkipEx(ilGenerator, pushReader, pushCtx); _valueDescriptor!.GenerateSkipEx(ilGenerator, pushReader, pushCtx); ilGenerator .Br(next) .Mark(skipFinished); } public ITypeDescriptor CloneAndMapNestedTypes(ITypeDescriptorCallbacks typeSerializers, Func<ITypeDescriptor, ITypeDescriptor> map) { var keyDesc = map(_keyDescriptor); var valueDesc = map(_valueDescriptor); if (_typeSerializers == typeSerializers && keyDesc == _keyDescriptor && valueDesc == _valueDescriptor) return this; return new DictionaryTypeDescriptor(typeSerializers, keyDesc, valueDesc); } }
42.453961
199
0.609805
1e0cdf37fb05c4d1364c91a770dd1ec3cdd01165
2,120
cs
C#
MyDashboard.Domain/Entities/Customer.cs
maschdev/Gemni.MyDashboard-API
25dcfa0eb2fcf80850c7fdb12a454368ade34b93
[ "MIT" ]
null
null
null
MyDashboard.Domain/Entities/Customer.cs
maschdev/Gemni.MyDashboard-API
25dcfa0eb2fcf80850c7fdb12a454368ade34b93
[ "MIT" ]
null
null
null
MyDashboard.Domain/Entities/Customer.cs
maschdev/Gemni.MyDashboard-API
25dcfa0eb2fcf80850c7fdb12a454368ade34b93
[ "MIT" ]
null
null
null
using MyDashboard.Domain.ValueObjects; using MyDashboard.Shared.Entities; using System; using System.Text; namespace MyDashboard.Domain.Entities { public class Customer : Entity { protected Customer() { } public Customer(Name name, Email email, User user, Document document, string phone) { Name = name; Email = email; Document = document; User = user; Phone = phone; } public Document Document { get; private set; } public Email Email { get; private set; } public Name Name { get; private set; } public User User { get; private set; } public Guid UserId { get; private set; } public string Phone { get; private set; } public bool Enable { get; private set; } public void Active() => Enable = true; public void Deactivate() => Enable = false; public void Update(Name name, Email email, Document document, string phone) { Name.Update(name.FirstName, name.LastName); Email.Udpate(email.Address); Document.Update(document.Number); //User.Update(user.Name); Phone = phone; } public bool Authenticate(string email, string password) { if (Email.Address.Trim() == email.Trim() && User.Password.Trim() == EncryptPassword(password).Trim()) return true; AddNotification("Password", "Usuário ou senha inválidos"); return false; } private static string EncryptPassword(string pass) { if (string.IsNullOrEmpty(pass)) return ""; var password = (pass += "|2d331cca-f6c0-40c0-bb43-6e32989c2881"); var md5 = System.Security.Cryptography.MD5.Create(); var data = md5.ComputeHash(Encoding.Default.GetBytes(password)); var sbString = new StringBuilder(); for (int i = 0; i < data.Length; i++) sbString.Append(data[i].ToString("x2")); return sbString.ToString(); } } }
32.121212
113
0.575472
1e1112b477dc394ff175f5c5a6903063afc4a4d1
5,107
cs
C#
src/tests/Equinor.ProCoSys.Preservation.WebApi.Tests/Controllers/Tags/UploadAttachmentForceOverwriteDtoValidatorTests.cs
hbjorgo/procosys-preservation-api
9ae1826bb78e6fdc6748091bce3118a0fb4556b8
[ "MIT" ]
5
2019-10-09T10:46:36.000Z
2021-02-22T15:13:04.000Z
src/tests/Equinor.ProCoSys.Preservation.WebApi.Tests/Controllers/Tags/UploadAttachmentForceOverwriteDtoValidatorTests.cs
hbjorgo/procosys-preservation-api
9ae1826bb78e6fdc6748091bce3118a0fb4556b8
[ "MIT" ]
217
2019-11-08T12:35:41.000Z
2022-03-01T23:03:11.000Z
src/tests/Equinor.ProCoSys.Preservation.WebApi.Tests/Controllers/Tags/UploadAttachmentForceOverwriteDtoValidatorTests.cs
hbjorgo/procosys-preservation-api
9ae1826bb78e6fdc6748091bce3118a0fb4556b8
[ "MIT" ]
3
2019-12-10T11:36:08.000Z
2022-02-17T11:12:52.000Z
using System.IO; using System.Threading; using System.Threading.Tasks; using Equinor.ProCoSys.Preservation.BlobStorage; using Equinor.ProCoSys.Preservation.Domain; using Equinor.ProCoSys.Preservation.WebApi.Controllers.Tags; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; namespace Equinor.ProCoSys.Preservation.WebApi.Tests.Controllers.Tags { [TestClass] public class UploadAttachmentForceOverwriteDtoValidatorTests { private UploadAttachmentForceOverwriteDtoValidator _dut; private BlobStorageOptions _options; [TestInitialize] public void Setup() { var blobStorageOptionsMock = new Mock<IOptionsSnapshot<BlobStorageOptions>>(); _options = new BlobStorageOptions { MaxSizeMb = 2, BlobContainer = "bc", BlockedFileSuffixes = new[] {".exe", ".zip"} }; blobStorageOptionsMock .Setup(x => x.Value) .Returns(_options); _dut = new UploadAttachmentForceOverwriteDtoValidator(blobStorageOptionsMock.Object); } [TestMethod] public void Validate_OK() { var uploadAttachmentDto = new UploadAttachmentForceOverwriteDto { File = new TestFile("picture.gif", 1000) }; var result = _dut.Validate(uploadAttachmentDto); Assert.IsTrue(result.IsValid); } [TestMethod] public void Fail_When_FileNotGiven() { var uploadAttachmentDto = new UploadAttachmentForceOverwriteDto(); var result = _dut.Validate(uploadAttachmentDto); Assert.IsFalse(result.IsValid); Assert.AreEqual(1, result.Errors.Count); Assert.AreEqual(result.Errors[0].ErrorMessage, "'File' must not be empty."); } [TestMethod] public void Fail_WhenFileNameNotExists() { var uploadAttachmentDto = new UploadAttachmentForceOverwriteDto { File = new TestFile(null, 1000) }; var result = _dut.Validate(uploadAttachmentDto); Assert.IsFalse(result.IsValid); Assert.AreEqual(1, result.Errors.Count); Assert.AreEqual(result.Errors[0].ErrorMessage, "Filename not given!"); } [TestMethod] public void Fail_WhenFileNameIsTooLong() { var uploadAttachmentDto = new UploadAttachmentForceOverwriteDto { File = new TestFile(new string('x', Attachment.FileNameLengthMax + 1), 1000) }; var result = _dut.Validate(uploadAttachmentDto); Assert.IsFalse(result.IsValid); Assert.AreEqual(1, result.Errors.Count); Assert.IsTrue(result.Errors[0].ErrorMessage.StartsWith("Filename to long! Max")); } [TestMethod] public void Fail_When_FileToBig() { var uploadAttachmentDto = new UploadAttachmentForceOverwriteDto { File = new TestFile("picture.gif", (_options.MaxSizeMb * 1024 * 1024) + 1) }; var result = _dut.Validate(uploadAttachmentDto); Assert.IsFalse(result.IsValid); Assert.AreEqual(1, result.Errors.Count); Assert.AreEqual(result.Errors[0].ErrorMessage, $"Maximum file size is {_options.MaxSizeMb}MB!"); } [TestMethod] public void Fail_When_IllegalFileType() { var uploadAttachmentDto = new UploadAttachmentForceOverwriteDto { File = new TestFile("picture.exe", 500) }; var result = _dut.Validate(uploadAttachmentDto); Assert.IsFalse(result.IsValid); Assert.AreEqual(1, result.Errors.Count); Assert.AreEqual(result.Errors[0].ErrorMessage, $"File {uploadAttachmentDto.File.FileName} is not a valid file for upload!"); } class TestFile : IFormFile { public TestFile(string fileName, long lengthInBytes) { ContentDisposition = null; ContentType = null; FileName = fileName; Headers = null; Length = lengthInBytes; Name = null; } public void CopyTo(Stream target) => throw new System.NotImplementedException(); public Task CopyToAsync(Stream target, CancellationToken cancellationToken = new CancellationToken()) => throw new System.NotImplementedException(); public Stream OpenReadStream() => throw new System.NotImplementedException(); public string ContentDisposition { get; } public string ContentType { get; } public string FileName { get; } public IHeaderDictionary Headers { get; } public long Length { get; } public string Name { get; } } } }
34.506757
160
0.602115
1e113a9f21097fc09ce1143d3393bae72e0f1121
8,052
cs
C#
src/Cake.Common/Tools/NuGet/Pack/NuspecTransformer.cs
RichiCoder1/cake
bdc3a070880dd6b7e4bdd3d5ea3c18ee2fe82bb6
[ "MIT" ]
1
2017-02-06T14:02:26.000Z
2017-02-06T14:02:26.000Z
src/Cake.Common/Tools/NuGet/Pack/NuspecTransformer.cs
RichiCoder1/cake
bdc3a070880dd6b7e4bdd3d5ea3c18ee2fe82bb6
[ "MIT" ]
null
null
null
src/Cake.Common/Tools/NuGet/Pack/NuspecTransformer.cs
RichiCoder1/cake
bdc3a070880dd6b7e4bdd3d5ea3c18ee2fe82bb6
[ "MIT" ]
1
2021-05-03T14:12:03.000Z
2021-05-03T14:12:03.000Z
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Xml; using Cake.Core; namespace Cake.Common.Tools.NuGet.Pack { internal static class NuspecTransformer { private static readonly Dictionary<string, Func<NuGetPackSettings, string>> _mappings; private static readonly List<string> _cdataElements; private const string NuSpecXsd = "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"; static NuspecTransformer() { _mappings = new Dictionary<string, Func<NuGetPackSettings, string>> { { "id", settings => ToString(settings.Id) }, { "version", settings => ToString(settings.Version) }, { "title", settings => ToString(settings.Title) }, { "authors", settings => ToCommaSeparatedString(settings.Authors) }, { "owners", settings => ToCommaSeparatedString(settings.Owners) }, { "description", settings => ToString(settings.Description) }, { "summary", settings => ToString(settings.Summary) }, { "licenseUrl", settings => ToString(settings.LicenseUrl) }, { "projectUrl", settings => ToString(settings.ProjectUrl) }, { "iconUrl", settings => ToString(settings.IconUrl) }, { "requireLicenseAcceptance", settings => ToString(settings.RequireLicenseAcceptance) }, { "copyright", settings => ToString(settings.Copyright) }, { "releaseNotes", settings => ToMultiLineString(settings.ReleaseNotes) }, { "tags", settings => ToSpaceSeparatedString(settings.Tags) } }; _cdataElements = new List<string> { "releaseNotes" }; } public static void Transform(XmlDocument document, NuGetPackSettings settings) { // Create the namespace manager. var namespaceManager = new XmlNamespaceManager(document.NameTable); namespaceManager.AddNamespace("nu", NuSpecXsd); foreach (var elementName in _mappings.Keys) { var content = _mappings[elementName](settings); if (content != null) { // Replace the node content. var node = FindOrCreateElement(document, namespaceManager, elementName); if (_cdataElements.Contains(elementName)) { node.AppendChild(document.CreateCDataSection(content)); } else { node.InnerText = content; } } } if (settings.Files != null && settings.Files.Count > 0) { var filesPath = string.Format(CultureInfo.InvariantCulture, "//*[local-name()='package']//*[local-name()='files']"); var filesElement = document.SelectSingleNode(filesPath, namespaceManager); if (filesElement == null) { // Get the package element. var package = GetPackageElement(document); filesElement = document.CreateAndAppendElement(package, "files"); } // Add the files filesElement.RemoveAll(); foreach (var file in settings.Files) { var fileElement = document.CreateAndAppendElement(filesElement, "file"); fileElement.AddAttributeIfSpecified(file.Source, "src"); fileElement.AddAttributeIfSpecified(file.Exclude, "exclude"); fileElement.AddAttributeIfSpecified(file.Target, "target"); } } if (settings.Dependencies != null && settings.Dependencies.Count > 0) { var dependenciesElement = FindOrCreateElement(document, namespaceManager, "dependencies"); // Add the files dependenciesElement.RemoveAll(); foreach (var dependency in settings.Dependencies) { var fileElement = document.CreateAndAppendElement(dependenciesElement, "dependency"); fileElement.AddAttributeIfSpecified(dependency.Id, "id"); fileElement.AddAttributeIfSpecified(dependency.Version, "version"); } } } private static XmlNode GetPackageElement(XmlDocument document) { var package = document.SelectSingleNode("//*[local-name()='package']"); if (package == null) { throw new CakeException("Nuspec file is missing package root."); } return package; } private static XmlNode FindOrCreateElement(XmlDocument document, XmlNamespaceManager ns, string name) { var path = string.Format(CultureInfo.InvariantCulture, "//*[local-name()='package']//*[local-name()='metadata']//*[local-name()='{0}']", name); var node = document.SelectSingleNode(path, ns); if (node == null) { var parent = document.SelectSingleNode("//*[local-name()='package']//*[local-name()='metadata']", ns); if (parent == null) { // Get the package element. var package = GetPackageElement(document); // Create the metadata element. parent = document.CreateElement("metadata", NuSpecXsd); package.PrependChild(parent); } node = document.CreateAndAppendElement(parent, name); } return node; } private static XmlNode CreateAndAppendElement(this XmlDocument document, XmlNode parent, string name) { // If the parent didn't have a namespace specified, then skip adding one. // Otherwise add the parent's namespace. This is a little hackish, but it // will avoid empty namespaces. This should probably be done better... return parent.AppendChild( string.IsNullOrWhiteSpace(parent.NamespaceURI) ? document.CreateElement(name) : document.CreateElement(name, parent.NamespaceURI)); } private static void AddAttributeIfSpecified(this XmlNode element, string value, string name) { if (string.IsNullOrWhiteSpace(value) || element.OwnerDocument == null || element.Attributes == null) { return; } var attr = element.OwnerDocument.CreateAttribute(name); attr.Value = value; element.Attributes.Append(attr); } private static string ToString(string value) { return string.IsNullOrWhiteSpace(value) ? null : value; } private static string ToString(Uri value) { return value == null ? null : value.ToString().TrimEnd('/'); } private static string ToString(bool value) { return value.ToString().ToLowerInvariant(); } private static string ToCommaSeparatedString(IEnumerable<string> values) { return values != null ? string.Join(",", values) : null; } private static string ToMultiLineString(IEnumerable<string> values) { return values != null ? string.Join("\r\n", values).NormalizeLineEndings() : null; } private static string ToSpaceSeparatedString(IEnumerable<string> values) { return values != null ? string.Join(" ", values.Select(x => x.Replace(" ", "-"))) : null; } } }
41.505155
155
0.551043
1e1601a77069aa09f2c517994159fdc15e5179a1
25,729
cs
C#
Ash.DefaultEC/UI/Containers/Container.cs
JonSnowbd/Nez
3fb72cd82370df607026c22c77c811cfbfcf7c77
[ "MIT" ]
3
2020-10-25T22:46:45.000Z
2021-02-22T19:41:21.000Z
Ash.DefaultEC/UI/Containers/Container.cs
JonSnowbd/Ash
3fb72cd82370df607026c22c77c811cfbfcf7c77
[ "MIT" ]
null
null
null
Ash.DefaultEC/UI/Containers/Container.cs
JonSnowbd/Ash
3fb72cd82370df607026c22c77c811cfbfcf7c77
[ "MIT" ]
null
null
null
using System; using Microsoft.Xna.Framework; namespace Ash.UI { /// <summary> /// A group with a single child that sizes and positions the child using constraints. This provides layout similar to a /// {@link Table} with a single cell but is more lightweight. /// </summary> public class Container : Group { #region ILayout public override float MinWidth => GetMinWidth(); public override float MinHeight => GetPrefHeight(); public override float PreferredWidth => GetPrefWidth(); public override float PreferredHeight => GetPrefHeight(); public override float MaxWidth => GetMaxWidth(); public override float MaxHeight => GetMaxHeight(); #endregion Element _element; Value _minWidthValue = Value.MinWidth, _minHeightValue = Value.MinHeight; Value _prefWidthValue = Value.PrefWidth, _prefHeightValue = Value.PrefHeight; Value _maxWidthValue = Value.Zero, _maxHeightValue = Value.Zero; Value _padTop = Value.Zero, _padLeft = Value.Zero, _padBottom = Value.Zero, _padRight = Value.Zero; float _fillX, _fillY; int _align; IDrawable _background; bool _clip; bool _round = true; /// <summary> /// Creates a container with no element /// </summary> public Container() { SetTouchable(Touchable.ChildrenOnly); transform = false; } public Container(Element element) : this() { SetElement(element); } public override void Draw(Batcher batcher, float parentAlpha) { Validate(); if (transform) { ApplyTransform(batcher, ComputeTransform()); DrawBackground(batcher, parentAlpha, 0, 0); if (_clip) { //batcher.flush(); //float padLeft = this.padLeft.get( this ), padBottom = this.padBottom.get( this ); //if( clipBegin( padLeft, padBottom,minWidthValueh() - padLeft - padRight.get( tmaxWidth // getHeight() - padBottom - padTop.get( this ) ) ) { DrawChildren(batcher, parentAlpha); //batcher.flush(); //clipEnd(); } } else { DrawChildren(batcher, parentAlpha); } ResetTransform(batcher); } else { DrawBackground(batcher, parentAlpha, GetX(), GetY()); base.Draw(batcher, parentAlpha); } } /// <summary> /// Called to draw the background, before clipping is applied (if enabled). Default implementation draws the background drawable. /// </summary> /// <param name="batcher">Batcher.</param> /// <param name="parentAlpha">Parent alpha.</param> /// <param name="x">The x coordinate.</param> /// <param name="y">The y coordinate.</param> protected void DrawBackground(Batcher batcher, float parentAlpha, float x, float y) { if (_background == null) return; _background.Draw(batcher, x, y, GetWidth(), GetHeight(), ColorExt.Create(color, (int) (color.A * parentAlpha))); } /// <summary> /// Sets the background drawable and adjusts the container's padding to match the background. /// </summary> /// <param name="background">Background.</param> public Container SetBackground(IDrawable background) { return SetBackground(background, true); } /// <summary> /// Sets the background drawable and, if adjustPadding is true, sets the container's padding to /// {@link Drawable#getBottomHeight()} , {@link Drawable#getTopHeight()}, {@link Drawable#getLeftWidth()}, and /// {@link Drawable#getRightWidth()}. /// If background is null, the background will be cleared and padding removed. /// </summary> /// <param name="background">Background.</param> /// <param name="adjustPadding">If set to <c>true</c> adjust padding.</param> public Container SetBackground(IDrawable background, bool adjustPadding) { if (_background == background) return this; _background = background; if (adjustPadding) { if (background == null) SetPad(Value.Zero); else SetPad(background.TopHeight, background.LeftWidth, background.BottomHeight, background.RightWidth); Invalidate(); } return this; } public IDrawable GetBackground() { return _background; } public override void Layout() { if (_element == null) return; float padLeft = _padLeft.Get(this), padBottom = _padBottom.Get(this); float containerWidth = GetWidth() - padLeft - _padRight.Get(this); float containerHeight = GetHeight() - padBottom - _padTop.Get(this); float minWidth = _minWidthValue.Get(_element), minHeight = _minHeightValue.Get(_element); float prefWidth = _prefWidthValue.Get(_element), prefHeight = _prefHeightValue.Get(_element); float maxWidth = _maxWidthValue.Get(_element), maxHeight = _maxHeightValue.Get(_element); float width; if (_fillX > 0) width = containerWidth * _fillX; else width = Math.Min(prefWidth, containerWidth); if (width < minWidth) width = minWidth; if (maxWidth > 0 && width > maxWidth) width = maxWidth; float height; if (_fillY > 0) height = containerHeight * _fillY; else height = Math.Min(prefHeight, containerHeight); if (height < minHeight) height = minHeight; if (maxHeight > 0 && height > maxHeight) height = maxHeight; var x = padLeft; if ((_align & AlignInternal.Right) != 0) x += containerWidth - width; else if ((_align & AlignInternal.Left) == 0) // center x += (containerWidth - width) / 2; var y = padBottom; if ((_align & AlignInternal.Top) != 0) y += containerHeight - height; else if ((_align & AlignInternal.Bottom) == 0) // center y += (containerHeight - height) / 2; if (_round) { x = Mathf.Round(x); y = Mathf.Round(y); width = Mathf.Round(width); height = Mathf.Round(height); } _element.SetBounds(x, y, width, height); if (_element is ILayout) ((ILayout) _element).Validate(); } /// <summary> /// element may be null /// </summary> /// <returns>The element.</returns> /// <param name="element">element.</param> public virtual Element SetElement(Element element) { if (element == this) throw new Exception("element cannot be the Container."); if (element == _element) return element; if (_element != null) base.RemoveElement(_element); _element = element; if (element != null) return AddElement(element); return null; } /// <summary> /// May be null /// </summary> /// <returns>The element.</returns> public T GetElement<T>() where T : Element { return _element as T; } /// <summary> /// May be null /// </summary> /// <returns>The element.</returns> public Element GetElement() { return _element; } public override bool RemoveElement(Element element) { if (element != _element) return false; SetElement(null); return true; } /// <summary> /// Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value /// </summary> /// <param name="size">Size.</param> public Container SetSize(Value size) { if (size == null) throw new Exception("size cannot be null."); _minWidthValue = size; _minHeightValue = size; _prefWidthValue = size; _prefHeightValue = size; _maxWidthValue = size; _maxHeightValue = size; return this; } /// <summary> /// Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public Container SetSize(Value width, Value height) { if (width == null) throw new Exception("width cannot be null."); if (height == null) throw new Exception("height cannot be null."); _minWidthValue = width; _minHeightValue = height; _prefWidthValue = width; _prefHeightValue = height; _maxWidthValue = width; _maxHeightValue = height; return this; } /// <summary> /// Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value /// </summary> /// <param name="size">Size.</param> public Container SetSize(float size) { SetSize(new Value.Fixed(size)); return this; } /// <summary> /// Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public new Container SetSize(float width, float height) { SetSize(new Value.Fixed(width), new Value.Fixed(height)); return this; } /// <summary> /// Sets the minWidth, prefWidth, and maxWidth to the specified value /// </summary> /// <param name="width">Width.</param> public Container SetWidth(Value width) { if (width == null) throw new Exception("width cannot be null."); _minWidthValue = width; _prefWidthValue = width; _maxWidthValue = width; return this; } /// <summary> /// Sets the minWidth, prefWidth, and maxWidth to the specified value /// </summary> /// <param name="width">Width.</param> public new Container SetWidth(float width) { SetWidth(new Value.Fixed(width)); return this; } /// <summary> /// Sets the minHeight, prefHeight, and maxHeight to the specified value. /// </summary> /// <param name="height">Height.</param> public Container SetHeight(Value height) { if (height == null) throw new Exception("height cannot be null."); _minHeightValue = height; _prefHeightValue = height; _maxHeightValue = height; return this; } /// <summary> /// Sets the minHeight, prefHeight, and maxHeight to the specified value /// </summary> /// <param name="height">Height.</param> public new Container SetHeight(float height) { SetHeight(new Value.Fixed(height)); return this; } /// <summary> /// Sets the minWidth and minHeight to the specified value /// </summary> /// <param name="size">Size.</param> public Container SetMinSize(Value size) { if (size == null) throw new Exception("size cannot be null."); _minWidthValue = size; _minHeightValue = size; return this; } /// <summary> /// Sets the minimum size. /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public Container SetMinSize(Value width, Value height) { if (width == null) throw new Exception("width cannot be null."); if (height == null) throw new Exception("height cannot be null."); _minWidthValue = width; _minHeightValue = height; return this; } public Container SetMinWidth(Value minWidth) { if (minWidth == null) throw new Exception("minWidth cannot be null."); _minWidthValue = minWidth; return this; } public Container SetMinHeight(Value minHeight) { if (minHeight == null) throw new Exception("minHeight cannot be null."); _minHeightValue = minHeight; return this; } /// <summary> /// Sets the minWidth and minHeight to the specified value /// </summary> /// <param name="size">Size.</param> public Container SetMinSize(float size) { SetMinSize(new Value.Fixed(size)); return this; } /// <summary> /// Sets the minWidth and minHeight to the specified values /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public Container SetMinSize(float width, float height) { SetMinSize(new Value.Fixed(width), new Value.Fixed(height)); return this; } public Container SetMinWidth(float minWidth) { _minWidthValue = new Value.Fixed(minWidth); return this; } public Container SetMinHeight(float minHeight) { _minHeightValue = new Value.Fixed(minHeight); return this; } /// <summary> /// Sets the prefWidth and prefHeight to the specified value. /// </summary> /// <param name="size">Size.</param> public Container PrefSize(Value size) { if (size == null) throw new Exception("size cannot be null."); _prefWidthValue = size; _prefHeightValue = size; return this; } /// <summary> /// Sets the prefWidth and prefHeight to the specified values. /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public Container PrefSize(Value width, Value height) { if (width == null) throw new Exception("width cannot be null."); if (height == null) throw new Exception("height cannot be null."); _prefWidthValue = width; _prefHeightValue = height; return this; } public Container SetPrefWidth(Value prefWidth) { if (prefWidth == null) throw new Exception("prefWidth cannot be null."); _prefWidthValue = prefWidth; return this; } public Container SetPrefHeight(Value prefHeight) { if (prefHeight == null) throw new Exception("prefHeight cannot be null."); _prefHeightValue = prefHeight; return this; } /// <summary> /// Sets the prefWidth and prefHeight to the specified value. /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public Container SetPrefSize(float width, float height) { PrefSize(new Value.Fixed(width), new Value.Fixed(height)); return this; } /// <summary> /// Sets the prefWidth and prefHeight to the specified values /// </summary> /// <param name="size">Size.</param> public Container SetPrefSize(float size) { PrefSize(new Value.Fixed(size)); return this; } public Container SetPrefWidth(float prefWidth) { _prefWidthValue = new Value.Fixed(prefWidth); return this; } public Container SetPrefHeight(float prefHeight) { _prefHeightValue = new Value.Fixed(prefHeight); return this; } /// <summary> /// Sets the maxWidth and maxHeight to the specified value. /// </summary> /// <param name="size">Size.</param> public Container SetMaxSize(Value size) { if (size == null) throw new Exception("size cannot be null."); _maxWidthValue = size; _maxHeightValue = size; return this; } /// <summary> /// Sets the maxWidth and maxHeight to the specified values /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public Container SetMaxSize(Value width, Value height) { if (width == null) throw new Exception("width cannot be null."); if (height == null) throw new Exception("height cannot be null."); _maxWidthValue = width; _maxHeightValue = height; return this; } public Container SetMaxWidth(Value maxWidth) { if (maxWidth == null) throw new Exception("maxWidth cannot be null."); _maxWidthValue = maxWidth; return this; } public Container SetMaxHeight(Value maxHeight) { if (maxHeight == null) throw new Exception("maxHeight cannot be null."); _maxHeightValue = maxHeight; return this; } /// <summary> /// Sets the maxWidth and maxHeight to the specified value /// </summary> /// <param name="size">Size.</param> public Container SetMaxSize(float size) { SetMaxSize(new Value.Fixed(size)); return this; } /// <summary> /// Sets the maxWidth and maxHeight to the specified values /// </summary> /// <param name="width">Width.</param> /// <param name="height">Height.</param> public Container SetMaxSize(float width, float height) { SetMaxSize(new Value.Fixed(width), new Value.Fixed(height)); return this; } public Container SetMaxWidth(float maxWidth) { _maxWidthValue = new Value.Fixed(maxWidth); return this; } public Container SetMaxHeight(float maxHeight) { _maxHeightValue = new Value.Fixed(maxHeight); return this; } /// <summary> /// Sets the padTop, padLeft, padBottom, and padRight to the specified value. /// </summary> /// <param name="pad">Pad.</param> public Container SetPad(Value pad) { if (pad == null) throw new Exception("pad cannot be null."); _padTop = pad; _padLeft = pad; _padBottom = pad; _padRight = pad; return this; } public Container SetPad(Value top, Value left, Value bottom, Value right) { if (top == null) throw new Exception("top cannot be null."); if (left == null) throw new Exception("left cannot be null."); if (bottom == null) throw new Exception("bottom cannot be null."); if (right == null) throw new Exception("right cannot be null."); _padTop = top; _padLeft = left; _padBottom = bottom; _padRight = right; return this; } public Container SetPadTop(Value padTop) { if (padTop == null) throw new Exception("padTop cannot be null."); _padTop = padTop; return this; } public Container SetPadLeft(Value padLeft) { if (padLeft == null) throw new Exception("padLeft cannot be null."); _padLeft = padLeft; return this; } public Container SetPadBottom(Value padBottom) { if (padBottom == null) throw new Exception("padBottom cannot be null."); _padBottom = padBottom; return this; } public Container SetPadRight(Value padRight) { if (padRight == null) throw new Exception("padRight cannot be null."); _padRight = padRight; return this; } /// <summary> /// Sets the padTop, padLeft, padBottom, and padRight to the specified value /// </summary> /// <param name="pad">Pad.</param> public Container SetPad(float pad) { Value value = new Value.Fixed(pad); _padTop = value; _padLeft = value; _padBottom = value; _padRight = value; return this; } public Container SetPad(float top, float left, float bottom, float right) { _padTop = new Value.Fixed(top); _padLeft = new Value.Fixed(left); _padBottom = new Value.Fixed(bottom); _padRight = new Value.Fixed(right); return this; } public Container SetPadTop(float padTop) { _padTop = new Value.Fixed(padTop); return this; } public Container SetPadLeft(float padLeft) { _padLeft = new Value.Fixed(padLeft); return this; } public Container SetPadBottom(float padBottom) { _padBottom = new Value.Fixed(padBottom); return this; } public Container SetPadRight(float padRight) { _padRight = new Value.Fixed(padRight); return this; } /// <summary> /// Sets fillX and fillY to 1 /// </summary> public Container SetFill() { _fillX = 1f; _fillY = 1f; return this; } /// <summary> /// Sets fillX to 1 /// </summary> public Container SetFillX() { _fillX = 1f; return this; } /// <summary> /// Sets fillY to 1 /// </summary> public Container SetFillY() { _fillY = 1f; return this; } public Container SetFill(float x, float y) { _fillX = x; _fillY = y; return this; } /// <summary> /// Sets fillX and fillY to 1 if true, 0 if false /// </summary> /// <param name="x">If set to <c>true</c> x.</param> /// <param name="y">If set to <c>true</c> y.</param> public Container SetFill(bool x, bool y) { _fillX = x ? 1f : 0; _fillY = y ? 1f : 0; return this; } /// <summary> /// Sets fillX and fillY to 1 if true, 0 if false /// </summary> /// <param name="fill">If set to <c>true</c> fill.</param> public Container SetFill(bool fill) { _fillX = fill ? 1f : 0; _fillY = fill ? 1f : 0; return this; } /// <summary> /// Sets the alignment of the element within the container. Set to {@link Align#center}, {@link Align#top}, {@link Align#bottom}, /// {@link Align#left}, {@link Align#right}, or any combination of those. /// </summary> /// <param name="align">Align.</param> public Container SetAlign(Align align) { _align = (int) align; return this; } /// <summary> /// Sets the alignment of the element within the container to {@link Align#center}. This clears any other alignment. /// </summary> public Container SetAlignCenter() { _align = AlignInternal.Center; return this; } /// <summary> /// Sets {@link Align#top} and clears {@link Align#bottom} for the alignment of the element within the container. /// </summary> public Container SetTop() { _align |= AlignInternal.Top; _align &= ~AlignInternal.Bottom; return this; } /// <summary> /// Sets {@link Align#left} and clears {@link Align#right} for the alignment of the element within the container. /// </summary> public Container SetLeft() { _align |= AlignInternal.Left; _align &= ~AlignInternal.Right; return this; } /// <summary> /// Sets {@link Align#bottom} and clears {@link Align#top} for the alignment of the element within the container. /// </summary> public Container SetBottom() { _align |= AlignInternal.Bottom; _align &= ~AlignInternal.Top; return this; } /// <summary> /// Sets {@link Align#right} and clears {@link Align#left} for the alignment of the element within the container. /// </summary> public Container SetRight() { _align |= AlignInternal.Right; _align &= ~AlignInternal.Left; return this; } public float GetMinWidth() { return _minWidthValue.Get(_element) + _padLeft.Get(this) + _padRight.Get(this); } public Value GetMinHeightValue() { return _minHeightValue; } public float GetMinHeight() { return _minHeightValue.Get(_element) + _padTop.Get(this) + _padBottom.Get(this); } public Value GetPrefWidthValue() { return _prefWidthValue; } public float GetPrefWidth() { float v = _prefWidthValue.Get(_element); if (_background != null) v = Math.Max(v, _background.MinWidth); return Math.Max(GetMinWidth(), v + _padLeft.Get(this) + _padRight.Get(this)); } public Value GetPrefHeightValue() { return _prefHeightValue; } public float GetPrefHeight() { float v = _prefHeightValue.Get(_element); if (_background != null) v = Math.Max(v, _background.MinHeight); return Math.Max(GetMinHeight(), v + _padTop.Get(this) + _padBottom.Get(this)); } public Value GetMaxWidthValue() { return _maxWidthValue; } public float GetMaxWidth() { float v = _maxWidthValue.Get(_element); if (v > 0) v += _padLeft.Get(this) + _padRight.Get(this); return v; } public Value GetMaxHeightValue() { return _maxHeightValue; } public float GetMaxHeight() { float v = _maxHeightValue.Get(_element); if (v > 0) v += _padTop.Get(this) + _padBottom.Get(this); return v; } /// <summary> /// May be null if this value is not set /// </summary> /// <returns>The pad top value.</returns> public Value GetPadTopValue() { return _padTop; } public float GetPadTop() { return _padTop.Get(this); } /// <summary> /// May be null if this value is not set /// </summary> /// <returns>The pad left value.</returns> public Value GetPadLeftValue() { return _padLeft; } public float GetPadLeft() { return _padLeft.Get(this); } /// <summary> /// May be null if this value is not set /// </summary> /// <returns>The pad bottom value.</returns> public Value GetPadBottomValue() { return _padBottom; } public float GetPadBottom() { return _padBottom.Get(this); } /// <summary> /// May be null if this value is not set /// </summary> /// <returns>The pad right value.</returns> public Value GetPadRightValue() { return _padRight; } public float GetPadRight() { return _padRight.Get(this); } /// <summary> /// Returns {@link #getPadLeft()} plus {@link #getPadRight()}. /// </summary> /// <returns>The pad x.</returns> public float GetPadX() { return _padLeft.Get(this) + _padRight.Get(this); } /// <summary> /// Returns {@link #getPadTop()} plus {@link #getPadBottom()} /// </summary> /// <returns>The pad y.</returns> public float GetPadY() { return _padTop.Get(this) + _padBottom.Get(this); } public float GetFillX() { return _fillX; } public float GetFillY() { return _fillY; } public int GetAlign() { return _align; } /// <summary> /// If true (the default), positions and sizes are rounded to integers /// </summary> /// <param name="round">If set to <c>true</c> round.</param> public void SetRound(bool round) { _round = round; } /// <summary> /// Causes the contents to be clipped if they exceed the container bounds. Enabling clipping will set /// {@link #setTransform(bool)} to true /// </summary> /// <param name="enabled">If set to <c>true</c> enabled.</param> public void SetClip(bool enabled) { _clip = enabled; transform = enabled; Invalidate(); } public bool GetClip() { return _clip; } public override Element Hit(Vector2 point) { if (_clip) { if (GetTouchable() == Touchable.Disabled) return null; if (point.X < 0 || point.X >= GetWidth() || point.Y < 0 || point.Y >= GetHeight()) return null; } return base.Hit(point); } public override void DebugRender(Batcher batcher) { Validate(); if (transform) { ApplyTransform(batcher, ComputeTransform()); if (_clip) { //shapes.flush(); //float padLeft = this.padLeft.get( this ), padBottom = this.padBottom.get( this ); //bool draw = background == null ? clipBegin( 0, 0, getWidth(), getHeight() ) : clipBegin( padLeft, padBottom, // getWidth() - padLeft - padRight.get( this ), getHeight() - padBottom - padTop.get( this ) ); var draw = true; if (draw) { DebugRenderChildren(batcher, 1f); //clipEnd(); } } else { DebugRenderChildren(batcher, 1f); } ResetTransform(batcher); } else { base.DebugRender(batcher); } } } }
22.066038
153
0.645264
1e163df4522d851f615fc286e9518f119ceea23a
4,822
cs
C#
SmartMapController/SmartMapControllerDefinition.cs
joshooaj/mipsdk-samples-plugin
0bb103aad9d1e9dfd0b13095437d86cc78d17c6e
[ "MIT" ]
6
2021-02-25T11:52:52.000Z
2022-01-30T13:37:55.000Z
SmartMapController/SmartMapControllerDefinition.cs
joshooaj/mipsdk-samples-plugin
0bb103aad9d1e9dfd0b13095437d86cc78d17c6e
[ "MIT" ]
null
null
null
SmartMapController/SmartMapControllerDefinition.cs
joshooaj/mipsdk-samples-plugin
0bb103aad9d1e9dfd0b13095437d86cc78d17c6e
[ "MIT" ]
5
2021-03-04T12:44:19.000Z
2022-03-30T09:03:44.000Z
using System; using System.Collections.Generic; using System.Drawing; using SmartMapController.Client; using VideoOS.Platform; using VideoOS.Platform.Client; namespace SmartMapController { /// <summary> /// This sample is a Smart Client view item plugin. It demonstrates how to use Message Communication to navigate /// Smart Map and listen to the information of the Smart Map position changes. /// </summary> public class SmartMapControllerDefinition : PluginDefinition { private static System.Drawing.Image _treeNodeImage; internal static Guid SmartMapControllerPluginId = new Guid("4b8e9e95-1443-4193-9332-619a9ecfb0e9"); internal static Guid SmartMapControllerKind = new Guid("49eaf8d2-eb12-4b2c-9197-82ff42fb5b90"); internal static Guid SmartMapControllerViewItemPlugin = new Guid("b4957ad3-edc3-4c67-b8ff-66ae05e2bb98"); #region Private fields // // Note that all the plugin are constructed during application start, and the constructors // should only contain code that references their own dll, e.g. resource load. private List<ViewItemPlugin> _viewItemPlugins = new List<ViewItemPlugin>(); #endregion #region Initialization /// <summary> /// Load resources /// </summary> static SmartMapControllerDefinition() { _treeNodeImage = Properties.Resources.DummyItem; } /// <summary> /// Get the icon for the plugin /// </summary> internal static Image TreeNodeImage { get { return _treeNodeImage; } } /// <summary> /// This method is called when the environment is up and running. /// Registration of Messages via RegisterReceiver can be done at this point. /// </summary> public override void Init() { // Populate all relevant lists with your plugins etc. if (EnvironmentManager.Instance.EnvironmentType == EnvironmentType.SmartClient) { _viewItemPlugins.Add(new SmartMapControllerViewItemPlugin()); } } #endregion #region Cleanup /// <summary> /// The main application is about to be in an undetermined state, either logging off or exiting. /// You can release resources at this point, it should match what you acquired during Init, so additional call to Init() will work. /// </summary> public override void Close() { _viewItemPlugins.Clear(); } #endregion #region Identification Properties /// <summary> /// Gets the unique id identifying this plugin component /// </summary> public override Guid Id { get { return SmartMapControllerPluginId; } } /// <summary> /// This Guid can be defined on several different IPluginDefinitions with the same value, /// and will result in a combination of this top level ProductNode for several plugins. /// Set to Guid.Empty if no sharing is enabled. /// </summary> public override Guid SharedNodeId { get { return PluginSamples.Common.SampleTopNode; } } /// <summary> /// Name of top level Tree node - e.g. A product name /// </summary> public override string Name { get { return "SmartMapController"; } } /// <summary> /// Top level name /// </summary> public override string SharedNodeName { get { return PluginSamples.Common.SampleNodeName; } } /// <summary> /// Company name /// </summary> public override string Manufacturer { get { return PluginSamples.Common.ManufacturerName; } } /// <summary> /// Version of this plugin. /// </summary> public override string VersionString { get { return "1.0.0.0"; } } /// <summary> /// Icon to be used on top level - e.g. a product or company logo /// </summary> public override System.Drawing.Image Icon { get { return null; } } #endregion #region Client related methods and properties /// <summary> /// A list of Client side definitions for Smart Client /// </summary> public override List<ViewItemPlugin> ViewItemPlugins { get { return _viewItemPlugins; } } #endregion } }
30.1375
139
0.574658
1e1762a3351a23add8e70c82b58b2c27968aed75
8,065
cs
C#
src/ImageInputInterface.cs
NicolasCaous/ImageInputInterface
6c59ee8559b426df5009bdad8a3832af7f999bc2
[ "MIT" ]
null
null
null
src/ImageInputInterface.cs
NicolasCaous/ImageInputInterface
6c59ee8559b426df5009bdad8a3832af7f999bc2
[ "MIT" ]
null
null
null
src/ImageInputInterface.cs
NicolasCaous/ImageInputInterface
6c59ee8559b426df5009bdad8a3832af7f999bc2
[ "MIT" ]
null
null
null
using System; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; public class ImageInputInterface : MonoBehaviour { [DllImport("ImageInputInterface")] private static extern void AddBox(int id); [DllImport("ImageInputInterface")] private static extern void RemoveBox(int id); [DllImport("ImageInputInterface")] private static extern void Init(int mainThreadDeltaMs, int boxThreadDeltaMs, int blueThreshValue, int greenThreshValue, int redThreshValue); [DllImport("ImageInputInterface")] private static extern void Stop(); [DllImport("ImageInputInterface")] private static extern int GetStatus(); [DllImport("ImageInputInterface")] private static extern int GetMatType(); [DllImport("ImageInputInterface")] private static extern double GetBoxValue(int id); [DllImport("ImageInputInterface")] private static extern void SetBaseValues(); [DllImport("ImageInputInterface")] private static extern void GetRawImage(IntPtr data, int width, int height); [DllImport("ImageInputInterface")] private static extern void GetRawButtonMaskImage(int id, IntPtr data, int width, int height); [DllImport("ImageInputInterface")] private static extern void GetRawButtonImage(int id, IntPtr data, int width, int height); [DllImport("ImageInputInterface")] private static extern void GetMaskDetectionOutput(IntPtr data, int width, int height); [DllImport("ImageInputInterface")] public static extern int GetRawImageArrayLenght(); [DllImport("ImageInputInterface")] public static extern int GetRawImageHeight(); [DllImport("ImageInputInterface")] public static extern int GetRawImageWidth(); public int mainThreadDeltaMs; public int boxThreadDeltaMs; public int blueThreshValue = 200; public int greenThreshValue = 200; public int redThreshValue = 200; void Awake() { Debug.Log("Initialized"); Init(mainThreadDeltaMs, boxThreadDeltaMs, blueThreshValue, greenThreshValue, redThreshValue); } void OnApplicationQuit() { Debug.Log("Finished"); Stop(); } public static int GetStatusFromModule() { return GetStatus(); } public static int GetMatTypeFromModule() { return GetMatType(); } public static double GetBoxValueFromModule(int id) { return GetBoxValue(id); } public static void SetBaseValuesFromModule() { SetBaseValues(); } public sealed class RawImageSession { private static RawImageSession instance = null; private static readonly object padlock = new object(); private Texture2D tex; private Color32[] pixel32; private GCHandle pixelHandle; private RawImageSession() { this.tex = new Texture2D( ImageInputInterface.GetRawImageWidth(), ImageInputInterface.GetRawImageHeight(), TextureFormat.ARGB32, false ); this.pixel32 = tex.GetPixels32(); this.pixelHandle = GCHandle.Alloc(this.pixel32, GCHandleType.Pinned); } ~RawImageSession() { this.pixelHandle.Free(); } public static RawImageSession GetInstance() { lock (padlock) { if (instance == null) { instance = new RawImageSession(); } return instance; } } public void UpdateRawImageBytes() { GetRawImage(this.pixelHandle.AddrOfPinnedObject(), this.tex.width, this.tex.height); this.tex.SetPixels32(this.pixel32); this.tex.Apply(); } public Texture2D GetCurrent2DTexture() { return this.tex; } } public sealed class RawMaskSession { private static RawMaskSession instance = null; private static readonly object padlock = new object(); private Texture2D tex; private Color32[] pixel32; private GCHandle pixelHandle; private RawMaskSession() { this.tex = new Texture2D( ImageInputInterface.GetRawImageWidth(), ImageInputInterface.GetRawImageHeight(), TextureFormat.ARGB32, false ); this.pixel32 = tex.GetPixels32(); this.pixelHandle = GCHandle.Alloc(this.pixel32, GCHandleType.Pinned); } ~RawMaskSession() { this.pixelHandle.Free(); } public static RawMaskSession GetInstance() { lock (padlock) { if (instance == null) { instance = new RawMaskSession(); } return instance; } } public void UpdateRawImageBytes() { GetMaskDetectionOutput(this.pixelHandle.AddrOfPinnedObject(), this.tex.width, this.tex.height); this.tex.SetPixels32(this.pixel32); this.tex.Apply(); } public Texture2D GetCurrent2DTexture() { return this.tex; } } public sealed class ButtonImageSession { private static SortedDictionary<int, ButtonImageSession> instances = null; private static readonly object padlock = new object(); private bool active; private int id; private Texture2D tex; private Color32[] pixel32; private GCHandle pixelHandle; private ButtonImageSession(int id) { this.id = id; this.tex = new Texture2D( ImageInputInterface.GetRawImageWidth(), ImageInputInterface.GetRawImageHeight(), TextureFormat.ARGB32, false ); this.pixel32 = tex.GetPixels32(); this.pixelHandle = GCHandle.Alloc(this.pixel32, GCHandleType.Pinned); AddBox(this.id); this.active = true; } ~ButtonImageSession() { this.Deactivate(); } public static ButtonImageSession GetInstance(int id) { lock (padlock) { if (instances == null) { instances = new SortedDictionary<int, ButtonImageSession>(); } if (!instances.ContainsKey(id)) { instances[id] = new ButtonImageSession(id); } else if (!instances[id].active) { instances[id] = new ButtonImageSession(id); } return instances[id]; } } public static void DeactivateAll() { if (instances != null) { foreach (var instance in instances) { instance.Value.Deactivate(); } } } public void Deactivate() { this.pixelHandle.Free(); RemoveBox(this.id); this.active = false; } public void UpdateRawMaskImageBytes() { GetRawButtonMaskImage(this.id, this.pixelHandle.AddrOfPinnedObject(), this.tex.width, this.tex.height); this.tex.SetPixels32(this.pixel32); this.tex.Apply(); } public void UpdateRawImageBytes() { GetRawButtonImage(this.id, this.pixelHandle.AddrOfPinnedObject(), this.tex.width, this.tex.height); this.tex.SetPixels32(this.pixel32); this.tex.Apply(); } public Texture2D GetCurrent2DTexture() { return this.tex; } public double GetValue() { return GetBoxValue(this.id); } } }
27.714777
144
0.573342
1e17c31c9eb7c6b0b62b2d2c3872121e6154389e
6,321
cs
C#
sdk/dotnet/CustomerInsights/GetPrediction.cs
pulumi-bot/pulumi-azure-native
f7b9490b5211544318e455e5cceafe47b628e12c
[ "Apache-2.0" ]
null
null
null
sdk/dotnet/CustomerInsights/GetPrediction.cs
pulumi-bot/pulumi-azure-native
f7b9490b5211544318e455e5cceafe47b628e12c
[ "Apache-2.0" ]
null
null
null
sdk/dotnet/CustomerInsights/GetPrediction.cs
pulumi-bot/pulumi-azure-native
f7b9490b5211544318e455e5cceafe47b628e12c
[ "Apache-2.0" ]
null
null
null
// *** 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.CustomerInsights { public static class GetPrediction { /// <summary> /// The prediction resource format. /// API Version: 2017-04-26. /// </summary> public static Task<GetPredictionResult> InvokeAsync(GetPredictionArgs args, InvokeOptions? options = null) => Pulumi.Deployment.Instance.InvokeAsync<GetPredictionResult>("azure-native:customerinsights:getPrediction", args ?? new GetPredictionArgs(), options.WithVersion()); } public sealed class GetPredictionArgs : Pulumi.InvokeArgs { /// <summary> /// The name of the hub. /// </summary> [Input("hubName", required: true)] public string HubName { get; set; } = null!; /// <summary> /// The name of the Prediction. /// </summary> [Input("predictionName", required: true)] public string PredictionName { get; set; } = null!; /// <summary> /// The name of the resource group. /// </summary> [Input("resourceGroupName", required: true)] public string ResourceGroupName { get; set; } = null!; public GetPredictionArgs() { } } [OutputType] public sealed class GetPredictionResult { /// <summary> /// Whether do auto analyze. /// </summary> public readonly bool AutoAnalyze; /// <summary> /// Description of the prediction. /// </summary> public readonly ImmutableDictionary<string, string>? Description; /// <summary> /// Display name of the prediction. /// </summary> public readonly ImmutableDictionary<string, string>? DisplayName; /// <summary> /// The prediction grades. /// </summary> public readonly ImmutableArray<Outputs.PredictionResponseGrades> Grades; /// <summary> /// Resource ID. /// </summary> public readonly string Id; /// <summary> /// Interaction types involved in the prediction. /// </summary> public readonly ImmutableArray<string> InvolvedInteractionTypes; /// <summary> /// KPI types involved in the prediction. /// </summary> public readonly ImmutableArray<string> InvolvedKpiTypes; /// <summary> /// Relationships involved in the prediction. /// </summary> public readonly ImmutableArray<string> InvolvedRelationships; /// <summary> /// Definition of the link mapping of prediction. /// </summary> public readonly Outputs.PredictionResponseMappings Mappings; /// <summary> /// Resource name. /// </summary> public readonly string Name; /// <summary> /// Negative outcome expression. /// </summary> public readonly string NegativeOutcomeExpression; /// <summary> /// Positive outcome expression. /// </summary> public readonly string PositiveOutcomeExpression; /// <summary> /// Name of the prediction. /// </summary> public readonly string? PredictionName; /// <summary> /// Primary profile type. /// </summary> public readonly string PrimaryProfileType; /// <summary> /// Provisioning state. /// </summary> public readonly string ProvisioningState; /// <summary> /// Scope expression. /// </summary> public readonly string ScopeExpression; /// <summary> /// Score label. /// </summary> public readonly string ScoreLabel; /// <summary> /// System generated entities. /// </summary> public readonly Outputs.PredictionResponseSystemGeneratedEntities SystemGeneratedEntities; /// <summary> /// The hub name. /// </summary> public readonly string TenantId; /// <summary> /// Resource type. /// </summary> public readonly string Type; [OutputConstructor] private GetPredictionResult( bool autoAnalyze, ImmutableDictionary<string, string>? description, ImmutableDictionary<string, string>? displayName, ImmutableArray<Outputs.PredictionResponseGrades> grades, string id, ImmutableArray<string> involvedInteractionTypes, ImmutableArray<string> involvedKpiTypes, ImmutableArray<string> involvedRelationships, Outputs.PredictionResponseMappings mappings, string name, string negativeOutcomeExpression, string positiveOutcomeExpression, string? predictionName, string primaryProfileType, string provisioningState, string scopeExpression, string scoreLabel, Outputs.PredictionResponseSystemGeneratedEntities systemGeneratedEntities, string tenantId, string type) { AutoAnalyze = autoAnalyze; Description = description; DisplayName = displayName; Grades = grades; Id = id; InvolvedInteractionTypes = involvedInteractionTypes; InvolvedKpiTypes = involvedKpiTypes; InvolvedRelationships = involvedRelationships; Mappings = mappings; Name = name; NegativeOutcomeExpression = negativeOutcomeExpression; PositiveOutcomeExpression = positiveOutcomeExpression; PredictionName = predictionName; PrimaryProfileType = primaryProfileType; ProvisioningState = provisioningState; ScopeExpression = scopeExpression; ScoreLabel = scoreLabel; SystemGeneratedEntities = systemGeneratedEntities; TenantId = tenantId; Type = type; } } }
31.924242
178
0.595001
1e184ed8ea321a6ecf4b19736bdd6c8be9712ab8
2,058
cs
C#
xZune.Bass/Interop/Core/Dx8Chorus.cs
higankanshi/xZune.Bass
cacacc288ac3a9b08c213676ab9b0d2d6eba2eb1
[ "WTFPL" ]
11
2016-02-15T14:20:25.000Z
2018-12-21T11:49:35.000Z
xZune.Bass/Interop/Core/Dx8Chorus.cs
higankanshi/xZune.Bass
cacacc288ac3a9b08c213676ab9b0d2d6eba2eb1
[ "WTFPL" ]
null
null
null
xZune.Bass/Interop/Core/Dx8Chorus.cs
higankanshi/xZune.Bass
cacacc288ac3a9b08c213676ab9b0d2d6eba2eb1
[ "WTFPL" ]
2
2016-02-19T05:34:21.000Z
2016-11-03T01:38:37.000Z
// Project: xZune.Bass (https://github.com/higankanshi/xZune.Bass) // Filename: Dx8Chorus.cs // Version: 20160216 using System.Runtime.InteropServices; using xZune.Bass.Interop.Flags; namespace xZune.Bass.Interop.Core { /// <summary> /// Used with <see cref="FXGetParameters" /> and <see cref="FXSetParameters" /> to retrieve and set the parameters of a /// DX8 chorus effect. /// </summary> [StructLayout(LayoutKind.Sequential)] public struct Dx8Chorus { /// <summary> /// Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from 0 through 100 (all wet). The /// default value is 50. /// </summary> public float WetDryMix; /// <summary> /// Percentage by which the delay time is modulated by the low-frequency oscillator (LFO). Must be in the range from 0 /// through 100. The default value is 10. /// </summary> public float Depth; /// <summary> /// Percentage of output signal to feed back into the effect's input, in the range from -99 to 99. The default value is /// 25. /// </summary> public float Feedback; /// <summary> /// Frequency of the LFO, in the range from 0 to 10. The default value is 1.1. /// </summary> public float Frequency; /// <summary> /// Waveform of the LFO... 0 = triangle, 1 = sine. By default, the waveform is sine. /// </summary> public uint WaveFormat; /// <summary> /// Number of milliseconds the input is delayed before it is played back, in the range from 0 to 20. The default value /// is 16 ms. /// </summary> public float Delay; /// <summary> /// Phase differential between left and right LFOs, one of <see cref="Dx8PhaseType" />. The default value is /// <see cref="Dx8PhaseType.Phase90" />. /// </summary> public uint Phase; } }
36.105263
131
0.580661
1e1883ff6c8b842de7666011eae77f0bb0b4450d
2,254
cs
C#
NActiviti/Sys.Bpm.Rest.API/events/integration/BaseIntegrationEventImpl.cs
zhangzihan/nactivity
89f9f17ddad95f76e1a6d9221810dab631db288e
[ "Apache-2.0" ]
62
2019-06-18T00:50:33.000Z
2021-11-25T03:13:27.000Z
NActiviti/Sys.Bpm.Rest.API/events/integration/BaseIntegrationEventImpl.cs
landonzeng/nactivity
239fb02082158ad86472f17d03d314f68bc807dd
[ "Apache-2.0" ]
20
2020-04-30T06:11:37.000Z
2022-03-02T04:29:23.000Z
NActiviti/Sys.Bpm.Rest.API/events/integration/BaseIntegrationEventImpl.cs
landonzeng/nactivity
239fb02082158ad86472f17d03d314f68bc807dd
[ "Apache-2.0" ]
18
2019-05-15T12:48:04.000Z
2021-08-03T07:42:06.000Z
/* * Copyright 2017 Alfresco, Inc. and/or its affiliates. * * 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 Sys.Workflow.Cloud.Services.Events.Integration { /// <summary> /// /// </summary> public abstract class BaseIntegrationEventImpl : AbstractProcessEngineEvent, IIntegrationEvent { /// <summary> /// /// </summary> public override abstract string EventType { get; } private readonly string integrationContextId; private readonly string flowNodeId; /// <summary> /// /// </summary> //used to deserialize from jsons public BaseIntegrationEventImpl() { } /// <summary> /// /// </summary> public BaseIntegrationEventImpl(string appName, string appVersion, string serviceName, string serviceFullName, string serviceType, string serviceVersion, string executionId, string processDefinitionId, string processInstanceId, string integrationContextId, string flowNodeId) : base(appName, appVersion, serviceName, serviceFullName, serviceType, serviceVersion, executionId, processDefinitionId, processInstanceId) { this.integrationContextId = integrationContextId; this.flowNodeId = flowNodeId; } /// <summary> /// /// </summary> public virtual string IntegrationContextId { get { return integrationContextId; } } /// <summary> /// /// </summary> public virtual string FlowNodeId { get { return flowNodeId; } } } }
28.175
423
0.616681
1e18a5336f730b497259e6abcc41d58cfff054e5
15,860
cs
C#
PdfSharp/PdfSharp.Pdf.AcroForms/PdfAcroField.cs
alexiej/YATE
378bf2e540f77f8363da0ac68056213462ffd7e1
[ "MS-PL" ]
18
2015-10-03T19:25:15.000Z
2021-08-18T03:56:51.000Z
PdfSharp/PdfSharp.Pdf.AcroForms/PdfAcroField.cs
alexiej/YATE
378bf2e540f77f8363da0ac68056213462ffd7e1
[ "MS-PL" ]
null
null
null
PdfSharp/PdfSharp.Pdf.AcroForms/PdfAcroField.cs
alexiej/YATE
378bf2e540f77f8363da0ac68056213462ffd7e1
[ "MS-PL" ]
7
2016-07-25T04:13:07.000Z
2021-08-18T03:56:56.000Z
#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange (mailto:Stefan.Lange@pdfsharp.com) // // Copyright (c) 2005-2009 empira Software GmbH, Cologne (Germany) // // http://www.pdfsharp.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.Diagnostics; using System.Collections; using PdfSharp.Pdf.Advanced; using PdfSharp.Pdf.Internal; namespace PdfSharp.Pdf.AcroForms { /// <summary> /// Represents the base class for all interactive field dictionaries. /// </summary> public abstract class PdfAcroField : PdfDictionary { /// <summary> /// Initializes a new instance of PdfAcroField. /// </summary> internal PdfAcroField(PdfDocument document) : base(document) { } /// <summary> /// Initializes a new instance of the <see cref="PdfAcroField"/> class. Used for type transformation. /// </summary> protected PdfAcroField(PdfDictionary dict) : base(dict) { } /// <summary> /// Gets the name of this field. /// </summary> public string Name { get { string name = Elements.GetString(Keys.T); return name; } } /// <summary> /// Gets the field flags of this instance. /// </summary> public PdfAcroFieldFlags Flags { // TODO: This entry is inheritable, thus the implementation is incorrect... id:102 gh:103 get { return (PdfAcroFieldFlags)Elements.GetInteger(Keys.Ff); } } internal PdfAcroFieldFlags SetFlags { get { return (PdfAcroFieldFlags)Elements.GetInteger(Keys.Ff); } set { Elements.SetInteger(Keys.Ff, (int)value); } } /// <summary> /// Gets or sets the value of the field. /// </summary> public PdfItem Value { get { return Elements[Keys.V]; } set { if (ReadOnly) throw new InvalidOperationException("The field is read only."); if (value is PdfString || value is PdfName) Elements[Keys.V] = value; else throw new NotImplementedException("Values other than string cannot be set."); } } /// <summary> /// Gets or sets a value indicating whether the field is read only. /// </summary> public bool ReadOnly { get { return (Flags & PdfAcroFieldFlags.ReadOnly) != 0; } set { if (value) SetFlags |= PdfAcroFieldFlags.ReadOnly; else SetFlags &= ~PdfAcroFieldFlags.ReadOnly; } } /// <summary> /// Gets the field with the specified name. /// </summary> public PdfAcroField this[string name] { get { return GetValue(name); } } /// <summary> /// Gets a child field by name. /// </summary> protected virtual PdfAcroField GetValue(string name) { if (name == null || name.Length == 0) return this; if (HasKids) return Fields.GetValue(name); return null; } /// <summary> /// Indicates whether the field has child fields. /// </summary> public bool HasKids { get { PdfItem item = Elements[Keys.Kids]; if (item == null) return false; if (item is PdfArray) return ((PdfArray)item).Elements.Count > 0; return false; } } /// <summary> /// Gets the names of all descendants of this field. /// </summary> public string[] DescendantNames { get { List<PdfName> names = new List<PdfName>(); if (HasKids) { PdfAcroFieldCollection fields = Fields; fields.GetDescendantNames(ref names, null); } List<string> temp = new List<string>(); foreach (PdfName name in names) temp.Add(name.ToString()); return temp.ToArray(); } } internal virtual void GetDescendantNames(ref List<PdfName> names, string partialName) { if (HasKids) { PdfAcroFieldCollection fields = Fields; string t = Elements.GetString(Keys.T); Debug.Assert(t != ""); if (t.Length > 0) { if (partialName != null && partialName.Length > 0) partialName += "." + t; else partialName = t; fields.GetDescendantNames(ref names, partialName); } } else { string t = Elements.GetString(Keys.T); Debug.Assert(t != ""); if (t.Length > 0) { if (!String.IsNullOrEmpty(partialName)) names.Add(new PdfName(partialName + "." + t)); else names.Add(new PdfName(t)); } } } /// <summary> /// Gets the collection of fields within this field. /// </summary> public PdfAcroField.PdfAcroFieldCollection Fields { get { if (this.fields == null) { object o = Elements.GetValue(Keys.Kids, VCF.CreateIndirect); this.fields = (PdfAcroField.PdfAcroFieldCollection)o; } return this.fields; } } PdfAcroField.PdfAcroFieldCollection fields; /// <summary> /// Holds a collection of interactive fields. /// </summary> public sealed class PdfAcroFieldCollection : PdfArray { PdfAcroFieldCollection(PdfArray array) : base(array) { } /// <summary> /// Gets the names of all fields in the collection. /// </summary> public string[] Names { get { int count = Elements.Count; string[] names = new string[count]; for (int idx = 0; idx < count; idx++) names[idx] = ((PdfDictionary)((PdfReference)Elements[idx]).Value).Elements.GetString(Keys.T); return names; } } /// <summary> /// Gets an array of all descendant names. /// </summary> public string[] DescendantNames { get { List<PdfName> names = new List<PdfName>(); GetDescendantNames(ref names, null); List<string> temp = new List<string>(); foreach (PdfName name in names) temp.Add(name.ToString()); return temp.ToArray(); } } internal void GetDescendantNames(ref List<PdfName> names, string partialName) { int count = Elements.Count; for (int idx = 0; idx < count; idx++) { PdfAcroField field = this[idx]; Debug.Assert(field != null); if (field != null) field.GetDescendantNames(ref names, partialName); } } /// <summary> /// Gets a field from the collection. For your convenience an instance of a derived class like /// PdfTextField or PdfCheckBox is returned if PDFsharp can guess the actual type of the dictionary. /// If the actual type cannot be guessed by PDFsharp the function returns an instance /// of PdfGenericField. /// </summary> public PdfAcroField this[int index] { get { PdfItem item = Elements[index]; Debug.Assert(item is PdfReference); PdfDictionary dict = ((PdfReference)item).Value as PdfDictionary; Debug.Assert(dict != null); PdfAcroField field = dict as PdfAcroField; if (field == null && dict != null) { // Do type transformation field = CreateAcroField(dict); //Elements[index] = field.XRef; } return field; } } /// <summary> /// Gets the field with the specified name. /// </summary> public PdfAcroField this[string name] { get { return GetValue(name); } } internal PdfAcroField GetValue(string name) { if (name == null || name.Length == 0) return null; int dot = name.IndexOf('.'); string prefix = dot == -1 ? name : name.Substring(0, dot); string suffix = dot == -1 ? "" : name.Substring(dot + 1); int count = Elements.Count; for (int idx = 0; idx < count; idx++) { PdfAcroField field = this[idx]; if (field.Name == prefix) return field.GetValue(suffix); } return null; } /// <summary> /// Create a derived type like PdfTextField or PdfCheckBox if possible. /// If the actual cannot be guessed by PDFsharp the function returns an instance /// of PdfGenericField. /// </summary> PdfAcroField CreateAcroField(PdfDictionary dict) { string ft = dict.Elements.GetName(Keys.FT); PdfAcroFieldFlags flags = (PdfAcroFieldFlags)dict.Elements.GetInteger(Keys.Ff); switch (ft) { case "/Btn": if ((flags & PdfAcroFieldFlags.Pushbutton) != 0) return new PdfPushButtonField(dict); else if ((flags & PdfAcroFieldFlags.Radio) != 0) return new PdfRadioButtonField(dict); else return new PdfCheckBoxField(dict); case "/Tx": return new PdfTextField(dict); case "/Ch": if ((flags & PdfAcroFieldFlags.Combo) != 0) return new PdfComboBoxField(dict); else return new PdfListBoxField(dict); case "/Sig": return new PdfSignatureField(dict); default: return new PdfGenericField(dict); } } } /// <summary> /// Predefined keys of this dictionary. /// The description comes from PDF 1.4 Reference. /// </summary> public class Keys : KeysBase { /// <summary> /// (Required for terminal fields; inheritable) The type of field that this dictionary /// describes: /// Btn Button /// Tx Text /// Ch Choice /// Sig (PDF 1.3) Signature /// Note: This entry may be present in a nonterminal field (one whose descendants /// are themselves fields) in order to provide an inheritable FT value. However, a /// nonterminal field does not logically have a type of its own; it is merely a container /// for inheritable attributes that are intended for descendant terminal fields of /// any type. /// </summary> [KeyInfo(KeyType.Name | KeyType.Required)] public const string FT = "/FT"; /// <summary> /// (Required if this field is the child of another in the field hierarchy; absent otherwise) /// The field that is the immediate parent of this one (the field, if any, whose Kids array /// includes this field). A field can have at most one parent; that is, it can be included /// in the Kids array of at most one other field. /// </summary> [KeyInfo(KeyType.Dictionary)] public const string Parent = "/Parent"; /// <summary> /// (Optional) An array of indirect references to the immediate children of this field. /// </summary> [KeyInfo(KeyType.Array | KeyType.Optional, typeof(PdfAcroField.PdfAcroFieldCollection))] public const string Kids = "/Kids"; /// <summary> /// (Optional) The partial field name. /// </summary> [KeyInfo(KeyType.TextString | KeyType.Optional)] public const string T = "/T"; /// <summary> /// (Optional; PDF 1.3) An alternate field name, to be used in place of the actual /// field name wherever the field must be identified in the user interface (such as /// in error or status messages referring to the field). This text is also useful /// when extracting the document�s contents in support of accessibility to disabled /// users or for other purposes. /// </summary> [KeyInfo(KeyType.TextString | KeyType.Optional)] public const string TU = "/TU"; /// <summary> /// (Optional; PDF 1.3) The mapping name to be used when exporting interactive form field /// data from the document. /// </summary> [KeyInfo(KeyType.TextString | KeyType.Optional)] public const string TM = "/TM"; /// <summary> /// (Optional; inheritable) A set of flags specifying various characteristics of the field. /// Default value: 0. /// </summary> [KeyInfo(KeyType.Integer | KeyType.Optional)] public const string Ff = "/Ff"; /// <summary> /// (Optional; inheritable) The field�s value, whose format varies depending on /// the field type; see the descriptions of individual field types for further information. /// </summary> [KeyInfo(KeyType.Various | KeyType.Optional)] public const string V = "/V"; /// <summary> /// (Optional; inheritable) The default value to which the field reverts when a /// reset-form action is executed. The format of this value is the same as that of V. /// </summary> [KeyInfo(KeyType.Various | KeyType.Optional)] public const string DV = "/DV"; /// <summary> /// (Optional; PDF 1.2) An additional-actions dictionary defining the field�s behavior /// in response to various trigger events. This entry has exactly the same meaning as /// the AA entry in an annotation dictionary. /// </summary> [KeyInfo(KeyType.Dictionary | KeyType.Optional)] public const string AA = "/AA"; // ----- Additional entries to all fields containing variable text -------------------------- /// <summary> /// (Required; inheritable) A resource dictionary containing default resources /// (such as fonts, patterns, or color spaces) to be used by the appearance stream. /// At a minimum, this dictionary must contain a Font entry specifying the resource /// name and font dictionary of the default font for displaying the field�s text. /// </summary> [KeyInfo(KeyType.Dictionary | KeyType.Required)] public const string DR = "/DR"; /// <summary> /// (Required; inheritable) The default appearance string, containing a sequence of /// valid page-content graphics or text state operators defining such properties as /// the field�s text size and color. /// </summary> [KeyInfo(KeyType.String | KeyType.Required)] public const string DA = "/DA"; /// <summary> /// (Optional; inheritable) A code specifying the form of quadding (justification) /// to be used in displaying the text: /// 0 Left-justified /// 1 Centered /// 2 Right-justified /// Default value: 0 (left-justified). /// </summary> [KeyInfo(KeyType.Integer | KeyType.Optional)] public const string Q = "/Q"; } } }
32.836439
106
0.597163
1e18c2c634e095a57cb94b7c470675351eac63bb
4,868
cs
C#
src/libraries/Common/src/System/Security/Cryptography/Asn1/Pkcs7/EncryptedContentInfoAsn.xml.cs
belav/runtime
bf1b5cca64a43d7e8d309fc74e83bcdf363c5090
[ "MIT" ]
null
null
null
src/libraries/Common/src/System/Security/Cryptography/Asn1/Pkcs7/EncryptedContentInfoAsn.xml.cs
belav/runtime
bf1b5cca64a43d7e8d309fc74e83bcdf363c5090
[ "MIT" ]
null
null
null
src/libraries/Common/src/System/Security/Cryptography/Asn1/Pkcs7/EncryptedContentInfoAsn.xml.cs
belav/runtime
bf1b5cca64a43d7e8d309fc74e83bcdf363c5090
[ "MIT" ]
null
null
null
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #pragma warning disable SA1028 // ignore whitespace warnings for generated code using System; using System.Formats.Asn1; using System.Runtime.InteropServices; namespace System.Security.Cryptography.Asn1.Pkcs7 { [StructLayout(LayoutKind.Sequential)] internal partial struct EncryptedContentInfoAsn { internal string ContentType; internal System.Security.Cryptography.Asn1.AlgorithmIdentifierAsn ContentEncryptionAlgorithm; internal ReadOnlyMemory<byte>? EncryptedContent; internal void Encode(AsnWriter writer) { Encode(writer, Asn1Tag.Sequence); } internal void Encode(AsnWriter writer, Asn1Tag tag) { writer.PushSequence(tag); try { writer.WriteObjectIdentifier(ContentType); } catch (ArgumentException e) { throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); } ContentEncryptionAlgorithm.Encode(writer); if (EncryptedContent.HasValue) { writer.WriteOctetString( EncryptedContent.Value.Span, new Asn1Tag(TagClass.ContextSpecific, 0) ); } writer.PopSequence(tag); } internal static EncryptedContentInfoAsn Decode( ReadOnlyMemory<byte> encoded, AsnEncodingRules ruleSet ) { return Decode(Asn1Tag.Sequence, encoded, ruleSet); } internal static EncryptedContentInfoAsn Decode( Asn1Tag expectedTag, ReadOnlyMemory<byte> encoded, AsnEncodingRules ruleSet ) { try { AsnValueReader reader = new AsnValueReader(encoded.Span, ruleSet); DecodeCore(ref reader, expectedTag, encoded, out EncryptedContentInfoAsn decoded); reader.ThrowIfNotEmpty(); return decoded; } catch (AsnContentException e) { throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); } } internal static void Decode( ref AsnValueReader reader, ReadOnlyMemory<byte> rebind, out EncryptedContentInfoAsn decoded ) { Decode(ref reader, Asn1Tag.Sequence, rebind, out decoded); } internal static void Decode( ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory<byte> rebind, out EncryptedContentInfoAsn decoded ) { try { DecodeCore(ref reader, expectedTag, rebind, out decoded); } catch (AsnContentException e) { throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); } } private static void DecodeCore( ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory<byte> rebind, out EncryptedContentInfoAsn decoded ) { decoded = default; AsnValueReader sequenceReader = reader.ReadSequence(expectedTag); ReadOnlySpan<byte> rebindSpan = rebind.Span; int offset; ReadOnlySpan<byte> tmpSpan; decoded.ContentType = sequenceReader.ReadObjectIdentifier(); System.Security.Cryptography.Asn1.AlgorithmIdentifierAsn.Decode( ref sequenceReader, rebind, out decoded.ContentEncryptionAlgorithm ); if ( sequenceReader.HasData && sequenceReader .PeekTag() .HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 0)) ) { if ( sequenceReader.TryReadPrimitiveOctetString( out tmpSpan, new Asn1Tag(TagClass.ContextSpecific, 0) ) ) { decoded.EncryptedContent = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray(); } else { decoded.EncryptedContent = sequenceReader.ReadOctetString( new Asn1Tag(TagClass.ContextSpecific, 0) ); } } sequenceReader.ThrowIfNotEmpty(); } } }
32.026316
101
0.549096
1e1a657058f85b7a96851a85c3d18a0fef02bbdf
4,276
cs
C#
WWCP_OICPv2.3/DataTypes/Enums/RFIDTypes.cs
OpenChargingCloud/WWCP_OICP
a245e7b9ae0cdcd46002adbf5d45761af5accabd
[ "Apache-2.0" ]
4
2016-12-25T13:52:49.000Z
2020-10-18T12:03:29.000Z
WWCP_OICPv2.3/DataTypes/Enums/RFIDTypes.cs
OpenChargingCloud/WWCP_OICP
a245e7b9ae0cdcd46002adbf5d45761af5accabd
[ "Apache-2.0" ]
null
null
null
WWCP_OICPv2.3/DataTypes/Enums/RFIDTypes.cs
OpenChargingCloud/WWCP_OICP
a245e7b9ae0cdcd46002adbf5d45761af5accabd
[ "Apache-2.0" ]
1
2021-09-17T19:24:16.000Z
2021-09-17T19:24:16.000Z
/* * Copyright (c) 2014-2021 GraphDefined GmbH * This file is part of WWCP OICP <https://github.com/OpenChargingCloud/WWCP_OICP> * * 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. */ #region Usings using System; #endregion namespace cloud.charging.open.protocols.OICPv2_3 { /// <summary> /// Extentions methods for RFID types. /// </summary> public static class RFIDTypesExtentions { #region Parse (Text) /// <summary> /// Parses the given text-representation of a RFID type. /// </summary> /// <param name="Text">A text-representation of a RFID type.</param> public static RFIDTypes Parse(String Text) { if (TryParse(Text, out RFIDTypes rfidType)) return rfidType; throw new ArgumentException("Undefined RFID type '" + Text + "'!"); } #endregion #region TryParse(Text) /// <summary> /// Parses the given text-representation of a RFID type. /// </summary> /// <param name="Text">A text-representation of a RFID type.</param> public static RFIDTypes? TryParse(String Text) { if (TryParse(Text, out RFIDTypes rfidType)) return rfidType; return default; } #endregion #region TryParse(Text, out RFIDType) /// <summary> /// Parses the given text-representation of a RFID type. /// </summary> /// <param name="Text">A text-representation of a RFID type.</param> /// <param name="RFIDType">The parsed RFID type.</param> public static Boolean TryParse(String Text, out RFIDTypes RFIDType) { switch (Text?.Trim()) { case "mifareCls": RFIDType = RFIDTypes.MifareClassic; return true; case "mifareDes": RFIDType = RFIDTypes.MifareDESFire; return true; case "calypso": RFIDType = RFIDTypes.Calypso; return true; case "nfc": RFIDType = RFIDTypes.NFC; return true; case "mifareFamily": RFIDType = RFIDTypes.MifareFamily; return true; default: RFIDType = RFIDTypes.MifareFamily; return false; }; } #endregion #region AsString(RFIDType) /// <summary> /// Return a text-representation of the given RFID type. /// </summary> /// <param name="RFIDType">A RFID type.</param> public static String AsString(this RFIDTypes RFIDType) => RFIDType switch { RFIDTypes.MifareClassic => "mifareCls", RFIDTypes.MifareDESFire => "mifareDes", RFIDTypes.Calypso => "calypso", RFIDTypes.NFC => "nfc", RFIDTypes.MifareFamily => "mifareFamily", _ => "unknown", }; #endregion } /// <summary> /// RFID types. /// </summary> public enum RFIDTypes { /// <summary> /// MiFare classic. /// </summary> MifareClassic, /// <summary> /// MiFare DESFire. /// </summary> MifareDESFire, /// <summary> /// Calypso. /// </summary> Calypso, /// <summary> /// NFC. /// </summary> NFC, /// <summary> /// MiFare family. /// </summary> MifareFamily } }
25.915152
82
0.521749
1e1cb9fb9d8c014f3689f29b86f60fa4963e886d
2,104
cs
C#
src/Workspaces/Core/Portable/PatternMatching/SimplePatternMatcher.cs
frandesc/roslyn
72a99a8279c9ccbb2ef3a99d5a8bf116a14ebf3b
[ "MIT" ]
17,923
2015-01-14T23:40:37.000Z
2022-03-31T18:10:52.000Z
src/Workspaces/Core/Portable/PatternMatching/SimplePatternMatcher.cs
open-dotnet/roslyn
2e26701b0d1cb1a902a24f4ad8b8c5fe70514581
[ "MIT" ]
48,991
2015-01-15T00:29:35.000Z
2022-03-31T23:48:56.000Z
src/Workspaces/Core/Portable/PatternMatching/SimplePatternMatcher.cs
open-dotnet/roslyn
2e26701b0d1cb1a902a24f4ad8b8c5fe70514581
[ "MIT" ]
5,209
2015-01-14T23:40:24.000Z
2022-03-30T20:15:03.000Z
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Globalization; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Collections; namespace Microsoft.CodeAnalysis.PatternMatching { internal partial class PatternMatcher { private sealed partial class SimplePatternMatcher : PatternMatcher { private PatternSegment _fullPatternSegment; public SimplePatternMatcher( string pattern, CultureInfo culture, bool includeMatchedSpans, bool allowFuzzyMatching) : base(includeMatchedSpans, culture, allowFuzzyMatching) { pattern = pattern.Trim(); _fullPatternSegment = new PatternSegment(pattern, allowFuzzyMatching); _invalidPattern = _fullPatternSegment.IsInvalid; } public override void Dispose() { base.Dispose(); _fullPatternSegment.Dispose(); } /// <summary> /// Determines if a given candidate string matches under a multiple word query text, as you /// would find in features like Navigate To. /// </summary> /// <returns>If this was a match, a set of match types that occurred while matching the /// patterns. If it was not a match, it returns null.</returns> public override bool AddMatches(string candidate, ref TemporaryArray<PatternMatch> matches) { if (SkipMatch(candidate)) { return false; } return MatchPatternSegment(candidate, in _fullPatternSegment, ref matches, fuzzyMatch: false) || MatchPatternSegment(candidate, in _fullPatternSegment, ref matches, fuzzyMatch: true); } } } }
36.912281
112
0.60884
1e1e6381c46b6059d0c487d71f09b3fbbb7c28e8
1,510
cs
C#
Assets/Scripts/Enemigos/Enemy.cs
XenMoros/ProjectAlpaca
0eab5a670a6d385a4e2cfa1463a04bb66b0fbbd3
[ "MIT" ]
1
2022-01-20T23:56:32.000Z
2022-01-20T23:56:32.000Z
Assets/Scripts/Enemigos/Enemy.cs
XenMoros/ProjectAlpaca
0eab5a670a6d385a4e2cfa1463a04bb66b0fbbd3
[ "MIT" ]
null
null
null
Assets/Scripts/Enemigos/Enemy.cs
XenMoros/ProjectAlpaca
0eab5a670a6d385a4e2cfa1463a04bb66b0fbbd3
[ "MIT" ]
null
null
null
using UnityEngine; public class Enemy : MonoBehaviour, IActivable { // Clase padre de todos los enemigos public bool pausa = true, active = true; // Los enemigos pueden pausarse o estar desactivados public EnemyManager enemyManager; // El manager de enemigos public enum TipoEnemigo { Guardia, Camara}; public TipoEnemigo tipoEnemigo; private void OnEnable() { StaticManager.OnPauseChange += SetPause; } private void OnDisable() { StaticManager.OnPauseChange -= SetPause; } public virtual void SetPause() { // Funcion para poner la pausa segun la clase estatica pausa = StaticManager.pause; } public virtual void SetActivationState(bool activateState) { // Activar o desactivar el enemigo segun entrada active = activateState; } public void SetActivationState() { // Activar el enemigo (sin entrada se activa automaticamente) SetActivationState(true); } public void SetActivationState(int activateState) { // Activar enemigo segun entrada numerica, 0 desactivado sino activado if (activateState > 0) { SetActivationState(true); } SetActivationState(false); } public void SetEnemyManager(EnemyManager manager) { // Set de el enemyManager segun entrada enemyManager = manager; } public virtual void AlertarEnemigo(Vector3 position) { } }
27.454545
98
0.646358
1e1ee98c74b40db0c874db9498a896442907e070
11,324
cs
C#
Telerik.Sitefinity.Frontend/Mvc/Infrastructure/Routing/UrlParamsMapperBase.cs
Sitefinity/feather
036ee2054f076281cae79ce54103f5eb1eba5242
[ "Apache-2.0" ]
89
2015-01-06T14:03:34.000Z
2021-11-22T21:34:54.000Z
Telerik.Sitefinity.Frontend/Mvc/Infrastructure/Routing/UrlParamsMapperBase.cs
Sitefinity/feather
036ee2054f076281cae79ce54103f5eb1eba5242
[ "Apache-2.0" ]
1,643
2015-01-06T09:48:36.000Z
2022-01-27T20:02:02.000Z
Telerik.Sitefinity.Frontend/Mvc/Infrastructure/Routing/UrlParamsMapperBase.cs
Sitefinity/feather
036ee2054f076281cae79ce54103f5eb1eba5242
[ "Apache-2.0" ]
84
2015-01-06T08:35:07.000Z
2021-05-17T14:00:48.000Z
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Web.Mvc; using System.Web.Routing; using Telerik.Sitefinity.Abstractions; using Telerik.Sitefinity.Configuration; namespace Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing { /// <summary> /// A base URL params mapper that provides responsibility chain logic. /// </summary> internal abstract class UrlParamsMapperBase : IUrlParamsMapper { /// <summary> /// Initializes a new instance of the <see cref="UrlParamsMapperBase"/> class. /// </summary> /// <param name="controller">The controller.</param> public UrlParamsMapperBase(ControllerBase controller) { this.Controller = controller; } /// <summary> /// Gets a value indicating whether to require parameter naming in the widget routings. /// </summary> /// <value> /// <c>true</c> if the routes will work only with named params (e.g /tag/sofia/page/2); otherwise, <c>false</c> when the route will be /sofia/2. /// </value> public static bool UseNamedParametersRouting { get { return Config.Get<FeatherConfig>().UseNamedParametersRouting; } } /// <inheritdoc /> public IUrlParamsMapper Next { get { return this.next; } } /// <inheritdoc /> public IUrlParamsMapper SetNext(IUrlParamsMapper nextResolver) { this.next = nextResolver; return this.Next; } /// <inheritdoc /> public void ResolveUrlParams(string[] urlParams, RequestContext requestContext) { this.ResolveUrlParams(urlParams, requestContext, null); } /// <inheritdoc /> public void ResolveUrlParams(string[] urlParams, RequestContext requestContext, string urlKeyPrefix) { var isMatch = this.TryMatchUrl(urlParams, requestContext, urlKeyPrefix); if (!isMatch && this.Next != null) this.Next.ResolveUrlParams(urlParams, requestContext, urlKeyPrefix); } /// <summary> /// Gets the controller. /// </summary> /// <value> /// The controller. /// </value> protected ControllerBase Controller { get; private set; } /// <summary> /// Creates parameter map in order to map the URL parameters to the provided URL template /// </summary> /// <param name="actionMethod">The action method.</param> /// <param name="metaParams">The meta parameters.</param> /// <param name="urlParams">The URL parameters.</param> /// <param name="urlParamNames">The URL parameter names.</param> /// <returns></returns> protected virtual IList<UrlSegmentInfo> MapParams(MethodInfo actionMethod, string[] metaParams, string[] urlParams, string[] urlParamNames) { var useNamedParams = UrlParamsMapperBase.UseNamedParametersRouting; if (!useNamedParams && (metaParams.Length != urlParams.Length || metaParams.Length != urlParamNames.Length)) return null; if (useNamedParams && ((2 * metaParams.Length) != urlParams.Length || metaParams.Length != urlParamNames.Length)) return null; var parameterInfos = new List<UrlSegmentInfo>(); for (int i = 0; i < urlParamNames.Length; i++) { string currentParam = useNamedParams ? this.MapNamedParam(urlParams, urlParamNames[i], i) : urlParams[i]; if (metaParams[i].Length > 2 && metaParams[i].First() == '{' && metaParams[i].Last() == '}') { var routeParam = metaParams[i].Sub(1, metaParams[i].Length - 2); routeParam = useNamedParams ? this.MapNamedRouteParam(urlParams, urlParamNames[i], i, routeParam) : routeParam; if (!this.TryResolveRouteParam(actionMethod, routeParam, currentParam, parameterInfos)) return null; } else if (!string.Equals(metaParams[i], currentParam, StringComparison.OrdinalIgnoreCase)) { return null; } } return parameterInfos; } /// <summary> /// Maps the URL parameter to a value from the provided URL template /// </summary> /// <param name="urlParams">The URL parameters.</param> /// <param name="urlParamName">The URL parameter name.</param> /// <param name="paramNameIndex">The index of the named parameter in the URL.</param> /// <returns></returns> protected virtual string MapNamedParam(string[] urlParams, string urlParamName, int paramNameIndex) { string currentParam; var urlParamActualIndex = 2 * paramNameIndex; if (urlParamName != FeatherActionInvoker.TaxonNamedParamter) { var namedParamIndex = Array.IndexOf(urlParams, urlParamName); if (namedParamIndex == -1 || urlParams.Length < namedParamIndex) return null; currentParam = urlParams[namedParamIndex + 1]; } else if (urlParamName == FeatherActionInvoker.TaxonNamedParamter && urlParams.Length > (urlParamActualIndex + 1)) { // in this case, in the url will be presented the name of the taxonomy, ex. tag/tag1/page/2 ; category/cat1/page/2 currentParam = urlParams[urlParamActualIndex + 1]; var taxonomyName = urlParams[urlParamActualIndex]; if (taxonomyName.ToLowerInvariant() == "categories") taxonomyName = "category"; if (taxonomyName.ToLowerInvariant() == "tags") taxonomyName = "tag"; var isResolverRegistered = ObjectFactory.IsTypeRegistered<IRouteParamResolver>(taxonomyName.ToLowerInvariant()); if (!isResolverRegistered) return null; } else return null; return currentParam; } /// <summary> /// Maps the classification URL parameter to a value from the provided URL template /// </summary> /// <param name="urlParams">The URL parameters.</param> /// <param name="urlParamName">The URL parameter name.</param> /// <param name="paramNameIndex">The index of the named parameter in the URL.</param> /// <param name="routeParam">The value of the route param from meta params.</param> /// <returns></returns> protected virtual string MapNamedRouteParam(string[] urlParams, string urlParamName, int paramNameIndex, string routeParam) { var urlParamActualIndex = 2 * paramNameIndex; if (routeParam.IndexOf(":") > 0 && urlParamName == FeatherActionInvoker.TaxonNamedParamter && urlParams.Length > (urlParamActualIndex + 1)) { // in this case, in the url will be presented the name of the taxonomy, ex. tag/tag1/page/2 ; category/cat1/page/2 var taxonomyName = urlParams[urlParamActualIndex]; if (taxonomyName.ToLowerInvariant() == "categories") taxonomyName = "category"; if (taxonomyName.ToLowerInvariant() == "tags") taxonomyName = "tag"; var isResolverRegistered = ObjectFactory.IsTypeRegistered<IRouteParamResolver>(taxonomyName.ToLowerInvariant()); if (!isResolverRegistered) return null; var parts = routeParam.Split(':'); return parts[0] + ":" + taxonomyName; } return routeParam; } /// <summary> /// Tries to resolve route parameters and map them to specific part of the url. /// </summary> /// <remarks> /// If needed tries to interpret the route value through <see cref="Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing.IRouteParamResolver"/> /// </remarks> /// <param name="actionMethod">The action method.</param> /// <param name="routeParam">The route parameter.</param> /// <param name="urlParam">The URL parameter.</param> /// <param name="parameterInfos">The parameter info.</param> /// <returns></returns> protected bool TryResolveRouteParam(MethodInfo actionMethod, string routeParam, string urlParam, IList<UrlSegmentInfo> parameterInfos) { if (routeParam.IsNullOrEmpty()) return false; var parts = routeParam.Split(':'); var paramName = parts[0]; object paramValue = urlParam; if (parts.Length >= 2) { var actionParam = actionMethod.GetParameters().FirstOrDefault(p => p.Name == paramName); if (actionParam != null) { var routeConstraints = parts[1] .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(r => r.Trim()); IRouteParamResolver first = null; IRouteParamResolver last = null; foreach (var resolverName in routeConstraints) { var resolver = ObjectFactory.Resolve<IRouteParamResolver>(resolverName); if (resolver != null) { if (last != null) { last = last.SetNext(resolver); } else { first = last = resolver; } } } if (first == null || first.TryResolveParam(urlParam, out paramValue) == false) return false; } } var paramInfo = new UrlSegmentInfo(); paramInfo.ParameterName = paramName; if (parts.Length >= 2) { paramInfo.ResolverName = parts[1]; } paramInfo.ParameterValue = paramValue; parameterInfos.Add(paramInfo); return true; } /// <summary> /// Matches the URL parameters. /// </summary> /// <param name="urlParams">The URL parameters.</param> /// <param name="requestContext">The request context.</param> /// <param name="urlKeyPrefix">The URL key prefix.</param> /// <returns>true if resolving was successful. In this case does not fallback to next mappers. Else returns false</returns> protected abstract bool TryMatchUrl(string[] urlParams, RequestContext requestContext, string urlKeyPrefix); /// <summary> /// The action name key for the RouteData values. /// </summary> protected const string ActionNameKey = "action"; private IUrlParamsMapper next; } }
41.940741
153
0.565525
1e1ef09fcf2780a789504b591778373e3d28a423
2,175
cs
C#
BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs
tustin2121/tpp-BizHawk2
5fc985ef61044799753fced4489b534524523666
[ "MIT" ]
29
2017-10-25T15:16:23.000Z
2021-02-23T04:49:18.000Z
BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs
tustin2121/tpp-BizHawk2
5fc985ef61044799753fced4489b534524523666
[ "MIT" ]
1
2021-06-08T10:20:02.000Z
2021-06-08T10:20:02.000Z
BizHawk.Client.Common/tools/Watch/SeparatorWatch.cs
tustin2121/tpp-BizHawk2
5fc985ef61044799753fced4489b534524523666
[ "MIT" ]
9
2017-10-29T05:28:15.000Z
2020-03-24T02:11:01.000Z
using System.Collections.Generic; namespace BizHawk.Client.Common { /// <summary> /// This class holds a separator for RamWatch /// Use the static property Instance to get it /// </summary> public sealed class SeparatorWatch : Watch { /// <summary> /// Initializes a new instance of the <see cref="SeparatorWatch"/> class. /// </summary> internal SeparatorWatch() : base(null, 0, WatchSize.Separator, DisplayType.Separator, true, "") { } /// <summary> /// Gets the separator instance /// </summary> public static SeparatorWatch Instance => new SeparatorWatch(); /// <summary> /// Get the appropriate DisplayType /// </summary> /// <returns>DisplayType.Separator nothing else</returns> public override IEnumerable<DisplayType> AvailableTypes() { yield return DisplayType.Separator; } /// <summary> /// Ignore that stuff /// </summary> public override int Value => 0; /// <summary> /// Ignore that stuff /// </summary> public override int ValueNoFreeze => 0; /// <summary> /// Ignore that stuff /// </summary> public override int Previous => 0; /// <summary> /// Ignore that stuff /// </summary> public override string ValueString => ""; /// <summary> /// Ignore that stuff /// </summary> public override string PreviousStr => ""; /// <summary> /// TTransform the current instance into a displayable (short representation) string /// It's used by the "Display on screen" option in the RamWatch window /// </summary> /// <returns>A well formatted string representation</returns> public override string ToDisplayString() { return "----"; } /// <summary> /// Ignore that stuff /// </summary> public override bool Poke(string value) { return false; } /// <summary> /// Ignore that stuff /// </summary> public override void ResetPrevious() { } /// <summary> /// Ignore that stuff /// </summary> public override string Diff => ""; /// <summary> /// Ignore that stuff /// </summary> public override uint MaxValue => 0; /// <summary> /// Ignore that stuff /// </summary> public override void Update() { } } }
21.534653
86
0.634943

No dataset card yet

New: Create and edit this dataset card directly on the website!

Contribute a Dataset Card
Downloads last month
0
Add dataset card