content
stringlengths 5
1.04M
| avg_line_length
float64 1.75
12.9k
| max_line_length
int64 2
244k
| alphanum_fraction
float64 0
0.98
| licenses
sequence | repository_name
stringlengths 7
92
| path
stringlengths 3
249
| size
int64 5
1.04M
| lang
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|
using System.Drawing;
using System.Runtime.InteropServices;
using PaintDotNet;
namespace ComputeShaderEffects
{
public abstract class DualPassComputeShaderBase : TiledComputeShaderBase
{
private int _pass;
public int Passes { get; set; }
protected DualPassComputeShaderBase(string name, Image image, string subMenuName, PaintDotNet.Effects.EffectFlags flags)
: base(name, image, subMenuName, flags)
{
Passes = 2;
}
protected virtual void OnBeginPass(int pass, RenderArgs dstArgs, RenderArgs srcArgs)
{
}
protected override void OnPreRender(RenderArgs dstArgs, RenderArgs srcArgs)
{
base.OnPreRender(dstArgs, srcArgs);
}
protected virtual void OnPreRenderComplete(RenderArgs dstArgs, RenderArgs srcArgs)
{
Rectangle[] rois;
Surface surfaceCopy;
RenderArgs args;
RenderArgs currentSourceArgs;
RenderArgs currentDestinationArgs;
Rectangle boundingTile;
if (FullImageSelected(srcArgs.Bounds))
{
boundingTile = dstArgs.Bounds;
}
else
{
boundingTile = EnvironmentParameters.SelectionBounds;
boundingTile.Inflate(ApronSize, ApronSize);
boundingTile.Intersect(dstArgs.Bounds);
}
rois = SliceRectangles(new Rectangle[] { boundingTile });
surfaceCopy = new Surface(dstArgs.Width, dstArgs.Height, SurfaceCreationFlags.DoNotZeroFillHint);
args = new RenderArgs(surfaceCopy);
currentSourceArgs = srcArgs;
currentDestinationArgs = args;
_pass = 1;
OnBeginPass(_pass, currentDestinationArgs, currentSourceArgs);
OnRenderRegion(rois, currentDestinationArgs, currentSourceArgs);
if (Passes == 1)
{
CopyRois(EnvironmentParameters.GetSelectionAsPdnRegion().GetRegionScansReadOnlyInt(),
dstArgs.Surface,
surfaceCopy);
surfaceCopy.Dispose();
}
else
{
if (_tmr != null)
{
_tmr = new System.Diagnostics.Stopwatch();
_tmr.Start();
}
_pass = 2;
if (FullImageSelected(srcArgs.Bounds))
{
currentSourceArgs = args;
currentDestinationArgs = dstArgs;
OnBeginPass(_pass, currentDestinationArgs, currentSourceArgs);
OnRenderRegion(rois, currentDestinationArgs, currentSourceArgs);
surfaceCopy.Dispose();
}
else
{
Surface surfaceCopy2 = new Surface(dstArgs.Width, dstArgs.Height, SurfaceCreationFlags.DoNotZeroFillHint);
RenderArgs args2 = new RenderArgs(surfaceCopy2);
currentSourceArgs = args;
currentDestinationArgs = args2;
OnBeginPass(_pass, currentDestinationArgs, currentSourceArgs);
OnRenderRegion(rois, currentDestinationArgs, currentSourceArgs);
surfaceCopy.Dispose();
CopyRois(EnvironmentParameters.GetSelectionAsPdnRegion().GetRegionScansReadOnlyInt(),
dstArgs.Surface,
surfaceCopy2);
surfaceCopy2.Dispose();
}
}
}
protected override sealed void OnRender(Rectangle[] rois, int startIndex, int length)
{
}
private unsafe void CopyRois(Rectangle[] rois, Surface dest, Surface source)
{
int COLOR_SIZE = Marshal.SizeOf(typeof(ColorBgra));
foreach (Rectangle copyRect in rois)
{
int length = copyRect.Width * COLOR_SIZE;
for (int y = copyRect.Top; y < copyRect.Bottom; y++)
{
BufferUtil.Copy(dest.GetPointPointer(copyRect.Left, y), source.GetPointPointer(copyRect.Left, y), length);
}
}
}
}
}
| 34.18254 | 128 | 0.557 | [
"MIT"
] | bbowyersmyth/ComputeShaderEffects | ComputeShaderEffects/DualPassComputeShaderBase.cs | 4,309 | C# |
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated code. DO NOT EDIT!
namespace Google.Cloud.Dialogflow.Cx.V3.Snippets
{
// [START dialogflow_v3_generated_Pages_CreatePage_async_flattened_resourceNames]
using Google.Cloud.Dialogflow.Cx.V3;
using System.Threading.Tasks;
public sealed partial class GeneratedPagesClientSnippets
{
/// <summary>Snippet for CreatePageAsync</summary>
/// <remarks>
/// This snippet has been automatically generated for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </remarks>
public async Task CreatePageResourceNamesAsync()
{
// Create client
PagesClient pagesClient = await PagesClient.CreateAsync();
// Initialize request argument(s)
FlowName parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
Page page = new Page();
// Make the request
Page response = await pagesClient.CreatePageAsync(parent, page);
}
}
// [END dialogflow_v3_generated_Pages_CreatePage_async_flattened_resourceNames]
}
| 40.534884 | 116 | 0.695353 | [
"Apache-2.0"
] | AlexandrTrf/google-cloud-dotnet | apis/Google.Cloud.Dialogflow.Cx.V3/Google.Cloud.Dialogflow.Cx.V3.GeneratedSnippets/PagesClient.CreatePageResourceNamesAsyncSnippet.g.cs | 1,743 | C# |
// Copyright 2010 the V8 project authors. All rights reserved.
// Copyright 2011-2012, Kevin Ring. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
namespace Yuzu.Grisu
{
public static class DoubleWriter
{
[ThreadStatic]
private static byte[] ts_decimal_rep;
private static byte[] infinity_symbol_ = Encoding.ASCII.GetBytes("Infinity");
private static byte[] nan_symbol_ = Encoding.ASCII.GetBytes("NaN");
private const byte exponent_character_ = (byte)'E';
public static void Write(double value, BinaryWriter writer)
{
if (double.IsNaN(value)) {
writer.Write(nan_symbol_);
return;
}
if (double.IsInfinity(value)) {
if (value < 0)
writer.Write((byte)'-');
writer.Write(infinity_symbol_);
return;
}
if (value == 0.0) {
writer.Write((byte)'0');
return;
}
if (value < 0.0) {
writer.Write((byte)'-');
value = -value;
}
byte[] decimal_rep = ts_decimal_rep;
if (decimal_rep == null)
decimal_rep = ts_decimal_rep = new byte[kBase10MaximalLength + 1];
GrisuDouble v = new GrisuDouble(value);
DiyFp w = v.AsNormalizedDiyFp();
// boundary_minus and boundary_plus are the boundaries between v and its
// closest floating-point neighbors. Any number strictly between
// boundary_minus and boundary_plus will round to v when convert to a double.
// Grisu3 will never output representations that lie exactly on a boundary.
DiyFp boundary_minus, boundary_plus;
v.NormalizedBoundaries(out boundary_minus, out boundary_plus);
int decimal_rep_length;
int decimal_exponent;
if (Grisu3(w, boundary_minus, boundary_plus, decimal_rep, out decimal_rep_length, out decimal_exponent))
CreateRepresentation(decimal_rep, decimal_rep_length, decimal_rep_length + decimal_exponent, writer);
else
writer.Write(Encoding.ASCII.GetBytes(value.ToString("R", CultureInfo.InvariantCulture)));
}
public static void Write(float value, BinaryWriter writer)
{
if (float.IsNaN(value)) {
writer.Write(nan_symbol_);
return;
}
if (float.IsInfinity(value)) {
if (value < 0)
writer.Write((byte)'-');
writer.Write(infinity_symbol_);
return;
}
if (value == 0.0) {
writer.Write((byte)'0');
return;
}
if (value < 0.0) {
writer.Write((byte)'-');
value = -value;
}
byte[] decimal_rep = ts_decimal_rep;
if (decimal_rep == null)
decimal_rep = ts_decimal_rep = new byte[kBase10MaximalLength + 1];
GrisuDouble v = new GrisuDouble((double)value);
DiyFp w = v.AsNormalizedDiyFp();
// boundary_minus and boundary_plus are the boundaries between v and its
// closest floating-point neighbors. Any number strictly between
// boundary_minus and boundary_plus will round to v when convert to a double.
// Grisu3 will never output representations that lie exactly on a boundary.
DiyFp boundary_minus, boundary_plus;
(new GrisuSingle(value)).NormalizedBoundaries(out boundary_minus, out boundary_plus);
int decimal_rep_length;
int decimal_exponent;
if (Grisu3(w, boundary_minus, boundary_plus, decimal_rep, out decimal_rep_length, out decimal_exponent))
CreateRepresentation(decimal_rep, decimal_rep_length, decimal_rep_length + decimal_exponent, writer);
else
writer.Write(Encoding.ASCII.GetBytes(value.ToString("R", CultureInfo.InvariantCulture)));
}
private static void CreateRepresentation(
byte[] decimal_rep, int decimal_rep_length, int decimal_point, BinaryWriter writer)
{
int decimalRepLength = decimal_rep_length;
if (decimal_point < 1)
decimalRepLength += -decimal_point + 1;
else if (decimal_point >= decimal_rep_length)
decimalRepLength += decimal_point - decimal_rep_length + 1;
int exponent = decimal_point - 1;
int absExponent = Math.Abs(exponent);
int exponentRepLength = decimal_rep_length + 3;
if (exponent < 0)
++exponentRepLength;
if (absExponent >= 10) {
++exponentRepLength;
if (absExponent >= 100)
++exponentRepLength;
}
if (decimalRepLength <= exponentRepLength)
CreateDecimalRepresentation(
decimal_rep, decimal_rep_length, decimal_point,
Math.Max(0, decimal_rep_length - decimal_point),
writer);
else
CreateExponentialRepresentation(decimal_rep, decimal_rep_length, exponent, writer);
}
// The maximal number of digits that are needed to emit a double in base 10.
// A higher precision can be achieved by using more digits, but the shortest
// accurate representation of any double will never use more digits than
// kBase10MaximalLength.
// Note that DoubleToAscii null-terminates its input. So the given buffer
// should be at least kBase10MaximalLength + 1 characters long.
private const int kBase10MaximalLength = 17;
// The minimal and maximal target exponent define the range of w's binary
// exponent, where 'w' is the result of multiplying the input by a cached power
// of ten.
//
// A different range might be chosen on a different platform, to optimize digit
// generation, but a smaller range requires more powers of ten to be cached.
private const int kMinimalTargetExponent = -60;
private const int kMaximalTargetExponent = -32;
// Provides a decimal representation of v = (w, boundary_minus, boundary_plus).
// Returns true if it succeeds, otherwise the result cannot be trusted.
// There will be *length digits inside the buffer (not null-terminated).
// If the function returns true then
// v == (double) (buffer * 10^decimal_exponent).
// The digits in the buffer are the shortest representation possible: no
// 0.09999999999999999 instead of 0.1. The shorter representation will even be
// chosen even if the longer one would be closer to v.
// The last digit will be closest to the actual v. That is, even if several
// digits might correctly yield 'v' when read again, the closest will be
// computed.
private static bool Grisu3(
DiyFp w, DiyFp boundary_minus, DiyFp boundary_plus,
byte[] buffer, out int length, out int decimal_exponent)
{
Debug.Assert(boundary_plus.E == w.E);
DiyFp ten_mk; // Cached power of ten: 10^-k
int mk; // -k
int ten_mk_minimal_binary_exponent =
kMinimalTargetExponent - (w.E + DiyFp.kSignificandSize);
int ten_mk_maximal_binary_exponent =
kMaximalTargetExponent - (w.E + DiyFp.kSignificandSize);
PowersOfTenCache.GetCachedPowerForBinaryExponentRange(
ten_mk_minimal_binary_exponent,
ten_mk_maximal_binary_exponent,
out ten_mk, out mk);
Debug.Assert((kMinimalTargetExponent <= w.E + ten_mk.E +
DiyFp.kSignificandSize) &&
(kMaximalTargetExponent >= w.E + ten_mk.E +
DiyFp.kSignificandSize));
// Note that ten_mk is only an approximation of 10^-k. A DiyFp only contains a
// 64 bit significand and ten_mk is thus only precise up to 64 bits.
// The DiyFp.Times procedure rounds its result, and ten_mk is approximated
// too. The variable scaled_w (as well as scaled_boundary_minus/plus) are now
// off by a small amount.
// In fact: scaled_w - w*10^k < 1ulp (unit in the last place) of scaled_w.
// In other words: let f = scaled_w.f() and e = scaled_w.e(), then
// (f-1) * 2^e < w*10^k < (f+1) * 2^e
//DiyFp scaled_w = DiyFp.Times(ref w, ref ten_mk);
w.Multiply(ref ten_mk);
Debug.Assert(w.E ==
boundary_plus.E + ten_mk.E + DiyFp.kSignificandSize);
// In theory it would be possible to avoid some recomputations by computing
// the difference between w and boundary_minus/plus (a power of 2) and to
// compute scaled_boundary_minus/plus by subtracting/adding from
// scaled_w. However the code becomes much less readable and the speed
// enhancements are not terriffic.
//DiyFp scaled_boundary_minus = DiyFp.Times(ref boundary_minus, ref ten_mk);
boundary_minus.Multiply(ref ten_mk);
//DiyFp scaled_boundary_plus = DiyFp.Times(ref boundary_plus, ref ten_mk);
boundary_plus.Multiply(ref ten_mk);
// DigitGen will generate the digits of scaled_w. Therefore we have
// v == (double) (scaled_w * 10^-mk).
// Set decimal_exponent == -mk and pass it to DigitGen. If scaled_w is not an
// integer than it will be updated. For instance if scaled_w == 1.23 then
// the buffer will be filled with "123" und the decimal_exponent will be
// decreased by 2.
int kappa;
bool result = DigitGen(ref boundary_minus, ref w, ref boundary_plus,
buffer, out length, out kappa);
decimal_exponent = -mk + kappa;
return result;
}
// Generates the digits of input number w.
// w is a floating-point number (DiyFp), consisting of a significand and an
// exponent. Its exponent is bounded by kMinimalTargetExponent and
// kMaximalTargetExponent.
// Hence -60 <= w.e() <= -32.
//
// Returns false if it fails, in which case the generated digits in the buffer
// should not be used.
// Preconditions:
// * low, w and high are correct up to 1 ulp (unit in the last place). That
// is, their error must be less than a unit of their last digits.
// * low.e() == w.e() == high.e()
// * low < w < high, and taking into account their error: low~ <= high~
// * kMinimalTargetExponent <= w.e() <= kMaximalTargetExponent
// Postconditions: returns false if procedure fails.
// otherwise:
// * buffer is not null-terminated, but len contains the number of digits.
// * buffer contains the shortest possible decimal digit-sequence
// such that LOW < buffer * 10^kappa < HIGH, where LOW and HIGH are the
// correct values of low and high (without their error).
// * if more than one decimal representation gives the minimal number of
// decimal digits then the one closest to W (where W is the correct value
// of w) is chosen.
// Remark: this procedure takes into account the imprecision of its input
// numbers. If the precision is not enough to guarantee all the postconditions
// then false is returned. This usually happens rarely (~0.5%).
//
// Say, for the sake of example, that
// w.e() == -48, and w.f() == 0x1234567890abcdef
// w's value can be computed by w.f() * 2^w.e()
// We can obtain w's integral digits by simply shifting w.f() by -w.e().
// -> w's integral part is 0x1234
// w's fractional part is therefore 0x567890abcdef.
// Printing w's integral part is easy (simply print 0x1234 in decimal).
// In order to print its fraction we repeatedly multiply the fraction by 10 and
// get each digit. Example the first digit after the point would be computed by
// (0x567890abcdef * 10) >> 48. -> 3
// The whole thing becomes slightly more complicated because we want to stop
// once we have enough digits. That is, once the digits inside the buffer
// represent 'w' we can stop. Everything inside the interval low - high
// represents w. However we have to pay attention to low, high and w's
// imprecision.
private static bool DigitGen(ref DiyFp low,
ref DiyFp w,
ref DiyFp high,
byte[] buffer,
out int length,
out int kappa)
{
Debug.Assert(low.E == w.E && w.E == high.E);
Debug.Assert(low.F + 1 <= high.F - 1);
Debug.Assert(kMinimalTargetExponent <= w.E && w.E <= kMaximalTargetExponent);
// low, w and high are imprecise, but by less than one ulp (unit in the last
// place).
// If we remove (resp. add) 1 ulp from low (resp. high) we are certain that
// the new numbers are outside of the interval we want the final
// representation to lie in.
// Inversely adding (resp. removing) 1 ulp from low (resp. high) would yield
// numbers that are certain to lie in the interval. We will use this fact
// later on.
// We will now start by generating the digits within the uncertain
// interval. Later we will weed out representations that lie outside the safe
// interval and thus _might_ lie outside the correct interval.
ulong unit = 1;
DiyFp too_low = new DiyFp(low.F - unit, low.E);
DiyFp too_high = new DiyFp(high.F + unit, high.E);
// too_low and too_high are guaranteed to lie outside the interval we want the
// generated number in.
DiyFp unsafe_interval = DiyFp.Minus(ref too_high, ref too_low);
// We now cut the input number into two parts: the integral digits and the
// fractionals. We will not write any decimal separator though, but adapt
// kappa instead.
// Reminder: we are currently computing the digits (stored inside the buffer)
// such that: too_low < buffer * 10^kappa < too_high
// We use too_high for the digit_generation and stop as soon as possible.
// If we stop early we effectively round down.
DiyFp one = new DiyFp((ulong)(1) << -w.E, w.E);
// Division by one is a shift.
uint integrals = (uint)(too_high.F >> -one.E);
// Modulo by one is an and.
ulong fractionals = too_high.F & (one.F - 1);
uint divisor;
int divisor_exponent_plus_one;
BiggestPowerTen(integrals, DiyFp.kSignificandSize - (-one.E),
out divisor, out divisor_exponent_plus_one);
kappa = divisor_exponent_plus_one;
length = 0;
// Loop invariant: buffer = too_high / 10^kappa (integer division)
// The invariant holds for the first iteration: kappa has been initialized
// with the divisor exponent + 1. And the divisor is the biggest power of ten
// that is smaller than integrals.
ulong unsafeIntervalF = unsafe_interval.F;
while (kappa > 0)
{
var digit = integrals / divisor;
buffer[length] = (byte)((uint)'0' + digit);
++length;
integrals -= digit * divisor;
kappa--;
// Note that kappa now equals the exponent of the divisor and that the
// invariant thus holds again.
ulong rest =
((ulong)(integrals) << -one.E) + fractionals;
// Invariant: too_high = buffer * 10^kappa + DiyFp(rest, one.e())
// Reminder: unsafe_interval.e() == one.e()
if (rest < unsafeIntervalF)
{
// Rounding down (by not emitting the remaining digits) yields a number
// that lies within the unsafe interval.
too_high.Subtract(ref w);
return RoundWeed(buffer, length, too_high.F,
unsafeIntervalF, rest,
(ulong)(divisor) << -one.E, unit);
}
divisor = kSmallPowersOfTen[kappa];
}
// The integrals have been generated. We are at the point of the decimal
// separator. In the following loop we simply multiply the remaining digits by
// 10 and divide by one. We just need to pay attention to multiply associated
// data (like the interval or 'unit'), too.
// Note that the multiplication by 10 does not overflow, because w.e >= -60
// and thus one.e >= -60.
Debug.Assert(one.E >= -60);
Debug.Assert(fractionals < one.F);
Debug.Assert(0xFFFFFFFFFFFFFFFF / 10 >= one.F);
int unitPower = 0;
while (true)
{
//fractionals *= 10;
//unit *= 10;
//unsafeIntervalF *= 10;
fractionals = (fractionals << 3) + (fractionals << 1);
unitPower++;
unsafeIntervalF = (unsafeIntervalF << 3) + (unsafeIntervalF << 1);
// Integer division by one.
int digit = (int)(fractionals >> -one.E);
buffer[length] = (byte)((int)'0' + digit);
++length;
fractionals &= one.F - 1; // Modulo by one.
kappa--;
if (fractionals < unsafeIntervalF)
{
unit = PowersOfTenCache.PowersOfTen[unitPower];
too_high.Subtract(ref w);
return RoundWeed(buffer, length, too_high.F * unit,
unsafeIntervalF, fractionals, one.F, unit);
}
}
}
// Returns the biggest power of ten that is less than or equal to the given
// number. We furthermore receive the maximum number of bits 'number' has.
//
// Returns power == 10^(exponent_plus_one-1) such that
// power <= number < power * 10.
// If number_bits == 0 then 0^(0-1) is returned.
// The number of bits must be <= 32.
// Precondition: number < (1 << (number_bits + 1)).
// Inspired by the method for finding an integer log base 10 from here:
// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
private static readonly uint[] kSmallPowersOfTen = new uint[]
{
0, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000
};
static void BiggestPowerTen(uint number,
int number_bits,
out uint power,
out int exponent_plus_one)
{
Debug.Assert(number < ((uint)(1) << (number_bits + 1)));
// 1233/4096 is approximately 1/lg(10).
int exponent_plus_one_guess = ((number_bits + 1) * 1233 >> 12);
// We increment to skip over the first entry in the kPowersOf10 table.
// Note: kPowersOf10[i] == 10^(i-1).
exponent_plus_one_guess++;
// We don't have any guarantees that 2^number_bits <= number.
// TODO(floitsch): can we change the 'while' into an 'if'? We definitely see
// number < (2^number_bits - 1), but I haven't encountered
// number < (2^number_bits - 2) yet.
while (number < kSmallPowersOfTen[exponent_plus_one_guess])
{
exponent_plus_one_guess--;
}
power = kSmallPowersOfTen[exponent_plus_one_guess];
exponent_plus_one = exponent_plus_one_guess;
}
// Adjusts the last digit of the generated number, and screens out generated
// solutions that may be inaccurate. A solution may be inaccurate if it is
// outside the safe interval, or if we cannot prove that it is closer to the
// input than a neighboring representation of the same length.
//
// Input: * buffer containing the digits of too_high / 10^kappa
// * the buffer's length
// * distance_too_high_w == (too_high - w).f() * unit
// * unsafe_interval == (too_high - too_low).f() * unit
// * rest = (too_high - buffer * 10^kappa).f() * unit
// * ten_kappa = 10^kappa * unit
// * unit = the common multiplier
// Output: returns true if the buffer is guaranteed to contain the closest
// representable number to the input.
// Modifies the generated digits in the buffer to approach (round towards) w.
static bool RoundWeed(byte[] buffer,
int length,
ulong distance_too_high_w,
ulong unsafe_interval,
ulong rest,
ulong ten_kappa,
ulong unit)
{
ulong small_distance = distance_too_high_w - unit;
ulong big_distance = distance_too_high_w + unit;
// Let w_low = too_high - big_distance, and
// w_high = too_high - small_distance.
// Note: w_low < w < w_high
//
// The real w (* unit) must lie somewhere inside the interval
// ]w_low; w_high[ (often written as "(w_low; w_high)")
// Basically the buffer currently contains a number in the unsafe interval
// ]too_low; too_high[ with too_low < w < too_high
//
// too_high - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// ^v 1 unit ^ ^ ^ ^
// boundary_high --------------------- . . . .
// ^v 1 unit . . . .
// - - - - - - - - - - - - - - - - - - - + - - + - - - - - - . .
// . . ^ . .
// . big_distance . . .
// . . . . rest
// small_distance . . . .
// v . . . .
// w_high - - - - - - - - - - - - - - - - - - . . . .
// ^v 1 unit . . . .
// w ---------------------------------------- . . . .
// ^v 1 unit v . . .
// w_low - - - - - - - - - - - - - - - - - - - - - . . .
// . . v
// buffer --------------------------------------------------+-------+--------
// . .
// safe_interval .
// v .
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .
// ^v 1 unit .
// boundary_low ------------------------- unsafe_interval
// ^v 1 unit v
// too_low - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
//
// Note that the value of buffer could lie anywhere inside the range too_low
// to too_high.
//
// boundary_low, boundary_high and w are approximations of the real boundaries
// and v (the input number). They are guaranteed to be precise up to one unit.
// In fact the error is guaranteed to be strictly less than one unit.
//
// Anything that lies outside the unsafe interval is guaranteed not to round
// to v when read again.
// Anything that lies inside the safe interval is guaranteed to round to v
// when read again.
// If the number inside the buffer lies inside the unsafe interval but not
// inside the safe interval then we simply do not know and bail out (returning
// false).
//
// Similarly we have to take into account the imprecision of 'w' when finding
// the closest representation of 'w'. If we have two potential
// representations, and one is closer to both w_low and w_high, then we know
// it is closer to the actual value v.
//
// By generating the digits of too_high we got the largest (closest to
// too_high) buffer that is still in the unsafe interval. In the case where
// w_high < buffer < too_high we try to decrement the buffer.
// This way the buffer approaches (rounds towards) w.
// There are 3 conditions that stop the decrementation process:
// 1) the buffer is already below w_high
// 2) decrementing the buffer would make it leave the unsafe interval
// 3) decrementing the buffer would yield a number below w_high and farther
// away than the current number. In other words:
// (buffer{-1} < w_high) && w_high - buffer{-1} > buffer - w_high
// Instead of using the buffer directly we use its distance to too_high.
// Conceptually rest ~= too_high - buffer
// We need to do the following tests in this order to avoid over- and
// underflows.
Debug.Assert(rest <= unsafe_interval);
while (rest < small_distance && // Negated condition 1
unsafe_interval - rest >= ten_kappa && // Negated condition 2
(rest + ten_kappa < small_distance || // buffer{-1} > w_high
small_distance - rest >= rest + ten_kappa - small_distance))
{
buffer[length - 1]--;
rest += ten_kappa;
}
// We have approached w+ as much as possible. We now test if approaching w-
// would require changing the buffer. If yes, then we have two possible
// representations close to w, but we cannot decide which one is closer.
if (rest < big_distance &&
unsafe_interval - rest >= ten_kappa &&
(rest + ten_kappa < big_distance ||
big_distance - rest > rest + ten_kappa - big_distance))
{
return false;
}
// Weeding test.
// The safe interval is [too_low + 2 ulp; too_high - 2 ulp]
// Since too_low = too_high - unsafe_interval this is equivalent to
// [too_high - unsafe_interval + 4 ulp; too_high - 2 ulp]
// Conceptually we have: rest ~= too_high - buffer
return (2 * unit <= rest) && (rest <= unsafe_interval - 4 * unit);
}
private static byte[] zeroes = Enumerable.Repeat((byte)'0', 100).ToArray();
private static void CreateDecimalRepresentation(
byte[] decimal_digits,
int length,
int decimal_point,
int digits_after_point,
BinaryWriter writer)
{
// Create a representation that is padded with zeros if needed.
if (decimal_point <= 0)
{
// "0.00000decimal_rep".
writer.Write((byte)'0');
if (digits_after_point > 0)
{
writer.Write((byte)'.');
writer.Write(zeroes, 0, -decimal_point);
Debug.Assert(length <= digits_after_point - (-decimal_point));
writer.Write(decimal_digits, 0, length);
int remaining_digits = digits_after_point - (-decimal_point) - length;
writer.Write(zeroes, 0, remaining_digits);
}
}
else if (decimal_point >= length)
{
// "decimal_rep0000.00000" or "decimal_rep.0000"
writer.Write(decimal_digits, 0, length);
writer.Write(zeroes, 0, decimal_point - length);
if (digits_after_point > 0)
{
writer.Write((byte)'.');
writer.Write(zeroes, 0, digits_after_point);
}
}
else
{
// "decima.l_rep000"
Debug.Assert(digits_after_point > 0);
writer.Write(decimal_digits, 0, decimal_point);
writer.Write((byte)'.');
Debug.Assert(length - decimal_point <= digits_after_point);
writer.Write(decimal_digits, decimal_point,
length - decimal_point);
int remaining_digits = digits_after_point - (length - decimal_point);
writer.Write(zeroes, 0, remaining_digits);
}
}
private static void CreateExponentialRepresentation(
byte[] decimal_digits,
int length,
int exponent,
BinaryWriter writer)
{
Debug.Assert(length != 0);
writer.Write(decimal_digits[0]);
if (length != 1)
{
writer.Write((byte)'.');
writer.Write(decimal_digits, 1, length - 1);
}
writer.Write(exponent_character_);
if (exponent < 0)
{
writer.Write((byte)'-');
exponent = -exponent;
}
if (exponent == 0)
{
writer.Write((byte)'0');
return;
}
Debug.Assert(exponent < 1e4);
if (exponent >= 100)
{
writer.Write((byte)((int)'0' + exponent / 100));
exponent %= 100;
writer.Write((byte)((int)'0' + exponent / 10));
exponent %= 10;
writer.Write((byte)((int)'0' + exponent));
}
else if (exponent >= 10)
{
writer.Write((byte)((int)'0' + exponent / 10));
exponent %= 10;
writer.Write((byte)((int)'0' + exponent));
}
else
{
writer.Write((byte)((int)'0' + exponent));
}
}
}
}
| 50.942337 | 117 | 0.532364 | [
"MIT"
] | game-forest/Yuzu | Yuzu/Grisu/Grisu.cs | 33,573 | C# |
using log4net.Core;
using System.IO;
namespace log4net.Layout.Pattern
{
/// <summary>
/// Write the exception text to the output
/// </summary>
/// <remarks>
/// <para>
/// If an exception object is stored in the logging event
/// it will be rendered into the pattern output with a
/// trailing newline.
/// </para>
/// <para>
/// If there is no exception then nothing will be output
/// and no trailing newline will be appended.
/// It is typical to put a newline before the exception
/// and to have the exception as the last data in the pattern.
/// </para>
/// </remarks>
/// <author>Nicko Cadell</author>
internal sealed class ExceptionPatternConverter : PatternLayoutConverter
{
/// <summary>
/// Default constructor
/// </summary>
public ExceptionPatternConverter()
{
IgnoresException = false;
}
/// <summary>
/// Write the exception text to the output
/// </summary>
/// <param name="writer"><see cref="T:System.IO.TextWriter" /> that will receive the formatted result.</param>
/// <param name="loggingEvent">the event being logged</param>
/// <remarks>
/// <para>
/// If an exception object is stored in the logging event
/// it will be rendered into the pattern output with a
/// trailing newline.
/// </para>
/// <para>
/// If there is no exception then nothing will be output
/// and no trailing newline will be appended.
/// It is typical to put a newline before the exception
/// and to have the exception as the last data in the pattern.
/// </para>
/// </remarks>
protected override void Convert(TextWriter writer, LoggingEvent loggingEvent)
{
string exceptionString = loggingEvent.GetExceptionString();
if (exceptionString != null && exceptionString.Length > 0)
{
writer.WriteLine(exceptionString);
}
}
}
}
| 29.819672 | 112 | 0.675646 | [
"MIT"
] | HuyTruong19x/DDTank4.1 | Source Server/SourceQuest4.5/log4net/log4net.Layout.Pattern/ExceptionPatternConverter.cs | 1,819 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#nullable disable
using System;
using System.ComponentModel.DataAnnotations;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using TheForumOfEverything.Data.Models;
namespace TheForumOfEverything.Areas.Identity.Pages.Account
{
public class ForgotPasswordModel : PageModel
{
private readonly UserManager<ApplicationUser> _userManager;
private readonly IEmailSender _emailSender;
public ForgotPasswordModel(UserManager<ApplicationUser> userManager, IEmailSender emailSender)
{
_userManager = userManager;
_emailSender = emailSender;
}
/// <summary>
/// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
[BindProperty]
public InputModel Input { get; set; }
/// <summary>
/// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
public class InputModel
{
/// <summary>
/// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
[Required]
[EmailAddress]
public string Email { get; set; }
}
public async Task<IActionResult> OnPostAsync()
{
if (ModelState.IsValid)
{
var user = await _userManager.FindByEmailAsync(Input.Email);
if (user == null || !(await _userManager.IsEmailConfirmedAsync(user)))
{
// Don't reveal that the user does not exist or is not confirmed
return RedirectToPage("./ForgotPasswordConfirmation");
}
// For more information on how to enable account confirmation and password reset please
// visit https://go.microsoft.com/fwlink/?LinkID=532713
var code = await _userManager.GeneratePasswordResetTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var callbackUrl = Url.Page(
"/Account/ResetPassword",
pageHandler: null,
values: new { area = "Identity", code },
protocol: Request.Scheme);
await _emailSender.SendEmailAsync(
Input.Email,
"Reset Password",
$"Please reset your password by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");
return RedirectToPage("./ForgotPasswordConfirmation");
}
return Page();
}
}
}
| 40.325581 | 125 | 0.621396 | [
"MIT"
] | IvanovvAlex/TheForumOfEverything | TheForumOfEverything/Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs | 3,470 | C# |
using System;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Security.Policy;
using System.Threading;
using System.Windows.Forms;
using Mirage.Urbanization.GrowthPathFinding;
using Mirage.Urbanization.Simulation.Datameters;
using Mirage.Urbanization.Tilesets;
using Mirage.Urbanization.WinForms.Rendering;
using Mirage.Urbanization.ZoneConsumption;
using Mirage.Urbanization.ZoneConsumption.Base;
using Mirage.Urbanization.ZoneStatisticsQuerying;
namespace Mirage.Urbanization.WinForms
{
public class RenderZoneContinuation
{
private readonly Action _drawSecondLayerAction;
private readonly Action<IAreaConsumption> _drawHighligterAction;
public void DrawSecondLayer()=>_drawSecondLayerAction?.Invoke();
public void DrawHighlighter(IAreaConsumption consumption)=>_drawHighligterAction?.Invoke(consumption);
public bool HasDrawHighlighterDelegate => _drawHighligterAction != null;
public bool HasDrawSecondLayerDelegate => _drawSecondLayerAction != null;
public RenderZoneContinuation(Action drawSecondLayerAction, Action<IAreaConsumption> drawHighligterAction)
{
_drawSecondLayerAction = drawSecondLayerAction;
_drawHighligterAction = drawHighligterAction;
}
}
public class ZoneRenderInfo
{
private readonly Func<IReadOnlyZoneInfo, Rectangle> _createRectangle;
private readonly ITilesetAccessor _tilesetAccessor;
private readonly RenderZoneOptions _renderZoneOptions;
public IReadOnlyZoneInfo ZoneInfo { get; }
public Rectangle GetRectangle()
{
return _createRectangle(ZoneInfo);
}
public ZoneRenderInfo(IReadOnlyZoneInfo zoneInfo, Func<IReadOnlyZoneInfo, Rectangle> createRectangle, ITilesetAccessor tilesetAccessor, RenderZoneOptions renderZoneOptions)
{
ZoneInfo = zoneInfo;
_createRectangle = createRectangle;
_tilesetAccessor = tilesetAccessor;
_renderZoneOptions = renderZoneOptions;
}
private static readonly SynchronizedAnimationFramePicker Picker = new SynchronizedAnimationFramePicker();
public RenderZoneContinuation RenderZoneInto(IGraphicsWrapper graphics, bool isHighlighted)
{
if (graphics == null) throw new ArgumentNullException(nameof(graphics));
var rectangle = GetRectangle();
var consumption = ZoneInfo.ZoneConsumptionState.GetZoneConsumption();
Action drawSecondLayerAction = null;
QueryResult<AnimatedCellBitmapSetLayers> bitmapLayer = _tilesetAccessor.TryGetBitmapFor(ZoneInfo.TakeSnapshot(), true);
if (bitmapLayer.HasMatch)
{
graphics.DrawImage(Picker.GetFrame(bitmapLayer.MatchingObject.LayerOne).Bitmap.ToSysDrawingBitmap(), rectangle);
if (bitmapLayer.MatchingObject.LayerTwo.HasMatch)
drawSecondLayerAction = () =>
{
graphics.DrawImage(Picker.GetFrame(bitmapLayer.MatchingObject.LayerTwo.MatchingObject).Bitmap.ToSysDrawingBitmap(), rectangle);
};
if (_renderZoneOptions.ShowDebugGrowthPathFinding)
{
switch (ZoneInfo.GrowthAlgorithmHighlightState.Current)
{
case HighlightState.UsedAsPath:
graphics.DrawRectangle(BrushManager.GreenPen, rectangle);
break;
case HighlightState.Examined:
graphics.DrawRectangle(BrushManager.YellowPen, rectangle);
break;
}
}
}
else
{
graphics.FillRectangle(BrushManager.Instance.GetBrushFor(consumption), rectangle);
}
var overlayOption = _renderZoneOptions.CurrentOverlayOption;
if (overlayOption != null)
overlayOption.Render(ZoneInfo, rectangle, graphics);
if (isHighlighted)
{
return new RenderZoneContinuation(
drawSecondLayerAction,
(areaConsumption) =>
{
if (areaConsumption is IAreaZoneClusterConsumption)
{
var sampleZones = (areaConsumption as IAreaZoneClusterConsumption)
.ZoneClusterMembers;
var width = sampleZones.GroupBy(x => x.RelativeToParentCenterX).Count() * _tilesetAccessor.TileWidthAndSizeInPixels;
var height = sampleZones.GroupBy(x => x.RelativeToParentCenterY).Count() * _tilesetAccessor.TileWidthAndSizeInPixels;
var xOffset = sampleZones.Min(x => x.RelativeToParentCenterX) * _tilesetAccessor.TileWidthAndSizeInPixels;
var yOffset = sampleZones.Min(x => x.RelativeToParentCenterY) * _tilesetAccessor.TileWidthAndSizeInPixels;
rectangle.Size = new Size(
width: width,
height: height
);
rectangle.Location = new Point(
x: rectangle.Location.X + xOffset, y: rectangle.Location.Y + yOffset);
}
var pen = (DateTime.Now.Millisecond % 400) > 200 ? BrushManager.BluePen : BrushManager.RedPen;
graphics.DrawRectangle(pen, rectangle);
});
}
return new RenderZoneContinuation(drawSecondLayerAction, null);
}
}
} | 42.65942 | 181 | 0.616103 | [
"MIT"
] | Miragecoder/Urbanization | src/Mirage.Urbanization.WinForms/ZoneRenderInfo.cs | 5,889 | C# |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore;
using test2.Models;
using test2.Data;
namespace test2.Controllers{
public class UsersController : Controller{
private readonly Test2Context _context;
public UsersController(Test2Context context){
_context=context;
}
public IActionResult Index(){
return View();
}
public IActionResult Login(){
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Login([Bind("Id,NomeR,NomeU,Email,senha")] CreateUser user){
if(ModelState.IsValid){
_context.Add(user);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
return View(user);
}
public async Task<IActionResult> MyUser(int? id){
if(id == null){
return NotFound();
}
var user = await _context.Users.FirstOrDefaultAsync(m => m.Id == id);
if(user ==null){
return NotFound();
}
return View(user);
}
}
} | 29.4375 | 101 | 0.595895 | [
"MIT"
] | Hugo-Oliveira-RDO11/repo_for_test | Web/CRUDS/test2/Controllers/UsersController.cs | 1,413 | C# |
namespace Binance.Net.Objects.Spot.IsolatedMarginData
{
/// <summary>
/// Result of creating isolated margin account
/// </summary>
public class CreateIsolatedMarginAccountResult
{
/// <summary>
/// Success
/// </summary>
public bool Success { get; set; }
/// <summary>
/// Symbol
/// </summary>
public string Symbol { get; set; } = string.Empty;
}
}
| 23.210526 | 58 | 0.548753 | [
"MIT"
] | CarlPrentice/Binance.Net | Binance.Net/Objects/Spot/IsolatedMarginData/CreateIsolatedMarginAccountResult.cs | 443 | C# |
using System.Collections.Generic;
using Essensoft.AspNetCore.Payment.Alipay.Response;
namespace Essensoft.AspNetCore.Payment.Alipay.Request
{
/// <summary>
/// alipay.trade.pay.consult
/// </summary>
public class AlipayTradePayConsultRequest : IAlipayRequest<AlipayTradePayConsultResponse>
{
/// <summary>
/// 统一收单支付能力咨询
/// </summary>
public string BizContent { get; set; }
#region IAlipayRequest Members
private bool needEncrypt = false;
private string apiVersion = "1.0";
private string terminalType;
private string terminalInfo;
private string prodCode;
private string notifyUrl;
private string returnUrl;
private AlipayObject bizModel;
public void SetNeedEncrypt(bool needEncrypt)
{
this.needEncrypt = needEncrypt;
}
public bool GetNeedEncrypt()
{
return needEncrypt;
}
public void SetNotifyUrl(string notifyUrl)
{
this.notifyUrl = notifyUrl;
}
public string GetNotifyUrl()
{
return notifyUrl;
}
public void SetReturnUrl(string returnUrl)
{
this.returnUrl = returnUrl;
}
public string GetReturnUrl()
{
return returnUrl;
}
public void SetTerminalType(string terminalType)
{
this.terminalType = terminalType;
}
public string GetTerminalType()
{
return terminalType;
}
public void SetTerminalInfo(string terminalInfo)
{
this.terminalInfo = terminalInfo;
}
public string GetTerminalInfo()
{
return terminalInfo;
}
public void SetProdCode(string prodCode)
{
this.prodCode = prodCode;
}
public string GetProdCode()
{
return prodCode;
}
public string GetApiName()
{
return "alipay.trade.pay.consult";
}
public void SetApiVersion(string apiVersion)
{
this.apiVersion = apiVersion;
}
public string GetApiVersion()
{
return apiVersion;
}
public IDictionary<string, string> GetParameters()
{
var parameters = new AlipayDictionary
{
{ "biz_content", BizContent }
};
return parameters;
}
public AlipayObject GetBizModel()
{
return bizModel;
}
public void SetBizModel(AlipayObject bizModel)
{
this.bizModel = bizModel;
}
#endregion
}
}
| 22.467742 | 93 | 0.54379 | [
"MIT"
] | lzw316/payment | src/Essensoft.AspNetCore.Payment.Alipay/Request/AlipayTradePayConsultRequest.cs | 2,808 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Hotel.Api.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Title = "Home Page";
return View();
}
}
}
| 17.210526 | 44 | 0.617737 | [
"MIT"
] | alvbarbosa/CrudHotel | Hotel.Datos/Hotel.Api/Controllers/HomeController.cs | 329 | C# |
using System.Collections.Generic;
using Elasticsearch.Net;
namespace Nest
{
/// <summary>
/// Aggregation response for an aggregation request
/// </summary>
[JsonFormatter(typeof(AggregateFormatter))]
public interface IAggregate
{
//TODO this public set is problematic
/// <summary>
/// Metadata for the aggregation
/// </summary>
IReadOnlyDictionary<string, object> Meta { get; set; }
}
}
| 21.526316 | 56 | 0.711491 | [
"Apache-2.0"
] | 591094733/elasticsearch-net | src/Nest/Aggregations/Aggregate.cs | 411 | C# |
using System.Diagnostics;
using xnaMugen.IO;
using Microsoft.Xna.Framework;
namespace xnaMugen.StateMachine.Controllers
{
[StateControllerName("PosSet")]
internal class PosSet : StateController
{
public PosSet(StateSystem statesystem, string label, TextSection textsection)
: base(statesystem, label, textsection)
{
m_x = textsection.GetAttribute<Evaluation.Expression>("x", null);
m_y = textsection.GetAttribute<Evaluation.Expression>("y", null);
}
public override void Run(Combat.Character character)
{
var x = EvaluationHelper.AsSingle(character, X, null);
var y = EvaluationHelper.AsSingle(character, Y, null);
var cameralocation = (Vector2)character.Engine.Camera.Location;
var location = character.CurrentLocation;
if (x != null) location.X = cameralocation.X + x.Value;
if (y != null) location.Y = y.Value;
character.CurrentLocation = location;
}
public Evaluation.Expression X => m_x;
public Evaluation.Expression Y => m_y;
#region Fields
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private readonly Evaluation.Expression m_x;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private readonly Evaluation.Expression m_y;
#endregion
}
} | 28.133333 | 80 | 0.722749 | [
"BSD-3-Clause"
] | BlazesRus/xnamugen | src/StateMachine/Controllers/PosSet.cs | 1,266 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001
{
using static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Extensions;
/// <summary>List of API operations.</summary>
public partial class OperationResultList
{
/// <summary>
/// <c>AfterFromJson</c> will be called after the json deserialization has finished, allowing customization of the object
/// before it is returned. Implement this method in a partial class to enable this behavior
/// </summary>
/// <param name="json">The JsonNode that should be deserialized into this object.</param>
partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json);
/// <summary>
/// <c>AfterToJson</c> will be called after the json erialization has finished, allowing customization of the <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject"
/// /> before it is returned. Implement this method in a partial class to enable this behavior
/// </summary>
/// <param name="container">The JSON container that the serialization result will be placed in.</param>
partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container);
/// <summary>
/// <c>BeforeFromJson</c> will be called before the json deserialization has commenced, allowing complete customization of
/// the object before it is deserialized.
/// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
/// Implement this method in a partial class to enable this behavior.
/// </summary>
/// <param name="json">The JsonNode that should be deserialized into this object.</param>
/// <param name="returnNow">Determines if the rest of the deserialization should be processed, or if the method should return
/// instantly.</param>
partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json, ref bool returnNow);
/// <summary>
/// <c>BeforeToJson</c> will be called before the json serialization has commenced, allowing complete customization of the
/// object before it is serialized.
/// If you wish to disable the default serialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
/// Implement this method in a partial class to enable this behavior.
/// </summary>
/// <param name="container">The JSON container that the serialization result will be placed in.</param>
/// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
/// instantly.</param>
partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, ref bool returnNow);
/// <summary>
/// Deserializes a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode"/> into an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IOperationResultList.
/// </summary>
/// <param name="node">a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode" /> to deserialize from.</param>
/// <returns>
/// an instance of Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IOperationResultList.
/// </returns>
public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api202001.IOperationResultList FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode node)
{
return node is Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json ? new OperationResultList(json) : null;
}
/// <summary>
/// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject into a new instance of <see cref="OperationResultList" />.
/// </summary>
/// <param name="json">A Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject instance to deserialize from.</param>
internal OperationResultList(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject json)
{
bool returnNow = false;
BeforeFromJson(json, ref returnNow);
if (returnNow)
{
return;
}
{_value = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonArray>("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonArray, out var __v) ? new global::System.Func<Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation[]>(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180901Preview.Operation.FromJson(__u) )) ))() : null : Value;}
{_nextLink = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString>("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;}
AfterFromJson(json);
}
/// <summary>
/// Serializes this instance of <see cref="OperationResultList" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode" />.
/// </summary>
/// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject"/> container to serialize this object into. If the caller
/// passes in <c>null</c>, a new instance will be created and returned to the caller.</param>
/// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode"/>.</param>
/// <returns>
/// a serialized instance of <see cref="OperationResultList" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode" />.
/// </returns>
public Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode serializationMode)
{
container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonObject();
bool returnNow = false;
BeforeToJson(ref container, ref returnNow);
if (returnNow)
{
return container;
}
if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly))
{
if (null != this._value)
{
var __w = new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.XNodeArray();
foreach( var __x in this._value )
{
AddIf(__x?.ToJson(null, serializationMode) ,__w.Add);
}
container.Add("value",__w);
}
}
if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeReadOnly))
{
AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add );
}
AfterToJson(ref container);
return container;
}
}
} | 68.393443 | 645 | 0.675935 | [
"MIT"
] | Agazoth/azure-powershell | src/Migrate/generated/api/Models/Api202001/OperationResultList.json.cs | 8,223 | C# |
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;
#nullable restore
namespace Elastic.Clients.Elasticsearch.Analysis
{
public partial class TruncateTokenFilter : TokenFilterBase, ITokenFilterDefinition
{
[JsonInclude]
[JsonPropertyName("length")]
public int Length { get; init; }
[JsonInclude]
[JsonPropertyName("type")]
public string Type => "truncate";
}
} | 31.702703 | 83 | 0.497869 | [
"Apache-2.0"
] | SimonCropp/elasticsearch-net | src/Elastic.Clients.Elasticsearch/_Generated/Types/Analysis/TruncateTokenFilter.g.cs | 1,619 | C# |
// Copyright (c) 2006, Gustavo Franco
// Email: [email protected]
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER
// REMAINS UNCHANGED.
namespace System.Drawing.IconLib.Exceptions
{
[Author("Franco, Gustavo")]
public class InvalidIconFormatSelectionException : Exception
{
#region Constructors
public InvalidIconFormatSelectionException() : base ("Invalid IconImageFormat selection")
{
}
#endregion
}
}
| 41.322581 | 98 | 0.723653 | [
"MIT"
] | jmenashe/sharpshell | SharpShell/Samples/PreviewHandler/IconLib/IconLib/System/Drawing/IconLib/Exceptions/InvalidIconFormatSelectionException.cs | 1,281 | C# |
namespace LINGYUN.Abp.Rules
{
public enum ExpressionType
{
LambdaExpression = 0
}
}
| 13.125 | 30 | 0.619048 | [
"MIT"
] | FanShiYou/abp-vue-admin-element-typescript | aspnet-core/modules/common/LINGYUN.Abp.Rules/LINGYUN/Abp/Rules/ExpressionType.cs | 107 | C# |
// Copyright (c) Jerry Lee. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Threading;
namespace System.Collections.Generic
{
/// <summary>
/// Represents a linked stack. Implements the <see cref="System.Collections.Generic.IEnumerable{T}" /> Implements the <see
/// cref="System.Collections.ICollection" />
/// </summary>
/// <typeparam name="T"></typeparam>
/// <seealso cref="System.Collections.Generic.IEnumerable{T}" />
/// <seealso cref="System.Collections.ICollection" />
[DebuggerDisplay("Count = {Count}")]
[ComVisible(false)]
public class LinkedStack<T> : IEnumerable<T>, ICollection
{
#region Fields
private readonly LinkedList<T> list;
[NonSerialized]
private object syncRoot;
private int version;
#endregion Fields
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="LinkedStack{T}" /> class.
/// </summary>
public LinkedStack()
{
list = new LinkedList<T>();
version = 0;
}
/// <summary>
/// Initializes a new instance of the <see cref="LinkedStack{T}" /> class that contains elements copied from the specified collection and has
/// sufficient capacity to accommodate the number of elements copied.
/// </summary>
/// <param name="collection">The collection to copy elements from.</param>
public LinkedStack(IEnumerable<T> collection)
{
list = new LinkedList<T>(collection);
version = 0;
}
#endregion Constructors
#region Properties
/// <summary>
/// Gets the number of elements contained in the <see cref="LinkedStack{T}" />.
/// </summary>
/// <value>The number of elements contained in the <see cref="LinkedStack{T}" />.</value>
public int Count
{
get
{
return list.Count;
}
}
bool ICollection.IsSynchronized
{
get
{
return false;
}
}
object ICollection.SyncRoot
{
get
{
if (syncRoot == null)
{
Interlocked.CompareExchange<object>(ref syncRoot, new object(), null);
}
return syncRoot;
}
}
#endregion Properties
#region Methods
/// <summary>
/// Removes all objects from the <see cref="LinkedStack{T}" />.
/// </summary>
public void Clear()
{
list.Clear();
}
/// <summary>
/// Determines whether an element is in the <see cref="LinkedStack{T}" />.
/// </summary>
/// <param name="item">The object to locate in the <see cref="LinkedStack{T}" />. The value can be null for reference types.</param>
/// <returns><c>true</c> if <c>item</c> is found in the <see cref="LinkedStack{T}" />; otherwise, <c>false</c>.</returns>
public bool Contains(T item)
{
return list.Contains(item);
}
/// <summary>
/// Copies the <see cref="LinkedStack{T}" /> to an existing one-dimensional <see cref="System.Array" />, starting at the specified array index.
/// </summary>
/// <param name="array">
/// The one-dimensional <see cref="System.Array" /> that is the destination of the elements copied from <see cref="LinkedStack{T}" />. The
/// <see cref="System.Array" /> must have zero-based indexing.
/// </param>
/// <param name="arrayIndex">The zero-based index in <c>array</c> at which copying begins.</param>
/// <exception cref="ArgumentNullException"><c>array</c> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException"><c>arrayIndex</c> is less than zero.</exception>
/// <exception cref="ArgumentException">
/// The number of elements in the source <see cref="LinkedStack{T}" /> is greater than the available space from <c>arrayIndex</c> to the end
/// of the destination <c>array</c>.
/// </exception>
public void CopyTo(T[] array, int arrayIndex)
{
if (array == null)
{
throw new ArgumentNullException(nameof(array));
}
if (arrayIndex < 0 || arrayIndex > array.Length)
{
throw new ArgumentOutOfRangeException(nameof(arrayIndex), "arrayIndex is less than zero. ");
}
if (array.Length - arrayIndex < Count)
{
throw new ArgumentException("The number of elements in the source LinkedStack<T> is greater than the available space from index to the end of the destination array.");
}
list.CopyTo(array, arrayIndex);
Array.Reverse(array, arrayIndex, Count);
}
/// <summary>
/// Returns an enumerator for the <see cref="LinkedStack{T}" />.
/// </summary>
/// <returns>An <see cref="LinkedStack{T}.Enumerator" /> for the <see cref="LinkedStack{T}" />.</returns>
public Enumerator GetEnumerator()
{
return new Enumerator(this);
}
/// <summary>
/// Returns the object at the top of the <see cref="LinkedStack{T}" /> without removing it.
/// </summary>
/// <returns>The object at the top of the <see cref="LinkedStack{T}" />.</returns>
/// <exception cref="InvalidOperationException">The <see cref="LinkedStack{T}" /> is empty.</exception>
public T Peek()
{
if (Count == 0)
{
throw new InvalidOperationException("Empty stack");
}
return list.Last.Value;
}
/// <summary>
/// Removes and returns the object at the top of the <see cref="LinkedStack{T}" />.
/// </summary>
/// <returns>The object removed from the top of the <see cref="LinkedStack{T}" />.</returns>
/// <exception cref="InvalidOperationException">The <see cref="LinkedStack{T}" /> is empty.</exception>
public T Pop()
{
if (Count == 0)
{
throw new InvalidOperationException("Empty stack");
}
version++;
T lastItem = list.Last.Value;
list.RemoveLast();
return lastItem;
}
/// <summary>
/// Inserts an object at the top of the <see cref="LinkedStack{T}" />.
/// </summary>
/// <param name="item">The object to push onto the <see cref="LinkedStack{T}" />. The value can be <c>null</c> for reference types.</param>
public void Push(T item)
{
list.AddLast(item);
version++;
}
/// <summary>
/// Copies the <see cref="LinkedStack{T}" /> to a new array.
/// </summary>
/// <returns>A new array containing copies of the elements of the <see cref="LinkedStack{T}" />.</returns>
public T[] ToArray()
{
T[] array = new T[list.Count];
LinkedListNode<T> node = list.Last;
int index = 0;
while (node != null)
{
array[index] = node.Value;
if (node.Previous != list.Last)
{
node = node.Previous;
}
else
{
node = null;
}
}
return array;
}
/// <summary>
/// Tries to get the object at the top of the <see cref="LinkedStack{T}" /> without removing it, and returns a value that indicates whether
/// the object exists.
/// </summary>
/// <param name="result">
/// When this method returns, contains the object at the top of the <see cref="LinkedStack{T}" />, or default value of <c>T</c>.
/// </param>
/// <returns><c>true</c> if the object at the top of the <see cref="LinkedStack{T}" /> exists, <c>false</c> otherwise.</returns>
public bool TryPeek(out T result)
{
result = default;
if (list.Last != null)
{
result = list.Last.Value;
return true;
}
return false;
}
/// <summary>
/// Tries to remove and get the object at the top of the <see cref="LinkedStack{T}" />, and returns a value that indicates whether the object exists.
/// </summary>
/// <param name="result">
/// When this method returns, contains the object at the top of the <see cref="LinkedStack{T}" />, or default value of <c>T</c>.
/// </param>
/// <returns><c>true</c> if the object at the top of the <see cref="LinkedStack{T}" /> exists, <c>false</c> otherwise.</returns>
public bool TryPop(out T result)
{
result = default;
if (list.Last != null)
{
result = list.Last.Value;
list.RemoveLast();
version++;
return true;
}
return false;
}
void ICollection.CopyTo(Array array, int arrayIndex)
{
if (array == null)
{
throw new ArgumentNullException(nameof(array));
}
if (arrayIndex < 0 || arrayIndex > array.Length)
{
throw new ArgumentOutOfRangeException(nameof(arrayIndex), "arrayIndex is less than zero. ");
}
if (array.Length - arrayIndex < Count)
{
throw new ArgumentException("The number of elements in the source LinkedStack<T> is greater than the available space from index to the end of the destination array.");
}
ICollection collection = list as ICollection;
collection.CopyTo(array, arrayIndex);
Array.Reverse(array, arrayIndex, Count);
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator(this);
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(this);
}
#endregion Methods
#region Structs
/// <summary>
/// Enumerates the elements of a <see cref="LinkedStack{T}" />. Implements the <see cref="System.Collections.Generic.IEnumerator{T}" />.
/// Implements the <see cref="System.Collections.IEnumerator" />.
/// </summary>
/// <seealso cref="System.Collections.Generic.IEnumerator{T}" />
/// <seealso cref="System.Collections.IEnumerator" />
[Serializable()]
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "not an expected scenario")]
public struct Enumerator : IEnumerator<T>, IEnumerator
{
#region Fields
private T currentElement;
private int index;
private LinkedListNode<T> node;
private LinkedStack<T> stack;
private int version;
#endregion Fields
#region Constructors
internal Enumerator(LinkedStack<T> stack)
{
this.stack = stack;
version = stack.version;
index = -2;
node = null;
currentElement = default(T);
}
#endregion Constructors
#region Properties
/// <summary>
/// Gets the element at the current position of the enumerator. Implements the <see
/// cref="System.Collections.Generic.IEnumerator{T}.Current" />.
/// </summary>
/// <value>The element in the <see cref="LinkedStack{T}" /> at the current position of the enumerator.</value>
/// <exception cref="InvalidOperationException">
/// The enumerator is positioned before the first element of the collection or after the last element.
/// </exception>
public T Current
{
get
{
if (index == -2)
{
throw new InvalidOperationException("Enum not started");
}
if (index == -1)
{
throw new InvalidOperationException("Enum ended");
}
return currentElement;
}
}
/// <summary>
/// Gets the element at the current position of the enumerator. Implements the <see cref="System.Collections.IEnumerator.Current" />.
/// </summary>
/// <value>The element in the collection at the current position of the enumerator.</value>
/// <exception cref="InvalidOperationException">
/// The enumerator is positioned before the first element of the collection or after the last element.
/// </exception>
object IEnumerator.Current
{
get
{
if (index == -2)
{
throw new InvalidOperationException("Enum not started");
}
if (index == -1)
{
throw new InvalidOperationException("Enum ended");
}
return currentElement;
}
}
#endregion Properties
#region Methods
/// <summary>
/// Releases all resources used by the <see cref="LinkedStack{T}.Enumerator" />.
/// </summary>
public void Dispose()
{
index = -1;
}
/// <summary>
/// Advances the enumerator to the next element of the <see cref="LinkedStack{T}" />. Implements the <see
/// cref="System.Collections.IEnumerator.MoveNext" />.
/// </summary>
/// <returns>
/// <c>true</c> if the enumerator was successfully advanced to the next element; <c>false</c> if the enumerator has passed the end of the collection.
/// </returns>
/// <exception cref="InvalidOperationException">The collection was modified after the enumerator was created.</exception>
public bool MoveNext()
{
bool retval;
if (version != stack.version)
{
throw new InvalidOperationException("Enum failed version");
}
if (index == -2)
{
node = stack.list.Last;
index = stack.Count - 1;
retval = (index >= 0);
if (retval)
{
currentElement = node.Value;
}
return retval;
}
if (index == -1)
{
return false;
}
retval = (--index >= 0);
if (retval)
{
currentElement = node.Value;
node = node.Previous;
}
else
{
currentElement = default(T);
}
return retval;
}
void IEnumerator.Reset()
{
if (version != stack.version)
{
throw new InvalidOperationException("Enum failed version");
}
index = -2;
currentElement = default(T);
}
#endregion Methods
}
#endregion Structs
}
} | 34.450106 | 183 | 0.511586 | [
"MIT"
] | cosmos53076/ReSharp.Core | src/ReSharp.Core/Assets/Scripts/System/Collections/Generic/LinkedStack.cs | 16,228 | C# |
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AWSSDK.ServiceCatalog")]
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - AWS Service Catalog. AWS Service Catalog allows organizations to create and manage catalogs of IT services that are approved for use on AWS.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Amazon Web Services SDK for .NET")]
[assembly: AssemblyCompany("Amazon.com, Inc")]
[assembly: AssemblyCopyright("Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.3")]
[assembly: AssemblyFileVersion("3.7.2.5")] | 46.46875 | 220 | 0.751177 | [
"Apache-2.0"
] | jon-armen/aws-sdk-net | sdk/code-analysis/ServiceAnalysis/ServiceCatalog/Properties/AssemblyInfo.cs | 1,487 | C# |
namespace SMSEditor.Controls
{
partial class AssetTilemapControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tpnlTilemapsMain = new System.Windows.Forms.TableLayoutPanel();
this.pnlTilemapImage = new SMSEditor.Controls.ImageControl();
this.grpTilemapList = new System.Windows.Forms.GroupBox();
this.lstTilemaps = new SMSEditor.Controls.ListBoxControl();
this.pnlTilemapButtons = new System.Windows.Forms.Panel();
this.btnTilemapRemove = new System.Windows.Forms.Button();
this.btnTilemapSave = new System.Windows.Forms.Button();
this.btnTilemapValidate = new System.Windows.Forms.Button();
this.pnlTilemapOptions = new System.Windows.Forms.Panel();
this.chkTilemapPlaceholder = new System.Windows.Forms.CheckBox();
this.nudTilemapHex = new System.Windows.Forms.NumericUpDown();
this.lblTilemapHex = new System.Windows.Forms.Label();
this.lblTilemapLength = new System.Windows.Forms.Label();
this.nudTilemapLength = new System.Windows.Forms.NumericUpDown();
this.grpTilemapDivider = new System.Windows.Forms.GroupBox();
this.pnlTilemapSPRPalette = new SMSEditor.Controls.PaletteControl();
this.pnlTilemapBGPalette = new SMSEditor.Controls.PaletteControl();
this.lblTilemapID = new System.Windows.Forms.Label();
this.lblTilemapRows = new System.Windows.Forms.Label();
this.lblTilemapColumns = new System.Windows.Forms.Label();
this.cbTilemapSPRPalette = new System.Windows.Forms.ComboBox();
this.cbTilemapCompression = new System.Windows.Forms.ComboBox();
this.lblTilemapCompression = new System.Windows.Forms.Label();
this.cbTilemapTileset = new System.Windows.Forms.ComboBox();
this.chkTilemapUseAttributes = new System.Windows.Forms.CheckBox();
this.nudTilemapOffset = new System.Windows.Forms.NumericUpDown();
this.lblTilemapSPRPalette = new System.Windows.Forms.Label();
this.nudTilemapRows = new System.Windows.Forms.NumericUpDown();
this.cbTilemapBGPalette = new System.Windows.Forms.ComboBox();
this.txtTilemapName = new System.Windows.Forms.TextBox();
this.nudTilemapColumns = new System.Windows.Forms.NumericUpDown();
this.lblTilemapBGPalette = new System.Windows.Forms.Label();
this.lblTilemapName = new System.Windows.Forms.Label();
this.lblTilemapOffset = new System.Windows.Forms.Label();
this.lblTilemapTileset = new System.Windows.Forms.Label();
this.nudTilemapID = new System.Windows.Forms.NumericUpDown();
this.tpnlTilemapsMain.SuspendLayout();
this.grpTilemapList.SuspendLayout();
this.pnlTilemapButtons.SuspendLayout();
this.pnlTilemapOptions.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapHex)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapLength)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapOffset)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapRows)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapColumns)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapID)).BeginInit();
this.SuspendLayout();
//
// tpnlTilemapsMain
//
this.tpnlTilemapsMain.ColumnCount = 3;
this.tpnlTilemapsMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 196F));
this.tpnlTilemapsMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tpnlTilemapsMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 172F));
this.tpnlTilemapsMain.Controls.Add(this.pnlTilemapImage, 1, 0);
this.tpnlTilemapsMain.Controls.Add(this.grpTilemapList, 0, 0);
this.tpnlTilemapsMain.Controls.Add(this.pnlTilemapOptions, 2, 0);
this.tpnlTilemapsMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tpnlTilemapsMain.Location = new System.Drawing.Point(0, 0);
this.tpnlTilemapsMain.Name = "tpnlTilemapsMain";
this.tpnlTilemapsMain.RowCount = 1;
this.tpnlTilemapsMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tpnlTilemapsMain.Size = new System.Drawing.Size(810, 544);
this.tpnlTilemapsMain.TabIndex = 4;
//
// pnlTilemapImage
//
this.pnlTilemapImage.AutoScroll = true;
this.pnlTilemapImage.AutoScrollMinSize = new System.Drawing.Size(430, 535);
this.pnlTilemapImage.Canvas = new System.Drawing.Size(8, 8);
this.pnlTilemapImage.Centered = true;
this.pnlTilemapImage.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlTilemapImage.HatchBackColor = System.Drawing.Color.DarkGray;
this.pnlTilemapImage.HatchForeColor = System.Drawing.Color.White;
this.pnlTilemapImage.HatchStyle = System.Drawing.Drawing2D.HatchStyle.OutlinedDiamond;
this.pnlTilemapImage.Image = null;
this.pnlTilemapImage.ImageAlpha = 1F;
this.pnlTilemapImage.ImageScale = 1;
this.pnlTilemapImage.Location = new System.Drawing.Point(202, 7);
this.pnlTilemapImage.Margin = new System.Windows.Forms.Padding(6, 7, 6, 2);
this.pnlTilemapImage.MinimumScale = 1;
this.pnlTilemapImage.Name = "pnlTilemapImage";
this.pnlTilemapImage.Size = new System.Drawing.Size(430, 535);
this.pnlTilemapImage.SnapSize = new System.Drawing.Size(8, 8);
this.pnlTilemapImage.TabIndex = 1;
this.pnlTilemapImage.UseCanvas = false;
this.pnlTilemapImage.UseHatch = true;
this.pnlTilemapImage.UseMouseWheelScaling = true;
//
// grpTilemapList
//
this.grpTilemapList.Controls.Add(this.lstTilemaps);
this.grpTilemapList.Controls.Add(this.pnlTilemapButtons);
this.grpTilemapList.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpTilemapList.Location = new System.Drawing.Point(0, 0);
this.grpTilemapList.Margin = new System.Windows.Forms.Padding(0);
this.grpTilemapList.Name = "grpTilemapList";
this.grpTilemapList.Padding = new System.Windows.Forms.Padding(12, 4, 12, 12);
this.grpTilemapList.Size = new System.Drawing.Size(196, 544);
this.grpTilemapList.TabIndex = 0;
this.grpTilemapList.TabStop = false;
this.grpTilemapList.Text = "Tilemaps";
//
// lstTilemaps
//
this.lstTilemaps.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lstTilemaps.DisableHighlighting = true;
this.lstTilemaps.Dock = System.Windows.Forms.DockStyle.Fill;
this.lstTilemaps.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.lstTilemaps.FormattingEnabled = true;
this.lstTilemaps.HorizontalExtent = 170;
this.lstTilemaps.IntegralHeight = false;
this.lstTilemaps.ItemHeight = 15;
this.lstTilemaps.Location = new System.Drawing.Point(12, 89);
this.lstTilemaps.Name = "lstTilemaps";
this.lstTilemaps.Size = new System.Drawing.Size(172, 443);
this.lstTilemaps.TabIndex = 0;
this.lstTilemaps.TextOffsetX = 2;
this.lstTilemaps.TextOffsetY = -1;
this.lstTilemaps.SelectedIndexChanged += new System.EventHandler(this.lstAssets_SelectedIndexChanged);
//
// pnlTilemapButtons
//
this.pnlTilemapButtons.Controls.Add(this.btnTilemapRemove);
this.pnlTilemapButtons.Controls.Add(this.btnTilemapSave);
this.pnlTilemapButtons.Controls.Add(this.btnTilemapValidate);
this.pnlTilemapButtons.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlTilemapButtons.Location = new System.Drawing.Point(12, 19);
this.pnlTilemapButtons.Name = "pnlTilemapButtons";
this.pnlTilemapButtons.Size = new System.Drawing.Size(172, 70);
this.pnlTilemapButtons.TabIndex = 0;
//
// btnTilemapRemove
//
this.btnTilemapRemove.Dock = System.Windows.Forms.DockStyle.Top;
this.btnTilemapRemove.Location = new System.Drawing.Point(0, 46);
this.btnTilemapRemove.Margin = new System.Windows.Forms.Padding(0);
this.btnTilemapRemove.Name = "btnTilemapRemove";
this.btnTilemapRemove.Size = new System.Drawing.Size(172, 23);
this.btnTilemapRemove.TabIndex = 2;
this.btnTilemapRemove.Text = "Remove Tilemap";
this.btnTilemapRemove.UseVisualStyleBackColor = true;
this.btnTilemapRemove.Click += new System.EventHandler(this.btnAsset_Click);
//
// btnTilemapSave
//
this.btnTilemapSave.Dock = System.Windows.Forms.DockStyle.Top;
this.btnTilemapSave.Location = new System.Drawing.Point(0, 23);
this.btnTilemapSave.Margin = new System.Windows.Forms.Padding(0);
this.btnTilemapSave.Name = "btnTilemapSave";
this.btnTilemapSave.Size = new System.Drawing.Size(172, 23);
this.btnTilemapSave.TabIndex = 1;
this.btnTilemapSave.Text = "Save Tilemap";
this.btnTilemapSave.UseVisualStyleBackColor = true;
this.btnTilemapSave.Click += new System.EventHandler(this.btnAsset_Click);
//
// btnTilemapValidate
//
this.btnTilemapValidate.Dock = System.Windows.Forms.DockStyle.Top;
this.btnTilemapValidate.Location = new System.Drawing.Point(0, 0);
this.btnTilemapValidate.Margin = new System.Windows.Forms.Padding(0);
this.btnTilemapValidate.Name = "btnTilemapValidate";
this.btnTilemapValidate.Size = new System.Drawing.Size(172, 23);
this.btnTilemapValidate.TabIndex = 0;
this.btnTilemapValidate.Text = "Validate Tilemap";
this.btnTilemapValidate.UseVisualStyleBackColor = true;
this.btnTilemapValidate.Click += new System.EventHandler(this.btnAsset_Click);
//
// pnlTilemapOptions
//
this.pnlTilemapOptions.Controls.Add(this.chkTilemapPlaceholder);
this.pnlTilemapOptions.Controls.Add(this.nudTilemapHex);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapHex);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapLength);
this.pnlTilemapOptions.Controls.Add(this.nudTilemapLength);
this.pnlTilemapOptions.Controls.Add(this.grpTilemapDivider);
this.pnlTilemapOptions.Controls.Add(this.pnlTilemapSPRPalette);
this.pnlTilemapOptions.Controls.Add(this.pnlTilemapBGPalette);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapID);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapRows);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapColumns);
this.pnlTilemapOptions.Controls.Add(this.cbTilemapSPRPalette);
this.pnlTilemapOptions.Controls.Add(this.cbTilemapCompression);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapCompression);
this.pnlTilemapOptions.Controls.Add(this.cbTilemapTileset);
this.pnlTilemapOptions.Controls.Add(this.chkTilemapUseAttributes);
this.pnlTilemapOptions.Controls.Add(this.nudTilemapOffset);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapSPRPalette);
this.pnlTilemapOptions.Controls.Add(this.nudTilemapRows);
this.pnlTilemapOptions.Controls.Add(this.cbTilemapBGPalette);
this.pnlTilemapOptions.Controls.Add(this.txtTilemapName);
this.pnlTilemapOptions.Controls.Add(this.nudTilemapColumns);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapBGPalette);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapName);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapOffset);
this.pnlTilemapOptions.Controls.Add(this.lblTilemapTileset);
this.pnlTilemapOptions.Controls.Add(this.nudTilemapID);
this.pnlTilemapOptions.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlTilemapOptions.Location = new System.Drawing.Point(638, 6);
this.pnlTilemapOptions.Margin = new System.Windows.Forms.Padding(0, 6, 0, 0);
this.pnlTilemapOptions.Name = "pnlTilemapOptions";
this.pnlTilemapOptions.Size = new System.Drawing.Size(172, 538);
this.pnlTilemapOptions.TabIndex = 2;
//
// chkTilemapPlaceholder
//
this.chkTilemapPlaceholder.AutoSize = true;
this.chkTilemapPlaceholder.Location = new System.Drawing.Point(0, 448);
this.chkTilemapPlaceholder.Name = "chkTilemapPlaceholder";
this.chkTilemapPlaceholder.Size = new System.Drawing.Size(122, 17);
this.chkTilemapPlaceholder.TabIndex = 26;
this.chkTilemapPlaceholder.Text = "Tileset Placeholder";
this.chkTilemapPlaceholder.UseVisualStyleBackColor = true;
//
// nudTilemapHex
//
this.nudTilemapHex.Hexadecimal = true;
this.nudTilemapHex.Location = new System.Drawing.Point(88, 16);
this.nudTilemapHex.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.nudTilemapHex.Name = "nudTilemapHex";
this.nudTilemapHex.Size = new System.Drawing.Size(80, 22);
this.nudTilemapHex.TabIndex = 3;
this.nudTilemapHex.ValueChanged += new System.EventHandler(this.nudAssetID_ValueChanged);
//
// lblTilemapHex
//
this.lblTilemapHex.AutoSize = true;
this.lblTilemapHex.Location = new System.Drawing.Point(88, 0);
this.lblTilemapHex.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapHex.Name = "lblTilemapHex";
this.lblTilemapHex.Size = new System.Drawing.Size(80, 13);
this.lblTilemapHex.TabIndex = 2;
this.lblTilemapHex.Text = "Position (Hex):";
this.lblTilemapHex.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTilemapLength
//
this.lblTilemapLength.AutoSize = true;
this.lblTilemapLength.Location = new System.Drawing.Point(0, 160);
this.lblTilemapLength.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapLength.Name = "lblTilemapLength";
this.lblTilemapLength.Size = new System.Drawing.Size(46, 13);
this.lblTilemapLength.TabIndex = 12;
this.lblTilemapLength.Text = "Length:";
this.lblTilemapLength.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// nudTilemapLength
//
this.nudTilemapLength.Location = new System.Drawing.Point(0, 176);
this.nudTilemapLength.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.nudTilemapLength.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudTilemapLength.Name = "nudTilemapLength";
this.nudTilemapLength.Size = new System.Drawing.Size(80, 22);
this.nudTilemapLength.TabIndex = 13;
this.nudTilemapLength.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// grpTilemapDivider
//
this.grpTilemapDivider.Location = new System.Drawing.Point(0, 260);
this.grpTilemapDivider.Name = "grpTilemapDivider";
this.grpTilemapDivider.Size = new System.Drawing.Size(176, 5);
this.grpTilemapDivider.TabIndex = 19;
this.grpTilemapDivider.TabStop = false;
//
// pnlTilemapSPRPalette
//
this.pnlTilemapSPRPalette.Location = new System.Drawing.Point(0, 400);
this.pnlTilemapSPRPalette.Margin = new System.Windows.Forms.Padding(0);
this.pnlTilemapSPRPalette.Name = "pnlTilemapSPRPalette";
this.pnlTilemapSPRPalette.ReadOnly = true;
this.pnlTilemapSPRPalette.Size = new System.Drawing.Size(168, 40);
this.pnlTilemapSPRPalette.TabIndex = 25;
//
// pnlTilemapBGPalette
//
this.pnlTilemapBGPalette.Location = new System.Drawing.Point(0, 312);
this.pnlTilemapBGPalette.Margin = new System.Windows.Forms.Padding(0);
this.pnlTilemapBGPalette.Name = "pnlTilemapBGPalette";
this.pnlTilemapBGPalette.ReadOnly = true;
this.pnlTilemapBGPalette.Size = new System.Drawing.Size(168, 40);
this.pnlTilemapBGPalette.TabIndex = 22;
//
// lblTilemapID
//
this.lblTilemapID.AutoSize = true;
this.lblTilemapID.Location = new System.Drawing.Point(0, 0);
this.lblTilemapID.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapID.Name = "lblTilemapID";
this.lblTilemapID.Size = new System.Drawing.Size(72, 13);
this.lblTilemapID.TabIndex = 0;
this.lblTilemapID.Text = "Position (ID):";
this.lblTilemapID.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTilemapRows
//
this.lblTilemapRows.AutoSize = true;
this.lblTilemapRows.Location = new System.Drawing.Point(88, 80);
this.lblTilemapRows.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapRows.Name = "lblTilemapRows";
this.lblTilemapRows.Size = new System.Drawing.Size(38, 13);
this.lblTilemapRows.TabIndex = 8;
this.lblTilemapRows.Text = "Rows:";
this.lblTilemapRows.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTilemapColumns
//
this.lblTilemapColumns.AutoSize = true;
this.lblTilemapColumns.Location = new System.Drawing.Point(0, 80);
this.lblTilemapColumns.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapColumns.Name = "lblTilemapColumns";
this.lblTilemapColumns.Size = new System.Drawing.Size(55, 13);
this.lblTilemapColumns.TabIndex = 6;
this.lblTilemapColumns.Text = "Columns:";
this.lblTilemapColumns.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// cbTilemapSPRPalette
//
this.cbTilemapSPRPalette.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbTilemapSPRPalette.FormattingEnabled = true;
this.cbTilemapSPRPalette.Location = new System.Drawing.Point(0, 376);
this.cbTilemapSPRPalette.Name = "cbTilemapSPRPalette";
this.cbTilemapSPRPalette.Size = new System.Drawing.Size(168, 21);
this.cbTilemapSPRPalette.TabIndex = 24;
this.cbTilemapSPRPalette.SelectedIndexChanged += new System.EventHandler(this.cbAsset_SelectedIndexChanged);
//
// cbTilemapCompression
//
this.cbTilemapCompression.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbTilemapCompression.FormattingEnabled = true;
this.cbTilemapCompression.Location = new System.Drawing.Point(0, 136);
this.cbTilemapCompression.Name = "cbTilemapCompression";
this.cbTilemapCompression.Size = new System.Drawing.Size(168, 21);
this.cbTilemapCompression.TabIndex = 11;
this.cbTilemapCompression.SelectedIndexChanged += new System.EventHandler(this.cbAsset_SelectedIndexChanged);
//
// lblTilemapCompression
//
this.lblTilemapCompression.AutoSize = true;
this.lblTilemapCompression.Location = new System.Drawing.Point(0, 120);
this.lblTilemapCompression.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapCompression.Name = "lblTilemapCompression";
this.lblTilemapCompression.Size = new System.Drawing.Size(77, 13);
this.lblTilemapCompression.TabIndex = 10;
this.lblTilemapCompression.Text = "Compression:";
this.lblTilemapCompression.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// cbTilemapTileset
//
this.cbTilemapTileset.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbTilemapTileset.FormattingEnabled = true;
this.cbTilemapTileset.Location = new System.Drawing.Point(0, 216);
this.cbTilemapTileset.Name = "cbTilemapTileset";
this.cbTilemapTileset.Size = new System.Drawing.Size(168, 21);
this.cbTilemapTileset.TabIndex = 17;
//
// chkTilemapUseAttributes
//
this.chkTilemapUseAttributes.AutoSize = true;
this.chkTilemapUseAttributes.Location = new System.Drawing.Point(0, 240);
this.chkTilemapUseAttributes.Margin = new System.Windows.Forms.Padding(0);
this.chkTilemapUseAttributes.Name = "chkTilemapUseAttributes";
this.chkTilemapUseAttributes.Size = new System.Drawing.Size(120, 17);
this.chkTilemapUseAttributes.TabIndex = 18;
this.chkTilemapUseAttributes.Text = "Use Tile Attributes";
this.chkTilemapUseAttributes.UseVisualStyleBackColor = true;
//
// nudTilemapOffset
//
this.nudTilemapOffset.Location = new System.Drawing.Point(88, 176);
this.nudTilemapOffset.Maximum = new decimal(new int[] {
512,
0,
0,
0});
this.nudTilemapOffset.Name = "nudTilemapOffset";
this.nudTilemapOffset.Size = new System.Drawing.Size(80, 22);
this.nudTilemapOffset.TabIndex = 15;
//
// lblTilemapSPRPalette
//
this.lblTilemapSPRPalette.AutoSize = true;
this.lblTilemapSPRPalette.Location = new System.Drawing.Point(0, 360);
this.lblTilemapSPRPalette.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapSPRPalette.Name = "lblTilemapSPRPalette";
this.lblTilemapSPRPalette.Size = new System.Drawing.Size(78, 13);
this.lblTilemapSPRPalette.TabIndex = 23;
this.lblTilemapSPRPalette.Text = "Sprite Palette:";
this.lblTilemapSPRPalette.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// nudTilemapRows
//
this.nudTilemapRows.Location = new System.Drawing.Point(88, 96);
this.nudTilemapRows.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.nudTilemapRows.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudTilemapRows.Name = "nudTilemapRows";
this.nudTilemapRows.Size = new System.Drawing.Size(80, 22);
this.nudTilemapRows.TabIndex = 9;
this.nudTilemapRows.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// cbTilemapBGPalette
//
this.cbTilemapBGPalette.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbTilemapBGPalette.FormattingEnabled = true;
this.cbTilemapBGPalette.Location = new System.Drawing.Point(0, 288);
this.cbTilemapBGPalette.Name = "cbTilemapBGPalette";
this.cbTilemapBGPalette.Size = new System.Drawing.Size(168, 21);
this.cbTilemapBGPalette.TabIndex = 21;
this.cbTilemapBGPalette.SelectedIndexChanged += new System.EventHandler(this.cbAsset_SelectedIndexChanged);
//
// txtTilemapName
//
this.txtTilemapName.Location = new System.Drawing.Point(0, 56);
this.txtTilemapName.MaxLength = 50;
this.txtTilemapName.Name = "txtTilemapName";
this.txtTilemapName.Size = new System.Drawing.Size(168, 22);
this.txtTilemapName.TabIndex = 5;
//
// nudTilemapColumns
//
this.nudTilemapColumns.Location = new System.Drawing.Point(0, 96);
this.nudTilemapColumns.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.nudTilemapColumns.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudTilemapColumns.Name = "nudTilemapColumns";
this.nudTilemapColumns.Size = new System.Drawing.Size(80, 22);
this.nudTilemapColumns.TabIndex = 7;
this.nudTilemapColumns.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// lblTilemapBGPalette
//
this.lblTilemapBGPalette.AutoSize = true;
this.lblTilemapBGPalette.Location = new System.Drawing.Point(0, 272);
this.lblTilemapBGPalette.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapBGPalette.Name = "lblTilemapBGPalette";
this.lblTilemapBGPalette.Size = new System.Drawing.Size(110, 13);
this.lblTilemapBGPalette.TabIndex = 20;
this.lblTilemapBGPalette.Text = "Background Palette:";
this.lblTilemapBGPalette.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTilemapName
//
this.lblTilemapName.AutoSize = true;
this.lblTilemapName.Location = new System.Drawing.Point(0, 40);
this.lblTilemapName.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapName.Name = "lblTilemapName";
this.lblTilemapName.Size = new System.Drawing.Size(82, 13);
this.lblTilemapName.TabIndex = 4;
this.lblTilemapName.Text = "Tilemap Name:";
this.lblTilemapName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTilemapOffset
//
this.lblTilemapOffset.AutoSize = true;
this.lblTilemapOffset.Location = new System.Drawing.Point(88, 160);
this.lblTilemapOffset.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapOffset.Name = "lblTilemapOffset";
this.lblTilemapOffset.Size = new System.Drawing.Size(42, 13);
this.lblTilemapOffset.TabIndex = 14;
this.lblTilemapOffset.Text = "Offset:";
this.lblTilemapOffset.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblTilemapTileset
//
this.lblTilemapTileset.AutoSize = true;
this.lblTilemapTileset.Location = new System.Drawing.Point(0, 200);
this.lblTilemapTileset.Margin = new System.Windows.Forms.Padding(0);
this.lblTilemapTileset.Name = "lblTilemapTileset";
this.lblTilemapTileset.Size = new System.Drawing.Size(43, 13);
this.lblTilemapTileset.TabIndex = 16;
this.lblTilemapTileset.Text = "Tileset:";
this.lblTilemapTileset.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// nudTilemapID
//
this.nudTilemapID.Location = new System.Drawing.Point(0, 16);
this.nudTilemapID.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.nudTilemapID.Name = "nudTilemapID";
this.nudTilemapID.Size = new System.Drawing.Size(80, 22);
this.nudTilemapID.TabIndex = 1;
this.nudTilemapID.ValueChanged += new System.EventHandler(this.nudAssetID_ValueChanged);
//
// AssetTilemapControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tpnlTilemapsMain);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Name = "AssetTilemapControl";
this.Size = new System.Drawing.Size(810, 544);
this.tpnlTilemapsMain.ResumeLayout(false);
this.grpTilemapList.ResumeLayout(false);
this.pnlTilemapButtons.ResumeLayout(false);
this.pnlTilemapOptions.ResumeLayout(false);
this.pnlTilemapOptions.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapHex)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapLength)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapOffset)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapRows)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapColumns)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudTilemapID)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tpnlTilemapsMain;
private ImageControl pnlTilemapImage;
private System.Windows.Forms.GroupBox grpTilemapList;
private ListBoxControl lstTilemaps;
private System.Windows.Forms.Panel pnlTilemapButtons;
private System.Windows.Forms.Button btnTilemapRemove;
private System.Windows.Forms.Button btnTilemapSave;
private System.Windows.Forms.Button btnTilemapValidate;
private System.Windows.Forms.Panel pnlTilemapOptions;
private PaletteControl pnlTilemapSPRPalette;
private PaletteControl pnlTilemapBGPalette;
private System.Windows.Forms.Label lblTilemapID;
private System.Windows.Forms.Label lblTilemapRows;
private System.Windows.Forms.Label lblTilemapColumns;
private System.Windows.Forms.ComboBox cbTilemapSPRPalette;
private System.Windows.Forms.ComboBox cbTilemapCompression;
private System.Windows.Forms.Label lblTilemapCompression;
private System.Windows.Forms.ComboBox cbTilemapTileset;
private System.Windows.Forms.CheckBox chkTilemapUseAttributes;
private System.Windows.Forms.NumericUpDown nudTilemapOffset;
private System.Windows.Forms.Label lblTilemapSPRPalette;
private System.Windows.Forms.NumericUpDown nudTilemapRows;
private System.Windows.Forms.ComboBox cbTilemapBGPalette;
private System.Windows.Forms.TextBox txtTilemapName;
private System.Windows.Forms.NumericUpDown nudTilemapColumns;
private System.Windows.Forms.Label lblTilemapBGPalette;
private System.Windows.Forms.Label lblTilemapName;
private System.Windows.Forms.Label lblTilemapOffset;
private System.Windows.Forms.Label lblTilemapTileset;
private System.Windows.Forms.NumericUpDown nudTilemapID;
private System.Windows.Forms.GroupBox grpTilemapDivider;
private System.Windows.Forms.Label lblTilemapLength;
private System.Windows.Forms.NumericUpDown nudTilemapLength;
private System.Windows.Forms.Label lblTilemapHex;
private System.Windows.Forms.NumericUpDown nudTilemapHex;
private System.Windows.Forms.CheckBox chkTilemapPlaceholder;
}
}
| 54.168285 | 149 | 0.636307 | [
"MIT"
] | xfixium/SMSEditor | SMSEditor/Controls/AssetTilemapControl.Designer.cs | 33,478 | C# |
namespace H.Hooks.IntegrationTests;
[TestClass]
public class KeyboardTests
{
[TestMethod]
public async Task DefaultTest()
{
using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
var cancellationToken = cancellationTokenSource.Token;
using var hook = new LowLevelKeyboardHook().WithEventLogging();
hook.Start();
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
}
[TestMethod]
public async Task HandlingTest()
{
using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
var cancellationToken = cancellationTokenSource.Token;
using var hook = new LowLevelKeyboardHook
{
Handling = true,
}.WithEventLogging();
hook.Up += (_, args) => args.IsHandled = true;
hook.Down += (_, args) => args.IsHandled = true;
hook.Start();
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
}
[TestMethod]
public async Task ExtendedModeTest()
{
using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
var cancellationToken = cancellationTokenSource.Token;
using var hook = new LowLevelKeyboardHook
{
IsExtendedMode = true,
}.WithEventLogging();
hook.Start();
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
}
[TestMethod]
public async Task LeftRightGranularityTest()
{
using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
var cancellationToken = cancellationTokenSource.Token;
using var hook = new LowLevelKeyboardHook
{
IsLeftRightGranularity = true,
}.WithEventLogging();
hook.Start();
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
}
[TestMethod]
public async Task CapsLockTest()
{
using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30));
var cancellationToken = cancellationTokenSource.Token;
using var hook = new LowLevelKeyboardHook
{
IsCapsLock = true,
}.WithEventLogging();
hook.Start();
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
}
}
| 28.188235 | 98 | 0.65818 | [
"MIT"
] | HavenDV/H.Hooks | src/tests/H.Hooks.IntegrationTests/KeyboardTests.cs | 2,396 | C# |
using System.IO;
using System.Runtime.Serialization;
using GameEstate.Red.Formats.Red.CR2W.Reflection;
using FastMember;
using static GameEstate.Red.Formats.Red.Records.Enums;
namespace GameEstate.Red.Formats.Red.Types
{
[DataContract(Namespace = "")]
[REDMeta]
public class BTTaskCheckDelaySinceLastMealDef : IBehTreeTaskDefinition
{
[Ordinal(1)] [RED("value")] public CFloat Value { get; set;}
[Ordinal(2)] [RED("operator")] public CEnum<EOperator> Operator { get; set;}
public BTTaskCheckDelaySinceLastMealDef(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name){ }
public static new CVariable Create(CR2WFile cr2w, CVariable parent, string name) => new BTTaskCheckDelaySinceLastMealDef(cr2w, parent, name);
public override void Read(BinaryReader file, uint size) => base.Read(file, size);
public override void Write(BinaryWriter file) => base.Write(file);
}
} | 34.740741 | 144 | 0.73774 | [
"MIT"
] | bclnet/GameEstate | src/Estates/Red/GameEstate.Red.Format/Red/W3/RTTIConvert/BTTaskCheckDelaySinceLastMealDef.cs | 938 | C# |
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace VSX.UniversalVehicleCombat
{
/// <summary>
/// This class manages the module selection part of the loadout menu.
/// </summary>
public class LoadoutModuleMenuController : MonoBehaviour
{
[SerializeField]
private ModuleMenuItemController moduleItemButtonPrefab;
[SerializeField]
private Transform moduleItemButtonParent;
List<ModuleMenuItemController> moduleMenuItems = new List<ModuleMenuItemController>();
/// <summary>
/// Initialize the module selection UI with all of the module information.
/// </summary>
/// <param name="itemManager">A prefab that contains references to all of the module prefabs available in the module selection UI.</param>
public void Initialize (PlayerItemManager itemManager)
{
// Create the module selection menu
for (int i = 0; i < itemManager.AllModulePrefabs.Count; ++i)
{
ModuleMenuItemController buttonController = (ModuleMenuItemController)Instantiate(moduleItemButtonPrefab, moduleItemButtonParent);
IModule module = itemManager.AllModulePrefabs[i].GetComponent<IModule>();
buttonController.transform.localPosition = Vector3.zero;
buttonController.transform.localRotation = Quaternion.identity;
buttonController.transform.localScale = new Vector3(1, 1, 1);
moduleMenuItems.Add(buttonController);
buttonController.itemIndex = i;
buttonController.SetIcon(module.MenuSprite);
buttonController.SetLabel(module.Label);
// Deselect by default
buttonController.Deselect();
}
}
/// <summary>
/// Update the module selection menu to show only the modules that are available for a particular module mount.
/// </summary>
/// <param name="selectableModuleIndexes">A list of the indexes of all the modules available at a module mount.</param>
/// <param name="mountedIndex">The index of the module currently mounted at the currently selected module mount.</param>
public void UpdateModuleSelectionMenu(List<int> selectableModuleIndexes, int mountedIndex)
{
// For each of the module menu items ...
for (int i = 0; i < moduleMenuItems.Count; ++i)
{
// Set active/inactive depending on if its index is one of the selectable module indexes
moduleMenuItems[i].gameObject.SetActive(selectableModuleIndexes.Contains(moduleMenuItems[i].itemIndex));
moduleMenuItems[i].Deselect();
}
if (mountedIndex != -1)
{
moduleMenuItems[mountedIndex].Select(false);
}
}
/// <summary>
/// Called when the player selects a new module in the module selection UI.
/// </summary>
/// <param name="index">The index of the newly selected module.</param>
public void OnSelectModule(int index)
{
if (index != -1) moduleMenuItems[index].Select(false);
// Deselect all the other buttons
for (int i = 0; i < moduleMenuItems.Count; ++i)
{
if (i != index) moduleMenuItems[i].Deselect();
}
}
}
}
| 31.505155 | 146 | 0.70877 | [
"MIT"
] | jackdarker/Spaceshooter1 | Assets/SpaceCombatKit/Scripts/UniversalVehicleCombat/Loadout/LoadoutModuleMenuController.cs | 3,058 | C# |
//-----------------------------------------------------------------------------
// Powerups.cs
//-----------------------------------------------------------------------------
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace Halcyon
{
/// <summary>
/// Powerup help
/// </summary>
class Powerups : MenuScreen
{
// shield power up
Animation shieldTexture;
// bomb power up
Animation bombTexture;
// +1 life power up
Animation lifeTexture;
// Font
SpriteFont font;
SpriteFont descFont;
/// <summary>
/// Construct a pause menu
/// </summary>
public Powerups()
: base( "Powerups" )
{
}
/// <summary>
/// Load screen content here
/// </summary>
public override void LoadContent()
{
base.LoadContent();
if ( content == null )
content = new ContentManager( ScreenManager.Game.Services, "Content" );
// font
font = content.Load<SpriteFont>( "Font/powerup" );
descFont = content.Load<SpriteFont>( "Font/powerupdesc" );
// Load textures
shieldTexture = new Animation();
bombTexture = new Animation();
lifeTexture = new Animation();
shieldTexture.Initialize(
content.Load<Texture2D>( "Animations/shield_powerup" ), new Vector2( 85, 350 ), 128, 128, 16, 32,
Color.White, 1f, true );
bombTexture.Initialize(
content.Load<Texture2D>( "Animations/bomb_powerup" ), new Vector2( 85, 530 ), 128, 128, 16, 32,
Color.White, 1f, true );
lifeTexture.Initialize(
content.Load<Texture2D>( "Animations/life_powerup" ), new Vector2( 85, 700 ), 128, 128, 16, 32,
Color.White, .65f, true );
}
/// <summary>
/// Exit Game has been selected
/// </summary>
protected override void OnCancel()
{
Dummy.Create( ScreenManager, new Background(), new MainMenu() );
}
/// <summary>
/// Update function
/// </summary>
/// <param name="gameTime"></param>
/// <param name="otherScreenHasFocus"></param>
/// <param name="coveredByOtherScreen"></param>
public override void Update( GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen )
{
base.Update( gameTime, otherScreenHasFocus, coveredByOtherScreen );
// Transition
float transitionOffset = ( float )Math.Pow( TransitionPosition, 2 );
shieldTexture.Position = new Vector2( 165, 290 );
lifeTexture.Position = new Vector2( 165, 665 );
bombTexture.Position = new Vector2( 165, 470 );
if ( ScreenState == ScreenState.TransitionOn ) {
shieldTexture.Position = new Vector2( shieldTexture.Position.X - transitionOffset * 256.0f,
shieldTexture.Position.Y );
lifeTexture.Position = new Vector2( lifeTexture.Position.X - transitionOffset * 256.0f,
lifeTexture.Position.Y );
bombTexture.Position = new Vector2( bombTexture.Position.X - transitionOffset * 256.5f,
bombTexture.Position.Y );
} else {
shieldTexture.Position = new Vector2( shieldTexture.Position.X + transitionOffset * 512.0f,
shieldTexture.Position.Y );
lifeTexture.Position = new Vector2( lifeTexture.Position.X + transitionOffset * 512.0f,
lifeTexture.Position.Y );
bombTexture.Position = new Vector2( bombTexture.Position.X + transitionOffset * 512.0f,
bombTexture.Position.Y );
}
shieldTexture.Update( gameTime );
lifeTexture.Update( gameTime );
bombTexture.Update( gameTime );
}
/// <summary>
/// Draw function, Draw to screen
/// </summary>
/// <param name="gameTime"></param>
public override void Draw( GameTime gameTime )
{
SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
// Begin rendering
spriteBatch.Begin();
// Draw animations
shieldTexture.Draw( spriteBatch );
bombTexture.Draw( spriteBatch );
lifeTexture.Draw( spriteBatch );
// Draw text
Vector2 shieldPosition = new Vector2(10, 320 );
Vector2 bombPosition = new Vector2( 10, 505 );
Vector2 lifePosition = new Vector2( 10, 700 );
Vector2 shieldTitle = new Vector2( ScreenManager.GraphicsDevice.Viewport.Width / 2.0f - this.font.LineSpacing, 275 );
Vector2 bombTitle = new Vector2( ScreenManager.GraphicsDevice.Viewport.Width / 2.0f - this.font.LineSpacing, 450 );
Vector2 lifeTitle = new Vector2( ScreenManager.GraphicsDevice.Viewport.Width / 2.0f - this.font.LineSpacing, 655 );
// Transition
float transitionOffset = ( float )Math.Pow( TransitionPosition, 2 );
if ( ScreenState == ScreenState.TransitionOn ) {
shieldPosition = new Vector2( shieldPosition.X - transitionOffset * 256.0f, shieldPosition.Y );
bombPosition = new Vector2( bombPosition.X - transitionOffset * 256.0f, bombPosition.Y );
lifePosition = new Vector2( lifePosition.X - transitionOffset * 256.0f, lifePosition.Y );
shieldTitle = new Vector2( shieldTitle.X - transitionOffset * 256.0f, shieldTitle.Y );
bombTitle = new Vector2( bombTitle.X - transitionOffset * 256.0f, bombTitle.Y );
lifeTitle = new Vector2( lifeTitle.X - transitionOffset * 256.0f, lifeTitle.Y );
} else {
shieldPosition = new Vector2( shieldPosition.X + transitionOffset * 512.0f, shieldPosition.Y );
bombPosition = new Vector2( bombPosition.X + transitionOffset * 512.0f, bombPosition.Y );
lifePosition = new Vector2( lifePosition.X + transitionOffset * 512.0f, lifePosition.Y );
shieldTitle = new Vector2( shieldTitle.X + transitionOffset * 512.0f, shieldTitle.Y );
bombTitle = new Vector2( bombTitle.X + transitionOffset * 512.0f, bombTitle.Y );
lifeTitle = new Vector2( lifeTitle.X + transitionOffset * 512.0f, lifeTitle.Y );
}
spriteBatch.DrawString( this.font, "Shield", shieldTitle, Color.LightBlue );
spriteBatch.DrawString( this.descFont,
"You will be granted a shield of immunity.\nWhile this shield is active you cannot be\nkilled! Take advantage of this.",
shieldPosition, Color.LightBlue );
spriteBatch.DrawString( this.font, "Bomb", bombTitle, Color.LightPink );
spriteBatch.DrawString( this.descFont,
"Activating a bomb will kill all enemies\nwithin its range, You can double-tap your\nscreen to activate it. Your ship can only\nhold two bombs at one time",
bombPosition, Color.LightPink );
spriteBatch.DrawString( this.font, " Life", lifeTitle, Color.LightGreen );
spriteBatch.DrawString( this.descFont,
"You will be granted an extra life for a\nmaximum of 5 lives. When you are out\nof lives it is game over!",
lifePosition, Color.LightGreen );
// End rendering
spriteBatch.End();
base.Draw( gameTime );
if ( TransitionPosition > 0 )
ScreenManager.FadeBackBufferToBlack( 1.0f - ( 1.0f - TransitionPosition ) );
}
}
}
| 43.575269 | 173 | 0.560395 | [
"MIT"
] | vevix/halcyon | Halcyon/Screens/Powerups.cs | 8,105 | C# |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Autofac;
using Autofac.Core;
using Module = Autofac.Module;
namespace Orchard.Logging {
public class LoggingModule : Module {
private readonly ConcurrentDictionary<string, ILogger> _loggerCache;
public LoggingModule() {
_loggerCache = new ConcurrentDictionary<string, ILogger>();
}
protected override void Load(ContainerBuilder moduleBuilder) {
// by default, use Orchard's logger that delegates to Castle's logger factory
moduleBuilder.RegisterType<CastleLoggerFactory>().As<ILoggerFactory>().InstancePerLifetimeScope();
moduleBuilder.RegisterType<OrchardLog4netFactory>().As<Castle.Core.Logging.ILoggerFactory>().InstancePerLifetimeScope();
// call CreateLogger in response to the request for an ILogger implementation
moduleBuilder.Register(CreateLogger).As<ILogger>().InstancePerDependency();
}
protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration) {
var implementationType = registration.Activator.LimitType;
// build an array of actions on this type to assign loggers to member properties
var injectors = BuildLoggerInjectors(implementationType).ToArray();
// if there are no logger properties, there's no reason to hook the activated event
if (!injectors.Any())
return;
// otherwise, whan an instance of this component is activated, inject the loggers on the instance
registration.Activated += (s, e) => {
foreach (var injector in injectors)
injector(e.Context, e.Instance);
};
}
private IEnumerable<Action<IComponentContext, object>> BuildLoggerInjectors(Type componentType) {
// Look for settable properties of type "ILogger"
var loggerProperties = componentType
.GetProperties(BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance)
.Select(p => new {
PropertyInfo = p,
p.PropertyType,
IndexParameters = p.GetIndexParameters(),
Accessors = p.GetAccessors(false)
})
.Where(x => x.PropertyType == typeof(ILogger)) // must be a logger
.Where(x => x.IndexParameters.Count() == 0) // must not be an indexer
.Where(x => x.Accessors.Length != 1 || x.Accessors[0].ReturnType == typeof(void)); //must have get/set, or only set
// Return an array of actions that resolve a logger and assign the property
foreach (var entry in loggerProperties) {
var propertyInfo = entry.PropertyInfo;
yield return (ctx, instance) => {
string component = componentType.ToString();
if (component != instance.GetType().ToString()) {
return;
}
var logger = _loggerCache.GetOrAdd(component, key => ctx.Resolve<ILogger>(new TypedParameter(typeof(Type), componentType)));
propertyInfo.SetValue(instance, logger, null);
};
}
}
private static ILogger CreateLogger(IComponentContext context, IEnumerable<Parameter> parameters) {
// return an ILogger in response to Resolve<ILogger>(componentTypeParameter)
var loggerFactory = context.Resolve<ILoggerFactory>();
var containingType = parameters.TypedAs<Type>();
return loggerFactory.CreateLogger(containingType);
}
}
} | 48.555556 | 145 | 0.61734 | [
"MIT"
] | AccentureRapid/OrchardCollaboration | src/Orchard/Logging/LoggingModule.cs | 3,935 | C# |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Linq;
using System.Reflection;
using Xunit;
namespace Microsoft.Data.Entity.Metadata
{
public class FieldMatcherTest
{
[Fact]
public void Camel_case_matching_field_is_used_as_first_preference()
{
FieldMatchTest("Breathe", "breathe");
}
[Fact]
public void Camel_case_matching_field_is_not_used_if_type_is_not_compatible()
{
FieldMatchTest("OnTheRun", "_onTheRun");
}
[Fact]
public void Underscore_camel_case_matching_field_is_used_as_second_preference()
{
FieldMatchTest("Time", "_time");
}
[Fact]
public void Underscpre_camel_case_matching_field_is_not_used_if_type_is_not_compatible()
{
FieldMatchTest("TheGreatGigInTheSky", "_TheGreatGigInTheSky");
}
[Fact]
public void Underscpre_matching_field_is_used_as_third_preference()
{
FieldMatchTest("Money", "_Money");
}
[Fact]
public void Underscore_matching_field_is_not_used_if_type_is_not_compatible()
{
FieldMatchTest("UsAndThem", "m_usAndThem");
}
[Fact]
public void M_underscpre_camel_case_matching_field_is_used_as_fourth_preference()
{
FieldMatchTest("AnyColourYouLike", "m_anyColourYouLike");
}
[Fact]
public void M_underscore_camel_case_matching_field_is_not_used_if_type_is_not_compatible()
{
FieldMatchTest("BrainDamage", "m_BrainDamage");
}
[Fact]
public void M_underscpre_matching_field_is_used_as_fifth_preference()
{
FieldMatchTest("Eclipse", "m_Eclipse");
}
private static void FieldMatchTest(string propertyName, string fieldName)
{
var entityType = new EntityType(typeof(TheDarkSideOfTheMoon));
var property = entityType.AddProperty(propertyName, typeof(int));
var propertyInfo = entityType.Type.GetAnyProperty(propertyName);
var fields = propertyInfo.DeclaringType.GetRuntimeFields().ToDictionary(f => f.Name);
var matchedField = new FieldMatcher().TryMatchFieldName(property, propertyInfo, fields);
Assert.Equal(fieldName, matchedField.Name);
}
[Fact]
public void M_underscore_matching_field_is_not_used_if_type_is_not_compatible()
{
var entityType = new EntityType(typeof(TheDarkSideOfTheMoon));
var property = entityType.AddProperty("SpeakToMe", typeof(int));
var propertyInfo = entityType.Type.GetAnyProperty("SpeakToMe");
var fields = propertyInfo.DeclaringType.GetRuntimeFields().ToDictionary(f => f.Name);
Assert.Null(new FieldMatcher().TryMatchFieldName(property, propertyInfo, fields));
}
private class TheDarkSideOfTheMoon
{
#pragma warning disable 649
#pragma warning disable 169
private string m_SpeakToMe;
public int SpeakToMe { get; set; }
private int? breathe;
private int? _breathe;
private int? _Breathe;
private int? m_breathe;
private int? m_Breathe;
public int Breathe
{
get { return (int)breathe; }
set { breathe = value; }
}
private string onTheRun;
private int? _onTheRun;
private int? _OnTheRun;
private int? m_onTheRun;
private int? m_OnTheRun;
public int OnTheRun
{
get { return (int)_onTheRun; }
set { _onTheRun = value; }
}
private int? _time;
private int? _Time;
private int? m_time;
private int? m_Time;
public int Time
{
get { return (int)_time; }
set { _time = value; }
}
private string _theGreatGigInTheSky;
private int? _TheGreatGigInTheSky;
private int? m_theGreatGigInTheSky;
private int? m_TheGreatGigInTheSky;
public int TheGreatGigInTheSky
{
get { return (int)_TheGreatGigInTheSky; }
set { _TheGreatGigInTheSky = value; }
}
private int? _Money;
private int? m_money;
private int? m_Money;
public int Money
{
get { return (int)_Money; }
set { _Money = value; }
}
private string _UsAndThem;
private int? m_usAndThem;
private int? m_UsAndThem;
public int UsAndThem
{
get { return (int)m_usAndThem; }
set { m_usAndThem = value; }
}
private int? m_anyColourYouLike;
private int? m_AnyColourYouLike;
public int AnyColourYouLike
{
get { return (int)m_anyColourYouLike; }
set { m_anyColourYouLike = value; }
}
private string m_brainDamage;
private int? m_BrainDamage;
public int BrainDamage
{
get { return (int)m_BrainDamage; }
set { m_BrainDamage = value; }
}
private int? m_Eclipse;
public int Eclipse
{
get { return (int)m_Eclipse; }
set { m_Eclipse = value; }
}
#pragma warning restore 649
#pragma warning restore 169
}
}
}
| 30.28866 | 111 | 0.573349 | [
"Apache-2.0"
] | garora/EntityFramework | test/EntityFramework.Tests/Metadata/FieldMatcherTest.cs | 5,876 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Win-Core-CloudFoundry-Template")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("David Dieruf")]
[assembly: AssemblyProduct("Win-Core-CloudFoundry-Template")]
[assembly: AssemblyCopyright("Copyright © David Dieruf 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("91eedcf0-e59d-4dc1-9b3d-e150fc7ebfd2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 39.378378 | 84 | 0.750172 | [
"Apache-2.0"
] | spring-operator/Tooling | visual-studio-templates/win-core-cloudfoundry/Win-Core-CloudFoundry-Template/Properties/AssemblyInfo.cs | 1,460 | C# |
using Ctrl.Core.Core.Attributes;
using Ctrl.Core.Core.Utils;
using Ctrl.Core.Entities.Dtos;
using Ctrl.Core.Entities.Paging;
using Ctrl.Core.Web;
using Ctrl.Core.Web.Attributes;
using Ctrl.Domain.Models.Dtos.Article;
using Ctrl.System.Business;
using Ctrl.System.Models.Entities;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel;
using System.Threading.Tasks;
using Ctrl.Domain.Models.Entities;
using Volo.Abp.Application.Dtos;
namespace Ctrl.Net.Areas.sysManage.Controllers
{
/// <summary>
/// 文章控制器
/// </summary>
public class ArticleController : BaseController
{
#region 构造函数
private readonly ISystemArticleLogic _systemArticleLogic;
public ArticleController(ISystemArticleLogic systemArticleLogic)
{
_systemArticleLogic = systemArticleLogic;
}
#endregion
#region 视图
/// <summary>
/// 列表
/// </summary>
/// <returns></returns>
[CreateBy("冯辉")]
[Description("应用系统-文章-列表")]
public IActionResult Index()
{
return View();
}
/// <summary>
/// 编辑
/// </summary>
/// <returns></returns>
[CreateBy("冯辉")]
[Description("应用系统-文章-编辑")]
[Permission("xtgl-wz-SaveArticle")]
public async Task<IActionResult> Edit(NullableIdInput input)
{
SystemArticle Article = new SystemArticle();
if (!input.Id.IsNullOrEmptyGuid())
{
// Article = await _systemArticleLogic.GetById(input.Id);
}
return View(Article);
}
#endregion
#region 方法
/// <summary>
/// 获取文章
/// </summary>
/// <returns></returns>
[CreateBy("冯辉")]
[Description("应用系统-文章-方法-获取文章")]
public async Task<JsonResult> GetList()
{
return null;
// return Json(await _systemArticleLogic.GetAllEnumerableAsync());
}
/// <summary>
/// 获取文章分页
/// </summary>
/// <returns></returns>
[CreateBy("冯辉")]
[Description("应用系统-文章-方法-获取文章列表")]
//public async Task<JsonResult> GetPagingArticle(SystemArticlePagingInput param)
public async Task<PagedResultDto<SystemArticleOutput>> GetPagingArticle(PagedAndSortedResultRequestDto param)
{
return await _systemArticleLogic.GetPagingArticle(param);
}
/// <summary>
/// 保存文章
/// </summary>
/// <returns></returns>
[HttpPost]
[CreateBy("冯辉")]
[ValidateAntiForgeryToken]
[Description("应用系统-文章类型-方法-保存文章类型")]
[Permission("xtgl-wz-SaveArticle")]
public async Task<JsonResult> SaveArticle(SystemArticle article) {
return Json(await _systemArticleLogic.SaveArticle(article));
}
#endregion
}
} | 29.1 | 117 | 0.586598 | [
"MIT"
] | hueifeng/Ctrl.Framework | src/Presentation/Ctrl.Net/Areas/sysManage/Controllers/ArticleController.cs | 3,108 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Text;
using System;
using System.Diagnostics.Contracts;
using System.Runtime.Serialization;
namespace System.Text
{
// An Encoder is used to encode a sequence of blocks of characters into
// a sequence of blocks of bytes. Following instantiation of an encoder,
// sequential blocks of characters are converted into blocks of bytes through
// calls to the GetBytes method. The encoder maintains state between the
// conversions, allowing it to correctly encode character sequences that span
// adjacent blocks.
//
// Instances of specific implementations of the Encoder abstract base
// class are typically obtained through calls to the GetEncoder method
// of Encoding objects.
//
internal class EncoderNLS : Encoder, ISerializable
{
// Need a place for the last left over character, most of our encodings use this
internal char charLeftOver;
protected EncodingNLS m_encoding;
protected bool m_mustFlush;
internal bool m_throwOnOverflow;
internal int m_charsUsed;
internal EncoderFallback m_fallback;
internal EncoderFallbackBuffer m_fallbackBuffer;
internal EncoderNLS(EncodingNLS encoding)
{
m_encoding = encoding;
m_fallback = m_encoding.EncoderFallback;
Reset();
}
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
throw new PlatformNotSupportedException();
}
internal new EncoderFallback Fallback
{
get { return m_fallback; }
}
internal bool InternalHasFallbackBuffer
{
get
{
return m_fallbackBuffer != null;
}
}
public new EncoderFallbackBuffer FallbackBuffer
{
get
{
if (m_fallbackBuffer == null)
{
if (m_fallback != null)
m_fallbackBuffer = m_fallback.CreateFallbackBuffer();
else
m_fallbackBuffer = EncoderFallback.ReplacementFallback.CreateFallbackBuffer();
}
return m_fallbackBuffer;
}
}
// This one is used when deserializing (like UTF7Encoding.Encoder)
internal EncoderNLS()
{
m_encoding = null;
Reset();
}
public override void Reset()
{
charLeftOver = (char)0;
if (m_fallbackBuffer != null)
m_fallbackBuffer.Reset();
}
[System.Security.SecuritySafeCritical] // auto-generated
public override unsafe int GetByteCount(char[] chars, int index, int count, bool flush)
{
// Validate input parameters
if (chars == null)
throw new ArgumentNullException(nameof(chars), SR.ArgumentNull_Array);
if (index < 0 || count < 0)
throw new ArgumentOutOfRangeException((index < 0 ? nameof(index): nameof(count)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (chars.Length - index < count)
throw new ArgumentOutOfRangeException(nameof(chars), SR.ArgumentOutOfRange_IndexCountBuffer);
Contract.EndContractBlock();
// Avoid empty input problem
if (chars.Length == 0)
chars = new char[1];
// Just call the pointer version
int result = -1;
fixed (char* pChars = &chars[0])
{
result = GetByteCount(pChars + index, count, flush);
}
return result;
}
[System.Security.SecurityCritical] // auto-generated
public override unsafe int GetByteCount(char* chars, int count, bool flush)
{
// Validate input parameters
if (chars == null)
throw new ArgumentNullException(nameof(chars), SR.ArgumentNull_Array);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
m_mustFlush = flush;
m_throwOnOverflow = true;
return m_encoding.GetByteCount(chars, count, this);
}
[System.Security.SecuritySafeCritical] // auto-generated
public override unsafe int GetBytes(char[] chars, int charIndex, int charCount,
byte[] bytes, int byteIndex, bool flush)
{
// Validate parameters
if (chars == null || bytes == null)
throw new ArgumentNullException((chars == null ? nameof(chars): nameof(bytes)), SR.ArgumentNull_Array);
if (charIndex < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((charIndex < 0 ? nameof(charIndex): nameof(charCount)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (chars.Length - charIndex < charCount)
throw new ArgumentOutOfRangeException(nameof(chars), SR.ArgumentOutOfRange_IndexCountBuffer);
if (byteIndex < 0 || byteIndex > bytes.Length)
throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.ArgumentOutOfRange_Index);
Contract.EndContractBlock();
if (chars.Length == 0)
chars = new char[1];
int byteCount = bytes.Length - byteIndex;
if (bytes.Length == 0)
bytes = new byte[1];
// Just call pointer version
fixed (char* pChars = &chars[0])
fixed (byte* pBytes = &bytes[0])
// Remember that charCount is # to decode, not size of array.
return GetBytes(pChars + charIndex, charCount,
pBytes + byteIndex, byteCount, flush);
}
[System.Security.SecurityCritical] // auto-generated
public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, bool flush)
{
// Validate parameters
if (chars == null || bytes == null)
throw new ArgumentNullException((chars == null ? nameof(chars): nameof(bytes)), SR.ArgumentNull_Array);
if (byteCount < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((byteCount < 0 ? nameof(byteCount): nameof(charCount)), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
m_mustFlush = flush;
m_throwOnOverflow = true;
return m_encoding.GetBytes(chars, charCount, bytes, byteCount, this);
}
// This method is used when your output buffer might not be large enough for the entire result.
// Just call the pointer version. (This gets bytes)
[System.Security.SecuritySafeCritical] // auto-generated
public override unsafe void Convert(char[] chars, int charIndex, int charCount,
byte[] bytes, int byteIndex, int byteCount, bool flush,
out int charsUsed, out int bytesUsed, out bool completed)
{
// Validate parameters
if (chars == null || bytes == null)
throw new ArgumentNullException((chars == null ? nameof(chars): nameof(bytes)), SR.ArgumentNull_Array);
if (charIndex < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((charIndex < 0 ? nameof(charIndex): nameof(charCount)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (byteIndex < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((byteIndex < 0 ? nameof(byteIndex): nameof(byteCount)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (chars.Length - charIndex < charCount)
throw new ArgumentOutOfRangeException(nameof(chars), SR.ArgumentOutOfRange_IndexCountBuffer);
if (bytes.Length - byteIndex < byteCount)
throw new ArgumentOutOfRangeException(nameof(bytes), SR.ArgumentOutOfRange_IndexCountBuffer);
Contract.EndContractBlock();
// Avoid empty input problem
if (chars.Length == 0)
chars = new char[1];
if (bytes.Length == 0)
bytes = new byte[1];
// Just call the pointer version (can't do this for non-msft encoders)
fixed (char* pChars = &chars[0])
{
fixed (byte* pBytes = &bytes[0])
{
Convert(pChars + charIndex, charCount, pBytes + byteIndex, byteCount, flush,
out charsUsed, out bytesUsed, out completed);
}
}
}
// This is the version that uses pointers. We call the base encoding worker function
// after setting our appropriate internal variables. This is getting bytes
[System.Security.SecurityCritical] // auto-generated
public override unsafe void Convert(char* chars, int charCount,
byte* bytes, int byteCount, bool flush,
out int charsUsed, out int bytesUsed, out bool completed)
{
// Validate input parameters
if (bytes == null || chars == null)
throw new ArgumentNullException(bytes == null ? nameof(bytes): nameof(chars), SR.ArgumentNull_Array);
if (charCount < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((charCount < 0 ? nameof(charCount): nameof(byteCount)), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// We don't want to throw
m_mustFlush = flush;
m_throwOnOverflow = false;
m_charsUsed = 0;
// Do conversion
bytesUsed = m_encoding.GetBytes(chars, charCount, bytes, byteCount, this);
charsUsed = m_charsUsed;
// Its completed if they've used what they wanted AND if they didn't want flush or if we are flushed
completed = (charsUsed == charCount) && (!flush || !HasState) &&
(m_fallbackBuffer == null || m_fallbackBuffer.Remaining == 0);
// Our data thingies are now full, we can return
}
public Encoding Encoding
{
get
{
return m_encoding;
}
}
public bool MustFlush
{
get
{
return m_mustFlush;
}
}
// Anything left in our encoder?
internal virtual bool HasState
{
get
{
return (charLeftOver != (char)0);
}
}
// Allow encoding to clear our must flush instead of throwing (in ThrowBytesOverflow)
internal void ClearMustFlush()
{
m_mustFlush = false;
}
}
}
| 39.145329 | 147 | 0.57845 | [
"MIT"
] | Acidburn0zzz/corefx | src/System.Text.Encoding.CodePages/src/System/Text/EncoderNLS.cs | 11,313 | C# |
//
// EventArgsTests.cs
//
// Author: Jeffrey Stedfast <[email protected]>
//
// Copyright (c) 2013-2018 Xamarin Inc. (www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using MimeKit;
using MailKit;
namespace UnitTests {
[TestFixture]
public class EventArgsTests
{
[Test]
public void TestAlertEventArgs ()
{
var args = new AlertEventArgs ("Klingons on the starboard bow!");
Assert.AreEqual ("Klingons on the starboard bow!", args.Message);
Assert.Throws<ArgumentNullException> (() => new AlertEventArgs (null));
}
[Test]
public void TestAuthenticatedEventArgs ()
{
var args = new AuthenticatedEventArgs ("Access Granted.");
Assert.AreEqual ("Access Granted.", args.Message);
Assert.Throws<ArgumentNullException> (() => new AuthenticatedEventArgs (null));
}
[Test]
public void TestFolderCreatedEventArgs ()
{
Assert.Throws<ArgumentNullException> (() => new FolderCreatedEventArgs (null));
}
[Test]
public void TestFolderRenamedEventArgs ()
{
var args = new FolderRenamedEventArgs ("Istanbul", "Constantinople");
Assert.AreEqual ("Istanbul", args.OldName);
Assert.AreEqual ("Constantinople", args.NewName);
Assert.Throws<ArgumentNullException> (() => new FolderRenamedEventArgs (null, "name"));
Assert.Throws<ArgumentNullException> (() => new FolderRenamedEventArgs ("name", null));
}
[Test]
public void TestMessageEventArgs ()
{
var args = new MessageEventArgs (0);
Assert.AreEqual (0, args.Index);
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageEventArgs (-1));
}
[Test]
public void TestMessageFlagsChangedEventArgs ()
{
var userFlags = new HashSet<string> (new [] { "custom1", "custom2" });
MessageFlagsChangedEventArgs args;
var uid = new UniqueId (5);
ulong modseq = 724;
args = new MessageFlagsChangedEventArgs (0);
Assert.AreEqual (0, args.UserFlags.Count);
Assert.AreEqual (MessageFlags.None, args.Flags);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.IsFalse (args.ModSeq.HasValue);
Assert.AreEqual (0, args.Index);
args = new MessageFlagsChangedEventArgs (0, MessageFlags.Answered);
Assert.AreEqual (0, args.UserFlags.Count);
Assert.AreEqual (MessageFlags.Answered, args.Flags);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.IsFalse (args.ModSeq.HasValue);
Assert.AreEqual (0, args.Index);
args = new MessageFlagsChangedEventArgs (0, MessageFlags.Answered, modseq);
Assert.AreEqual (0, args.UserFlags.Count);
Assert.AreEqual (MessageFlags.Answered, args.Flags);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.AreEqual (modseq, args.ModSeq);
Assert.AreEqual (0, args.Index);
args = new MessageFlagsChangedEventArgs (0, MessageFlags.Answered, userFlags);
Assert.AreEqual (userFlags.Count, args.UserFlags.Count);
Assert.AreEqual (MessageFlags.Answered, args.Flags);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.IsFalse (args.ModSeq.HasValue);
Assert.AreEqual (0, args.Index);
args = new MessageFlagsChangedEventArgs (0, MessageFlags.Answered, userFlags, modseq);
Assert.AreEqual (userFlags.Count, args.UserFlags.Count);
Assert.AreEqual (MessageFlags.Answered, args.Flags);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.AreEqual (modseq, args.ModSeq);
Assert.AreEqual (0, args.Index);
args = new MessageFlagsChangedEventArgs (0, uid, MessageFlags.Answered);
Assert.AreEqual (0, args.UserFlags.Count);
Assert.AreEqual (MessageFlags.Answered, args.Flags);
Assert.AreEqual (uid, args.UniqueId);
Assert.IsFalse (args.ModSeq.HasValue);
Assert.AreEqual (0, args.Index);
args = new MessageFlagsChangedEventArgs (0, uid, MessageFlags.Answered, modseq);
Assert.AreEqual (0, args.UserFlags.Count);
Assert.AreEqual (MessageFlags.Answered, args.Flags);
Assert.AreEqual (uid, args.UniqueId);
Assert.AreEqual (modseq, args.ModSeq);
Assert.AreEqual (0, args.Index);
args = new MessageFlagsChangedEventArgs (0, uid, MessageFlags.Answered, userFlags);
Assert.AreEqual (userFlags.Count, args.UserFlags.Count);
Assert.AreEqual (MessageFlags.Answered, args.Flags);
Assert.AreEqual (uid, args.UniqueId);
Assert.IsFalse (args.ModSeq.HasValue);
Assert.AreEqual (0, args.Index);
args = new MessageFlagsChangedEventArgs (0, uid, MessageFlags.Answered, userFlags, modseq);
Assert.AreEqual (userFlags.Count, args.UserFlags.Count);
Assert.AreEqual (MessageFlags.Answered, args.Flags);
Assert.AreEqual (uid, args.UniqueId);
Assert.AreEqual (modseq, args.ModSeq);
Assert.AreEqual (0, args.Index);
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageFlagsChangedEventArgs (-1));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageFlagsChangedEventArgs (-1, MessageFlags.Answered));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageFlagsChangedEventArgs (-1, MessageFlags.Answered, modseq));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageFlagsChangedEventArgs (-1, MessageFlags.Answered, userFlags));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageFlagsChangedEventArgs (-1, MessageFlags.Answered, userFlags, modseq));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageFlagsChangedEventArgs (-1, uid, MessageFlags.Answered));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageFlagsChangedEventArgs (-1, uid, MessageFlags.Answered, modseq));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageFlagsChangedEventArgs (-1, uid, MessageFlags.Answered, userFlags));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageFlagsChangedEventArgs (-1, uid, MessageFlags.Answered, userFlags, modseq));
Assert.Throws<ArgumentNullException> (() => new MessageFlagsChangedEventArgs (0, MessageFlags.Answered, null));
Assert.Throws<ArgumentNullException> (() => new MessageFlagsChangedEventArgs (0, MessageFlags.Answered, null, modseq));
Assert.Throws<ArgumentNullException> (() => new MessageFlagsChangedEventArgs (0, uid, MessageFlags.Answered, null));
Assert.Throws<ArgumentNullException> (() => new MessageFlagsChangedEventArgs (0, uid, MessageFlags.Answered, null, modseq));
}
[Test]
public void TestMessageLabelsChangedEventArgs ()
{
var labels = new string[] { "label1", "label2" };
MessageLabelsChangedEventArgs args;
var uid = new UniqueId (5);
ulong modseq = 724;
args = new MessageLabelsChangedEventArgs (0);
Assert.IsNull (args.Labels);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.IsFalse (args.ModSeq.HasValue);
Assert.AreEqual (0, args.Index);
args = new MessageLabelsChangedEventArgs (0, labels);
Assert.AreEqual (labels.Length, args.Labels.Count);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.IsFalse (args.ModSeq.HasValue);
Assert.AreEqual (0, args.Index);
args = new MessageLabelsChangedEventArgs (0, labels, modseq);
Assert.AreEqual (labels.Length, args.Labels.Count);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.AreEqual (modseq, args.ModSeq);
Assert.AreEqual (0, args.Index);
args = new MessageLabelsChangedEventArgs (0, uid, labels);
Assert.AreEqual (labels.Length, args.Labels.Count);
Assert.AreEqual (uid, args.UniqueId);
Assert.IsFalse (args.ModSeq.HasValue);
Assert.AreEqual (0, args.Index);
args = new MessageLabelsChangedEventArgs (0, uid, labels, modseq);
Assert.AreEqual (labels.Length, args.Labels.Count);
Assert.AreEqual (uid, args.UniqueId);
Assert.AreEqual (modseq, args.ModSeq);
Assert.AreEqual (0, args.Index);
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageLabelsChangedEventArgs (-1));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageLabelsChangedEventArgs (-1, labels));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageLabelsChangedEventArgs (-1, labels, modseq));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageLabelsChangedEventArgs (-1, uid, labels));
Assert.Throws<ArgumentOutOfRangeException> (() => new MessageLabelsChangedEventArgs (-1, uid, labels, modseq));
Assert.Throws<ArgumentNullException> (() => new MessageLabelsChangedEventArgs (0, null));
Assert.Throws<ArgumentNullException> (() => new MessageLabelsChangedEventArgs (0, null, modseq));
Assert.Throws<ArgumentNullException> (() => new MessageLabelsChangedEventArgs (0, uid, null));
Assert.Throws<ArgumentNullException> (() => new MessageLabelsChangedEventArgs (0, uid, null, modseq));
}
[Test]
public void TestMessageSentEventArgs ()
{
var message = new MimeMessage ();
MessageSentEventArgs args;
args = new MessageSentEventArgs (message, "response");
Assert.AreEqual (message, args.Message);
Assert.AreEqual ("response", args.Response);
Assert.Throws<ArgumentNullException> (() => new MessageSentEventArgs (null, "response"));
Assert.Throws<ArgumentNullException> (() => new MessageSentEventArgs (message, null));
}
[Test]
public void TestMessageSummaryFetchedEventArgs ()
{
var message = new MessageSummary (0);
MessageSummaryFetchedEventArgs args;
args = new MessageSummaryFetchedEventArgs (message);
Assert.AreEqual (message, args.Message);
Assert.Throws<ArgumentNullException> (() => new MessageSummaryFetchedEventArgs (null));
}
[Test]
public void TestMessagesVanishedEventArgs ()
{
var uids = new UniqueIdRange (0, 5, 7);
MessagesVanishedEventArgs args;
args = new MessagesVanishedEventArgs (uids, true);
Assert.AreEqual (uids, args.UniqueIds);
Assert.IsTrue (args.Earlier);
Assert.Throws<ArgumentNullException> (() => new MessagesVanishedEventArgs (null, false));
}
[Test]
public void TestMetadataChangedEventArgs ()
{
var args = new MetadataChangedEventArgs (new Metadata (MetadataTag.PrivateComment, "this is a comment"));
Assert.AreEqual (MetadataTag.PrivateComment, args.Metadata.Tag, "Tag");
Assert.AreEqual ("this is a comment", args.Metadata.Value, "Value");
Assert.Throws<ArgumentNullException> (() => new MetadataChangedEventArgs (null));
}
[Test]
public void TestModSeqChangedEventArgs ()
{
ModSeqChangedEventArgs args;
ulong modseq = 724;
args = new ModSeqChangedEventArgs (0);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.AreEqual (0, args.ModSeq);
Assert.AreEqual (0, args.Index);
args = new ModSeqChangedEventArgs (0, modseq);
Assert.IsFalse (args.UniqueId.HasValue);
Assert.AreEqual (modseq, args.ModSeq);
Assert.AreEqual (0, args.Index);
args = new ModSeqChangedEventArgs (0, UniqueId.MinValue, modseq);
Assert.AreEqual (UniqueId.MinValue, args.UniqueId);
Assert.AreEqual (modseq, args.ModSeq);
Assert.AreEqual (0, args.Index);
Assert.Throws<ArgumentOutOfRangeException> (() => new ModSeqChangedEventArgs (-1));
Assert.Throws<ArgumentOutOfRangeException> (() => new ModSeqChangedEventArgs (-1, modseq));
Assert.Throws<ArgumentOutOfRangeException> (() => new ModSeqChangedEventArgs (-1, UniqueId.MinValue, modseq));
}
}
}
| 39.97377 | 139 | 0.735892 | [
"MIT"
] | nisharms/test | UnitTests/EventArgsTests.cs | 12,194 | C# |
namespace Wordleans.Api.Grains;
public class RiddleStatus
{
public string WinningWord { get; set; }
public GuessResult[] Guesses { get; set; }
} | 21.857143 | 46 | 0.712418 | [
"MIT"
] | alkampfergit/wordleans | src/Wordleans.Api/Grains/RiddleStatus.cs | 153 | C# |
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Reflection;
using System.Linq;
using System.Xml.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Amazon.CodeAnalysis.Shared;
namespace Amazon.Polly.CodeAnalysis
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class PropertyValueAssignmentAnalyzer : AbstractPropertyValueAssignmentAnalyzer
{
public override string GetServiceName()
{
return "Polly";
}
}
} | 26.92 | 91 | 0.745914 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/code-analysis/ServiceAnalysis/Polly/Generated/PropertyValueAssignmentAnalyzer.cs | 673 | C# |
using UnityEngine;
using UnityEngine.Rendering;
namespace HorizonBasedAmbientOcclusion.Universal
{
public class HBAOControl : MonoBehaviour
{
public VolumeProfile postProcessProfile;
public UnityEngine.UI.Slider aoRadiusSlider;
private bool m_HbaoDisplayed = true;
public void Start()
{
HBAO hbao;
postProcessProfile.TryGet(out hbao);
if (hbao != null)
{
hbao.EnableHBAO(true);
hbao.SetDebugMode(HBAO.DebugMode.Disabled);
hbao.SetAoRadius(aoRadiusSlider.value);
}
}
public void ToggleHBAO()
{
HBAO hbao;
postProcessProfile.TryGet(out hbao);
if (hbao != null)
{
m_HbaoDisplayed = !m_HbaoDisplayed;
hbao.EnableHBAO(m_HbaoDisplayed);
}
}
public void ToggleShowAO()
{
HBAO hbao;
postProcessProfile.TryGet(out hbao);
if (hbao != null)
{
if (hbao.GetDebugMode() != HBAO.DebugMode.Disabled)
hbao.SetDebugMode(HBAO.DebugMode.Disabled);
else
hbao.SetDebugMode(HBAO.DebugMode.AOOnly);
}
}
public void UpdateAoRadius()
{
HBAO hbao;
postProcessProfile.TryGet(out hbao);
if (hbao != null)
hbao.SetAoRadius(aoRadiusSlider.value);
}
}
}
| 24.983871 | 67 | 0.517753 | [
"Unlicense"
] | LucasHilgevoord/Proeve-Van-Bekwaamheid | ToySalloon/ToySalloon/Assets/Horizon Based Ambient Occlusion/SRP/URP/Demo/Runtime/HBAOControl.cs | 1,551 | C# |
// License
// https://github.com/ClydeDz/demo-nuget/blob/master/LICENSE
namespace DemoNugetByClydeDSouza
{
public class DemoOne
{
public static int Add(int a, int b)
{
return a + b;
}
}
}
| 17 | 60 | 0.57563 | [
"MIT"
] | ClydeDz/demo-nuget | Src/DemoNuget/DemoNuget/DemoOne.cs | 240 | C# |
using System;
using System.Xml.Serialization;
using System.ComponentModel.DataAnnotations;
using BroadWorksConnector.Ocip.Validation;
using System.Collections.Generic;
namespace BroadWorksConnector.Ocip.Models
{
/// <summary>
/// Get the list of users that are unreachable from the primary application server.
/// The response is a SystemGeographicRedundancyUnreachableFromPrimaryGetUserListResponse22 or an ErrorResponse.
/// <see cref="SystemGeographicRedundancyUnreachableFromPrimaryGetUserListResponse22"/>
/// <see cref="ErrorResponse"/>
/// </summary>
[Serializable]
[XmlRoot(Namespace = "")]
[Groups(@"[{""__type"":""Sequence:#BroadWorksConnector.Ocip.Validation"",""id"":""7f663d5135470c33ca64b0eed3c3aa0c:10601""}]")]
public class SystemGeographicRedundancyUnreachableFromPrimaryGetUserListRequest22 : BroadWorksConnector.Ocip.Models.C.OCIRequest<BroadWorksConnector.Ocip.Models.SystemGeographicRedundancyUnreachableFromPrimaryGetUserListResponse22>
{
private int _userListSizeLimit;
[XmlElement(ElementName = "userListSizeLimit", IsNullable = false, Namespace = "")]
[Optional]
[Group(@"7f663d5135470c33ca64b0eed3c3aa0c:10601")]
[MinInclusive(1)]
[MaxInclusive(10000)]
public int UserListSizeLimit
{
get => _userListSizeLimit;
set
{
UserListSizeLimitSpecified = true;
_userListSizeLimit = value;
}
}
[XmlIgnore]
protected bool UserListSizeLimitSpecified { get; set; }
}
}
| 36.454545 | 235 | 0.700125 | [
"MIT"
] | cwmiller/broadworks-connector-net | BroadworksConnector/Ocip/Models/SystemGeographicRedundancyUnreachableFromPrimaryGetUserListRequest22.cs | 1,604 | C# |
using FortBlast.Extras;
using FortBlast.Resources;
using UnityEngine;
namespace FortBlast.Common
{
public class CollectObjectAndAddToInventory : MonoBehaviour
{
public InventoryItem inventoryItem;
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.CompareTag(TagManager.Player))
{
ResourceManager.instance.AddResource(inventoryItem);
Destroy(gameObject);
}
}
}
} | 24.8 | 68 | 0.639113 | [
"MIT"
] | Rud156/FortBlast | Assets/Scripts/Common/CollectObjectAndAddToInventory.cs | 498 | C# |
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from https://docs.microsoft.com/en-us/windows/win32/appxpkg/how-to-programmatically-sign-a-package
// Original source is Copyright © Microsoft. All rights reserved. Licensed under the MIT License (MIT).
using NUnit.Framework;
using System;
using System.Runtime.InteropServices;
namespace TerraFX.Interop.Windows.UnitTests;
/// <summary>Provides validation of the <see cref="SIGNER_ATTR_AUTHCODE" /> struct.</summary>
public static unsafe partial class SIGNER_ATTR_AUTHCODETests
{
/// <summary>Validates that the <see cref="SIGNER_ATTR_AUTHCODE" /> struct is blittable.</summary>
[Test]
public static void IsBlittableTest()
{
Assert.That(Marshal.SizeOf<SIGNER_ATTR_AUTHCODE>(), Is.EqualTo(sizeof(SIGNER_ATTR_AUTHCODE)));
}
/// <summary>Validates that the <see cref="SIGNER_ATTR_AUTHCODE" /> struct has the right <see cref="LayoutKind" />.</summary>
[Test]
public static void IsLayoutSequentialTest()
{
Assert.That(typeof(SIGNER_ATTR_AUTHCODE).IsLayoutSequential, Is.True);
}
/// <summary>Validates that the <see cref="SIGNER_ATTR_AUTHCODE" /> struct has the correct size.</summary>
[Test]
public static void SizeOfTest()
{
if (Environment.Is64BitProcess)
{
Assert.That(sizeof(SIGNER_ATTR_AUTHCODE), Is.EqualTo(32));
}
else
{
Assert.That(sizeof(SIGNER_ATTR_AUTHCODE), Is.EqualTo(20));
}
}
}
| 37.186047 | 145 | 0.702939 | [
"MIT"
] | IngmarBitter/terrafx.interop.windows | tests/Interop/Windows/Windows/other/mssign32/SIGNER_ATTR_AUTHCODETests.cs | 1,601 | C# |
using FreeTime.Application.Common.Interfaces;
using Microsoft.AspNetCore.Http;
using System.Security.Claims;
namespace FreeTime.Web.Application
{
public class CurrentUserService : ICurrentUserService
{
private readonly IHttpContextAccessor _httpContextAccessor;
public CurrentUserService(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
private string user => _httpContextAccessor?.HttpContext?.User.FindFirstValue(ClaimTypes.NameIdentifier);
public int userId
{
get { return int.Parse(user); }
}
}
}
| 29.318182 | 113 | 0.705426 | [
"MIT"
] | uthmanrahimi/FreeTimeBlog | src/FreeTime/Application/CurrentUserService.cs | 647 | C# |
using System;
using System.Data;
using System.Collections;
using System.Text.RegularExpressions;
using Microsoft.VisualBasic;
using ECMPS.Checks.CheckEngine;
using ECMPS.Checks.Parameters;
using ECMPS.Checks.TypeUtilities;
using ECMPS.ErrorSuppression;
namespace ECMPS.Checks.QAEvaluation
{
public class cFlowLoadReference : cQaTestReportCategory
{
#region Private Fields
private string mMonitorLocationID;
private cQAMain mQA;
private string mTestSumID;
private string mSystemID;
//private long mUnitID;
//private string mStackPipeID;
#endregion
#region Constructors
public cFlowLoadReference(cCheckEngine CheckEngine, cQAMain QA, string MonitorLocationID, string TestSumID)
: base(QA, "F2LREF")
{
InitializeCurrent(MonitorLocationID, TestSumID);
mMonitorLocationID = MonitorLocationID;
mQA = QA;
mTestSumID = TestSumID;
TableName = "TEST_SUMMARY";
CurrentRowId = mTestSumID;
FilterData();
SetRecordIdentifier();
}
#endregion
public string TestSumID
{
get
{
return mTestSumID;
}
}
#region Public Methods
public new bool ProcessChecks()
{
return base.ProcessChecks();
}
#endregion
#region Base Class Overrides
protected override void FilterData()
{
SetCheckParameter("Current_Flow_to_Load_Reference", new DataView(mQA.SourceData.Tables["QAFlowLoadReference"],
"test_sum_id = '" + mTestSumID + "'", "", DataViewRowState.CurrentRows)[0], eParameterDataType.DataRowView);
SetCheckParameter("Current_Test", new DataView(mQA.SourceData.Tables["QATestSummary"],
"test_sum_id = '" + mTestSumID + "'", "", DataViewRowState.CurrentRows)[0], eParameterDataType.DataRowView);
mSystemID = cDBConvert.ToString(((DataRowView)GetCheckParameter("Current_Flow_To_Load_Reference").ParameterValue)["mon_sys_id"]);
SetCheckParameter("Current_Location", new DataView(mQA.SourceData.Tables["QALocation"],
"", "", DataViewRowState.CurrentRows)[0], eParameterDataType.DataRowView);
SetCheckParameter("Flow_to_Load_Reference_Records", new DataView(mQA.SourceData.Tables["QAFlowLoadReference"],
"mon_sys_id = '" + mSystemID + "'", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("QA_Supplemental_Data_Records", new DataView(mQA.SourceData.Tables["QASuppData"],
"", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("QA_Supplemental_Attribute_Records", new DataView(mQA.SourceData.Tables["QASuppAttribute"],
"", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("Facility_QA_Supplemental_Data_Records", new DataView(mQA.SourceData.Tables["FacilityQASuppData"],
"", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("Facility_QA_Supplemental_Attribute_Records", new DataView(mQA.SourceData.Tables["FacilityQASuppAttribute"],
"", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("Facility_Unit_Stack_Configuration_Records", new DataView(mQA.SourceData.Tables["FacilityUnitStackConfiguration"],
"", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("Facility_RATA_Run_Records", new DataView(mQA.SourceData.Tables["FacilityRATARun"],
"", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("Facility_RATA_Summary_Records", new DataView(mQA.SourceData.Tables["FacilityRATASummary"],
"", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("System_RATA_Summary_Records", new DataView(mQA.SourceData.Tables["FacilityRATASummary"],
"mon_sys_id = '" + mSystemID + "'", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("Test_Tolerances_Cross_Check_Table", new DataView(mQA.SourceData.Tables["CrossCheck_TestTolerances"],
"TestTypeCode = 'F2LREF'", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("Operating_Level_Code_Lookup_Table", new DataView(mQA.SourceData.Tables["OperatingLevelCode"],
"", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("Load_Records", new DataView(mQA.SourceData.Tables["QALoad"],
"Mon_loc_id = '" + mMonitorLocationID + "'", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
SetCheckParameter("Monitoring_Plan_Location_Records_for_QA", new DataView(mQA.SourceData.Tables["MonitorPlanLocation"],
"", "", DataViewRowState.CurrentRows), eParameterDataType.DataView);
}
protected override void SetRecordIdentifier()
{
RecordIdentifier = "this test";
}
#endregion
}
} | 35.688406 | 138 | 0.731777 | [
"MIT"
] | US-EPA-CAMD/easey-quartz-scheduler | CheckEngine/QA/Categories/Report/FlowLoadReference.cs | 4,925 | C# |
using Dahomey.Json.Attributes;
using System;
using System.Numerics;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ch1seL.TonNet.Client.Models
{
/// <summary>
/// Not described yet..
/// </summary>
public class ParamsOfFactorize
{
/// <summary>
/// Hexadecimal representation of u64 composite number.
/// </summary>
[JsonPropertyName("composite")]
public string Composite { get; set; }
}
} | 23.95 | 63 | 0.643006 | [
"Apache-2.0"
] | freeton-org/ton-client-dotnet | src/ch1seL.TonNet.Client.Models/Generated/Models/ParamsOfFactorize.cs | 479 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BallCollider : MonoBehaviour
{
public bool isForvet = false;
private LevelManager levelManager;
private SoundEffectsController soundEffectPlayer;
private void Start()
{
levelManager = GameObject.Find("LevelManager").GetComponent<LevelManager>();
soundEffectPlayer = GameObject.Find("SoundEffectController").GetComponent<SoundEffectsController>();
}
private void OnTriggerEnter(Collider other)
{
if (other.transform.tag == "goalTarget")
{
Time.timeScale = 1f;
soundEffectPlayer.PlayGoal();
// Goal
Destroy(levelManager.mainCamera.GetComponent<CameraController>());
levelManager.mainCamera.gameObject.AddComponent<CameraShake>();
levelManager.questionManager.trueOrFalse.GetComponent<Text>().color = Color.white;
levelManager.questionManager.trueOrFalse.GetComponent<Text>().text = "Goool!!";
levelManager. questionManager.trueOrFalse.GetComponent<Animator>().SetTrigger("setAnim");
levelManager.allPlayers.transform.GetChild(0).GetChild(5).GetComponent<Animator>().SetTrigger("isGoal");
Destroy(levelManager.allPlayers.transform.GetChild(1).GetChild(0).GetComponent<Animator>());
Destroy(this);
}
}
private void OnCollisionEnter(Collision collision)
{
Time.timeScale = 1f;
if (isForvet)
{
if(collision.transform.tag == "red")
{
// Goalkeeper saves.
levelManager.restartLastPosition();
gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
gameObject.GetComponent<Rigidbody>().angularVelocity = Vector3.zero;
}
}
else
{
gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
gameObject.GetComponent<Rigidbody>().angularVelocity = Vector3.zero;
if (collision.transform.tag == "target")
{
Debug.Log("SUCCESS");
levelManager.playerGotTheBall();
}
else
{
levelManager.restartLastPosition();
}
}
}
}
| 32.260274 | 116 | 0.61741 | [
"Apache-2.0"
] | onurozler/Fizbol | Assets/Scripts/BallCollider.cs | 2,357 | C# |
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
namespace Frogy.Methods
{
/// <summary>
/// 数据相关Helper类
/// </summary>
class MyDataHelper
{
/// <summary>
/// 将Json反序列化为对象
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="Json">Json</param>
/// <returns>对象</returns>
public static T CoverJsonToObject<T>(string Json)
{
return JsonConvert.DeserializeObject<T>(Json);
}
/// <summary>
/// 将对象序列化为Json
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="Object">对象</param>
/// <returns>Json</returns>
public static string CoverObjectToJson<T>(T Object)
{
return JsonConvert.SerializeObject(Object, Formatting.Indented);
}
/// <summary>
/// 将内容写入文件
/// </summary>
/// <param name="Path">文件路径</param>
/// <param name="Content">文件内容</param>
public static void WriteFile(string Path,string Content)
{
FileStream fileStream = new FileStream(Path, FileMode.Create);
StreamWriter streamWriter = new StreamWriter(fileStream);
streamWriter.Write(Content);
streamWriter.Flush();
streamWriter.Close();
fileStream.Close();
}
/// <summary>
/// 读取文件
/// </summary>
/// <param name="Path">文件路径</param>
/// <returns>文件内容</returns>
public static string ReadFile(string Path)
{
FileStream fileStream = new FileStream(Path, FileMode.Open, FileAccess.Read);
byte[] bytes = new byte[fileStream.Length];
fileStream.Read(bytes, 0, bytes.Length);
char[] content = Encoding.UTF8.GetChars(bytes);
fileStream.Close();
return new string(content);
}
/// <summary>
/// 将图片转码位Base64
/// </summary>
/// <param name="bmp">Bitmap</param>
/// <returns>Base64</returns>
public static string ImgToBase64String(Bitmap bmp)
{
try
{
MemoryStream ms = new MemoryStream();
bmp.Save(ms, ImageFormat.Png);
byte[] arr = new byte[ms.Length];
ms.Position = 0;
ms.Read(arr, 0, (int)ms.Length);
ms.Close();
return Convert.ToBase64String(arr);
}
catch
{
return null;
}
}
/// <summary>
/// 将Base64转码为图片
/// </summary>
/// <param name="strbase64">Base64</param>
/// <returns>Bitmap</returns>
public static Bitmap Base64StringToImage(string strbase64)
{
try
{
byte[] arr = Convert.FromBase64String(strbase64);
MemoryStream ms = new MemoryStream(arr);
Bitmap bmp = new Bitmap(ms);
ms.Close();
return bmp;
}
catch
{
return null;
}
}
/// <summary>
/// 将Bitmap转换为BitmapImage
/// </summary>
/// <param name="bitmap">Bitmap</param>
/// <returns>BitmapImage 若bitmap为空或无效,则返回null</returns>
public static BitmapImage BitmapToBitmapImage(Bitmap bitmap)
{
if (bitmap == null) return null;
BitmapImage bitmapImage = new BitmapImage();
using (MemoryStream ms = new MemoryStream())
{
bitmap.Save(ms, ImageFormat.Png);
bitmapImage.BeginInit();
bitmapImage.StreamSource = ms;
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.EndInit();
bitmapImage.Freeze();
}
return bitmapImage;
}
public static void TransferFolder(string srcFolder, string destFolder)
{
string fileName, destFile;
if (Directory.Exists(srcFolder))
{
if (!Directory.Exists(destFolder)) Directory.CreateDirectory(destFolder);
string[] files = Directory.GetFiles(srcFolder);
foreach (string s in files)
{
fileName = Path.GetFileName(s);
destFile = Path.Combine(destFolder, fileName);
File.Copy(s, destFile, true);
}
}
else
{
throw new InvalidOperationException("Source folder not found!");
}
}
public static void RenameFile(string srcFile, string destFile)
{
FileInfo fi = new FileInfo(srcFile); //xx/xx/aa.rar
if(File.Exists(destFile))
File.Copy(destFile, destFile + ".bak");
if(File.Exists(destFile)) File.Delete(destFile);
fi.MoveTo(destFile); //xx/xx/xx.rar
File.Delete(destFile + ".bak");
}
}
}
| 30.72 | 89 | 0.518415 | [
"MIT"
] | dimojang/Frogy | Methods/MyDataHelper.cs | 5,548 | C# |
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace Microsoft.Azure.Management.Internal.Network.Version2017_03_01.Models
{
using Microsoft.Azure;
using Microsoft.Azure.Management;
using Microsoft.Azure.Management.Internal;
using Microsoft.Azure.Management.Internal.Network;
using Microsoft.Azure.Management.Internal.Network.Version2017_03_01;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Effective network security group.
/// </summary>
public partial class EffectiveNetworkSecurityGroup
{
/// <summary>
/// Initializes a new instance of the EffectiveNetworkSecurityGroup
/// class.
/// </summary>
public EffectiveNetworkSecurityGroup()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the EffectiveNetworkSecurityGroup
/// class.
/// </summary>
/// <param name="networkSecurityGroup">The ID of network security group
/// that is applied.</param>
/// <param name="effectiveSecurityRules">A collection of effective
/// security rules.</param>
/// <param name="tagMap">Tag map.</param>
public EffectiveNetworkSecurityGroup(SubResource networkSecurityGroup = default(SubResource), EffectiveNetworkSecurityGroupAssociation association = default(EffectiveNetworkSecurityGroupAssociation), IList<EffectiveNetworkSecurityRule> effectiveSecurityRules = default(IList<EffectiveNetworkSecurityRule>), IDictionary<string, List<string>> tagMap = default(IDictionary<string, List<string>>))
{
NetworkSecurityGroup = networkSecurityGroup;
Association = association;
EffectiveSecurityRules = effectiveSecurityRules;
TagMap = tagMap;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets the ID of network security group that is applied.
/// </summary>
[JsonProperty(PropertyName = "networkSecurityGroup")]
public SubResource NetworkSecurityGroup { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "association")]
public EffectiveNetworkSecurityGroupAssociation Association { get; set; }
/// <summary>
/// Gets or sets a collection of effective security rules.
/// </summary>
[JsonProperty(PropertyName = "effectiveSecurityRules")]
public IList<EffectiveNetworkSecurityRule> EffectiveSecurityRules { get; set; }
/// <summary>
/// Gets or sets the tag map.
/// </summary>
[JsonProperty(PropertyName = "tagMap")]
public IDictionary<string, List<string>> TagMap { get; set; }
}
}
| 40.641026 | 402 | 0.643533 | [
"MIT"
] | Azure/azure-powershell-common | src/Network/Version2017_03_01/Models/EffectiveNetworkSecurityGroup.cs | 3,170 | C# |
// =======================================================
// Author: Davain Pablo Edwards
// Email: [email protected]
// Web:
// =======================================================
using System;
using System.Linq;
using System.Threading.Tasks;
using RESTfulAPI.Extensions;
using RESTfulAPI.ViewModels;
using Microsoft.AspNetCore.Mvc;
using RESTfulAPI.Responses;
using Microsoft.AspNetCore.Authorization;
using RESTfulAPI.Core.DataLayer;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.Options;
using RESTfulAPI.Core.AppSettingsLayer;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using System.Net;
using RESTfulAPI.Core;
using System.IO;
using System.Runtime.InteropServices;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace RESTfulAPI.Controllers
{
/// <summary>
///
/// </summary>
[Route("api/1.0/webservice/[controller]")]
public class PurchaseOrderStatusController : Controller
{
private IRESTfulAPI_Repository _RESTfulAPI_Repository;
private readonly IOptions<DatabaseSettings> _databaseSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IOptions<LinuxSettings> _linuxSettings;
/// <summary>
///
/// </summary>
/// <param name="repository"></param>
/// <param name="databaseSettings"></param>
/// <param name="hostingEnvironment"></param>
/// <param name="linuxSettings"></param>
public PurchaseOrderStatusController(IRESTfulAPI_Repository repository, IOptions<DatabaseSettings> databaseSettings, IHostingEnvironment hostingEnvironment, IOptions<LinuxSettings> linuxSettings)
{
_RESTfulAPI_Repository = repository;
_databaseSettings = databaseSettings;
_hostingEnvironment = hostingEnvironment;
_linuxSettings = linuxSettings;
}
/// <summary>
///
/// </summary>
/// <param name="disposing"></param>
protected override void Dispose(Boolean disposing)
{
if (_RESTfulAPI_Repository != null)
{
_RESTfulAPI_Repository.Dispose();
}
base.Dispose(disposing);
}
/// <summary>
///
/// </summary>
/// <param name="pageSize"></param>
/// <param name="pageNumber"></param>
/// <param name="name"></param>
/// <returns></returns>
[HttpGet]
[ResponseCache(Duration = 30)]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[ApiExplorerSettings(IgnoreApi = false)]
public async Task<IActionResult> GetPurchaseOrderStatusesAsync(Int32? pageSize = 10, Int32? pageNumber = 1, String name = null)
{
var response = new ListModelResponse<PurchaseOrderStatusViewModel>() as IListModelResponse<PurchaseOrderStatusViewModel>;
try
{
response.PageSize = (Int32)pageSize;
response.PageNumber = (Int32)pageNumber;
response.Model = await Task.Run(() =>
{
return _RESTfulAPI_Repository
.GetPurchaseOrderStatuses(response.PageSize, response.PageNumber, name)
.Select(item => item.ToViewModel())
.ToList();
});
response.Info = String.Format("Total of records: {0}", response.Model.Count());
}
catch (Exception ex)
{
response.DidError = true;
response.ErrorMessage = ex.Message;
}
return response.ToHttpResponse();
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("{id}")]
[ResponseCache(Duration = 30)]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[ApiExplorerSettings(IgnoreApi = false)]
public async Task<IActionResult> GetPurchaseOrderStatusAsync(Int32 id)
{
var response = new SingleModelResponse<PurchaseOrderStatusViewModel>() as ISingleModelResponse<PurchaseOrderStatusViewModel>;
try
{
response.Model = await Task.Run(() =>
{
return _RESTfulAPI_Repository.GetPurchaseOrderStatus(id).ToViewModel();
});
}
catch (Exception ex)
{
response.DidError = true;
response.ErrorMessage = ex.Message;
}
return response.ToHttpResponse();
}
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
[HttpPost]
[ResponseCache(Duration = 30)]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[ApiExplorerSettings(IgnoreApi = false)]
public async Task<IActionResult> CreatePurchaseOrderStatusAsync([FromBody]PurchaseOrderStatusViewModel value)
{
var response = new SingleModelResponse<PurchaseOrderStatusViewModel>() as ISingleModelResponse<PurchaseOrderStatusViewModel>;
try
{
var entity = await Task.Run(() =>
{
return _RESTfulAPI_Repository.AddPurchaseOrderStatus(value.ToEntity());
});
if (response.DidError == false)
{
response.Model = entity.ToViewModel();
}
}
catch (Exception ex)
{
string webRoot = _hostingEnvironment.WebRootPath;
string errorGuid = String.Format(Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 16));
HttpContext.Session.SetString("ErrorGuid", errorGuid);
ViewBag.ErrorGuid = HttpContext.Session.GetString("ErrorGuid");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
using (StreamWriter w = new StreamWriter(webRoot + "\\log.txt", append: true))
{
Log.Logging(ex.ToString(), w, ViewBag.ErrorGuid);
}
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
using (StreamWriter w = new StreamWriter(webRoot + "/log.txt", append: true))
{
Log.Logging(ex.ToString(), w, ViewBag.ErrorGuid);
}
}
response.DidError = true;
//response.ErrorMessage = ex.ToString();
return this.Json(new { timestamp = DateTime.Now, errorGuid = ViewBag.ErrorGuid, status = HttpStatusCode.InternalServerError, info = "Error logged in log file." });
}
response.Info = "Client " + " " + HttpContext.Connection.RemoteIpAddress.ToString();
return response.ToHttpResponse();
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <param name="value"></param>
/// <returns></returns>
[HttpPut("{id}")]
[ResponseCache(Duration = 30)]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[ApiExplorerSettings(IgnoreApi = false)]
public async Task<IActionResult> UpdatePurchaseOrderStatusAsync(Int32 id, [FromBody]PurchaseOrderStatusViewModel value)
{
var response = new SingleModelResponse<PurchaseOrderStatusViewModel>() as ISingleModelResponse<PurchaseOrderStatusViewModel>;
try
{
var entity = await Task.Run(() =>
{
return _RESTfulAPI_Repository.UpdatePurchaseOrderStatus(id, value.ToEntity());
});
response.Model = entity.ToViewModel();
response.Info = "The record was updated successfully";
}
catch (Exception ex)
{
response.DidError = true;
response.ErrorMessage = ex.Message;
}
return response.ToHttpResponse();
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpDelete("{id}")]
[ResponseCache(Duration = 30)]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[ApiExplorerSettings(IgnoreApi = false)]
public async Task<IActionResult> DeletePurchaseOrderStatusAsync(Int32 id)
{
var response = new SingleModelResponse<PurchaseOrderStatusViewModel>() as ISingleModelResponse<PurchaseOrderStatusViewModel>;
try
{
var entity = await Task.Run(() =>
{
return _RESTfulAPI_Repository.DeletePurchaseOrderStatus(id);
});
response.Model = entity.ToViewModel();
response.Info = "The record was deleted successfully";
}
catch (Exception ex)
{
response.DidError = true;
response.ErrorMessage = ex.Message;
}
return response.ToHttpResponse();
}
}
}
| 31.993399 | 203 | 0.560243 | [
"MIT"
] | dpedwards/dotnet-core-restapi | RESTfulAPI/RESTfulAPI/Controllers/PurchaseOrderStatusController.cs | 9,696 | C# |
using System.Reflection;
using TheTankGame.Entities.Miscellaneous;
using TheTankGame.Entities.Miscellaneous.Contracts;
namespace TheTankGame.Entities.Vehicles
{
public class Vanguard : BaseVehicle
{
public Vanguard(string model, double weight, decimal price, int attack, int defense, int hitPoints, IAssembler assembler)
: base(model, weight, price, attack, defense, hitPoints, assembler)
{
}
}
}
| 25.210526 | 130 | 0.668058 | [
"MIT"
] | PETROV442518/SoftUni | TheTankGame/TheTankGame/Entities/Vehicles/Vanguard.cs | 481 | C# |
using Stride.Core;
using Stride.Core.Mathematics;
namespace Stride.Physics.Constraints
{
[DataContract("DistanceLimitConstraint")]
[Display("Distance Limit Constraint")]
public class DistanceLimitConstraint : PhysicsConstraintComponent
{
public RigidbodyComponent BodyA { get; set; }
public RigidbodyComponent BodyB { get; set; }
private float minimumDistance = 1;
public float MinimumDistance
{
get => minimumDistance;
set
{
minimumDistance = value;
if (Simulation != null && Simulation.ConstraintExists(constraintHandle))
{
Simulation.UpdateConstraint(constraintHandle, CreateDescription());
}
}
}
private float maximumDistance = 0;
public float MaximumDistance
{
get => maximumDistance;
set
{
maximumDistance = value;
if (Simulation != null && Simulation.ConstraintExists(constraintHandle))
{
Simulation.UpdateConstraint(constraintHandle, CreateDescription());
}
}
}
private Vector3 localOffsetA;
public Vector3 LocalOffsetA
{
get => localOffsetA;
set
{
localOffsetA = value;
if (Simulation != null && Simulation.ConstraintExists(constraintHandle))
{
Simulation.UpdateConstraint(constraintHandle, CreateDescription());
}
}
}
private Vector3 localOffsetB;
public Vector3 LocalOffsetB
{
get => localOffsetB;
set
{
localOffsetB = value;
if (Simulation != null && Simulation.ConstraintExists(constraintHandle))
{
Simulation.UpdateConstraint(constraintHandle, CreateDescription());
}
}
}
private float springFrequency = 5;
public float SpringFrequency
{
get => springFrequency;
set
{
springFrequency = value;
if (Simulation != null && Simulation.ConstraintExists(constraintHandle))
{
Simulation.UpdateConstraint(constraintHandle, CreateDescription());
}
}
}
private float springDampingRatio = 2;
public float SpringDampingRatio
{
get => springDampingRatio;
set
{
springDampingRatio = value;
if (Simulation != null && Simulation.ConstraintExists(constraintHandle))
{
Simulation.UpdateConstraint(constraintHandle, CreateDescription());
}
}
}
protected override void OnAttach()
{
base.OnAttach();
constraintHandle = Simulation.AddConstraint(BodyA.BodyHandle, BodyB.BodyHandle, CreateDescription());
}
private BepuPhysics.Constraints.DistanceLimit CreateDescription()
{
return new BepuPhysics.Constraints.DistanceLimit
{
MinimumDistance = MinimumDistance,
MaximumDistance = MaximumDistance,
LocalOffsetA = new System.Numerics.Vector3(LocalOffsetA.X, LocalOffsetA.Y, LocalOffsetA.Z),
LocalOffsetB = new System.Numerics.Vector3(LocalOffsetB.X, LocalOffsetB.Y, LocalOffsetB.Z),
SpringSettings = new BepuPhysics.Constraints.SpringSettings(SpringFrequency, SpringDampingRatio),
};
}
protected override void OnDetach()
{
base.OnDetach();
Simulation.RemoveConstraint(constraintHandle);
}
}
}
| 30.183206 | 113 | 0.542236 | [
"MIT"
] | thintreegames/stride | sources/engine/Stride.Physics/Constraints/DistanceLimitConstraint.cs | 3,954 | C# |
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters", Justification = "<Pending>")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1307:Specify StringComparison", Justification = "<Pending>")]
| 55.4 | 160 | 0.783394 | [
"MIT"
] | IvanJasenov/CloudinaryDotNet | Cloudinary.NetCoreTest/GlobalSuppressions.cs | 556 | C# |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace Dbosoft.YaNco.Internal
{
public static class Api
{
public static ConnectionHandle OpenConnection(IDictionary<string, string> connectionParams,
out RfcErrorInfo errorInfo)
{
var rfcOptions = connectionParams.Select(x => new Interopt.RfcConnectionParameter { Name = x.Key, Value = x.Value })
.ToArray();
var ptr = Interopt.RfcOpenConnection(rfcOptions, (uint)rfcOptions.Length, out errorInfo);
return ptr == IntPtr.Zero ? null : new ConnectionHandle(ptr);
}
public static RfcRc IsConnectionHandleValid(ConnectionHandle connectionHandle, out bool isValid, out RfcErrorInfo errorInfo)
{
if (connectionHandle.Ptr == IntPtr.Zero)
{
errorInfo = RfcErrorInfo.EmptyResult();
isValid = false;
return RfcRc.RFC_INVALID_HANDLE;
}
var rc = Interopt.RfcIsConnectionHandleValid(connectionHandle.Ptr, out var isValidInt, out errorInfo);
isValid = isValidInt == 0;
return rc;
}
public static FunctionDescriptionHandle GetFunctionDescription(FunctionHandle functionHandle,
out RfcErrorInfo errorInfo)
{
var ptr = Interopt.RfcDescribeFunction(functionHandle.Ptr, out errorInfo);
return ptr == IntPtr.Zero ? null : new FunctionDescriptionHandle(ptr);
}
public static FunctionDescriptionHandle GetFunctionDescription(ConnectionHandle connectionHandle,
string functionName, out RfcErrorInfo errorInfo)
{
var ptr = Interopt.RfcGetFunctionDesc(connectionHandle.Ptr, functionName, out errorInfo);
return ptr == IntPtr.Zero ? null : new FunctionDescriptionHandle(ptr);
}
public static RfcRc GetFunctionName(FunctionDescriptionHandle descriptionHandle, out string functionName,
out RfcErrorInfo errorInfo)
{
return Interopt.RfcGetFunctionName(descriptionHandle.Ptr, out functionName, out errorInfo);
}
public static TypeDescriptionHandle GetTypeDescription(IDataContainerHandle dataContainer,
out RfcErrorInfo errorInfo)
{
var ptr = Interopt.RfcDescribeType(dataContainer.Ptr, out errorInfo);
return ptr == IntPtr.Zero ? null : new TypeDescriptionHandle(ptr);
}
public static RfcRc GetTypeFieldCount(TypeDescriptionHandle descriptionHandle, out int count,
out RfcErrorInfo errorInfo)
{
var rc = Interopt.RfcGetFieldCount(descriptionHandle.Ptr, out var uIntCount, out errorInfo);
count = (int)uIntCount;
return rc;
}
public static RfcRc GetTypeFieldDescription(TypeDescriptionHandle descriptionHandle, string name,
out RfcFieldInfo parameterInfo, out RfcErrorInfo errorInfo)
{
var rc = Interopt.RfcGetFieldDescByName(descriptionHandle.Ptr, name, out var parameterDescr, out errorInfo);
parameterInfo = new RfcFieldInfo(parameterDescr.Name, parameterDescr.Type, parameterDescr.NucLength, parameterDescr.UcLength, parameterDescr.Decimals);
return rc;
}
public static RfcRc GetTypeFieldDescription(TypeDescriptionHandle descriptionHandle, int index,
out RfcFieldInfo parameterInfo, out RfcErrorInfo errorInfo)
{
var rc = Interopt.RfcGetFieldDescByIndex(descriptionHandle.Ptr, (uint)index, out var parameterDescr, out errorInfo);
parameterInfo = new RfcFieldInfo(parameterDescr.Name, parameterDescr.Type, parameterDescr.NucLength, parameterDescr.UcLength, parameterDescr.Decimals);
return rc;
}
public static FunctionHandle CreateFunction(FunctionDescriptionHandle descriptionHandle,
out RfcErrorInfo errorInfo)
{
var ptr = Interopt.RfcCreateFunction(descriptionHandle.Ptr, out errorInfo);
return ptr == IntPtr.Zero ? null : new FunctionHandle(ptr);
}
public static RfcRc GetFunctionParameterCount(FunctionDescriptionHandle descriptionHandle, out int count,
out RfcErrorInfo errorInfo)
{
var rc = Interopt.RfcGetParameterCount(descriptionHandle.Ptr, out var uIntCount, out errorInfo);
count = (int)uIntCount;
return rc;
}
public static RfcRc GetFunctionParameterDescription(FunctionDescriptionHandle descriptionHandle,
string name, out RfcParameterInfo parameterInfo, out RfcErrorInfo errorInfo)
{
var rc = Interopt.RfcGetParameterDescByName(descriptionHandle.Ptr, name, out var parameterDescr, out errorInfo);
parameterInfo = new RfcParameterInfo(
parameterDescr.Name, parameterDescr.Type, parameterDescr.Direction, parameterDescr.NucLength, parameterDescr.UcLength, parameterDescr.Decimals, parameterDescr.DefaultValue, parameterDescr.ParameterText, parameterDescr.Optional == 'X');
return rc;
}
public static RfcRc GetFunctionParameterDescription(FunctionDescriptionHandle descriptionHandle,
int index, out RfcParameterInfo parameterInfo, out RfcErrorInfo errorInfo)
{
var rc = Interopt.RfcGetParameterDescByIndex(descriptionHandle.Ptr, (uint)index, out var parameterDescr, out errorInfo);
parameterInfo = new RfcParameterInfo(
parameterDescr.Name, parameterDescr.Type, parameterDescr.Direction, parameterDescr.NucLength, parameterDescr.UcLength, parameterDescr.Decimals, parameterDescr.DefaultValue, parameterDescr.ParameterText, parameterDescr.Optional == 'X');
return rc;
}
public static RfcRc Invoke(ConnectionHandle connectionHandle, FunctionHandle functionHandle,
out RfcErrorInfo errorInfo)
{
return Interopt.RfcInvoke(connectionHandle.Ptr, functionHandle.Ptr, out errorInfo);
}
public static RfcRc CancelConnection(ConnectionHandle connectionHandle,
out RfcErrorInfo errorInfo)
{
return Interopt.RfcCancel(connectionHandle.Ptr, out errorInfo);
}
public static RfcRc GetStructure(IDataContainerHandle dataContainer, string name,
out StructureHandle structure, out RfcErrorInfo errorInfo)
{
var rc = Interopt.RfcGetStructure(dataContainer.Ptr, name, out var structPtr, out errorInfo);
structure = structPtr == IntPtr.Zero ? null : new StructureHandle(structPtr);
return rc;
}
public static RfcRc GetTable(IDataContainerHandle dataContainer, string name, out TableHandle table,
out RfcErrorInfo errorInfo)
{
var rc = Interopt.RfcGetTable(dataContainer.Ptr, name, out var tablePtr, out errorInfo);
table = tablePtr == IntPtr.Zero ? null : new TableHandle(tablePtr, false);
return rc;
}
public static TableHandle CloneTable(TableHandle tableHandle, out RfcErrorInfo errorInfo)
{
var ptr = Interopt.RfcCloneTable(tableHandle.Ptr, out errorInfo);
return ptr == IntPtr.Zero ? null : new TableHandle(ptr, true);
}
public static void AllowStartOfPrograms(ConnectionHandle connectionHandle, StartProgramDelegate callback, out
RfcErrorInfo errorInfo)
{
var descriptionHandle = new FunctionDescriptionHandle(Interopt.RfcCreateFunctionDesc("RFC_START_PROGRAM", out errorInfo));
if (descriptionHandle.Ptr == IntPtr.Zero)
{
return;
}
var paramDesc = new Interopt.RFC_PARAMETER_DESC { Name = "COMMAND", Type = RfcType.CHAR, Direction = RfcDirection.Import, NucLength = 512, UcLength = 1024 };
var rc = Interopt.RfcAddParameter(descriptionHandle.Ptr, ref paramDesc, out errorInfo);
if (rc != RfcRc.RFC_OK)
{
return;
}
rc = Interopt.RfcInstallServerFunction(null, descriptionHandle.Ptr, StartProgramHandler, out errorInfo);
if (rc != RfcRc.RFC_OK)
{
return;
}
RegisteredCallbacks.AddOrUpdate(connectionHandle.Ptr, callback, (c,v) => v );
}
private static readonly ConcurrentDictionary<IntPtr, StartProgramDelegate> RegisteredCallbacks
= new ConcurrentDictionary<IntPtr, StartProgramDelegate>();
private static readonly Interopt.RfcServerFunction StartProgramHandler = RFC_START_PROGRAM_Handler;
static RfcRc RFC_START_PROGRAM_Handler(IntPtr rfcHandle, IntPtr funcHandle, out RfcErrorInfo errorInfo)
{
if (!RegisteredCallbacks.TryGetValue(rfcHandle, out var startProgramDelegate))
{
errorInfo = new RfcErrorInfo(RfcRc.RFC_INVALID_HANDLE, RfcErrorGroup.EXTERNAL_APPLICATION_FAILURE, "",
"no connection registered for this callback", "", "", "", "", "", "", "");
return RfcRc.RFC_INVALID_HANDLE;
}
var commandBuffer = new char[513];
var rc = Interopt.RfcGetStringByIndex(funcHandle, 0, commandBuffer, (uint)commandBuffer.Length - 1, out var commandLength, out errorInfo);
if (rc != RfcRc.RFC_OK)
return rc;
var command = new string(commandBuffer, 0, (int)commandLength);
errorInfo = startProgramDelegate(command);
return errorInfo.Code;
}
public static void RemoveCallbackHandler(IntPtr connectionHandle)
{
RegisteredCallbacks.TryRemove(connectionHandle, out var _);
}
public static RfcRc GetTableRowCount(TableHandle table, out int count, out RfcErrorInfo errorInfo)
{
var rc = Interopt.RfcGetRowCount(table.Ptr, out var uIntCount, out errorInfo);
count = (int)uIntCount;
return rc;
}
public static StructureHandle GetCurrentTableRow(TableHandle table, out RfcErrorInfo errorInfo)
{
var ptr = Interopt.RfcGetCurrentRow(table.Ptr, out errorInfo);
return ptr == IntPtr.Zero ? null : new StructureHandle(ptr);
}
public static StructureHandle AppendTableRow(TableHandle table, out RfcErrorInfo errorInfo)
{
var ptr = Interopt.RfcAppendNewRow(table.Ptr, out errorInfo);
return ptr == IntPtr.Zero ? null : new StructureHandle(ptr);
}
public static RfcRc MoveToNextTableRow(TableHandle table, out RfcErrorInfo errorInfo)
{
return Interopt.RfcMoveToNextRow(table.Ptr, out errorInfo);
}
public static RfcRc MoveToFirstTableRow(TableHandle table, out RfcErrorInfo errorInfo)
{
return Interopt.RfcMoveToFirstRow(table.Ptr, out errorInfo);
}
public static RfcRc SetString(IDataContainerHandle containerHandle, string name, string value, out
RfcErrorInfo errorInfo)
{
return Interopt.RfcSetString(containerHandle.Ptr, name, value, (uint)value.Length, out errorInfo);
}
public static RfcRc GetString(IDataContainerHandle containerHandle, string name, out string value, out
RfcErrorInfo errorInfo)
{
var buffer = new char[61];
var rc = Interopt.RfcGetString(containerHandle.Ptr, name, buffer, 61, out var stringLength, out errorInfo);
if (rc != RfcRc.RFC_BUFFER_TOO_SMALL)
{
value = new string(buffer, 0, (int)stringLength);
return rc;
}
buffer = new char[stringLength + 1];
rc = Interopt.RfcGetString(containerHandle.Ptr, name, buffer, stringLength + 1, out _, out errorInfo);
value = new string(buffer, 0, (int)stringLength);
return rc;
}
public static RfcRc SetInt(IDataContainerHandle containerHandle, string name, int value, out
RfcErrorInfo errorInfo)
{
return Interopt.RfcSetInt(containerHandle.Ptr, name, value, out errorInfo);
}
public static RfcRc GetInt(IDataContainerHandle containerHandle, string name, out int value, out
RfcErrorInfo errorInfo)
{
return Interopt.RfcGetInt(containerHandle.Ptr, name, out value, out errorInfo);
}
public static RfcRc SetLong(IDataContainerHandle containerHandle, string name, long value, out
RfcErrorInfo errorInfo)
{
return Interopt.RfcSetInt8(containerHandle.Ptr, name, value, out errorInfo);
}
public static RfcRc GetLong(IDataContainerHandle containerHandle, string name, out long value, out
RfcErrorInfo errorInfo)
{
return Interopt.RfcGetInt8(containerHandle.Ptr, name, out value, out errorInfo);
}
public static RfcRc SetDateString(IDataContainerHandle containerHandle, string name, string value, out
RfcErrorInfo errorInfo)
{
return Interopt.RfcSetDate(containerHandle.Ptr, name, value.ToCharArray(0, 8), out errorInfo);
}
public static RfcRc GetDateString(IDataContainerHandle containerHandle, string name, out string value, out
RfcErrorInfo errorInfo)
{
var buffer = new char[8];
var rc = Interopt.RfcGetDate(containerHandle.Ptr, name, buffer, out errorInfo);
value = new string(buffer);
return rc;
}
public static RfcRc SetTimeString(IDataContainerHandle containerHandle, string name, string value, out
RfcErrorInfo errorInfo)
{
return Interopt.RfcSetTime(containerHandle.Ptr, name, value.ToCharArray(0, 6), out errorInfo);
}
public static RfcRc GetTimeString(IDataContainerHandle containerHandle, string name, out string value, out
RfcErrorInfo errorInfo)
{
var buffer = new char[6];
var rc = Interopt.RfcGetTime(containerHandle.Ptr, name, buffer, out errorInfo);
value = new string(buffer);
return rc;
}
public static RfcRc SetBytes(IDataContainerHandle containerHandle, string name, byte[] buffer, uint bufferLength, out
RfcErrorInfo errorInfo)
{
return Interopt.RfcSetBytes(containerHandle.Ptr, name, buffer, bufferLength, out errorInfo);
}
public static RfcRc GetBytes(IDataContainerHandle containerHandle, string name, out byte[] buffer, out
RfcErrorInfo errorInfo)
{
var tempBuffer = new byte[255];
var rc = Interopt.RfcGetXString(containerHandle.Ptr, name, tempBuffer, 255, out var bufferLength, out errorInfo);
if (rc != RfcRc.RFC_BUFFER_TOO_SMALL)
{
buffer = new byte[bufferLength];
Array.Copy(tempBuffer, buffer, bufferLength);
return rc;
}
tempBuffer = new byte[bufferLength];
rc = Interopt.RfcGetXString(containerHandle.Ptr, name, tempBuffer, bufferLength, out _, out errorInfo);
buffer = new byte[bufferLength];
tempBuffer.CopyTo(buffer, 0);
return rc;
}
}
} | 41.601604 | 251 | 0.654155 | [
"MIT"
] | fossabot/YaNco | src/YaNco.Core/Internal/Api.cs | 15,561 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SimplePDF")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SimplePDF")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)] | 35.689655 | 84 | 0.740097 | [
"MIT"
] | ClaireFinn74/PDFViewerCSharp | SimplePDF/Properties/AssemblyInfo.cs | 1,038 | C# |
namespace Messages
{
using NServiceBus;
public class PlaceOrder :
ICommand
{
public string OrderId { get; set; }
}
} | 15 | 43 | 0.58 | [
"MIT"
] | Particular/MonitoringDemo | src/Messages/PlaceOrder.cs | 152 | C# |
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace backend.Models
{
public class ArtistTranslation
{
public long Id {get;set;}
public long ArtistId {get;set;}
public long LanguageId {get;set;}
public String Description {get;set;}
[ForeignKey("ArtistId")]
public virtual Artist Artist {get;set;}
[ForeignKey("LanguageId")]
public virtual Language Language {get;set;}
public String SourceLink {get;set;}
}
} | 24.666667 | 51 | 0.648649 | [
"MIT"
] | oSoc19/explorer-app | backend/Models/ArtistTranslation.cs | 518 | C# |
namespace CourseSystem.Services.Data
{
using System.Collections.Generic;
public interface ICategoriesService
{
IEnumerable<T> GetCategories<T>();
int GetCategoryId(string name);
}
}
| 18.083333 | 42 | 0.677419 | [
"MIT"
] | KredikShaw/CourseSystem | Services/CourseSystem.Services.Data/ICategoriesService.cs | 219 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("03.On Time for the Exam")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("03.On Time for the Exam")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("74b8f4d1-b311-406a-a4e3-782725a2e9e1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 39.324324 | 85 | 0.723711 | [
"MIT"
] | KrasimiraGeorgieva/Programming-Basics-Exam | Coding 101 Exam - 06 March 2016/03.On Time for the Exam/Properties/AssemblyInfo.cs | 1,458 | C# |
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// </auto-generated>
namespace Microsoft.Azure.Management.Storage.Fluent.Models
{
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Defines headers for ExtendImmutabilityPolicy operation.
/// </summary>
public partial class BlobContainersExtendImmutabilityPolicyHeadersInner
{
/// <summary>
/// Initializes a new instance of the
/// BlobContainersExtendImmutabilityPolicyHeadersInner class.
/// </summary>
public BlobContainersExtendImmutabilityPolicyHeadersInner()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the
/// BlobContainersExtendImmutabilityPolicyHeadersInner class.
/// </summary>
/// <param name="eTag">The ETag HTTP response header. This is an opaque
/// string. You can use it to detect whether the resource has changed
/// between requests. In particular, you can pass the ETag to one of
/// the If-Match or If-None-Match headers.</param>
public BlobContainersExtendImmutabilityPolicyHeadersInner(string eTag = default(string))
{
ETag = eTag;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets the ETag HTTP response header. This is an opaque
/// string. You can use it to detect whether the resource has changed
/// between requests. In particular, you can pass the ETag to one of
/// the If-Match or If-None-Match headers.
/// </summary>
[JsonProperty(PropertyName = "ETag")]
public string ETag { get; set; }
}
}
| 35.396552 | 96 | 0.639065 | [
"MIT"
] | LekeFasola/azure-libraries-for-net | src/ResourceManagement/Storage/Generated/Models/BlobContainersExtendImmutabilityPolicyHeadersInner.cs | 2,053 | C# |
using UnityEngine;
using System;
using System.Collections;
using System.Runtime.InteropServices;
using FMOD.Studio;
public class FMOD_StudioEventEmitter : MonoBehaviour
{
public FMODAsset asset;
public string path = "";
public bool startEventOnAwake = true;
FMOD.Studio.EventInstance evt;
bool hasStarted = false;
Rigidbody cachedRigidBody;
[System.Serializable]
public class Parameter
{
public string name;
public float value;
}
public void Play()
{
if (evt != null)
{
ERRCHECK(evt.start());
}
else
{
FMOD.Studio.UnityUtil.Log("Tried to play event without a valid instance: " + path);
return;
}
}
public void Stop()
{
if (evt != null)
{
ERRCHECK(evt.stop(STOP_MODE.IMMEDIATE));
}
}
public FMOD.Studio.ParameterInstance getParameter(string name)
{
FMOD.Studio.ParameterInstance param = null;
ERRCHECK(evt.getParameter(name, out param));
return param;
}
public FMOD.Studio.PLAYBACK_STATE getPlaybackState()
{
if (evt == null || !evt.isValid())
return FMOD.Studio.PLAYBACK_STATE.STOPPED;
FMOD.Studio.PLAYBACK_STATE state = PLAYBACK_STATE.STOPPED;
if (ERRCHECK (evt.getPlaybackState(out state)) == FMOD.RESULT.OK)
return state;
return FMOD.Studio.PLAYBACK_STATE.STOPPED;
}
void Start()
{
if (evt == null || !evt.isValid())
{
CacheEventInstance();
}
cachedRigidBody = GetComponent<Rigidbody>();
if (startEventOnAwake)
StartEvent();
}
void CacheEventInstance()
{
if (asset != null)
{
evt = FMOD_StudioSystem.instance.GetEvent(asset.id);
}
else if (!String.IsNullOrEmpty(path))
{
evt = FMOD_StudioSystem.instance.GetEvent(path);
}
else
{
FMOD.Studio.UnityUtil.LogError("No asset or path specified for Event Emitter");
}
}
static bool isShuttingDown = false;
void OnApplicationQuit()
{
isShuttingDown = true;
}
void OnDestroy()
{
if (isShuttingDown)
return;
FMOD.Studio.UnityUtil.Log("Destroy called");
if (evt != null && evt.isValid())
{
if (getPlaybackState () != FMOD.Studio.PLAYBACK_STATE.STOPPED)
{
FMOD.Studio.UnityUtil.Log("Release evt: " + path);
ERRCHECK (evt.stop(FMOD.Studio.STOP_MODE.IMMEDIATE));
}
ERRCHECK(evt.release ());
evt = null;
}
}
public void StartEvent()
{
if (evt == null || !evt.isValid())
{
CacheEventInstance();
}
// Attempt to release as oneshot
if (evt != null && evt.isValid())
{
Update3DAttributes();
ERRCHECK(evt.start());
//if (evt.release() == FMOD.RESULT.OK)
{
//evt = null;
}
}
else
{
FMOD.Studio.UnityUtil.LogError("Event retrieval failed: " + path);
}
hasStarted = true;
}
public bool HasFinished()
{
if (!hasStarted)
return false;
if (evt == null || !evt.isValid())
return true;
return getPlaybackState () == FMOD.Studio.PLAYBACK_STATE.STOPPED;
}
void Update()
{
if (evt != null && evt.isValid ())
{
Update3DAttributes();
}
else
{
evt = null;
}
}
void Update3DAttributes()
{
if (evt != null && evt.isValid ())
{
var attributes = FMOD.Studio.UnityUtil.to3DAttributes(gameObject, cachedRigidBody);
ERRCHECK(evt.set3DAttributes(attributes));
}
}
#if (UNITY_EDITOR)
void OnDrawGizmosSelected()
{
if (asset != null && enabled &&
(!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isPlaying))
{
FMOD.Studio.EventDescription desc = null;
desc = FMODEditorExtension.GetEventDescription(asset.id);
if (desc != null)
{
float max, min;
desc.getMaximumDistance(out max);
desc.getMinimumDistance(out min);
Gizmos.color = Color.blue;
Gizmos.DrawWireSphere(transform.position, min);
Gizmos.DrawWireSphere(transform.position, max);
}
}
}
#endif
FMOD.RESULT ERRCHECK(FMOD.RESULT result)
{
FMOD.Studio.UnityUtil.ERRCHECK(result);
return result;
}
}
| 20.724638 | 119 | 0.605828 | [
"Apache-2.0"
] | Team2point5D/Davinas-Stone-Full | Major Project/Assets/Plugins/FMOD/FMOD_StudioEventEmitter.cs | 4,290 | C# |
using Jint;
using System;
using System.Collections;
using System.Collections.Generic;
namespace TestJint
{
class Program
{
static void Main(string[] args)
{
Engine engine = new Engine();
engine.SetValue("AAA", new List<int> { 11, 22, 33 });
engine.SetValue("log", new Action<object>(Log));
engine.Execute("log(\"ok\"); var BBB = [444,555,666]; for (a of AAA) { log(a); }");
Console.ReadLine();
}
static void Log(object o)
{
Console.WriteLine(o?.ToString() ?? string.Empty);
}
}
public class AAA : IEnumerable
{
public IEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
}
}
| 20.526316 | 95 | 0.533333 | [
"BSD-2-Clause"
] | simage3d/jint | Jint/Program.cs | 782 | C# |
using System.Linq.Expressions;
namespace AutoMapper.Execution
{
using System;
using System.Collections.Generic;
using System.Reflection;
public class FieldGetter<TSource, TValue> : MemberGetter<TSource, TValue>
{
private readonly FieldInfo _fieldInfo;
private readonly Lazy<Expression<LateBoundFieldGet<TSource, TValue>>> _lateBoundFieldGetExpression;
private readonly Lazy<LateBoundFieldGet<TSource, TValue>> _lateBoundFieldGet;
public FieldGetter(FieldInfo fieldInfo)
{
_fieldInfo = fieldInfo;
Name = fieldInfo.Name;
MemberType = fieldInfo.FieldType;
_lateBoundFieldGetExpression = new Lazy<Expression<LateBoundFieldGet<TSource, TValue>>>(() => DelegateFactory.CreateGet<TSource, TValue>(fieldInfo));
_lateBoundFieldGet = new Lazy<LateBoundFieldGet<TSource, TValue>>(() => _lateBoundFieldGetExpression.Value.Compile());
}
public override MemberInfo MemberInfo => _fieldInfo;
public override string Name { get; }
public override LambdaExpression GetExpression => _lateBoundFieldGetExpression.Value;
public override Type MemberType { get; }
public override object GetValue(object source)
{
return _lateBoundFieldGet.Value((TSource)source);
}
public bool Equals(FieldGetter<TSource, TValue> other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Equals(other._fieldInfo, _fieldInfo);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != typeof (FieldGetter<TSource, TValue>)) return false;
return Equals((FieldGetter<TSource, TValue>) obj);
}
public override int GetHashCode()
{
return _fieldInfo.GetHashCode();
}
public override IEnumerable<object> GetCustomAttributes(Type attributeType, bool inherit)
{
return _fieldInfo.GetCustomAttributes(attributeType, inherit);
}
public override IEnumerable<object> GetCustomAttributes(bool inherit)
{
return _fieldInfo.GetCustomAttributes(inherit);
}
public override bool IsDefined(Type attributeType, bool inherit)
{
return _fieldInfo.IsDefined(attributeType, inherit);
}
}
} | 36.126761 | 161 | 0.654191 | [
"MIT"
] | jbogard/AutoMapper | src/AutoMapper/Execution/FieldGetter.cs | 2,565 | C# |
using BorrowBuddy.Models.Requests;
using BorrowBuddy.Models.Resources;
using Reinforced.Typings.Fluent;
namespace BorrowBuddy.Shared {
public static class TypescriptGenerationConfiguration {
public static void Configure(ConfigurationBuilder builder) {
builder.Global(global => global.CamelCaseForMethods().CamelCaseForProperties().TabSymbol(" ").UseModules());
builder.AddTypeSubsitutes();
builder.AddExports(typeof(Participant));
builder.AddExports(typeof(FlowPost));
}
}
}
| 32.125 | 115 | 0.7607 | [
"MIT"
] | romansp/BorrowBuddy | shared/BorrowBuddy.Shared/TypescriptGenerationConfiguration.cs | 514 | C# |
namespace Plarium.Geo.Services
{
public interface ICountryService
{
string GetCountryName(string code);
byte CountryToByte(string code);
string GetCountryName(byte code);
string GetCountryCode(byte code);
string GetDialCode(string code);
}
}
| 18.6875 | 43 | 0.658863 | [
"MIT"
] | anton-nesterenko/Plarium.Geo | Plarium.Geo/Services/ICountryService.cs | 301 | C# |
using System;
using System.Collections.Generic;
namespace Panther.Core.Models
{
public class Artist : IIdentificable, IEquatable<Artist>
{
#region Primary key
/// <summary>
/// Autogenerated artist id
/// </summary>
public long Id { get; set; }
#endregion
#region Artist properties
/// <summary>
/// Artist name
/// </summary>
public string Name { get; set; }
#endregion
#region Navigation properties
/// <summary>
/// Albums
/// </summary>
public ICollection<Album> Albums { get; set; }
#endregion
#region Implementations
public bool Equals(Artist other) =>
Id == default ? Name == other.Name : Id == other.Id;
#endregion
}
}
| 21.763158 | 64 | 0.538089 | [
"MIT"
] | humaranah/panther-core | src/Panther.Core.Abstractions/Models/Artist.cs | 829 | C# |
#pragma checksum "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5ec25f84ff98ce87e0458e7beb32258e6ca00f88"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_SalePerson_Delete), @"mvc.1.0.view", @"/Views/SalePerson/Delete.cshtml")]
[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/Views/SalePerson/Delete.cshtml", typeof(AspNetCore.Views_SalePerson_Delete))]
namespace AspNetCore
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
#line 1 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\_ViewImports.cshtml"
using BootShop_2019;
#line default
#line hidden
#line 2 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\_ViewImports.cshtml"
using BootShop_2019.Models;
#line default
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"5ec25f84ff98ce87e0458e7beb32258e6ca00f88", @"/Views/SalePerson/Delete.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"fc6d4f309af9d66726e3ec591b2019ddd1da6f4c", @"/Views/_ViewImports.cshtml")]
public class Views_SalePerson_Delete : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<BootShop_2019.Models.ViewModels.SalePersonViewModel>
{
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "hidden", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-action", "Index", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("text-danger"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-action", "Delete", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
#line hidden
#pragma warning disable 0169
private string __tagHelperStringValueBuffer;
#pragma warning restore 0169
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null;
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager
{
get
{
if (__backed__tagHelperScopeManager == null)
{
__backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope);
}
return __backed__tagHelperScopeManager;
}
}
private global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper;
private global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper;
private global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper;
private global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper;
private global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper;
#pragma warning disable 1998
public async override global::System.Threading.Tasks.Task ExecuteAsync()
{
BeginContext(60, 2, true);
WriteLiteral("\r\n");
EndContext();
#line 3 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
ViewData["Title"] = "Delete";
Layout = "~/Views/Shared/_Layout.cshtml";
#line default
#line hidden
BeginContext(151, 189, true);
WriteLiteral("\r\n<h1>Delete</h1>\r\n\r\n<h3>Are you sure you want to delete this?</h3>\r\n<div>\r\n <h4>SalePersonViewModel</h4>\r\n <hr />\r\n <dl class=\"row\">\r\n <dt class = \"col-sm-2\">\r\n ");
EndContext();
BeginContext(341, 43, false);
#line 16 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
Write(Html.DisplayNameFor(model => model.Surname));
#line default
#line hidden
EndContext();
BeginContext(384, 63, true);
WriteLiteral("\r\n </dt>\r\n <dd class = \"col-sm-10\">\r\n ");
EndContext();
BeginContext(448, 39, false);
#line 19 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
Write(Html.DisplayFor(model => model.Surname));
#line default
#line hidden
EndContext();
BeginContext(487, 62, true);
WriteLiteral("\r\n </dd>\r\n <dt class = \"col-sm-2\">\r\n ");
EndContext();
BeginContext(550, 45, false);
#line 22 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
Write(Html.DisplayNameFor(model => model.Othername));
#line default
#line hidden
EndContext();
BeginContext(595, 63, true);
WriteLiteral("\r\n </dt>\r\n <dd class = \"col-sm-10\">\r\n ");
EndContext();
BeginContext(659, 41, false);
#line 25 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
Write(Html.DisplayFor(model => model.Othername));
#line default
#line hidden
EndContext();
BeginContext(700, 62, true);
WriteLiteral("\r\n </dd>\r\n <dt class = \"col-sm-2\">\r\n ");
EndContext();
BeginContext(763, 42, false);
#line 28 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
Write(Html.DisplayNameFor(model => model.Gender));
#line default
#line hidden
EndContext();
BeginContext(805, 63, true);
WriteLiteral("\r\n </dt>\r\n <dd class = \"col-sm-10\">\r\n ");
EndContext();
BeginContext(869, 38, false);
#line 31 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
Write(Html.DisplayFor(model => model.Gender));
#line default
#line hidden
EndContext();
BeginContext(907, 62, true);
WriteLiteral("\r\n </dd>\r\n <dt class = \"col-sm-2\">\r\n ");
EndContext();
BeginContext(970, 44, false);
#line 34 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
Write(Html.DisplayNameFor(model => model.ShopName));
#line default
#line hidden
EndContext();
BeginContext(1014, 63, true);
WriteLiteral("\r\n </dt>\r\n <dd class = \"col-sm-10\">\r\n ");
EndContext();
BeginContext(1078, 40, false);
#line 37 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
Write(Html.DisplayFor(model => model.ShopName));
#line default
#line hidden
EndContext();
BeginContext(1118, 38, true);
WriteLiteral("\r\n </dd>\r\n </dl>\r\n \r\n ");
EndContext();
BeginContext(1156, 282, false);
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5ec25f84ff98ce87e0458e7beb32258e6ca00f889325", async() => {
BeginContext(1182, 10, true);
WriteLiteral("\r\n ");
EndContext();
BeginContext(1192, 36, false);
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "5ec25f84ff98ce87e0458e7beb32258e6ca00f889717", async() => {
}
);
__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper);
__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.InputTypeName = (string)__tagHelperAttribute_0.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
#line 42 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Id);
#line default
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
EndContext();
BeginContext(1228, 83, true);
WriteLiteral("\r\n <input type=\"submit\" value=\"Delete\" class=\"btn btn-danger\" /> |\r\n ");
EndContext();
BeginContext(1311, 38, false);
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5ec25f84ff98ce87e0458e7beb32258e6ca00f8811654", async() => {
BeginContext(1333, 12, true);
WriteLiteral("Back to List");
EndContext();
}
);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_1.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
EndContext();
BeginContext(1349, 10, true);
WriteLiteral("\r\n ");
EndContext();
BeginContext(1359, 66, false);
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5ec25f84ff98ce87e0458e7beb32258e6ca00f8813131", async() => {
}
);
__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper);
#line 45 "C:\Users\CalebWS\source\TechCollection\BootShop_2019\BootShop_2019\BootShop_2019\Views\SalePerson\Delete.cshtml"
__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper.ValidationSummary = global::Microsoft.AspNetCore.Mvc.Rendering.ValidationSummary.ModelOnly;
#line default
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-summary", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationSummaryTagHelper.ValidationSummary, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
EndContext();
BeginContext(1425, 6, true);
WriteLiteral("\r\n ");
EndContext();
}
);
__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_3.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
EndContext();
BeginContext(1438, 10, true);
WriteLiteral("\r\n</div>\r\n");
EndContext();
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<BootShop_2019.Models.ViewModels.SalePersonViewModel> Html { get; private set; }
}
}
#pragma warning restore 1591
| 64.296578 | 349 | 0.702188 | [
"MIT"
] | koninlord/BootShop-Web | BootShop_2019/obj/Release/netcoreapp2.2/Razor/Views/SalePerson/Delete.g.cshtml.cs | 16,910 | C# |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: IMethodRequest.cs.tt
namespace Microsoft.Graph
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading;
/// <summary>
/// The interface IUserExperienceAnalyticsRegressionSummarySummarizeDeviceRegressionPerformanceRequest.
/// </summary>
public partial interface IUserExperienceAnalyticsRegressionSummarySummarizeDeviceRegressionPerformanceRequest : IBaseRequest
{
/// <summary>
/// Issues the GET request.
/// </summary>
System.Threading.Tasks.Task<UserExperienceAnalyticsRegressionSummary> GetAsync();
/// <summary>
/// Issues the GET request.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The task to await for async call.</returns>
System.Threading.Tasks.Task<UserExperienceAnalyticsRegressionSummary> GetAsync(
CancellationToken cancellationToken);
/// <summary>
/// Issues the PATCH request.
/// </summary>
/// <param name="userexperienceanalyticsregressionsummary">The UserExperienceAnalyticsRegressionSummary object set with the properties to update.</param>
/// <returns>The task to await for async call.</returns>
System.Threading.Tasks.Task<UserExperienceAnalyticsRegressionSummary> PatchAsync(UserExperienceAnalyticsRegressionSummary userexperienceanalyticsregressionsummary);
/// <summary>
/// Issues the PATCH request.
/// </summary>
/// <param name="userexperienceanalyticsregressionsummary">The UserExperienceAnalyticsRegressionSummary object set with the properties to update.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The task to await for async call.</returns>
System.Threading.Tasks.Task<UserExperienceAnalyticsRegressionSummary> PatchAsync(UserExperienceAnalyticsRegressionSummary userexperienceanalyticsregressionsummary,
CancellationToken cancellationToken);
/// <summary>
/// Issues the PUT request.
/// </summary>
/// <param name="userexperienceanalyticsregressionsummary">The UserExperienceAnalyticsRegressionSummary object to update.</param>
/// <returns>The task to await for async call.</returns>
System.Threading.Tasks.Task<UserExperienceAnalyticsRegressionSummary> PutAsync(UserExperienceAnalyticsRegressionSummary userexperienceanalyticsregressionsummary);
/// <summary>
/// Issues the PUT request.
/// </summary>
/// <param name="userexperienceanalyticsregressionsummary">The UserExperienceAnalyticsRegressionSummary object to update.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The task to await for async call.</returns>
System.Threading.Tasks.Task<UserExperienceAnalyticsRegressionSummary> PutAsync(UserExperienceAnalyticsRegressionSummary userexperienceanalyticsregressionsummary,
CancellationToken cancellationToken);
/// <summary>
/// Adds the specified expand value to the request.
/// </summary>
/// <param name="value">The expand value.</param>
/// <returns>The request object to send.</returns>
IUserExperienceAnalyticsRegressionSummarySummarizeDeviceRegressionPerformanceRequest Expand(string value);
/// <summary>
/// Adds the specified select value to the request.
/// </summary>
/// <param name="value">The select value.</param>
/// <returns>The request object to send.</returns>
IUserExperienceAnalyticsRegressionSummarySummarizeDeviceRegressionPerformanceRequest Select(string value);
}
}
| 50.5 | 172 | 0.684089 | [
"MIT"
] | GeertVL/msgraph-beta-sdk-dotnet | src/Microsoft.Graph/Generated/requests/IUserExperienceAnalyticsRegressionSummarySummarizeDeviceRegressionPerformanceRequest.cs | 4,343 | C# |
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
using System;
using System.Collections.Generic;
using System.Linq;
using Nest.Utf8Json;
namespace Nest
{
/// <summary>
/// Contains aggregates that are returned by Elasticsearch. In NEST, Aggregation always refers to an aggregation
/// request to Elasticsearch and an Aggregate describes an aggregation response.
/// </summary>
[JsonFormatter(typeof(AggregateDictionaryFormatter))]
public class AggregateDictionary : IsAReadOnlyDictionaryBase<string, IAggregate>
{
internal static readonly char[] TypedKeysSeparator = { '#' };
[SerializationConstructor]
public AggregateDictionary(IReadOnlyDictionary<string, IAggregate> backingDictionary) : base(backingDictionary) { }
public static AggregateDictionary Default { get; } = new AggregateDictionary(EmptyReadOnly<string, IAggregate>.Dictionary);
protected override string Sanitize(string key)
{
//typed_keys = true on results in aggregation keys being returned as "<type>#<name>"
var tokens = TypedKeyTokens(key);
return tokens.Length > 1 ? tokens[1] : tokens[0];
}
internal static string[] TypedKeyTokens(string key)
{
var tokens = key.Split(TypedKeysSeparator, 2, StringSplitOptions.RemoveEmptyEntries);
return tokens;
}
public ValueAggregate Min(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate Max(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate Sum(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate Cardinality(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate Average(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate ValueCount(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate AverageBucket(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate Derivative(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate SumBucket(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate MovingAverage(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate CumulativeSum(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate CumulativeCardinality(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate BucketScript(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate SerialDifferencing(string key) => TryGet<ValueAggregate>(key);
public ValueAggregate WeightedAverage(string key) => TryGet<ValueAggregate>(key);
public KeyedValueAggregate MaxBucket(string key) => TryGet<KeyedValueAggregate>(key);
public KeyedValueAggregate MinBucket(string key) => TryGet<KeyedValueAggregate>(key);
public ScriptedMetricAggregate ScriptedMetric(string key)
{
var valueMetric = TryGet<ValueAggregate>(key);
return valueMetric != null
? new ScriptedMetricAggregate(valueMetric.Value) { Meta = valueMetric.Meta }
: TryGet<ScriptedMetricAggregate>(key);
}
public StatsAggregate Stats(string key) => TryGet<StatsAggregate>(key);
public StringStatsAggregate StringStats(string key) => TryGet<StringStatsAggregate>(key);
public TopMetricsAggregate TopMetrics(string key) => TryGet<TopMetricsAggregate>(key);
public StatsAggregate StatsBucket(string key) => TryGet<StatsAggregate>(key);
public ExtendedStatsAggregate ExtendedStats(string key) => TryGet<ExtendedStatsAggregate>(key);
public ExtendedStatsAggregate ExtendedStatsBucket(string key) => TryGet<ExtendedStatsAggregate>(key);
public GeoBoundsAggregate GeoBounds(string key) => TryGet<GeoBoundsAggregate>(key);
public PercentilesAggregate Percentiles(string key) => TryGet<PercentilesAggregate>(key);
public PercentilesAggregate PercentilesBucket(string key) => TryGet<PercentilesAggregate>(key);
public PercentilesAggregate MovingPercentiles(string key) => TryGet<PercentilesAggregate>(key);
public PercentilesAggregate PercentileRanks(string key) => TryGet<PercentilesAggregate>(key);
public TopHitsAggregate TopHits(string key) => TryGet<TopHitsAggregate>(key);
public FiltersAggregate Filters(string key)
{
var named = TryGet<FiltersAggregate>(key);
if (named != null)
return named;
var anonymous = TryGet<BucketAggregate>(key);
return anonymous != null
? new FiltersAggregate { Buckets = anonymous.Items.OfType<FiltersBucketItem>().ToList(), Meta = anonymous.Meta }
: null;
}
public SingleBucketAggregate Global(string key) => TryGet<SingleBucketAggregate>(key);
public SingleBucketAggregate Filter(string key) => TryGet<SingleBucketAggregate>(key);
public SingleBucketAggregate Missing(string key) => TryGet<SingleBucketAggregate>(key);
public SingleBucketAggregate Nested(string key) => TryGet<SingleBucketAggregate>(key);
public ValueAggregate Normalize(string key) => TryGet<ValueAggregate>(key);
public SingleBucketAggregate ReverseNested(string key) => TryGet<SingleBucketAggregate>(key);
public SingleBucketAggregate Children(string key) => TryGet<SingleBucketAggregate>(key);
public SingleBucketAggregate Parent(string key) => TryGet<SingleBucketAggregate>(key);
public SingleBucketAggregate Sampler(string key) => TryGet<SingleBucketAggregate>(key);
public SingleBucketAggregate DiversifiedSampler(string key) => TryGet<SingleBucketAggregate>(key);
public GeoCentroidAggregate GeoCentroid(string key) => TryGet<GeoCentroidAggregate>(key);
public SignificantTermsAggregate<TKey> SignificantTerms<TKey>(string key)
{
var bucket = TryGet<BucketAggregate>(key);
return bucket == null
? null
: new SignificantTermsAggregate<TKey>
{
BgCount = bucket.BgCount,
DocCount = bucket.DocCount,
Buckets = GetSignificantTermsBuckets<TKey>(bucket.Items).ToList(),
Meta = bucket.Meta
};
}
public SignificantTermsAggregate<string> SignificantTerms(string key) => SignificantTerms<string>(key);
public SignificantTermsAggregate<TKey> SignificantText<TKey>(string key)
{
var bucket = TryGet<BucketAggregate>(key);
return bucket == null
? null
: new SignificantTermsAggregate<TKey>
{
BgCount = bucket.BgCount,
DocCount = bucket.DocCount,
Buckets = GetSignificantTermsBuckets<TKey>(bucket.Items).ToList(),
Meta = bucket.Meta
};
}
public SignificantTermsAggregate<string> SignificantText(string key) => SignificantText<string>(key);
public TermsAggregate<TKey> Terms<TKey>(string key)
{
var bucket = TryGet<BucketAggregate>(key);
return bucket == null
? null
: new TermsAggregate<TKey>
{
DocCountErrorUpperBound = bucket.DocCountErrorUpperBound,
SumOtherDocCount = bucket.SumOtherDocCount,
Buckets = GetKeyedBuckets<TKey>(bucket.Items).ToList(),
Meta = bucket.Meta
};
}
public TermsAggregate<string> Terms(string key) => Terms<string>(key);
public MultiBucketAggregate<KeyedBucket<double>> Histogram(string key) => GetMultiKeyedBucketAggregate<double>(key);
public MultiBucketAggregate<KeyedBucket<string>> GeoHash(string key) => GetMultiKeyedBucketAggregate<string>(key);
public MultiBucketAggregate<KeyedBucket<string>> GeoTile(string key) => GetMultiKeyedBucketAggregate<string>(key);
public MultiBucketAggregate<KeyedBucket<string>> AdjacencyMatrix(string key) => GetMultiKeyedBucketAggregate<string>(key);
public MultiBucketAggregate<RareTermsBucket<TKey>> RareTerms<TKey>(string key)
{
var bucket = TryGet<BucketAggregate>(key);
return bucket == null
? null
: new MultiBucketAggregate<RareTermsBucket<TKey>>
{
Buckets = GetRareTermsBuckets<TKey>(bucket.Items).ToList(),
Meta = bucket.Meta
};
}
public ValueAggregate Rate(string key) => TryGet<ValueAggregate>(key);
public MultiBucketAggregate<RareTermsBucket<string>> RareTerms(string key) => RareTerms<string>(key);
public MultiBucketAggregate<RangeBucket> Range(string key) => GetMultiBucketAggregate<RangeBucket>(key);
public MultiBucketAggregate<RangeBucket> DateRange(string key) => GetMultiBucketAggregate<RangeBucket>(key);
public MultiBucketAggregate<IpRangeBucket> IpRange(string key) => GetMultiBucketAggregate<IpRangeBucket>(key);
public MultiBucketAggregate<RangeBucket> GeoDistance(string key) => GetMultiBucketAggregate<RangeBucket>(key);
public MultiBucketAggregate<DateHistogramBucket> DateHistogram(string key) => GetMultiBucketAggregate<DateHistogramBucket>(key);
public AutoDateHistogramAggregate AutoDateHistogram(string key)
{
var bucket = TryGet<BucketAggregate>(key);
if (bucket == null) return null;
return new AutoDateHistogramAggregate
{
Buckets = bucket.Items.OfType<DateHistogramBucket>().ToList(),
Meta = bucket.Meta,
Interval = bucket.Interval
};
}
public CompositeBucketAggregate Composite(string key)
{
var bucket = TryGet<BucketAggregate>(key);
if (bucket == null) return null;
return new CompositeBucketAggregate
{
Buckets = bucket.Items.OfType<CompositeBucket>().ToList(),
Meta = bucket.Meta,
AfterKey = bucket.AfterKey
};
}
public MatrixStatsAggregate MatrixStats(string key) => TryGet<MatrixStatsAggregate>(key);
public ValueAggregate MedianAbsoluteDeviation(string key) => TryGet<ValueAggregate>(key);
public BoxplotAggregate Boxplot(string key) => TryGet<BoxplotAggregate>(key);
// ReSharper disable once InconsistentNaming
public ValueAggregate TTest(string key) => TryGet<ValueAggregate>(key);
private TAggregate TryGet<TAggregate>(string key) where TAggregate : class, IAggregate =>
BackingDictionary.TryGetValue(key, out var agg) ? agg as TAggregate : null;
private MultiBucketAggregate<TBucket> GetMultiBucketAggregate<TBucket>(string key)
where TBucket : IBucket
{
var bucket = TryGet<BucketAggregate>(key);
if (bucket == null) return null;
return new MultiBucketAggregate<TBucket>
{
Buckets = bucket.Items.OfType<TBucket>().ToList(),
Meta = bucket.Meta
};
}
private MultiBucketAggregate<KeyedBucket<TKey>> GetMultiKeyedBucketAggregate<TKey>(string key)
{
var bucket = TryGet<BucketAggregate>(key);
if (bucket == null) return null;
return new MultiBucketAggregate<KeyedBucket<TKey>>
{
Buckets = GetKeyedBuckets<TKey>(bucket.Items).ToList(),
Meta = bucket.Meta
};
}
private IEnumerable<KeyedBucket<TKey>> GetKeyedBuckets<TKey>(IEnumerable<IBucket> items)
{
var buckets = items.Cast<KeyedBucket<object>>();
foreach (var bucket in buckets)
yield return new KeyedBucket<TKey>(bucket.BackingDictionary)
{
Key = GetKeyFromBucketKey<TKey>(bucket.Key),
KeyAsString = bucket.KeyAsString,
DocCount = bucket.DocCount,
DocCountErrorUpperBound = bucket.DocCountErrorUpperBound
};
}
private IEnumerable<SignificantTermsBucket<TKey>> GetSignificantTermsBuckets<TKey>(IEnumerable<IBucket> items)
{
var buckets = items.Cast<SignificantTermsBucket<object>>();
foreach (var bucket in buckets)
yield return new SignificantTermsBucket<TKey>(bucket.BackingDictionary)
{
Key = GetKeyFromBucketKey<TKey>(bucket.Key),
BgCount = bucket.BgCount,
DocCount = bucket.DocCount,
Score = bucket.Score
};
}
private IEnumerable<RareTermsBucket<TKey>> GetRareTermsBuckets<TKey>(IEnumerable<IBucket> items)
{
var buckets = items.Cast<KeyedBucket<object>>();
foreach (var bucket in buckets)
yield return new RareTermsBucket<TKey>(bucket.BackingDictionary)
{
Key = GetKeyFromBucketKey<TKey>(bucket.Key),
DocCount = bucket.DocCount.GetValueOrDefault(0)
};
}
private static TKey GetKeyFromBucketKey<TKey>(object key) =>
typeof(TKey).IsEnum
? (TKey)Enum.Parse(typeof(TKey), key.ToString(), true)
: (TKey)Convert.ChangeType(key, typeof(TKey));
}
}
| 35.981873 | 130 | 0.753233 | [
"Apache-2.0"
] | benaadams/elasticsearch-net | src/Nest/Aggregations/AggregateDictionary.cs | 11,910 | C# |
#nullable enable
using System;
using System.Collections.Generic;
namespace Java.Interop
{
public struct JniNativeMethodRegistrationArguments
{
const string invalidStateMessage = nameof(JniNativeMethodRegistrationArguments) + " state is invalid. Please use constructor with parameters.";
public ICollection<JniNativeMethodRegistration> Registrations {
get { return _registrations ?? throw new InvalidOperationException (invalidStateMessage); }
}
public string? Methods { get; }
ICollection<JniNativeMethodRegistration> _registrations;
public JniNativeMethodRegistrationArguments (ICollection<JniNativeMethodRegistration> registrations, string? methods)
{
_registrations = registrations ?? throw new ArgumentNullException (nameof (registrations));
Methods = methods;
}
public void AddRegistrations (IEnumerable<JniNativeMethodRegistration> registrations)
{
if (_registrations == null)
throw new InvalidOperationException (invalidStateMessage);
if (registrations is List<JniNativeMethodRegistration> list) {
list.AddRange (registrations);
} else {
foreach (var registration in registrations)
_registrations.Add (registration);
}
}
}
}
| 31.631579 | 145 | 0.781198 | [
"MIT"
] | Wivra/java.interop | src/Java.Interop/Java.Interop/JniNativeMethodRegistrationArguments.cs | 1,204 | C# |
//
// System.Runtime.Serialization.SerializationCallbacks.cs
//
// Author:
// Robert Jordan ([email protected])
//
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Reflection;
namespace System.Runtime.Serialization {
internal sealed class SerializationCallbacks
{
public delegate void CallbackHandler (StreamingContext context);
readonly ArrayList onSerializingList;
readonly ArrayList onSerializedList;
readonly ArrayList onDeserializingList;
readonly ArrayList onDeserializedList;
public bool HasSerializingCallbacks {
get {return onSerializingList != null;}
}
public bool HasSerializedCallbacks {
get {return onSerializedList != null;}
}
public bool HasDeserializingCallbacks {
get {return onDeserializingList != null;}
}
public bool HasDeserializedCallbacks {
get {return onDeserializedList != null;}
}
public SerializationCallbacks (Type type)
{
onSerializingList = GetMethodsByAttribute (type, typeof (OnSerializingAttribute));
onSerializedList = GetMethodsByAttribute (type, typeof (OnSerializedAttribute));
onDeserializingList = GetMethodsByAttribute (type, typeof (OnDeserializingAttribute));
onDeserializedList = GetMethodsByAttribute (type, typeof (OnDeserializedAttribute));
}
const BindingFlags DefaultBindingFlags = BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.DeclaredOnly;
static ArrayList GetMethodsByAttribute (Type type, Type attr)
{
ArrayList list = new ArrayList ();
Type t = type;
while (t != typeof (object)) {
int count = 0;
foreach (MethodInfo mi in t.GetMethods (DefaultBindingFlags)) {
if (mi.IsDefined (attr, false)) {
list.Add (mi);
count++;
}
}
// FIXME: MS.NET is checking for this with the verifier at assembly load time.
if (count > 1)
throw new TypeLoadException (
String.Format ("Type '{0}' has more than one method with the following attribute: '{1}'.", type.AssemblyQualifiedName, attr.FullName));
t = t.BaseType;
}
// optimize memory usage
return list.Count == 0 ? null : list;
}
static void Invoke (ArrayList list, object target, StreamingContext context)
{
if (list == null)
return;
CallbackHandler handler = null;
// construct a delegate from the specified list
foreach (MethodInfo mi in list) {
handler = (CallbackHandler)
Delegate.Combine (
Delegate.CreateDelegate (typeof (CallbackHandler), target, mi),
handler);
}
handler (context);
}
public void RaiseOnSerializing (object target, StreamingContext contex)
{
Invoke (onSerializingList, target, contex);
}
public void RaiseOnSerialized (object target, StreamingContext contex)
{
Invoke (onSerializedList, target, contex);
}
public void RaiseOnDeserializing (object target, StreamingContext contex)
{
Invoke (onDeserializingList, target, contex);
}
public void RaiseOnDeserialized (object target, StreamingContext contex)
{
Invoke (onDeserializedList, target, contex);
}
static Hashtable cache = new Hashtable ();
static object cache_lock = new object ();
public static SerializationCallbacks GetSerializationCallbacks (Type t)
{
SerializationCallbacks sc = (SerializationCallbacks) cache [t];
if (sc != null)
return sc;
// Slow path, new entry, we need to copy
lock (cache_lock){
sc = (SerializationCallbacks) cache [t];
if (sc == null) {
Hashtable copy = (Hashtable) cache.Clone ();
sc = new SerializationCallbacks (t);
copy [t] = sc;
cache = copy;
}
return sc;
}
}
}
}
| 29.776398 | 141 | 0.717564 | [
"Apache-2.0"
] | 121468615/mono | mcs/class/corlib/System.Runtime.Serialization/SerializationCallbacks.cs | 4,794 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tools.Math
{
public static class Misc
{
public static Vector2D PolarToCartesian(Vector2D v)
{
return new Vector2D()
{
X = v.X * System.Math.Cos(v.Y),
Y = v.X * System.Math.Sin(v.Y)
};
}
public static Vector2D PolarToCartesian(double R, double A)
{
return new Vector2D()
{
X = R * System.Math.Cos(A),
Y = R * System.Math.Sin(A)
};
}
public static Vector2D CartesianToPolar(Vector2D v)
{
return new Vector2D()
{
X = System.Math.Sqrt(v.X * v.X + v.Y * v.Y),
Y = System.Math.Atan2(v.Y, v.X)
};
}
public static Vector2D CartesianToPolar(double X, double Y)
{
return new Vector2D()
{
X = System.Math.Sqrt(X * X + Y * Y),
Y = System.Math.Atan2(Y, X)
};
}
public static double DegToRad(double value)
{
return value / 180 * System.Math.PI;
}
public static double RadToDeg(double value)
{
return 180 * value / System.Math.PI;
}
public static double Map(double From_min, double From_max, double To_min, double To_max, double value)
{
return To_min + ((To_max - To_min) / (From_max - From_min)) * (value - From_min);
}
public static double[] FindPolynomialRoot_BrentDekker(double a, double b, double[] function, double epsilon = double.Epsilon)
{
int rank = function.Length - 1;
double[] roots = new double[rank];
double s = double.NaN;
double f_s = double.NaN;
double d = double.NaN;
// calculate f(a) and calculate f(b)
double f_a = CalculatePolynomialValue(a, function);
double f_b = CalculatePolynomialValue(b, function);
// exit function because the root is not bracketed
if (f_a * f_b >= 0) return null;
if (System.Math.Abs(f_a) < System.Math.Abs(f_b))
{
double t = a;
a = b;
b = t;
double f_t = f_a;
f_a = f_b;
f_b = f_t;
}
bool mflag = true;
double c = a;
double f_c;
do
{
f_c = CalculatePolynomialValue(c, function);
if (f_a != f_c && f_b != f_c)
{
s = (a * f_c - b * f_c) / ((f_a - f_b) * (f_a - f_c)) +
(b * f_a - b * f_c) / ((f_b - f_a) * (f_b - f_c)) +
(c * f_a - b * f_b) / ((f_c - f_a) * (f_c - f_b));
}
else
{
s = b - f_b * (b - a) / (f_b - f_a);
}
if (!InRange((3 * a + b) / 4, b, s) ||
(mflag && System.Math.Abs(s - b) >= System.Math.Abs(b - c) / 2) ||
(!mflag && System.Math.Abs(s - b) >= System.Math.Abs(c - d) / 2) ||
(mflag && System.Math.Abs(b - c) >= epsilon) ||
(!mflag && System.Math.Abs(c - d) >= epsilon))
{
s = (a + b) / 2;
mflag = true;
}
else
mflag = false;
f_s = CalculatePolynomialValue(s, function);
d = c;
c = b;
if (f_a * f_s < 0)
{
b = s;
f_b = f_s;
}
else
{
a = s;
f_a = f_s;
}
if (System.Math.Abs(f_a) < System.Math.Abs(f_b))
{
double t = a;
a = b;
b = t;
double f_t = f_a;
f_a = f_b;
f_b = f_t;
}
Console.SetCursorPosition(0, Console.CursorTop);
Console.Write(string.Format("[{0:N3} : {1:N3}]", s, b));
// repeat until f(b or s) = 0 or |b − a| is small enough (convergence)
} while (f_s != 0 && f_b != 0 && System.Math.Abs(b - a) >= epsilon);
roots[0] = s;
roots[1] = b;
return roots;
}
public static double CalculatePolynomialValue(double value, double[] function)
{
double result = 0;
for (int n = 0; n < function.Length; n++)
result += function[function.Length - 1 - n] * System.Math.Pow(value, n);
return result;
}
public static bool InRange(double a, double b, double value)
{
double lower = a;
double upper = b;
if (a > b)
{
lower = b;
upper = a;
}
return (value >= lower && value <= upper);
}
}
}
| 30.960452 | 134 | 0.394708 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Shikareth/Tools | Tools/Math/Misc.cs | 5,484 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.X86;
using Internal.Runtime.CompilerServices;
// Some routines inspired by the Stanford Bit Twiddling Hacks by Sean Eron Anderson:
// http://graphics.stanford.edu/~seander/bithacks.html
namespace System.Numerics
{
/// <summary>
/// Utility methods for intrinsic bit-twiddling operations.
/// The methods use hardware intrinsics when available on the underlying platform,
/// otherwise they use optimized software fallbacks.
/// </summary>
public static class BitOperations
{
// C# no-alloc optimization that directly wraps the data section of the dll (similar to string constants)
// https://github.com/dotnet/roslyn/pull/24621
private static ReadOnlySpan<byte> TrailingZeroCountDeBruijn => new byte[32]
{
00, 01, 28, 02, 29, 14, 24, 03,
30, 22, 20, 15, 25, 17, 04, 08,
31, 27, 13, 23, 21, 19, 16, 07,
26, 12, 18, 06, 11, 05, 10, 09
};
private static ReadOnlySpan<byte> Log2DeBruijn => new byte[32]
{
00, 09, 01, 10, 13, 21, 02, 29,
11, 14, 16, 18, 22, 25, 03, 30,
08, 12, 20, 28, 15, 17, 24, 07,
19, 27, 23, 06, 26, 05, 04, 31
};
/// <summary>
/// Evaluate whether a given integral value is a power of 2.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsPow2(int value) => (value & (value - 1)) == 0 && value > 0;
/// <summary>
/// Evaluate whether a given integral value is a power of 2.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static bool IsPow2(uint value) => (value & (value - 1)) == 0 && value != 0 ;
/// <summary>
/// Evaluate whether a given integral value is a power of 2.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsPow2(long value) => (value & (value - 1)) == 0 && value > 0;
/// <summary>
/// Evaluate whether a given integral value is a power of 2.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static bool IsPow2(ulong value) => (value & (value - 1)) == 0 && value != 0;
/// <summary>
/// Round the given integral value up to a power of 2.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>
/// The smallest power of 2 which is greater than or equal to <paramref name="value"/>.
/// If <paramref name="value"/> is 0 or the result overflows, returns 0.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static uint RoundUpToPowerOf2(uint value)
{
if (Lzcnt.IsSupported || ArmBase.IsSupported || X86Base.IsSupported)
{
#if TARGET_64BIT
return (uint)(0x1_0000_0000ul >> LeadingZeroCount(value - 1));
#else
int shift = 32 - LeadingZeroCount(value - 1);
return (1u ^ (uint)(shift >> 5)) << shift;
#endif
}
// Based on https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
--value;
value |= value >> 1;
value |= value >> 2;
value |= value >> 4;
value |= value >> 8;
value |= value >> 16;
return value + 1;
}
/// <summary>
/// Round the given integral value up to a power of 2.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>
/// The smallest power of 2 which is greater than or equal to <paramref name="value"/>.
/// If <paramref name="value"/> is 0 or the result overflows, returns 0.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static ulong RoundUpToPowerOf2(ulong value)
{
if (Lzcnt.X64.IsSupported || ArmBase.Arm64.IsSupported)
{
int shift = 64 - LeadingZeroCount(value - 1);
return (1ul ^ (ulong)(shift >> 6)) << shift;
}
// Based on https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
--value;
value |= value >> 1;
value |= value >> 2;
value |= value >> 4;
value |= value >> 8;
value |= value >> 16;
value |= value >> 32;
return value + 1;
}
/// <summary>
/// Count the number of leading zero bits in a mask.
/// Similar in behavior to the x86 instruction LZCNT.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static int LeadingZeroCount(uint value)
{
if (Lzcnt.IsSupported)
{
// LZCNT contract is 0->32
return (int)Lzcnt.LeadingZeroCount(value);
}
if (ArmBase.IsSupported)
{
return ArmBase.LeadingZeroCount(value);
}
// Unguarded fallback contract is 0->31, BSR contract is 0->undefined
if (value == 0)
{
return 32;
}
if (X86Base.IsSupported)
{
// LZCNT returns index starting from MSB, whereas BSR gives the index from LSB.
// 31 ^ BSR here is equivalent to 31 - BSR since the BSR result is always between 0 and 31.
// This saves an instruction, as subtraction from constant requires either MOV/SUB or NEG/ADD.
return 31 ^ (int)X86Base.BitScanReverse(value);
}
return 31 ^ Log2SoftwareFallback(value);
}
/// <summary>
/// Count the number of leading zero bits in a mask.
/// Similar in behavior to the x86 instruction LZCNT.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static int LeadingZeroCount(ulong value)
{
if (Lzcnt.X64.IsSupported)
{
// LZCNT contract is 0->64
return (int)Lzcnt.X64.LeadingZeroCount(value);
}
if (ArmBase.Arm64.IsSupported)
{
return ArmBase.Arm64.LeadingZeroCount(value);
}
if (X86Base.X64.IsSupported)
{
// BSR contract is 0->undefined
return value == 0 ? 64 : 63 ^ (int)X86Base.X64.BitScanReverse(value);
}
uint hi = (uint)(value >> 32);
if (hi == 0)
{
return 32 + LeadingZeroCount((uint)value);
}
return LeadingZeroCount(hi);
}
/// <summary>
/// Returns the integer (floor) log of the specified value, base 2.
/// Note that by convention, input value 0 returns 0 since log(0) is undefined.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static int Log2(uint value)
{
// The 0->0 contract is fulfilled by setting the LSB to 1.
// Log(1) is 0, and setting the LSB for values > 1 does not change the log2 result.
value |= 1;
// value lzcnt actual expected
// ..0001 31 31-31 0
// ..0010 30 31-30 1
// 0010.. 2 31-2 29
// 0100.. 1 31-1 30
// 1000.. 0 31-0 31
if (Lzcnt.IsSupported)
{
return 31 ^ (int)Lzcnt.LeadingZeroCount(value);
}
if (ArmBase.IsSupported)
{
return 31 ^ ArmBase.LeadingZeroCount(value);
}
// BSR returns the log2 result directly. However BSR is slower than LZCNT
// on AMD processors, so we leave it as a fallback only.
if (X86Base.IsSupported)
{
return (int)X86Base.BitScanReverse(value);
}
// Fallback contract is 0->0
return Log2SoftwareFallback(value);
}
/// <summary>
/// Returns the integer (floor) log of the specified value, base 2.
/// Note that by convention, input value 0 returns 0 since log(0) is undefined.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static int Log2(ulong value)
{
value |= 1;
if (Lzcnt.X64.IsSupported)
{
return 63 ^ (int)Lzcnt.X64.LeadingZeroCount(value);
}
if (ArmBase.Arm64.IsSupported)
{
return 63 ^ ArmBase.Arm64.LeadingZeroCount(value);
}
if (X86Base.X64.IsSupported)
{
return (int)X86Base.X64.BitScanReverse(value);
}
uint hi = (uint)(value >> 32);
if (hi == 0)
{
return Log2((uint)value);
}
return 32 + Log2(hi);
}
/// <summary>
/// Returns the integer (floor) log of the specified value, base 2.
/// Note that by convention, input value 0 returns 0 since Log(0) is undefined.
/// Does not directly use any hardware intrinsics, nor does it incur branching.
/// </summary>
/// <param name="value">The value.</param>
private static int Log2SoftwareFallback(uint value)
{
// No AggressiveInlining due to large method size
// Has conventional contract 0->0 (Log(0) is undefined)
// Fill trailing zeros with ones, eg 00010010 becomes 00011111
value |= value >> 01;
value |= value >> 02;
value |= value >> 04;
value |= value >> 08;
value |= value >> 16;
// uint.MaxValue >> 27 is always in range [0 - 31] so we use Unsafe.AddByteOffset to avoid bounds check
return Unsafe.AddByteOffset(
// Using deBruijn sequence, k=2, n=5 (2^5=32) : 0b_0000_0111_1100_0100_1010_1100_1101_1101u
ref MemoryMarshal.GetReference(Log2DeBruijn),
// uint|long -> IntPtr cast on 32-bit platforms does expensive overflow checks not needed here
(IntPtr)(int)((value * 0x07C4ACDDu) >> 27));
}
/// <summary>Returns the integer (ceiling) log of the specified value, base 2.</summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static int Log2Ceiling(uint value)
{
int result = Log2(value);
if (PopCount(value) != 1)
{
result++;
}
return result;
}
/// <summary>Returns the integer (ceiling) log of the specified value, base 2.</summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static int Log2Ceiling(ulong value)
{
int result = Log2(value);
if (PopCount(value) != 1)
{
result++;
}
return result;
}
/// <summary>
/// Returns the population count (number of bits set) of a mask.
/// Similar in behavior to the x86 instruction POPCNT.
/// </summary>
/// <param name="value">The value.</param>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static int PopCount(uint value)
{
if (Popcnt.IsSupported)
{
return (int)Popcnt.PopCount(value);
}
if (AdvSimd.Arm64.IsSupported)
{
// PopCount works on vector so convert input value to vector first.
Vector64<uint> input = Vector64.CreateScalar(value);
Vector64<byte> aggregated = AdvSimd.Arm64.AddAcross(AdvSimd.PopCount(input.AsByte()));
return aggregated.ToScalar();
}
return SoftwareFallback(value);
static int SoftwareFallback(uint value)
{
const uint c1 = 0x_55555555u;
const uint c2 = 0x_33333333u;
const uint c3 = 0x_0F0F0F0Fu;
const uint c4 = 0x_01010101u;
value -= (value >> 1) & c1;
value = (value & c2) + ((value >> 2) & c2);
value = (((value + (value >> 4)) & c3) * c4) >> 24;
return (int)value;
}
}
/// <summary>
/// Returns the population count (number of bits set) of a mask.
/// Similar in behavior to the x86 instruction POPCNT.
/// </summary>
/// <param name="value">The value.</param>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static int PopCount(ulong value)
{
if (Popcnt.X64.IsSupported)
{
return (int)Popcnt.X64.PopCount(value);
}
if (AdvSimd.Arm64.IsSupported)
{
// PopCount works on vector so convert input value to vector first.
Vector64<ulong> input = Vector64.Create(value);
Vector64<byte> aggregated = AdvSimd.Arm64.AddAcross(AdvSimd.PopCount(input.AsByte()));
return aggregated.ToScalar();
}
#if TARGET_32BIT
return PopCount((uint)value) // lo
+ PopCount((uint)(value >> 32)); // hi
#else
return SoftwareFallback(value);
static int SoftwareFallback(ulong value)
{
const ulong c1 = 0x_55555555_55555555ul;
const ulong c2 = 0x_33333333_33333333ul;
const ulong c3 = 0x_0F0F0F0F_0F0F0F0Ful;
const ulong c4 = 0x_01010101_01010101ul;
value -= (value >> 1) & c1;
value = (value & c2) + ((value >> 2) & c2);
value = (((value + (value >> 4)) & c3) * c4) >> 56;
return (int)value;
}
#endif
}
/// <summary>
/// Count the number of trailing zero bits in an integer value.
/// Similar in behavior to the x86 instruction TZCNT.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int TrailingZeroCount(int value)
=> TrailingZeroCount((uint)value);
/// <summary>
/// Count the number of trailing zero bits in an integer value.
/// Similar in behavior to the x86 instruction TZCNT.
/// </summary>
/// <param name="value">The value.</param>
[CLSCompliant(false)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int TrailingZeroCount(uint value)
{
if (Bmi1.IsSupported)
{
// TZCNT contract is 0->32
return (int)Bmi1.TrailingZeroCount(value);
}
if (ArmBase.IsSupported)
{
return ArmBase.LeadingZeroCount(ArmBase.ReverseElementBits(value));
}
// Unguarded fallback contract is 0->0, BSF contract is 0->undefined
if (value == 0)
{
return 32;
}
if (X86Base.IsSupported)
{
return (int)X86Base.BitScanForward(value);
}
// uint.MaxValue >> 27 is always in range [0 - 31] so we use Unsafe.AddByteOffset to avoid bounds check
return Unsafe.AddByteOffset(
// Using deBruijn sequence, k=2, n=5 (2^5=32) : 0b_0000_0111_0111_1100_1011_0101_0011_0001u
ref MemoryMarshal.GetReference(TrailingZeroCountDeBruijn),
// uint|long -> IntPtr cast on 32-bit platforms does expensive overflow checks not needed here
(IntPtr)(int)(((value & (uint)-(int)value) * 0x077CB531u) >> 27)); // Multi-cast mitigates redundant conv.u8
}
/// <summary>
/// Count the number of trailing zero bits in a mask.
/// Similar in behavior to the x86 instruction TZCNT.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int TrailingZeroCount(long value)
=> TrailingZeroCount((ulong)value);
/// <summary>
/// Count the number of trailing zero bits in a mask.
/// Similar in behavior to the x86 instruction TZCNT.
/// </summary>
/// <param name="value">The value.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static int TrailingZeroCount(ulong value)
{
if (Bmi1.X64.IsSupported)
{
// TZCNT contract is 0->64
return (int)Bmi1.X64.TrailingZeroCount(value);
}
if (ArmBase.Arm64.IsSupported)
{
return ArmBase.Arm64.LeadingZeroCount(ArmBase.Arm64.ReverseElementBits(value));
}
if (X86Base.X64.IsSupported)
{
// BSF contract is 0->undefined
return value == 0 ? 64 : (int)X86Base.X64.BitScanForward(value);
}
uint lo = (uint)value;
if (lo == 0)
{
return 32 + TrailingZeroCount((uint)(value >> 32));
}
return TrailingZeroCount(lo);
}
/// <summary>
/// Rotates the specified value left by the specified number of bits.
/// Similar in behavior to the x86 instruction ROL.
/// </summary>
/// <param name="value">The value to rotate.</param>
/// <param name="offset">The number of bits to rotate by.
/// Any value outside the range [0..31] is treated as congruent mod 32.</param>
/// <returns>The rotated value.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static uint RotateLeft(uint value, int offset)
=> (value << offset) | (value >> (32 - offset));
/// <summary>
/// Rotates the specified value left by the specified number of bits.
/// Similar in behavior to the x86 instruction ROL.
/// </summary>
/// <param name="value">The value to rotate.</param>
/// <param name="offset">The number of bits to rotate by.
/// Any value outside the range [0..63] is treated as congruent mod 64.</param>
/// <returns>The rotated value.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static ulong RotateLeft(ulong value, int offset)
=> (value << offset) | (value >> (64 - offset));
/// <summary>
/// Rotates the specified value right by the specified number of bits.
/// Similar in behavior to the x86 instruction ROR.
/// </summary>
/// <param name="value">The value to rotate.</param>
/// <param name="offset">The number of bits to rotate by.
/// Any value outside the range [0..31] is treated as congruent mod 32.</param>
/// <returns>The rotated value.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static uint RotateRight(uint value, int offset)
=> (value >> offset) | (value << (32 - offset));
/// <summary>
/// Rotates the specified value right by the specified number of bits.
/// Similar in behavior to the x86 instruction ROR.
/// </summary>
/// <param name="value">The value to rotate.</param>
/// <param name="offset">The number of bits to rotate by.
/// Any value outside the range [0..63] is treated as congruent mod 64.</param>
/// <returns>The rotated value.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[CLSCompliant(false)]
public static ulong RotateRight(ulong value, int offset)
=> (value >> offset) | (value << (64 - offset));
}
}
| 37.760984 | 124 | 0.544866 | [
"MIT"
] | FiniteReality/runtime | src/libraries/System.Private.CoreLib/src/System/Numerics/BitOperations.cs | 21,486 | C# |
using Microsoft.AspNetCore.Identity;
namespace PierreTreat.Models
{
public class ApplicationUser : IdentityUser
{
}
} | 14.555556 | 47 | 0.732824 | [
"MIT"
] | an12346/pierre-savory-sweet | PierreTreat/Models/ApplicationUser.cs | 131 | C# |
//----------------------
// <auto-generated>
// This file was automatically generated. Any changes to it will be lost if and when the file is regenerated.
// </auto-generated>
//----------------------
#pragma warning disable
using System;
using SQEX.Luminous.Core.Object;
using System.Collections.Generic;
using CodeDom = System.CodeDom;
namespace Black.Sequence.Action.Menu
{
[Serializable, CodeDom.Compiler.GeneratedCode("Luminaire", "0.1")]
public partial class SequenceActionSetTextSwfEntityBundle : Black.Sequence.Action.Menu.SequenceActionSwfEntityHierarchyBase
{
new public static ObjectType ObjectType { get; private set; }
private static PropertyContainer fieldProperties;
[UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphTriggerInputPin in_= new SQEX.Ebony.Framework.Node.GraphTriggerInputPin();
[UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphTriggerOutputPin out_= new SQEX.Ebony.Framework.Node.GraphTriggerOutputPin();
[UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphVariableInputPin swfEntityInput_= new SQEX.Ebony.Framework.Node.GraphVariableInputPin();
[UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphVariableInputPin messagePin_= new SQEX.Ebony.Framework.Node.GraphVariableInputPin();
[UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphVariableInputPin offsetPin_= new SQEX.Ebony.Framework.Node.GraphVariableInputPin();
public bool forceVisibleFlag_;
public uint textFieldFixid_;
public string message_= string.Empty;
public bool setEmptyText_;
new public static void SetupObjectType()
{
if (ObjectType != null)
{
return;
}
var dummy = new SequenceActionSetTextSwfEntityBundle();
var properties = dummy.GetFieldProperties();
ObjectType = new ObjectType("Black.Sequence.Action.Menu.SequenceActionSetTextSwfEntityBundle", 0, Black.Sequence.Action.Menu.SequenceActionSetTextSwfEntityBundle.ObjectType, Construct, properties, 0, 800);
}
public override ObjectType GetObjectType()
{
return ObjectType;
}
protected override PropertyContainer GetFieldProperties()
{
if (fieldProperties != null)
{
return fieldProperties;
}
fieldProperties = new PropertyContainer("Black.Sequence.Action.Menu.SequenceActionSetTextSwfEntityBundle", base.GetFieldProperties(), 1163920092, 1401431363);
fieldProperties.AddIndirectlyProperty(new Property("refInPorts_", 1035088696, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 24, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4));
fieldProperties.AddIndirectlyProperty(new Property("refOutPorts_", 283683627, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 40, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4));
fieldProperties.AddIndirectlyProperty(new Property("triInPorts_", 291734708, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 96, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4));
fieldProperties.AddIndirectlyProperty(new Property("triOutPorts_", 3107891487, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 112, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4));
fieldProperties.AddIndirectlyProperty(new Property("Isolated_", 56305607, "bool", 168, 1, 1, Property.PrimitiveType.Bool, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("mcInstancePathPin_", 1160557025, "SQEX.Ebony.Framework.Node.GraphVariableInputPin", 192, 88, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("mcInstancePathPin_.pinName_", 3471311288, "Base.String", 200, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("mcInstancePathPin_.name_", 457596691, "Base.String", 216, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("mcInstancePathPin_.connections_", 914993659, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 232, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("mcInstancePathPin_.pinValueType_", 1321962310, "Base.String", 264, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("mcInstancePath_", 3085499294, "Ebony.Base.String", 280, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("in_.pinName_", 3330161590, "Base.String", 320, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("in_.name_", 192292993, "Base.String", 336, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("in_.connections_", 490033121, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 352, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("in_.delayType_", 261766523, "SQEX.Ebony.Framework.Node.GraphPin.DelayType", 384, 4, 1, Property.PrimitiveType.Enum, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("in_.delayTime_", 1689218608, "float", 388, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("in_.delayMaxTime_", 1529341114, "float", 392, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.pinName_", 1137295951, "Base.String", 416, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.name_", 2182257194, "Base.String", 432, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.connections_", 2048532136, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 448, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("out_.delayType_", 124432558, "SQEX.Ebony.Framework.Node.GraphPin.DelayType", 480, 4, 1, Property.PrimitiveType.Enum, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.delayTime_", 3264366185, "float", 484, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.delayMaxTime_", 456551125, "float", 488, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("swfEntityInput_.pinName_", 77426036, "Base.String", 512, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("swfEntityInput_.name_", 3148774799, "Base.String", 528, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("swfEntityInput_.connections_", 2228389663, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 544, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("swfEntityInput_.pinValueType_", 3729535634, "Base.String", 576, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("messagePin_.pinName_", 1474441579, "Base.String", 600, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("messagePin_.name_", 1674323430, "Base.String", 616, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("messagePin_.connections_", 3531932060, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 632, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("messagePin_.pinValueType_", 1864640575, "Base.String", 664, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("offsetPin_.pinName_", 3857530301, "Base.String", 688, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("offsetPin_.name_", 1495859656, "Base.String", 704, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("offsetPin_.connections_", 62799878, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 720, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("offsetPin_.pinValueType_", 3124797965, "Base.String", 752, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddProperty(new Property("in_", 1827225043, "SQEX.Ebony.Framework.Node.GraphTriggerInputPin", 312, 96, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddProperty(new Property("out_", 1514340864, "SQEX.Ebony.Framework.Node.GraphTriggerOutputPin", 408, 96, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddProperty(new Property("swfEntityInput_", 531204709, "SQEX.Ebony.Framework.Node.GraphVariableInputPin", 504, 88, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddProperty(new Property("messagePin_", 301027364, "SQEX.Ebony.Framework.Node.GraphVariableInputPin", 592, 88, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddProperty(new Property("offsetPin_", 3742051434, "SQEX.Ebony.Framework.Node.GraphVariableInputPin", 680, 88, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddProperty(new Property("forceVisibleFlag_", 322326389, "bool", 768, 1, 1, Property.PrimitiveType.Bool, 0, (char)0));
fieldProperties.AddProperty(new Property("textFieldFixid_", 1480614613, "SQEX.Ebony.Std.Fixid", 772, 4, 1, Property.PrimitiveType.Fixid, 0, (char)0));
fieldProperties.AddProperty(new Property("message_", 3825450593, "Ebony.Base.String", 776, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddProperty(new Property("setEmptyText_", 4275394312, "bool", 792, 1, 1, Property.PrimitiveType.Bool, 0, (char)0));
return fieldProperties;
}
private static BaseObject Construct()
{
return new SequenceActionSetTextSwfEntityBundle();
}
}
} | 91.102564 | 241 | 0.7572 | [
"MIT"
] | Gurrimo/Luminaire | Assets/Editor/Generated/Black/Sequence/Action/Menu/SequenceActionSetTextSwfEntityBundle.generated.cs | 10,659 | C# |
namespace ResXManager.Model
{
using System.Collections.Generic;
using System.Linq;
using ResXManager.Infrastructure;
using ResXManager.Model.Properties;
[LocalizedDisplayName(StringResourceKey.ResourceTableEntryRuleWhiteSpaceTail_Name)]
[LocalizedDescription(StringResourceKey.ResourceTableEntryRuleWhiteSpaceTail_Description)]
public sealed class ResourceTableEntryRuleWhiteSpaceTail : ResourceTableEntryRuleWhiteSpace
{
public const string Id = "WhiteSpaceTail";
public override string RuleId => Id;
protected override IEnumerable<char> GetCharIterator(string? value) => value?.Reverse() ?? Enumerable.Empty<char>();
protected override string GetErrorMessage(IEnumerable<string> reference)
{
var whiteSpaceSeq = string.Join("][", reference.Reverse());
var intro = Resources.ResourceTableEntryRuleWhiteSpaceTail_Error_Intro;
if (whiteSpaceSeq.IsNullOrEmpty())
return intro + " " + Resources.ResourceTableEntryRuleWhiteSpaceTail_Error_NoWhiteSpaceExpected;
whiteSpaceSeq = "[" + whiteSpaceSeq + "]";
return intro + " " + string.Format(Resources.Culture,
Resources.ResourceTableEntryRuleWhiteSpaceTail_Error_WhiteSpaceSeqExpected,
whiteSpaceSeq);
}
}
}
| 40.735294 | 125 | 0.693863 | [
"MIT"
] | Dalagh/ResXResourceManager | src/ResXManager.Model/ResourceTableEntryRuleWhiteSpaceTail.cs | 1,387 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace tasksche
{
class ServerDATA
{
public string IP { get; set; }
public int PORT { get; set; }
}
class FileDATA
{
public string NAME { get; set; }
public string KEY { get; set; }
}
class UrlDATA
{
public string URL { get; set; }
public string KEY1 { get; set; }
public string KEY2 { get; set; }
}
class Program
{
[DllImport("kernel32.dll")]
private static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private const int SW_HIDE = 0;
private static string f1(string str, string key, byte[] iv)
{
RijndaelManaged aes = new RijndaelManaged();
aes.KeySize = 256;
aes.BlockSize = 128;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
aes.Key = Encoding.UTF8.GetBytes(key);
aes.IV = iv;
var decrypt = aes.CreateDecryptor();
byte[] xBuff = null;
using (var ms = new MemoryStream())
{
using (var cs = new CryptoStream(ms, decrypt, CryptoStreamMode.Write))
{
byte[] xXml = Convert.FromBase64String(str);
cs.Write(xXml, 0, xXml.Length);
}
xBuff = ms.ToArray();
}
return Encoding.UTF8.GetString(xBuff);
}
static void Main(string[] args)
{
var handle = GetConsoleWindow();
ShowWindow(handle, SW_HIDE);
try
{
while (true)
{
try
{
FileDATA v1 = new FileDATA();
v1.NAME = "b.wncry";
v1.KEY = "GLD34QaGHRdsR2ws";
UrlDATA v2 = new UrlDATA();
ServerDATA v3 = new ServerDATA();
FileDATA v4 = new FileDATA();
v4.NAME = "t.wncry";
v4.KEY = "";
string v5 = f1(File.ReadAllText(v1.NAME), v1.KEY, new byte[] { 1, 0, 7, 3, 4, 2, 0, 3, 9, 6, 0, 6, 2, 5, 6, 8 });
v2.URL = v5.Split('+')[0]; v2.KEY1 = v5.Split('+')[1]; v2.KEY2 = v5.Split('+')[2];
string v6 = v2.URL;
WebRequest v7 = null;
WebResponse v8 = null;
Stream v9 = null;
StreamReader v10 = null;
try
{
v7 = WebRequest.Create(v2.URL.Trim());
v8 = v7.GetResponse();
v9 = v8.GetResponseStream();
v10 = new StreamReader(v9);
string v11 = v10.ReadToEnd();
v6 = v11;
}
catch (Exception) { v3.IP = null; v3.PORT = 0; }
finally { if (v10 != null) v10.Close(); if (v10 != null) v10.Close(); }
string v12 = f1(v6.Split(new string[] { "&" }, StringSplitOptions.None)[0], v2.KEY1, new byte[] { 1, 0, 7, 3, 4, 2, 0, 3, 9, 6, 0, 6, 2, 5, 6, 8 });
string v14 = f1(v6.Split(new string[] { "&" }, StringSplitOptions.None)[1], v2.KEY2, new byte[] { 1, 0, 7, 3, 4, 2, 0, 3, 9, 6, 0, 6, 2, 5, 6, 8 });
v3.IP = v12; v3.PORT = int.Parse(v14);
string v15 = File.ReadAllText(v4.NAME);
NetworkStream v16 = null;
StreamReader v17 = null;
StreamWriter v18 = null;
TcpClient v19 = null;
v19 = new TcpClient(v3.IP, v3.PORT);
v16 = v19.GetStream();
v17 = new StreamReader(v16, Encoding.UTF8);
v18 = new StreamWriter(v16, Encoding.UTF8);
string v20 = string.Empty;
string v21 = string.Empty;
v20 = "[SCH]" + v15;
v18.WriteLine(v20);
v18.Flush();
v21 = v17.ReadLine();
if (v18 != null) v18.Close();
if (v17 != null) v17.Close();
if (v19 != null) v19.Close();
File.Delete(v4.NAME);
}
catch (Exception) { }
Thread.Sleep(20000);
}
}
catch (Exception) { }
}
}
}
| 38.240602 | 172 | 0.429414 | [
"MIT"
] | fkdldkRhya/WannaCrypt0r | tasksche/tasksche/Program.cs | 5,088 | C# |
// ReSharper disable All
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Web.Http;
using MixERP.Net.Schemas.Localization.Data;
using MixERP.Net.EntityParser;
using MixERP.Net.Framework.Extensions;
using PetaPoco;
using CustomField = PetaPoco.CustomField;
namespace MixERP.Net.Api.Localization.Fakes
{
public class ResourceRepository : IResourceRepository
{
public long Count()
{
return 1;
}
public IEnumerable<MixERP.Net.Entities.Localization.Resource> GetAll()
{
return Enumerable.Repeat(new MixERP.Net.Entities.Localization.Resource(), 1);
}
public IEnumerable<dynamic> Export()
{
return Enumerable.Repeat(new MixERP.Net.Entities.Localization.Resource(), 1);
}
public MixERP.Net.Entities.Localization.Resource Get(int resourceId)
{
return new MixERP.Net.Entities.Localization.Resource();
}
public IEnumerable<MixERP.Net.Entities.Localization.Resource> Get(int[] resourceIds)
{
return Enumerable.Repeat(new MixERP.Net.Entities.Localization.Resource(), 1);
}
public MixERP.Net.Entities.Localization.Resource GetFirst()
{
return new MixERP.Net.Entities.Localization.Resource();
}
public MixERP.Net.Entities.Localization.Resource GetPrevious(int resourceId)
{
return new MixERP.Net.Entities.Localization.Resource();
}
public MixERP.Net.Entities.Localization.Resource GetNext(int resourceId)
{
return new MixERP.Net.Entities.Localization.Resource();
}
public MixERP.Net.Entities.Localization.Resource GetLast()
{
return new MixERP.Net.Entities.Localization.Resource();
}
public IEnumerable<MixERP.Net.Entities.Localization.Resource> GetPaginatedResult()
{
return Enumerable.Repeat(new MixERP.Net.Entities.Localization.Resource(), 1);
}
public IEnumerable<MixERP.Net.Entities.Localization.Resource> GetPaginatedResult(long pageNumber)
{
return Enumerable.Repeat(new MixERP.Net.Entities.Localization.Resource(), 1);
}
public long CountWhere(List<EntityParser.Filter> filters)
{
return 1;
}
public IEnumerable<MixERP.Net.Entities.Localization.Resource> GetWhere(long pageNumber, List<EntityParser.Filter> filters)
{
return Enumerable.Repeat(new MixERP.Net.Entities.Localization.Resource(), 1);
}
public long CountFiltered(string filterName)
{
return 1;
}
public List<EntityParser.Filter> GetFilters(string catalog, string filterName)
{
return Enumerable.Repeat(new EntityParser.Filter(), 1).ToList();
}
public IEnumerable<MixERP.Net.Entities.Localization.Resource> GetFiltered(long pageNumber, string filterName)
{
return Enumerable.Repeat(new MixERP.Net.Entities.Localization.Resource(), 1);
}
public IEnumerable<DisplayField> GetDisplayFields()
{
return Enumerable.Repeat(new DisplayField(), 1);
}
public IEnumerable<PetaPoco.CustomField> GetCustomFields()
{
return Enumerable.Repeat(new CustomField(), 1);
}
public IEnumerable<PetaPoco.CustomField> GetCustomFields(string resourceId)
{
return Enumerable.Repeat(new CustomField(), 1);
}
public object AddOrEdit(dynamic resource, List<EntityParser.CustomField> customFields)
{
return true;
}
public void Update(dynamic resource, int resourceId)
{
if (resourceId > 0)
{
return;
}
throw new ArgumentException("resourceId is null.");
}
public object Add(dynamic resource)
{
return true;
}
public List<object> BulkImport(List<ExpandoObject> resources)
{
return Enumerable.Repeat(new object(), 1).ToList();
}
public void Delete(int resourceId)
{
if (resourceId > 0)
{
return;
}
throw new ArgumentException("resourceId is null.");
}
}
} | 29.778523 | 130 | 0.618436 | [
"MPL-2.0"
] | asine/mixerp | src/Libraries/Web API/Localization/Fakes/ResourceRepository.cs | 4,437 | C# |
/*************************************************************************************
Toolkit for WPF
Copyright (C) 2007-2019 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Public
License (Ms-PL) as published at https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md
For more features, controls, and fast professional support,
pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
***********************************************************************************/
using System.Windows.Input;
namespace Xceed.Wpf.Toolkit
{
public static class WizardCommands
{
private static RoutedCommand _cancelCommand = new RoutedCommand();
public static RoutedCommand Cancel
{
get
{
return _cancelCommand;
}
}
private static RoutedCommand _finishCommand = new RoutedCommand();
public static RoutedCommand Finish
{
get
{
return _finishCommand;
}
}
private static RoutedCommand _helpCommand = new RoutedCommand();
public static RoutedCommand Help
{
get
{
return _helpCommand;
}
}
private static RoutedCommand _nextPageCommand = new RoutedCommand();
public static RoutedCommand NextPage
{
get
{
return _nextPageCommand;
}
}
private static RoutedCommand _previousPageCommand = new RoutedCommand();
public static RoutedCommand PreviousPage
{
get
{
return _previousPageCommand;
}
}
private static RoutedCommand _selectPageCommand = new RoutedCommand();
public static RoutedCommand SelectPage
{
get
{
return _selectPageCommand;
}
}
}
}
| 23.64557 | 101 | 0.602248 | [
"MIT"
] | O-Debegnach/Supervisor-de-Comercio | wpftoolkit-master/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Wizard/Implementation/WizardCommands.cs | 1,870 | C# |
namespace MatrixTransform
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 33;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(592, 573);
this.DoubleBuffered = true;
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Timer timer1;
}
}
| 29.540984 | 87 | 0.530522 | [
"MIT"
] | mingchaoyan/MatrixTransform | MatrixTransform/Form1.Designer.cs | 1,954 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
namespace VNC.TFS
{
public class Common
{
public const string LOG_APPNAME = "VNCTFS";
}
}
| 16.5 | 51 | 0.709957 | [
"MIT"
] | chrhodes/VNC | VNC.TFSHelper/VNC.TFSHelper/Common.cs | 233 | C# |
using System.Threading;
using System.Threading.Tasks;
using Caracal.Framework.UseCases;
using Caracal.PayStation.Payments;
using Caracal.PayStation.Payments.Gateways;
namespace Caracal.PayStation.Application.UseCases.Withdrawals.ProcessWFClientAction {
public class ProcessWFClientActionUseCase: UseCase<ProcessWFClientActionResponse, ProcessWFClientActionRequest> {
private readonly WorkflowGateway _workflow;
private readonly WithdrawalService _service;
public ProcessWFClientActionUseCase(WorkflowGateway workflow, WithdrawalService service) {
_workflow = workflow;
_service = service;
}
public override async Task<ProcessWFClientActionResponse> ExecuteAsync(ProcessWFClientActionRequest request, CancellationToken cancellationToken) {
Request = request;
foreach(var i in request.Items)
await ProcessAsync(i);
return new ProcessWFClientActionResponse {Items = request.Items};
async Task ProcessAsync(WorkflowAction action) {
var withdrawal = await _service.GetWithdrawal(action.WithdrawalId, cancellationToken);
if (string.IsNullOrWhiteSpace(withdrawal.WorkflowUrl))
return;
await _service.UpdateWfUrlAsync(withdrawal.Id, string.Empty, cancellationToken);
await _workflow.SendClientEventAsync(withdrawal.WorkflowUrl, action.Payload, cancellationToken);
action.Succeeded = true;
}
}
}
} | 42.594595 | 155 | 0.69797 | [
"MIT"
] | Caracal-IT/pay-station | src/Source/Caracal.PayStation.Application/UseCases/Withdrawals/ProcessWFClientAction/ProcessWFClientActionUseCase.cs | 1,576 | C# |
public class EnduranceDriver : Driver
{
public EnduranceDriver(string name, int hp, double fuelAmount, double tyreHardness)
: base(name, hp, fuelAmount, tyreHardness)
{
}
public EnduranceDriver(string name, int hp, double fuelAmount, double tyreHardness, double tyreGrip)
: base(name, hp, fuelAmount, tyreHardness, tyreGrip)
{
}
public override double FuelConsumptionPerKm => 1.5;
}
| 26.9375 | 104 | 0.696056 | [
"MIT"
] | danieldamianov/C-OOP-Basics | Exam Preparation 2/Grand_Prix/EnduranceDriver.cs | 433 | C# |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Linq;
using Hl7.Fhir.Model;
using Hl7.Fhir.Serialization;
using BreastRadLib;
using BreastRadLib.ObservationLocal;
//+Usings
//-Usings
namespace BreastRadLib.NMFindingLocal
{
//+ LocalClassDefs
//- LocalClassDefs
}
| 18.15 | 38 | 0.754821 | [
"Apache-2.0"
] | Gjoll/BreastRadiologyLibrary | Projects/BreastRadLib/Generated/Class/NMFindingLocal.cs | 363 | C# |
using AutoMapper;
using FluentAssertions;
using MediatR;
using Moq;
using Opdex.Platform.Application.Abstractions.Queries.Tokens;
using Opdex.Platform.Application.Assemblers;
using Opdex.Platform.Domain.Models.Tokens;
using System;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Opdex.Platform.Domain.Models.Addresses;
using Opdex.Platform.Application.Abstractions.Models.Addresses;
using Opdex.Platform.Common.Models.UInt;
using Opdex.Platform.Common.Models;
namespace Opdex.Platform.Application.Tests.Assemblers;
public class AddressBalanceDtoAssemblerTests
{
private readonly Mock<IMapper> _mapperMock;
private readonly Mock<IMediator> _mediatorMock;
private readonly AddressBalanceDtoAssembler _assembler;
public AddressBalanceDtoAssemblerTests()
{
_mapperMock = new Mock<IMapper>();
_mediatorMock = new Mock<IMediator>();
_assembler = new AddressBalanceDtoAssembler(_mapperMock.Object, _mediatorMock.Object);
}
[Fact]
public async Task Assemble_HappyPath_Map()
{
// Arrange
var source = new AddressBalance(5, 5, "PQFv8x66vXEQEjw7ZBi8kCavrz15S1ShcG", 500000000, 5, 50);
// Act
try
{
await _assembler.Assemble(source);
}
catch (Exception) { }
// Assert
_mapperMock.Verify(callTo => callTo.Map<AddressBalanceDto>(source), Times.Once);
}
[Fact]
public async Task Assemble_RetrieveTokenByIdQuery_Send()
{
// Arrange
var source = new AddressBalance(5, 10, "PQFv8x66vXEQEjw7ZBi8kCavrz15S1ShcG", 500000000, 5, 50);
// Act
try
{
await _assembler.Assemble(source);
}
catch (Exception) { }
// Assert
_mediatorMock.Verify(callTo => callTo.Send(It.Is<RetrieveTokenByIdQuery>(query => query.TokenId == source.TokenId && query.FindOrThrow),
CancellationToken.None), Times.Once);
}
[Fact]
public async Task Assemble_HappyPath_ReturnMapped()
{
// Arrange
var dto = new AddressBalanceDto { Address = "PQFv8x66vXEQEjw7ZBi8kCavrz15S1ShcH" };
var token = new Token(5, "PHrN1DPvMcp17i5YL4yUzUCVcH2QimMvHi", "Wrapped Bitcoin", "WBTC", 8, 2100000000000000, UInt256.Parse("21000000"), 5, 15);
var source = new AddressBalance(5, 5, "PQFv8x66vXEQEjw7ZBi8kCavrz15S1ShcG", 500000000, 5, 50);
_mapperMock.Setup(callTo => callTo.Map<AddressBalanceDto>(It.IsAny<AddressBalance>())).Returns(dto);
_mediatorMock.Setup(callTo => callTo.Send(It.IsAny<RetrieveTokenByIdQuery>(), It.IsAny<CancellationToken>())).ReturnsAsync(token);
// Act
var response = await _assembler.Assemble(source);
// Assert
response.Address.Should().Be(dto.Address);
response.Balance.Should().Be(FixedDecimal.Parse("5.00000000"));
response.Token.Should().Be(token.Address);
}
}
| 33.404494 | 153 | 0.679112 | [
"MIT"
] | Opdex/opdex-v1-api | test/Opdex.Platform.Application.Tests/Assemblers/AddressBalanceDtoAssemblerTests.cs | 2,973 | C# |
using Xwt;
using Samples;
namespace MacTest
{
class MainClass
{
static void Main (string [] args)
{
//FIXME: remove this once mmp summorts xammac
ObjCRuntime.Dlfcn.dlopen ("/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac.dylib", 0);
App.Run (ToolkitType.XamMac);
}
}
}
| 17.555556 | 114 | 0.708861 | [
"MIT"
] | UPBIoT/renode-iot | lib/termsharp/xwt/TestApps/XamMacTest/Main.cs | 316 | C# |
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
public class OpenSceneFromMenu : MonoBehaviour
{
[MenuItem("Oreon/Main")]
static void Main()
{
OpenScene("Main");
}
[MenuItem("Oreon/Home")]
static void Home()
{
OpenScene("Home");
}
static void OpenScene(string sceneName)
{
if(!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
{
return;
}
EditorSceneManager.OpenScene("Assets/Scenes/"+sceneName+".unity");
}
} | 21.892857 | 76 | 0.559543 | [
"MIT"
] | cococatus/unity3d_ui_stuff | OpenSceneFromMenu.cs | 613 | C# |
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated code. DO NOT EDIT!
namespace Google.Cloud.DataLabeling.V1Beta1.Snippets
{
// [START datalabeling_v1beta1_generated_DataLabelingService_LabelVideo_sync]
using Google.Cloud.DataLabeling.V1Beta1;
using Google.LongRunning;
public sealed partial class GeneratedDataLabelingServiceClientSnippets
{
/// <summary>Snippet for LabelVideo</summary>
/// <remarks>
/// This snippet has been automatically generated for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </remarks>
public void LabelVideoRequestObject()
{
// Create client
DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.Create();
// Initialize request argument(s)
LabelVideoRequest request = new LabelVideoRequest
{
ParentAsDatasetName = DatasetName.FromProjectDataset("[PROJECT]", "[DATASET]"),
BasicConfig = new HumanAnnotationConfig(),
Feature = LabelVideoRequest.Types.Feature.Unspecified,
VideoClassificationConfig = new VideoClassificationConfig(),
};
// Make the request
Operation<AnnotatedDataset, LabelOperationMetadata> response = dataLabelingServiceClient.LabelVideo(request);
// Poll until the returned long-running operation is complete
Operation<AnnotatedDataset, LabelOperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AnnotatedDataset result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AnnotatedDataset, LabelOperationMetadata> retrievedResponse = dataLabelingServiceClient.PollOnceLabelVideo(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
AnnotatedDataset retrievedResult = retrievedResponse.Result;
}
}
}
// [END datalabeling_v1beta1_generated_DataLabelingService_LabelVideo_sync]
}
| 46.609375 | 144 | 0.69125 | [
"Apache-2.0"
] | AlexandrTrf/google-cloud-dotnet | apis/Google.Cloud.DataLabeling.V1Beta1/Google.Cloud.DataLabeling.V1Beta1.GeneratedSnippets/DataLabelingServiceClient.LabelVideoRequestObjectSnippet.g.cs | 2,983 | C# |
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
namespace app
{
[Route("api/todo-items")]
public partial class ToDoController : Controller
{
private static List<string> items = new List<String> { "Clean my room", "Feed the cat" };
[HttpGet]
public IActionResult GetAllItems()
{
return Ok(items);
}
}
}
| 21.315789 | 97 | 0.617284 | [
"MIT"
] | BrunnerAlexander/htl-csharp | aspnet-core/0030-web-api/app/ToDoController.cs | 407 | C# |
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Management.SecurityInsights.Models
{
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// The graph query to show the current data status
/// </summary>
public partial class GraphQueries
{
/// <summary>
/// Initializes a new instance of the GraphQueries class.
/// </summary>
public GraphQueries()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the GraphQueries class.
/// </summary>
/// <param name="metricName">the metric that the query is
/// checking</param>
/// <param name="legend">The legend for the graph</param>
/// <param name="baseQuery">The base query for the graph</param>
public GraphQueries(string metricName = default(string), string legend = default(string), string baseQuery = default(string))
{
MetricName = metricName;
Legend = legend;
BaseQuery = baseQuery;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets the metric that the query is checking
/// </summary>
[JsonProperty(PropertyName = "metricName")]
public string MetricName { get; set; }
/// <summary>
/// Gets or sets the legend for the graph
/// </summary>
[JsonProperty(PropertyName = "legend")]
public string Legend { get; set; }
/// <summary>
/// Gets or sets the base query for the graph
/// </summary>
[JsonProperty(PropertyName = "baseQuery")]
public string BaseQuery { get; set; }
}
}
| 31.753623 | 133 | 0.596531 | [
"MIT"
] | 93mishra/azure-sdk-for-net | sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GraphQueries.cs | 2,191 | C# |
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/channel/v1/entitlements.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Cloud.Channel.V1 {
/// <summary>Holder for reflection information generated from google/cloud/channel/v1/entitlements.proto</summary>
public static partial class EntitlementsReflection {
#region Descriptor
/// <summary>File descriptor for google/cloud/channel/v1/entitlements.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static EntitlementsReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Cipnb29nbGUvY2xvdWQvY2hhbm5lbC92MS9lbnRpdGxlbWVudHMucHJvdG8S",
"F2dvb2dsZS5jbG91ZC5jaGFubmVsLnYxGh9nb29nbGUvYXBpL2ZpZWxkX2Jl",
"aGF2aW9yLnByb3RvGhlnb29nbGUvYXBpL3Jlc291cmNlLnByb3RvGiRnb29n",
"bGUvY2xvdWQvY2hhbm5lbC92MS9jb21tb24ucHJvdG8aJGdvb2dsZS9jbG91",
"ZC9jaGFubmVsL3YxL29mZmVycy5wcm90bxomZ29vZ2xlL2Nsb3VkL2NoYW5u",
"ZWwvdjEvcHJvZHVjdHMucHJvdG8aH2dvb2dsZS9wcm90b2J1Zi90aW1lc3Rh",
"bXAucHJvdG8aHmdvb2dsZS9wcm90b2J1Zi93cmFwcGVycy5wcm90bxocZ29v",
"Z2xlL2FwaS9hbm5vdGF0aW9ucy5wcm90byLdCAoLRW50aXRsZW1lbnQSEQoE",
"bmFtZRgBIAEoCUID4EEDEjQKC2NyZWF0ZV90aW1lGAUgASgLMhouZ29vZ2xl",
"LnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEjQKC3VwZGF0ZV90aW1lGAYgASgL",
"MhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEID4EEDEjgKBW9mZmVyGAgg",
"ASgJQingQQL6QSMKIWNsb3VkY2hhbm5lbC5nb29nbGVhcGlzLmNvbS9PZmZl",
"chJIChNjb21taXRtZW50X3NldHRpbmdzGAwgASgLMisuZ29vZ2xlLmNsb3Vk",
"LmNoYW5uZWwudjEuQ29tbWl0bWVudFNldHRpbmdzElcKEnByb3Zpc2lvbmlu",
"Z19zdGF0ZRgNIAEoDjI2Lmdvb2dsZS5jbG91ZC5jaGFubmVsLnYxLkVudGl0",
"bGVtZW50LlByb3Zpc2lvbmluZ1N0YXRlQgPgQQMSTQoTcHJvdmlzaW9uZWRf",
"c2VydmljZRgQIAEoCzIrLmdvb2dsZS5jbG91ZC5jaGFubmVsLnYxLlByb3Zp",
"c2lvbmVkU2VydmljZUID4EEDElYKEnN1c3BlbnNpb25fcmVhc29ucxgSIAMo",
"DjI1Lmdvb2dsZS5jbG91ZC5jaGFubmVsLnYxLkVudGl0bGVtZW50LlN1c3Bl",
"bnNpb25SZWFzb25CA+BBAxIeChFwdXJjaGFzZV9vcmRlcl9pZBgTIAEoCUID",
"4EEBEkMKDnRyaWFsX3NldHRpbmdzGBUgASgLMiYuZ29vZ2xlLmNsb3VkLmNo",
"YW5uZWwudjEuVHJpYWxTZXR0aW5nc0ID4EEDEkIKEGFzc29jaWF0aW9uX2lu",
"Zm8YFyABKAsyKC5nb29nbGUuY2xvdWQuY2hhbm5lbC52MS5Bc3NvY2lhdGlv",
"bkluZm8SNgoKcGFyYW1ldGVycxgaIAMoCzIiLmdvb2dsZS5jbG91ZC5jaGFu",
"bmVsLnYxLlBhcmFtZXRlciJSChFQcm92aXNpb25pbmdTdGF0ZRIiCh5QUk9W",
"SVNJT05JTkdfU1RBVEVfVU5TUEVDSUZJRUQQABIKCgZBQ1RJVkUQARINCglT",
"VVNQRU5ERUQQBSKjAQoQU3VzcGVuc2lvblJlYXNvbhIhCh1TVVNQRU5TSU9O",
"X1JFQVNPTl9VTlNQRUNJRklFRBAAEhYKElJFU0VMTEVSX0lOSVRJQVRFRBAB",
"Eg8KC1RSSUFMX0VOREVEEAISHAoYUkVORVdBTF9XSVRIX1RZUEVfQ0FOQ0VM",
"EAMSGgoWUEVORElOR19UT1NfQUNDRVBUQU5DRRAEEgkKBU9USEVSEGQ6cOpB",
"bQonY2xvdWRjaGFubmVsLmdvb2dsZWFwaXMuY29tL0VudGl0bGVtZW50EkJh",
"Y2NvdW50cy97YWNjb3VudH0vY3VzdG9tZXJzL3tjdXN0b21lcn0vZW50aXRs",
"ZW1lbnRzL3tlbnRpdGxlbWVudH0iXwoJUGFyYW1ldGVyEgwKBG5hbWUYASAB",
"KAkSLQoFdmFsdWUYAiABKAsyHi5nb29nbGUuY2xvdWQuY2hhbm5lbC52MS5W",
"YWx1ZRIVCghlZGl0YWJsZRgDIAEoCEID4EEDIlkKD0Fzc29jaWF0aW9uSW5m",
"bxJGChBiYXNlX2VudGl0bGVtZW50GAEgASgJQiz6QSkKJ2Nsb3VkY2hhbm5l",
"bC5nb29nbGVhcGlzLmNvbS9FbnRpdGxlbWVudCJgChJQcm92aXNpb25lZFNl",
"cnZpY2USHAoPcHJvdmlzaW9uaW5nX2lkGAEgASgJQgPgQQMSFwoKcHJvZHVj",
"dF9pZBgCIAEoCUID4EEDEhMKBnNrdV9pZBgDIAEoCUID4EEDIsUBChJDb21t",
"aXRtZW50U2V0dGluZ3MSMwoKc3RhcnRfdGltZRgBIAEoCzIaLmdvb2dsZS5w",
"cm90b2J1Zi5UaW1lc3RhbXBCA+BBAxIxCghlbmRfdGltZRgCIAEoCzIaLmdv",
"b2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxJHChByZW5ld2FsX3NldHRp",
"bmdzGAQgASgLMiguZ29vZ2xlLmNsb3VkLmNoYW5uZWwudjEuUmVuZXdhbFNl",
"dHRpbmdzQgPgQQEiuAEKD1JlbmV3YWxTZXR0aW5ncxIWCg5lbmFibGVfcmVu",
"ZXdhbBgBIAEoCBIZChFyZXNpemVfdW5pdF9jb3VudBgCIAEoCBI6CgxwYXlt",
"ZW50X3BsYW4YBSABKA4yJC5nb29nbGUuY2xvdWQuY2hhbm5lbC52MS5QYXlt",
"ZW50UGxhbhI2Cg1wYXltZW50X2N5Y2xlGAYgASgLMh8uZ29vZ2xlLmNsb3Vk",
"LmNoYW5uZWwudjEuUGVyaW9kIkwKDVRyaWFsU2V0dGluZ3MSDQoFdHJpYWwY",
"ASABKAgSLAoIZW5kX3RpbWUYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGlt",
"ZXN0YW1wIr8BCg9UcmFuc2ZlcmFibGVTa3USSgoUdHJhbnNmZXJfZWxpZ2li",
"aWxpdHkYCSABKAsyLC5nb29nbGUuY2xvdWQuY2hhbm5lbC52MS5UcmFuc2Zl",
"ckVsaWdpYmlsaXR5EikKA3NrdRgLIAEoCzIcLmdvb2dsZS5jbG91ZC5jaGFu",
"bmVsLnYxLlNrdRI1CgpsZWdhY3lfc2t1GAwgASgLMhwuZ29vZ2xlLmNsb3Vk",
"LmNoYW5uZWwudjEuU2t1QgPgQQEi+QEKE1RyYW5zZmVyRWxpZ2liaWxpdHkS",
"EwoLaXNfZWxpZ2libGUYASABKAgSEwoLZGVzY3JpcHRpb24YAiABKAkSUQoU",
"aW5lbGlnaWJpbGl0eV9yZWFzb24YAyABKA4yMy5nb29nbGUuY2xvdWQuY2hh",
"bm5lbC52MS5UcmFuc2ZlckVsaWdpYmlsaXR5LlJlYXNvbiJlCgZSZWFzb24S",
"FgoSUkVBU09OX1VOU1BFQ0lGSUVEEAASGgoWUEVORElOR19UT1NfQUNDRVBU",
"QU5DRRABEhQKEFNLVV9OT1RfRUxJR0lCTEUQAhIRCg1TS1VfU1VTUEVOREVE",
"EANCcgobY29tLmdvb2dsZS5jbG91ZC5jaGFubmVsLnYxQhFFbnRpdGxlbWVu",
"dHNQcm90b1ABWj5nb29nbGUuZ29sYW5nLm9yZy9nZW5wcm90by9nb29nbGVh",
"cGlzL2Nsb3VkL2NoYW5uZWwvdjE7Y2hhbm5lbGIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Api.FieldBehaviorReflection.Descriptor, global::Google.Api.ResourceReflection.Descriptor, global::Google.Cloud.Channel.V1.CommonReflection.Descriptor, global::Google.Cloud.Channel.V1.OffersReflection.Descriptor, global::Google.Cloud.Channel.V1.ProductsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, global::Google.Api.AnnotationsReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Channel.V1.Entitlement), global::Google.Cloud.Channel.V1.Entitlement.Parser, new[]{ "Name", "CreateTime", "UpdateTime", "Offer", "CommitmentSettings", "ProvisioningState", "ProvisionedService", "SuspensionReasons", "PurchaseOrderId", "TrialSettings", "AssociationInfo", "Parameters" }, null, new[]{ typeof(global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState), typeof(global::Google.Cloud.Channel.V1.Entitlement.Types.SuspensionReason) }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Channel.V1.Parameter), global::Google.Cloud.Channel.V1.Parameter.Parser, new[]{ "Name", "Value", "Editable" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Channel.V1.AssociationInfo), global::Google.Cloud.Channel.V1.AssociationInfo.Parser, new[]{ "BaseEntitlement" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Channel.V1.ProvisionedService), global::Google.Cloud.Channel.V1.ProvisionedService.Parser, new[]{ "ProvisioningId", "ProductId", "SkuId" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Channel.V1.CommitmentSettings), global::Google.Cloud.Channel.V1.CommitmentSettings.Parser, new[]{ "StartTime", "EndTime", "RenewalSettings" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Channel.V1.RenewalSettings), global::Google.Cloud.Channel.V1.RenewalSettings.Parser, new[]{ "EnableRenewal", "ResizeUnitCount", "PaymentPlan", "PaymentCycle" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Channel.V1.TrialSettings), global::Google.Cloud.Channel.V1.TrialSettings.Parser, new[]{ "Trial", "EndTime" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Channel.V1.TransferableSku), global::Google.Cloud.Channel.V1.TransferableSku.Parser, new[]{ "TransferEligibility", "Sku", "LegacySku" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Channel.V1.TransferEligibility), global::Google.Cloud.Channel.V1.TransferEligibility.Parser, new[]{ "IsEligible", "Description", "IneligibilityReason" }, null, new[]{ typeof(global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason) }, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
/// An entitlement is a representation of a customer's ability to use a service.
/// </summary>
public sealed partial class Entitlement : pb::IMessage<Entitlement>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Entitlement> _parser = new pb::MessageParser<Entitlement>(() => new Entitlement());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Entitlement> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.Channel.V1.EntitlementsReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Entitlement() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Entitlement(Entitlement other) : this() {
name_ = other.name_;
createTime_ = other.createTime_ != null ? other.createTime_.Clone() : null;
updateTime_ = other.updateTime_ != null ? other.updateTime_.Clone() : null;
offer_ = other.offer_;
commitmentSettings_ = other.commitmentSettings_ != null ? other.commitmentSettings_.Clone() : null;
provisioningState_ = other.provisioningState_;
provisionedService_ = other.provisionedService_ != null ? other.provisionedService_.Clone() : null;
suspensionReasons_ = other.suspensionReasons_.Clone();
purchaseOrderId_ = other.purchaseOrderId_;
trialSettings_ = other.trialSettings_ != null ? other.trialSettings_.Clone() : null;
associationInfo_ = other.associationInfo_ != null ? other.associationInfo_.Clone() : null;
parameters_ = other.parameters_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Entitlement Clone() {
return new Entitlement(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// Output only. Resource name of an entitlement in the form:
/// accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "create_time" field.</summary>
public const int CreateTimeFieldNumber = 5;
private global::Google.Protobuf.WellKnownTypes.Timestamp createTime_;
/// <summary>
/// Output only. The time at which the entitlement is created.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Protobuf.WellKnownTypes.Timestamp CreateTime {
get { return createTime_; }
set {
createTime_ = value;
}
}
/// <summary>Field number for the "update_time" field.</summary>
public const int UpdateTimeFieldNumber = 6;
private global::Google.Protobuf.WellKnownTypes.Timestamp updateTime_;
/// <summary>
/// Output only. The time at which the entitlement is updated.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Protobuf.WellKnownTypes.Timestamp UpdateTime {
get { return updateTime_; }
set {
updateTime_ = value;
}
}
/// <summary>Field number for the "offer" field.</summary>
public const int OfferFieldNumber = 8;
private string offer_ = "";
/// <summary>
/// Required. The offer resource name for which the entitlement is to be
/// created. Takes the form: accounts/{account_id}/offers/{offer_id}.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Offer {
get { return offer_; }
set {
offer_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "commitment_settings" field.</summary>
public const int CommitmentSettingsFieldNumber = 12;
private global::Google.Cloud.Channel.V1.CommitmentSettings commitmentSettings_;
/// <summary>
/// Commitment settings for a commitment-based Offer.
/// Required for commitment based offers.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.CommitmentSettings CommitmentSettings {
get { return commitmentSettings_; }
set {
commitmentSettings_ = value;
}
}
/// <summary>Field number for the "provisioning_state" field.</summary>
public const int ProvisioningStateFieldNumber = 13;
private global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState provisioningState_ = global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState.Unspecified;
/// <summary>
/// Output only. Current provisioning state of the entitlement.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState ProvisioningState {
get { return provisioningState_; }
set {
provisioningState_ = value;
}
}
/// <summary>Field number for the "provisioned_service" field.</summary>
public const int ProvisionedServiceFieldNumber = 16;
private global::Google.Cloud.Channel.V1.ProvisionedService provisionedService_;
/// <summary>
/// Output only. Service provisioning details for the entitlement.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.ProvisionedService ProvisionedService {
get { return provisionedService_; }
set {
provisionedService_ = value;
}
}
/// <summary>Field number for the "suspension_reasons" field.</summary>
public const int SuspensionReasonsFieldNumber = 18;
private static readonly pb::FieldCodec<global::Google.Cloud.Channel.V1.Entitlement.Types.SuspensionReason> _repeated_suspensionReasons_codec
= pb::FieldCodec.ForEnum(146, x => (int) x, x => (global::Google.Cloud.Channel.V1.Entitlement.Types.SuspensionReason) x);
private readonly pbc::RepeatedField<global::Google.Cloud.Channel.V1.Entitlement.Types.SuspensionReason> suspensionReasons_ = new pbc::RepeatedField<global::Google.Cloud.Channel.V1.Entitlement.Types.SuspensionReason>();
/// <summary>
/// Output only. Enumerable of all current suspension reasons for an entitlement.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Google.Cloud.Channel.V1.Entitlement.Types.SuspensionReason> SuspensionReasons {
get { return suspensionReasons_; }
}
/// <summary>Field number for the "purchase_order_id" field.</summary>
public const int PurchaseOrderIdFieldNumber = 19;
private string purchaseOrderId_ = "";
/// <summary>
/// Optional. This purchase order (PO) information is for resellers to use for their
/// company tracking usage. If a purchaseOrderId value is given, it appears in
/// the API responses and shows up in the invoice. The property accepts up to
/// 80 plain text characters.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string PurchaseOrderId {
get { return purchaseOrderId_; }
set {
purchaseOrderId_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "trial_settings" field.</summary>
public const int TrialSettingsFieldNumber = 21;
private global::Google.Cloud.Channel.V1.TrialSettings trialSettings_;
/// <summary>
/// Output only. Settings for trial offers.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.TrialSettings TrialSettings {
get { return trialSettings_; }
set {
trialSettings_ = value;
}
}
/// <summary>Field number for the "association_info" field.</summary>
public const int AssociationInfoFieldNumber = 23;
private global::Google.Cloud.Channel.V1.AssociationInfo associationInfo_;
/// <summary>
/// Association information to other entitlements.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.AssociationInfo AssociationInfo {
get { return associationInfo_; }
set {
associationInfo_ = value;
}
}
/// <summary>Field number for the "parameters" field.</summary>
public const int ParametersFieldNumber = 26;
private static readonly pb::FieldCodec<global::Google.Cloud.Channel.V1.Parameter> _repeated_parameters_codec
= pb::FieldCodec.ForMessage(210, global::Google.Cloud.Channel.V1.Parameter.Parser);
private readonly pbc::RepeatedField<global::Google.Cloud.Channel.V1.Parameter> parameters_ = new pbc::RepeatedField<global::Google.Cloud.Channel.V1.Parameter>();
/// <summary>
/// Extended entitlement parameters. When creating an entitlement, valid
/// parameters' names and values are defined in the offer's parameter
/// definitions.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Google.Cloud.Channel.V1.Parameter> Parameters {
get { return parameters_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as Entitlement);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(Entitlement other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (!object.Equals(CreateTime, other.CreateTime)) return false;
if (!object.Equals(UpdateTime, other.UpdateTime)) return false;
if (Offer != other.Offer) return false;
if (!object.Equals(CommitmentSettings, other.CommitmentSettings)) return false;
if (ProvisioningState != other.ProvisioningState) return false;
if (!object.Equals(ProvisionedService, other.ProvisionedService)) return false;
if(!suspensionReasons_.Equals(other.suspensionReasons_)) return false;
if (PurchaseOrderId != other.PurchaseOrderId) return false;
if (!object.Equals(TrialSettings, other.TrialSettings)) return false;
if (!object.Equals(AssociationInfo, other.AssociationInfo)) return false;
if(!parameters_.Equals(other.parameters_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (createTime_ != null) hash ^= CreateTime.GetHashCode();
if (updateTime_ != null) hash ^= UpdateTime.GetHashCode();
if (Offer.Length != 0) hash ^= Offer.GetHashCode();
if (commitmentSettings_ != null) hash ^= CommitmentSettings.GetHashCode();
if (ProvisioningState != global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState.Unspecified) hash ^= ProvisioningState.GetHashCode();
if (provisionedService_ != null) hash ^= ProvisionedService.GetHashCode();
hash ^= suspensionReasons_.GetHashCode();
if (PurchaseOrderId.Length != 0) hash ^= PurchaseOrderId.GetHashCode();
if (trialSettings_ != null) hash ^= TrialSettings.GetHashCode();
if (associationInfo_ != null) hash ^= AssociationInfo.GetHashCode();
hash ^= parameters_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (createTime_ != null) {
output.WriteRawTag(42);
output.WriteMessage(CreateTime);
}
if (updateTime_ != null) {
output.WriteRawTag(50);
output.WriteMessage(UpdateTime);
}
if (Offer.Length != 0) {
output.WriteRawTag(66);
output.WriteString(Offer);
}
if (commitmentSettings_ != null) {
output.WriteRawTag(98);
output.WriteMessage(CommitmentSettings);
}
if (ProvisioningState != global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState.Unspecified) {
output.WriteRawTag(104);
output.WriteEnum((int) ProvisioningState);
}
if (provisionedService_ != null) {
output.WriteRawTag(130, 1);
output.WriteMessage(ProvisionedService);
}
suspensionReasons_.WriteTo(output, _repeated_suspensionReasons_codec);
if (PurchaseOrderId.Length != 0) {
output.WriteRawTag(154, 1);
output.WriteString(PurchaseOrderId);
}
if (trialSettings_ != null) {
output.WriteRawTag(170, 1);
output.WriteMessage(TrialSettings);
}
if (associationInfo_ != null) {
output.WriteRawTag(186, 1);
output.WriteMessage(AssociationInfo);
}
parameters_.WriteTo(output, _repeated_parameters_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (createTime_ != null) {
output.WriteRawTag(42);
output.WriteMessage(CreateTime);
}
if (updateTime_ != null) {
output.WriteRawTag(50);
output.WriteMessage(UpdateTime);
}
if (Offer.Length != 0) {
output.WriteRawTag(66);
output.WriteString(Offer);
}
if (commitmentSettings_ != null) {
output.WriteRawTag(98);
output.WriteMessage(CommitmentSettings);
}
if (ProvisioningState != global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState.Unspecified) {
output.WriteRawTag(104);
output.WriteEnum((int) ProvisioningState);
}
if (provisionedService_ != null) {
output.WriteRawTag(130, 1);
output.WriteMessage(ProvisionedService);
}
suspensionReasons_.WriteTo(ref output, _repeated_suspensionReasons_codec);
if (PurchaseOrderId.Length != 0) {
output.WriteRawTag(154, 1);
output.WriteString(PurchaseOrderId);
}
if (trialSettings_ != null) {
output.WriteRawTag(170, 1);
output.WriteMessage(TrialSettings);
}
if (associationInfo_ != null) {
output.WriteRawTag(186, 1);
output.WriteMessage(AssociationInfo);
}
parameters_.WriteTo(ref output, _repeated_parameters_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (createTime_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(CreateTime);
}
if (updateTime_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(UpdateTime);
}
if (Offer.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Offer);
}
if (commitmentSettings_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(CommitmentSettings);
}
if (ProvisioningState != global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState.Unspecified) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ProvisioningState);
}
if (provisionedService_ != null) {
size += 2 + pb::CodedOutputStream.ComputeMessageSize(ProvisionedService);
}
size += suspensionReasons_.CalculateSize(_repeated_suspensionReasons_codec);
if (PurchaseOrderId.Length != 0) {
size += 2 + pb::CodedOutputStream.ComputeStringSize(PurchaseOrderId);
}
if (trialSettings_ != null) {
size += 2 + pb::CodedOutputStream.ComputeMessageSize(TrialSettings);
}
if (associationInfo_ != null) {
size += 2 + pb::CodedOutputStream.ComputeMessageSize(AssociationInfo);
}
size += parameters_.CalculateSize(_repeated_parameters_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(Entitlement other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.createTime_ != null) {
if (createTime_ == null) {
CreateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
CreateTime.MergeFrom(other.CreateTime);
}
if (other.updateTime_ != null) {
if (updateTime_ == null) {
UpdateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
UpdateTime.MergeFrom(other.UpdateTime);
}
if (other.Offer.Length != 0) {
Offer = other.Offer;
}
if (other.commitmentSettings_ != null) {
if (commitmentSettings_ == null) {
CommitmentSettings = new global::Google.Cloud.Channel.V1.CommitmentSettings();
}
CommitmentSettings.MergeFrom(other.CommitmentSettings);
}
if (other.ProvisioningState != global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState.Unspecified) {
ProvisioningState = other.ProvisioningState;
}
if (other.provisionedService_ != null) {
if (provisionedService_ == null) {
ProvisionedService = new global::Google.Cloud.Channel.V1.ProvisionedService();
}
ProvisionedService.MergeFrom(other.ProvisionedService);
}
suspensionReasons_.Add(other.suspensionReasons_);
if (other.PurchaseOrderId.Length != 0) {
PurchaseOrderId = other.PurchaseOrderId;
}
if (other.trialSettings_ != null) {
if (trialSettings_ == null) {
TrialSettings = new global::Google.Cloud.Channel.V1.TrialSettings();
}
TrialSettings.MergeFrom(other.TrialSettings);
}
if (other.associationInfo_ != null) {
if (associationInfo_ == null) {
AssociationInfo = new global::Google.Cloud.Channel.V1.AssociationInfo();
}
AssociationInfo.MergeFrom(other.AssociationInfo);
}
parameters_.Add(other.parameters_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 42: {
if (createTime_ == null) {
CreateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(CreateTime);
break;
}
case 50: {
if (updateTime_ == null) {
UpdateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(UpdateTime);
break;
}
case 66: {
Offer = input.ReadString();
break;
}
case 98: {
if (commitmentSettings_ == null) {
CommitmentSettings = new global::Google.Cloud.Channel.V1.CommitmentSettings();
}
input.ReadMessage(CommitmentSettings);
break;
}
case 104: {
ProvisioningState = (global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState) input.ReadEnum();
break;
}
case 130: {
if (provisionedService_ == null) {
ProvisionedService = new global::Google.Cloud.Channel.V1.ProvisionedService();
}
input.ReadMessage(ProvisionedService);
break;
}
case 146:
case 144: {
suspensionReasons_.AddEntriesFrom(input, _repeated_suspensionReasons_codec);
break;
}
case 154: {
PurchaseOrderId = input.ReadString();
break;
}
case 170: {
if (trialSettings_ == null) {
TrialSettings = new global::Google.Cloud.Channel.V1.TrialSettings();
}
input.ReadMessage(TrialSettings);
break;
}
case 186: {
if (associationInfo_ == null) {
AssociationInfo = new global::Google.Cloud.Channel.V1.AssociationInfo();
}
input.ReadMessage(AssociationInfo);
break;
}
case 210: {
parameters_.AddEntriesFrom(input, _repeated_parameters_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 42: {
if (createTime_ == null) {
CreateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(CreateTime);
break;
}
case 50: {
if (updateTime_ == null) {
UpdateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(UpdateTime);
break;
}
case 66: {
Offer = input.ReadString();
break;
}
case 98: {
if (commitmentSettings_ == null) {
CommitmentSettings = new global::Google.Cloud.Channel.V1.CommitmentSettings();
}
input.ReadMessage(CommitmentSettings);
break;
}
case 104: {
ProvisioningState = (global::Google.Cloud.Channel.V1.Entitlement.Types.ProvisioningState) input.ReadEnum();
break;
}
case 130: {
if (provisionedService_ == null) {
ProvisionedService = new global::Google.Cloud.Channel.V1.ProvisionedService();
}
input.ReadMessage(ProvisionedService);
break;
}
case 146:
case 144: {
suspensionReasons_.AddEntriesFrom(ref input, _repeated_suspensionReasons_codec);
break;
}
case 154: {
PurchaseOrderId = input.ReadString();
break;
}
case 170: {
if (trialSettings_ == null) {
TrialSettings = new global::Google.Cloud.Channel.V1.TrialSettings();
}
input.ReadMessage(TrialSettings);
break;
}
case 186: {
if (associationInfo_ == null) {
AssociationInfo = new global::Google.Cloud.Channel.V1.AssociationInfo();
}
input.ReadMessage(AssociationInfo);
break;
}
case 210: {
parameters_.AddEntriesFrom(ref input, _repeated_parameters_codec);
break;
}
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the Entitlement message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
/// <summary>
/// Indicates the current provisioning state of the entitlement.
/// </summary>
public enum ProvisioningState {
/// <summary>
/// Default value. This state doesn't show unless an error occurs.
/// </summary>
[pbr::OriginalName("PROVISIONING_STATE_UNSPECIFIED")] Unspecified = 0,
/// <summary>
/// The entitlement is currently active.
/// </summary>
[pbr::OriginalName("ACTIVE")] Active = 1,
/// <summary>
/// The entitlement is currently suspended.
/// </summary>
[pbr::OriginalName("SUSPENDED")] Suspended = 5,
}
/// <summary>
/// Suspension reason for an entitlement if [provisioning_state][google.cloud.channel.v1.Entitlement.provisioning_state] = SUSPENDED.
/// </summary>
public enum SuspensionReason {
/// <summary>
/// Default value. This state doesn't show unless an error occurs.
/// </summary>
[pbr::OriginalName("SUSPENSION_REASON_UNSPECIFIED")] Unspecified = 0,
/// <summary>
/// Entitlement was manually suspended by the Reseller.
/// </summary>
[pbr::OriginalName("RESELLER_INITIATED")] ResellerInitiated = 1,
/// <summary>
/// Trial ended.
/// </summary>
[pbr::OriginalName("TRIAL_ENDED")] TrialEnded = 2,
/// <summary>
/// Entitlement renewal was canceled.
/// </summary>
[pbr::OriginalName("RENEWAL_WITH_TYPE_CANCEL")] RenewalWithTypeCancel = 3,
/// <summary>
/// Entitlement was automatically suspended on creation for pending ToS
/// acceptance on customer.
/// </summary>
[pbr::OriginalName("PENDING_TOS_ACCEPTANCE")] PendingTosAcceptance = 4,
/// <summary>
/// Other reasons (internal reasons, abuse, etc.).
/// </summary>
[pbr::OriginalName("OTHER")] Other = 100,
}
}
#endregion
}
/// <summary>
/// Definition for extended entitlement parameters.
/// </summary>
public sealed partial class Parameter : pb::IMessage<Parameter>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Parameter> _parser = new pb::MessageParser<Parameter>(() => new Parameter());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Parameter> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.Channel.V1.EntitlementsReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Parameter() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Parameter(Parameter other) : this() {
name_ = other.name_;
value_ = other.value_ != null ? other.value_.Clone() : null;
editable_ = other.editable_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Parameter Clone() {
return new Parameter(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// Name of the parameter.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "value" field.</summary>
public const int ValueFieldNumber = 2;
private global::Google.Cloud.Channel.V1.Value value_;
/// <summary>
/// Value of the parameter.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.Value Value {
get { return value_; }
set {
value_ = value;
}
}
/// <summary>Field number for the "editable" field.</summary>
public const int EditableFieldNumber = 3;
private bool editable_;
/// <summary>
/// Output only. Specifies whether this parameter is allowed to be changed. For example, for
/// a Google Workspace Business Starter entitlement in commitment plan,
/// num_units is editable when entitlement is active.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Editable {
get { return editable_; }
set {
editable_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as Parameter);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(Parameter other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (!object.Equals(Value, other.Value)) return false;
if (Editable != other.Editable) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (value_ != null) hash ^= Value.GetHashCode();
if (Editable != false) hash ^= Editable.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (value_ != null) {
output.WriteRawTag(18);
output.WriteMessage(Value);
}
if (Editable != false) {
output.WriteRawTag(24);
output.WriteBool(Editable);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (value_ != null) {
output.WriteRawTag(18);
output.WriteMessage(Value);
}
if (Editable != false) {
output.WriteRawTag(24);
output.WriteBool(Editable);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (value_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Value);
}
if (Editable != false) {
size += 1 + 1;
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(Parameter other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.value_ != null) {
if (value_ == null) {
Value = new global::Google.Cloud.Channel.V1.Value();
}
Value.MergeFrom(other.Value);
}
if (other.Editable != false) {
Editable = other.Editable;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
if (value_ == null) {
Value = new global::Google.Cloud.Channel.V1.Value();
}
input.ReadMessage(Value);
break;
}
case 24: {
Editable = input.ReadBool();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
if (value_ == null) {
Value = new global::Google.Cloud.Channel.V1.Value();
}
input.ReadMessage(Value);
break;
}
case 24: {
Editable = input.ReadBool();
break;
}
}
}
}
#endif
}
/// <summary>
/// Association links that an entitlement has to other entitlements.
/// </summary>
public sealed partial class AssociationInfo : pb::IMessage<AssociationInfo>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<AssociationInfo> _parser = new pb::MessageParser<AssociationInfo>(() => new AssociationInfo());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<AssociationInfo> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.Channel.V1.EntitlementsReflection.Descriptor.MessageTypes[2]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AssociationInfo() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AssociationInfo(AssociationInfo other) : this() {
baseEntitlement_ = other.baseEntitlement_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public AssociationInfo Clone() {
return new AssociationInfo(this);
}
/// <summary>Field number for the "base_entitlement" field.</summary>
public const int BaseEntitlementFieldNumber = 1;
private string baseEntitlement_ = "";
/// <summary>
/// The name of the base entitlement, for which this entitlement is an add-on.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string BaseEntitlement {
get { return baseEntitlement_; }
set {
baseEntitlement_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as AssociationInfo);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(AssociationInfo other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (BaseEntitlement != other.BaseEntitlement) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (BaseEntitlement.Length != 0) hash ^= BaseEntitlement.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (BaseEntitlement.Length != 0) {
output.WriteRawTag(10);
output.WriteString(BaseEntitlement);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (BaseEntitlement.Length != 0) {
output.WriteRawTag(10);
output.WriteString(BaseEntitlement);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (BaseEntitlement.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(BaseEntitlement);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(AssociationInfo other) {
if (other == null) {
return;
}
if (other.BaseEntitlement.Length != 0) {
BaseEntitlement = other.BaseEntitlement;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
BaseEntitlement = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
BaseEntitlement = input.ReadString();
break;
}
}
}
}
#endif
}
/// <summary>
/// Service provisioned for an entitlement.
/// </summary>
public sealed partial class ProvisionedService : pb::IMessage<ProvisionedService>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<ProvisionedService> _parser = new pb::MessageParser<ProvisionedService>(() => new ProvisionedService());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<ProvisionedService> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.Channel.V1.EntitlementsReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ProvisionedService() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ProvisionedService(ProvisionedService other) : this() {
provisioningId_ = other.provisioningId_;
productId_ = other.productId_;
skuId_ = other.skuId_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ProvisionedService Clone() {
return new ProvisionedService(this);
}
/// <summary>Field number for the "provisioning_id" field.</summary>
public const int ProvisioningIdFieldNumber = 1;
private string provisioningId_ = "";
/// <summary>
/// Output only. Provisioning ID of the entitlement. For Google Workspace, this would be the
/// underlying Subscription ID.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string ProvisioningId {
get { return provisioningId_; }
set {
provisioningId_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "product_id" field.</summary>
public const int ProductIdFieldNumber = 2;
private string productId_ = "";
/// <summary>
/// Output only. The product pertaining to the provisioning resource as specified in the
/// Offer.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string ProductId {
get { return productId_; }
set {
productId_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "sku_id" field.</summary>
public const int SkuIdFieldNumber = 3;
private string skuId_ = "";
/// <summary>
/// Output only. The SKU pertaining to the provisioning resource as specified in the Offer.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string SkuId {
get { return skuId_; }
set {
skuId_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as ProvisionedService);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(ProvisionedService other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (ProvisioningId != other.ProvisioningId) return false;
if (ProductId != other.ProductId) return false;
if (SkuId != other.SkuId) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (ProvisioningId.Length != 0) hash ^= ProvisioningId.GetHashCode();
if (ProductId.Length != 0) hash ^= ProductId.GetHashCode();
if (SkuId.Length != 0) hash ^= SkuId.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (ProvisioningId.Length != 0) {
output.WriteRawTag(10);
output.WriteString(ProvisioningId);
}
if (ProductId.Length != 0) {
output.WriteRawTag(18);
output.WriteString(ProductId);
}
if (SkuId.Length != 0) {
output.WriteRawTag(26);
output.WriteString(SkuId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (ProvisioningId.Length != 0) {
output.WriteRawTag(10);
output.WriteString(ProvisioningId);
}
if (ProductId.Length != 0) {
output.WriteRawTag(18);
output.WriteString(ProductId);
}
if (SkuId.Length != 0) {
output.WriteRawTag(26);
output.WriteString(SkuId);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (ProvisioningId.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ProvisioningId);
}
if (ProductId.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ProductId);
}
if (SkuId.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(SkuId);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(ProvisionedService other) {
if (other == null) {
return;
}
if (other.ProvisioningId.Length != 0) {
ProvisioningId = other.ProvisioningId;
}
if (other.ProductId.Length != 0) {
ProductId = other.ProductId;
}
if (other.SkuId.Length != 0) {
SkuId = other.SkuId;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
ProvisioningId = input.ReadString();
break;
}
case 18: {
ProductId = input.ReadString();
break;
}
case 26: {
SkuId = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
ProvisioningId = input.ReadString();
break;
}
case 18: {
ProductId = input.ReadString();
break;
}
case 26: {
SkuId = input.ReadString();
break;
}
}
}
}
#endif
}
/// <summary>
/// Commitment settings for commitment-based offers.
/// </summary>
public sealed partial class CommitmentSettings : pb::IMessage<CommitmentSettings>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<CommitmentSettings> _parser = new pb::MessageParser<CommitmentSettings>(() => new CommitmentSettings());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<CommitmentSettings> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.Channel.V1.EntitlementsReflection.Descriptor.MessageTypes[4]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public CommitmentSettings() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public CommitmentSettings(CommitmentSettings other) : this() {
startTime_ = other.startTime_ != null ? other.startTime_.Clone() : null;
endTime_ = other.endTime_ != null ? other.endTime_.Clone() : null;
renewalSettings_ = other.renewalSettings_ != null ? other.renewalSettings_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public CommitmentSettings Clone() {
return new CommitmentSettings(this);
}
/// <summary>Field number for the "start_time" field.</summary>
public const int StartTimeFieldNumber = 1;
private global::Google.Protobuf.WellKnownTypes.Timestamp startTime_;
/// <summary>
/// Output only. Commitment start timestamp.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Protobuf.WellKnownTypes.Timestamp StartTime {
get { return startTime_; }
set {
startTime_ = value;
}
}
/// <summary>Field number for the "end_time" field.</summary>
public const int EndTimeFieldNumber = 2;
private global::Google.Protobuf.WellKnownTypes.Timestamp endTime_;
/// <summary>
/// Output only. Commitment end timestamp.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Protobuf.WellKnownTypes.Timestamp EndTime {
get { return endTime_; }
set {
endTime_ = value;
}
}
/// <summary>Field number for the "renewal_settings" field.</summary>
public const int RenewalSettingsFieldNumber = 4;
private global::Google.Cloud.Channel.V1.RenewalSettings renewalSettings_;
/// <summary>
/// Optional. Renewal settings applicable for a commitment-based Offer.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.RenewalSettings RenewalSettings {
get { return renewalSettings_; }
set {
renewalSettings_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as CommitmentSettings);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(CommitmentSettings other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!object.Equals(StartTime, other.StartTime)) return false;
if (!object.Equals(EndTime, other.EndTime)) return false;
if (!object.Equals(RenewalSettings, other.RenewalSettings)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (startTime_ != null) hash ^= StartTime.GetHashCode();
if (endTime_ != null) hash ^= EndTime.GetHashCode();
if (renewalSettings_ != null) hash ^= RenewalSettings.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (startTime_ != null) {
output.WriteRawTag(10);
output.WriteMessage(StartTime);
}
if (endTime_ != null) {
output.WriteRawTag(18);
output.WriteMessage(EndTime);
}
if (renewalSettings_ != null) {
output.WriteRawTag(34);
output.WriteMessage(RenewalSettings);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (startTime_ != null) {
output.WriteRawTag(10);
output.WriteMessage(StartTime);
}
if (endTime_ != null) {
output.WriteRawTag(18);
output.WriteMessage(EndTime);
}
if (renewalSettings_ != null) {
output.WriteRawTag(34);
output.WriteMessage(RenewalSettings);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (startTime_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(StartTime);
}
if (endTime_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(EndTime);
}
if (renewalSettings_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(RenewalSettings);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(CommitmentSettings other) {
if (other == null) {
return;
}
if (other.startTime_ != null) {
if (startTime_ == null) {
StartTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
StartTime.MergeFrom(other.StartTime);
}
if (other.endTime_ != null) {
if (endTime_ == null) {
EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
EndTime.MergeFrom(other.EndTime);
}
if (other.renewalSettings_ != null) {
if (renewalSettings_ == null) {
RenewalSettings = new global::Google.Cloud.Channel.V1.RenewalSettings();
}
RenewalSettings.MergeFrom(other.RenewalSettings);
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
if (startTime_ == null) {
StartTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(StartTime);
break;
}
case 18: {
if (endTime_ == null) {
EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(EndTime);
break;
}
case 34: {
if (renewalSettings_ == null) {
RenewalSettings = new global::Google.Cloud.Channel.V1.RenewalSettings();
}
input.ReadMessage(RenewalSettings);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
if (startTime_ == null) {
StartTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(StartTime);
break;
}
case 18: {
if (endTime_ == null) {
EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(EndTime);
break;
}
case 34: {
if (renewalSettings_ == null) {
RenewalSettings = new global::Google.Cloud.Channel.V1.RenewalSettings();
}
input.ReadMessage(RenewalSettings);
break;
}
}
}
}
#endif
}
/// <summary>
/// Renewal settings for renewable Offers.
/// </summary>
public sealed partial class RenewalSettings : pb::IMessage<RenewalSettings>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<RenewalSettings> _parser = new pb::MessageParser<RenewalSettings>(() => new RenewalSettings());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<RenewalSettings> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.Channel.V1.EntitlementsReflection.Descriptor.MessageTypes[5]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public RenewalSettings() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public RenewalSettings(RenewalSettings other) : this() {
enableRenewal_ = other.enableRenewal_;
resizeUnitCount_ = other.resizeUnitCount_;
paymentPlan_ = other.paymentPlan_;
paymentCycle_ = other.paymentCycle_ != null ? other.paymentCycle_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public RenewalSettings Clone() {
return new RenewalSettings(this);
}
/// <summary>Field number for the "enable_renewal" field.</summary>
public const int EnableRenewalFieldNumber = 1;
private bool enableRenewal_;
/// <summary>
/// If false, the plan will be completed at the end date.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool EnableRenewal {
get { return enableRenewal_; }
set {
enableRenewal_ = value;
}
}
/// <summary>Field number for the "resize_unit_count" field.</summary>
public const int ResizeUnitCountFieldNumber = 2;
private bool resizeUnitCount_;
/// <summary>
/// If true and enable_renewal = true, the unit (for example seats or licenses)
/// will be set to the number of active units at renewal time.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool ResizeUnitCount {
get { return resizeUnitCount_; }
set {
resizeUnitCount_ = value;
}
}
/// <summary>Field number for the "payment_plan" field.</summary>
public const int PaymentPlanFieldNumber = 5;
private global::Google.Cloud.Channel.V1.PaymentPlan paymentPlan_ = global::Google.Cloud.Channel.V1.PaymentPlan.Unspecified;
/// <summary>
/// Describes how a reseller will be billed.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.PaymentPlan PaymentPlan {
get { return paymentPlan_; }
set {
paymentPlan_ = value;
}
}
/// <summary>Field number for the "payment_cycle" field.</summary>
public const int PaymentCycleFieldNumber = 6;
private global::Google.Cloud.Channel.V1.Period paymentCycle_;
/// <summary>
/// Describes how frequently the reseller will be billed, such as
/// once per month.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.Period PaymentCycle {
get { return paymentCycle_; }
set {
paymentCycle_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as RenewalSettings);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(RenewalSettings other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (EnableRenewal != other.EnableRenewal) return false;
if (ResizeUnitCount != other.ResizeUnitCount) return false;
if (PaymentPlan != other.PaymentPlan) return false;
if (!object.Equals(PaymentCycle, other.PaymentCycle)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (EnableRenewal != false) hash ^= EnableRenewal.GetHashCode();
if (ResizeUnitCount != false) hash ^= ResizeUnitCount.GetHashCode();
if (PaymentPlan != global::Google.Cloud.Channel.V1.PaymentPlan.Unspecified) hash ^= PaymentPlan.GetHashCode();
if (paymentCycle_ != null) hash ^= PaymentCycle.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (EnableRenewal != false) {
output.WriteRawTag(8);
output.WriteBool(EnableRenewal);
}
if (ResizeUnitCount != false) {
output.WriteRawTag(16);
output.WriteBool(ResizeUnitCount);
}
if (PaymentPlan != global::Google.Cloud.Channel.V1.PaymentPlan.Unspecified) {
output.WriteRawTag(40);
output.WriteEnum((int) PaymentPlan);
}
if (paymentCycle_ != null) {
output.WriteRawTag(50);
output.WriteMessage(PaymentCycle);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (EnableRenewal != false) {
output.WriteRawTag(8);
output.WriteBool(EnableRenewal);
}
if (ResizeUnitCount != false) {
output.WriteRawTag(16);
output.WriteBool(ResizeUnitCount);
}
if (PaymentPlan != global::Google.Cloud.Channel.V1.PaymentPlan.Unspecified) {
output.WriteRawTag(40);
output.WriteEnum((int) PaymentPlan);
}
if (paymentCycle_ != null) {
output.WriteRawTag(50);
output.WriteMessage(PaymentCycle);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (EnableRenewal != false) {
size += 1 + 1;
}
if (ResizeUnitCount != false) {
size += 1 + 1;
}
if (PaymentPlan != global::Google.Cloud.Channel.V1.PaymentPlan.Unspecified) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) PaymentPlan);
}
if (paymentCycle_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(PaymentCycle);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(RenewalSettings other) {
if (other == null) {
return;
}
if (other.EnableRenewal != false) {
EnableRenewal = other.EnableRenewal;
}
if (other.ResizeUnitCount != false) {
ResizeUnitCount = other.ResizeUnitCount;
}
if (other.PaymentPlan != global::Google.Cloud.Channel.V1.PaymentPlan.Unspecified) {
PaymentPlan = other.PaymentPlan;
}
if (other.paymentCycle_ != null) {
if (paymentCycle_ == null) {
PaymentCycle = new global::Google.Cloud.Channel.V1.Period();
}
PaymentCycle.MergeFrom(other.PaymentCycle);
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
EnableRenewal = input.ReadBool();
break;
}
case 16: {
ResizeUnitCount = input.ReadBool();
break;
}
case 40: {
PaymentPlan = (global::Google.Cloud.Channel.V1.PaymentPlan) input.ReadEnum();
break;
}
case 50: {
if (paymentCycle_ == null) {
PaymentCycle = new global::Google.Cloud.Channel.V1.Period();
}
input.ReadMessage(PaymentCycle);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
EnableRenewal = input.ReadBool();
break;
}
case 16: {
ResizeUnitCount = input.ReadBool();
break;
}
case 40: {
PaymentPlan = (global::Google.Cloud.Channel.V1.PaymentPlan) input.ReadEnum();
break;
}
case 50: {
if (paymentCycle_ == null) {
PaymentCycle = new global::Google.Cloud.Channel.V1.Period();
}
input.ReadMessage(PaymentCycle);
break;
}
}
}
}
#endif
}
/// <summary>
/// Settings for trial offers.
/// </summary>
public sealed partial class TrialSettings : pb::IMessage<TrialSettings>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TrialSettings> _parser = new pb::MessageParser<TrialSettings>(() => new TrialSettings());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<TrialSettings> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.Channel.V1.EntitlementsReflection.Descriptor.MessageTypes[6]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TrialSettings() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TrialSettings(TrialSettings other) : this() {
trial_ = other.trial_;
endTime_ = other.endTime_ != null ? other.endTime_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TrialSettings Clone() {
return new TrialSettings(this);
}
/// <summary>Field number for the "trial" field.</summary>
public const int TrialFieldNumber = 1;
private bool trial_;
/// <summary>
/// Determines if the entitlement is in a trial or not:
///
/// * `true` - The entitlement is in trial.
/// * `false` - The entitlement is not in trial.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Trial {
get { return trial_; }
set {
trial_ = value;
}
}
/// <summary>Field number for the "end_time" field.</summary>
public const int EndTimeFieldNumber = 2;
private global::Google.Protobuf.WellKnownTypes.Timestamp endTime_;
/// <summary>
/// Date when the trial ends. The value is in milliseconds
/// using the UNIX Epoch format. See an example [Epoch
/// converter](https://www.epochconverter.com).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Protobuf.WellKnownTypes.Timestamp EndTime {
get { return endTime_; }
set {
endTime_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as TrialSettings);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(TrialSettings other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Trial != other.Trial) return false;
if (!object.Equals(EndTime, other.EndTime)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Trial != false) hash ^= Trial.GetHashCode();
if (endTime_ != null) hash ^= EndTime.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Trial != false) {
output.WriteRawTag(8);
output.WriteBool(Trial);
}
if (endTime_ != null) {
output.WriteRawTag(18);
output.WriteMessage(EndTime);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Trial != false) {
output.WriteRawTag(8);
output.WriteBool(Trial);
}
if (endTime_ != null) {
output.WriteRawTag(18);
output.WriteMessage(EndTime);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Trial != false) {
size += 1 + 1;
}
if (endTime_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(EndTime);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(TrialSettings other) {
if (other == null) {
return;
}
if (other.Trial != false) {
Trial = other.Trial;
}
if (other.endTime_ != null) {
if (endTime_ == null) {
EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
EndTime.MergeFrom(other.EndTime);
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Trial = input.ReadBool();
break;
}
case 18: {
if (endTime_ == null) {
EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(EndTime);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
Trial = input.ReadBool();
break;
}
case 18: {
if (endTime_ == null) {
EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp();
}
input.ReadMessage(EndTime);
break;
}
}
}
}
#endif
}
/// <summary>
/// TransferableSku represents information a reseller needs to view existing
/// provisioned services for a customer that they do not own.
/// Read-only.
/// </summary>
public sealed partial class TransferableSku : pb::IMessage<TransferableSku>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TransferableSku> _parser = new pb::MessageParser<TransferableSku>(() => new TransferableSku());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<TransferableSku> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.Channel.V1.EntitlementsReflection.Descriptor.MessageTypes[7]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TransferableSku() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TransferableSku(TransferableSku other) : this() {
transferEligibility_ = other.transferEligibility_ != null ? other.transferEligibility_.Clone() : null;
sku_ = other.sku_ != null ? other.sku_.Clone() : null;
legacySku_ = other.legacySku_ != null ? other.legacySku_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TransferableSku Clone() {
return new TransferableSku(this);
}
/// <summary>Field number for the "transfer_eligibility" field.</summary>
public const int TransferEligibilityFieldNumber = 9;
private global::Google.Cloud.Channel.V1.TransferEligibility transferEligibility_;
/// <summary>
/// Describes the transfer eligibility of a SKU.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.TransferEligibility TransferEligibility {
get { return transferEligibility_; }
set {
transferEligibility_ = value;
}
}
/// <summary>Field number for the "sku" field.</summary>
public const int SkuFieldNumber = 11;
private global::Google.Cloud.Channel.V1.Sku sku_;
/// <summary>
/// The SKU pertaining to the provisioning resource as specified in the Offer.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.Sku Sku {
get { return sku_; }
set {
sku_ = value;
}
}
/// <summary>Field number for the "legacy_sku" field.</summary>
public const int LegacySkuFieldNumber = 12;
private global::Google.Cloud.Channel.V1.Sku legacySku_;
/// <summary>
/// Optional. The customer to transfer has an entitlement with the populated legacy SKU.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.Sku LegacySku {
get { return legacySku_; }
set {
legacySku_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as TransferableSku);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(TransferableSku other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!object.Equals(TransferEligibility, other.TransferEligibility)) return false;
if (!object.Equals(Sku, other.Sku)) return false;
if (!object.Equals(LegacySku, other.LegacySku)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (transferEligibility_ != null) hash ^= TransferEligibility.GetHashCode();
if (sku_ != null) hash ^= Sku.GetHashCode();
if (legacySku_ != null) hash ^= LegacySku.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (transferEligibility_ != null) {
output.WriteRawTag(74);
output.WriteMessage(TransferEligibility);
}
if (sku_ != null) {
output.WriteRawTag(90);
output.WriteMessage(Sku);
}
if (legacySku_ != null) {
output.WriteRawTag(98);
output.WriteMessage(LegacySku);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (transferEligibility_ != null) {
output.WriteRawTag(74);
output.WriteMessage(TransferEligibility);
}
if (sku_ != null) {
output.WriteRawTag(90);
output.WriteMessage(Sku);
}
if (legacySku_ != null) {
output.WriteRawTag(98);
output.WriteMessage(LegacySku);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (transferEligibility_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(TransferEligibility);
}
if (sku_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Sku);
}
if (legacySku_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(LegacySku);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(TransferableSku other) {
if (other == null) {
return;
}
if (other.transferEligibility_ != null) {
if (transferEligibility_ == null) {
TransferEligibility = new global::Google.Cloud.Channel.V1.TransferEligibility();
}
TransferEligibility.MergeFrom(other.TransferEligibility);
}
if (other.sku_ != null) {
if (sku_ == null) {
Sku = new global::Google.Cloud.Channel.V1.Sku();
}
Sku.MergeFrom(other.Sku);
}
if (other.legacySku_ != null) {
if (legacySku_ == null) {
LegacySku = new global::Google.Cloud.Channel.V1.Sku();
}
LegacySku.MergeFrom(other.LegacySku);
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 74: {
if (transferEligibility_ == null) {
TransferEligibility = new global::Google.Cloud.Channel.V1.TransferEligibility();
}
input.ReadMessage(TransferEligibility);
break;
}
case 90: {
if (sku_ == null) {
Sku = new global::Google.Cloud.Channel.V1.Sku();
}
input.ReadMessage(Sku);
break;
}
case 98: {
if (legacySku_ == null) {
LegacySku = new global::Google.Cloud.Channel.V1.Sku();
}
input.ReadMessage(LegacySku);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 74: {
if (transferEligibility_ == null) {
TransferEligibility = new global::Google.Cloud.Channel.V1.TransferEligibility();
}
input.ReadMessage(TransferEligibility);
break;
}
case 90: {
if (sku_ == null) {
Sku = new global::Google.Cloud.Channel.V1.Sku();
}
input.ReadMessage(Sku);
break;
}
case 98: {
if (legacySku_ == null) {
LegacySku = new global::Google.Cloud.Channel.V1.Sku();
}
input.ReadMessage(LegacySku);
break;
}
}
}
}
#endif
}
/// <summary>
/// Specifies transfer eligibility of a SKU.
/// </summary>
public sealed partial class TransferEligibility : pb::IMessage<TransferEligibility>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<TransferEligibility> _parser = new pb::MessageParser<TransferEligibility>(() => new TransferEligibility());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<TransferEligibility> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.Channel.V1.EntitlementsReflection.Descriptor.MessageTypes[8]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TransferEligibility() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TransferEligibility(TransferEligibility other) : this() {
isEligible_ = other.isEligible_;
description_ = other.description_;
ineligibilityReason_ = other.ineligibilityReason_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public TransferEligibility Clone() {
return new TransferEligibility(this);
}
/// <summary>Field number for the "is_eligible" field.</summary>
public const int IsEligibleFieldNumber = 1;
private bool isEligible_;
/// <summary>
/// Whether reseller is eligible to transfer the SKU.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool IsEligible {
get { return isEligible_; }
set {
isEligible_ = value;
}
}
/// <summary>Field number for the "description" field.</summary>
public const int DescriptionFieldNumber = 2;
private string description_ = "";
/// <summary>
/// Localized description if reseller is not eligible to transfer the SKU.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Description {
get { return description_; }
set {
description_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "ineligibility_reason" field.</summary>
public const int IneligibilityReasonFieldNumber = 3;
private global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason ineligibilityReason_ = global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason.Unspecified;
/// <summary>
/// Specified the reason for ineligibility.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason IneligibilityReason {
get { return ineligibilityReason_; }
set {
ineligibilityReason_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as TransferEligibility);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(TransferEligibility other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (IsEligible != other.IsEligible) return false;
if (Description != other.Description) return false;
if (IneligibilityReason != other.IneligibilityReason) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (IsEligible != false) hash ^= IsEligible.GetHashCode();
if (Description.Length != 0) hash ^= Description.GetHashCode();
if (IneligibilityReason != global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason.Unspecified) hash ^= IneligibilityReason.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (IsEligible != false) {
output.WriteRawTag(8);
output.WriteBool(IsEligible);
}
if (Description.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Description);
}
if (IneligibilityReason != global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason.Unspecified) {
output.WriteRawTag(24);
output.WriteEnum((int) IneligibilityReason);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (IsEligible != false) {
output.WriteRawTag(8);
output.WriteBool(IsEligible);
}
if (Description.Length != 0) {
output.WriteRawTag(18);
output.WriteString(Description);
}
if (IneligibilityReason != global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason.Unspecified) {
output.WriteRawTag(24);
output.WriteEnum((int) IneligibilityReason);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (IsEligible != false) {
size += 1 + 1;
}
if (Description.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Description);
}
if (IneligibilityReason != global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason.Unspecified) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) IneligibilityReason);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(TransferEligibility other) {
if (other == null) {
return;
}
if (other.IsEligible != false) {
IsEligible = other.IsEligible;
}
if (other.Description.Length != 0) {
Description = other.Description;
}
if (other.IneligibilityReason != global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason.Unspecified) {
IneligibilityReason = other.IneligibilityReason;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
IsEligible = input.ReadBool();
break;
}
case 18: {
Description = input.ReadString();
break;
}
case 24: {
IneligibilityReason = (global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason) input.ReadEnum();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
IsEligible = input.ReadBool();
break;
}
case 18: {
Description = input.ReadString();
break;
}
case 24: {
IneligibilityReason = (global::Google.Cloud.Channel.V1.TransferEligibility.Types.Reason) input.ReadEnum();
break;
}
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the TransferEligibility message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
/// <summary>
/// Reason of ineligibility.
/// </summary>
public enum Reason {
/// <summary>
/// Reason is not available.
/// </summary>
[pbr::OriginalName("REASON_UNSPECIFIED")] Unspecified = 0,
/// <summary>
/// Reseller needs to accept TOS before transferring the SKU.
/// </summary>
[pbr::OriginalName("PENDING_TOS_ACCEPTANCE")] PendingTosAcceptance = 1,
/// <summary>
/// Reseller not eligible to sell the SKU.
/// </summary>
[pbr::OriginalName("SKU_NOT_ELIGIBLE")] SkuNotEligible = 2,
/// <summary>
/// SKU subscription is suspended
/// </summary>
[pbr::OriginalName("SKU_SUSPENDED")] SkuSuspended = 3,
}
}
#endregion
}
#endregion
}
#endregion Designer generated code
| 38.2589 | 536 | 0.658848 | [
"Apache-2.0"
] | googleapis/googleapis-gen | google/cloud/channel/v1/google-cloud-channel-v1-csharp/Google.Cloud.Channel.V1/Entitlements.g.cs | 118,220 | C# |
/*
* Sasinosoft Map Loader
* Copyright (c) 2019-2020 - Sasinosoft
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SampSharp.GameMode;
using System.Collections.Generic;
namespace Sasinosoft.SMLLoader
{
public class AttachmentData : IObjectData
{
public readonly int Model;
public readonly Vector3 Offset;
public readonly Vector3 Rotation;
public readonly int VirtualWorld;
public readonly int Interior;
public readonly float StreamDistance;
public readonly float DrawDistance;
public readonly List<MaterialData> Materials;
public readonly List<MaterialTextData> MaterialTexts;
public AttachmentData(int model, Vector3 offset, Vector3 rotation, int virtualWorld, int interior, float streamDistance, float drawDistance)
{
Model = model;
Offset = offset;
Rotation = rotation;
VirtualWorld = virtualWorld;
Interior = interior;
StreamDistance = streamDistance;
DrawDistance = drawDistance;
Materials = new List<MaterialData>();
MaterialTexts = new List<MaterialTextData>();
}
}
}
| 33.243902 | 148 | 0.661042 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | SaSiNO97/MapLoader | Loader-SampSharp/AttachmentData.cs | 1,363 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Never.EasySql.Xml
{
/// <summary>
/// 标签类型
/// </summary>
public interface ILabel
{
/// <summary>
/// 标签类型
/// </summary>
LabelType GetLabelType();
/// <summary>
/// sql语句
/// </summary>
string SqlText { get; }
/// <summary>
/// 格式化
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="format"></param>
/// <param name="parameter"></param>
/// <param name="convert"></param>
void Format<T>(SqlTagFormat format, EasySqlParameter<T> parameter, IReadOnlyList<KeyValueTuple<string, object>> convert);
/// <summary>
/// 是否找到参数
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="parameter"></param>
/// <param name="convert"></param>
/// <returns></returns>
bool ContainParameter<T>(EasySqlParameter<T> parameter, IReadOnlyList<KeyValueTuple<string, object>> convert);
}
} | 27.309524 | 129 | 0.548387 | [
"MIT"
] | daniel1519/never | src/Never.EasySql/Xml/ILabel.cs | 1,187 | C# |
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Threading;
using FolderSelect;
using Prism.Commands;
using XIVLauncher.WPF.Models;
namespace XIVLauncher.WPF.Views
{
/// <summary>
/// MainView.xaml の相互作用ロジック
/// </summary>
public partial class MainView :
Window,
INotifyPropertyChanged
{
public MainView()
{
this.InitializeComponent();
this.Loaded += this.MainView_Loaded;
this.PreviewKeyDown += (x, y) =>
{
if (y.Key == Key.Enter)
{
this.LoginButton.Focus();
}
};
}
public Settings Config => Models.Settings.Instance;
private async void MainView_Loaded(
object sender,
RoutedEventArgs e)
{
if (string.IsNullOrEmpty(this.Config.SavedID))
{
this.IDTextBox.Focusable = true;
this.IDTextBox.Focus();
}
else
{
this.OTPTextBox.Focusable = true;
this.OTPTextBox.Focus();
}
if (!this.IsActive)
{
this.Activate();
}
if (!this.Config.ExistGame)
{
MessageBox.Show(
@"You will now be asked to select the path your game is installed in." + Environment.NewLine +
@"It should contain the folders ""game"" and ""boot"".",
"Select Game Path",
MessageBoxButton.OK,
MessageBoxImage.Information);
var fsd = new FolderSelectDialog();
fsd.Title = "Choose your game path";
if (fsd.ShowDialog(new WindowInteropHelper(this).Handle))
{
this.Config.GamePath = fsd.FileName;
}
}
if (this.Config.AutoLogin &&
!SettingsHelper.IsAdministrator() &&
this.CanExecute())
{
var stat = await Task.Run(() => XIVGame.GetGateStatus());
if (!stat)
{
MessageBox.Show(
"SQUARE ENIX seems to be running maintenance work right now.\nThe game shouldn't be launched.",
"Login failed",
MessageBoxButton.OK,
MessageBoxImage.Information);
this.Config.AutoLogin = false;
Settings.Instance.Save();
return;
}
try
{
await Task.Run(() =>
XIVGame.LaunchGame(
XIVGame.GetRealSid(
this.Config.SavedID,
this.Config.SavedPW,
this.Config.OnetimePassword),
(int)this.Config.Language,
this.Config.IsDX11,
this.Config.UseSteam,
(int)this.Config.ExpansionLevel));
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(
"Logging in failed, check your login information or try again.\n\n" + ex,
"Login failed",
MessageBoxButton.OK,
MessageBoxImage.Error);
}
}
}
private bool CanExecute() =>
!string.IsNullOrEmpty(this.Config.SavedID) &&
!string.IsNullOrEmpty(this.Config.SavedPW);
private volatile bool isProcessing = false;
private ICommand loginCommand;
public ICommand LoginCommand =>
this.loginCommand ?? (this.loginCommand = new DelegateCommand(() =>
{
if (!this.CanExecute())
{
return;
}
if (this.isProcessing)
{
return;
}
this.isProcessing = true;
try
{
this.LoginAsync();
}
finally
{
this.isProcessing = false;
}
}));
private async void LoginAsync()
{
Settings.Instance.Save();
#if !DEBUG
if (!this.Config.ExistGame)
{
MessageBox.Show(
"FFXIV not found.\nPlease setup options. [Options] -> [Game Path]",
"Not Avalable",
MessageBoxButton.OK,
MessageBoxImage.Information);
return;
}
var stat = await Task.Run(() => XIVGame.GetGateStatus());
if (!stat)
{
MessageBox.Show(
"SQUARE ENIX seems to be running maintenance work right now.\nThe game shouldn't be launched.",
"Login failed",
MessageBoxButton.OK,
MessageBoxImage.Information);
return;
}
#endif
try
{
var kicked = false;
foreach (var tool in Models.Settings.Instance.ToolSettings)
{
tool.IsRunning = false;
}
// ツールを起動する
await Task.Run(() =>
{
foreach (var tool in Models.Settings.Instance.ToolSettings
.Where(x =>
x.IsEnabled &&
!x.IsPostProcess)
.OrderBy(x => x.Priority))
{
if (tool.Run())
{
kicked = true;
Thread.Sleep(TimeSpan.FromSeconds(0.5));
}
tool.IsRunning = true;
}
});
if (kicked)
{
await Task.Delay(TimeSpan.FromSeconds(Settings.Instance.DelayLaunchFFXIV));
}
#if !DEBUG
// FFXIVを起動する
await Task.Run(() =>
XIVGame.LaunchGame(
XIVGame.GetRealSid(
this.Config.SavedID,
this.Config.SavedPW,
this.Config.OnetimePassword),
(int)this.Config.Language,
this.Config.IsDX11,
this.Config.UseSteam,
(int)this.Config.ExpansionLevel));
#else
Debug.WriteLine("●FFXIV Started");
#endif
var ffxivStartedTime = DateTime.Now;
// ポストプロセスツールを起動する
await Task.Run(() =>
{
var posts =
from x in Models.Settings.Instance.ToolSettings
where
x.IsEnabled &&
x.IsPostProcess
orderby
x.Delay,
x.Priority
select
x;
var startTime = DateTime.Now;
while ((DateTime.Now - startTime).TotalMinutes <= 5.0)
{
foreach (var tool in posts)
{
if (DateTime.Now >= ffxivStartedTime.AddSeconds(tool.Delay))
{
tool.Run();
tool.IsRunning = true;
}
}
if (!posts.Any(x => !x.IsRunning))
{
break;
}
Thread.Sleep(TimeSpan.FromSeconds(0.05));
}
});
// 起動したら終わる
await Task.Delay(TimeSpan.FromSeconds(0.5));
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(
"Logging in failed, check your login information or try again.\n\n" + ex,
"Login failed",
MessageBoxButton.OK,
MessageBoxImage.Error);
}
}
private string waitingMessage = string.Empty;
public string WaitingMessage
{
get => this.waitingMessage;
set => this.SetProperty(ref this.waitingMessage, value);
}
private ICommand queueMaintenanceCommand;
public ICommand QueueMaintenanceCommand =>
this.queueMaintenanceCommand ?? (this.queueMaintenanceCommand = new DelegateCommand(async () =>
{
this.WaitingMessage = string.Empty;
#if !DEBUG
if (!this.Config.ExistGame)
{
MessageBox.Show(
"FFXIV not found.\nPlease setup options. [Options] -> [Game Path]",
"Not Avalable",
MessageBoxButton.OK,
MessageBoxImage.Information);
return;
}
#endif
var result = MessageBox.Show(
"This will be querying the maintenance status server,\nuntil the maintenance is over." +
"\n\n!!!The application will be unresponsive!!!" +
"\n\nDo you want to continue?",
"Maintenance Queue",
MessageBoxButton.YesNo,
MessageBoxImage.Question,
MessageBoxResult.Yes);
if (result != MessageBoxResult.Yes)
{
return;
}
var startTime = DateTime.Now;
await Task.Run(async () =>
{
var i = 0;
while (true)
{
if (i == 0)
{
if (XIVGame.GetGateStatus())
{
break;
}
}
var span = DateTime.Now - startTime;
await Dispatcher.InvokeAsync(() =>
{
this.WaitingMessage = $" {span.ToString(@"mm\:ss")} Wating{new string('.', i)} ";
});
i++;
if (i > 4)
{
i = 0;
}
await Task.Delay(TimeSpan.FromSeconds(1.0));
}
});
this.WaitingMessage = " Server is Available!";
if (string.IsNullOrEmpty(this.IDTextBox.Text))
{
this.IDTextBox.Focus();
}
else
{
if (string.IsNullOrEmpty(this.PlainPWBox.Text))
{
this.PWBox.Focus();
}
else
{
this.OTPTextBox.Focus();
}
}
await Task.Run(() =>
{
Console.Beep(529, 130);
Thread.Sleep(200);
Console.Beep(529, 100);
Thread.Sleep(30);
Console.Beep(529, 100);
Thread.Sleep(300);
Console.Beep(420, 140);
Thread.Sleep(300);
Console.Beep(466, 100);
Thread.Sleep(300);
Console.Beep(529, 160);
Thread.Sleep(200);
Console.Beep(466, 100);
Thread.Sleep(30);
Console.Beep(529, 900);
});
// 自動ログインはしない
// というかワンタイムパスワードがあるのでできない
/*
this.LoginCommand.Execute(null);
*/
}));
private ICommand optionCommand;
public ICommand OptionCommand =>
this.optionCommand ?? (this.optionCommand = new DelegateCommand(() =>
{
var view = new OptionView()
{
Owner = this
};
view.Show();
}));
#region INotifyPropertyChanged
[field: NonSerialized]
public event PropertyChangedEventHandler PropertyChanged;
public void RaisePropertyChanged(
[CallerMemberName]string propertyName = null)
{
this.PropertyChanged?.Invoke(
this,
new PropertyChangedEventArgs(propertyName));
}
protected virtual bool SetProperty<T>(
ref T field,
T value,
[CallerMemberName]string propertyName = null)
{
if (Equals(field, value))
{
return false;
}
field = value;
this.PropertyChanged?.Invoke(
this,
new PropertyChangedEventArgs(propertyName));
return true;
}
#endregion INotifyPropertyChanged
}
}
| 31.761589 | 120 | 0.395538 | [
"MIT"
] | marwidragon/FFXIVQuickLauncher | XIVLauncher/WPF/Views/MainView.xaml.cs | 14,546 | C# |
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Management.Reservations
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// ReservationOperations operations.
/// </summary>
internal partial class ReservationOperations : IServiceOperations<AzureReservationAPIClient>, IReservationOperations
{
/// <summary>
/// Initializes a new instance of the ReservationOperations class.
/// </summary>
/// <param name='client'>
/// Reference to the service client.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
internal ReservationOperations(AzureReservationAPIClient client)
{
if (client == null)
{
throw new System.ArgumentNullException("client");
}
Client = client;
}
/// <summary>
/// Gets a reference to the AzureReservationAPIClient
/// </summary>
public AzureReservationAPIClient Client { get; private set; }
/// <summary>
/// Get Available Scopes for `Reservation`.
/// </summary>
/// <remarks>
/// Get Available Scopes for `Reservation`.
///
/// </remarks>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='reservationId'>
/// Id of the Reservation Item
/// </param>
/// <param name='body'>
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse<AvailableScopeProperties>> AvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, AvailableScopeRequest body, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
AzureOperationResponse<AvailableScopeProperties> _response = await BeginAvailableScopesWithHttpMessagesAsync(reservationOrderId, reservationId, body, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Split the `Reservation`.
/// </summary>
/// <remarks>
/// Split a `Reservation` into two `Reservation`s with specified quantity
/// distribution.
/// </remarks>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='body'>
/// Information needed to Split a reservation item
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse<IList<ReservationResponse>>> SplitWithHttpMessagesAsync(string reservationOrderId, SplitRequest body, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
AzureOperationResponse<IList<ReservationResponse>> _response = await BeginSplitWithHttpMessagesAsync(reservationOrderId, body, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Merges two `Reservation`s.
/// </summary>
/// <remarks>
/// Merge the specified `Reservation`s into a new `Reservation`. The two
/// `Reservation`s being merged must have same properties.
/// </remarks>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='body'>
/// Information needed for commercial request for a reservation
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse<IList<ReservationResponse>>> MergeWithHttpMessagesAsync(string reservationOrderId, MergeRequest body, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
AzureOperationResponse<IList<ReservationResponse>> _response = await BeginMergeWithHttpMessagesAsync(reservationOrderId, body, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Get `Reservation`s in a given reservation Order
/// </summary>
/// <remarks>
/// List `Reservation`s within a single `ReservationOrder`.
/// </remarks>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<ReservationResponse>>> ListWithHttpMessagesAsync(string reservationOrderId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (reservationOrderId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId");
}
string apiVersion = "2020-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("reservationOrderId", reservationOrderId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations").ToString();
_url = _url.Replace("{reservationOrderId}", System.Uri.EscapeDataString(reservationOrderId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<Error>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IPage<ReservationResponse>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<ReservationResponse>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Get `Reservation` details.
/// </summary>
/// <remarks>
/// Get specific `Reservation` details.
/// </remarks>
/// <param name='reservationId'>
/// Id of the Reservation Item
/// </param>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='expand'>
/// Supported value of this query is renewProperties
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<ReservationResponse>> GetWithHttpMessagesAsync(string reservationId, string reservationOrderId, string expand = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (reservationId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationId");
}
if (reservationOrderId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId");
}
string apiVersion = "2020-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("reservationId", reservationId);
tracingParameters.Add("reservationOrderId", reservationOrderId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("expand", expand);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}").ToString();
_url = _url.Replace("{reservationId}", System.Uri.EscapeDataString(reservationId));
_url = _url.Replace("{reservationOrderId}", System.Uri.EscapeDataString(reservationOrderId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (expand != null)
{
_queryParameters.Add(string.Format("expand={0}", System.Uri.EscapeDataString(expand)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<Error>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<ReservationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<ReservationResponse>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Updates a `Reservation`.
/// </summary>
/// <remarks>
/// Updates the applied scopes of the `Reservation`.
/// </remarks>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='reservationId'>
/// Id of the Reservation Item
/// </param>
/// <param name='parameters'>
/// Information needed to patch a reservation item
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse<ReservationResponse>> UpdateWithHttpMessagesAsync(string reservationOrderId, string reservationId, Patch parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
AzureOperationResponse<ReservationResponse> _response = await BeginUpdateWithHttpMessagesAsync(reservationOrderId, reservationId, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Get `Reservation` revisions.
/// </summary>
/// <remarks>
/// List of all the revisions for the `Reservation`.
/// </remarks>
/// <param name='reservationId'>
/// Id of the Reservation Item
/// </param>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<ReservationResponse>>> ListRevisionsWithHttpMessagesAsync(string reservationId, string reservationOrderId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (reservationId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationId");
}
if (reservationOrderId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId");
}
string apiVersion = "2020-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("reservationId", reservationId);
tracingParameters.Add("reservationOrderId", reservationOrderId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListRevisions", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions").ToString();
_url = _url.Replace("{reservationId}", System.Uri.EscapeDataString(reservationId));
_url = _url.Replace("{reservationOrderId}", System.Uri.EscapeDataString(reservationOrderId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<Error>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IPage<ReservationResponse>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<ReservationResponse>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Get Available Scopes for `Reservation`.
/// </summary>
/// <remarks>
/// Get Available Scopes for `Reservation`.
///
/// </remarks>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='reservationId'>
/// Id of the Reservation Item
/// </param>
/// <param name='body'>
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<AvailableScopeProperties>> BeginAvailableScopesWithHttpMessagesAsync(string reservationOrderId, string reservationId, AvailableScopeRequest body, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (reservationOrderId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId");
}
if (reservationId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationId");
}
if (body == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "body");
}
string apiVersion = "2020-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("reservationOrderId", reservationOrderId);
tracingParameters.Add("reservationId", reservationId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("body", body);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginAvailableScopes", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes").ToString();
_url = _url.Replace("{reservationOrderId}", System.Uri.EscapeDataString(reservationOrderId));
_url = _url.Replace("{reservationId}", System.Uri.EscapeDataString(reservationId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
if(body != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<Error>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<AvailableScopeProperties>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<AvailableScopeProperties>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Split the `Reservation`.
/// </summary>
/// <remarks>
/// Split a `Reservation` into two `Reservation`s with specified quantity
/// distribution.
/// </remarks>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='body'>
/// Information needed to Split a reservation item
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IList<ReservationResponse>>> BeginSplitWithHttpMessagesAsync(string reservationOrderId, SplitRequest body, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (reservationOrderId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId");
}
if (body == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "body");
}
string apiVersion = "2020-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("reservationOrderId", reservationOrderId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("body", body);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginSplit", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split").ToString();
_url = _url.Replace("{reservationOrderId}", System.Uri.EscapeDataString(reservationOrderId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
if(body != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<Error>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IList<ReservationResponse>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<IList<ReservationResponse>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Merges two `Reservation`s.
/// </summary>
/// <remarks>
/// Merge the specified `Reservation`s into a new `Reservation`. The two
/// `Reservation`s being merged must have same properties.
/// </remarks>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='body'>
/// Information needed for commercial request for a reservation
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IList<ReservationResponse>>> BeginMergeWithHttpMessagesAsync(string reservationOrderId, MergeRequest body, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (reservationOrderId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId");
}
if (body == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "body");
}
string apiVersion = "2020-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("reservationOrderId", reservationOrderId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("body", body);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginMerge", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge").ToString();
_url = _url.Replace("{reservationOrderId}", System.Uri.EscapeDataString(reservationOrderId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
if(body != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<Error>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IList<ReservationResponse>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<IList<ReservationResponse>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Updates a `Reservation`.
/// </summary>
/// <remarks>
/// Updates the applied scopes of the `Reservation`.
/// </remarks>
/// <param name='reservationOrderId'>
/// Order Id of the reservation
/// </param>
/// <param name='reservationId'>
/// Id of the Reservation Item
/// </param>
/// <param name='parameters'>
/// Information needed to patch a reservation item
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<ReservationResponse>> BeginUpdateWithHttpMessagesAsync(string reservationOrderId, string reservationId, Patch parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (reservationOrderId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationOrderId");
}
if (reservationId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "reservationId");
}
if (parameters == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
string apiVersion = "2020-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("reservationOrderId", reservationOrderId);
tracingParameters.Add("reservationId", reservationId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}").ToString();
_url = _url.Replace("{reservationOrderId}", System.Uri.EscapeDataString(reservationOrderId));
_url = _url.Replace("{reservationId}", System.Uri.EscapeDataString(reservationId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("PATCH");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<Error>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<ReservationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<ReservationResponse>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Get `Reservation`s in a given reservation Order
/// </summary>
/// <remarks>
/// List `Reservation`s within a single `ReservationOrder`.
/// </remarks>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<ReservationResponse>>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
}
// Construct URL
string _url = "{nextLink}";
_url = _url.Replace("{nextLink}", nextPageLink);
List<string> _queryParameters = new List<string>();
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<Error>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IPage<ReservationResponse>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<ReservationResponse>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
/// <summary>
/// Get `Reservation` revisions.
/// </summary>
/// <remarks>
/// List of all the revisions for the `Reservation`.
/// </remarks>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="ErrorException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<ReservationResponse>>> ListRevisionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListRevisionsNext", tracingParameters);
}
// Construct URL
string _url = "{nextLink}";
_url = _url.Replace("{nextLink}", nextPageLink);
List<string> _queryParameters = new List<string>();
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
// Set Credentials
if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject<Error>(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
}
}
catch (JsonException)
{
// Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IPage<ReservationResponse>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
if ((int)_statusCode == 200)
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<ReservationResponse>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
}
}
| 45.949811 | 315 | 0.564966 | [
"MIT"
] | 93mishra/azure-sdk-for-net | sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/ReservationOperations.cs | 85,145 | C# |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ProductStockInfo.cs" company="Sitecore Corporation">
// Copyright (c) Sitecore Corporation 1999-2015
// </copyright>
// <summary>
// Defines the ProductStockInfo type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
// Copyright 2015 Sitecore Corporation A/S
// 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 Sitecore.Ecommerce.DomainModel.Products
{
/// <summary>
/// Represents product info.
/// </summary>
public class ProductStockInfo
{
/// <summary>
/// Gets or sets the product code.
/// </summary>
/// <value>The product code.</value>
public string ProductCode { get; set; }
}
} | 45.090909 | 121 | 0.534274 | [
"Apache-2.0"
] | HydAu/sitecore8ecommerce | code/Core/Sitecore.Ecommerce.DomainModel/Products/ProductStockInfo.cs | 1,490 | C# |
/*
* MIT License
*
* Copyright (c) 2021 [FacuFalcone]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
using System;
namespace Models {
public sealed class SupplierPayment : Payment {
public SupplierPayment(short id, DateTime date, string customerName, string customerSurname, string customerBussiness, float amount, short idCustomer)
: base(id, date, customerName, customerSurname, customerBussiness, amount, idCustomer) { }
}
}
| 42.857143 | 158 | 0.749333 | [
"MIT"
] | caidevOficial/CSharp_AccountControl | Account_Control/Account_Control.Logic/Account_Control.Logic.Classes/Account_Control.Logic.Classes.SubClass/SupplierPayment.cs | 1,502 | C# |
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.UI.Xaml.Input
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || false
[global::Uno.NotImplemented]
#endif
public partial class KeyboardAccelerator : global::Windows.UI.Xaml.DependencyObject
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public global::Windows.UI.Xaml.DependencyObject ScopeOwner
{
get
{
return (global::Windows.UI.Xaml.DependencyObject)this.GetValue(ScopeOwnerProperty);
}
set
{
this.SetValue(ScopeOwnerProperty, value);
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public global::Windows.System.VirtualKeyModifiers Modifiers
{
get
{
return (global::Windows.System.VirtualKeyModifiers)this.GetValue(ModifiersProperty);
}
set
{
this.SetValue(ModifiersProperty, value);
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public global::Windows.System.VirtualKey Key
{
get
{
return (global::Windows.System.VirtualKey)this.GetValue(KeyProperty);
}
set
{
this.SetValue(KeyProperty, value);
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public bool IsEnabled
{
get
{
return (bool)this.GetValue(IsEnabledProperty);
}
set
{
this.SetValue(IsEnabledProperty, value);
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public static global::Windows.UI.Xaml.DependencyProperty IsEnabledProperty { get; } =
Windows.UI.Xaml.DependencyProperty.Register(
"IsEnabled", typeof(bool),
typeof(global::Windows.UI.Xaml.Input.KeyboardAccelerator),
new FrameworkPropertyMetadata(default(bool)));
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public static global::Windows.UI.Xaml.DependencyProperty KeyProperty { get; } =
Windows.UI.Xaml.DependencyProperty.Register(
"Key", typeof(global::Windows.System.VirtualKey),
typeof(global::Windows.UI.Xaml.Input.KeyboardAccelerator),
new FrameworkPropertyMetadata(default(global::Windows.System.VirtualKey)));
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public static global::Windows.UI.Xaml.DependencyProperty ModifiersProperty { get; } =
Windows.UI.Xaml.DependencyProperty.Register(
"Modifiers", typeof(global::Windows.System.VirtualKeyModifiers),
typeof(global::Windows.UI.Xaml.Input.KeyboardAccelerator),
new FrameworkPropertyMetadata(default(global::Windows.System.VirtualKeyModifiers)));
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public static global::Windows.UI.Xaml.DependencyProperty ScopeOwnerProperty { get; } =
Windows.UI.Xaml.DependencyProperty.Register(
"ScopeOwner", typeof(global::Windows.UI.Xaml.DependencyObject),
typeof(global::Windows.UI.Xaml.Input.KeyboardAccelerator),
new FrameworkPropertyMetadata(default(global::Windows.UI.Xaml.DependencyObject)));
#endif
// Skipping already declared method Windows.UI.Xaml.Input.KeyboardAccelerator.KeyboardAccelerator()
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.KeyboardAccelerator()
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.Key.get
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.Key.set
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.Modifiers.get
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.Modifiers.set
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.IsEnabled.get
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.IsEnabled.set
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.ScopeOwner.get
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.ScopeOwner.set
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.Invoked.add
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.Invoked.remove
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.KeyProperty.get
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.ModifiersProperty.get
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.IsEnabledProperty.get
// Forced skipping of method Windows.UI.Xaml.Input.KeyboardAccelerator.ScopeOwnerProperty.get
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public event global::Windows.Foundation.TypedEventHandler<global::Windows.UI.Xaml.Input.KeyboardAccelerator, global::Windows.UI.Xaml.Input.KeyboardAcceleratorInvokedEventArgs> Invoked
{
[global::Uno.NotImplemented]
add
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.Xaml.Input.KeyboardAccelerator", "event TypedEventHandler<KeyboardAccelerator, KeyboardAcceleratorInvokedEventArgs> KeyboardAccelerator.Invoked");
}
[global::Uno.NotImplemented]
remove
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.Xaml.Input.KeyboardAccelerator", "event TypedEventHandler<KeyboardAccelerator, KeyboardAcceleratorInvokedEventArgs> KeyboardAccelerator.Invoked");
}
}
#endif
}
}
| 42.583333 | 236 | 0.759651 | [
"Apache-2.0"
] | 06needhamt/uno | src/Uno.UI/Generated/3.0.0.0/Windows.UI.Xaml.Input/KeyboardAccelerator.cs | 5,621 | C# |
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Pantheon.Identity.Data;
namespace Pantheon.Identity
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddPantheonIdentityInfrastructure(
this IServiceCollection services,
IConfiguration configuration,
ILoggerFactory loggerFactory = null)
{
services.AddDbContext<PantheonIdentityDbContext>(optionsBuilder =>
{
if (loggerFactory != null)
{
optionsBuilder.UseLoggerFactory(loggerFactory);
}
optionsBuilder.UseSqlServer(
configuration.GetConnectionString("Identity"),
providerOptions => providerOptions.MigrationsAssembly(
typeof(PantheonIdentityDbContext).Assembly.FullName));
});
services.Configure<IdentityOptions>(options =>
{
options.User.RequireUniqueEmail = true;
});
return services;
}
}
} | 33.131579 | 78 | 0.626688 | [
"MIT"
] | danielsprohar/Pantheon-Property-Management-System | src/Infrastructure/Pantheon.Identity/ServiceCollectionExtensions.cs | 1,261 | C# |
using System;
using System.Linq;
namespace AI.BackEnds.DSP.NWaves.Transforms.Wavelets
{
/// <summary>
/// Wavelet
/// </summary>
public class Wavelet
{
/// <summary>
/// Name
/// </summary>
public string Name { get; set; }
/// <summary>
/// The length of the mother wavelet
/// </summary>
public int Length { get; set; }
/// <summary>
/// LP coefficients for decomposition
/// </summary>
public float[] LoD { get; set; }
/// <summary>
/// HP coefficients for decomposition
/// </summary>
public float[] HiD { get; set; }
/// <summary>
/// LP coefficients for reconstruction
/// </summary>
public float[] LoR { get; set; }
/// <summary>
/// HP coefficients for reconstruction
/// </summary>
public float[] HiR { get; set; }
/// <summary>
/// Constructor from wavelet family and number of taps
/// </summary>
/// <param name="waveletFamily"></param>
/// <param name="taps">Set for all wavelets</param>
public Wavelet(WaveletFamily waveletFamily, int taps = 1)
{
MakeWavelet(waveletFamily, taps);
}
/// <summary>
/// Constructor from name
/// </summary>
/// <param name="name"></param>
public Wavelet(string name)
{
WaveletFamily waveletFamily;
int taps = 1;
name = name.ToLower();
if (name == "haar")
{
waveletFamily = WaveletFamily.Haar;
}
else
{
int digitPos = -1;
for (int i = 0; i < name.Length; i++)
{
if (char.IsDigit(name[i]))
{
digitPos = i;
break;
}
}
string wname = name;
if (digitPos < 0)
{
taps = 1;
}
else
{
wname = name.Substring(0, digitPos);
taps = int.Parse(name.Substring(digitPos));
}
switch (wname)
{
case "db":
waveletFamily = WaveletFamily.Daubechies;
break;
case "sym":
waveletFamily = WaveletFamily.Symlet;
break;
case "coif":
waveletFamily = WaveletFamily.Coiflet;
break;
default:
throw new ArgumentException($"Unrecognized wavelet name: {name}");
}
}
MakeWavelet(waveletFamily, taps);
}
/// <summary>
/// Fill wavelet fields: name, length and coefficients
/// </summary>
/// <param name="waveletFamily"></param>
/// <param name="taps"></param>
private void MakeWavelet(WaveletFamily waveletFamily, int taps)
{
switch (waveletFamily)
{
case WaveletFamily.Daubechies:
MakeDaubechiesWavelet(taps);
break;
case WaveletFamily.Symlet:
MakeSymletWavelet(taps);
break;
case WaveletFamily.Coiflet:
MakeCoifletWavelet(taps);
break;
default:
MakeHaarWavelet();
break;
}
ComputeOrthonormalCoeffs();
}
/// <summary>
/// Compute orthonormal coefficients from LoD coefficients only
/// </summary>
public void ComputeOrthonormalCoeffs()
{
HiD = LoD.Reverse().ToArray();
for (int i = 0; i < HiD.Length; i += 2)
{
HiD[i] = -HiD[i];
}
LoR = LoD.Reverse().ToArray();
HiR = HiD.Reverse().ToArray();
}
#region wavelet coefficients
/// <summary>
/// Haar wavelet
/// </summary>
public void MakeHaarWavelet()
{
Name = "haar";
Length = 2;
float sqrt2 = (float)Math.Sqrt(2);
LoD = new[] { 1 / sqrt2, 1 / sqrt2 };
}
/// <summary>
/// Daubechies wavelet
/// </summary>
/// <param name="taps"></param>
public void MakeDaubechiesWavelet(int taps)
{
Name = $"db{taps}";
Length = 2 * taps;
switch (taps)
{
case 1:
float sqrt2 = (float)Math.Sqrt(2); // just like Haar
LoD = new[] { 1 / sqrt2, 1 / sqrt2 };
break;
case 2:
LoD = new[] { -0.12940952255092145f,
0.22414386804185735f,
0.836516303737469f,
0.48296291314469025f };
break;
case 3:
LoD = new[] { 0.035226291882100656f,
-0.08544127388224149f,
-0.13501102001039084f,
0.4598775021193313f,
0.8068915093133388f,
0.3326705529509569f };
break;
case 4:
LoD = new[] { -0.010597401784997278f,
0.032883011666982945f,
0.030841381835986965f,
-0.18703481171888114f,
-0.02798376941698385f,
0.6308807679295904f,
0.7148465705525415f,
0.23037781330885523f };
break;
case 5:
LoD = new[] { 0.003335725285001549f,
-0.012580751999015526f,
-0.006241490213011705f,
0.07757149384006515f,
-0.03224486958502952f,
-0.24229488706619015f,
0.13842814590110342f,
0.7243085284385744f,
0.6038292697974729f,
0.160102397974125f };
break;
case 6:
LoD = new[] { -0.00107730108499558f,
0.004777257511010651f,
0.0005538422009938016f,
-0.031582039318031156f,
0.02752286553001629f,
0.09750160558707936f,
-0.12976686756709563f,
-0.22626469396516913f,
0.3152503517092432f,
0.7511339080215775f,
0.4946238903983854f,
0.11154074335008017f };
break;
case 7:
LoD = new[] { 0.0003537138000010399f,
-0.0018016407039998328f,
0.00042957797300470274f,
0.012550998556013784f,
-0.01657454163101562f,
-0.03802993693503463f,
0.0806126091510659f,
0.07130921926705004f,
-0.22403618499416572f,
-0.14390600392910627f,
0.4697822874053586f,
0.7291320908465551f,
0.39653931948230575f,
0.07785205408506236f };
break;
case 8:
LoD = new[] { -0.00011747678400228192f,
0.0006754494059985568f,
-0.0003917403729959771f,
-0.00487035299301066f,
0.008746094047015655f,
0.013981027917015516f,
-0.04408825393106472f,
-0.01736930100202211f,
0.128747426620186f,
0.00047248457399797254f,
-0.2840155429624281f,
-0.015829105256023893f,
0.5853546836548691f,
0.6756307362980128f,
0.3128715909144659f,
0.05441584224308161f };
break;
case 9:
LoD = new[] { 3.9347319995026124e-05f,
-0.0002519631889981789f,
0.00023038576399541288f,
0.0018476468829611268f,
-0.004281503681904723f,
-0.004723204757894831f,
0.022361662123515244f,
0.00025094711499193845f,
-0.06763282905952399f,
0.030725681478322865f,
0.14854074933476008f,
-0.09684078322087904f,
-0.29327378327258685f,
0.13319738582208895f,
0.6572880780366389f,
0.6048231236767786f,
0.24383467463766728f,
0.03807794736316728f };
break;
case 10:
LoD = new[] { -1.326420300235487e-05f,
9.358867000108985e-05f,
-0.0001164668549943862f,
-0.0006858566950046825f,
0.00199240529499085f,
0.0013953517469940798f,
-0.010733175482979604f,
0.0036065535669883944f,
0.03321267405893324f,
-0.02945753682194567f,
-0.07139414716586077f,
0.09305736460380659f,
0.12736934033574265f,
-0.19594627437659665f,
-0.24984642432648865f,
0.2811723436604265f,
0.6884590394525921f,
0.5272011889309198f,
0.18817680007762133f,
0.026670057900950818f };
break;
case 11:
LoD = new[] { 4.494274277236352e-06f,
-3.463498418698379e-05f,
5.443907469936638e-05f,
0.00024915252355281426f,
-0.0008930232506662366f,
-0.00030859285881515924f,
0.004928417656058778f,
-0.0033408588730145018f,
-0.015364820906201324f,
0.02084090436018004f,
0.03133509021904531f,
-0.06643878569502022f,
-0.04647995511667613f,
0.14981201246638268f,
0.06604358819669089f,
-0.27423084681792875f,
-0.16227524502747828f,
0.41196436894789695f,
0.6856867749161785f,
0.44989976435603013f,
0.1440670211506196f,
0.01869429776147044f };
break;
case 12:
LoD = new[] { -1.5290717580684923e-06f,
1.2776952219379579e-05f,
-2.4241545757030318e-05f,
-8.850410920820318e-05f,
0.0003886530628209267f,
6.5451282125215034e-06f,
-0.0021795036186277044f,
0.0022486072409952287f,
0.006711499008795549f,
-0.012840825198299882f,
-0.01221864906974642f,
0.04154627749508764f,
0.010849130255828966f,
-0.09643212009649671f,
0.0053595696743599965f,
0.18247860592758275f,
-0.023779257256064865f,
-0.31617845375277914f,
-0.04476388565377762f,
0.5158864784278007f,
0.6571987225792911f,
0.3773551352142041f,
0.10956627282118277f,
0.013112257957229239f };
break;
case 13:
LoD = new[] { 5.2200350984548e-07f,
-4.700416479360808e-06f,
1.0441930571407941e-05f,
3.067853757932436e-05f,
-0.0001651289885565057f,
4.9251525126285676e-05f,
0.000932326130867249f,
-0.0013156739118922766f,
-0.002761911234656831f,
0.007255589401617119f,
0.003923941448795577f,
-0.02383142071032781f,
0.002379972254052227f,
0.056139477100276156f,
-0.026488406475345658f,
-0.10580761818792761f,
0.07294893365678874f,
0.17947607942935084f,
-0.12457673075080665f,
-0.31497290771138414f,
0.086985726179645f,
0.5888895704312119f,
0.6110558511587811f,
0.3119963221604349f,
0.08286124387290195f,
0.009202133538962279f };
break;
case 14:
LoD = new[] { -1.7871399683109222e-07f,
1.7249946753674012e-06f,
-4.389704901780418e-06f,
-1.0337209184568496e-05f,
6.875504252695734e-05f,
-4.177724577037067e-05f,
-0.00038683194731287514f,
0.0007080211542354048f,
0.001061691085606874f,
-0.003849638868019787f,
-0.0007462189892638753f,
0.01278949326634007f,
-0.0056150495303375755f,
-0.030185351540353976f,
0.02698140830794797f,
0.05523712625925082f,
-0.0715489555039835f,
-0.0867484115681106f,
0.13998901658445695f,
0.13839521386479153f,
-0.2180335299932165f,
-0.27168855227867705f,
0.21867068775886594f,
0.6311878491047198f,
0.5543056179407709f,
0.25485026779256437f,
0.062364758849384874f,
0.0064611534600864905f };
break;
case 15:
LoD = new[] { 6.133359913303714e-08f,
-6.316882325879451e-07f,
1.8112704079399406e-06f,
3.3629871817363823e-06f,
-2.8133296266037558e-05f,
2.579269915531323e-05f,
0.00015589648992055726f,
-0.00035956524436229364f,
-0.0003734823541372647f,
0.0019433239803823459f,
-0.00024175649075894543f,
-0.0064877345603061454f,
0.005101000360422873f,
0.015083918027862582f,
-0.020810050169636805f,
-0.02576700732836694f,
0.054780550584559995f,
0.033877143923563204f,
-0.11112093603713753f,
-0.0396661765557336f,
0.19014671400708816f,
0.06528295284876569f,
-0.28888259656686216f,
-0.19320413960907623f,
0.33900253545462167f,
0.6458131403572103f,
0.4926317717079753f,
0.20602386398692688f,
0.04674339489275062f,
0.004538537361577376f };
break;
case 16:
LoD = new[] { -2.1093396300980412e-08f,
2.3087840868545578e-07f,
-7.363656785441815e-07f,
-1.0435713423102517e-06f,
1.133660866126152e-05f,
-1.394566898819319e-05f,
-6.103596621404321e-05f,
0.00017478724522506327f,
0.00011424152003843815f,
-0.0009410217493585433f,
0.00040789698084934395f,
0.00312802338120381f,
-0.0036442796214883506f,
-0.006990014563390751f,
0.013993768859843242f,
0.010297659641009963f,
-0.036888397691556774f,
-0.007588974368642594f,
0.07592423604445779f,
-0.006239722752156254f,
-0.13238830556335474f,
0.027340263752899923f,
0.21119069394696974f,
-0.02791820813292813f,
-0.3270633105274758f,
-0.08975108940236352f,
0.44029025688580486f,
0.6373563320829833f,
0.43031272284545874f,
0.1650642834886438f,
0.03490771432362905f,
0.0031892209253436892f };
break;
case 17:
LoD = new[] { 7.26749296856637e-09f,
-8.423948446008154e-08f,
2.9577009333187617e-07f,
3.0165496099963414e-07f,
-4.505942477225963e-06f,
6.990600985081294e-06f,
2.318681379876164e-05f,
-8.204803202458212e-05f,
-2.5610109566546042e-05f,
0.0004394654277689454f,
-0.00032813251941022427f,
-0.001436845304805f,
0.0023012052421511474f,
0.002967996691518064f,
-0.008602921520347815f,
-0.0030429899813869555f,
0.022733676583919053f,
-0.0032709555358783646f,
-0.04692243838937891f,
0.022312336178011833f,
0.08110598665408082f,
-0.05709141963185808f,
-0.12681569177849797f,
0.10113548917744287f,
0.19731058956508457f,
-0.12659975221599248f,
-0.32832074836418546f,
0.027314970403312946f,
0.5183157640572823f,
0.6109966156850273f,
0.3703507241528858f,
0.13121490330791097f,
0.025985393703623173f,
0.00224180700103879f };
break;
case 18:
LoD = new[] { -2.507934454941929e-09f,
3.06883586303703e-08f,
-1.1760987670250871e-07f,
-7.691632689865049e-08f,
1.768712983622886e-06f,
-3.3326344788769603e-06f,
-8.520602537423464e-06f,
3.741237880730847e-05f,
-1.535917123021341e-07f,
-0.00019864855231101547f,
0.0002135815619103188f,
0.0006284656829644715f,
-0.0013405962983313922f,
-0.0011187326669886426f,
0.004943343605456594f,
0.00011863003387493042f,
-0.013051480946517112f,
0.006262167954438661f,
0.026670705926689853f,
-0.023733210395336858f,
-0.04452614190225633f,
0.05705124773905827f,
0.0648872162123582f,
-0.10675224665906288f,
-0.09233188415030412f,
0.16708131276294505f,
0.14953397556500755f,
-0.21648093400458224f,
-0.2936540407357981f,
0.14722311196952223f,
0.571801654887122f,
0.5718268077650818f,
0.31467894133619284f,
0.10358846582214751f,
0.01928853172409497f,
0.0015763102184365595f };
break;
case 19:
LoD = new[] { 8.666848839034483e-10f,
-1.1164020670405678e-08f,
4.636937775802368e-08f,
1.447088298804088e-08f,
-6.86275565779811e-07f,
1.531931476697877e-06f,
3.0109643163099385e-06f,
-1.664017629722462e-05f,
5.105950487090694e-06f,
8.711270467250443e-05f,
-0.00012460079173506306f,
-0.0002606761356811995f,
0.0007358025205041731f,
0.00034180865344939543f,
-0.002687551800734441f,
0.0007689543592242488f,
0.007040747367080495f,
-0.005866922281112195f,
-0.013988388678695632f,
0.019375549889114482f,
0.021623767409452484f,
-0.04567422627778492f,
-0.026501236250778635f,
0.0869067555554507f,
0.02758435062488713f,
-0.14278569504021468f,
-0.03351854190320226f,
0.21234974330662043f,
0.07465226970806647f,
-0.28583863175723145f,
-0.22809139421653665f,
0.2608949526521201f,
0.6017045491300916f,
0.5244363774668862f,
0.26438843174202237f,
0.08127811326580564f,
0.01428109845082521f,
0.0011086697631864314f };
break;
case 20:
LoD = new[] { -2.998836489615753e-10f,
4.05612705554717e-09f,
-1.814843248297622e-08f,
2.0143220235374613e-10f,
2.633924226266962e-07f,
-6.847079596993149e-07f,
-1.0119940100181473e-06f,
7.241248287663791e-06f,
-4.376143862182197e-06f,
-3.710586183390615e-05f,
6.774280828373048e-05f,
0.00010153288973669777f,
-0.0003851047486990061f,
-5.349759844340453e-05f,
0.0013925596193045254f,
-0.0008315621728772474f,
-0.003581494259744107f,
0.00442054238676635f,
0.0067216273018096935f,
-0.013810526137727442f,
-0.008789324924555765f,
0.03229429953011916f,
0.0058746818113949465f,
-0.061722899624668884f,
0.005632246857685454f,
0.10229171917513397f,
-0.024716827337521424f,
-0.1554587507060453f,
0.039850246458519104f,
0.22829105082013823f,
-0.016727088308801888f,
-0.3267868004335376f,
-0.13921208801128787f,
0.36150229873889705f,
0.6104932389378558f,
0.4726961853103315f,
0.21994211355113222f,
0.06342378045900529f,
0.010549394624937735f,
0.0007799536136659112f };
break;
default:
throw new ArgumentException("Only db1-db20 are supported");
}
}
/// <summary>
/// Symlet wavelet
/// </summary>
/// <param name="taps"></param>
public void MakeSymletWavelet(int taps)
{
Name = $"sym{taps}";
Length = 2 * taps;
switch (taps)
{
case 2:
LoD = new[] { -0.12940952255092145f,
0.22414386804185735f,
0.836516303737469f,
0.48296291314469025f };
break;
case 3:
LoD = new[] { 0.035226291882100656f,
-0.08544127388224149f,
-0.13501102001039084f,
0.4598775021193313f,
0.8068915093133388f,
0.3326705529509569f };
break;
case 4:
LoD = new[] { -0.07576571478927333f,
-0.02963552764599851f,
0.49761866763201545f,
0.8037387518059161f,
0.29785779560527736f,
-0.09921954357684722f,
-0.012603967262037833f,
0.0322231006040427f };
break;
case 5:
LoD = new[] { 0.027333068345077982f,
0.029519490925774643f,
-0.039134249302383094f,
0.1993975339773936f,
0.7234076904024206f,
0.6339789634582119f,
0.01660210576452232f,
-0.17532808990845047f,
-0.021101834024758855f,
0.019538882735286728f };
break;
case 6:
LoD = new[] { 0.015404109327027373f,
0.0034907120842174702f,
-0.11799011114819057f,
-0.048311742585633f,
0.4910559419267466f,
0.787641141030194f,
0.3379294217276218f,
-0.07263752278646252f,
-0.021060292512300564f,
0.04472490177066578f,
0.0017677118642428036f,
-0.007800708325034148f };
break;
case 7:
LoD = new[] { 0.002681814568257878f,
-0.0010473848886829163f,
-0.01263630340325193f,
0.03051551316596357f,
0.0678926935013727f,
-0.049552834937127255f,
0.017441255086855827f,
0.5361019170917628f,
0.767764317003164f,
0.2886296317515146f,
-0.14004724044296152f,
-0.10780823770381774f,
0.004010244871533663f,
0.010268176708511255f };
break;
case 8:
LoD = new[] { -0.0033824159510061256f,
-0.0005421323317911481f,
0.03169508781149298f,
0.007607487324917605f,
-0.1432942383508097f,
-0.061273359067658524f,
0.4813596512583722f,
0.7771857517005235f,
0.3644418948353314f,
-0.05194583810770904f,
-0.027219029917056003f,
0.049137179673607506f,
0.003808752013890615f,
-0.01495225833704823f,
-0.0003029205147213668f,
0.0018899503327594609f };
break;
case 9:
LoD = new[] { 0.0014009155259146807f,
0.0006197808889855868f,
-0.013271967781817119f,
-0.01152821020767923f,
0.03022487885827568f,
0.0005834627461258068f,
-0.05456895843083407f,
0.238760914607303f,
0.717897082764412f,
0.6173384491409358f,
0.035272488035271894f,
-0.19155083129728512f,
-0.018233770779395985f,
0.06207778930288603f,
0.008859267493400484f,
-0.010264064027633142f,
-0.0004731544986800831f,
0.0010694900329086053f };
break;
case 10:
LoD = new[] { 0.0007701598091144901f,
9.563267072289475e-05f,
-0.008641299277022422f,
-0.0014653825813050513f,
0.0459272392310922f,
0.011609893903711381f,
-0.15949427888491757f,
-0.07088053578324385f,
0.47169066693843925f,
0.7695100370211071f,
0.38382676106708546f,
-0.03553674047381755f,
-0.0319900568824278f,
0.04999497207737669f,
0.005764912033581909f,
-0.02035493981231129f,
-0.0008043589320165449f,
0.004593173585311828f,
5.7036083618494284e-05f,
-0.0004593294210046588f };
break;
case 11:
LoD = new[] { 0.00017172195069934854f,
-3.8795655736158566e-05f,
-0.0017343662672978692f,
0.0005883527353969915f,
0.00651249567477145f,
-0.009857934828789794f,
-0.024080841595864003f,
0.0370374159788594f,
0.06997679961073414f,
-0.022832651022562687f,
0.09719839445890947f,
0.5720229780100871f,
0.7303435490883957f,
0.23768990904924897f,
-0.2046547944958006f,
-0.1446023437053156f,
0.03526675956446655f,
0.04300019068155228f,
-0.0020034719001093887f,
-0.006389603666454892f,
0.00011053509764272153f,
0.0004892636102619239f };
break;
case 12:
LoD = new[] { 0.00011196719424656033f,
-1.1353928041541452e-05f,
-0.0013497557555715387f,
0.00018021409008538188f,
0.007414965517654251f,
-0.0014089092443297553f,
-0.024220722675013445f,
0.0075537806116804775f,
0.04917931829966084f,
-0.03584883073695439f,
-0.022162306170337816f,
0.39888597239022f,
0.7634790977836572f,
0.46274103121927235f,
-0.07833262231634322f,
-0.17037069723886492f,
0.01530174062247884f,
0.05780417944550566f,
-0.0026043910313322326f,
-0.014589836449234145f,
0.00030764779631059454f,
0.002350297614183465f,
-1.8158078862617515e-05f,
-0.0001790665869750869f };
break;
case 13:
LoD = new[] { 6.820325263075319e-05f,
-3.573862364868901e-05f,
-0.0011360634389281183f,
-0.0001709428585302221f,
0.0075262253899681f,
0.005296359738725025f,
-0.02021676813338983f,
-0.017211642726299048f,
0.013862497435849205f,
-0.0597506277179437f,
-0.12436246075153011f,
0.19770481877117801f,
0.6957391505614964f,
0.6445643839011856f,
0.11023022302137217f,
-0.14049009311363403f,
0.008819757670420546f,
0.09292603089913712f,
0.017618296880653084f,
-0.020749686325515677f,
-0.0014924472742598532f,
0.0056748537601224395f,
0.00041326119884196064f,
-0.0007213643851362283f,
3.690537342319624e-05f,
7.042986690694402e-05f };
break;
case 14:
LoD = new[] { -2.5879090265397886e-05f,
1.1210865808890361e-05f,
0.00039843567297594335f,
-6.286542481477636e-05f,
-0.002579441725933078f,
0.0003664765736601183f,
0.01003769371767227f,
-0.002753774791224071f,
-0.029196217764038187f,
0.004280520499019378f,
0.03743308836285345f,
-0.057634498351326995f,
-0.03531811211497973f,
0.39320152196208885f,
0.7599762419610909f,
0.4753357626342066f,
-0.05811182331771783f,
-0.15999741114652205f,
0.02589858753104667f,
0.06982761636180755f,
-0.002365048836740385f,
-0.019439314263626713f,
0.0010131419871842082f,
0.004532677471945648f,
-7.321421356702399e-05f,
-0.0006057601824664335f,
1.9329016965523917e-05f,
4.4618977991475265e-05f };
break;
case 15:
LoD = new[] { 9.712419737963348e-06f,
-7.35966679891947e-06f,
-0.00016066186637495343f,
5.512254785558665e-05f,
0.0010705672194623959f,
-0.0002673164464718057f,
-0.0035901654473726417f,
0.003423450736351241f,
0.01007997708790567f,
-0.01940501143093447f,
-0.03887671687683349f,
0.021937642719753955f,
0.04073547969681068f,
-0.04108266663538248f,
0.11153369514261872f,
0.5786404152150345f,
0.7218430296361812f,
0.2439627054321663f,
-0.1966263587662373f,
-0.1340562984562539f,
0.06839331006048024f,
0.06796982904487918f,
-0.008744788886477952f,
-0.01717125278163873f,
0.0015261382781819983f,
0.003481028737064895f,
-0.00010815440168545525f,
-0.00040216853760293483f,
2.171789015077892e-05f,
2.866070852531808e-05f };
break;
case 16:
LoD = new[] { 6.230006701220761e-06f,
-3.113556407621969e-06f,
-0.00010943147929529757f,
2.8078582128442894e-05f,
0.0008523547108047095f,
-0.0001084456223089688f,
-0.0038809122526038786f,
0.0007182119788317892f,
0.012666731659857348f,
-0.0031265171722710075f,
-0.031051202843553064f,
0.004869274404904607f,
0.032333091610663785f,
-0.06698304907021778f,
-0.034574228416972504f,
0.39712293362064416f,
0.7565249878756971f,
0.47534280601152273f,
-0.054040601387606135f,
-0.15959219218520598f,
0.03072113906330156f,
0.07803785290341991f,
-0.003510275068374009f,
-0.024952758046290123f,
0.001359844742484172f,
0.0069377611308027096f,
-0.00022211647621176323f,
-0.0013387206066921965f,
3.656592483348223e-05f,
0.00016545679579108483f,
-5.396483179315242e-06f,
-1.0797982104319795e-05f };
break;
case 17:
LoD = new[] { 4.297343327345983e-06f,
2.7801266938414138e-06f,
-6.293702597554192e-05f,
-1.3506383399901165e-05f,
0.0004759963802638669f,
-0.000138642302680455f,
-0.0027416759756816018f,
0.0008567700701915741f,
0.010482366933031529f,
-0.004819212803176148f,
-0.03329138349235933f,
0.01790395221434112f,
0.10475461484223211f,
0.0172711782105185f,
-0.11856693261143636f,
0.1423983504146782f,
0.6507166292045456f,
0.681488995344925f,
0.18053958458111286f,
-0.15507600534974825f,
-0.08607087472073338f,
0.016158808725919346f,
-0.007261634750928767f,
-0.01803889724191924f,
0.009952982523509598f,
0.012396988366648726f,
-0.001905407689852666f,
-0.003932325279797902f,
5.8400428694052584e-05f,
0.0007198270642148971f,
2.520793314082878e-05f,
-7.607124405605129e-05f,
-2.4527163425833e-06f,
3.7912531943321266e-06f };
break;
case 18:
LoD = new[] { 2.6126125564836423e-06f,
1.354915761832114e-06f,
-4.5246757874949856e-05f,
-1.4020992577726755e-05f,
0.00039616840638254753f,
7.021273459036268e-05f,
-0.002313871814506099f,
-0.00041152110923597756f,
0.009502164390962365f,
0.001642986397278216f,
-0.030325091089369604f,
-0.005077085160757053f,
0.08421992997038655f,
0.03399566710394736f,
-0.15993814866932407f,
-0.052029158983952786f,
0.47396905989393956f,
0.7536291401017928f,
0.40148386057061813f,
-0.032480573290138676f,
-0.07379920729060717f,
0.028529597039037808f,
0.006277944554311694f,
-0.03171268473181454f,
-0.0032607442000749834f,
0.015012356344250213f,
0.001087784789595693f,
-0.005239789683026608f,
-0.00018877623940755607f,
0.0014280863270832796f,
4.741614518373667e-05f,
-0.0002658301102424104f,
-9.858816030140058e-06f,
2.955743762093081e-05f,
7.847298055831765e-07f,
-1.5131530692371587e-06f };
break;
case 19:
LoD = new[] { 5.487732768215838e-07f,
-6.463651303345963e-07f,
-1.1880518269823984e-05f,
8.873312173729286e-06f,
0.0001155392333357879f,
-4.612039600210587e-05f,
-0.000635764515004334f,
0.00015915804768084938f,
0.0021214250281823303f,
-0.0011607032572062486f,
-0.005122205002583014f,
0.007968438320613306f,
0.01579743929567463f,
-0.02265199337824595f,
-0.046635983534938946f,
0.0070155738571741596f,
0.008954591173043624f,
-0.06752505804029409f,
0.10902582508127781f,
0.578144945338605f,
0.7195555257163943f,
0.2582661692372836f,
-0.17659686625203097f,
-0.11624173010739675f,
0.09363084341589714f,
0.08407267627924504f,
-0.016908234861345205f,
-0.02770989693131125f,
0.004319351874894969f,
0.008262236955528255f,
-0.0006179223277983108f,
-0.0017049602611649971f,
0.00012930767650701415f,
0.0002762187768573407f,
-1.6821387029373716e-05f,
-2.8151138661550245e-05f,
2.0623170632395688e-06f,
1.7509367995348687e-06f };
break;
case 20:
LoD = new[] { 3.695537474835221e-07f,
-1.9015675890554106e-07f,
-7.919361411976999e-06f,
3.025666062736966e-06f,
7.992967835772481e-05f,
-1.928412300645204e-05f,
-0.0004947310915672655f,
7.215991188074035e-05f,
0.002088994708190198f,
-0.0003052628317957281f,
-0.006606585799088861f,
0.0014230873594621453f,
0.01700404902339034f,
-0.003313857383623359f,
-0.031629437144957966f,
0.008123228356009682f,
0.025579349509413946f,
-0.07899434492839816f,
-0.02981936888033373f,
0.4058314443484506f,
0.75116272842273f,
0.47199147510148703f,
-0.0510883429210674f,
-0.16057829841525254f,
0.03625095165393308f,
0.08891966802819956f,
-0.0068437019650692274f,
-0.035373336756604236f,
0.0019385970672402002f,
0.012157040948785737f,
-0.0006111263857992088f,
-0.0034716478028440734f,
0.0001254409172306726f,
0.0007476108597820572f,
-2.6615550335516086e-05f,
-0.00011739133516291466f,
4.525422209151636e-06f,
1.22872527779612e-05f,
-3.2567026420174407e-07f,
-6.329129044776395e-07f };
break;
default:
throw new ArgumentException("Only sym2-sym20 are supported");
}
}
/// <summary>
/// Coiflet wavelet
/// </summary>
/// <param name="taps"></param>
public void MakeCoifletWavelet(int taps)
{
Name = $"coif{taps}";
Length = 6 * taps;
switch (taps)
{
case 1:
LoD = new[] { -0.01565572813546454f,
-0.0727326195128539f,
0.38486484686420286f,
0.8525720202122554f,
0.3378976624578092f,
-0.0727326195128539f };
break;
case 2:
LoD = new[] { -0.0007205494453645122f,
-0.0018232088707029932f,
0.0056114348193944995f,
0.023680171946334084f,
-0.0594344186464569f,
-0.0764885990783064f,
0.41700518442169254f,
0.8127236354455423f,
0.3861100668211622f,
-0.06737255472196302f,
-0.04146493678175915f,
0.016387336463522112f };
break;
case 3:
LoD = new[] { -3.459977283621256e-05f,
-7.098330313814125e-05f,
0.0004662169601128863f,
0.0011175187708906016f,
-0.0025745176887502236f,
-0.00900797613666158f,
0.015880544863615904f,
0.03455502757306163f,
-0.08230192710688598f,
-0.07179982161931202f,
0.42848347637761874f,
0.7937772226256206f,
0.4051769024096169f,
-0.06112339000267287f,
-0.0657719112818555f,
0.023452696141836267f,
0.007782596427325418f,
-0.003793512864491014f };
break;
case 4:
LoD = new[] { -1.7849850030882614e-06f,
-3.2596802368833675e-06f,
3.1229875865345646e-05f,
6.233903446100713e-05f,
-0.00025997455248771324f,
-0.0005890207562443383f,
0.0012665619292989445f,
0.003751436157278457f,
-0.00565828668661072f,
-0.015211731527946259f,
0.025082261844864097f,
0.03933442712333749f,
-0.09622044203398798f,
-0.06662747426342504f,
0.4343860564914685f,
0.782238930920499f,
0.41530840703043026f,
-0.05607731331675481f,
-0.08126669968087875f,
0.026682300156053072f,
0.016068943964776348f,
-0.0073461663276420935f,
-0.0016294920126017326f,
0.0008923136685823146f };
break;
case 5:
LoD = new[] { -9.517657273819165e-08f,
-1.6744288576823017e-07f,
2.0637618513646814e-06f,
3.7346551751414047e-06f,
-2.1315026809955787e-05f,
-4.134043227251251e-05f,
0.00014054114970203437f,
0.00030225958181306315f,
-0.0006381313430451114f,
-0.0016628637020130838f,
0.0024333732126576722f,
0.006764185448053083f,
-0.009164231162481846f,
-0.01976177894257264f,
0.03268357426711183f,
0.0412892087501817f,
-0.10557420870333893f,
-0.06203596396290357f,
0.4379916261718371f,
0.7742896036529562f,
0.4215662066908515f,
-0.05204316317624377f,
-0.09192001055969624f,
0.02816802897093635f,
0.023408156785839195f,
-0.010131117519849788f,
-0.004159358781386048f,
0.0021782363581090178f,
0.00035858968789573785f,
-0.00021208083980379827f };
break;
default:
throw new ArgumentException("Only coif1-coif5 are supported");
}
}
#endregion
}
}
| 49.672609 | 90 | 0.350023 | [
"Apache-2.0"
] | AIFramework/AIFrameworkOpen | AI/BackEnds/DSP/NWaves/Transforms/Wavelets/Wavelet.cs | 61,298 | C# |
using GainzTrack.Core.Entities;
using GainzTrack.Core.Expressions;
using GainzTrack.Core.Interfaces;
using GainzTrack.Web.Interfaces;
using GainzTrack.Web.ViewModels.HomeViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace GainzTrack.Web.Services
{
public class HomeViewService : IHomeViewService
{
private readonly IRepository _repository;
private readonly IUserService _userService;
private readonly IWorkoutViewService _workoutViewService;
private readonly IUsersViewService _userViewService;
public HomeViewService(IRepository repository,
IUserService userService,
IWorkoutViewService workoutViewService,
IUsersViewService userViewService)
{
_repository = repository;
_userService = userService;
_workoutViewService = workoutViewService;
_userViewService = userViewService;
}
public HomeViewModel GetHomeViewModel(string username)
{
var workouts = _workoutViewService.GetAllWorkoutsPreview().Take(6);
var user = _userViewService.GetUserProfile(username, username);
var nextTitle = _userService.GetNextTitle(user.Title.Name);
double progressPercent = ((double)user.Title.RequiredAP / nextTitle.RequiredAP)* 100;
return new HomeViewModel
{
Profile = user,
NextTitle = nextTitle.Name,
ProgressPercent = progressPercent,
Workouts = workouts
};
}
}
}
| 35.717391 | 97 | 0.673767 | [
"MIT"
] | GalinShterev/GainzTrack | src/GainzTrack.Web/Services/HomeViewService.cs | 1,645 | C# |
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
using Kaitai;
using System.Collections.Generic;
namespace KCD.Library.Tables
{
public partial class Key : KaitaiStruct
{
public static Key FromFile(string fileName)
{
return new Key(new KaitaiStream(fileName));
}
public Key(KaitaiStream p__io, KaitaiStruct p__parent = null, Key p__root = null) : base(p__io)
{
m_parent = p__parent;
m_root = p__root ?? this;
_read();
}
private void _read()
{
_table = new Header(m_io, this, m_root);
_rows = new List<Row>((int) (Table.RowCount));
for (var i = 0; i < Table.RowCount; i++)
{
_rows.Add(new Row(m_io, this, m_root));
}
_strings = new List<string>((int) (Table.UniqueStringsCount));
for (var i = 0; i < Table.UniqueStringsCount; i++)
{
_strings.Add(System.Text.Encoding.GetEncoding("utf-8").GetString(m_io.ReadBytesTerm(0, false, true, true)));
}
}
public partial class Header : KaitaiStruct
{
public static Header FromFile(string fileName)
{
return new Header(new KaitaiStream(fileName));
}
public Header(KaitaiStream p__io, Key p__parent = null, Key p__root = null) : base(p__io)
{
m_parent = p__parent;
m_root = p__root;
_read();
}
private void _read()
{
_version = m_io.ReadS4le();
_descriptorsHash = m_io.ReadU4le();
_layoutHash = m_io.ReadU4le();
_tableVersion = m_io.ReadS4le();
_rowCount = m_io.ReadS4le();
_stringDataSize = m_io.ReadS4le();
_uniqueStringsCount = m_io.ReadS4le();
}
private int _version;
private uint _descriptorsHash;
private uint _layoutHash;
private int _tableVersion;
private int _rowCount;
private int _stringDataSize;
private int _uniqueStringsCount;
private Key m_root;
private Key m_parent;
public int Version { get { return _version; } }
public uint DescriptorsHash { get { return _descriptorsHash; } }
public uint LayoutHash { get { return _layoutHash; } }
public int TableVersion { get { return _tableVersion; } }
public int RowCount { get { return _rowCount; } }
public int StringDataSize { get { return _stringDataSize; } }
public int UniqueStringsCount { get { return _uniqueStringsCount; } }
public Key M_Root { get { return m_root; } }
public Key M_Parent { get { return m_parent; } }
}
public partial class Row : KaitaiStruct
{
public static Row FromFile(string fileName)
{
return new Row(new KaitaiStream(fileName));
}
public Row(KaitaiStream p__io, Key p__parent = null, Key p__root = null) : base(p__io)
{
m_parent = p__parent;
m_root = p__root;
_read();
}
private void _read()
{
_itemId = m_io.ReadBytes(16);
_keyTypeId = m_io.ReadS4le();
_keySubtypeId = m_io.ReadS4le();
}
private byte[] _itemId;
private int _keyTypeId;
private int _keySubtypeId;
private Key m_root;
private Key m_parent;
public byte[] ItemId { get { return _itemId; } }
public int KeyTypeId { get { return _keyTypeId; } }
public int KeySubtypeId { get { return _keySubtypeId; } }
public Key M_Root { get { return m_root; } }
public Key M_Parent { get { return m_parent; } }
}
private Header _table;
private List<Row> _rows;
private List<string> _strings;
private Key m_root;
private KaitaiStruct m_parent;
public Header Table { get { return _table; } }
public List<Row> Rows { get { return _rows; } }
public List<string> Strings { get { return _strings; } }
public Key M_Root { get { return m_root; } }
public KaitaiStruct M_Parent { get { return m_parent; } }
}
}
| 38.420168 | 124 | 0.539589 | [
"MIT"
] | Scrivener07/Kingdom-Come | Source/KCD.Kaitai/Tables/Key.cs | 4,572 | C# |
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using RandomchaosMGBase.BaseClasses;
namespace RandomchaosGeoClipMapping.Terrain.GeoClipMapping
{
public enum GeoClipMapRenderTypesEnum
{
Textured,
FlatWireFrame,
WireFrame
}
public class GeoClipMapCentre : DrawableGameComponent
{
protected GeoClipMapFootPrintBlock block;
protected Effect effect;
public Vector3 Position = Vector3.Zero;
public Vector3 Scale = Vector3.One;
public Quaternion Orientation = Quaternion.Identity;
public Matrix World = Matrix.Identity;
protected GeoClipMapRenderTypesEnum _RenderType = GeoClipMapRenderTypesEnum.Textured;
protected string effectToLoad = string.Empty;
public GeoClipMapRenderTypesEnum RenderType
{
get { return _RenderType; }
set
{
_RenderType = value;
switch (_RenderType)
{
case GeoClipMapRenderTypesEnum.Textured:
effectToLoad = "Shaders/GeoClipMapLayer";
break;
case GeoClipMapRenderTypesEnum.FlatWireFrame:
effectToLoad = "Shaders/GeoClipMapLayer_FlatWire";
break;
case GeoClipMapRenderTypesEnum.WireFrame:
effectToLoad = "Shaders/GeoClipMapLayer_HeightWire";
break;
}
}
}
protected Base3DCamera camera
{
get { return (Base3DCamera)Game.Services.GetService(typeof(Base3DCamera)); }
}
public GeoClipMapCentre(Game game, short n) : base(game)
{
short m = (short)((n + 1) / 4);
short edge = (short)((n / 2) - 1);
block = new GeoClipMapFootPrintBlock(game, n);
block.Position = new Vector3(-edge, 0, -edge);
block.color = Color.MintCream;
}
public override void Initialize()
{
base.Initialize();
block.Initialize();
}
protected override void LoadContent()
{
effect = Game.Content.Load<Effect>(effectToLoad);
}
public override void Update(GameTime gameTime)
{
World = Matrix.CreateScale(Scale) * Matrix.CreateFromQuaternion(Orientation) * Matrix.CreateTranslation(Position);
base.Update(gameTime);
block.Update(gameTime);
}
public override void Draw(GameTime gameTime)
{
effect.Parameters["world"].SetValue(World);
effect.Parameters["wvp"].SetValue(World * camera.View * camera.Projection);
effect.CurrentTechnique.Passes[0].Apply();
//if (camera.Frustum.Intersects(block.getBounds(World)))
block.Draw(gameTime);
}
public void Rotate(Vector3 axis, float angle)
{
axis = Vector3.Transform(axis, Matrix.CreateFromQuaternion(Orientation));
Orientation = Quaternion.Normalize(Quaternion.CreateFromAxisAngle(axis, angle) * Orientation);
}
}
}
| 30.714286 | 126 | 0.583256 | [
"MIT"
] | Lajbert/Randomchaos-MonoGame-Samples | Sandboxs/Terrain/RandomchaosGeoClipMapping/Terrain/GeoClipMapping/GeoClipMapCentre.cs | 3,227 | C# |
//-----------------------------------------------------------------------------
// Copyright : (c) Chris Moore, 2020
// License : MIT
//-----------------------------------------------------------------------------
namespace Z0
{
using System;
using System.Runtime.CompilerServices;
using static Root;
partial struct Relations
{
[MethodImpl(Inline), Op]
public static bool eq(ArrowType a, ArrowType b)
=> a.Source == b.Source && a.Target == b.Target;
[Op]
public static uint hash32(ArrowType src)
=> alg.hash.calc(src.Source) ^ alg.hash.calc(src.Target) ^ alg.hash.calc(src.Kind);
}
} | 30.636364 | 95 | 0.452522 | [
"BSD-3-Clause"
] | 0xCM/z0 | src/relations/src/ops/eq.cs | 674 | C# |
using DemoCrossSiteScripting.Shared;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace DemoCrossSiteScripting.Server.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}
| 29.219512 | 110 | 0.614357 | [
"Apache-2.0"
] | jp-gouigoux/DemoCrossSiteScripting | DemoCrossSiteScripting/Server/Controllers/WeatherForecastController.cs | 1,200 | C# |
using System.Reflection;
[assembly: AssemblyTitle("Nito.AsyncEx Enlightenment for .NET 4.5")]
| 24 | 68 | 0.770833 | [
"Apache-2.0"
] | algoadv/ably-dotnet | src/external/Nito.AsyncEx.Enlightenment/Properties/AssemblyInfo.cs | 98 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using Harmony;
using BattleTech;
using PracticeMakesPerfect.Framework;
using static PracticeMakesPerfect.Framework.GlobalVars;
using BattleTech.UI;
using BattleTech.UI.TMProWrapper;
using UnityEngine;
namespace PracticeMakesPerfect.Patches
{
public class ShopPatches
{
[HarmonyPatch(typeof(SimGameState), "GetReputationShopAdjustment", new Type[] {typeof(FactionValue)})]
public static class SGS_GetReputationShopAdjustmentFV_Patch
{
public static void Postfix(SimGameState __instance, ref float __result, FactionValue faction)
{
if (GlobalVars.sim == null) return;
var curPilots = new List<string> {GlobalVars.sim.Commander.FetchGUID()};
foreach (var p in GlobalVars.sim.PilotRoster)
{
SpecHolder.HolderInstance.AddToMaps(p);
curPilots.Add(p.FetchGUID());
}
var discount = 0f;
foreach (var opSpec in from pKey in curPilots where SpecHolder.HolderInstance.OpForSpecMap.ContainsKey(pKey) from spec in SpecHolder.HolderInstance.OpForSpecMap[pKey] select SpecManager.ManagerInstance.OpForSpecList.FirstOrDefault(x => x.OpForSpecID == spec) into opSpec where opSpec.storeDiscount.ContainsKey(faction.Name) select opSpec)
{
discount += opSpec.storeDiscount[faction.Name];
ModInit.modLog.LogMessage($"Current discount from specs: {discount}");
}
ModInit.modLog.LogMessage($"Total discount from specs: {discount}");
__result += discount;
}
}
[HarmonyPatch(typeof(SG_Shop_Screen), "AddShopItemToWidget",
new Type[] {typeof(ShopDefItem), typeof(Shop), typeof(IMechLabDropTarget), typeof(bool), typeof(bool)})]
public static class SH_Shop_Screen_AddShopItemToWidget
{
[HarmonyPriority(Priority.First)]
public static void Prefix(SG_Shop_Screen __instance, StarSystem ___theSystem, ShopDefItem itemDef, Shop shop, //removed ref from shopdefitem?
IMechLabDropTarget targetWidget, bool isSelling = false, bool isBulkAdd = false)
{
if (GlobalVars.sim == null) return;
if (!isSelling) return;
var curPilots = new List<string> {GlobalVars.sim.Commander.FetchGUID()};
foreach (var p in GlobalVars.sim.PilotRoster)
{
SpecHolder.HolderInstance.AddToMaps(p);
curPilots.Add(p.FetchGUID());
}
var sellBonus = 1f;
string shopOwner;
if (shop.ThisShopType == Shop.ShopType.BlackMarket)
{
shopOwner = FactionEnumeration.GetAuriganPiratesFactionValue().Name;
ModInit.modLog.LogMessage($"System: {___theSystem.Name}. shopOwner: {shopOwner}");
}
else
{
shopOwner = sim.CurSystem.Def.OwnerValue.Name;
//shopOwner = Traverse.Create(shop).Field("system").GetValue<StarSystem>().Def.OwnerValue.Name;
ModInit.modLog.LogMessage($"System: {___theSystem.Name}. shopOwner: {shopOwner}");
}
foreach (var pKey in curPilots)
{
if (SpecHolder.HolderInstance.OpForSpecMap.ContainsKey(pKey))
{
foreach (var spec in SpecHolder.HolderInstance.OpForSpecMap[pKey])
{
var opSpec =
SpecManager.ManagerInstance.OpForSpecList.FirstOrDefault(x => x.OpForSpecID == spec);
if (opSpec != null && opSpec.storeBonus.ContainsKey(shopOwner))
{
sellBonus += opSpec.storeBonus[shopOwner];
ModInit.modLog.LogMessage($"Current sell multiplier from specs: {sellBonus}");
}
}
}
}
ModInit.modLog.LogMessage($"Total sell multiplier from specs: {sellBonus}");
ModInit.modLog.LogMessage($"Original sell price: {itemDef.SellCost}");
var cost = itemDef.SellCost * sellBonus;
ModInit.modLog.LogMessage($"Final sell price: {cost}");
itemDef.SellCost = Mathf.RoundToInt(cost);
}
}
[HarmonyPatch(typeof(SG_Stores_MiniFactionWidget), "FillInData",
new Type[] {typeof(FactionValue)})]
public static class SG_Stores_MiniFactionWidget_FillInData_Patch
{
public static void Postfix(SG_Stores_MiniFactionWidget __instance, FactionValue theFaction, FactionValue ___owningFactionValue, LocalizableText ___ReputationBonusText)
{
if (GlobalVars.sim == null) return;
var sellBonus = 0f;
var curPilots = new List<string>();
curPilots.Add(GlobalVars.sim.Commander.FetchGUID());
foreach (var p in GlobalVars.sim.PilotRoster)
{
SpecHolder.HolderInstance.AddToMaps(p);
curPilots.Add(p.FetchGUID());
}
foreach (var pKey in curPilots)
{
if (SpecHolder.HolderInstance.OpForSpecMap.ContainsKey(pKey))
{
foreach (var spec in SpecHolder.HolderInstance.OpForSpecMap[pKey])
{
var opSpec =
SpecManager.ManagerInstance.OpForSpecList.FirstOrDefault(x => x.OpForSpecID == spec);
if (opSpec != null && opSpec.storeBonus.ContainsKey(___owningFactionValue.Name))
{
sellBonus += opSpec.storeBonus[___owningFactionValue.Name];
ModInit.modLog.LogMessage($"Current sell multiplier from specs: {sellBonus}");
}
}
}
}
if (sellBonus == 0f) return;
___ReputationBonusText.AppendTextAndRefresh(", {0}% Sell Bonus", new object[]
{
Mathf.RoundToInt(sellBonus * 100f)
});
}
}
}
}
| 47.042553 | 354 | 0.552239 | [
"MIT"
] | ajkroeg/PracticeMakesPerfect | Patches/ShopPatches.cs | 6,635 | C# |
Subsets and Splits