Beispiel #1
0
        /// <summary>
        /// Replaces the test nodes in the list.
        /// </summary>
        public void ReplaceNodeList(IList <TestNode> nodes, IList <ILocalNode> newNodes, NamespaceTable namespaceUris)
        {
            nodes.Clear();

            if (newNodes == null)
            {
                return;
            }

            List <string> exportedUris = new List <string>();

            if (NamespaceUris != null)
            {
                exportedUris.AddRange(NamespaceUris);
            }

            for (int ii = 0; ii < newNodes.Count; ii++)
            {
                ILocalNode newNode = newNodes[ii];

                NodeId nodeId = newNode.NodeId;

                if (namespaceUris != null && nodeId.NamespaceIndex > 1)
                {
                    string uri = namespaceUris.GetString(nodeId.NamespaceIndex);

                    if (uri != null)
                    {
                        bool found = false;

                        for (int jj = 0; jj < exportedUris.Count; ii++)
                        {
                            if (exportedUris[jj] == uri)
                            {
                                nodeId = new NodeId(nodeId.Identifier, (ushort)(jj + 2));
                                found  = true;
                                break;
                            }
                        }

                        if (!found)
                        {
                            exportedUris.Add(uri);
                            nodeId = new NodeId(nodeId.Identifier, (ushort)(exportedUris.Count + 1));
                        }
                    }
                }

                TestNode testNode = new TestNode();

                testNode.Id   = nodeId.ToString();
                testNode.Name = newNode.BrowseName.ToString();

                nodes.Add(testNode);
            }

            NamespaceUris = new ListOfString();
            NamespaceUris.AddRange(exportedUris);
        }
Beispiel #2
0
 /// <summary>
 /// Creates a new <see cref="StaticSpell"/> instance.
 /// </summary>
 public StaticSpell()
 {
     Cooldown = new ListOfDouble();
     Cost = new ListOfInt();
     Effect = new ListOfListOfDouble();
     EffectBurn = new ListOfString();
     Image = new Image();
     LevelTip = new LevelTip();
     Range = new ListOfInt();
 }
Beispiel #3
0
 /// <summary>
 /// Creates a new <see cref="StaticChampion"/> instance.
 /// </summary>
 public StaticChampion()
 {
     // ComplexTypes CANNOT be null when saving to the database.
     AllyTips = new ListOfString();
     EnemyTips = new ListOfString();
     Image = new Image();
     Info = new StaticChampionInfo();
     Passive = new Passive();
     Stats = new Stats();
     Tags = new ListOfString();
 }
    public void RemoveGroup(string key)
    {
        // First delete the blackboard Entries that were in this group
        ListOfString entries = groupedBlackboardEntries[key];

        foreach (string entry in entries.list)
        {
            blackboardEntries.Remove(entry);
        }
        // Then delete the group
        groupedBlackboardEntries.Remove(key);
    }
    public void RenameGroup(string key, string newKey)
    {
        if (groupedBlackboardEntries.ContainsKey(newKey))
        {
            Debug.LogError($"A group named {newKey} already exists");
            return;
        }

        ListOfString groupContent = groupedBlackboardEntries[key];

        groupedBlackboardEntries.Add(newKey, groupContent);
        groupedBlackboardEntries.Remove(key);
    }
Beispiel #6
0
        void GenerateListOfLists()
        {
            ListOfLobbies.Add(TempLobby1);
            ListOfLobbies.Add(TempLobby2);
            ListOfLobbies.Add(TempLobby3);
            ListOfLobbies.Add(TempLobby4);

            ListOfLobbies.Add(TempLobby5);
            ListOfLobbies.Add(TempLobby6);
            ListOfLobbies.Add(TempLobby7);
            ListOfLobbies.Add(TempLobby8);

            ListOfLobbies.Add(TempLobby9);
            ListOfLobbies.Add(TempLobby10);
            ListOfLobbies.Add(TempLobby11);
            ListOfLobbies.Add(TempLobby12);

            ListOfLobbies.Add(TempLobby13);
            ListOfLobbies.Add(TempLobby14);
            ListOfLobbies.Add(TempLobby15);
            ListOfLobbies.Add(TempLobby16);

            ListOfString.Add(CopyTextA);
            ListOfString.Add(CopyTextB);
            ListOfString.Add(CopyTextC);
            ListOfString.Add(CopyTextD);

            ListOfString.Add(CopyTextE);
            ListOfString.Add(CopyTextF);
            ListOfString.Add(CopyTextG);
            ListOfString.Add(CopyTextH);

            ListOfString.Add(CopyTextI);
            ListOfString.Add(CopyTextJ);
            ListOfString.Add(CopyTextK);
            ListOfString.Add(CopyTextL);

            ListOfString.Add(CopyTextM);
            ListOfString.Add(CopyTextN);
            ListOfString.Add(CopyTextO);
            ListOfString.Add(CopyTextP);
        }
