示例#1
0
 void Swap(ref Elements  first, ref Elements  second)
 {
     Elements aux;
     aux = first;
     first = second;
     second = aux;
 }
示例#2
0
        public Elemental(Elements element, Movements movement, Vector2 pos, Vector2 velocity, Animation animation, Animation creationAnimation,
            int width, int height, int attack, int defense, int speed, int health)
        {
            this.created = false;
            this.visible = false;
            this.element = element;
            this.movement = movement;
            this.pos = pos;
            this.velocity = velocity;

            this.width = width;
            this.height = height;
            this.animation = animation;
            this.animation.TargetWidth = width;
            this.animation.TargetHeight = height;
            this.creationAnimation = creationAnimation;
            this.creationAnimation.TargetWidth = width;
            this.creationAnimation.TargetHeight = height;

            this.attack = attack;
            this.defense = defense;
            this.speed = speed;
            this.health = this.maxHealth = health;

            this.damageTimeElapsed = damageInterval;
        }
示例#3
0
    public void OnChosen(ElementChoiceButton button, Elements element)
    {
        if (button.IsSelected)
        {
            return;
        }

        chosenElements.Add(element);
        button.IsSelected = true;
        PrefabAndInstanceContainer.InstantiateAt(PrefabAndInstanceContainer.Instance.ParticlePrefab_ChooseElemental,
                                                 button.MyTransform.position);

        if (chosenElements.Count == 2)
        {
            FSM.Current = new Player(chosenElements[0], chosenElements[1], false);
            Elements[] aiEls = AI.ChooseElements(chosenElements);
            FSM.Opponent = new Player(aiEls[0], aiEls[1], true);

            FSM.StartCoroutine(DealOutCoroutine());
        }
        else if (chosenElements.Count > 2)
        {
            Debug.LogError("More than two elements somehow! " + chosenElements.Count);
        }
    }
示例#4
0
文件: Block.cs 项目: CaptiveAire/VPL
        public Block(IElementCreationContext context, string id) 
            : base(context)
        {
            _id = id;

            _elements = new Elements(context.Owner);
        }
示例#5
0
 public void SetValueAndDefaults( Elements value, Elements defaults )
 {
     elements = value;
     this.defaults = defaults;
     Enabled = true;
     UpdateView();
 }
示例#6
0
	public void Show(Elements element)
	{
		transform.position = originalPos;
		rigidBody.velocity = Vector2.zero;
		spriteRenderer.sprite = Game.attackByType[element];
		spriteRenderer.enabled = true;
	}
 public void makeNeutral()
 {
     UnitHandler.currentHero.convertMana(school);
     school = Elements.NORMAL;
     img.color = Color.white;
     gameObject.transform.SetAsLastSibling();
 }
示例#8
0
文件: GUI.cs 项目: Ragora/Emakio
        /// <summary>
        /// Adds a new GUI element to this GUI.
        /// </summary>
        /// <param name="element">
        /// The element to add to the GUI.
        /// </param>
        public void AddElement(Elements.AElement element)
        {
            Elements.Add(element);

            if (element is Elements.Button)
                Buttons.Add((Elements.Button)element);
        }
		public virtual object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
		{
			Diagram diagram = (Diagram) obj;

			diagram.SuspendEvents = true;
			diagram.Suspend();
			
			mShapes = (Elements) info.GetValue("Shapes",typeof(Elements));
			mLines = (Elements) info.GetValue("Lines",typeof(Elements));
			mLayers = (Layers) info.GetValue("Layers",typeof(Layers));
			
			//Diagram is created without a constructor, so need to do some initialization
			diagram.SetRender(new Render());

			diagram.DiagramSize = Serialize.GetSize(info.GetString("DiagramSize"));
			diagram.Zoom = info.GetSingle("Zoom");
			diagram.ShowTooltips = info.GetBoolean("ShowTooltips");
			diagram.Paged = info.GetBoolean("Paged");
			diagram.CheckBounds = info.GetBoolean("CheckBounds");
			diagram.Margin = (Margin) info.GetValue("Margin",typeof(Margin));
			diagram.WorkspaceColor = Color.FromArgb(Convert.ToInt32(info.GetString("WorkspaceColor")));
			if (Serialize.Contains(info,"Animator", typeof(Animator))) diagram.Animator = (Animator) info.GetValue("Animator", typeof(Animator));

			diagram.Resume();
			diagram.SuspendEvents = false;
			return diagram;
		}
