Esempio n. 1
0
        private static NamedObjectType GetDeploymentReturnType(ResourceScopeType targetScope)
        {
            // Note: there are other properties which could be included here, but they allow you to break out of the bicep world.
            // We're going to omit them and only include what is truly necessary. If we get feature requests to expose more properties, we should discuss this further.
            // Properties such as 'template', 'templateHash', 'parameters' depend on the codegen, and feel like they could be fragile.
            IEnumerable <TypeProperty> properties = new []
            {
                new TypeProperty("name", LanguageConstants.String),
                new TypeProperty("properties", new NamedObjectType("properties", TypeSymbolValidationFlags.Default, new []
                {
                    new TypeProperty("templateLink", new NamedObjectType("properties", TypeSymbolValidationFlags.Default, new []
                    {
                        new TypeProperty("uri", LanguageConstants.String)
                    }, null))
                }, null)),
            };

            if (!targetScope.HasFlag(ResourceScopeType.ResourceGroupScope))
            {
                // deployments in the 'resourcegroup' scope do not have the 'location' property. All other scopes do.
                var locationProperty = new TypeProperty("location", LanguageConstants.String);
                properties = properties.Concat(locationProperty.AsEnumerable());
            }

            return(new NamedObjectType("deployment", TypeSymbolValidationFlags.Default, properties, null));
        }
Esempio n. 2
0
        /// <summary>
        /// Construct the device by obtainin the device properties and the sub data.
        ///
        /// NOTE:
        /// There is a difference with the device id and the id.
        /// The id indicates the object id within the windows portable device.
        /// The device id indicates the object id within the operating system.
        ///
        /// The initial id for all windows portable devices is hard coded to "DEVICE"
        /// </summary>
        /// <param name="deviceId"></param>
        public Device(string deviceId, bool withDeviceItems = true) : base("DEVICE")
        {
            DeviceId        = deviceId;
            ComDeviceObject = new PortableDeviceClass();
            Connect();
            IPortableDeviceValues deviceProperties = ExtractDeviceProperties(ComDeviceObject);

            ContentType     = new ContentTypeProperty(deviceProperties);
            DeviceType      = new TypeProperty(deviceProperties);
            FirmwareVersion = new FirmwareVersionProperty(deviceProperties);
            FriendlyName    = new FriendlyNameProperty(deviceProperties);
            Manufacturer    = new ManufacturerProperty(deviceProperties);
            Model           = new ModelProperty(deviceProperties);
            Name            = new NameProperty(deviceProperties);
            SerialNumber    = new SerialNumberProperty(deviceProperties);

            if (withDeviceItems == true)
            {
                LoadDeviceData(ComDeviceObject);

                do
                {
                    System.Threading.Thread.Sleep(100);
                } while (UtilityHelper.threadList.Count > 0);
            }
            Disconnect();
        }
Esempio n. 3
0
        private static string FormatPropertyDocumentation(TypeProperty property)
        {
            var buffer = new StringBuilder();

            buffer.Append($"Type: `{property.TypeReference.Type}`{MarkdownNewLine}");

            if (property.Flags.HasFlag(TypePropertyFlags.ReadOnly))
            {
                // this case will be used for dot property access completions
                // this flag is not possible in property name completions
                buffer.Append($"Read-only property{MarkdownNewLine}");
            }

            if (property.Flags.HasFlag(TypePropertyFlags.WriteOnly))
            {
                buffer.Append($"Write-only property{MarkdownNewLine}");
            }

            if (property.Flags.HasFlag(TypePropertyFlags.Constant))
            {
                buffer.Append($"Requires a compile-time constant value.{MarkdownNewLine}");
            }

            return(buffer.ToString());
        }
        public async Task <IActionResult> Edit(int id, [Bind("TypePropertyId,Name")] TypeProperty typeProperty)
        {
            if (id != typeProperty.TypePropertyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(typeProperty);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypePropertyExists(typeProperty.TypePropertyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeProperty));
        }