Beispiel #7
0
 /// <summary>
 /// Creates a new <see cref="BasicData"/> instance.
 /// </summary>
 public BasicData()
 {
     // Note: default values are defined in the "basic" property of an ItemList or RuneList.
     Colloq = string.Empty;
     Description = string.Empty;
     Group = string.Empty;
     Image = new Image();
     Maps = new DictionaryOfBoolean
     {
         { "1", true },
         { "8", true },
         { "10", true },
         { "12", true },
     };
     Name = string.Empty;
     PlainText = string.Empty;
     RequiredChampion = string.Empty;
     SanitizedDescription = string.Empty;
     Stacks = 1;
     Stats = new BasicDataStats();
     Tags = new ListOfString();
 }
Beispiel #8
0
        /// <summary>
        /// Activates the session.
        /// </summary>
        public byte[] Activate(
            SignatureData signature,
            ListOfString localeIds,
            ExtensionObject userIdentityToken,
            SignatureData userTokenSignature)
        {
            lock (m_lock)
            {
                if (m_clientCertificate != null)
                {
                    // validate the client's signature.
                    byte[] dataToSign = SecurityUtils.Append(m_endpoint.ServerCertificate, m_serverNonce);

                    bool valid = SecurityUtils.Verify(
                        m_clientCertificate,
                        m_endpoint.SecurityPolicyUri,
                        dataToSign,
                        signature);

                    if (!valid)
                    {
                        throw new StatusCodeException(
                                  StatusCodes.BadSecurityChecksFailed,
                                  "Client did not provide a correct signature for the nonce data provided by the server.");
                    }
                }

                m_activated = true;
                m_localeIds = localeIds;

                // TBD - validate the user identity token.

                // return a new nonce.
                RNGCryptoServiceProvider random = new RNGCryptoServiceProvider();
                random.GetBytes(m_serverNonce);
                return(m_serverNonce);
            }
        }
        /// <summary>
        /// Replaces the test nodes in the list.
        /// </summary>        
        public void ReplaceNodeList(IList<TestNode> nodes, IList<ILocalNode> newNodes, NamespaceTable namespaceUris)
        {
            nodes.Clear();

            if (newNodes == null)
            {
                return;
            }

            List<string> exportedUris = new List<string>();

            if (NamespaceUris != null)
            {
                exportedUris.AddRange(NamespaceUris);
            }
                
            for (int ii = 0; ii < newNodes.Count; ii++)
            {
                ILocalNode newNode = newNodes[ii];

                NodeId nodeId = newNode.NodeId;

                if (namespaceUris != null && nodeId.NamespaceIndex > 1)
                {
                    string uri = namespaceUris.GetString(nodeId.NamespaceIndex);
                    
                    if (uri != null)
                    {
                        bool found = false;

                        for (int jj = 0; jj < exportedUris.Count; ii++)
                        {
                            if (exportedUris[jj] == uri)
                            {
                                nodeId = new NodeId(nodeId.Identifier, (ushort)(jj+2));
                                found = true;
                                break;
                            }
                        }

                        if (!found)
                        {
                            exportedUris.Add(uri);
                            nodeId = new NodeId(nodeId.Identifier, (ushort)(exportedUris.Count+1));
                        }
                    }
                }

                TestNode testNode = new TestNode();

                testNode.Id = nodeId.ToString();
                testNode.Name = newNode.BrowseName.ToString();

                nodes.Add(testNode);
            }

            NamespaceUris = new ListOfString();
            NamespaceUris.AddRange(exportedUris);
        }
		public void DeepClone_ListStringWithNullString_AsReference(TypeModel model)
		{
			var list = new ListOfString()
			{
				Messages = new List<string>()
				{
				    "Hi there",
					null,
					"How are you ?"
				}
			};

			var clone = (ListOfString)model.DeepClone(list);

			Assert.AreEqual(list.Messages.Count, clone.Messages.Count);
			Assert.AreEqual(list.Messages[0], clone.Messages[0]);
			Assert.IsNull(clone.Messages[1]);
			Assert.AreEqual(list.Messages[2], clone.Messages[2]);
		}
Beispiel #11
0
 /// <summary>
 /// Creates a new <see cref="StaticItemTree"/> instance.
 /// </summary>
 public StaticItemTree()
 {
     Tags = new ListOfString();
 }
