示例#1
0
文件: Creep.cs 项目: zedr0n/Screeps
 public Spec(Property[] props)
 {
     foreach (Property prop in props)
     {
         spec.Add(prop);
     }
 }
示例#2
0
 public string GetArgumentStringFor(Property property)
 {
     return RawArgumentString
         .Replace("#entity.Name#", property.Entity.Name)
         .Replace("#property.Name#", property.Name)
         .Replace("#property.Type#", property.Type);
 }
        public override void establish_context()
        {
            property = ReflectionHelper.GetAccessor(GetPropertyExpression());
            target = new PropertyEntity();

            sut = new Property<PropertyEntity, string>(property, "expected");
        }
示例#4
0
文件: Template.cs 项目: daszat/zetbox
        protected virtual void ApplyPropertyTemplate(Property prop)
        {
            bool isReadOnly = false;
            bool isList = false;

            if (prop is ValueTypeProperty)
            {
                var vtp = (ValueTypeProperty)prop;
                isList = vtp.IsList;
                isReadOnly = vtp.IsCalculated;
            }
            else if (prop is CompoundObjectProperty)
            {
                isList = ((CompoundObjectProperty)prop).IsList;
            }
            else if (prop is ObjectReferenceProperty)
            {
                isList = ((ObjectReferenceProperty)prop).IsList();
            }
            else if (prop is CalculatedObjectReferenceProperty)
            {
                isReadOnly = true;
            }

            if (isList)
            {
                Properties.SimplePropertyListTemplate.Call(Host, ctx, prop);
            }
            else
            {
                Properties.SimplePropertyTemplate.Call(Host, ctx, prop, isReadOnly);
            }
        }
示例#5
0
文件: ConVar.cs 项目: sparker/Lemma
		public ConVar(string name, string description, Action<string> onChanged, string defaultValue)
		{
			this.Name.Value = name;
			this.Description.Value = description;
			this.OnChanged.Value = onChanged;
			this.Value.Value = defaultValue;
		}
        public override bool VisitProperty(Property decl)
        {
            if(!AlreadyVisited(decl) && decl.ExplicitInterfaceImpl == null)
                CheckDuplicate(decl);

            return false;
        }
示例#7
0
        public void Can_search_with_filters()
        {
            Property property = new Property { Id = Guid.NewGuid(), Name = "Property Name", BedroomCount = 3 };
            Catalog catalog = new Catalog() { Id = Guid.NewGuid(), Type = "Waterfront", PropertyId = property.Id };

            using(var store = NewDocumentStore())
            using(var _session = store.OpenSession())
            {

                _session.Store(property);
                _session.Store(catalog);
                _session.SaveChanges();

                var catalogs = _session.Advanced.DocumentQuery<Catalog>().WhereEquals("Type", "Waterfront").Select(c => c.PropertyId);
                var properties = _session.Advanced.DocumentQuery<Property>();
                properties.OpenSubclause();
                var first = true;
                foreach (var guid in catalogs)
                {
                    if (first == false)
                        properties.OrElse(); 
                    properties.WhereEquals("__document_id", guid);
                    first = false;
                }
                properties.CloseSubclause();
                var refinedProperties = properties.AndAlso().WhereGreaterThanOrEqual("BedroomCount", "2").Select(p => p.Id);

                Assert.NotEqual(0, refinedProperties.Count());
            }
        }
