public MdaMethodParamImpl(MdaMethod parentMethod, int parameterIndex,
			string paramName, PropertiesNode tags, System.Type paramType)
            : base(paramName, tags)
        {
            this.parentMethod = parentMethod;
            // TOCHECK see parent constructor!
            this.parameterIndex = parameterIndex;
            this.paramName = paramName;
            this.paramType = paramType;
        }
        // ------------------------------------------------------------------------
        //    private final MdaClass parentMdaClass;  .. see super
        //    private final String methodName; .. see super.getName
        // constructors
        // -------------------------------------------------------------------------
        public MdaMethodImpl(MdaClass parentMdaClass, int internalMethodIndex, 
		                     System.Reflection.MethodInfo method, PropertiesNode tags)
            : base(method.Name, tags, parentMdaClass)
        {
            this.internalMethodIndex = internalMethodIndex;
            this.method = method;
            this.returnType = method.ReturnType;
            if (returnType == null)
            {
                throw new System.InvalidOperationException("returnType == null for Method " + this);
            }
        }
        public MdaFieldImpl(MdaClass ownerMdaClass, int internalFieldIndex,
			string fieldName, PropertiesNode tags, PropMethodsDescriptor methods)
            : base(fieldName, tags, ownerMdaClass)
        {
            this.internalFieldIndex = internalFieldIndex;
            System.Type modelClass = ownerMdaClass.getModelClass();
            if (methods == null)
            {
                throw new System.ArgumentException();
            }
            // TODO fieldType is badly set
            // should be set correctly using MethodRecognizer + PropertFact / PropMethodsDescriptor
            System.Reflection.MethodInfo getterMethod = methods.getMethod;
            if (getterMethod == null)
            {
                log.error("failed to find read Method for " + modelClass + "." + fieldName + " ... subsequent calls to fieldInfo.getValue(object) will not work!");
                this.fieldType = typeof(object);
            }
            else
            {
                this.fieldType = getterMethod.ReturnType;
            }
        }
        private PropertiesNode RegisterSpanCell(CompositPanel panel)
        {
            _memento.BeginUpdate();

            var propertiesNode = new PropertiesNode(panel)
            {
                ControlName        = ObjectInspector.ControlRepository.GetName("GridPanelCell"),
                EnabledLayoutTypes = new List <EnabledItems>
                {
                    EnabledItems.Action,
                    EnabledItems.Data,
                    EnabledItems.Layout
                },
                OnCopy = () => false
            };

            if (ObjectInspector != null)
            {
                ObjectInspector.AddNode(propertiesNode);
            }
            _memento.EndUpdate();
            //возвращаем обертку PropertiesControl над добавляемой панелью
            return(propertiesNode);
        }
