Пример #1
0
 public void StopEmotion(Kind k)
 {
     if( emotionRequests.Contains(k) ) {
         emotionRequests.RemoveAll(x => x == k);
         _PlayEmotionOfLastCapables();
     }
 }
Пример #2
0
 private bool _IsOnceAnimation(Kind k)
 {
     switch(k) {
     case Kind.Exclamation:
         return true;
     case Kind.Question:
         return true;
     case Kind.Berserk:
         return false;
     case Kind.Hungry:
         return false;
     case Kind.Kirakira:
         return false;
     case Kind.Ohana:
         return false;
     case Kind.Onpu:
         return true;
     case Kind.Paralize:
         return false;
     case Kind.Poison:
         return false;
     case Kind.Sleep:
         return false;
     case Kind.Star:
         return false;
     case Kind.Wakatta:
         return true;
     }
     return false;
 }
Пример #3
0
 /// <summary>
 /// Writes a binary field to data file.
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="kind"></param>
 /// <param name="offset"></param>
 /// <param name="v"></param>
 public static void BinWrite(FileStream stream, Kind kind, long offset, object v)
 {
     var v_str = v.ToString();
     stream.Position = offset;
     var writer = new BinaryWriter(stream);
     switch (kind)
     {
         case Kind.Byte:
             writer.Write(byte.Parse(v_str));
             break;
         case Kind.Int16:
             writer.Write(short.Parse(v_str));
             break;
         case Kind.Int32:
             writer.Write(int.Parse(v_str));
             break;
         case Kind.Int64:
             writer.Write(long.Parse(v_str));
             break;
         case Kind.Single:
             writer.Write(float.Parse(v_str));
             break;
         case Kind.Double:
             writer.Write(double.Parse(v_str));
             break;
         default:
             throw new Exception("Invalid type code.");
     }
     writer.Flush();
 }
Пример #4
0
		public static int ChangeKind(int sourceKId, Kind kind)
		{
			if (sourceKId == InvalidKId)
				return InvalidKId;

			return sourceKId & 0x00ffffff | (int)kind;
		}
Пример #5
0
 internal void SwitchKind()
 {
     if (!changed)
     {
         if ((int)kind < 2)
         {
             kind++;
         }
         else
         {
             kind = (Kind)0;
         }
         switch (kind)
         {
             case Kind.Rock:
                 couleur = Color.Red;
                 chiffre = 0;
                 break;
             case Kind.Turret:
                 couleur = Color.Green;
                 chiffre = 2;
                 break;
             case Kind.Creep:
                 couleur = Color.White;
                 chiffre = 1;
                 break;
             default:
                 break;
         }
         changed = true;
     }
 }
Пример #6
0
 public Card(int kind, int rank)
 {
     _kind = (Kind)kind;
     _rank = (CardRank)rank;
     _image = new Image();
     _image.Stretch = Stretch.Fill;
 }
Пример #7
0
    /// <summary>
    /// Translate the skin string, create the skin string if not found.
    /// </summary>
    /// <param name="line"></param>
    /// <param name="kind"></param>
    /// <returns></returns>
    public static int TranslateSkinString(string line, Kind kind)
    {
      Dictionary<int, SkinString>.Enumerator enumer = _skinStringSettings.GetEnumerator();
      while (enumer.MoveNext())
      {
        SkinString skin = enumer.Current.Value;
        if (skin.Name == line)
        {
          return enumer.Current.Key;
        }
      }

      SkinString newString = new SkinString();
      newString.Name = line;
      newString.Value = line;
      newString.Kind = kind;

      // Create the setting as a property if not already present.
      if (!GUIPropertyManager.PropertyIsDefined(newString.Name))
      {
        GUIPropertyManager.SetProperty(newString.Name, newString.Value);
      }
      else
      {
        newString.Value = GUIPropertyManager.GetProperty(newString.Name);
      }

      int key;
      lock (_skinStringSettings) //Lock the dictionary, it might be getting saved at the moment
      {
        key = _skinStringSettings.Count;
        _skinStringSettings[key] = newString;
      }
      return key;
    }
Пример #8
0
 private object CreateSinkOrSource(Kind kind, bool isOut)
 { 
     switch (kind)
     {
         case Kind.Stream:
             return isOut ? new MemoryStream() : new MemoryStream(Encoding.Default.GetBytes(Content));
         case Kind.File:
             var path = GetPath(isOut);
             if (!isOut)
             {
                 File.WriteAllText(path, Content);
             }
             return new FileInfo(path);
         case Kind.ReaderWriter:
             return isOut ? new StringWriter() : new StringReader(Content).As<object>();
         case Kind.String:
             return Content;
         case Kind.Chars:
             return isOut ? new List<char>() : Content.ToCharArray().As<object>();
         case Kind.Lines:
             return isOut ? new List<string>() : Content.Split(new[] { Environment.NewLine }, StringSplitOptions.None).As<object>();
         default:
             throw new InvalidOperationException();
     }
 }
Пример #9
0
        public void AddStat(Kind kind, int amount, int turn)
        {
            if(turn >= MAX_TURNS)
                throw new Exception("Statistic can have only " + MAX_TURNS + " columns");

            statistic[(int)kind][turn] += amount;
        }
Пример #10
0
 //     INITIALIZATION
 //_________________________________________________________________________________________
 /// <summary>
 /// Creates a new map iterator.
 /// </summary>
 /// <param name="prototype"> The next object in the prototype chain. </param>
 /// <param name="map"> The map to iterate over. </param>
 /// <param name="list"> The linked list to iterate over. </param>
 /// <param name="kind"> The type of values to return. </param>
 internal MapIterator(ObjectInstance prototype, MapInstance map, LinkedList<KeyValuePair<object, object>> list, Kind kind)
     : base(prototype)
 {
     this.map = map;
     this.map.BeforeDelete += Map_BeforeDelete;
     this.list = list;
     this.kind = kind;
 }