示例#8
0
		public static void AttachEditorComponents(Entity entity, string name, Property<Entity.Handle> target)
		{
			entity.Add(name, target);
			if (entity.EditorSelected != null)
			{
				Transform transform = entity.Get<Transform>("Transform");

				LineDrawer connectionLines = new LineDrawer { Serialize = false };
				connectionLines.Add(new Binding<bool>(connectionLines.Enabled, entity.EditorSelected));

				connectionLines.Add(new NotifyBinding(delegate()
				{
					connectionLines.Lines.Clear();
					Entity targetEntity = target.Value.Target;
					if (targetEntity != null)
					{
						Transform targetTransform = targetEntity.Get<Transform>("Transform");
						if (targetTransform != null)
						{
							connectionLines.Lines.Add
							(
								new LineDrawer.Line
								{
									A = new Microsoft.Xna.Framework.Graphics.VertexPositionColor(transform.Position, connectionLineColor),
									B = new Microsoft.Xna.Framework.Graphics.VertexPositionColor(targetTransform.Position, connectionLineColor)
								}
							);
						}
					}
				}, transform.Position, target, entity.EditorSelected));

				entity.Add(connectionLines);
			}
		}
 private TestSelectionViewModel()
 {
     _sourceControlBrowser = Property.New(this, p => p.SourceControlTestBrowser, OnPropertyChanged);
     _fileSystemBrowser = Property.New(this, p => p.FileSystemTestBrowser, OnPropertyChanged);
     _manualEntry = Property.New(this, p => p.ManualEntry, OnPropertyChanged);
     _selectedTestCase = Property.New(this, p => p.SelectedTestCase, OnPropertyChanged);
 }
 public ModelMslEntityTypeMappingScalarProperty(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Property prop, string parentName)
     : base(_host)
 {
     this.ctx = ctx;
     this.prop = prop;
     this.parentName = parentName;
 }
示例#11
0
 protected virtual PropertyControlInfo Configure(Property property)
 {
     var info = PropertyControlInfo.CreateFor(property);
     if (Name != null) info.SetPropertyControlValue(property.Name, ControlInfoPropertyNames.DisplayName, Name);
     if (Description != null) info.SetPropertyControlValue(property.Name, ControlInfoPropertyNames.Description, Description);
     return info;
 }
示例#12
0
        private void OnValueChanged(Property property, object newValue) {
            var field = GetType().GetField(property.Name);
            if(newValue != null && !newValue.GetType().IsSubtypeOrEqualTo(field.FieldType))
                return;

            field.SetValue(this, newValue);
        }
        public SimplePropertyListTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Property prop)
            : base(_host)
        {
			this.ctx = ctx;
			this.prop = prop;

        }
示例#14
0
 public Cursor(Entity ent, String name)
     : base(ent, name)
 {
     m_Position = Entity.AddProperty<Vector3>("Position", Vector3.Zero);
     Broadphases.Input inp = XNAGame.Instance.GetBroadphase<Broadphases.Input>("Input");
     inp.MouseMoved += new Broadphases.MouseEventHandler(inp_MouseMoved);
 }
 private void CollectProperties(object instance, PropertyDescriptor descriptor, List<Property> propertyCollection, bool automaticlyExpandObjects, string filter)
 {
     if (descriptor.Attributes[typeof(FlatAttribute)] == null)
     {
         Property property = new Property(instance, descriptor);
         if (descriptor.IsBrowsable)
         {
             //Add a property with Name: AutomaticlyExpandObjects
             Type propertyType = descriptor.PropertyType;
             if (automaticlyExpandObjects && propertyType.IsClass && !propertyType.IsArray && propertyType != typeof(string))
             {
                 propertyCollection.Add(new ExpandableProperty(instance, descriptor, automaticlyExpandObjects, filter));
             }
             else if (descriptor.Converter.GetType() == typeof(ExpandableObjectConverter))
             {
                 propertyCollection.Add(new ExpandableProperty(instance, descriptor, automaticlyExpandObjects, filter));
             }
             else
                 propertyCollection.Add(property);
         }
     }
     else
     {
         instance = descriptor.GetValue(instance);
         PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(instance);
         foreach (PropertyDescriptor propertyDescriptor in properties)
         {
             CollectProperties(instance, propertyDescriptor, propertyCollection, automaticlyExpandObjects, filter);
         }
     }
 }
