private void OnTagInit(EntityUid uid, TagComponent component, ComponentInit args) { foreach (var tag in component.Tags) { GetTagOrThrow(tag); } }
private void AddMandatoryComponents(int entityId) { var stateComponent = new StateComponent(); var tagComponent = new TagComponent(); ComponentManager.Instance.AddComponentToEntity(stateComponent, entityId); ComponentManager.Instance.AddComponentToEntity(tagComponent, entityId); }
/* Sets the camera to "chase" the target entity. */ public static void SetTargetEntity(ref CameraComponent camera, Entity target) { TagComponent tag = ComponentManager.Instance.GetEntityComponent <TagComponent>(target); if (tag != null) { camera.targetEntity = tag.tagName; } }
public void OnCreate() { Log.Info("Hello world!"); TagComponent tag = GetComponent <TagComponent>(); tag.Tag = "Tag from CSharp!"; Log.Info($"We have a new tag: { GetComponent<TagComponent>().Tag}"); }
/* * This function tags the pickup for deletion. * Should only be called when the pickup was actually used up. */ private void DeletePickup(int pickup) { var tagComponent = ComponentManager.GetEntityComponentOrDefault <TagComponent>(pickup); if (tagComponent == null) { tagComponent = new TagComponent(); ComponentManager.AddComponentToEntity(tagComponent, pickup); } tagComponent.Tags.Add(Tag.Delete); }
public MaskMatchedVersion(string version) { var maskMatch = FormatRegex.Match(version); IsValid = maskMatch.Success; Major = new Component(maskMatch.Groups["Major"]); Minor = new Component(maskMatch.Groups["Minor"]); Build = new Component(maskMatch.Groups["Build"]); Revision = new Component(maskMatch.Groups["Revision"]); Tag = new TagComponent(maskMatch.Groups["PreRelease"]); }
public Entity GetEntityWithTag(String tagName, List <Entity> entities) { foreach (Entity e in entities) { TagComponent t = GetEntityComponent <TagComponent>(e); if (t != null && t.ID.Equals(tagName)) { return(e); } } return(null); }
/// <summary> /// Tries to remove a tag if it exists. /// </summary> /// <returns> /// true if it was removed, false otherwise even if it didn't exist. /// </returns> /// <exception cref="UnknownPrototypeException"> /// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// </exception> public bool RemoveTag(TagComponent component, string id) { GetTagOrThrow(id); if (component.Tags.Remove(id)) { Dirty(component); return(true); } return(false); }
/// <summary> /// Tries to add a tag if it doesn't already exist. /// </summary> /// <param name="id">The tag to add.</param> /// <returns>true if it was added, false if it already existed.</returns> /// <exception cref="UnknownPrototypeException"> /// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// </exception> public bool AddTag(TagComponent component, string id) { GetTagOrThrow(id); var added = component.Tags.Add(id); if (added) { Dirty(component); return(true); } return(false); }
private static void OnTagGetState(EntityUid uid, TagComponent component, ref ComponentGetState args) { var tags = new string[component.Tags.Count]; var i = 0; foreach (var tag in component.Tags) { tags[i] = tag; i++; } args.State = new TagComponentState(tags); }
private void OnTriggerExit(Collider other) { if (compatibleTags.Count == 0) { Debug.LogError("Trigger component has no compatible tags"); } TagComponent tag = other.GetComponent <TagComponent>(); if (tag != null && tag.HasAnyOf(compatibleTags)) { onTriggerExit.Invoke(other); } }
/// <summary> /// Checks if any of the given tags have been added. /// </summary> /// <param name="ids">The tags to check for.</param> /// <returns>true if any of them exist, false otherwise.</returns> /// <exception cref="UnknownPrototypeException"> /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// </exception> public bool HasAnyTag(TagComponent component, IEnumerable <string> ids) { foreach (var id in ids) { GetTagOrThrow(id); if (component.Tags.Contains(id)) { return(true); } } return(false); }
private void OnTagHandleState(EntityUid uid, TagComponent component, ref ComponentHandleState args) { if (args.Current is not TagComponentState state) { return; } component.Tags.Clear(); foreach (var tag in state.Tags) { GetTagOrThrow(tag); component.Tags.Add(tag); } }
void CheckGroundedEnter(Collision collision) { if (isGrounded) { return; } TagComponent tagComponent = collision.gameObject.GetComponent <TagComponent>(); if (tagComponent == null) { return; } isGrounded = tagComponent.HasTag(groundTag); }
public void LoadContent() { Random ran = new Random(); HeightmapComponent hc = ComponentManager.Instance.GetEntityComponent <HeightmapComponent> (ComponentManager.Instance.GetEntityWithTag("heightmap", SceneManager.Instance.GetActiveSceneEntities())); foreach (Entity ent in ComponentManager.Instance.GetAllEntitiesWithCertainComp <ModelComponent>()) { TagComponent tagc = ComponentManager.Instance.GetEntityComponent <TagComponent>(ent); if (tagc.ID.Contains("tree") || tagc.ID.Contains("house") || tagc.ID.Contains("stone")) { ModelComponent mc = ComponentManager.Instance.GetEntityComponent <ModelComponent>(ent); TransformComponent tc = ComponentManager.Instance.GetEntityComponent <TransformComponent>(ent); tc.Position = Vector3.Transform(hc.Vertices[ran.Next(hc.Vertices.Length)].Position, hc.World); } } }
/// <summary> /// Tries to remove all of the given tags if they exist. /// </summary> /// <param name="ids">The tags to remove.</param> /// <returns>true if any tag was removed, false otherwise.</returns> /// <exception cref="UnknownPrototypeException"> /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// </exception> public bool RemoveTags(TagComponent component, IEnumerable <string> ids) { var count = component.Tags.Count; foreach (var id in ids) { GetTagOrThrow(id); component.Tags.Remove(id); } if (component.Tags.Count < count) { Dirty(component); return(true); } return(false); }
/* Sets the camera to "chase" the tagged entity. More inefficient than directly providing an entity, use: SetTargetEntity(Entity target) when possible. */ public static void SetTargetEntity(string EntityTag) { List <Entity> entities = ComponentManager.Instance.GetAllEntitiesWithComponentType <ModelComponent>(); Entity camEnt = ComponentManager.Instance.GetFirstEntityOfType <CameraComponent>(); CameraComponent c = ComponentManager.Instance.GetEntityComponent <CameraComponent>(camEnt); foreach (Entity e in entities) { TagComponent t = ComponentManager.Instance.GetEntityComponent <TagComponent>(e); if (t != null && c != null) { if (t.tagName.Equals(EntityTag)) { c.targetEntity = t.tagName; } } } }
public void Update(GameTime gametime) { Vector3 tempMovement = Vector3.Zero; Vector3 tempRotation = Vector3.Zero; Keyboard.GetState().GetPressedKeys(); foreach (Entity ent in ComponentManager.Instance.GetAllEntitiesWithCertainComp <KeyActionsComponent>()) { KeyActionsComponent keys = ComponentManager.Instance.GetEntityComponent <KeyActionsComponent>(ent); TagComponent tag = ComponentManager.Instance.GetEntityComponent <TagComponent>(ent); foreach (Keys key in Keyboard.GetState().GetPressedKeys()) { KeyValuePair <Keys, IAction> action = keys.KeyAction.FirstOrDefault(k => k.Key == key); if (!action.Equals(default(KeyValuePair <Keys, IAction>))) { action.Value.PerformAction(key, tag.ID); } } } }
public async Task TagComponentTest() { var options = new ServerContentIntegrationOption { ExtraPrototypes = Prototypes }; var server = StartServerDummyTicker(options); await server.WaitIdleAsync(); var sMapManager = server.ResolveDependency <IMapManager>(); var sEntityManager = server.ResolveDependency <IEntityManager>(); var sPrototypeManager = server.ResolveDependency <IPrototypeManager>(); IEntity sTagDummy = null !; TagComponent sTagComponent = null !; await server.WaitPost(() => { sMapManager.CreateNewMapEntity(MapId.Nullspace); sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace); sTagComponent = sTagDummy.GetComponent <TagComponent>(); }); await server.WaitAssertion(() => { // Has one tag, the starting tag Assert.That(sTagComponent.Tags.Count, Is.EqualTo(1)); sPrototypeManager.Index <TagPrototype>(StartingTag); Assert.That(sTagComponent.Tags, Contains.Item(StartingTag)); // Single Assert.True(sTagDummy.HasTag(StartingTag)); Assert.True(sTagComponent.HasTag(StartingTag)); // Any Assert.True(sTagDummy.HasAnyTag(StartingTag)); Assert.True(sTagComponent.HasAnyTag(StartingTag)); // All Assert.True(sTagDummy.HasAllTags(StartingTag)); Assert.True(sTagComponent.HasAllTags(StartingTag)); // Does not have the added tag var addedTagPrototype = sPrototypeManager.Index <TagPrototype>(AddedTag); Assert.That(sTagComponent.Tags, Does.Not.Contains(addedTagPrototype)); // Single Assert.False(sTagDummy.HasTag(AddedTag)); Assert.False(sTagComponent.HasTag(AddedTag)); // Any Assert.False(sTagDummy.HasAnyTag(AddedTag)); Assert.False(sTagComponent.HasAnyTag(AddedTag)); // All Assert.False(sTagDummy.HasAllTags(AddedTag)); Assert.False(sTagComponent.HasAllTags(AddedTag)); // Does not have the unused tag var unusedTagPrototype = sPrototypeManager.Index <TagPrototype>(UnusedTag); Assert.That(sTagComponent.Tags, Does.Not.Contains(unusedTagPrototype)); // Single Assert.False(sTagDummy.HasTag(UnusedTag)); Assert.False(sTagComponent.HasTag(UnusedTag)); // Any Assert.False(sTagDummy.HasAnyTag(UnusedTag)); Assert.False(sTagComponent.HasAnyTag(UnusedTag)); // All Assert.False(sTagDummy.HasAllTags(UnusedTag)); Assert.False(sTagComponent.HasAllTags(UnusedTag)); // Throws when checking for an unregistered tag Assert.Throws <UnknownPrototypeException>(() => { sPrototypeManager.Index <TagPrototype>(UnregisteredTag); }); // Single Assert.Throws <UnknownPrototypeException>(() => { sTagDummy.HasTag(UnregisteredTag); }); Assert.Throws <UnknownPrototypeException>(() => { sTagComponent.HasTag(UnregisteredTag); }); // Any Assert.Throws <UnknownPrototypeException>(() => { sTagDummy.HasAnyTag(UnregisteredTag); }); Assert.Throws <UnknownPrototypeException>(() => { sTagComponent.HasAnyTag(UnregisteredTag); }); // All Assert.Throws <UnknownPrototypeException>(() => { sTagDummy.HasAllTags(UnregisteredTag); }); Assert.Throws <UnknownPrototypeException>(() => { sTagComponent.HasAllTags(UnregisteredTag); }); // Cannot add the starting tag again Assert.That(sTagComponent.AddTag(StartingTag), Is.False); Assert.That(sTagComponent.AddTags(StartingTag, StartingTag), Is.False); Assert.That(sTagComponent.AddTags(new List <string> { StartingTag, StartingTag }), Is.False); // Has the starting tag Assert.That(sTagComponent.HasTag(StartingTag), Is.True); Assert.That(sTagComponent.HasAllTags(StartingTag, StartingTag), Is.True); Assert.That(sTagComponent.HasAllTags(new List <string> { StartingTag, StartingTag }), Is.True); Assert.That(sTagComponent.HasAnyTag(StartingTag, StartingTag), Is.True); Assert.That(sTagComponent.HasAnyTag(new List <string> { StartingTag, StartingTag }), Is.True); // Does not have the added tag yet Assert.That(sTagComponent.HasTag(AddedTag), Is.False); Assert.That(sTagComponent.HasAllTags(AddedTag, AddedTag), Is.False); Assert.That(sTagComponent.HasAllTags(new List <string> { AddedTag, AddedTag }), Is.False); Assert.That(sTagComponent.HasAnyTag(AddedTag, AddedTag), Is.False); Assert.That(sTagComponent.HasAnyTag(new List <string> { AddedTag, AddedTag }), Is.False); // Has a combination of the two tags Assert.That(sTagComponent.HasAnyTag(StartingTag, AddedTag), Is.True); Assert.That(sTagComponent.HasAnyTag(new List <string> { StartingTag, AddedTag }), Is.True); // Does not have both tags Assert.That(sTagComponent.HasAllTags(StartingTag, AddedTag), Is.False); Assert.That(sTagComponent.HasAllTags(new List <string> { StartingTag, AddedTag }), Is.False); // Cannot remove a tag that does not exist Assert.That(sTagComponent.RemoveTag(AddedTag), Is.False); Assert.That(sTagComponent.RemoveTags(AddedTag, AddedTag), Is.False); Assert.That(sTagComponent.RemoveTags(new List <string> { AddedTag, AddedTag }), Is.False); // Can add the new tag Assert.That(sTagComponent.AddTag(AddedTag), Is.True); // Cannot add it twice Assert.That(sTagComponent.AddTag(AddedTag), Is.False); // Cannot add existing tags Assert.That(sTagComponent.AddTags(StartingTag, AddedTag), Is.False); Assert.That(sTagComponent.AddTags(new List <string> { StartingTag, AddedTag }), Is.False); // Now has two tags Assert.That(sTagComponent.Tags.Count, Is.EqualTo(2)); // Has both tags Assert.That(sTagComponent.HasTag(StartingTag), Is.True); Assert.That(sTagComponent.HasTag(AddedTag), Is.True); Assert.That(sTagComponent.HasAllTags(StartingTag, StartingTag), Is.True); Assert.That(sTagComponent.HasAllTags(AddedTag, StartingTag), Is.True); Assert.That(sTagComponent.HasAllTags(new List <string> { StartingTag, AddedTag }), Is.True); Assert.That(sTagComponent.HasAllTags(new List <string> { AddedTag, StartingTag }), Is.True); Assert.That(sTagComponent.HasAnyTag(StartingTag, AddedTag), Is.True); Assert.That(sTagComponent.HasAnyTag(AddedTag, StartingTag), Is.True); // Remove the existing starting tag Assert.That(sTagComponent.RemoveTag(StartingTag), Is.True); // Remove the existing added tag Assert.That(sTagComponent.RemoveTags(AddedTag, AddedTag), Is.True); // No tags left to remove Assert.That(sTagComponent.RemoveTags(new List <string> { StartingTag, AddedTag }), Is.False); // No tags left in the component Assert.That(sTagComponent.Tags, Is.Empty); }); }
public async Task TagComponentTest() { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true, ExtraPrototypes = Prototypes }); var server = pairTracker.Pair.Server; var sMapManager = server.ResolveDependency <IMapManager>(); var sEntityManager = server.ResolveDependency <IEntityManager>(); var sPrototypeManager = server.ResolveDependency <IPrototypeManager>(); var entManager = server.ResolveDependency <IEntitySystemManager>(); EntityUid sTagDummy = default; TagComponent sTagComponent = null !; await server.WaitPost(() => { sMapManager.CreateNewMapEntity(MapId.Nullspace); sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace); sTagComponent = sEntityManager.GetComponent <TagComponent>(sTagDummy); }); await server.WaitAssertion(() => { var tagSystem = entManager.GetEntitySystem <TagSystem>(); // Has one tag, the starting tag Assert.That(sTagComponent.Tags.Count, Is.EqualTo(1)); sPrototypeManager.Index <TagPrototype>(StartingTag); Assert.That(sTagComponent.Tags, Contains.Item(StartingTag)); // Single Assert.True(tagSystem.HasTag(sTagDummy, StartingTag)); Assert.True(tagSystem.HasTag(sTagComponent, StartingTag)); // Any Assert.True(tagSystem.HasAnyTag(sTagDummy, StartingTag)); Assert.True(tagSystem.HasAnyTag(sTagComponent, StartingTag)); // All Assert.True(tagSystem.HasAllTags(sTagDummy, StartingTag)); Assert.True(tagSystem.HasAllTags(sTagComponent, StartingTag)); // Does not have the added tag var addedTagPrototype = sPrototypeManager.Index <TagPrototype>(AddedTag); Assert.That(sTagComponent.Tags, Does.Not.Contains(addedTagPrototype)); // Single Assert.False(tagSystem.HasTag(sTagDummy, AddedTag)); Assert.False(tagSystem.HasTag(sTagComponent, AddedTag)); // Any Assert.False(tagSystem.HasAnyTag(sTagDummy, AddedTag)); Assert.False(tagSystem.HasAnyTag(sTagComponent, AddedTag)); // All Assert.False(tagSystem.HasAllTags(sTagDummy, AddedTag)); Assert.False(tagSystem.HasAllTags(sTagComponent, AddedTag)); // Does not have the unused tag var unusedTagPrototype = sPrototypeManager.Index <TagPrototype>(UnusedTag); Assert.That(sTagComponent.Tags, Does.Not.Contains(unusedTagPrototype)); // Single Assert.False(tagSystem.HasTag(sTagDummy, UnusedTag)); Assert.False(tagSystem.HasTag(sTagComponent, UnusedTag)); // Any Assert.False(tagSystem.HasAnyTag(sTagDummy, UnusedTag)); Assert.False(tagSystem.HasAnyTag(sTagComponent, UnusedTag)); // All Assert.False(tagSystem.HasAllTags(sTagDummy, UnusedTag)); Assert.False(tagSystem.HasAllTags(sTagComponent, UnusedTag)); // Throws when checking for an unregistered tag Assert.Throws <UnknownPrototypeException>(() => { sPrototypeManager.Index <TagPrototype>(UnregisteredTag); }); // Single Assert.Throws <UnknownPrototypeException>(() => { tagSystem.HasTag(sTagDummy, UnregisteredTag); }); Assert.Throws <UnknownPrototypeException>(() => { tagSystem.HasTag(sTagComponent, UnregisteredTag); }); // Any Assert.Throws <UnknownPrototypeException>(() => { tagSystem.HasAnyTag(sTagDummy, UnregisteredTag); }); Assert.Throws <UnknownPrototypeException>(() => { tagSystem.HasAnyTag(sTagComponent, UnregisteredTag); }); // All Assert.Throws <UnknownPrototypeException>(() => { tagSystem.HasAllTags(sTagDummy, UnregisteredTag); }); Assert.Throws <UnknownPrototypeException>(() => { tagSystem.HasAllTags(sTagComponent, UnregisteredTag); }); // Cannot add the starting tag again Assert.That(tagSystem.AddTag(sTagComponent, StartingTag), Is.False); Assert.That(tagSystem.AddTags(sTagComponent, StartingTag, StartingTag), Is.False); Assert.That(tagSystem.AddTags(sTagComponent, new List <string> { StartingTag, StartingTag }), Is.False); // Has the starting tag Assert.That(tagSystem.HasTag(sTagComponent, StartingTag), Is.True); Assert.That(tagSystem.HasAllTags(sTagComponent, StartingTag, StartingTag), Is.True); Assert.That(tagSystem.HasAllTags(sTagComponent, new List <string> { StartingTag, StartingTag }), Is.True); Assert.That(tagSystem.HasAnyTag(sTagComponent, StartingTag, StartingTag), Is.True); Assert.That(tagSystem.HasAnyTag(sTagComponent, new List <string> { StartingTag, StartingTag }), Is.True); // Does not have the added tag yet Assert.That(tagSystem.HasTag(sTagComponent, AddedTag), Is.False); Assert.That(tagSystem.HasAllTags(sTagComponent, AddedTag, AddedTag), Is.False); Assert.That(tagSystem.HasAllTags(sTagComponent, new List <string> { AddedTag, AddedTag }), Is.False); Assert.That(tagSystem.HasAnyTag(sTagComponent, AddedTag, AddedTag), Is.False); Assert.That(tagSystem.HasAnyTag(sTagComponent, new List <string> { AddedTag, AddedTag }), Is.False); // Has a combination of the two tags Assert.That(tagSystem.HasAnyTag(sTagComponent, StartingTag, AddedTag), Is.True); Assert.That(tagSystem.HasAnyTag(sTagComponent, new List <string> { StartingTag, AddedTag }), Is.True); // Does not have both tags Assert.That(tagSystem.HasAllTags(sTagComponent, StartingTag, AddedTag), Is.False); Assert.That(tagSystem.HasAllTags(sTagComponent, new List <string> { StartingTag, AddedTag }), Is.False); // Cannot remove a tag that does not exist Assert.That(tagSystem.RemoveTag(sTagComponent, AddedTag), Is.False); Assert.That(tagSystem.RemoveTags(sTagComponent, AddedTag, AddedTag), Is.False); Assert.That(tagSystem.RemoveTags(sTagComponent, new List <string> { AddedTag, AddedTag }), Is.False); // Can add the new tag Assert.That(tagSystem.AddTag(sTagComponent, AddedTag), Is.True); // Cannot add it twice Assert.That(tagSystem.AddTag(sTagComponent, AddedTag), Is.False); // Cannot add existing tags Assert.That(tagSystem.AddTags(sTagComponent, StartingTag, AddedTag), Is.False); Assert.That(tagSystem.AddTags(sTagComponent, new List <string> { StartingTag, AddedTag }), Is.False); // Now has two tags Assert.That(sTagComponent.Tags.Count, Is.EqualTo(2)); // Has both tags Assert.That(tagSystem.HasTag(sTagComponent, StartingTag), Is.True); Assert.That(tagSystem.HasTag(sTagComponent, AddedTag), Is.True); Assert.That(tagSystem.HasAllTags(sTagComponent, StartingTag, StartingTag), Is.True); Assert.That(tagSystem.HasAllTags(sTagComponent, AddedTag, StartingTag), Is.True); Assert.That(tagSystem.HasAllTags(sTagComponent, new List <string> { StartingTag, AddedTag }), Is.True); Assert.That(tagSystem.HasAllTags(sTagComponent, new List <string> { AddedTag, StartingTag }), Is.True); Assert.That(tagSystem.HasAnyTag(sTagComponent, StartingTag, AddedTag), Is.True); Assert.That(tagSystem.HasAnyTag(sTagComponent, AddedTag, StartingTag), Is.True); // Remove the existing starting tag Assert.That(tagSystem.RemoveTag(sTagComponent, StartingTag), Is.True); // Remove the existing added tag Assert.That(tagSystem.RemoveTags(sTagComponent, AddedTag, AddedTag), Is.True); // No tags left to remove Assert.That(tagSystem.RemoveTags(sTagComponent, new List <string> { StartingTag, AddedTag }), Is.False); // No tags left in the component Assert.That(sTagComponent.Tags, Is.Empty); }); await pairTracker.CleanReturnAsync(); }
/// <summary> /// Tries to remove all of the given tags if they exist. /// </summary> /// <param name="ids">The tags to remove.</param> /// <returns> /// true if it was removed, false otherwise even if they didn't exist. /// </returns> /// <exception cref="UnknownPrototypeException"> /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// </exception> public bool RemoveTags(TagComponent component, params string[] ids) { return(RemoveTags(component, ids.AsEnumerable())); }
/// <summary> /// Registers tag component to active tags /// </summary> /// <param name="tagComponent"></param> public void RegisterTagComponent(TagComponent tagComponent) { _tagComponents.Add(tagComponent); }
/// <summary> /// Removes tag component from active tags /// </summary> /// <param name="tagComponent"></param> public void RemoveTag(TagComponent tagComponent) { _tagComponents.Remove(tagComponent); ; }
/// <summary> /// Checks if any of the given tags have been added. /// </summary> /// <param name="ids">The tags to check for.</param> /// <returns>true if any of them exist, false otherwise.</returns> /// <exception cref="UnknownPrototypeException"> /// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>. /// </exception> public bool HasAnyTag(TagComponent component, params string[] ids) { return(HasAnyTag(component, ids.AsEnumerable())); }
/// <summary> /// Checks if a tag has been added. /// </summary> /// <param name="id">The tag to check for.</param> /// <returns>true if it exists, false otherwise.</returns> /// <exception cref="UnknownPrototypeException"> /// Thrown if no <see cref="TagPrototype"/> exists with the given id. /// </exception> public bool HasTag(TagComponent component, string id) { GetTagOrThrow(id); return(component.Tags.Contains(id)); }
public MaskMatchedVersion(string version) { var maskMatch = FormatRegex.Match(version); IsValid = maskMatch.Success; Major = new Component(maskMatch.Groups["Major"]); Minor = new Component(maskMatch.Groups["Minor"]); Build = new Component(maskMatch.Groups["Build"]); Revision = new Component(maskMatch.Groups["Revision"]); Tag = new TagComponent(maskMatch.Groups["PreRelease"]); }