Esempio n. 5
0
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            TypeProperty cli = new TypeProperty();

            this.Hide();
            cli.Show();
        }
        private static JsonExtensionDataItem UnpackExtensionDataMember(object Item)
        {
            PropertyInfo          NameProperty;
            JsonExtensionDataItem ReturnValue = null;
            PropertyInfo          ValueProperty;

            NameProperty  = FindProperty(Item, "Name");
            ValueProperty = FindProperty(Item, "Value");
            if (NameProperty != null && ValueProperty != null)
            {
                string Name;
                object Value;

                Name  = NameProperty.GetValue(Item).ToString();
                Value = ValueProperty.GetValue(Item);
                if (Value != null)
                {
                    switch (Value.GetType().Name)
                    {
                    case "DataNode`1":
                        PropertyInfo ItemValueProperty;
                        PropertyInfo TypeProperty;

                        TypeProperty      = FindProperty(Value, "DataType");
                        ItemValueProperty = FindProperty(Value, "Value");
                        if (TypeProperty != null && ItemValueProperty != null)
                        {
                            Type   DataType;
                            object ItemValue;

                            DataType  = (Type)TypeProperty.GetValue(Value);
                            ItemValue = ItemValueProperty.GetValue(Value);

                            ReturnValue = new JsonExtensionDataItem(Name, DataType, ItemValue);
                        }
                        break;

                    case "ClassDataNode":
                        JsonExtensionDataItemCollection NewItems;

                        NewItems    = UnpackExtensionDataMembers(Value);
                        ReturnValue = new JsonExtensionDataItem(Name, NewItems);
                        break;

                    case "CollectionDataNode":
                        break;

                    default:
                        Console.WriteLine("WTF");
                        break;
                    }
                }
            }

            return(ReturnValue);
        }
        public async Task <IActionResult> Create([Bind("TypePropertyId,Name")] TypeProperty typeProperty)
        {
            if (ModelState.IsValid)
            {
                _context.Add(typeProperty);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeProperty));
        }
Esempio n. 8
0
        /// <summary>
        /// Fetches airports matching the given search string from the local database.
        /// Three letter searches will search for FAA codes, four letter searches will
        /// search for ICAO code, and all others will search for the airport name
        /// </summary>
        /// <param name="searchStr">The string to search for</param>
        /// <returns>The matching airports</returns>
        public Airports FetchMatchingAirports(string searchStr)
        {
            if (searchStr == null)
            {
                return(new Airports());
            }

            IQuery searchQuery;

            switch (searchStr.Length)
            {
            case (int)AirportCodeLength.FAA:
                searchQuery = Query
                              .Select(AirportNameResult)
                              .From(DataSource.Database(UserSession.Database))
                              .Where(TypeProperty
                                     .EqualTo("airport")
                                     .And(FaaProperty
                                          .EqualTo(searchStr.ToUpperInvariant())))
                              .OrderBy(Ordering.Property("datfield").Ascending());
                break;

            case (int)AirportCodeLength.ICAO:
                searchQuery = Query
                              .Select(AirportNameResult)
                              .From(DataSource.Database(UserSession.Database))
                              .Where(TypeProperty
                                     .EqualTo("airport")
                                     .And(IcaoProperty
                                          .EqualTo(searchStr.ToUpperInvariant())));
                break;

            default:
                searchQuery = Query
                              .Select(AirportNameResult)
                              .From(DataSource.Database(UserSession.Database))
                              .Where(TypeProperty
                                     .EqualTo("airport")
                                     .And(AirportNameProperty
                                          .Like($"{searchStr}%")));
                break;
            }

            try {
                using (var results = searchQuery.Run()) {
                    return(results.Select(x => x.GetString("airportname")).Where(x => x != null).ToList());
                }
            } finally {
                searchQuery.Dispose();
            }
        }
Esempio n. 9
0
    void calculateOnsetdata(TypeProperty property)
    {
        int           type = property.segmentnumber;
        List <int>    countonsetpergroup = new List <int>();
        double        auxsum             = 0;
        double        auxcount           = 0;
        List <double> auxonsettimes      = new List <double> ();
        List <double> onsettimes         = new List <double> ();

        for (int i = 0; i < onsetbysecond.Length; i++)
        {
            if (bullettypebyonset[i] == type)
            {
                auxonsettimes.Add(onsetbysecond[i]);
                onsettimes.Add(onsetbysecond[i]);
            }
            else
            {
                if (auxonsettimes.Count > 1)
                {
                    countonsetpergroup.Add(auxonsettimes.Count);
                    auxcount = auxcount + auxonsettimes.Count - 1;
                    for (int j = 1; j < auxonsettimes.Count; j++)
                    {
                        auxsum = auxsum + (auxonsettimes[j] - auxonsettimes[j - 1]);
                    }
                    auxonsettimes.Clear();
                }
            }
        }
        if (auxonsettimes.Count > 1)
        {
            countonsetpergroup.Add(auxonsettimes.Count);
            auxcount = auxcount + auxonsettimes.Count - 1;
            for (int j = 1; j < auxonsettimes.Count; j++)
            {
                if (auxonsettimes[j] != 0)
                {
                    auxsum = auxsum + (auxonsettimes[j] - auxonsettimes[j - 1]);
                }
            }
            auxonsettimes.Clear();
        }
        double average = auxsum / auxcount;

        property.averageinterval    = average;
        property.countonsetpergroup = countonsetpergroup;
    }