示例#16
0
        /// <summary>
        /// Create a new option.  
        /// </summary>
        /// <param name="opco">The three or four letter code for the operating company</param>
        /// <param name="name">The human-readable name for this option</param>
        /// <param name="slug">A unique slug for this option; optional, will be generated from the name if not provided</param>
        /// <param name="external">An third-party external identifier for this option (optional)</param>
        /// <param name="language">The two-letter ISO language for the option's name; defaults to the opco's language</param>
        /// <param name="relatedTo">The category or taxonomy using this option (optional)</param>
        /// <param name="relatedBy">The property by which this option is related to the relatedTo value</param>
        /// <returns>The newly created Option</returns>
        /// <exception cref="Terra.ServerException">
        /// <list type="bullet">
        /// <item>
        /// <description>If any of the parameters submitted are invalid, returns a status of Not Acceptable.</description>
        /// </item>
        /// <item>
        /// <description>If the slug already exists, returns a status of Conflict.</description>
        /// </item>
        /// <item>
        /// <description>If the operating company, relatedTo, or relatedBy does not exist, returns a status of Not Found.</description>
        /// </item>
        /// </list>
        /// </exception>
        public Option Create(string opco, string name, string slug = null, string external = null, string language = null,
            Node relatedTo = null, Property relatedBy = null)
        {
            var request = _client.Request("option", Method.POST).
                AddParameter("opco", opco).
                AddParameter("name", name).
                AddParameter("slug", slug).
                AddParameter("external", external).
                AddParameter("lang", language);

            if (relatedBy != null)
            {
                if (relatedTo is Taxonomy)
                {
                    request.AddParameter("taxonomy", ((Taxonomy)relatedTo).Slug);
                }
                else if (relatedTo is Category)
                {
                    request.AddParameter("category", ((Category)relatedTo).Slug);
                }

                request.AddParameter("property", relatedBy.Slug);
            }

            return request.MakeRequest<Option>();
        }
示例#17
0
        /// <summary>
        /// Método encargado de obtener las propiedades necesarias para realizar
        /// la conexión con el tipo de Servidor necesario.
        /// </summary>
        /// <param name="envio">Se configura para enviar si es TRUE, para recibir si es FALSE</param>
        /// <param name="server">Servidor del cual se quiere obtener la configuración</param>
        /// <returns></returns>
        public Property obtenerPropiedades(bool envio, ServerDTO server)
        {
            Property propiedad = new Property();

            try
            {
                IServerProperty propiedadObtenida;

                switch (server.Name)
                {
                    case "GMAIL":
                        propiedadObtenida = new Gmail();
                        if (envio) propiedad = propiedadObtenida.getPropiedadEnviar(server);
                        else propiedad = propiedadObtenida.getPropiedadRecibir(server);
                        break;
                    case "OUTLOOK":
                        ///
                        break;
                    case "YAHOO":
                        ///
                        break;
                }
            }
            catch (Exception ex) { }

            return propiedad;
        }