示例#10
0
        public EnemyState HandleInput(Elements.Enemy enemy, EStateInput input, EnemyState state)
        {
            switch (input)
            {
                case EStateInput.Move:
                    return new EnemyRunning(direction);
                case EStateInput.SwitchDir:
                    if (direction != 0)
                    {
                        enemy.velocity.X = 0;
                        direction = (EDirection)((int)direction * -1);
                    }
                    return state;
                case EStateInput.Dead:
                    return new EnemyDead();
                case EStateInput.Hit:
                    break;
                case EStateInput.AnimEnd:

                    break;
                case EStateInput.PlayerCollision:
                    enemy.velocity = Vector2.Zero;
                    return new EnemyAttack(direction);
                case EStateInput.Stop:
                    if (state.GetType() != typeof(EnemyIdle))
                        return new EnemyIdle();
                    return this;
                default:
                    break;
            }
            return state;
        }
    void ChangeColor()
    {
        elements = (Elements)Random.Range (0,4);
        Color newColor = new Color ();
        Debug.Log (elements);

        switch (elements)
        {
        case Elements.Earth:
            newColor = Color.black;
            break;
        case Elements.Water:
            newColor = Color.blue;
            break;

        case Elements.Fire:
            newColor = Color.red;
            break;

        case Elements.Wind:
            newColor = Color.grey;
            break;

        default:
            newColor = Color.red;
            break;
        }

        renderer.material.color = newColor;
    }
示例#12
0
		/// <summary>
		/// Метод, которому условие поиска передаётся через делегат;
		/// </summary>
		/// <param name="array">Массив с элементами.</param>
		public static void SearchByDelegat(this int[] array, Elements positive)
		{
			int pos = 0;
			array.Randomizer();
			for (int i = 0; i < array.Length; i++)
				if (positive(array[i]) == true)
					pos++;
		}
示例#13
0
 public void Initialize(Elements.Worlds.World _world)
 {
     world = _world;
     offset.X = ((world.chunkC * world.chunkSize) / 2) - (visible.Width / 2);
     offset.Y = ((world.chunkR * world.chunkSize) / 2) - (visible.Height / 2);
     visible.X = (int)offset.X;
     visible.Y = (int)offset.Y;
 }
示例#14
0
        public void Attribute_MultipleNodes_ReturnsFirstFoundAttributeValue()
        {
            var nodes = GetNodes("<a href='url'>text</a><a href='otherurl'>text</a>");

            var elements = new Elements(nodes);

            Assert.That(elements.Attribute("href"), Is.EqualTo("url"));
        }
示例#15
0
        public void Attribute_WithMatch_ReturnsAttributeValue()
        {
            var nodes = GetNodes("<a href='someurl'>text</a>");

            var elements = new Elements(nodes);

            Assert.That(elements.Attribute("href"), Is.EqualTo("someurl"));
        }
示例#16
0
        public void Add(float h, float w)
        {
            Elements temp = new Elements(h, w, Pila);
            Quad.Add(temp);

            //Render();
            //BigChek();
        }
示例#17
0
        public void Text_MultipleNodes_ReturnsFirstFoundValue()
        {
            var nodes = GetNodes("<a href='url'>text</a><a href='otherurl'>other</a>");

            var elements = new Elements(nodes);

            Assert.That(elements.Text, Is.EqualTo("text"));
        }
示例#18
0
        public void Raw_WithMatch_ReturnsValue()
        {
            var nodes = GetNodes("<a href='someurl'>text</a>");

            var elements = new Elements(nodes);

            Assert.That(elements.Raw, Is.EqualTo("<a href='someurl'>text</a>"));
        }
 public void DisableObject(GameObject obj, Elements element)
 {
     List<GameObject> list = ObjectList[(int) element];
     obj.SetActive(false);
     if (!list.Contains(obj))
     {
         list.Add(obj);
     }
 }
示例#20
0
 protected override void SetTransition(int counter, Elements.BaseTypes.ComplexTypes.Transition transition, int j, string s)
 {
     var coast = transition as TransitionItemsCoast;
     if(coast == null)
     {
         int a = 5;
     }
     int value = Convert.ToInt32(s, 16);
     coast.AddElement((LineType)counter,j,value);
 }
示例#21
0
 public override void Update(Elements.Enemy enemy, GameTime gameTime)
 {
     timer += gameTime.ElapsedGameTime.Milliseconds;
     if (timer >= hitTime)
     {
         if (enemy.Hitbox.Intersects(Managers.Executive.level.Player.Hitbox))
             Managers.Executive.level.Player.SendStateInput(StateInput.Hit);
         timer = 0;
     }
 }
示例#22
0
 public void DisableObject(GameObject obj, Elements element)
 {
     List<GameObject> list = ObjectList[(int) element];
     obj.SetActive(false);
     obj.transform.localScale = new Vector3(1,1,1);
     if (!list.Contains(obj))
     {
         list.Add(obj);
     }
 }