Esempio n. 10
0
        /// <summary>
        /// Gets the guest bookmark document (only applicable to the guest user)
        /// </summary>
        /// <returns>The guest bookmark document</returns>
        public Document FetchGuestBookmarkDocument()
        {
            if (!IsGuest)
            {
                throw new InvalidOperationException("This method is only for the guest user");
            }

            using (var searchQuery = QueryBuilder
                                     .Select(DocIdResult)
                                     .From(DataSource.Database(Database))
                                     .Where(TypeProperty.EqualTo(Expression.String("bookmarkedhotels")))) {
                var results = searchQuery.Execute().ToList();
                var docID   = results.FirstOrDefault()?.GetString("id");
                return(docID != null?Database.GetDocument(docID) : null);
            }
        }
Esempio n. 11
0
    void divideonsetandpitch(TypeProperty typeProperty)
    {
        int           type          = typeProperty.segmentnumber;
        List <double> onsetpergroup = new List <double>();
        List <double> pitchpergroup = new List <double>();

        for (int i = 0; i < bullettypebyonset.Length; i++)
        {
            if (bullettypebyonset[i] == type)
            {
                onsetpergroup.Add(onsetbysecond[i]);
                pitchpergroup.Add(pitchbyonset[i]);
            }
        }
        typeProperty.onsettimes  = onsetpergroup;
        typeProperty.pitchvalues = pitchpergroup;
    }
Esempio n. 12
0
 private static CompletionItem CreatePropertyCompletion(TypeProperty property)
 {
     return(new CompletionItem
     {
         Kind = CompletionItemKind.Property,
         Label = property.Name,
         InsertTextFormat = InsertTextFormat.PlainText,
         // property names containg spaces need to be escaped
         InsertText = Lexer.IsValidIdentifier(property.Name) ? property.Name : StringUtils.EscapeBicepString(property.Name),
         CommitCharacters = new Container <string>(" ", ":"),
         Detail = FormatPropertyDetail(property),
         Documentation = new StringOrMarkupContent(new MarkupContent
         {
             Kind = MarkupKind.Markdown,
             Value = FormatPropertyDocumentation(property)
         })
     });
 }
Esempio n. 13
0
 public static CompletionItem CreatePropertyNameCompletion(TypeProperty property, bool preselect = false, CompletionPriority priority = CompletionPriority.Medium) =>
 new CompletionItem
 {
     Kind             = CompletionItemKind.Property,
     Label            = property.Name,
     InsertTextFormat = InsertTextFormat.PlainText,
     // property names containg spaces need to be escaped
     InsertText       = IsPropertyNameEscapingRequired(property) ? StringUtils.EscapeBicepString(property.Name) : property.Name,
     CommitCharacters = PropertyCommitChars,
     Detail           = FormatPropertyDetail(property),
     Documentation    = new StringOrMarkupContent(new MarkupContent
     {
         Kind  = MarkupKind.Markdown,
         Value = FormatPropertyDocumentation(property)
     }),
     Preselect = preselect,
     SortText  = GetSortText(property.Name, priority)
 };
Esempio n. 14
0
        /// <summary>
        /// Called when the sprite is changed.
        /// </summary>
        protected virtual void SpriteChanged()
        {
            if (GameObject == null)
            {
                return;
            }

            if (LoadMode.HasFlag(LoadMode.HiddenWhileLoading))
            {
                if (Sprite != null && Sprite.IsLoaded)
                {
                    ImageComponent.enabled = true;
                }
            }

            // uncomment for tracking sprite sets
            //var spriteInfo = Sprite == null ? "null" : String.Format("{0} (IsLoaded: {1})", Sprite.Id, Sprite.IsLoaded);
            //Debugger.Info(String.Format("{0}: Setting Sprite = {1}", Name, spriteInfo), LogCategory.Delight);

            var sprite = Sprite?.UnityObject;

            if (sprite != null && ImageComponent == null)
            {
                ImageComponent = GameObject.AddComponent <UnityEngine.UI.Image>();
                FastMaterialChanged(); // apply fast material if specified
            }

            if (ImageComponent != null)
            {
                ImageComponent.sprite = sprite;

                if (sprite != null && TypeProperty.IsUndefined(this))
                {
                    // if type is undefined auto-detect if sprite is sliced
                    if (sprite.border != Vector4.zero)
                    {
                        ImageComponent.type = UnityEngine.UI.Image.Type.Sliced;
                    }
                }
            }

            ImageChanged();
        }