示例#18
0
        public void CopyFrom_ExceptionTest()
        {
            var target = new Property<string>("TEST", "Test string");
            var replacement = new Property<int>("TEST", 100);

            target.CopyFrom(replacement);
        }
        public object GetValue(Property originalProperty)
        {
            var overridableProperty = GetOverridableProperty(originalProperty);
            var mergeElement = GetMergeElement(elementPath);

            if (mergeElement != null)
            {
                var entry = mergeElement.OverriddenProperties.
                    Cast<EnvironmentOverriddenPropertyElement>().
                    Where(x => ConfigurationMergePropertyMatchesProperty(x, overridableProperty)).
                    FirstOrDefault();
                if (entry != null)
                {
                    return overridableProperty.DeltaConfigurationStorageConverter.ConvertTo(originalProperty, CultureInfo.InvariantCulture, entry.OverriddenValue, originalProperty.PropertyType);
                }
            }

            if (lastMergeElements != null)
            {
                var entry = lastMergeElements.
                    Where(x => ConfigurationMergePropertyMatchesProperty(x, overridableProperty)).
                    FirstOrDefault();
                if (entry != null)
                {
                    return overridableProperty.DeltaConfigurationStorageConverter.ConvertTo(originalProperty, CultureInfo.InvariantCulture, entry.OverriddenValue, originalProperty.PropertyType);
                }
            }

            return originalProperty.Value;
        }
        private List<Property> GetCRMUserProperties()
        {
            List<Property> ContainerProperties = new List<Property>();

            Property userfqn = new Property
            {
                Name = "userfqn",
                MetaData = new MetaData("UserFQN", "UserFQN"),
                SoType = SourceCode.SmartObjects.Services.ServiceSDK.Types.SoType.Text,
                Type = "string"
            };
            ContainerProperties.Add(userfqn);

            Property userid = new Property
            {
                Name = "userid",
                MetaData = new MetaData("User Id", "User Id"),
                SoType = SourceCode.SmartObjects.Services.ServiceSDK.Types.SoType.Text,
                Type = "string"
            };
            ContainerProperties.Add(userid);

            ContainerProperties.AddRange(CRMFunctionsStandard.GetStandardReturnProperties());

            return ContainerProperties;
        }
示例#21
0
        public static void AddProperty(Property property)
        {
            using (var hdc = new HotelDataEntryDataContext())
            {
                hdc.Properties.InsertOnSubmit(new Property
                {
                    PropertyCode = property.PropertyCode,
                    PropertyName = property.PropertyName,
                    CurrencyId = property.CurrencyId,
                    UpdateDateTime = DateTime.Now,
                    Status = property.Status
                });

                try
                {
                    hdc.SubmitChanges();
                }
                catch (SqlException ex)
                {
                    if (ex.Number == 2601 || ex.Number == 2627)
                    {
                        throw;
                    }
                }
            }
        }
示例#22
0
        protected override void Init()
        {
            Position = Parent.GetProperty<Vector3>("Position");
            Scale = Parent.GetProperty<Vector3>("Scale");

            bb = new BoundingBox(Position.Value - Scale.Value / 2, Position.Value + Scale.Value /2);
        }
 public void NewProperty(Property property)
 {
     using (PropertyAccessClient _propertyAccessClient = new PropertyAccessClient(EndpointName.PropertyAccess))
     {
         _propertyAccessClient.Insert1(property);
     }
 }
        public ActionResult Create(PropertyInsertView property)
        {
            if (ModelState.IsValid)
            {
                if (!PhoneExist(property.PhoneNumber))
                {

                    Property p = new Property();
                    Block block = uow.BlockRepository.GetByID(property.BlockId);
                    p.Active = property.Active;//default to true, meaning property is avaliable for association
                    p.Balance = 0;
                    p.Block = block;
                    p.Notes = property.Notes;
                    p.NumberOfResidents = property.NumberOfResidents;
                    p.PropertyNumber = property.PropertyNumber;
                    p.Sold = property.Sold;
                    p.PhoneNumber = property.PhoneNumber;
                    uow.PropertyRepository.Insert(p);
                    uow.Save();
                    TempData["result"] = "单元创建成功!";
                    return RedirectToAction("Details", "Block", new { id = property.BlockId });
                }
                else
                {
                    ModelState.AddModelError("", "该电话号码已被注册,请重新输入");
                }
            }

            return View(property);
        }
示例#25
0
        public void CreateProperty()
        {
            Property prop = new Property("Name", "John");

            Assert.AreEqual("Name", prop.Name);
            Assert.AreEqual("John", prop.Value);
        }