Пример #11
0
 public Outcome(string type, Kind kind, Vector vector, string message, int nesting = 0)
 {
     this.Type = type;
     this.Kind = kind;
     this.Vector = vector;
     this.Message = message;
     this.Nesting = nesting;
 }
Пример #12
0
 //     INITIALIZATION
 //_________________________________________________________________________________________
 /// <summary>
 /// Creates a new set iterator.
 /// </summary>
 /// <param name="prototype"> The next object in the prototype chain. </param>
 /// <param name="set"> The set to iterate over. </param>
 /// <param name="list"> The linked list to iterate over. </param>
 /// <param name="kind"> The type of values to return. </param>
 internal SetIterator(ObjectInstance prototype, SetInstance set, LinkedList<object> list, Kind kind)
     : base(prototype)
 {
     this.set = set;
     this.set.BeforeDelete += Set_BeforeDelete;
     this.list = list;
     this.kind = kind;
 }
Пример #13
0
 public VariableDeclaration(string name, string type, bool isArray,
     Kind kind, int row, int col)
     : base(name, type, isArray, row, col)
 {
     VariableKind = kind;
     LocalIndex = 0;
     Used = false;
 }
Пример #14
0
 public CleanupWorkItem(Kind task, string relativePath, string physicalPath)
 {
     this.task = task;
     this.relativePath = relativePath;
     this.physicalPath = physicalPath;
     if (this.relativePath.StartsWith("/")) {
         Debug.WriteLine("Invalid relativePath value - should never have leading slash!");
     }
 }
Пример #15
0
        public Concept(string name, Kind kind)
        {
            id = 0;
            this.name = name;

            this.kind = kind;

            loaded = false;
        }
Пример #16
0
 public void Add(string type, Kind kind, Vector vector, string message, params object[] args)
 {
     Outcome outcome;
     outcome.Type = type;
     outcome.Vector = vector;
     outcome.Message = string.Format(message, args);
     outcome.Kind = kind;
     outcome.Nesting = this.nesting;
     Outcomes.Add(outcome);
 }
Пример #17
0
 public Weapon(Kind kind, string name, string modelName, int baseDamage, float attackInterval, string attackSound, Vector3 firstPersonPosition)
 {
     this.WeaponKind = kind;
     this.Name = name;
     this.ModelName = modelName;
     this.BaseDamage = baseDamage;
     this.AttackInterval = attackInterval;
     this.AttackSound = attackSound;
     this.FirstPersonPosition = firstPersonPosition;
 }
Пример #18
0
        public override Style FromString(string s)
        {
            s = s.Trim();

            Kind result;
            if (!Enum.TryParse<Kind>(s, true, out result))
                throw new Exception("Invalid white-space value: " + s);

            this.Value = result;
            return this;
        }
Пример #19
0
        public RangedWeapon(Kind kind, string name, string modelName, int baseDamage, float attackInterval, string attackSound, Vector3 firstPersonPosition,
			float minInaccuracy, float maxInaccuracy, float inaccuracyGrowth, float maxRecoil, float recoilGrowth, Vector3 MuzzleFlashPosition)
            : base(kind, name, modelName, baseDamage, attackInterval, attackSound, firstPersonPosition)
        {
            this.MinInaccuracy = minInaccuracy;
            this.MaxInaccuracy = maxInaccuracy;
            this.InaccuracyGrowth = inaccuracyGrowth;
            this.MaxRecoil = maxRecoil;
            this.RecoilGrowth = recoilGrowth;
            this.MuzzleFlashPosition = MuzzleFlashPosition;
        }
Пример #20
0
 public void PlayEmotion(Kind k)
 {
     if( _IsOnceAnimation(k) ) {
         StartCoroutine(_PlayOnceAnimation(k));
     } else {
         if( !emotionRequests.Contains(k) ) {
             emotionRequests.Add(k);
             _PlayEmotionOfLastCapables();
         }
     }
 }
Пример #21
0
 public Move(string name, string description, int damage, int accuracy, int uses, Kind kind, Type type)
 {
     Name = name;
     Description = description;
     BaseDamage = damage;
     Accuracy = accuracy;
     Uses = uses;
     MaxUses = uses;
     Kind = kind;
     Type = type;
 }
Пример #22
0
        public Card(Kind kind, CardRank rank, bool trump)
        {
            _trump = trump;
            _kind = kind;
            _rank = rank;
            _image = new Image();
            _image.Stretch = Stretch.Fill;

            //Uri uri = new Uri("/images/c14.png", UriKind.Relative);
            //System.Diagnostics.Debug.WriteLine(uri);
            //_image.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(uri);
                //"images/"+_kind.ToString()+_rank.ToString()+".png", UriKind.Relative)); ;
        }
Пример #23
0
 public Card(Image im)
 {
     string name = im.Name;
     name = name.Trim();
     string kind = name.Substring(0, 1);
     Kind kindVal = (Kind)Enum.Parse(typeof(Kind), kind);
     string rank = name.Substring(1, name.Length - 1);
     CardRank rankVal = (CardRank)Enum.Parse(typeof(CardRank), rank);
     _kind = kindVal;
     _rank = rankVal;
     _image = new Image();
     _image.Stretch = Stretch.Fill;
 }
