コード例 #1
0
ファイル: Cuvinte.cs プロジェクト: RazvanHidan/Probleme
 void Swap(ref Elements  first, ref Elements  second)
 {
     Elements aux;
     aux = first;
     first = second;
     second = aux;
 }
コード例 #2
0
ファイル: Elemental.cs プロジェクト: zanagi/MelSpaceHunter
        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
ファイル: ElementsEditor.cs プロジェクト: Glain/FFTPatcher
 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;
	}
コード例 #7
0
 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);
        }
コード例 #9
0
		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;
        }
コード例 #11
0
    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
ファイル: DataHelper.cs プロジェクト: TottoroChan/lab.net
		/// <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
ファイル: Camera.cs プロジェクト: AaronCC/RealTimeStrategy
 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
ファイル: ElementsTests.cs プロジェクト: vinntreus/HttpGhost
        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
ファイル: ElementsTests.cs プロジェクト: vinntreus/HttpGhost
        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
ファイル: Rascroi.cs プロジェクト: qwertyV112/Rascroi
        public void Add(float h, float w)
        {
            Elements temp = new Elements(h, w, Pila);
            Quad.Add(temp);

            //Render();
            //BigChek();
        }
コード例 #17
0
ファイル: ElementsTests.cs プロジェクト: vinntreus/HttpGhost
        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
ファイル: ElementsTests.cs プロジェクト: vinntreus/HttpGhost
        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>"));
        }
コード例 #19
0
 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
ファイル: EnemyAttack.cs プロジェクト: AaronCC/Dread-Dungeon
 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
ファイル: Form.cs プロジェクト: zanagi/MelSpaceHunter
 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
ファイル: Player.cs プロジェクト: heyx3/ClubJam2015
    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
ファイル: EnemyIdle.cs プロジェクト: AaronCC/Dread-Dungeon
 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
ファイル: Element.cs プロジェクト: zanagi/MelSpaceHunter
 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
ファイル: PlayerUI.cs プロジェクト: Octanum/Corvus
 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();
     }
 }
コード例 #30
0
    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));
 }
コード例 #33
0
 void Inititalize()
 {
     Elements.SetName(PdfAction.Keys.Type, "/Action");
     Elements.SetName(PdfAction.Keys.S, "/GoToR");
 }
コード例 #34
0
 public void RegisterOnNext(T element) => Elements.Add(element);
コード例 #35
0
 void Initialize()
 {
     Elements.SetName(Keys.Subtype, "/Widget");
 }
コード例 #36
0
ファイル: FindTicketsByTitle.cs プロジェクト: csf-dev/agiil
 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);
 }
コード例 #38
0
 public OUR_OptimizedSetWithVC <T> Merge(ImmutableHashSet <OUR_OptimizedSetWithVCElement <T> > elements)
 {
     return(new(Elements.Union(elements)));
 }
コード例 #39
0
ファイル: PdfPage.cs プロジェクト: ulisses31/PdfSharpCore
 /// <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();
 }
コード例 #40
0
 /// <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();
 }
コード例 #41
0
        /// <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
        }
コード例 #42
0
        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
ファイル: PdfShadingPattern.cs プロジェクト: i-e-b/Form8sn
 /// <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
ファイル: ChainTests.cs プロジェクト: the-ress/HarshPoint
 public IEnumerable <String> GetValues()
 => Elements.Select(e => e.GetValue());
コード例 #52
0
 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");
 }
コード例 #58
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="nodes">Der Inhalt</param>
 public HtmlElementOptgroup(params IHtmlNode[] nodes)
     : this()
 {
     Elements.AddRange(nodes);
 }
コード例 #59
0
        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);
 }