示例#23
0
 public Form(string path, Elements element, int width, int height, int maxElementalPoints = 100)
 {
     this.animation = new Animation(path, 4, 1, width, height);
     this.element = element;
     this.experience = this.targetExperience = 0;
     this.maxExperience = 100;
     this.elementalPoints = 0;
     this.maxElementalPoints = maxElementalPoints;
     this.usingQ = this.usingE = false;
     this.qTimer = this.eTimer = 0;
 }
示例#24
0
    public Player(Elements primary, Elements secondary, bool isAI)
    {
        PrimaryChar = primary;
        SecondChar = secondary;
        IsAI = isAI;

        HP = GameConsts.Instance.StartingHP;

        //Generate energy.
        Energy = new Dictionary<Elements, int>();
        foreach (Elements el in Enum.GetValues(typeof(Elements)).Cast<Elements>())
        {
            Energy.Add(el, 0);
        }
        Energy[PrimaryChar] += GameConsts.Instance.StartingEnergyPerType;
        Energy[SecondChar] += GameConsts.Instance.StartingEnergyPerType;

        //Generate the deck.
        foreach (Card c in GameConsts.Instance.Decks[PrimaryChar].Concat(GameConsts.Instance.Decks[SecondChar]))
        {
            Card c2 = new Card(c);
            Deck.Add(c2);
        }

        //Shuffle the deck: http://stackoverflow.com/questions/273313/randomize-a-listt-in-c-sharp
        System.Random rng = new System.Random();
        int n = Deck.Count;
        while (n > 1)
        {
            n--;
            int k = rng.Next(n + 1);
            Card value = Deck[k];
            Deck[k] = Deck[n];
            Deck[n] = value;
        }

        //Create corresponding GameObjects.
        int count = 0;
        Vector3 containerPos = (isAI ? PrefabAndInstanceContainer.Instance.AIPlayerDeckMarker :
                                       PrefabAndInstanceContainer.Instance.HumanPlayerDeckMarker).position;
        foreach (Card c in Deck)
        {
            GameObject prefab = PrefabAndInstanceContainer.Instance.CardPrefabs[c.Type];
            Transform cT = GameObject.Instantiate<GameObject>(prefab).transform;

            cT.position = containerPos + new Vector3(0.0f, count * GameConsts.Instance.DeckCardSeparation, 0.0f);

            CardComponent cmp = cT.GetComponent<CardComponent>();
            cmp.MyCard = c;
            cmp.IsFaceDown = true;

            count += 1;
        }
    }
示例#25
0
 public static string ClassFor(Elements element)
 {
     var _elementCssClasses = new Dictionary<Elements, string>
                              {
                                  { Elements.FcmReassignButton, "btn btn-reassign-further-action-task pull-right" },
                                  { Elements.EditFcmButton, "btn btn-edit-further-action-task" },
                                  { Elements.HazardousSubstanceRemoveButton, "deleteIcon icon-remove" },
                                  { Elements.HazardousSubstanceReinstateButton, "reinstateIcon icon-refresh" }
                              };
     return _elementCssClasses[element];
 }
示例#26
0
 public override EnemyState HandleInput(Elements.Enemy enemy, EStateInput input)
 {
     switch(input)
     {
         case EStateInput.AnimEnd:
             animState = EAnimState.Idle;
             break;
         default:
             break;
     }
     return base.HandleInput(enemy, input, this);
 }
示例#27
0
 public static float GetMultiplier(Elements current, Elements target)
 {
     if (WeakAgainst(current, target))
     {
         return 0.5f;
     }
     else if (WeakAgainst(target, current))
     {
         return 2.0f;
     }
     return 1.0f;
 }
示例#28
0
 private Color DetermineColorByElement(Elements element)
 {
     switch (element)
     {
         case Elements.Physical: return Color.LightGray;
         case Elements.Fire: return Color.LightCoral;
         case Elements.Water: return Color.LightBlue;
         case Elements.Wind: return Color.LightGreen;
         case Elements.Earth: return Color.RosyBrown;
         default: return Color.White;
     }
 }
