public void AddTypedProperty1() { var col = new PropertyCollection(); col.AddTypedProperty("foo"); Assert.AreEqual(1, col.PropertyList.Count); Assert.IsTrue(col.ContainsProperty(typeof(string))); }
public Level(string uniqueName, string caption, int number, PropertyCollection properties) { UniqueName = uniqueName; Caption = caption; Number = number; Properties = properties; }
public ObjectContent(XmlNode node) { if (node.Attributes[AttributeNames.MapObjectAttributes.Name] != null) Name = node.Attributes[AttributeNames.MapObjectAttributes.Name].Value; if (node.Attributes[AttributeNames.MapObjectAttributes.Type] != null) Type = node.Attributes[AttributeNames.MapObjectAttributes.Type].Value; if (node[AttributeNames.MapObjectAttributes.Properties] != null) properties = new PropertyCollection(node[AttributeNames.MapObjectAttributes.Properties]); int x = 0, y = 0, width = 0, height = 0; if (node.Attributes[AttributeNames.MapObjectAttributes.X] != null) x = Utilities.TryToParseInt(node.Attributes[AttributeNames.MapObjectAttributes.X].Value); if (node.Attributes[AttributeNames.MapObjectAttributes.Y] != null) y = Utilities.TryToParseInt(node.Attributes[AttributeNames.MapObjectAttributes.Y].Value); if (node.Attributes[AttributeNames.MapObjectAttributes.Width] != null) width = Utilities.TryToParseInt(node.Attributes[AttributeNames.MapObjectAttributes.Width].Value); if (node.Attributes[AttributeNames.MapObjectAttributes.Height] != null) height = Utilities.TryToParseInt(node.Attributes[AttributeNames.MapObjectAttributes.Height].Value); Bounds = new Rectangle(x, y, width, height); string objectPoints = String.Empty; if (node.Attributes[AttributeNames.MapObjectAttributes.GID] != null) { objectType = MapObjectType.Tile; GID = Utilities.TryToParseInt(node.Attributes[AttributeNames.MapObjectAttributes.GID].Value); } else if (node.Attributes[AttributeNames.MapObjectAttributes.Polygon] != null) { objectType = MapObjectType.Polygon; objectPoints = node.Attributes[AttributeNames.MapObjectAttributes.Polygon].Value; } else if (node.Attributes[AttributeNames.MapObjectAttributes.Polyline] != null) { objectType = MapObjectType.Polyline; objectPoints = node.Attributes[AttributeNames.MapObjectAttributes.Polyline].Value; } if(!String.IsNullOrEmpty(objectPoints)) { string[] splitPoints = objectPoints.Split(' '); foreach(string splitPoint in splitPoints) { string[] coordinates = splitPoint.Split(','); float coordinateX = 0f, coordinateY = 0f; float.TryParse(coordinates[0], NumberStyles.None, CultureInfo.InvariantCulture, out coordinateX); float.TryParse(coordinates[1], NumberStyles.None, CultureInfo.InvariantCulture, out coordinateY); points.Add(new Point((int)x, (int)y)); } } }
internal PropertyManager(PropertyClassManager classManager, object inst) { _classManager = classManager; _inst = inst; _custom = new PropertyCollection(_classManager.RegisteredNames); }
public Level(string uniqueName, string caption, int number) { UniqueName = uniqueName; Caption = caption; Number = number; Properties = new PropertyCollection(); }
/// <summary> /// Default constructor requires a name, the bounds of the object, the orientation of projection, and a collection of properties assigned to the object /// </summary> /// <param name="name"></param> /// <param name="bounds"></param> /// <param name="orientation"></param> /// <param name="properties"></param> public MapObject(string name, Rectangle bounds, Orientation orientation, PropertyCollection properties) { Name = name; Bounds = bounds; Orientation = orientation; Properties = properties; }
internal ObjectLayer(ContentReader reader, ObjectRegistry registry) : base(reader) { _registry = registry; _objects = new List<ObjectInstance>(); int objCount = reader.ReadInt32(); for (int i = 0; i < objCount; i++) { int id = reader.ReadInt32(); int dx = reader.ReadInt32(); int dy = reader.ReadInt32(); float rotation = reader.ReadSingle(); float scaleX = reader.ReadSingle(); float scaleY = reader.ReadSingle(); PropertyCollection properties = new PropertyCollection(reader); _objects.Add(new ObjectInstance(_registry.GetObjectPool(id), id, dx, dy) { Rotation = rotation, ScaleX = scaleX, ScaleY = scaleY, Properties = properties, }); } }
/// <summary> /// Initializes a new instance of the <see cref="Mesh"/> class. /// </summary> public Mesh() { VertexBuffers = new List<VertexBuffer>(); IndexBuffers = new List<IndexBuffer>(); MeshParts = new List<MeshPart>(); Properties = new PropertyCollection(); }
public TileSheetPropertiesCommand(TileSheet tileSheet, string newId, string newDescription, Size newTileSize, Size newMargin, Size newSpacing, Size newSheetSize, string newImageSource, PropertyCollection newProperties) { m_tileSheet = tileSheet; m_oldId = tileSheet.Id; m_oldDescription = tileSheet.Description; m_oldTileSize = tileSheet.TileSize; m_oldMargin = tileSheet.Margin; m_oldSpacing = tileSheet.Spacing; m_oldSheetSize = tileSheet.SheetSize; m_oldImageSource = tileSheet.ImageSource; m_oldProperties = new PropertyCollection(tileSheet.Properties); m_newId = newId; m_newDescription = newDescription; m_newTileSize = newTileSize; m_newMargin = newMargin; m_newSpacing = newSpacing; m_newSheetSize = newSheetSize; m_newImageSource = newImageSource; m_newProperties = newProperties; }
internal MapObject(string name, string type, Rectangle location, PropertyCollection properties) { Name = name; Type = type; Location = location; Properties = properties; }
public override ControlInfo OnCreateSaveConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultSaveConfigUI(props); configUI.SetPropertyControlValue( PropertyNames.BitDepth, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("PngFileType.ConfigUI.BitDepth.DisplayName")); PropertyControlInfo bitDepthPCI = configUI.FindControlForPropertyName(PropertyNames.BitDepth); bitDepthPCI.SetValueDisplayName(PngBitDepthUIChoices.AutoDetect, PdnResources.GetString("PngFileType.ConfigUI.BitDepth.AutoDetect.DisplayName")); bitDepthPCI.SetValueDisplayName(PngBitDepthUIChoices.Bpp32, PdnResources.GetString("PngFileType.ConfigUI.BitDepth.Bpp32.DisplayName")); bitDepthPCI.SetValueDisplayName(PngBitDepthUIChoices.Bpp24, PdnResources.GetString("PngFileType.ConfigUI.BitDepth.Bpp24.DisplayName")); bitDepthPCI.SetValueDisplayName(PngBitDepthUIChoices.Bpp8, PdnResources.GetString("PngFileType.ConfigUI.BitDepth.Bpp8.DisplayName")); configUI.SetPropertyControlType(PropertyNames.BitDepth, PropertyControlType.RadioButton); configUI.SetPropertyControlValue( PropertyNames.DitherLevel, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("PngFileType.ConfigUI.DitherLevel.DisplayName")); configUI.SetPropertyControlValue( PropertyNames.Threshold, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("PngFileType.ConfigUI.Threshold.DisplayName")); configUI.SetPropertyControlValue( PropertyNames.Threshold, ControlInfoPropertyNames.Description, PdnResources.GetString("PngFileType.ConfigUI.Threshold.Description")); return configUI; }
public MapEntity() { Layer = MapLayer.Default; FourCC = string.Empty; LayerCanChange = false; Fields = new PropertyCollection(); }
public Layer(XElement node) { //string Type = node.Name; Name = node.Attribute("name").Value; if (node.Attribute("width") != null) Width = int.Parse(node.Attribute("width").Value, CultureInfo.InvariantCulture); else Width = 0; if (node.Attribute("height") != null) Height = int.Parse(node.Attribute("height").Value, CultureInfo.InvariantCulture); else Height = 0; if (node.Attribute("opacity") != null) { Opacity = float.Parse(node.Attribute("opacity").Value, CultureInfo.InvariantCulture); } else Opacity = 1; if (node.Attribute("visible") != null) { Visible = int.Parse(node.Attribute("visible").Value, CultureInfo.InvariantCulture) == 1; } else Visible = true; XElement propertiesNode = node.Element("properties"); if (propertiesNode != null) { Properties = new PropertyCollection(propertiesNode); } }
/// <summary> /// Constructor for creating a Content object /// </summary> /// <param name="name">Name of the content</param> /// <param name="parentId">Id of the Parent content</param> /// <param name="contentType">ContentType for the current Content object</param> /// <param name="properties">Collection of properties</param> public Content(string name, int parentId, IContentType contentType, PropertyCollection properties) : base(name, parentId, contentType, properties) { Mandate.ParameterNotNull(contentType, "contentType"); _contentType = contentType; }
protected override ControlInfo OnCreateConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultConfigUI(props); configUI.SetPropertyControlValue(PropertyNames.Scale, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("CloudsEffect.ConfigDialog.ScaleLabel")); configUI.SetPropertyControlValue(PropertyNames.Power, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("CloudsEffect.ConfigDialog.RoughnessLabel")); configUI.SetPropertyControlValue(PropertyNames.Power, ControlInfoPropertyNames.SliderLargeChange, 0.25); configUI.SetPropertyControlValue(PropertyNames.Power, ControlInfoPropertyNames.SliderSmallChange, 0.05); configUI.SetPropertyControlValue(PropertyNames.Power, ControlInfoPropertyNames.UpDownIncrement, 0.01); PropertyControlInfo blendOpControl = configUI.FindControlForPropertyName(PropertyNames.BlendOp); blendOpControl.ControlProperties[ControlInfoPropertyNames.DisplayName].Value = PdnResources.GetString("CloudsEffect.ConfigDialog.BlendModeHeader.Text"); Type[] blendOpTypes = UserBlendOps.GetBlendOps(); foreach (Type blendOpType in blendOpTypes) { string blendOpDisplayName = UserBlendOps.GetBlendOpFriendlyName(blendOpType); blendOpControl.SetValueDisplayName(blendOpType, blendOpDisplayName); } configUI.SetPropertyControlType(PropertyNames.Seed, PropertyControlType.IncrementButton); configUI.SetPropertyControlValue(PropertyNames.Seed, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("CloudsEffect.ConfigDialog.SeedHeader.Text")); configUI.SetPropertyControlValue(PropertyNames.Seed, ControlInfoPropertyNames.ButtonText, PdnResources.GetString("CloudsEffect.ConfigDialog.ReseedButton.Text")); configUI.SetPropertyControlValue(PropertyNames.Seed, ControlInfoPropertyNames.Description, PdnResources.GetString("CloudsEffect.ConfigDialog.UsageLabel")); return configUI; }
public MapContent(string filePath, Renderer renderer, string contentRoot) { XmlDocument document = new XmlDocument(); document.Load(filePath); XmlNode mapNode = document[AttributeNames.MapAttributes.Map]; Version = mapNode.Attributes[AttributeNames.MapAttributes.Version].Value; Orientation = (Orientation)Enum.Parse(typeof(Orientation), mapNode.Attributes[AttributeNames.MapAttributes.Orientation].Value, true); Width = Utilities.TryToParseInt(mapNode.Attributes[AttributeNames.MapAttributes.Width].Value); Height = Utilities.TryToParseInt(mapNode.Attributes[AttributeNames.MapAttributes.Height].Value); TileWidth = Utilities.TryToParseInt(mapNode.Attributes[AttributeNames.MapAttributes.TileWidth].Value); TileHeight = Utilities.TryToParseInt(mapNode.Attributes[AttributeNames.MapAttributes.TileHeight].Value); XmlNode propertiesNode = document.SelectSingleNode(AttributeNames.MapAttributes.MapProperties); if (propertiesNode != null) properties = new PropertyCollection(propertiesNode); BuildTileSets(document); BuildLayers(document); BuildTileSetTextures(renderer, contentRoot); GenerateTileSourceRectangles(); }
internal Tileset(ContentReader reader) : this() { _manager = reader.ContentManager; int version = reader.ReadInt16(); int id = reader.ReadInt16(); TileWidth = reader.ReadInt16(); TileHeight = reader.ReadInt16(); string texAsset = reader.ReadString(); Properties = new PropertyCollection(reader); int tileCount = reader.ReadInt16(); for (int i = 0; i < tileCount; i++) { int tileId = reader.ReadInt16(); int tileX = reader.ReadInt16(); int tileY = reader.ReadInt16(); Tile tile = new Tile(tileId, this, tileX, tileY) { Properties = new PropertyCollection(reader), }; _tiles.Add(tileId, tile); } _texture = _manager.Load<Texture2D>(texAsset); }
protected override ControlInfo OnCreateConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultConfigUI(props); configUI.SetPropertyControlValue(PropertyNames.Amount1, ControlInfoPropertyNames.DisplayName, "Scale"); configUI.SetPropertyControlValue(PropertyNames.Amount1, ControlInfoPropertyNames.SliderLargeChange, 0.25); configUI.SetPropertyControlValue(PropertyNames.Amount1, ControlInfoPropertyNames.SliderSmallChange, 0.05); configUI.SetPropertyControlValue(PropertyNames.Amount1, ControlInfoPropertyNames.UpDownIncrement, 0.01); configUI.SetPropertyControlValue(PropertyNames.Amount2, ControlInfoPropertyNames.DisplayName, "Line Width"); configUI.SetPropertyControlValue(PropertyNames.Amount3, ControlInfoPropertyNames.DisplayName, "Line Color"); configUI.SetPropertyControlValue(PropertyNames.Amount3, ControlInfoPropertyNames.Description, "Transparent"); configUI.SetPropertyControlValue(PropertyNames.Amount4, ControlInfoPropertyNames.DisplayName, string.Empty); configUI.SetPropertyControlType(PropertyNames.Amount4, PropertyControlType.ColorWheel); configUI.SetPropertyControlValue(PropertyNames.Amount5, ControlInfoPropertyNames.DisplayName, "Offset"); configUI.SetPropertyControlValue(PropertyNames.Amount5, ControlInfoPropertyNames.SliderSmallChangeX, 0.05); configUI.SetPropertyControlValue(PropertyNames.Amount5, ControlInfoPropertyNames.SliderLargeChangeX, 0.25); configUI.SetPropertyControlValue(PropertyNames.Amount5, ControlInfoPropertyNames.UpDownIncrementX, 0.01); configUI.SetPropertyControlValue(PropertyNames.Amount5, ControlInfoPropertyNames.SliderSmallChangeY, 0.05); configUI.SetPropertyControlValue(PropertyNames.Amount5, ControlInfoPropertyNames.SliderLargeChangeY, 0.25); configUI.SetPropertyControlValue(PropertyNames.Amount5, ControlInfoPropertyNames.UpDownIncrementY, 0.01); Rectangle selection5 = EnvironmentParameters.GetSelection(EnvironmentParameters.SourceSurface.Bounds).GetBoundsInt(); ImageResource imageResource5 = ImageResource.FromImage(EnvironmentParameters.SourceSurface.CreateAliasedBitmap(selection5)); configUI.SetPropertyControlValue(PropertyNames.Amount5, ControlInfoPropertyNames.StaticImageUnderlay, imageResource5); return configUI; }
protected override ControlInfo OnCreateConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultConfigUI(props); configUI.SetPropertyControlValue(PropertyNames.Amount, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("TwistEffect.TwistAmount.Text")); configUI.SetPropertyControlValue(PropertyNames.Amount, ControlInfoPropertyNames.UseExponentialScale, true); configUI.SetPropertyControlValue(PropertyNames.Size, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("TwistEffect.TwistSize.Text")); configUI.SetPropertyControlValue(PropertyNames.Size, ControlInfoPropertyNames.SliderSmallChange, 0.05); configUI.SetPropertyControlValue(PropertyNames.Size, ControlInfoPropertyNames.SliderLargeChange, 0.25); configUI.SetPropertyControlValue(PropertyNames.Size, ControlInfoPropertyNames.UpDownIncrement, 0.01); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("TwistEffect.Offset.Text")); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderSmallChangeX, 0.05); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderLargeChangeX, 0.25); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.UpDownIncrementX, 0.01); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderSmallChangeY, 0.05); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderLargeChangeY, 0.25); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.UpDownIncrementY, 0.01); Surface sourceSurface = this.EnvironmentParameters.SourceSurface; Bitmap bitmap = sourceSurface.CreateAliasedBitmap(); ImageResource imageResource = ImageResource.FromImage(bitmap); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.StaticImageUnderlay, imageResource); configUI.SetPropertyControlValue(PropertyNames.Quality, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("TwistEffect.Antialias.Text")); return configUI; }
internal Settings(StyleCopCore core) { this.globalSettings = new PropertyCollection(); this.parserSettings = new Dictionary<string, AddInPropertyCollection>(); this.analyzerSettings = new Dictionary<string, AddInPropertyCollection>(); this.core = core; }
protected override ControlInfo OnCreateConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultConfigUI(props); configUI.SetPropertyControlValue(PropertyNames.Angle, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("RadialBlurEffect.ConfigDialog.RadialLabel")); configUI.FindControlForPropertyName(PropertyNames.Angle).ControlType.Value = PropertyControlType.AngleChooser; configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("RadialBlurEffect.ConfigDialog.OffsetLabel")); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderSmallChangeX, 0.05); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderLargeChangeX, 0.25); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.UpDownIncrementX, 0.01); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderSmallChangeY, 0.05); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderLargeChangeY, 0.25); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.UpDownIncrementY, 0.01); Surface sourceSurface = this.EnvironmentParameters.SourceSurface; Bitmap bitmap = sourceSurface.CreateAliasedBitmap(); ImageResource imageResource = ImageResource.FromImage(bitmap); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.StaticImageUnderlay, imageResource); configUI.SetPropertyControlValue(PropertyNames.Quality, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("RadialBlurEffect.ConfigDialog.QualityLabel")); configUI.SetPropertyControlValue(PropertyNames.Quality, ControlInfoPropertyNames.Description, PdnResources.GetString("RadialBlurEffect.ConfigDialog.QualityDescription")); return configUI; }
protected virtual void ReadDetail(XPathNavigator navigator, PropertyCollection collection, ReadingJournal journal) { Dictionary<string, string> attributes = GetAttributes(navigator); Type type = attributes["typeName"].ToType(); if (type != typeof(ContentItem)) { collection.Add(Parse(navigator.Value, type)); } else { int referencedItemID = int.Parse(navigator.Value); ContentItem referencedItem = journal.Find(referencedItemID); if (referencedItem != null) collection.Add(referencedItem); else journal.ItemAdded += (sender, e) => { if (e.AffectedItem.ID == referencedItemID) { collection.Add(e.AffectedItem); } }; } }
protected override ControlInfo OnCreateConfigUI(PropertyCollection props) { ControlInfo configUI = base.OnCreateConfigUI(props); configUI.SetPropertyControlValue(PropertyNames.Amount, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("PolarInversion.ConfigUI.Amount.DisplayName")); configUI.SetPropertyControlValue(PropertyNames.Amount, ControlInfoPropertyNames.UseExponentialScale, true); configUI.SetPropertyControlValue(PropertyNames.Amount, ControlInfoPropertyNames.SliderLargeChange, 0.25); configUI.SetPropertyControlValue(PropertyNames.Amount, ControlInfoPropertyNames.SliderSmallChange, 0.05); configUI.SetPropertyControlValue(PropertyNames.Amount, ControlInfoPropertyNames.UpDownIncrement, 0.01); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("PolarInversion.ConfigUI.Offset.DisplayName")); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderSmallChangeX, 0.05); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderLargeChangeX, 0.25); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.UpDownIncrementX, 0.01); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderSmallChangeY, 0.05); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderLargeChangeY, 0.25); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.UpDownIncrementY, 0.01); Rectangle selection = this.EnvironmentParameters.GetSelection(base.EnvironmentParameters.SourceSurface.Bounds).GetBoundsInt(); ImageResource propertyValue = ImageResource.FromImage(base.EnvironmentParameters.SourceSurface.CreateAliasedBitmap(selection)); configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.StaticImageUnderlay, propertyValue); configUI.SetPropertyControlValue(PropertyNames.EdgeBehavior, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("PolarInversion.ConfigUI.EdgeBehavior.DisplayName")); PropertyControlInfo edgeBehaviorPCI = configUI.FindControlForPropertyName(PropertyNames.EdgeBehavior); edgeBehaviorPCI.SetValueDisplayName(WarpEdgeBehavior.Clamp, PdnResources.GetString("PolarInversion.ConfigUI.EdgeBehavior.Clamp.DisplayName")); edgeBehaviorPCI.SetValueDisplayName(WarpEdgeBehavior.Reflect, PdnResources.GetString("PolarInversion.ConfigUI.EdgeBehavior.Reflect.DisplayName")); edgeBehaviorPCI.SetValueDisplayName(WarpEdgeBehavior.Wrap, PdnResources.GetString("PolarInversion.ConfigUI.EdgeBehavior.Wrap.DisplayName")); configUI.SetPropertyControlValue(PropertyNames.Quality, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("PolarInversion.ConfigUI.Quality.DisplayName")); return configUI; }
internal Tile(Texture2D texture, Rectangle source, PropertyCollection properties, bool[] collision) { Texture = texture; Source = source; Properties = properties; CollisionData = collision; }
private static void AddBooleanProperty(string propertyName, bool value, PropertyCollection properties, PropertyDescriptorCollection propertyDescriptors) { PropertyDescriptor<bool> propertyDescriptor = propertyDescriptors[propertyName] as PropertyDescriptor<bool>; if (propertyDescriptor != null) { properties.Add(new BooleanProperty(propertyDescriptor, value)); } }
internal MapObject(string name, string type, Rectangle location, List<Point> linePoints, PropertyCollection properties) { Name = name; Type = type; Location = location; Properties = properties; LinePoints = linePoints; }
static void TestRemove(ref PropertyCollection collection, int count) { for (int i = 0; i < count; i++) { collection.RemoveProperty(i); Assert.AreEqual(collection.GetProperty(i), null); } }
protected override ControlInfo OnCreateConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultConfigUI(props); configUI.SetPropertyControlValue(PropertyNames.Amount, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("SharpenEffect.ConfigDialog.SliderLabel")); return configUI; }
static void TestAdd(ref PropertyCollection collection, int count) { for (int i = 0; i < count; i++) { collection.SetProperty(i, i); Assert.AreEqual(collection.GetProperty(i), i); } }
public void TryGetPropertySafe_NotFound() { var col = new PropertyCollection(); var key = new object(); string value; Assert.IsFalse(col.TryGetPropertySafe(key, out value)); }
/// <summary> /// <para>Initializes an instance of the <see cref="TraceContextComponent"/> class.</para> /// </summary> /// <param name="configuration"> /// Configuration properties. /// </param> public TraceContextComponent(PropertyCollection configuration) : base(configuration) { maxLogSize = (ulong)configuration.Read("MaxLogSize"); logPath = (string)configuration.Read("LogPath"); }
public TextBufferStub(String contentType) { ContentType = new ContentTypeStub(contentType); Properties = new PropertyCollection(); }
public FKField(int fieldId, string column, int typeId, string typeName, int panelId, IFK fk, PropertyCollection attr = null, PropertyCollection rules = null) : base(fieldId, column, typeId, typeName, panelId, attr, rules) { this.fk = fk; }
public static Tuple <Mock <ITextView>, MockRepository> CreateTextViewWithVisibleLines( ITextBuffer textBuffer, int startLine, int?endLine = null, int?caretPosition = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); var endLineValue = endLine ?? startLine; var caretPositionValue = caretPosition ?? textBuffer.GetLine(startLine).Start.Position; var caret = factory.Create <ITextCaret>(); caret.SetupGet(x => x.Position).Returns( new CaretPosition( new VirtualSnapshotPoint(textBuffer.GetPoint(caretPositionValue)), factory.Create <IMappingPoint>().Object, PositionAffinity.Predecessor)); var firstLine = factory.Create <ITextViewLine>(); firstLine.SetupGet(x => x.Start).Returns(textBuffer.GetLine(startLine).Start); var lastLine = factory.Create <ITextViewLine>(); lastLine.SetupGet(x => x.End).Returns(textBuffer.GetLine(endLineValue).End); var lines = factory.Create <ITextViewLineCollection>(); lines.SetupGet(x => x.FirstVisibleLine).Returns(firstLine.Object); lines.SetupGet(x => x.LastVisibleLine).Returns(lastLine.Object); var visualBuffer = CreateTextBuffer(factory: factory); var textViewModel = factory.Create <ITextViewModel>(); textViewModel.SetupGet(x => x.VisualBuffer).Returns(visualBuffer.Object); var textDataModel = CreateTextDataModel(textBuffer, factory); // When creating the CommonOperations linked to the textview, // the roles are checked for the outlining manager. // Pretend we don't support anything var roles = factory.Create <ITextViewRoleSet>(); roles.Setup(x => x.Contains(It.IsAny <String>())).Returns(false); var properties = new PropertyCollection(); var textView = factory.Create <ITextView>(); var options = factory.Create <IEditorOptions>(); var bufferGraph = factory.Create <IBufferGraph>(); textView.SetupGet(x => x.TextBuffer).Returns(textBuffer); textView.SetupGet(x => x.TextViewLines).Returns(lines.Object); textView.SetupGet(x => x.Caret).Returns(caret.Object); textView.SetupGet(x => x.InLayout).Returns(false); textView.SetupGet(x => x.TextSnapshot).Returns(() => textBuffer.CurrentSnapshot); textView.SetupGet(x => x.Properties).Returns(properties); textView.SetupGet(x => x.BufferGraph).Returns(bufferGraph.Object); textView.SetupGet(x => x.TextViewModel).Returns(textViewModel.Object); textView.SetupGet(x => x.VisualSnapshot).Returns(visualBuffer.Object.CurrentSnapshot); textView.SetupGet(x => x.Roles).Returns(roles.Object); textView.SetupGet(x => x.Options).Returns(options.Object); textView.SetupGet(x => x.TextDataModel).Returns(textDataModel.Object); return(Tuple.Create(textView, factory)); }
protected override void OnCustomizeConfigUIWindowProperties(PropertyCollection props) { base.OnCustomizeConfigUIWindowProperties(props); //props[ControlInfoPropertyNames.WindowIsSizable].Value = true; }
public UserInfoRecordDescription(string channel) { Channel = channel; Properties = new PropertyCollection <object>(0); }
public override ControlInfo OnCreateSaveConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultSaveConfigUI(props); PropertyControlInfo formatPCI = configUI.FindControlForPropertyName(PropertyNames.FileFormat); formatPCI.ControlProperties[ControlInfoPropertyNames.DisplayName].Value = string.Empty; formatPCI.SetValueDisplayName(DdsFileFormat.BC1, this.strings.GetString("DdsFileFormat_BC1")); formatPCI.SetValueDisplayName(DdsFileFormat.BC1Srgb, this.strings.GetString("DdsFileFormat_BC1Srgb")); formatPCI.SetValueDisplayName(DdsFileFormat.BC2, this.strings.GetString("DdsFileFormat_BC2")); formatPCI.SetValueDisplayName(DdsFileFormat.BC2Srgb, this.strings.GetString("DdsFileFormat_BC2Srgb")); formatPCI.SetValueDisplayName(DdsFileFormat.BC3, this.strings.GetString("DdsFileFormat_BC3")); formatPCI.SetValueDisplayName(DdsFileFormat.BC3Srgb, this.strings.GetString("DdsFileFormat_BC3Srgb")); formatPCI.SetValueDisplayName(DdsFileFormat.BC4Unsigned, this.strings.GetString("DdsFileFormat_BC4Unsigned")); formatPCI.SetValueDisplayName(DdsFileFormat.BC5Unsigned, this.strings.GetString("DdsFileFormat_BC5Unsigned")); formatPCI.SetValueDisplayName(DdsFileFormat.BC5Signed, this.strings.GetString("DdsFileFormat_BC5Signed")); formatPCI.SetValueDisplayName(DdsFileFormat.BC6HUnsigned, this.strings.GetString("DdsFileFormat_BC6HUnsigned")); formatPCI.SetValueDisplayName(DdsFileFormat.BC7, this.strings.GetString("DdsFileFormat_BC7")); formatPCI.SetValueDisplayName(DdsFileFormat.BC7Srgb, this.strings.GetString("DdsFileFormat_BC7Srgb")); formatPCI.SetValueDisplayName(DdsFileFormat.B8G8R8A8, this.strings.GetString("DdsFileFormat_B8G8R8A8")); formatPCI.SetValueDisplayName(DdsFileFormat.B8G8R8A8Srgb, this.strings.GetString("DdsFileFormat_B8G8R8A8Srgb")); formatPCI.SetValueDisplayName(DdsFileFormat.B8G8R8X8, this.strings.GetString("DdsFileFormat_B8G8R8X8")); formatPCI.SetValueDisplayName(DdsFileFormat.B8G8R8X8Srgb, this.strings.GetString("DdsFileFormat_B8G8R8X8Srgb")); formatPCI.SetValueDisplayName(DdsFileFormat.R8G8B8A8, this.strings.GetString("DdsFileFormat_R8G8B8A8")); formatPCI.SetValueDisplayName(DdsFileFormat.R8G8B8A8Srgb, this.strings.GetString("DdsFileFormat_R8G8B8A8Srgb")); formatPCI.SetValueDisplayName(DdsFileFormat.R8G8B8X8, this.strings.GetString("DdsFileFormat_R8G8B8X8")); formatPCI.SetValueDisplayName(DdsFileFormat.B5G5R5A1, this.strings.GetString("DdsFileFormat_B5G5R5A1")); formatPCI.SetValueDisplayName(DdsFileFormat.B4G4R4A4, this.strings.GetString("DdsFileFormat_B4G4R4A4")); formatPCI.SetValueDisplayName(DdsFileFormat.B5G6R5, this.strings.GetString("DdsFileFormat_B5G6R5")); formatPCI.SetValueDisplayName(DdsFileFormat.B8G8R8, this.strings.GetString("DdsFileFormat_B8G8R8")); formatPCI.SetValueDisplayName(DdsFileFormat.R8Unsigned, this.strings.GetString("DdsFileFormat_R8Unsigned")); formatPCI.SetValueDisplayName(DdsFileFormat.R8G8Unsigned, this.strings.GetString("DdsFileFormat_R8G8Unsigned")); formatPCI.SetValueDisplayName(DdsFileFormat.R8G8Signed, this.strings.GetString("DdsFileFormat_R8G8Signed")); PropertyControlInfo compresionModePCI = configUI.FindControlForPropertyName(PropertyNames.BC7CompressionSpeed); compresionModePCI.ControlProperties[ControlInfoPropertyNames.DisplayName].Value = this.strings.GetString("BC7CompressionSpeed_DisplayName"); compresionModePCI.SetValueDisplayName(BC7CompressionSpeed.Fast, this.strings.GetString("BC7CompressionSpeed_Fast")); compresionModePCI.SetValueDisplayName(BC7CompressionSpeed.Medium, this.strings.GetString("BC7CompressionSpeed_Medium")); compresionModePCI.SetValueDisplayName(BC7CompressionSpeed.Slow, this.strings.GetString("BC7CompressionSpeed_Slow")); PropertyControlInfo errorMetricPCI = configUI.FindControlForPropertyName(PropertyNames.ErrorMetric); errorMetricPCI.ControlProperties[ControlInfoPropertyNames.DisplayName].Value = this.strings.GetString("ErrorMetric_DisplayName"); errorMetricPCI.ControlType.Value = PropertyControlType.RadioButton; errorMetricPCI.SetValueDisplayName(DdsErrorMetric.Perceptual, this.strings.GetString("ErrorMetric_Perceptual")); errorMetricPCI.SetValueDisplayName(DdsErrorMetric.Uniform, this.strings.GetString("ErrorMetric_Uniform")); PropertyControlInfo cubemapPCI = configUI.FindControlForPropertyName(PropertyNames.CubeMap); cubemapPCI.ControlProperties[ControlInfoPropertyNames.DisplayName].Value = string.Empty; cubemapPCI.ControlProperties[ControlInfoPropertyNames.Description].Value = this.strings.GetString("CubeMap_Description"); PropertyControlInfo generateMipPCI = configUI.FindControlForPropertyName(PropertyNames.GenerateMipMaps); generateMipPCI.ControlProperties[ControlInfoPropertyNames.DisplayName].Value = string.Empty; generateMipPCI.ControlProperties[ControlInfoPropertyNames.Description].Value = this.strings.GetString("GenerateMipMaps_Description"); PropertyControlInfo mipResamplingPCI = configUI.FindControlForPropertyName(PropertyNames.MipMapResamplingAlgorithm); mipResamplingPCI.ControlProperties[ControlInfoPropertyNames.DisplayName].Value = string.Empty; mipResamplingPCI.SetValueDisplayName(ResamplingAlgorithm.NearestNeighbor, this.strings.GetString("ResamplingAlgorithm_NearestNeighbor")); mipResamplingPCI.SetValueDisplayName(ResamplingAlgorithm.Bicubic, this.strings.GetString("ResamplingAlgorithm_Bicubic")); mipResamplingPCI.SetValueDisplayName(ResamplingAlgorithm.Bilinear, this.strings.GetString("ResamplingAlgorithm_Bilinear")); mipResamplingPCI.SetValueDisplayName(ResamplingAlgorithm.Fant, this.strings.GetString("ResamplingAlgorithm_Fant")); mipResamplingPCI.SetValueDisplayName(ResamplingAlgorithm.SuperSampling, this.strings.GetString("ResamplingAlgorithm_SuperSampling")); PropertyControlInfo forumLinkPCI = configUI.FindControlForPropertyName(PropertyNames.ForumLink); forumLinkPCI.ControlProperties[ControlInfoPropertyNames.DisplayName].Value = this.strings.GetString("ForumLink_DisplayName"); forumLinkPCI.ControlProperties[ControlInfoPropertyNames.Description].Value = this.strings.GetString("ForumLink_Description"); PropertyControlInfo githubLinkPCI = configUI.FindControlForPropertyName(PropertyNames.GitHubLink); githubLinkPCI.ControlProperties[ControlInfoPropertyNames.DisplayName].Value = string.Empty; githubLinkPCI.ControlProperties[ControlInfoPropertyNames.Description].Value = "GitHub"; // GitHub is a brand name that should not be localized. return(configUI); }
/// <summary> /// Appends its data points into new or existing property collection /// </summary> /// <param name="data">Property collection to add data into</param> /// <returns> /// Updated or newly created property collection /// </returns> /// <exception cref="NotImplementedException"></exception> PropertyCollection IAppendDataFields.AppendDataFields(PropertyCollection data) { return(AppendDataFields(data as PropertyCollectionExtended)); }
protected void AddMessageBoxStyle(XmlNode XMLMessageBox) { string name = Xml.Att(XMLMessageBox.Attributes["name"]); // Empty style name is the same as "default" if (name == null || name == "") { name = "__defaultMessageBox__"; } PropertyCollection msgStyle = new PropertyCollection(); string style = Xml.Att(XMLMessageBox.Attributes["style"]); msgStyle.Set("width", styleSheet.Apply(style, "width", XMLMessageBox.Attributes)); msgStyle.Set("y", styleSheet.Apply(style, "y", XMLMessageBox.Attributes)); msgStyle.Set("alignV", styleSheet.Apply(style, "alignV", XMLMessageBox.Attributes)); foreach (XmlNode element in XMLMessageBox.ChildNodes) { style = Xml.Att(element.Attributes["style"]); switch (element.Name) { case "title": msgStyle.Set("titleFontSize", styleSheet.Apply(style, "fontSize", element.Attributes)); msgStyle.Set("titleFontFace", styleSheet.Apply(style, "fontFace", element.Attributes)); msgStyle.Set("titlePaddingTop", styleSheet.Apply(style, "paddingTop", element.Attributes)); break; case "body": msgStyle.Set("bodyFontSize", styleSheet.Apply(style, "fontSize", element.Attributes)); msgStyle.Set("bodyFontFace", styleSheet.Apply(style, "fontFace", element.Attributes)); msgStyle.Set("bodyPaddingTop", styleSheet.Apply(style, "paddingTop", element.Attributes)); break; case "background": msgStyle.Set("backgroundColour", styleSheet.Apply(style, "colour", element.Attributes)); msgStyle.Set("backgroundSrc", styleSheet.Apply(style, "src", element.Attributes)); break; case "button": msgStyle.Set("buttonPaddingTop", styleSheet.Apply(style, "paddingTop", element.Attributes)); msgStyle.Set("buttonY", styleSheet.Apply(style, "y", element.Attributes)); msgStyle.Set("buttonWidth", styleSheet.Apply(style, "width", element.Attributes)); msgStyle.Set("buttonHeight", styleSheet.Apply(style, "height", element.Attributes)); foreach (XmlNode child in element.ChildNodes) { style = Xml.Att(child.Attributes["style"]); if (child.Name == "text") { //msgStyle.Set("buttonTextAlign", styleSheet.Apply(style, "textAlign", child.Attributes)); msgStyle.Set("buttonFontSize", styleSheet.Apply(style, "fontSize", child.Attributes)); msgStyle.Set("buttonFontFace", styleSheet.Apply(style, "fontFace", child.Attributes)); } else if (child.Name == "background") { msgStyle.Set("buttonBackgroundSrc", styleSheet.Apply(style, "src", child.Attributes)); msgStyle.Set("buttonBackgroundColour", styleSheet.Apply(style, "colour", child.Attributes)); //msgStyle.Set("buttonBackgroundScale", styleSheet.Apply(style, "scale", child.Attributes)); } else { throw new Exception("Button has unexpected element: " + element.Name); } } break; default: throw new Exception(string.Format("Encountered unknown messagebox child: {0}", element.Name)); } } styleSheet.Add(name, msgStyle); }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken token, RenderArgs dstArgs, RenderArgs srcArgs) { int blurRadius = token.GetProperty <Int32Property>(PropertyNames.BlurRadius).Value; int brightness = token.GetProperty <Int32Property>(PropertyNames.Brightness).Value; Pair <double, double> position = token.GetProperty <DoubleVectorProperty>(PropertyNames.Position).Value; this.keepOriginal = token.GetProperty <BooleanProperty>(PropertyNames.KeepOriginal).Value; Rectangle selection = this.EnvironmentParameters.SelectionBounds; if (this.trimmedBounds.IsEmpty) { this.trimmedBounds = GetTrimmedBounds(srcArgs.Surface, selection); } float ratio = (float)selection.Width / selection.Height; Size ratioSize = new Size(this.trimmedBounds.Width, this.trimmedBounds.Height); if (ratioSize.Width < ratioSize.Height * ratio) { ratioSize.Height = (int)Math.Round(this.trimmedBounds.Width / ratio); } else if (ratioSize.Width > ratioSize.Height * ratio) { ratioSize.Width = (int)Math.Round(this.trimmedBounds.Height * ratio); } PointF offsetForCenter = new PointF(Math.Abs(ratioSize.Width - this.trimmedBounds.Width) / 2f, Math.Abs(ratioSize.Height - this.trimmedBounds.Height) / 2f); Rectangle srcRect = new Rectangle { X = (int)Math.Round(this.trimmedBounds.X + offsetForCenter.X + (position.First * offsetForCenter.X)), Y = (int)Math.Round(this.trimmedBounds.Y + offsetForCenter.Y + (position.Second * offsetForCenter.Y)), Width = ratioSize.Width, Height = ratioSize.Height }; if (this.enlargedSurface == null) { this.enlargedSurface = new Surface(selection.Size); } using (Surface ratioSurface = new Surface(ratioSize)) { ratioSurface.CopySurface(srcArgs.Surface, Point.Empty, srcRect); this.enlargedSurface.FitSurface(ResamplingAlgorithm.Bicubic, ratioSurface); } if (selection.Size != srcArgs.Surface.Size) { if (this.clampedSurface == null) { this.clampedSurface = new Surface(srcArgs.Surface.Size); } for (int y = Math.Max(0, selection.Top - 200); y < Math.Min(this.clampedSurface.Height, selection.Bottom + 200); y++) { if (this.IsCancelRequested) { return; } for (int x = Math.Max(0, selection.Left - 200); x < Math.Min(this.clampedSurface.Width, selection.Right + 200); x++) { this.clampedSurface[x, y] = this.enlargedSurface.GetBilinearSampleClamped(x - selection.Left, y - selection.Top); } } } else { this.clampedSurface = this.enlargedSurface; } if (this.effectsSurface == null) { this.effectsSurface = new Surface(srcArgs.Surface.Size); } // Setup for calling the Gaussian Blur effect PropertyCollection blurProps = this.blurEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken BlurParameters = new PropertyBasedEffectConfigToken(blurProps); BlurParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, blurRadius); this.blurEffect.SetRenderInfo(BlurParameters, new RenderArgs(this.effectsSurface), new RenderArgs(this.clampedSurface)); // Setup for calling the Brightness and Contrast Adjustment function PropertyCollection bacProps = this.bacAdjustment.CreatePropertyCollection(); PropertyBasedEffectConfigToken bacParameters = new PropertyBasedEffectConfigToken(bacProps); bacParameters.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Brightness, brightness); bacParameters.SetPropertyValue(BrightnessAndContrastAdjustment.PropertyNames.Contrast, 0); this.bacAdjustment.SetRenderInfo(bacParameters, new RenderArgs(this.effectsSurface), new RenderArgs(this.effectsSurface)); base.OnSetRenderInfo(token, dstArgs, srcArgs); }
private static string GenerateDataTablePropertyArray(DataTableProcessor dataTableProcessor) { List <PropertyCollection> propertyCollections = new List <PropertyCollection>(); for (int i = 0; i < dataTableProcessor.RawColumnCount; i++) { if (dataTableProcessor.IsCommentColumn(i)) { // 注释列 continue; } if (dataTableProcessor.IsIdColumn(i)) { // 编号列 continue; } string name = dataTableProcessor.GetName(i); if (!EndWithNumberRegex.IsMatch(name)) { continue; } string propertyCollectionName = EndWithNumberRegex.Replace(name, string.Empty); int id = int.Parse(EndWithNumberRegex.Match(name).Value); PropertyCollection propertyCollection = null; foreach (PropertyCollection pc in propertyCollections) { if (pc.Name == propertyCollectionName) { propertyCollection = pc; break; } } if (propertyCollection == null) { propertyCollection = new PropertyCollection(propertyCollectionName, dataTableProcessor.GetLanguageKeyword(i)); propertyCollections.Add(propertyCollection); } propertyCollection.AddItem(id, name); } StringBuilder stringBuilder = new StringBuilder(); bool firstProperty = true; foreach (PropertyCollection propertyCollection in propertyCollections) { if (firstProperty) { firstProperty = false; } else { stringBuilder.AppendLine().AppendLine(); } stringBuilder .AppendFormat(" private KeyValuePair<int, {1}>[] m_{0} = null;", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() .AppendLine() .AppendFormat(" public int {0}Count", propertyCollection.Name).AppendLine() .AppendLine(" {") .AppendLine(" get") .AppendLine(" {") .AppendFormat(" return m_{0}.Length;", propertyCollection.Name).AppendLine() .AppendLine(" }") .AppendLine(" }") .AppendLine() .AppendFormat(" public {1} Get{0}(int id)", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() .AppendLine(" {") .AppendFormat(" foreach (KeyValuePair<int, {1}> i in m_{0})", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() .AppendLine(" {") .AppendLine(" if (i.Key == id)") .AppendLine(" {") .AppendLine(" return i.Value;") .AppendLine(" }") .AppendLine(" }") .AppendLine() .AppendFormat(" throw new GameFrameworkException(Utility.Text.Format(\"Get{0} with invalid id '{{0}}'.\", id.ToString()));", propertyCollection.Name).AppendLine() .AppendLine(" }") .AppendLine() .AppendFormat(" public {1} Get{0}At(int index)", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() .AppendLine(" {") .AppendFormat(" if (index < 0 || index >= m_{0}.Length)", propertyCollection.Name).AppendLine() .AppendLine(" {") .AppendFormat(" throw new GameFrameworkException(Utility.Text.Format(\"Get{0}At with invalid index '{{0}}'.\", index.ToString()));", propertyCollection.Name).AppendLine() .AppendLine(" }") .AppendLine() .AppendFormat(" return m_{0}[index].Value;", propertyCollection.Name).AppendLine() .Append(" }"); } if (propertyCollections.Count > 0) { stringBuilder.AppendLine().AppendLine(); } stringBuilder .AppendLine(" private void GeneratePropertyArray()") .AppendLine(" {"); firstProperty = true; foreach (PropertyCollection propertyCollection in propertyCollections) { if (firstProperty) { firstProperty = false; } else { stringBuilder.AppendLine().AppendLine(); } stringBuilder .AppendFormat(" m_{0} = new KeyValuePair<int, {1}>[]", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() .AppendLine(" {"); int itemCount = propertyCollection.ItemCount; for (int i = 0; i < itemCount; i++) { KeyValuePair <int, string> item = propertyCollection.GetItem(i); stringBuilder.AppendFormat(" new KeyValuePair<int, {0}>({1}, {2}),", propertyCollection.LanguageKeyword, item.Key.ToString(), item.Value).AppendLine(); } stringBuilder.Append(" };"); } stringBuilder .AppendLine() .Append(" }"); return(stringBuilder.ToString()); }
/// <summary> /// Initializes a new instance of the <see cref="CompilerContext"/> class. /// </summary> public CompilerContext() { Properties = new PropertyCollection(); }
public UserInfoRecordDescription(UserInfoRecordDescription description) { Channel = description.Channel; Properties = new PropertyCollection <object>(description.Properties ?? new PropertyCollection <object>(0)); }
public TilePropertiesCommand(Tile tile, string newId, BlendMode newBlendMode, PropertyCollection newProperties) { m_tile = tile; m_oldId = tile.Id; m_oldBlendMode = tile.BlendMode; m_oldProperties = new PropertyCollection(tile.Properties); m_newId = newId; m_newBlendMode = newBlendMode; m_newProperties = newProperties; m_description = "Change tile properties"; }
public static PropertyCollection getDefaultStructValue(string className, bool stripTransients) { bool isImmutable = UnrealObjectInfo.IsImmutable(className, MEGame.ME2); if (Structs.ContainsKey(className)) { ClassInfo info = Structs[className]; try { PropertyCollection structProps = new PropertyCollection(); ClassInfo tempInfo = info; while (tempInfo != null) { foreach ((string propName, PropertyInfo propInfo) in tempInfo.properties) { if (stripTransients && propInfo.Transient) { continue; } if (getDefaultProperty(propName, propInfo, stripTransients, isImmutable) is Property uProp) { structProps.Add(uProp); } } if (!Structs.TryGetValue(tempInfo.baseClass, out tempInfo)) { tempInfo = null; } } structProps.Add(new NoneProperty()); string filepath = null; if (ME2Directory.BioGamePath != null) { filepath = Path.Combine(ME2Directory.BioGamePath, info.pccPath); } Stream loadStream = null; if (File.Exists(info.pccPath)) { filepath = info.pccPath; loadStream = new MemoryStream(File.ReadAllBytes(info.pccPath)); } else if (info.pccPath == UnrealObjectInfo.Me3ExplorerCustomNativeAdditionsName) { filepath = "GAMERESOURCES_ME2"; loadStream = Utilities.LoadFileFromCompressedResource("GameResources.zip", CoreLib.CustomResourceFileName(MEGame.ME2)); } else if (filepath != null && File.Exists(filepath)) { loadStream = new MemoryStream(File.ReadAllBytes(filepath)); } #if AZURE else if (MiniGameFilesPath != null && File.Exists(Path.Combine(MiniGameFilesPath, info.pccPath))) { // Load from test minigame folder. This is only really useful on azure where we don't have access to // games filepath = Path.Combine(MiniGameFilesPath, info.pccPath); loadStream = new MemoryStream(File.ReadAllBytes(filepath)); } #endif if (loadStream != null) { using (IMEPackage importPCC = MEPackageHandler.OpenMEPackageFromStream(loadStream, filepath, useSharedPackageCache: true)) { var exportToRead = importPCC.GetUExport(info.exportIndex); byte[] buff = exportToRead.Data.Skip(0x30).ToArray(); PropertyCollection defaults = PropertyCollection.ReadProps(exportToRead, new MemoryStream(buff), className); foreach (var prop in defaults) { structProps.TryReplaceProp(prop); } } } return(structProps); } catch { return(null); } } return(null); }
public void SetProperties(PropertyCollection properties) { _properties = properties; }
static void Main(string[] args) { for (int i = 0; i < args.Length; i++) { switch (args[i]) { case "/proc": if (i + 1 == args.Length) { Console.WriteLine("Use /proc <N> to specify number of processors"); return; } int numProcs; if (Int32.TryParse(args[i + 1], out numProcs)) { // only increment i if successful b/c we're going to continue the run // with the default # of processors and don't want to automatically // eat the next parameter. ++i; Processor.LogicalCpuCount = numProcs; } else { Console.WriteLine("You must specify a integer for /proc <N>, continuing with default"); } break; case "/image": if (i + 1 == args.Length) { Console.WriteLine("Use /image <filename> to specify a file to perform benchmark with"); return; } ++i; benchmarkImageName = args[i]; if (!File.Exists(benchmarkImageName)) { Console.WriteLine("Specified image doesn't exist"); return; } break; case "/tsv": useTsvOutput = true; break; case "/?": PrintHelp(); return; default: break; } } //Processor.LogicalCpuCount = 1; Console.WriteLine("PdnBench v" + PdnInfo.GetVersion()); Console.WriteLine("Running in " + (8 * Marshal.SizeOf(typeof(IntPtr))) + "-bit mode on Windows " + Environment.OSVersion.Version.ToString() + " " + OS.Revision + (OS.Revision.Length > 0 ? " " : string.Empty) + OS.Type + " " + Processor.NativeArchitecture.ToString().ToLower()); Console.WriteLine("Processor: " + Processor.LogicalCpuCount + "x \"" + Processor.CpuName + "\" @ ~" + GetCpuSpeed() + " MHz"); Console.WriteLine("Memory: " + ((Memory.TotalPhysicalBytes / 1024) / 1024) + " MB"); Console.WriteLine(); Console.WriteLine("Using " + Processor.LogicalCpuCount + " threads."); ArrayList benchmarks = new ArrayList(); Document document; Console.Write("Loading image ... "); Stream imageStream = null; try { imageStream = (defaultImageName == benchmarkImageName) ? Assembly.GetExecutingAssembly().GetManifestResourceStream(benchmarkImageName) : new FileStream(benchmarkImageName, FileMode.Open); JpegFileType jft = new JpegFileType(); document = jft.Load(imageStream); } finally { if (imageStream != null) { imageStream.Dispose(); } } Console.WriteLine("(" + document.Width + " x " + document.Height + ") done"); Surface surface = ((BitmapLayer)document.Layers[0]).Surface; Surface dst = new Surface(surface.Width * 4, surface.Height * 4); #if EFFECTS for (double i = 0; i < (2 * Math.PI); i += 70.0 * ((2 * Math.PI) / 360.0)) { benchmarks.Add( new EffectBenchmark("Rotate/Zoom at " + ((i * 180.0) / Math.PI).ToString("F2") + " degrees", 3, new RotateZoomEffect(), new RotateZoomEffectConfigToken( true, (float)(Math.PI * 0.3f), (float)((Math.PI * -0.4) + i), 50, 0.5f, new PointF(-0.2f, 0.3f), false, true), surface)); } for (int i = 1; i <= 4; i += 3) { for (int j = 10; j < 100; j += 75) { OilPaintingEffect e = new OilPaintingEffect(); PropertyCollection props = e.CreatePropertyCollection(); props[OilPaintingEffect.PropertyNames.BrushSize].Value = i; props[OilPaintingEffect.PropertyNames.Coarseness].Value = j; benchmarks.Add( new EffectBenchmark( "Oil Painting, brush size = " + i + ", coarseness = " + j, 1, e, new PropertyBasedEffectConfigToken(props), surface)); } } for (int i = 2; i <= 200; i += i) { GaussianBlurEffect e = new GaussianBlurEffect(); PropertyCollection props = e.CreatePropertyCollection(); props[GaussianBlurEffect.PropertyNames.Radius].Value = i; benchmarks.Add( new EffectBenchmark( "Gaussian Blur with radius of " + i, 1, e, new PropertyBasedEffectConfigToken(props), surface)); } for (int i = 1; i <= 4; i += 3) { SharpenEffect e = new SharpenEffect(); PropertyCollection props = e.CreatePropertyCollection(); props[SharpenEffect.PropertyNames.Amount].Value = i; benchmarks.Add( new EffectBenchmark( "Sharpen with value of " + i, 1, e, new PropertyBasedEffectConfigToken(props), surface)); } for (int i = 81; i >= 5; i /= 3) { CloudsEffect e = new CloudsEffect(); PropertyCollection props = e.CreatePropertyCollection(); props["Scale"].Value = 50; props["Power"].Value = (double)i / 100.0; props["Seed"].Value = 12345 % 255; props["BlendOp"].Value = typeof(UserBlendOps.NormalBlendOp); benchmarks.Add( new EffectBenchmark( "Clouds, roughness = " + i, 2, e, new PropertyBasedEffectConfigToken(props), surface)); } for (int i = 4; i <= 64; i *= 4) { MedianEffect e = new MedianEffect(); PropertyCollection props = e.CreatePropertyCollection(); props[MedianEffect.PropertyNames.Radius].Value = i; props[MedianEffect.PropertyNames.Percentile].Value = 50; benchmarks.Add( new EffectBenchmark( "Median, radius " + i, 1, e, new PropertyBasedEffectConfigToken(props), surface)); } for (int i = 4; i <= 64; i *= 4) { UnfocusEffect e = new UnfocusEffect(); PropertyCollection props = e.CreatePropertyCollection(); props[UnfocusEffect.PropertyNames.Radius].Value = i; benchmarks.Add( new EffectBenchmark( "Unfocus, radius " + i, 1, e, new PropertyBasedEffectConfigToken(props), surface)); } { MotionBlurEffect e = new MotionBlurEffect(); PropertyCollection props = e.CreatePropertyCollection(); props[MotionBlurEffect.PropertyNames.Angle].Value = 0.0; props[MotionBlurEffect.PropertyNames.Distance].Value = 15; props[MotionBlurEffect.PropertyNames.Centered].Value = true; benchmarks.Add( new EffectBenchmark( "Motion Blur, Horizontal", 1, e, new PropertyBasedEffectConfigToken(props), surface)); } { MotionBlurEffect e = new MotionBlurEffect(); PropertyCollection props = e.CreatePropertyCollection(); props[MotionBlurEffect.PropertyNames.Angle].Value = 90.0; props[MotionBlurEffect.PropertyNames.Distance].Value = 15; props[MotionBlurEffect.PropertyNames.Centered].Value = true; benchmarks.Add( new EffectBenchmark( "Motion Blur, Vertical", 1, e, new PropertyBasedEffectConfigToken(props), surface)); } { ReduceNoiseEffect e = new ReduceNoiseEffect(); PropertyCollection props = e.CreatePropertyCollection(); benchmarks.Add( new EffectBenchmark( "Reduce Noise (3x)", 3, e, new PropertyBasedEffectConfigToken(props), dst)); } { MandelbrotFractalEffect e = new MandelbrotFractalEffect(); PropertyCollection props = e.CreatePropertyCollection(); benchmarks.Add( new EffectBenchmark( "Mandelbrot Fractal", 1, e, new PropertyBasedEffectConfigToken(props), surface)); } { JuliaFractalEffect e = new JuliaFractalEffect(); PropertyCollection props = e.CreatePropertyCollection(); benchmarks.Add( new EffectBenchmark( "Julia Fractal", 1, e, new PropertyBasedEffectConfigToken(props), surface)); } #endif #if RESIZE // Resize benchmarks for (int i = 1; i < 8; i += 2) { int newWidth = i * (dst.Width / 8); int newHeight = i * (dst.Height / 8); Surface dstWindow = dst.CreateWindow(new Rectangle(0, 0, newWidth, newHeight)); benchmarks.Add(new ResizeBenchmark("Resize from " + surface.Width + "x" + surface.Height + " to " + newWidth + "x" + newHeight, surface, dstWindow)); benchmarks.Add(new ResizeBenchmark("Resize from " + newWidth + "x" + newHeight + " to " + surface.Width + "x" + surface.Height, dstWindow, surface)); } #endif #if GRADIENT // Gradient benchmarks benchmarks.Add(new GradientBenchmark( "Linear reflected gradient @ " + dst.Width + "x" + dst.Height + " (5x)", dst, new GradientRenderers.LinearReflected(false, new UserBlendOps.NormalBlendOp()), 2)); benchmarks.Add(new GradientBenchmark( "Conical gradient @ " + dst.Width + "x" + dst.Height + " (5x)", dst, new GradientRenderers.Conical(false, new UserBlendOps.NormalBlendOp()), 2)); benchmarks.Add(new GradientBenchmark( "Radial gradient @ " + dst.Width + "x" + dst.Height + " (5x)", dst, new GradientRenderers.Radial(false, new UserBlendOps.NormalBlendOp()), 2)); #endif #if COMPOSITION // Composition benchmarks Document doc1 = new Document(surface.Size); BitmapLayer layer1 = Layer.CreateBackgroundLayer(doc1.Width, doc1.Height); layer1.Surface.CopySurface(surface); doc1.Layers.Add(layer1); doc1.Layers.Add(layer1.Clone()); doc1.Layers.Add(layer1.Clone()); doc1.Layers.Add(layer1.Clone()); benchmarks.Add(new CompositionBenchmark("Compositing one layer, Normal blend mode, 255 opacity (" + CompositionBenchmark.Iterations + "x)", doc1, surface, delegate(int layerIndex, Layer layer) { if (layerIndex == 0) { layer.Visible = true; layer.Opacity = 255; ((BitmapLayer)layer).SetBlendOp(new UserBlendOps.NormalBlendOp()); } else { layer.Visible = false; } })); benchmarks.Add(new CompositionBenchmark("Compositing one layer, Normal blend mode, 128 opacity (" + CompositionBenchmark.Iterations + "x)", doc1, surface, delegate(int layerIndex, Layer layer) { if (layerIndex == 0) { layer.Visible = true; layer.Opacity = 128; ((BitmapLayer)layer).SetBlendOp(new UserBlendOps.NormalBlendOp()); } else { layer.Visible = false; } })); benchmarks.Add(new CompositionBenchmark("Compositing four layers, Normal blend mode, 255 opacity (" + CompositionBenchmark.Iterations + "x)", doc1, surface, delegate(int layerIndex, Layer layer) { layer.Visible = true; layer.Opacity = 255; ((BitmapLayer)layer).SetBlendOp(new UserBlendOps.NormalBlendOp()); })); benchmarks.Add(new CompositionBenchmark("Compositing four layers, Normal blend mode, 255 (layer 0) and 128 (layer 1-3) opacity (" + CompositionBenchmark.Iterations + "x)", doc1, surface, delegate(int layerIndex, Layer layer) { layer.Visible = true; layer.Opacity = 128; ((BitmapLayer)layer).SetBlendOp(new UserBlendOps.NormalBlendOp()); })); benchmarks.Add(new CompositionBenchmark("Compositing four layers, Normal blend mode, 128 opacity (" + CompositionBenchmark.Iterations + "x)", doc1, surface, delegate(int layerIndex, Layer layer) { layer.Visible = true; layer.Opacity = 128; ((BitmapLayer)layer).SetBlendOp(new UserBlendOps.NormalBlendOp()); })); benchmarks.Add(new CompositionBenchmark("Compositing three layers, Normal+Multiply+Overlay blending, 150+255+170 opacity (" + CompositionBenchmark.Iterations + "x)", doc1, surface, delegate(int layerIndex, Layer layer) { if (layerIndex == 0) { layer.Visible = true; layer.Opacity = 150; ((BitmapLayer)layer).SetBlendOp(new UserBlendOps.NormalBlendOp()); } else if (layerIndex == 1) { layer.Visible = true; layer.Opacity = 255; ((BitmapLayer)layer).SetBlendOp(new UserBlendOps.MultiplyBlendOp()); } else if (layerIndex == 2) { layer.Visible = true; layer.Opacity = 170; ((BitmapLayer)layer).SetBlendOp(new UserBlendOps.OverlayBlendOp()); } else { layer.Visible = false; } })); #endif #if TRANSFORM // Transform benchmarks Matrix m = new Matrix(); m.Reset(); MaskedSurface msSimple = new MaskedSurface(surface, new PdnRegion(surface.Bounds)); // simple masked surface PdnRegion complexRegion = new PdnRegion(surface.Bounds); // cut 4 holes in region 1 to form a complex clipping surface for (int x = -1; x < 3; ++x) { for (int y = -1; y < 3; ++y) { int left = (1 + (x * 3)) * (surface.Width / 6); int top = (1 + (x * 3)) * (surface.Height / 6); int right = (2 + (x * 3)) * (surface.Width / 6); int bottom = (2 + (x * 3)) * (surface.Height / 6); Rectangle rect = Rectangle.FromLTRB(left, top, right, bottom); PdnGraphicsPath path = new PdnGraphicsPath(); path.AddEllipse(rect); complexRegion.Exclude(path); } } MaskedSurface msComplex = new MaskedSurface(surface, complexRegion); benchmarks.Add(new TransformBenchmark("Transform simple surface, no transform, nearest neighbor resampling (" + TransformBenchmark.Iterations + "x)", surface, msSimple, m, false)); benchmarks.Add(new TransformBenchmark("Transform complex surface, no transform, nearest neighbor resampling (" + TransformBenchmark.Iterations + "x)", surface, msSimple, m, false)); benchmarks.Add(new TransformBenchmark("Transform simple surface, no transform, bilinear resampling (" + TransformBenchmark.Iterations + "x)", surface, msSimple, m, true)); benchmarks.Add(new TransformBenchmark("Transform complex surface, no transform, bilinear resampling (" + TransformBenchmark.Iterations + "x)", surface, msSimple, m, true)); Matrix m2 = m.Clone(); m2.RotateAt(45.0f, new PointF(surface.Width / 2, surface.Height / 2)); benchmarks.Add(new TransformBenchmark("Transform simple surface, 45 deg. rotation about center, bilinear resampling (" + TransformBenchmark.Iterations + "x)", surface, msSimple, m2, true)); benchmarks.Add(new TransformBenchmark("Transform complex surface, 45 deg. rotation about center, bilinear resampling (" + TransformBenchmark.Iterations + "x)", surface, msSimple, m2, true)); Matrix m3 = m.Clone(); m3.Scale(0.5f, 0.75f); benchmarks.Add(new TransformBenchmark("Transform simple surface, 50% x-scaling 75% y-scaling, bilinear resampling (" + TransformBenchmark.Iterations + "x)", surface, msSimple, m3, true)); benchmarks.Add(new TransformBenchmark("Transform complex surface, 50% x-scaling 75% y-scaling, bilinear resampling (" + TransformBenchmark.Iterations + "x)", surface, msSimple, m3, true)); #endif #if BLIT // Blit benchmarks benchmarks.Add(new ZoomOutBlitBenchmark("Zoom out, rotated grid multisampling, 66% (" + ZoomOutBlitBenchmark.IterationCount + "x)", surface, dst, new Size((surface.Width * 2) / 3, (surface.Height * 2) / 3))); benchmarks.Add(new ZoomOutBlitBenchmark("Zoom out, rotated grid multisampling, 28% (" + ZoomOutBlitBenchmark.IterationCount + "x)", surface, dst, new Size((surface.Width * 28) / 100, (surface.Height * 28) / 100))); benchmarks.Add(new ZoomOneToOneBlitBenchmark("Zoom 1:1, straight blit (" + ZoomOneToOneBlitBenchmark.IterationCount + "x)", surface, dst.CreateWindow(new Rectangle(0, 0, surface.Width, surface.Height)))); #endif // Run benchmarks! Timing timing = new Timing(); ulong start = timing.GetTickCount(); foreach (Benchmark benchmark in benchmarks) { Console.Write(benchmark.Name + (useTsvOutput ? "\t" : " ... ")); TimeSpan timeSpan = benchmark.Execute(); Console.WriteLine(" " + timeSpan.TotalMilliseconds.ToString() + (useTsvOutput ? "\t" : "") + " milliseconds"); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); } ulong end = timing.GetTickCount(); Console.WriteLine(); Console.WriteLine("Total time: " + (useTsvOutput ? "\t" : "") + (end - start).ToString() + (useTsvOutput ? "\t" : "") + " milliseconds"); Console.WriteLine(); }
protected virtual ControlInfo OnCreateConfigUI(PropertyCollection props) { return(CreateDefaultConfigUI(props)); }
public M2NMappingField(int fieldId, string column, int typeId, string typeName, int panelId, IM2NMapping mapping, PropertyCollection attr = null, PropertyCollection rules = null) : base(fieldId, column, typeId, typeName, panelId, attr, rules) { this.mapping = mapping; }
void SetLabel() { ManagementPath mgmtPath = mgmtObj.Path; if (mgmtPath.IsSingleton) { label = mgmtPath.ClassName; } else { //this is not a singleton. Construct label to consist of comma-separated //key property values and caption value. bool needCaption = true; string keyVals = string.Empty; string caption = string.Empty; PropertyCollection props = mgmtObj.Properties; try { caption = props["Caption"].Value.ToString(); } catch (Exception) { //no "Caption" property needCaption = false; } if (caption == string.Empty) { needCaption = false; } //get key property values PropertyCollection.PropertyEnumerator propEnum = mgmtObj.Properties.GetEnumerator(); while (propEnum.MoveNext()) { if (WmiHelper.IsKeyProperty(propEnum.Current)) { string keyval = propEnum.Current.Value.ToString(); if (needCaption && (string.Compare(keyval, caption, true) == 0)) { needCaption = false; } keyVals += keyval + ","; } } if (keyVals != string.Empty) { //get rid of last character (a comma) keyVals = keyVals.Substring(0, keyVals.Length - 1); } if (needCaption) { label = caption + "(" + keyVals + ")"; } else { label = keyVals; } if (label == string.Empty) { label = className; } } }
public static void CreateReachSpec(ExportEntry startNode, bool createTwoWay, ExportEntry destinationNode, string reachSpecClass, ReachSpecSize size, PropertyCollection externalGUIDProperties = null) { IMEPackage Pcc = startNode.FileRef; ExportEntry reachSpectoClone = Pcc.Exports.FirstOrDefault(x => x.ClassName == "ReachSpec"); if (externalGUIDProperties != null) //EXTERNAL { //external node //Debug.WriteLine("Num Exports: " + pcc.Exports.Count); if (reachSpectoClone != null) { ExportEntry outgoingSpec = reachSpectoClone.Clone(); Pcc.AddExport(outgoingSpec); IEntry reachSpecClassImp = GetEntryOrAddImport(Pcc, reachSpecClass); //new class type. outgoingSpec.Class = reachSpecClassImp; outgoingSpec.ObjectName = reachSpecClassImp.ObjectName; var properties = outgoingSpec.GetProperties(); ObjectProperty outgoingSpecStartProp = properties.GetProp <ObjectProperty>("Start"); //START StructProperty outgoingEndStructProp = properties.GetProp <StructProperty>("End"); //Embeds END ObjectProperty outgoingSpecEndProp = outgoingEndStructProp.Properties.GetProp <ObjectProperty>(SharedPathfinding.GetReachSpecEndName(outgoingSpec)); //END outgoingSpecStartProp.Value = startNode.UIndex; outgoingSpecEndProp.Value = 0; var endGuid = outgoingEndStructProp.GetProp <StructProperty>("Guid"); endGuid.Properties = externalGUIDProperties; //set the other guid values to our guid values //Add to source node prop ArrayProperty <ObjectProperty> PathList = startNode.GetProperty <ArrayProperty <ObjectProperty> >("PathList"); PathList.Add(new ObjectProperty(outgoingSpec.UIndex)); startNode.WriteProperty(PathList); outgoingSpec.WriteProperties(properties); //Write Spec Size SharedPathfinding.SetReachSpecSize(outgoingSpec, size.SpecRadius, size.SpecHeight); //Reindex reachspecs. SharedPathfinding.ReindexMatchingObjects(outgoingSpec); } } else { //Debug.WriteLine("Source Node: " + startNode.Index); //Debug.WriteLine("Num Exports: " + pcc.Exports.Count); //int outgoingSpec = pcc.ExportCount; //int incomingSpec = pcc.ExportCount + 1; if (reachSpectoClone != null) { ExportEntry outgoingSpec = reachSpectoClone.Clone(); Pcc.AddExport(outgoingSpec); ExportEntry incomingSpec = null; if (createTwoWay) { incomingSpec = reachSpectoClone.Clone(); Pcc.AddExport(incomingSpec); } IEntry reachSpecClassImp = GetEntryOrAddImport(Pcc, reachSpecClass); //new class type. outgoingSpec.Class = reachSpecClassImp; outgoingSpec.ObjectName = reachSpecClassImp.ObjectName; var outgoingSpecProperties = outgoingSpec.GetProperties(); if (reachSpecClass == "Engine.SlotToSlotReachSpec") { outgoingSpecProperties.Add(new ByteProperty(1, "SpecDirection")); //We might need to find a way to support this edit } //Debug.WriteLine("Outgoing UIndex: " + outgoingSpecExp.UIndex); ObjectProperty outgoingSpecStartProp = outgoingSpecProperties.GetProp <ObjectProperty>("Start"); //START StructProperty outgoingEndStructProp = outgoingSpecProperties.GetProp <StructProperty>("End"); //Embeds END ObjectProperty outgoingSpecEndProp = outgoingEndStructProp.Properties.GetProp <ObjectProperty>(SharedPathfinding.GetReachSpecEndName(outgoingSpec)); //END outgoingSpecStartProp.Value = startNode.UIndex; outgoingSpecEndProp.Value = destinationNode.UIndex; //Add to source node prop var PathList = startNode.GetProperty <ArrayProperty <ObjectProperty> >("PathList"); PathList.Add(new ObjectProperty(outgoingSpec.UIndex)); startNode.WriteProperty(PathList); //Write Spec Size SetReachSpecSize(outgoingSpecProperties, size.SpecRadius, size.SpecHeight); outgoingSpec.WriteProperties(outgoingSpecProperties); if (createTwoWay) { incomingSpec.Class = reachSpecClassImp; incomingSpec.ObjectName = reachSpecClassImp.ObjectName; var incomingSpecProperties = incomingSpec.GetProperties(); if (reachSpecClass == "Engine.SlotToSlotReachSpec") { incomingSpecProperties.Add(new ByteProperty(2, "SpecDirection")); } ObjectProperty incomingSpecStartProp = incomingSpecProperties.GetProp <ObjectProperty>("Start"); //START StructProperty incomingEndStructProp = incomingSpecProperties.GetProp <StructProperty>("End"); //Embeds END ObjectProperty incomingSpecEndProp = incomingEndStructProp.Properties.GetProp <ObjectProperty>(SharedPathfinding.GetReachSpecEndName(incomingSpec)); //END incomingSpecStartProp.Value = destinationNode.UIndex; //Uindex incomingSpecEndProp.Value = startNode.UIndex; //Add reachspec to destination node's path list (returning) var DestPathList = destinationNode.GetProperty <ArrayProperty <ObjectProperty> >("PathList"); DestPathList.Add(new ObjectProperty(incomingSpec.UIndex)); destinationNode.WriteProperty(DestPathList); //destNode.WriteProperty(DestPathList); SetReachSpecSize(incomingSpecProperties, size.SpecRadius, size.SpecHeight); incomingSpec.WriteProperties(incomingSpecProperties); } //Reindex reachspecs. SharedPathfinding.ReindexMatchingObjects(outgoingSpec); } } }
protected virtual void OnCustomizeConfigUIWindowProperties(PropertyCollection props) { return; }
private static void AddPropertyTextAlignment(PropertyCollection properties, string propertyParent, string propertyName, string propertyCaption) { AddProperty <PropertyEditorTextAlignment>(properties, propertyParent, propertyName, propertyCaption); }
// Редакторы сложных свойств элементов печатного представления private static void AddPropertyDisplayFormat(PropertyCollection properties, string propertyParent, string propertyName, string propertyCaption) { AddProperty <PropertyEditorDisplayFormat>(properties, propertyParent, propertyName, propertyCaption); }
private static void AddPropertyThickness(PropertyCollection properties, string propertyParent, string propertyName, string propertyCaption) { AddProperty <PropertyEditorThickness>(properties, propertyParent, propertyName, propertyCaption); }
private static void AddPropertyColor(PropertyCollection properties, string propertyParent, string propertyName, string propertyCaption) { AddProperty <PropertyEditorColor>(properties, propertyParent, propertyName, propertyCaption); }
public CountedTaggerTest() { _factory = new MockRepository(MockBehavior.Strict); _key = new object(); _propertyCollection = new PropertyCollection(); }
private CountedTagger <TextMarkerTag> Create(object key, PropertyCollection propertyCollection, Func <ITagger <TextMarkerTag> > func) { return(new CountedTagger <TextMarkerTag>(propertyCollection, key, func)); }
public void Refresh() { if (Instance == null) { Properties = new ObservableCollection <Item>(); } else { var properties = new PropertyCollection(Instance, !Categorized, AutomaticlyExpandObjects, Filter.ToLower()); Properties = properties.Items; if (Instance != null) { /// Fill the Instance type and Name with the Data if (Template != null) { object myInstanceType = Template.FindName("PART_InstanceType", this); if (myInstanceType != null && myInstanceType is TextBlock) { string myType = ""; Object[] myAttributes = Instance.GetType().GetCustomAttributes(false); if (myAttributes.Length > 0) { foreach (Object attr in myAttributes) { if (attr is System.ComponentModel.DisplayNameAttribute) { myType = ((System.ComponentModel.DisplayNameAttribute)attr).DisplayName; } } } if (myType.Length == 0) { myType = Instance.GetType().ToString(); myType = myType.Substring(myType.LastIndexOf('.') + 1); } if (myType.Equals("componentType")) { myType = Asterics.ACS.Properties.Resources.PropertyEditorModelComponentAlias; } else if (myType.Equals("inputPortType")) { myType = Asterics.ACS.Properties.Resources.PropertyEditorInputPortTypeAlias; } else if (myType.Equals("outputPortType")) { myType = Asterics.ACS.Properties.Resources.PropertyEditorOutputPortTypeAlias; } ((TextBlock)myInstanceType).Text = myType; } object myInstanceName = Template.FindName("PART_InstanceName", this); if (myInstanceName != null && myInstanceName is TextBlock) { if (Instance is FrameworkElement) { ((TextBlock)myInstanceName).Text = ((FrameworkElement)Instance).Name; } else if (Instance is System.Windows.Forms.Control) { ((TextBlock)myInstanceName).Text = ((System.Windows.Forms.Control)Instance).Name; } else if (DisplayName != "") { ((TextBlock)myInstanceName).Text = DisplayName; // new code for AsTeRICS } else { ((TextBlock)myInstanceName).Text = ""; PropertyInfo pi = Instance.GetType().GetProperty("Name"); if (pi != null) { ((TextBlock)myInstanceName).Text = (string)pi.GetValue(Instance, null); } } } } } } }
/* * private static void VerifyGesturesWork(ExportEntry trackExport) * { * var gestures = RBioEvtSysTrackGesture.GetGestures(trackExport); * var defaultPose = RBioEvtSysTrackGesture.GetDefaultPose(trackExport); * * var gesturesToCheck = gestures.Append(defaultPose).ToList(); * * // Get the containing sequence * var owningSequence = SeqTools.GetParentSequence(trackExport); * while (owningSequence.ClassName != "Sequence") * { * owningSequence = owningSequence.Parent as ExportEntry; * var parSeq = SeqTools.GetParentSequence(owningSequence); * if (parSeq != null) * { * owningSequence = parSeq; * } * } * * var kismetBioDynamicAnimSets = owningSequence.GetProperty<ArrayProperty<ObjectProperty>>("m_aBioDynAnimSets"); * if (kismetBioDynamicAnimSets == null) * { * // We don't have any animsets! * throw new Exception("Track's sequence is missing animsets property!"); * } * * // Get a list of all supported animations * List<Gesture> supportedGestures = new List<Gesture>(); * foreach (var kbdas in kismetBioDynamicAnimSets) * { * var sequenceBioDynamicAnimSet = kbdas.ResolveToEntry(trackExport.FileRef) as ExportEntry; // I don't think these can be imports as they're part of the seq * var associatedset = sequenceBioDynamicAnimSet.GetProperty<ObjectProperty>("m_pBioAnimSetData").ResolveToEntry(trackExport.FileRef); * * } * * // Check all gestures * foreach (var gesture in gesturesToCheck) * { * var bioAnimSet = gesture.GetBioAnimSet(trackExport.FileRef); * * } * * * * } * * internal class TestingBioDynamicAnimSet * { * public NameReference OrigSetName { get; } * public List<string> SupportedGesturesFullPaths { get; } * public IEntry BioAnimSetData { get; } * * internal TestingBioDynamicAnimSet(ExportEntry export) * { * var props = export.GetProperties(); * OrigSetName = props.GetProp<NameProperty>("m_nmOrigSetName").Value; * BioAnimSetData = props.GetProp<ObjectProperty>("m_pBioAnimSetData").ResolveToEntry(export.FileRef); * SupportedGesturesFullPaths = props.GetProp<ArrayProperty<ObjectProperty>>("Sequences").Select(x => x.ResolveToEntry(export.FileRef).InstancedFullPath).ToList(); * } * } */ private static void InstallDynamicAnimSetRefForSeq(ref ExportEntry owningSequence, ExportEntry export, Gesture gesture) { // Find owning sequence if (owningSequence == null) { owningSequence = export; } while (owningSequence.ClassName != "Sequence") { owningSequence = owningSequence.Parent as ExportEntry; var parSeq = SeqTools.GetParentSequence(owningSequence); if (parSeq != null) { owningSequence = parSeq; } } // We have parent sequence data var kismetBioDynamicAnimSets = owningSequence.GetProperty <ArrayProperty <ObjectProperty> >("m_aBioDynAnimSets") ?? new ArrayProperty <ObjectProperty>("m_aBioDynamicAnimSets"); // Check to see if there is any item that uses our bioanimset var bioAnimSet = gesture.GetBioAnimSet(export.FileRef); if (bioAnimSet != null) { ExportEntry kismetBDAS = null; foreach (var kbdas in kismetBioDynamicAnimSets) { var kEntry = kbdas.ResolveToEntry(export.FileRef) as ExportEntry; // I don't think these can be imports as they're part of the seq var associatedset = kEntry.GetProperty <ObjectProperty>("m_pBioAnimSetData").ResolveToEntry(export.FileRef); if (associatedset == bioAnimSet) { // It's this one kismetBDAS = kEntry; break; } } if (kismetBDAS == null) { // We need to generate a new one PropertyCollection props = new PropertyCollection(); props.Add(new NameProperty(gesture.GestureSet, "m_nmOrigSetName")); props.Add(new ArrayProperty <ObjectProperty>("Sequences")); props.Add(new ObjectProperty(bioAnimSet, "m_pBioAnimSetData")); kismetBDAS = ExportCreator.CreateExport(export.FileRef, $"KIS_DYN_{gesture.GestureSet}", "BioDynamicAnimSet", owningSequence); kismetBDAS.indexValue = 0; // Write a blank count of 0 - we will update this in subsequent call // This must be here to ensure parser can read it kismetBDAS.WritePropertiesAndBinary(props, new byte[4]); kismetBioDynamicAnimSets.Add(new ObjectProperty(kismetBDAS)); // Add new export to sequence's list of biodynamicanimsets owningSequence.WriteProperty(kismetBioDynamicAnimSets); } var currentObjs = kismetBDAS.GetProperty <ArrayProperty <ObjectProperty> >("Sequences"); if (currentObjs.All(x => x.Value != gesture.Entry.UIndex)) { // We need to add our item to it currentObjs.Add(new ObjectProperty(gesture.Entry)); var bin = ObjectBinary.From <BioDynamicAnimSet>(kismetBDAS); bin.SequenceNamesToUnkMap[gesture.GestureAnim] = 1; // Not sure what the value should be, or if game actually reads this // FIX IT IF WE EVER FIGURE IT OUT! kismetBDAS.WriteProperty(currentObjs); kismetBDAS.WriteBinary(bin); } } }