Пример #24
0
 public Move(string name, string description, int damage, int accuracy, int uses, ModApplyer hitModifier, ModApplyer missModifier, Kind kind, Type type)
 {
     Name = name;
     Description = description;
     BaseDamage = damage;
     Accuracy = accuracy;
     Uses = uses;
     MaxUses = uses;
     HitModifier = hitModifier;
     MissModifier = missModifier;
     Kind = kind;
     Type = type;
 }
    public static StatusModifier CreateStatus(Kind k)
    {
        switch(k) {
        case Kind.Poison:
            return ScriptableObject.CreateInstance<StatusPoison>();
        case Kind.Paralized:
            return ScriptableObject.CreateInstance<StatusParalized>();
        case Kind.Sleep:
            return ScriptableObject.CreateInstance<StatusSleep>();
        }

        return null;
    }
Пример #26
0
		public MoonlightTypeConverter (string propertyName, Type destinationType)
		{
			this.propertyName = propertyName;
			this.destinationType = destinationType;

			destinationKind = Deployment.Current.Types.TypeToKind (destinationType);
			if (destinationKind == Kind.INVALID)
				throw new InvalidOperationException (string.Format ("Cannot convert to type {0} (property {1})", destinationType, propertyName));

			var nullable = Nullable.GetUnderlyingType (destinationType);
			if (nullable != null) {
				this.destinationType = nullable;
				nullableDestination = true;
			}
		}
Пример #27
0
		private GraphicsContext(IntPtr nativePointer, Kind kind)
		{
			switch ((int)kind)
			{
				case (int)Kind.NextStep:
					this.nativePointer = ObjectiveC.RetainObject(nativePointer);
					break;
//				case (int)Kind.CoreGraphics:
//					graphicsPort = nativePointer;
//					break;
//				case (int)Kind.CoreImage:
//					ciNativePointer = nativePointer;
//					break;
			}
		}
Пример #28
0
		public Palette(Color32[] cs, string name, Kind k, Is blindSafe, Is printSafe, Is xeroxSafe, Is panelSafe) {
			this.colors = cs;
			this.colorsReverse = new Color32[cs.Length];
			this.colors.CopyTo(this.colorsReverse, 0);
			Array.Reverse(this.colorsReverse);
			this.name = name;
			this.kind = k;
			this.blind = blindSafe;
			this.print = printSafe;
			this.xerox = xeroxSafe;
			this.panel = panelSafe;
			this.size = cs.Length;
			this.index = 0;
			this.hash = name + size;
		}
 public QuerySelectionParameter(string Name, string FieldName, string DescriptionText, int Length, bool Obligatory, bool NoDisplay, Kind Kind)
 {
     this._Name = "";
     this._FieldName = "";
     this._DescriptionText = "";
     this._ABAPType = "C";
     this._Ranges = new RangeCollection();
     this.Name = Name;
     this.FieldName = FieldName;
     this.DescriptionText = DescriptionText;
     this.Length = Length;
     this.Obligatory = Obligatory;
     this.NoDisplay = NoDisplay;
     this.Kind = Kind;
 }
Пример #30
0
        }//constructor

         public void setTrump() { 
            Random r = new Random();
            int i = r.Next(4);
            switch (i)
            {
                case 1:
                    _trump = Kind.c; break;
                case 2:
                    _trump = Kind.d; break;
                case 3:
                    _trump = Kind.h; break;
                default:
                    _trump = Kind.s; break;
            }
         }
Пример #31
0
 public Chocolate(Kind chocoKind, DateTime dateProduced)
 { //constructor used when producing from factory
     DateProduced = dateProduced;
 }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (Optional.IsDefined(Identity))
     {
         writer.WritePropertyName("identity");
         writer.WriteObjectValue(Identity);
     }
     writer.WritePropertyName("location");
     writer.WriteStringValue(Location);
     if (Optional.IsCollectionDefined(Tags))
     {
         writer.WritePropertyName("tags");
         writer.WriteStartObject();
         foreach (var item in Tags)
         {
             writer.WritePropertyName(item.Key);
             writer.WriteStringValue(item.Value);
         }
         writer.WriteEndObject();
     }
     writer.WritePropertyName("kind");
     writer.WriteStringValue(Kind.ToString());
     writer.WritePropertyName("properties");
     writer.WriteStartObject();
     if (Optional.IsDefined(ContainerSettings))
     {
         writer.WritePropertyName("containerSettings");
         writer.WriteObjectValue(ContainerSettings);
     }
     if (Optional.IsDefined(StorageAccountSettings))
     {
         writer.WritePropertyName("storageAccountSettings");
         writer.WriteObjectValue(StorageAccountSettings);
     }
     if (Optional.IsDefined(CleanupPreference))
     {
         writer.WritePropertyName("cleanupPreference");
         writer.WriteStringValue(CleanupPreference.Value.ToString());
     }
     if (Optional.IsDefined(PrimaryScriptUri))
     {
         writer.WritePropertyName("primaryScriptUri");
         writer.WriteStringValue(PrimaryScriptUri);
     }
     if (Optional.IsCollectionDefined(SupportingScriptUris))
     {
         writer.WritePropertyName("supportingScriptUris");
         writer.WriteStartArray();
         foreach (var item in SupportingScriptUris)
         {
             writer.WriteStringValue(item);
         }
         writer.WriteEndArray();
     }
     if (Optional.IsDefined(ScriptContent))
     {
         writer.WritePropertyName("scriptContent");
         writer.WriteStringValue(ScriptContent);
     }
     if (Optional.IsDefined(Arguments))
     {
         writer.WritePropertyName("arguments");
         writer.WriteStringValue(Arguments);
     }
     if (Optional.IsCollectionDefined(EnvironmentVariables))
     {
         writer.WritePropertyName("environmentVariables");
         writer.WriteStartArray();
         foreach (var item in EnvironmentVariables)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (Optional.IsDefined(ForceUpdateTag))
     {
         writer.WritePropertyName("forceUpdateTag");
         writer.WriteStringValue(ForceUpdateTag);
     }
     writer.WritePropertyName("retentionInterval");
     writer.WriteStringValue(RetentionInterval, "P");
     if (Optional.IsDefined(Timeout))
     {
         writer.WritePropertyName("timeout");
         writer.WriteStringValue(Timeout.Value, "P");
     }
     writer.WritePropertyName("azPowerShellVersion");
     writer.WriteStringValue(AzPowerShellVersion);
     writer.WriteEndObject();
     writer.WriteEndObject();
 }