示例#29
0
 private static string EnergyTextFor(Elements el)
 {
     switch (el)
     {
         case Elements.Fire: return "F";
         case Elements.Air: return "A";
         case Elements.Water: return "Wa";
         case Elements.Earth: return "E";
         case Elements.Wood: return "Wo";
         case Elements.Metal: return "M";
         default: throw new InvalidOperationException();
     }
 }
    static void Main()
    {
        int[] tokens = Console.ReadLine().Split(' ').Select(ch => int.Parse(ch)).ToArray();

        int n = tokens[0], m = tokens[1];
        string genome = Console.ReadLine();

        List<Elements> elements = new List<Elements>();
        elements = AddLetterRepeatsToList(ref elements, genome);

        int indexLetter = 0, indexLine = 1;

        List<StringBuilder> lines = new List<StringBuilder>();

        int letterOnLine = n;

        while (indexLetter < elements.Count)
        {
            StringBuilder line = new StringBuilder();
            line.Append(string.Format("{0} ", indexLine++));

            for (int i = 1; i <= n; i++)
            {
                line.Append(elements[indexLetter].letter);

                elements[indexLetter] =
                    new Elements() { repeats = elements[indexLetter].repeats - 1, letter = elements[indexLetter].letter };

                if (elements[indexLetter].repeats == 0) indexLetter++;

                if (indexLetter >= elements.Count) break;

                if (i % m == 0) line.Append(" ");
            }

            lines.Add(line);
        }

        int numberOfSpaces = (--indexLine).ToString().Length - 1;

        for (int i = 0; i < lines.Count; i++)
        {
            if (i == 9 || i == 99 || i == 999 || i == 9999 || i == 99999) numberOfSpaces--;

            lines[i].Insert(0, new string(' ', numberOfSpaces));

            if (lines[i][lines[i].Length - 1] == ' ') lines[i].Remove(lines[i].Length - 1, 1);
        }

        foreach (var line in lines) Console.WriteLine(line);
    }
示例#31
0
        /// <summary>
        /// Add a parameter with a given name and value.
        /// </summary>
        /// <param name="name">The name of the parameter</param>
        /// <param name="value">The value of the parameter as a FHIR datatype or Resource</param>
        /// <returns>this (Parameters), so you can chain AddParameter calls</returns>
        public SearchParams Add(string name, string value)
        {
            if (name == null)
            {
                throw Error.ArgumentNull(nameof(name));
            }
            if (value == null)
            {
                throw Error.ArgumentNull(nameof(value));
            }

            if (name == SEARCH_PARAM_QUERY)
            {
                Query = nonEmptySingleValue(name, Query, value);
            }
            else if (name == SEARCH_PARAM_TEXT)
            {
                Text = nonEmptySingleValue(name, Text, value);
            }
            else if (name == SEARCH_PARAM_CONTENT)
            {
                Content = nonEmptySingleValue(name, Content, value);
            }
            else if (name == SEARCH_PARAM_COUNT)
            {
                int count;
                if (!Int32.TryParse(value, out count) || count <= 0)
                {
                    throw Error.Format("Invalid {0}: '{1}' is not a positive integer".FormatWith(name, value));
                }
                Count = count;
            }
            else if (name == SEARCH_PARAM_INCLUDE)
            {
                addNonEmpty(name, Include, value);
            }
            else if (name == SEARCH_PARAM_REVINCLUDE)
            {
                addNonEmpty(name, RevInclude, value);
            }
            else if (name.StartsWith(SEARCH_PARAM_SORT + SEARCH_MODIFIERSEPARATOR))
            {
                var order = name.Substring(SEARCH_PARAM_SORT.Length + 1).ToLower();

                if ("ascending".StartsWith(order) && order.Length >= 3)
                {
                    addNonEmptySort(value, SortOrder.Ascending);
                }
                else if ("descending".StartsWith(order) && order.Length >= 4)
                {
                    addNonEmptySort(value, SortOrder.Descending);
                }
                else
                {
                    throw Error.Format("Invalid {0}: '{1}' is not a recognized sort order".FormatWith(SEARCH_PARAM_SORT, order));
                }
            }
            else if (name == SEARCH_PARAM_SORT)
            {
                addNonEmptySort(value, SortOrder.Ascending);
            }
            else if (name == SEARCH_PARAM_SUMMARY)
            {
                SummaryType st = SummaryType.False;
                if (Enum.TryParse(value, ignoreCase: true, result: out st))
                {
                    Summary = st;
                }
                else
                {
                    throw Error.Format("Invalid {0}: '{1}' is not a recognized summary value".FormatWith(name, value));
                }
            }
            else if (name == SEARCH_PARAM_FILTER)
            {
                Filter = nonEmptySingleValue(name, Filter, value);
            }
            else if (name == SEARCH_PARAM_CONTAINED)
            {
                if (SEARCH_CONTAINED_TRUE.Equals(value))
                {
                    Contained = ContainedSearch.True;
                }
                else if (SEARCH_CONTAINED_FALSE.Equals(value))
                {
                    Contained = ContainedSearch.False;
                }
                else if (SEARCH_CONTAINED_BOTH.Equals(value))
                {
                    Contained = ContainedSearch.Both;
                }
                else
                {
                    throw Error.Format("Invalid {0}: '{1}' is not a recognized contained value".FormatWith(name, value));
                }
            }
            else if (name == SEARCH_PARAM_CONTAINEDTYPE)
            {
                if (SEARCH_CONTAINED_TYPE_CONTAINED.Equals(value))
                {
                    ContainedType = ContainedResult.Contained;
                }
                else if (SEARCH_CONTAINED_TYPE_CONTAINER.Equals(value))
                {
                    ContainedType = ContainedResult.Container;
                }
                else
                {
                    throw Error.Format("Invalid {0}: '{1}' is not a recognized containedType value".FormatWith(name, value));
                }
            }
            else if (name == SEARCH_PARAM_ELEMENTS)
            {
                if (String.IsNullOrEmpty(value))
                {
                    throw Error.Format("Invalid {0} value: it cannot be empty".FormatWith(name));
                }
                Elements.AddRange(value.Split(','));
            }
            else
            {
                Parameters.Add(Tuple.Create(name, value));
            }

            return(this);
        }