Esempio n. 15
0
        /// <summary>
        /// Construct the device by obtainin the device properties and the sub data.
        ///
        /// NOTE:
        /// There is a difference with the device id and the id.
        /// The id indicates the object id within the windows portable device.
        /// The device id indicates the object id within the operating system.
        ///
        /// The initial id for all windows portable devices is hard coded to "DEVICE"
        /// </summary>
        /// <param name="deviceId"></param>
        public Device(string deviceId) : base("DEVICE")
        {
            DeviceId        = deviceId;
            ComDeviceObject = new PortableDeviceClass();
            Connect();
            IPortableDeviceValues deviceProperties = ExtractDeviceProperties(ComDeviceObject);

            ContentType     = new ContentTypeProperty(deviceProperties);
            DeviceType      = new TypeProperty(deviceProperties);
            FirmwareVersion = new FirmwareVersionProperty(deviceProperties);
            FriendlyName    = new FriendlyNameProperty(deviceProperties);
            Manufacturer    = new ManufacturerProperty(deviceProperties);
            Model           = new ModelProperty(deviceProperties);
            Name            = new NameProperty(deviceProperties);
            SerialNumber    = new SerialNumberProperty(deviceProperties);

            LoadDeviceData(ComDeviceObject);

            Disconnect();
        }
Esempio n. 16
0
        private Task <Hotels> FetchHotelsFromLocalAsync(string description, string location)
        {
            // Description is looked up in the "description" and "name" content
            // Location is looking up in country, city, state, and address
            // Reference: https://developer.couchbase.com/documentation/server/4.6/sdk/sample-application.html
            // MATCH can only appear at top-level, or in a top-level AND

            IExpression descExp = null;

            if (!String.IsNullOrWhiteSpace(description))
            {
                descExp = FullTextExpression.Index("description").Match(description);
            }

            var locationExp = CountryProperty.Like(Expression.String($"%{location}%"))
                              .Or(CityProperty.Like(Expression.String($"%{location}%")))
                              .Or(StateProperty.Like(Expression.String($"%{location}%")))
                              .Or(AddressProperty.Like(Expression.String($"%{location}%")));

            var searchExp = locationExp;

            if (descExp != null)
            {
                searchExp = descExp.And(locationExp);
            }

            using (var hotelSearchQuery = QueryBuilder
                                          .Select(SelectResult.All())
                                          .From(DataSource.Database(UserSession.Database))
                                          .Where(TypeProperty.EqualTo(Expression.String("hotel")).And(searchExp))) {
                var results = hotelSearchQuery.Execute().ToList();

                var hotels = results.Select(x => x.GetDictionary(0).ToDictionary(y => y.Key, y => y.Value) as Hotel).ToList();
                return(Task.FromResult(hotels));
            }
        }
Esempio n. 17
0
 private static string FormatPropertyDetail(TypeProperty property) =>
 property.Flags.HasFlag(TypePropertyFlags.Required)
         ? $"{property.Name} (Required)"
         : property.Name;
		public PropertyConfig(string name, TypeProperty typeProperty, string label)
			: this(name, typeProperty)
		{
			_label = label;
		}
		public PropertyConfig(string name, TypeProperty typeProperty)
		{
			Name = name;
			TypeProperty = typeProperty;
		}
Esempio n. 20
0
 public org.omg.dds.type.typeobject.Type SetProperty(TypeProperty newProperty)
 {
     this.Property = newProperty;
     return this;
 }
Esempio n. 21
0
 public TypeMethods(TypeProperty typeproperty)
 {
     this.typeproperty = typeproperty;
 }
Esempio n. 22
0
 set => base.SetValue(TypeProperty, value);
Esempio n. 23
0
 set => SetValue(TypeProperty, value);
Esempio n. 24
0
 get => (string)GetValue(TypeProperty); set => SetValue(TypeProperty, value);