Пример #33
0
 /// <summary>
 /// Returns the Option info as a string
 /// </summary>
 /// <returns>
 /// A <see cref="System.String"/>
 /// </returns>
 public override string ToString()
 {
     return("[" + Kind.ToString() + ": MD5Digest=0x" + MD5Digest.ToString() + "]");
 }
        public unsafe TraceManagerLocalHelper(DkmProcess process, Kind kind)
        {
            _process  = process;
            _pyrtInfo = process.GetPythonRuntimeInfo();

            _traceFunc         = _pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("TraceFunc");
            _pyTracingPossible = _pyrtInfo.DLLs.Python.GetStaticVariable <UInt32Proxy>("_Py_TracingPossible");

            if (kind == Kind.StepIn)
            {
                var fieldOffsets = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <CliStructProxy <FieldOffsets> >("fieldOffsets");
                fieldOffsets.Write(new FieldOffsets(process, _pyrtInfo));

                var types = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <CliStructProxy <Types> >("types");
                types.Write(new Types(process, _pyrtInfo));

                var functionPointers = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <CliStructProxy <FunctionPointers> >("functionPointers");
                functionPointers.Write(new FunctionPointers(process, _pyrtInfo));

                var stringEquals = _pyrtInfo.DLLs.DebuggerHelper.GetExportedStaticVariable <PointerProxy>("stringEquals");
                if (_pyrtInfo.LanguageVersion <= PythonLanguageVersion.V27)
                {
                    stringEquals.Write(_pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("StringEquals27").GetPointer());
                }
                else
                {
                    stringEquals.Write(_pyrtInfo.DLLs.DebuggerHelper.GetExportedFunctionAddress("StringEquals33").GetPointer());
                }

                foreach (var interp in PyInterpreterState.GetInterpreterStates(process))
                {
                    foreach (var tstate in interp.GetThreadStates())
                    {
                        RegisterTracing(tstate);
                    }
                }

                _handlers = new PythonDllBreakpointHandlers(this);
                LocalComponent.CreateRuntimeDllFunctionExitBreakpoints(_pyrtInfo.DLLs.Python, "new_threadstate", _handlers.new_threadstate, enable: true);
                LocalComponent.CreateRuntimeDllFunctionExitBreakpoints(_pyrtInfo.DLLs.Python, "PyErr_SetObject", _handlers.PyErr_SetObject, enable: true);
                if (_pyrtInfo.LanguageVersion <= PythonLanguageVersion.V27)
                {
                    LocalComponent.CreateRuntimeDllFunctionExitBreakpoints(_pyrtInfo.DLLs.Python, "do_raise", _handlers.do_raise, enable: true);
                }

                foreach (var methodInfo in _handlers.GetType().GetMethods())
                {
                    var stepInAttr = (StepInGateAttribute)Attribute.GetCustomAttribute(methodInfo, typeof(StepInGateAttribute));
                    if (stepInAttr != null &&
                        (stepInAttr.MinVersion == PythonLanguageVersion.None || _pyrtInfo.LanguageVersion >= stepInAttr.MinVersion) &&
                        (stepInAttr.MaxVersion == PythonLanguageVersion.None || _pyrtInfo.LanguageVersion <= stepInAttr.MaxVersion))
                    {
                        var handler = (StepInGateHandler)Delegate.CreateDelegate(typeof(StepInGateHandler), _handlers, methodInfo);
                        AddStepInGate(handler, _pyrtInfo.DLLs.Python, methodInfo.Name, stepInAttr.HasMultipleExitPoints);
                    }
                }

                if (_pyrtInfo.DLLs.CTypes != null)
                {
                    OnCTypesLoaded(_pyrtInfo.DLLs.CTypes);
                }
            }
        }
Пример #35
0
 /// <summary>Initializes a new instance of the <see cref="MetricValueColumn"/> class.</summary>
 /// <param name="metric">The metric information.</param>
 /// <param name="kind">The kind of value to display.</param>
 public MetricValueColumn([NotNull] MetricInfo metric, Kind kind) :
     this(null, metric, kind)
 {
 }
Пример #36
0
 private StringConverter(Kind kind)
 {
     _kind = kind;
 }