示例#26
0
        public Camera(Entity ent, string name)
            : base(ent, name)
        {
            // Retrieve the Screen dimensions from global.
            m_ScreenDimensions = GlobalProperties.Instance.AddProperty<Vector2>("ScreenDimensions", Vector2.Zero);
            // Retrieve position, rotation, and zoom.
            m_Rotation = Entity.AddProperty<float>("Rotation", 0.0f);
            m_Zoom = Entity.AddProperty<float>("Zoom", GlobalProperties.Instance.AddProperty<float>("ZoomStart", 1.0f).Value);
            m_Position = Entity.AddProperty<Vector3>("Position", Vector3.UnitZ * m_Zoom.Value);

            m_View = Matrix.Identity;
            m_Proj = Matrix.Identity;

            m_Position.ValueChanged += new ValueChanged<Vector3>(PositionChanged);
            m_Zoom.ValueChanged += new ValueChanged<float>(ZoomChanged);
            m_Rotation.ValueChanged += new ValueChanged<float>(RotationChanged);

            RecalculateView(m_Position.Value);

            m_Proj = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(40.0f), 1.0f, 0.1f, 1000.0f);
            m_ScreenAdjust = Matrix.CreateTranslation(new Vector3(m_ScreenDimensions.Value.X / 2, m_ScreenDimensions.Value.Y / 2, 0.0f));

            // Whenever the entities "SetActive" event is triggered, make this camera active.
            Entity.AddEvent("SetActive", (o) => SetActiveCamera());
        }
        private object SerializeValue(Property prop)
        {
            switch(prop.Type)
            {
                case "IntProperty":
                case "QWordProperty":
                case "FloatProperty":
                case "StrProperty":
                case "NameProperty":
                case "ByteProperty":
                    return prop.Value;
                case "BoolProperty":
                    return ((int)prop.Value == 1);
                case "ArrayProperty":
                    var arrayPropDict = new Dictionary<string, object>();

                    IEnumerable<IEnumerable<KeyValuePair<string, object> > > serializedArray = ((List<PropertyDictionary>)prop.Value)
                        .Select(l => l.Where(p => p.Key != "None").Select(p => new KeyValuePair<string, object>(p.Key, SerializeValue(p.Value))));

                    // Combine each IEnumerable<KeyValuePair<string, object> > into a single IDictionary<string, object>
                    // Each KeyValuePair will be representing 1 property. We can combine them so we're left with a list of properties.

                    return serializedArray.Select(l => l.ToDictionary(kv => kv.Key, kv => kv.Value));
            }

            return null;
        }
		////////////////////////////////////////////////////////////////

		public Uri[] PropertyQuery (Property prop)
		{
			// FIXME: Should we support scanning the secondary
			// index as well?

			IndexReader primary_reader;
			primary_reader = LuceneCommon.GetReader (PrimaryStore);

			Term term;
			term = new Term (PropertyToFieldName (prop.Type, prop.Key), prop.Value.ToLower ());

			TermDocs term_docs;
			term_docs = primary_reader.TermDocs ();
			term_docs.Seek (term);

			ArrayList uri_list = new ArrayList ();
			while (term_docs.Next ()) {
				Document doc = primary_reader.Document (term_docs.Doc ());
				uri_list.Add (GetUriFromDocument (doc));
			}

			term_docs.Close ();
			LuceneCommon.ReleaseReader (primary_reader);

			return (Uri[]) uri_list.ToArray (typeof (Uri));
		}
 public TestFormViewModel() {
     this.FirstName = new Property<string>((x, errors) => ValidateName(x, "First", errors));
     this.LastName = new Property<string>((x, errors) => ValidateName(x, "Last", errors));
     this.Email = new Property<string>((x, errors) => {
         
     });
 }
示例#30
0
        public static new void Call(Arebis.CodeGeneration.IGenerationHost host, IZetboxContext ctx, Templates.Serialization.SerializationMembersList serializationList, Property prop)
        {
            if (host == null) { throw new ArgumentNullException("host"); }

            host.CallTemplate("Properties.NotifyingEnumProperty",
                ctx, serializationList, prop);
        }