Esempio n. 5
0
        private static List <Layer> ParseLayers(MapDetails Map, List <TextureDetails> Textures)
        {
            var Result = new List <Layer>();

            foreach (XmlNode LayerNode in Map.MapElement.SelectNodes("layer"))
            {
                var    DataNode          = LayerNode.SelectNodes("data").Item(0);
                string CompressionFormat = DataNode.Attributes["compression"].Value;
                string EncodingFormat    = DataNode.Attributes["encoding"].Value;
                if (!CompressionFormat.Equals("gzip", StringComparison.InvariantCultureIgnoreCase) || !EncodingFormat.Equals("base64", StringComparison.InvariantCultureIgnoreCase))
                {
                    throw new FormatException("Currently the Tmx loader can only handled base-64 zlib tiles.");
                }
                string Base64Data       = DataNode.InnerXml.Trim();
                byte[] CompressedData   = Convert.FromBase64String(Base64Data);
                byte[] UncompressedData = new byte[1024];                 // NOTE: This must be a multiple of 4.
                Tile[,] Tiles = new Tile[Map.MapNumTilesWide, Map.MapNumTilesHigh];
                int MapIndex = 0;
                using (var GZipStream = new GZipStream(new MemoryStream(CompressedData), CompressionMode.Decompress, false)) {
                    while (true)
                    {
                        int BytesRead = GZipStream.Read(UncompressedData, 0, UncompressedData.Length);
                        if (BytesRead == 0)
                        {
                            break;
                        }
                        using (BinaryReader Reader = new BinaryReader(new MemoryStream(UncompressedData))) {
                            for (int i = 0; i < BytesRead; i += 4)
                            {
                                int GID  = Reader.ReadInt32();
                                int MapX = MapIndex % Map.MapNumTilesWide;
                                int MapY = MapIndex / Map.MapNumTilesWide;
                                MapIndex++;
                                if (GID == 0)
                                {
                                    continue;
                                }
                                var       Texture    = Textures.Last(c => c.StartGID <= GID);
                                int       TextureX   = (GID - Texture.StartGID) % Texture.NumTilesWide;
                                int       TextureY   = (GID - Texture.StartGID) / Texture.NumTilesWide;
                                Rectangle SourceRect = new Rectangle(TextureX * Texture.TileWidth, TextureY * Texture.TileHeight, Texture.TileWidth, Texture.TileHeight);
                                Rectangle Location   = new Rectangle(MapX * Map.MapTileWidth, MapY * Map.MapTileHeight, Map.MapTileWidth, Map.MapTileHeight);
                                Tile      Tile       = new Tile(Texture.Texture, SourceRect, Location, new Vector2(MapX, MapY));
                                Tiles[MapX, MapY] = Tile;
                            }
                        }
                    }
                }

                bool IsSolid = true;
                foreach (XmlNode PropertiesNode in LayerNode.SelectNodes("properties"))
                {
                    foreach (XmlNode Property in PropertiesNode.SelectNodes("property"))
                    {
                        string Name  = Property.Attributes["name"].Value;
                        string Value = Property.Attributes["value"].Value;
                        if (Name.Equals("Solid", StringComparison.InvariantCultureIgnoreCase))
                        {
                            IsSolid = bool.Parse(Value);
                        }
                    }
                }
                Layer Layer = new Layer(new Vector2(Map.MapTileWidth, Map.MapTileHeight), Tiles);
                Layer.IsSolid = IsSolid;
                Result.Add(Layer);
            }
            return(Result);
        }
 public void BeginUpdate()
 {
     _state = _inspector.FocusedPropertiesNode;
 }
 public MdaConstExpr(object constValue, MdaClass declaredType, PropertiesNode props)
 {
     this.constValue = constValue;
     this.declaredType = declaredType;
     this.props = props;
 }
 public MdaMemberImpl(string name, PropertiesNode tags, MdaClass parentMdaClass)
     : base(name, tags)
 {
     this.parentMdaClass = parentMdaClass;
 }
 public PropertyNode(PropertiesNode properties, ActivityBuilderXamlWriter writer)
     : base(writer)
 {
     this.properties = properties;
     base.CurrentWriter = properties.CurrentWriter;
 }
        //     ------------------------------------------------------------------------
        public MdaCollectionFieldImpl(MdaClass ownerMdaClass, int internalFieldIndex,
			string fieldName, PropertiesNode tags, CollectionPropMethodsDescriptor methods)
            : base(ownerMdaClass, internalFieldIndex, fieldName, tags, methods)
        {
            this.methods = methods;
        }
        public MdaRefFieldImpl(MdaClass ownerMdaClass, int internalFieldIndex,
			string fieldName, PropertiesNode tags, RefPropMethodsDescriptor methods)
            : base(ownerMdaClass, internalFieldIndex, fieldName, tags, methods)
        {
        }
 // ------------------------------------------------------------------------
 // TODO ???
 //    protected TagValuesMap extraTags = new DefaultTagValues();
 // constructor
 // ------------------------------------------------------------------------
 protected AbstractMdaItemImpl(string name, PropertiesNode tags)
 {
     this.name = name;
     this.tags = tags;
 }
 // constructor
 // -------------------------------------------------------------------------
 public MdaClassImpl(System.Type modelClass, PropertiesNode tags)
     : base(modelClass.Name, tags)
 {
     this.modelClass = modelClass;
 }