Пример #37
0
 public UnRedo(Kind kindOfUnRedo, SubnetClass Subnet)
 {
     kind   = kindOfUnRedo;
     subnet = Subnet;
 }
        internal static StorageAccountData DeserializeStorageAccountData(JsonElement element)
        {
            Optional <Models.Sku>             sku              = default;
            Optional <Kind>                   kind             = default;
            Optional <ManagedServiceIdentity> identity         = default;
            Optional <ExtendedLocation>       extendedLocation = default;
            IDictionary <string, string>      tags             = default;
            AzureLocation                location              = default;
            ResourceIdentifier           id                  = default;
            string                       name                = default;
            ResourceType                 type                = default;
            SystemData                   systemData          = default;
            Optional <ProvisioningState> provisioningState   = default;
            Optional <Endpoints>         primaryEndpoints    = default;
            Optional <string>            primaryLocation     = default;
            Optional <AccountStatus>     statusOfPrimary     = default;
            Optional <DateTimeOffset>    lastGeoFailoverTime = default;
            Optional <string>            secondaryLocation   = default;
            Optional <AccountStatus>     statusOfSecondary   = default;
            Optional <DateTimeOffset>    creationTime        = default;
            Optional <CustomDomain>      customDomain        = default;
            Optional <SasPolicy>         sasPolicy           = default;
            Optional <KeyPolicy>         keyPolicy           = default;
            Optional <KeyCreationTime>   keyCreationTime     = default;
            Optional <Endpoints>         secondaryEndpoints  = default;
            Optional <Encryption>        encryption          = default;
            Optional <AccessTier>        accessTier          = default;
            Optional <AzureFilesIdentityBasedAuthentication> azureFilesIdentityBasedAuthentication = default;
            Optional <bool>                 supportsHttpsTrafficOnly = default;
            Optional <NetworkRuleSet>       networkAcls          = default;
            Optional <bool>                 isSftpEnabled        = default;
            Optional <bool>                 isLocalUserEnabled   = default;
            Optional <bool>                 isHnsEnabled         = default;
            Optional <GeoReplicationStats>  geoReplicationStats  = default;
            Optional <bool>                 failoverInProgress   = default;
            Optional <LargeFileSharesState> largeFileSharesState = default;
            Optional <IReadOnlyList <PrivateEndpointConnectionData> > privateEndpointConnections = default;
            Optional <RoutingPreference> routingPreference = default;
            Optional <BlobRestoreStatus> blobRestoreStatus = default;
            Optional <bool> allowBlobPublicAccess          = default;
            Optional <MinimumTlsVersion> minimumTlsVersion = default;
            Optional <bool> allowSharedKeyAccess           = default;
            Optional <bool> isNfsV3Enabled = default;
            Optional <bool> allowCrossTenantReplication                       = default;
            Optional <bool> defaultToOAuthAuthentication                      = default;
            Optional <PublicNetworkAccess>     publicNetworkAccess            = default;
            Optional <ImmutableStorageAccount> immutableStorageWithVersioning = default;
            Optional <AllowedCopyScope>        allowedCopyScope               = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = Models.Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new Kind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    var serializeOptions = new JsonSerializerOptions {
                        Converters = { new ManagedServiceIdentityTypeV3Converter() }
                    };
                    identity = JsonSerializer.Deserialize <ManagedServiceIdentity>(property.Value.ToString(), serializeOptions);
                    continue;
                }
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = property0.Value.GetString().ToProvisioningState();
                            continue;
                        }
                        if (property0.NameEquals("primaryEndpoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            primaryEndpoints = Endpoints.DeserializeEndpoints(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("primaryLocation"))
                        {
                            primaryLocation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("statusOfPrimary"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            statusOfPrimary = property0.Value.GetString().ToAccountStatus();
                            continue;
                        }
                        if (property0.NameEquals("lastGeoFailoverTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            lastGeoFailoverTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("secondaryLocation"))
                        {
                            secondaryLocation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("statusOfSecondary"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            statusOfSecondary = property0.Value.GetString().ToAccountStatus();
                            continue;
                        }
                        if (property0.NameEquals("creationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            creationTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("customDomain"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            customDomain = CustomDomain.DeserializeCustomDomain(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("sasPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sasPolicy = SasPolicy.DeserializeSasPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("keyPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            keyPolicy = KeyPolicy.DeserializeKeyPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("keyCreationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            keyCreationTime = KeyCreationTime.DeserializeKeyCreationTime(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("secondaryEndpoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            secondaryEndpoints = Endpoints.DeserializeEndpoints(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("encryption"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            encryption = Encryption.DeserializeEncryption(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("accessTier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            accessTier = property0.Value.GetString().ToAccessTier();
                            continue;
                        }
                        if (property0.NameEquals("azureFilesIdentityBasedAuthentication"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            azureFilesIdentityBasedAuthentication = AzureFilesIdentityBasedAuthentication.DeserializeAzureFilesIdentityBasedAuthentication(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("supportsHttpsTrafficOnly"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            supportsHttpsTrafficOnly = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("networkAcls"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("isSftpEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isSftpEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("isLocalUserEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isLocalUserEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("isHnsEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isHnsEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("geoReplicationStats"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            geoReplicationStats = GeoReplicationStats.DeserializeGeoReplicationStats(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("failoverInProgress"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            failoverInProgress = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("largeFileSharesState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            largeFileSharesState = new LargeFileSharesState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PrivateEndpointConnectionData> array = new List <PrivateEndpointConnectionData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateEndpointConnectionData.DeserializePrivateEndpointConnectionData(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("routingPreference"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            routingPreference = RoutingPreference.DeserializeRoutingPreference(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("blobRestoreStatus"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            blobRestoreStatus = BlobRestoreStatus.DeserializeBlobRestoreStatus(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("allowBlobPublicAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowBlobPublicAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("minimumTlsVersion"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            minimumTlsVersion = new MinimumTlsVersion(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("allowSharedKeyAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowSharedKeyAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("isNfsV3Enabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isNfsV3Enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("allowCrossTenantReplication"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowCrossTenantReplication = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("defaultToOAuthAuthentication"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            defaultToOAuthAuthentication = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("publicNetworkAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("immutableStorageWithVersioning"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            immutableStorageWithVersioning = ImmutableStorageAccount.DeserializeImmutableStorageAccount(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("allowedCopyScope"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowedCopyScope = new AllowedCopyScope(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new StorageAccountData(id, name, type, systemData, tags, location, sku.Value, Optional.ToNullable(kind), identity, extendedLocation.Value, Optional.ToNullable(provisioningState), primaryEndpoints.Value, primaryLocation.Value, Optional.ToNullable(statusOfPrimary), Optional.ToNullable(lastGeoFailoverTime), secondaryLocation.Value, Optional.ToNullable(statusOfSecondary), Optional.ToNullable(creationTime), customDomain.Value, sasPolicy.Value, keyPolicy.Value, keyCreationTime.Value, secondaryEndpoints.Value, encryption.Value, Optional.ToNullable(accessTier), azureFilesIdentityBasedAuthentication.Value, Optional.ToNullable(supportsHttpsTrafficOnly), networkAcls.Value, Optional.ToNullable(isSftpEnabled), Optional.ToNullable(isLocalUserEnabled), Optional.ToNullable(isHnsEnabled), geoReplicationStats.Value, Optional.ToNullable(failoverInProgress), Optional.ToNullable(largeFileSharesState), Optional.ToList(privateEndpointConnections), routingPreference.Value, blobRestoreStatus.Value, Optional.ToNullable(allowBlobPublicAccess), Optional.ToNullable(minimumTlsVersion), Optional.ToNullable(allowSharedKeyAccess), Optional.ToNullable(isNfsV3Enabled), Optional.ToNullable(allowCrossTenantReplication), Optional.ToNullable(defaultToOAuthAuthentication), Optional.ToNullable(publicNetworkAccess), immutableStorageWithVersioning.Value, Optional.ToNullable(allowedCopyScope)));
        }
Пример #39
0
        //     INITIALIZATION
        //_________________________________________________________________________________________

        /// <summary>
        /// Creates a new set iterator.
        /// </summary>
        /// <param name="prototype"> The next object in the prototype chain. </param>
        /// <param name="set"> The set to iterate over. </param>
        /// <param name="list"> The linked list to iterate over. </param>
        /// <param name="kind"> The type of values to return. </param>
        internal SetIterator(ObjectInstance prototype, SetInstance set, LinkedList <object> list, Kind kind)
            : base(prototype)
        {
            this.set = set;
            this.set.BeforeDelete += Set_BeforeDelete;
            this.list              = list;
            this.kind              = kind;
        }
Пример #40
0
 /// <summary>
 /// Returns the Option info as a string
 /// </summary>
 /// <returns>
 /// A <see cref="System.String"/>
 /// </returns>
 public override string ToString()
 {
     return("[" + Kind.ToString() + ": Value=" + Value.ToString() + " EchoReply=" + EchoReply.ToString() + "]");
 }
Пример #41
0
 public Policy(List <RuleBuilder> queries, Kind kind)
 {
     this.queries = queries;
     this.kind    = kind;
 }
Пример #42
0
        public override bool Equals(object obj)
        {
            Animals animal = (Animals)obj;

            return(Name.Equals(animal.Name) & Kind.Equals(animal.Kind) & Weight == animal.Weight);
        }
Пример #43
0
        //public double Price
        //{
        //    get
        //    {
        //        if (ChocolateKind == Kind.White)
        //            return 5;
        //        else if (ChocolateKind == Kind.Peanut)
        //            return 6;
        //        else if (ChocolateKind == Kind.Milk)
        //            return 7;
        //        else if (ChocolateKind == Kind.Dark)
        //            return 4;
        //        else //(ChocolateKind == Kind.Almond)
        //            return 8;
        //    }
        //}

        public Chocolate(Kind chocoKind)
        { //Constructor used for modeling the orders
            ChocolateKind = chocoKind;
        }
Пример #44
0
 public override string ToString()
 {
     return(Text != null
         ? Kind.ToString() + ":" + Text
         : Kind.ToString());
 }
Пример #45
0
 public void parse(int p1, byte[] data, Kind type, GPSpec spec)
 {
     populate_tags(data, type);
 }
Пример #46
0
        /// <summary>
        /// Deserializes an <see cref="IPipFingerprintEntryData"/> of the appropriate concrete type (or null if the type is unknown).
        /// <see cref="PipFingerprintEntry"/> is a tagged polymorphic container (see <see cref="Kind"/>),
        /// and this operation unwraps it. The returned instance contains all relevant data for the entry.
        /// </summary>
        public IPipFingerprintEntryData Deserialize(CacheQueryData cacheQueryData = null)
        {
            if (Kind == PipFingerprintEntryKind.Unknown)
            {
                return(null);
            }

            if (m_deserializedEntryData != null)
            {
                return(m_deserializedEntryData);
            }

            try
            {
                InputBuffer buffer = new InputBuffer(DataBlob);
                CompactBinaryReader <InputBuffer> reader = new CompactBinaryReader <InputBuffer>(buffer);
                IPipFingerprintEntryData          deserialized;

                switch (Kind)
                {
                case PipFingerprintEntryKind.DescriptorV1:
                    deserialized = Deserialize <PipCacheDescriptor> .From(reader);

                    break;

                case PipFingerprintEntryKind.DescriptorV2:
                    deserialized = Deserialize <PipCacheDescriptorV2Metadata> .From(reader);

                    break;

                case PipFingerprintEntryKind.GraphDescriptor:
                    deserialized = Deserialize <PipGraphCacheDescriptor> .From(reader);

                    break;

                case PipFingerprintEntryKind.FileDownload:
                    deserialized = Deserialize <FileDownloadDescriptor> .From(reader);

                    break;

                case PipFingerprintEntryKind.PackageDownload:
                    deserialized = Deserialize <PackageDownloadDescriptor> .From(reader);

                    break;

                case PipFingerprintEntryKind.GraphInputDescriptor:
                    deserialized = Deserialize <PipGraphInputDescriptor> .From(reader);

                    break;

                default:
                    throw Contract.AssertFailure("Unhandled PipFingerprintEntryKind");
                }

                Interlocked.CompareExchange(ref m_deserializedEntryData, deserialized, comparand: null);
                return(Volatile.Read(ref m_deserializedEntryData));
            }
            catch (Exception exception)
            {
                if (IsCorrupted)
                {
                    OutputBuffer valueBuffer = new OutputBuffer(1024);
                    CompactBinaryWriter <OutputBuffer> writer = new CompactBinaryWriter <OutputBuffer>(valueBuffer);
                    Serialize.To(writer, this);

                    // Include in the log the hash of this instance so that we can trace it in the cache log, and obtain the file in the CAS.
                    ContentHash valueHash = ContentHashingUtilities.HashBytes(
                        valueBuffer.Data.Array,
                        valueBuffer.Data.Offset,
                        valueBuffer.Data.Count);

                    const string Unspecified     = "<Unspecified>";
                    string       actualEntryBlob = Unspecified;
                    string       actualEntryHash = Unspecified;

                    if (cacheQueryData != null && cacheQueryData.ContentCache != null)
                    {
                        var maybeActualContent = cacheQueryData.ContentCache.TryLoadContent(
                            cacheQueryData.MetadataHash,
                            failOnNonSeekableStream: true,
                            byteLimit: 20 * 1024 * 1024).Result;

                        if (maybeActualContent.Succeeded && maybeActualContent.Result != null)
                        {
                            actualEntryBlob = ToByteArrayString(maybeActualContent.Result);
                            actualEntryHash = ContentHashingUtilities.HashBytes(maybeActualContent.Result).ToString();
                        }
                    }

                    Logger.Log.DeserializingCorruptedPipFingerprintEntry(
                        Events.StaticContext,
                        kind: Kind.ToString(),
                        weakFingerprint: cacheQueryData?.WeakContentFingerprint.ToString() ?? Unspecified,
                        pathSetHash: cacheQueryData?.PathSetHash.ToString() ?? Unspecified,
                        strongFingerprint: cacheQueryData?.StrongContentFingerprint.ToString() ?? Unspecified,
                        expectedHash: cacheQueryData?.MetadataHash.ToString() ?? Unspecified, // expected metadata hash
                        hash: valueHash.ToString(),                                           // re-computed hash
                        blob: ToDataBlobString(),                                             // blob of data carried by pip fingerprint entry
                        actualHash: actualEntryHash,                                          // actual pip fingerprint entry hash
                        actualEntryBlob: actualEntryBlob);                                    // actual pip fingerprint entry blob

                    throw new BuildXLException("Deserializing corrupted pip fingerprint entry", exception, ExceptionRootCause.CorruptedCache);
                }

                // We don't expect this to happen so rethrow the exception.
                throw;
            }
        }
Пример #47
0
        public void ValidateSRPAccount(string resourceGroupName,
                                       string accountName,
                                       string location       = null,
                                       string skuName        = null,
                                       Hashtable[] tags      = null,
                                       Kind kind             = Kind.Storage,
                                       AccessTier?accessTier = null,
                                       string customDomain   = null,
                                       bool?useSubdomain     = null,
                                       Constants.EncryptionSupportServiceEnum enableEncryptionService = Constants.EncryptionSupportServiceEnum.Blob | Constants.EncryptionSupportServiceEnum.File,
                                       bool?enableHttpsTrafficOnly = null,
                                       bool AssignIdentity         = false,
                                       bool StorageEncryption      = false,
                                       bool keyvaultEncryption     = false,
                                       string keyName     = null,
                                       string keyVersion  = null,
                                       string keyVaultUri = null)
        {
            AzureOperationResponse <SRPModel.StorageAccount> response = this.SRPStorageClient.StorageAccounts.GetPropertiesWithHttpMessagesAsync(resourceGroupName, accountName).Result;

            Test.Assert(response.Response.StatusCode == HttpStatusCode.OK, string.Format("Account {0} should be created successfully.", accountName));

            SRPModel.StorageAccount account = response.Body;
            Test.Assert(accountName == account.Name, string.Format("Expected account name is {0} and actually it is {1}", accountName, account.Name));
            if (!string.IsNullOrEmpty(skuName))
            {
                Test.Assert(this.mapAccountType(Constants.AccountTypes[(int)account.Sku.Name]).Equals(skuName),
                            string.Format("Expected account type is {0} and actually it is {1}", skuName, account.Sku.Name));
            }
            if (!string.IsNullOrEmpty(location))
            {
                Test.Assert(location.Replace(" ", "").ToLower() == account.Location, string.Format("Expected location is {0} and actually it is {1}", location, account.Location));
            }
            Test.Assert(kind == account.Kind, string.Format("Kind should match: {0} == {1}", kind, account.Kind));

            //for StorageV2 account, will have default accesstier as cool
            if (kind == Kind.StorageV2 && accessTier == null)
            {
                accessTier = AccessTier.Cool;
            }
            Test.Assert(accessTier == account.AccessTier || (account.Kind == Kind.StorageV2 && account.AccessTier == AccessTier.Hot), string.Format("AccessTier should match: {0} == {1}", accessTier, account.AccessTier));

            if (customDomain == null)
            {
                Test.Assert(account.CustomDomain == null, string.Format("CustomDomain should match: {0} == {1}", customDomain, account.CustomDomain));
            }
            else
            {
                Test.Assert(customDomain == account.CustomDomain.Name, string.Format("CustomDomain should match: {0} == {1}", customDomain, account.CustomDomain.Name));

                // UseSubDomain is only for set, and won't be return in get
                Test.Assert(account.CustomDomain.UseSubDomain == null, string.Format("UseSubDomain should match: {0} == {1}", null, account.CustomDomain.UseSubDomain));
            }
            if (enableHttpsTrafficOnly != null)
            {
                Test.Assert(enableHttpsTrafficOnly == account.EnableHttpsTrafficOnly, string.Format("EnableHttpsTrafficOnly should match: {0} == {1}", enableHttpsTrafficOnly, account.EnableHttpsTrafficOnly));
            }
            if (AssignIdentity)
            {
                Test.Assert(account.Identity != null, string.Format("IdentityType should not be null: {0}, {1}", account.Identity.PrincipalId, account.Identity.TenantId));
            }

            this.ValidateTags(tags, account.Tags);
            ValidateServiceEncrption(account.Encryption, enableEncryptionService,
                                     StorageEncryption,
                                     keyvaultEncryption,
                                     keyName,
                                     keyVersion,
                                     keyVaultUri);
        }
Пример #48
0
 public override int GetHashCode()
 {
     return(Value.GetHashCode() ^ Span.GetHashCode() ^ Kind.GetHashCode());
 }
Пример #49
0
 public void ClearValue()
 {
     this.value     = null;
     this.HasValue  = false;
     this.valueKind = Kind.String;
 }
Пример #50
0
 // 2018-10-08: must be in sync with CAC, assuming IsEPortSessEndoc() == true
 public static bool IsEPortSession(char tKind)
 {
     return(Kind.Seek(tKind).what == What.OpenSession);
 }
Пример #51
0
        /// <summary>Initializes a new instance of the <see cref="MetricValueColumn"/> class.</summary>
        /// <param name="name">The  column name.</param>
        /// <param name="metric">The metric information.</param>
        /// <param name="kind">The kind of value to display.</param>
        public MetricValueColumn([CanBeNull] string name, [NotNull] MetricInfo metric, Kind kind)
        {
            DebugEnumCode.Defined(kind, nameof(kind));
            _kind = kind;

            ColumnName         = name ?? (metric.DisplayName + (kind == Kind.Mean ? "" : "-" + kind));
            Metric             = metric;
            PriorityInCategory = PriorityInCategoryStartValue;
        }
Пример #52
0
 public void SetAsLazyString(bool quoted)
 {
     valueKind = quoted ? Kind.QuotedString : Kind.String;
     HasValue  = true;
 }
Пример #53
0
 internal override object GetDefaultValue(Kind kind)
 {
     return(defaultValue);
 }
Пример #54
0
 [BsonElement("lcd") BsonDateTimeOptions(Kind = DateTimeKind.Local)] //99.9% sure we need to convert to utc
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("identity");
     writer.WriteObjectValue(Identity);
     writer.WritePropertyName("location");
     writer.WriteStringValue(Location);
     if (Tags != null)
     {
         writer.WritePropertyName("tags");
         writer.WriteStartObject();
         foreach (var item in Tags)
         {
             writer.WritePropertyName(item.Key);
             writer.WriteStringValue(item.Value);
         }
         writer.WriteEndObject();
     }
     writer.WritePropertyName("kind");
     writer.WriteStringValue(Kind.ToString());
     if (SystemData != null)
     {
         writer.WritePropertyName("systemData");
         writer.WriteObjectValue(SystemData);
     }
     if (Id != null)
     {
         writer.WritePropertyName("id");
         writer.WriteStringValue(Id);
     }
     if (Name != null)
     {
         writer.WritePropertyName("name");
         writer.WriteStringValue(Name);
     }
     if (Type != null)
     {
         writer.WritePropertyName("type");
         writer.WriteStringValue(Type);
     }
     writer.WritePropertyName("properties");
     writer.WriteStartObject();
     if (ContainerSettings != null)
     {
         writer.WritePropertyName("containerSettings");
         writer.WriteObjectValue(ContainerSettings);
     }
     if (StorageAccountSettings != null)
     {
         writer.WritePropertyName("storageAccountSettings");
         writer.WriteObjectValue(StorageAccountSettings);
     }
     if (CleanupPreference != null)
     {
         writer.WritePropertyName("cleanupPreference");
         writer.WriteStringValue(CleanupPreference.Value.ToString());
     }
     if (ProvisioningState != null)
     {
         writer.WritePropertyName("provisioningState");
         writer.WriteStringValue(ProvisioningState.Value.ToString());
     }
     if (Status != null)
     {
         writer.WritePropertyName("status");
         writer.WriteObjectValue(Status);
     }
     if (Outputs != null)
     {
         writer.WritePropertyName("outputs");
         writer.WriteStartObject();
         foreach (var item in Outputs)
         {
             writer.WritePropertyName(item.Key);
             writer.WriteObjectValue(item.Value);
         }
         writer.WriteEndObject();
     }
     if (PrimaryScriptUri != null)
     {
         writer.WritePropertyName("primaryScriptUri");
         writer.WriteStringValue(PrimaryScriptUri);
     }
     if (SupportingScriptUris != null)
     {
         writer.WritePropertyName("supportingScriptUris");
         writer.WriteStartArray();
         foreach (var item in SupportingScriptUris)
         {
             writer.WriteStringValue(item);
         }
         writer.WriteEndArray();
     }
     if (ScriptContent != null)
     {
         writer.WritePropertyName("scriptContent");
         writer.WriteStringValue(ScriptContent);
     }
     if (Arguments != null)
     {
         writer.WritePropertyName("arguments");
         writer.WriteStringValue(Arguments);
     }
     if (EnvironmentVariables != null)
     {
         writer.WritePropertyName("environmentVariables");
         writer.WriteStartArray();
         foreach (var item in EnvironmentVariables)
         {
             writer.WriteObjectValue(item);
         }
         writer.WriteEndArray();
     }
     if (ForceUpdateTag != null)
     {
         writer.WritePropertyName("forceUpdateTag");
         writer.WriteStringValue(ForceUpdateTag);
     }
     writer.WritePropertyName("retentionInterval");
     writer.WriteStringValue(RetentionInterval, "P");
     if (Timeout != null)
     {
         writer.WritePropertyName("timeout");
         writer.WriteStringValue(Timeout.Value, "P");
     }
     writer.WritePropertyName("azCliVersion");
     writer.WriteStringValue(AzCliVersion);
     writer.WriteEndObject();
     writer.WriteEndObject();
 }