Beispiel #12
0
 /// <summary>
 /// Creates a new <see cref="StaticMapDetails"/> instance.
 /// </summary>
 public StaticMapDetails()
 {
     Image = new Image();
     UnpurchasableItemList = new ListOfString();
 }
Beispiel #13
0
 /// <summary>
 /// Creates a new <see cref="StaticSummonerSpell"/> instance.
 /// </summary>
 public StaticSummonerSpell()
 {
     Modes = new ListOfString();
 }
Beispiel #14
0
        public static ModifiablePropertyType GetProperty(KeyValuePair<string, object> dmsPropertyValue)
		{
			var dmsProperty = default(ModifiablePropertyType);

			if (dmsPropertyValue.Value == null)
			{
				dmsProperty = new SingletonString { Value = null };
			}
			else
			{
				var propertyType = dmsPropertyValue.Value.GetType();

				if (propertyType == typeof(string))
				{
					dmsProperty = new SingletonString
					{
						Value = Convert.ToString(dmsPropertyValue.Value)
					};
				}
				else if (propertyType == typeof(bool) || propertyType == typeof(bool?))
				{
					dmsProperty = new SingletonBoolean
					{
						Value = Convert.ToBoolean(dmsPropertyValue.Value),
						ValueSpecified = true
					};
				}
				else if (propertyType == typeof(int) || propertyType == typeof(int?))
				{
					dmsProperty = new SingletonInteger32
					{
						Value = Convert.ToInt32(dmsPropertyValue.Value),
						ValueSpecified = true
					};
				}
				else if (propertyType == typeof(float) || propertyType == typeof(float?) ||
						 propertyType == typeof(double) || propertyType == typeof(double?))
				{
					dmsProperty = new SingletonFloat64
					{
						Value = Convert.ToDouble(dmsPropertyValue.Value),
						ValueSpecified = true
					};
				}
				else if (propertyType == typeof(DateTime) || propertyType == typeof(DateTime?))
				{
					dmsProperty = new SingletonDateTime
					{
						Value = Convert.ToDateTime(dmsPropertyValue.Value),
						ValueSpecified = true
					};
				}
				else if (propertyType == typeof(Guid) || propertyType == typeof(Guid?))
				{
					dmsProperty = new SingletonId
					{
						Value = ((Guid)dmsPropertyValue.Value).ToString()
					};
				}
				else if (propertyType == typeof(string[]))
				{
					dmsProperty = new ListOfString
					{
						Value = (string[])dmsPropertyValue.Value
					};
				}
				else if (propertyType == typeof(List<string>))
				{
					dmsProperty = new ListOfString
					{
						Value = ((List<string>)dmsPropertyValue.Value).ToArray()
					};
				}
				else
				{
					throw new NotImplementedException(propertyType.FullName);
				}
			}
				
			dmsProperty.propertyId = dmsPropertyValue.Key;

			return dmsProperty;
		}
Beispiel #15
0
        /// <summary>
        /// Activates the session.
        /// </summary>
        public byte[] Activate(
            SignatureData signature, 
            ListOfString localeIds,
            ExtensionObject userIdentityToken,
            SignatureData userTokenSignature)
        {
            lock (m_lock)
            {
                if (m_clientCertificate != null)
                {
                    // validate the client's signature.
                    byte[] dataToSign = SecurityUtils.Append(m_endpoint.ServerCertificate, m_serverNonce);

                    bool valid = SecurityUtils.Verify(
                        m_clientCertificate,
                        m_endpoint.SecurityPolicyUri,
                        dataToSign,
                        signature);

                    if (!valid)
                    {
                        throw new StatusCodeException(
                            StatusCodes.BadSecurityChecksFailed,
                            "Client did not provide a correct signature for the nonce data provided by the server.");
                    }
                }

                m_activated = true;
                m_localeIds = localeIds;

                // TBD - validate the user identity token.

                // return a new nonce.
                RNGCryptoServiceProvider random = new RNGCryptoServiceProvider();
                random.GetBytes(m_serverNonce);
                return m_serverNonce;
            }
        }
Beispiel #16
0
 /// <summary>
 /// Creates a new <see cref="StaticMastery"/> instance.
 /// </summary>
 public StaticMastery()
 {
     Description = new ListOfString();
     Image = new Image();
     SanitizedDescription = new ListOfString();
 }
Beispiel #17
0
 /// <summary>
 /// Creates a new <see cref="LevelTip"/> instance.
 /// </summary>
 public LevelTip()
 {
     Effect = new ListOfString();
     Label = new ListOfString();
 }