示例#32
0
 public bool ContainsClass(string @class)
 {
     return(Elements.ContainsKey(@class));
 }
 void Inititalize()
 {
     Elements.SetName(PdfAction.Keys.Type, "/Action");
     Elements.SetName(PdfAction.Keys.S, "/GoToR");
 }
示例#34
0
 public void RegisterOnNext(T element) => Elements.Add(element);
 void Initialize()
 {
     Elements.SetName(Keys.Subtype, "/Widget");
 }
示例#36
0
 protected override ElementCollection PerformAs(IPerformer actor)
 {
     return(actor.Perform(Elements.InThePageBody()
                          .ThatAre(TicketList.TicketsTitled(title))
                          .Called($"the tickets titled {title}")));
 }
示例#37
0
 public SearchParams Select(params string[] elements)
 {
     Elements.AddRange(elements);
     return(this);
 }
 public OUR_OptimizedSetWithVC <T> Merge(ImmutableHashSet <OUR_OptimizedSetWithVCElement <T> > elements)
 {
     return(new(Elements.Union(elements)));
 }
示例#39
0
 /// <summary>
 /// Initializes a new page. The page must be added to a document before it can be used.
 /// Depending of the IsMetric property of the current region the page size is set to
 /// A4 or Letter respectively. If this size is not appropriate it should be changed before
 /// any drawing operations are performed on the page.
 /// </summary>
 public PdfPage()
 {
     Elements.SetName(Keys.Type, "/Page");
     Initialize();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PdfMetadata"/> class.
 /// </summary>
 public PdfMetadata()
 {
     Elements.SetName(Keys.Type, "/Metadata");
     Elements.SetName(Keys.Subtype, "/XML");
     SetupStream();
 }
        /// <summary>
        /// Checks the password.
        /// </summary>
        /// <param name="inputPassword">Password or null if no password is provided.</param>
        public PasswordValidity ValidatePassword(string inputPassword)
        {
            // We can handle 40 and 128 bit standard encryption
            string filter = Elements.GetName(PdfSecurityHandler.Keys.Filter);
            int    v      = Elements.GetInteger(PdfSecurityHandler.Keys.V);

            if (filter != "/Standard" || !(v >= 1 && v <= 3))
            {
                throw new PdfReaderException(PSSR.UnknownEncryption);
            }

            byte[] documentID = PdfEncoders.RawEncoding.GetBytes(Owner.Internals.FirstDocumentID);
            byte[] oValue     = PdfEncoders.RawEncoding.GetBytes(Elements.GetString(Keys.O));
            byte[] uValue     = PdfEncoders.RawEncoding.GetBytes(Elements.GetString(Keys.U));
            int    pValue     = Elements.GetInteger(Keys.P);
            int    rValue     = Elements.GetInteger(Keys.R);

            if (inputPassword == null)
            {
                inputPassword = "";
            }

            bool strongEncryption = rValue == 3;
            int  keyLength        = strongEncryption ? 16 : 32;

#if true
            // Try owner password first
            byte[] password = PdfEncoders.RawEncoding.GetBytes(inputPassword);
            InitWidhOwnerPassword(documentID, inputPassword, oValue, pValue, strongEncryption);
            if (EqualsKey(uValue, keyLength))
            {
                this.document.SecuritySettings.hasOwnerPermissions = true;
                return(PasswordValidity.OwnerPassword);
            }
            this.document.SecuritySettings.hasOwnerPermissions = false;

            // Now try user password
            password = PdfEncoders.RawEncoding.GetBytes(inputPassword);
            InitWidhUserPassword(documentID, inputPassword, oValue, pValue, strongEncryption);
            if (!EqualsKey(uValue, keyLength))
            {
                return(PasswordValidity.Invalid);
            }
            return(PasswordValidity.UserPassword);
#else
            password = PdfEncoders.RawEncoding.GetBytes(inputPassword);
            InitWidhUserPassword(documentID, inputPassword, oValue, pValue, strongEncryption);

            this.document.SecuritySettings.hasOwnerPermissions = false;

            if (!EqualsKey(uValue, keyLength))
            {
                password = PdfEncoders.RawEncoding.GetBytes(inputPassword);

                // Compare owner password
                InitWidhOwnerPassword(documentID, inputPassword, oValue, pValue, strongEncryption);

                if (!EqualsKey(uValue, keyLength))
                {
                    //Compare user password
                    InitWidhUserPassword(documentID, inputPassword, oValue, pValue, strongEncryption);
                    if (!EqualsKey(uValue, keyLength))
                    {
                        return(0);
                    }
                    return(1);
                }
                this.document.SecuritySettings.hasOwnerPermissions = true;
                return(2);
            }
            return(1);
#endif
        }
        private bool TryToMergeWire(float x, float y, Pin pin)
        {
            float scaledX = (x - translate.X) / zoom;
            float scaledY = (y - translate.Y) / zoom;

            // find wire that contains touch point
            Wire wireToMerge  = null;
            Pin  startToMerge = null;
            Pin  endToMerge   = null;

            // try to merge wire Pin to current element Pin
            foreach (var pair in Elements.Where(_ => _.Value is Wire))
            {
                var  wire        = pair.Value as Wire;
                bool startBounds = wire.StartBounds.Contains(scaledX, scaledY) == true;
                bool endBounds   = wire.EndBounds.Contains(scaledX, scaledY) == true;
                bool wireBounds  = wire.WireBounds.Contains(scaledX, scaledY) == true;

                // check for wire start pin
                // exlude if wire start is same as pin to merge
                if (startBounds == true && wire.Start != pin)
                {
                    wireToMerge  = wire;
                    startToMerge = wire.Start;
                    break;
                }

                // check for wire end pin
                // exlude if wire end is same as pin to merge
                if (endBounds == true && wire.End != pin)
                {
                    wireToMerge = wire;
                    endToMerge  = wire.End;
                    break;
                }
            }

            // merge wire start
            if (wireToMerge != null && startToMerge != null && startToMerge.Parent == null)
            {
                MergeWireStart(wireToMerge, startToMerge, pin);

                // if pin is wire end than wire is removed
                if (pin == wireToMerge.End)
                {
                    Element value;
                    Elements.TryRemove(wireToMerge.Id, out value);

                    wireToMerge.Start.Wires.Remove(wireToMerge);
                    wireToMerge.End.Wires.Remove(wireToMerge);

                    //Console.WriteLine ("TryToMergeWire: pin==wireToMerge.End, Pin.Id {0} Remove wireToMerge.Id", pin.Id, wireToMerge.Id);
                }

                // check for other end Wires connections to be merged
                UpdateMergedPinWires(pin, wireToMerge, startToMerge);

                // if merged start does not have any connected wires than need to be removed
                if (startToMerge.Wires.Count == 0)
                {
                    Element value;
                    Elements.TryRemove(startToMerge.Id, out value);

                    //Console.WriteLine ("TryToMergeWire: startToMerge.Wires.Count==0, Pin.Id {0} Remove startToMerge.Id", pin.Id, startToMerge.Id);
                }

                // if pin does not have any connected wires than need to be removed
                if (pin.Wires.Count == 0)
                {
                    Element value;
                    Elements.TryRemove(pin.Id, out value);

                    //Console.WriteLine ("TryToMergeWire: pin.Wires.Count==0, Pin.Id {0} Remove pin.Id", pin.Id);
                }
                // otherwise update all wires connected to pin
                else
                {
                    UpdateWires(pin.Wires, 0f, 0f);
                }

                ResetStartAndEndPin();

                return(true);
            }

            // merge wire end
            if (wireToMerge != null && endToMerge != null && endToMerge.Parent == null)
            {
                MergeWireEnd(wireToMerge, endToMerge, pin);

                // if pin is wire start than wire is removed
                if (pin == wireToMerge.Start)
                {
                    Element value;
                    Elements.TryRemove(wireToMerge.Id, out value);

                    wireToMerge.Start.Wires.Remove(wireToMerge);
                    wireToMerge.End.Wires.Remove(wireToMerge);

                    //Console.WriteLine ("TryToMergeWire: pin==wireToMerge.Start, Pin.Id {0} Remove wireToMerge.Id", pin.Id, wireToMerge.Id);
                }

                // check for other end Wires connections to be merged
                UpdateMergedPinWires(pin, wireToMerge, endToMerge);

                // if merged end does not have any connected wires than need to be removed
                if (endToMerge.Wires.Count == 0)
                {
                    Element value;
                    Elements.TryRemove(endToMerge.Id, out value);

                    //Console.WriteLine ("TryToMergeWire: endToMerge.Wires.Count==0, Pin.Id {0} Remove endToMerge.Id", pin.Id, endToMerge.Id);
                }

                // if pin does not have any connected wires than need to be removed
                if (pin.Wires.Count == 0)
                {
                    Element value;
                    Elements.TryRemove(pin.Id, out value);

                    //Console.WriteLine ("TryToMergeWire: pin.Wires.Count==0, Pin.Id {0} Remove pin.Id", pin.Id);
                }
                // otherwise update all wires connected to pin
                else
                {
                    UpdateWires(pin.Wires, 0f, 0f);
                }

                ResetStartAndEndPin();

                return(true);
            }

            return(false);
        }
示例#43
0
 public void ExpectNone(long withinMilliseconds) => Elements.ExpectNone(withinMilliseconds, "Expected nothing");
示例#44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PdfLinkAnnotation"/> class.
 /// </summary>
 public PdfLinkAnnotation()
 {
     _linkType = LinkType.None;
     Elements.SetName(PdfAnnotation.Keys.Subtype, "/Link");
 }
示例#45
0
 public void ExpectCompletion(long timeoutMilliseconds, string message)
 => Elements.ExpectCompletion(timeoutMilliseconds, message);
示例#46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PdfLinkAnnotation"/> class.
 /// </summary>
 public PdfLinkAnnotation(PdfDocument document)
     : base(document)
 {
     _linkType = LinkType.None;
     Elements.SetName(PdfAnnotation.Keys.Subtype, "/Link");
 }
示例#47
0
 public T ExpectNext() =>
 Elements.Next(Environment.DefaultTimeoutMilliseconds,
               $"Subscriber {Sub} did not call `RegisterOnNext(_)`");
示例#48
0
 private TypeMirrorTestUtils(Types types, Elements elements, TypeMirrorUtils typeMirrors)
 {
     this._types       = types;
     this._elements    = elements;
     this._typeMirrors = typeMirrors;
 }
示例#49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PdfShadingPattern"/> class.
 /// </summary>
 public PdfShadingPattern(PdfDocument document)
     : base(document)
 {
     Elements.SetName(Keys.Type, "/Pattern");
     Elements[Keys.PatternType] = new PdfInteger(2);
 }
示例#50
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="nodes">Der Inhalt</param>
 public HtmlElementTHead(params IHtmlNode[] nodes)
     : this()
 {
     Elements.AddRange(nodes);
 }
示例#51
0
 public IEnumerable <String> GetValues()
 => Elements.Select(e => e.GetValue());
 public void Clear()
 {
     Elements.Clear();
     SetNextId(0);
 }
示例#53
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="nodes">Der Inhalt</param>
 public HtmlElementTHead(IEnumerable <IHtmlNode> nodes)
     : this()
 {
     Elements.AddRange(nodes);
 }
示例#54
0
        public void VideoSearch(String searchType, String searchText, String videoName)
        {
            iWait.Until(ExpectedConditions.ElementExists(By.Id("ContentPlaceHolder1_ddlSelectTypeSearch")));

            SelectElement videoSearchType = new SelectElement(driver.FindElement(By.Id("ContentPlaceHolder1_ddlSelectTypeSearch")));

            videoSearchType.SelectByText(searchType);

            VideoSearchText().Clear();
            VideoSearchText().SendKeys(searchText);

            //Click on search button
            VideoSearchButton().Click();

            OverlayWait();

            //NSoup to parse the code of Page.
            Document doc = NSoup.NSoupClient.Parse(driver.PageSource);

            iWait.Until(ExpectedConditions.ElementIsVisible(By.Id("ContentPlaceHolder1_grdVideoListingSearch")));

            Elements rowListNsoup = doc.GetElementById("ContentPlaceHolder1_grdVideoListingSearch").GetElementsByTag("tr");

            // Retreving all the rows of Manage Table
            IList <IWebElement> rowListSelenium = (IList <IWebElement>)driver.FindElement(By.Id("ContentPlaceHolder1_grdVideoListingSearch")).FindElements(By.TagName("tr"));

            flag = false;

            int rowcounter = 0;

            foreach (Element currentRow in rowListNsoup)
            {
                Attributes attr = currentRow.Attributes;

                //Row that have class="GridRowStyle" or class="AltGridStyle"
                if (attr["class"].Equals("GridRowStyle") || attr["class"].Equals("AltGridStyle"))
                {
                    log.Info("Row Counter :: " + rowcounter + " at line:" + new StackTrace(true).GetFrame(0).GetFileLineNumber());

                    columData = currentRow.GetElementsByTag("td")[1].GetElementById("ContentPlaceHolder1_grdVideoListingSearch_lnkTitleSearch_" + rowcounter).OwnText().Trim();


                    if (columData.Equals(videoName))
                    {
                        flag = true;
                        iWait.Until(ExpectedConditions.ElementIsVisible(By.Id("ContentPlaceHolder1_grdVideoListingSearch_btnSelect_" + rowcounter)));

                        //click on Select Button
                        rowListSelenium[rowcounter + 1].FindElements(By.TagName("td"))[0].FindElement(By.Id("ContentPlaceHolder1_grdVideoListingSearch_btnSelect_" + rowcounter)).Click();

                        OverlayWait();

                        iWait.Until(ExpectedConditions.ElementIsVisible(By.Id("ContentPlaceHolder1_btnSearch")));
                        log.Info("Clicked on select Button: " + rowcounter);

                        break;
                    }
                    rowcounter++;
                }
            }
        }
示例#55
0
 public SeparatorSegment(Separator s)
 {
     Elements.Add(s);
 }
示例#56
0
 public void Add(SrgsElement element)
 {
     Helpers.ThrowIfNull(element, "element");
     Elements.Add(element);
 }
示例#57
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PdfXObject"/> class.
 /// </summary>
 /// <param name="document">The document that owns the object.</param>
 public PdfSoftMask(PdfDocument document)
     : base(document)
 {
     Elements.SetName(Keys.Type, "/Mask");
 }
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="nodes">Der Inhalt</param>
 public HtmlElementOptgroup(params IHtmlNode[] nodes)
     : this()
 {
     Elements.AddRange(nodes);
 }
        private bool TryToDetachWire(float x, float y)
        {
            float scaledX = (x - translate.X) / zoom;
            float scaledY = (y - translate.Y) / zoom;

            // find wire that contains touch point
            Wire wireToDetach  = null;
            Pin  startToDetach = null;
            Pin  endToDetach   = null;

            // try to detach wire Pin from current element
            foreach (var pair in Elements.Where(_ => _.Value is Wire))
            {
                var  wire        = pair.Value as Wire;
                bool startBounds = wire.StartBounds.Contains(scaledX, scaledY) == true;
                bool endBounds   = wire.EndBounds.Contains(scaledX, scaledY) == true;
                bool wireBounds  = wire.WireBounds.Contains(scaledX, scaledY) == true;

                // check for wire start pin
                if (startBounds == true)
                {
                    wireToDetach  = wire;
                    startToDetach = wire.Start;
                    break;
                }

                // check for wire end pin
                if (endBounds == true)
                {
                    wireToDetach = wire;
                    endToDetach  = wire.End;
                    break;
                }
            }

            // detach wire start
            if (wireToDetach != null && startToDetach != null && startToDetach.Parent != null)
            {
                // create standalone pin
                var pin = InsertPin(scaledX, scaledY, false);

                // set detached wire start to standalone pin
                SwapWireStart(wireToDetach, startToDetach, pin);

                // reset start pin
                startToDetach.IsSelected = false;

                // set standalone pin as current element
                currentElement          = pin;
                currentElement.ShowPins = true;

                UpdateWires(pin.Wires, 0f, 0f);

                ResetStartAndEndPin();

                return(true);
            }

            // detach wire end
            if (wireToDetach != null && endToDetach != null && endToDetach.Parent != null)
            {
                // create standalone pin
                var pin = InsertPin(scaledX, scaledY, false);

                // set detached wire end to standalone pin
                SwapWireEnd(wireToDetach, endToDetach, pin);

                // reset start pin
                endToDetach.IsSelected = false;

                // set standalone pin as current element
                currentElement          = pin;
                currentElement.ShowPins = true;

                UpdateWires(pin.Wires, 0f, 0f);

                ResetStartAndEndPin();

                return(true);
            }

            return(false);
        }
示例#60
0
 /// <summary>
 /// Adds the specified annotation.
 /// </summary>
 /// <param name="annotation">The annotation.</param>
 public void Add(PdfAnnotation annotation)
 {
     annotation.Document = Owner;
     Owner._irefTable.Add(annotation);
     Elements.Add(annotation.Reference);
 }