示例#1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Id;
         result = (result * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         result = (result * 397) ^ InputCount.GetHashCode();
         result = (result * 397) ^ OutputCount.GetHashCode();
         result = (result * 397) ^ DefaultSamplesPerSec.GetHashCode();
         return(result);
     }
 }
 public void CountList()
 {
     OutputCount.Invoke(GameObjectList.Count);
 }
示例#3
0
        private void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
        {
            if (context == SaveContext.Copy || context == SaveContext.Undo)
            {
                //Dump all the information into memory

                nodeElement.SetAttribute("inputCount", InputCount.ToString());
                nodeElement.SetAttribute("outputCount", OutputCount.ToString());
                nodeElement.SetAttribute("legacyNodeName", LegacyNodeName);
                nodeElement.SetAttribute("legacyAssembly", LegacyAssembly);
                nodeElement.SetAttribute("nodeNature", NodeNature.ToString());

                if (OriginalNodeContent != null)
                {
                    XmlElement originalNode = xmlDoc.CreateElement("OriginalNodeContent");
                    XmlElement nodeContent  = nodeElement.OwnerDocument.CreateElement(OriginalNodeContent.Name);

                    foreach (XmlAttribute attribute in OriginalNodeContent.Attributes)
                    {
                        nodeContent.SetAttribute(attribute.Name, attribute.Value);
                    }

                    for (int i = 0; i < OriginalNodeContent.ChildNodes.Count; i++)
                    {
                        XmlNode child =
                            nodeContent.OwnerDocument.ImportNode(OriginalNodeContent.ChildNodes[i], true);
                        nodeContent.AppendChild(child.CloneNode(true));
                    }

                    originalNode.AppendChild(nodeContent);
                    nodeElement.AppendChild(originalNode);
                }
            }

            if (context == SaveContext.File)
            {
                //When save files, only save the original node's content,
                //instead of saving the dummy node.
                if (OriginalNodeContent != null)
                {
                    nodeElement.RemoveAll();
                    foreach (XmlAttribute attribute in OriginalNodeContent.Attributes)
                    {
                        nodeElement.SetAttribute(attribute.Name, attribute.Value);
                    }

                    //overwrite the guid/x/y value of the original node.
                    nodeElement.SetAttribute("guid", nodeElement.GetAttribute("guid"));
                    nodeElement.SetAttribute("x", nodeElement.GetAttribute("x"));
                    nodeElement.SetAttribute("y", nodeElement.GetAttribute("y"));

                    for (int i = 0; i < OriginalNodeContent.ChildNodes.Count; i++)
                    {
                        XmlNode child = nodeElement.OwnerDocument.ImportNode(OriginalNodeContent.ChildNodes[i], true);
                        nodeElement.AppendChild(child.CloneNode(true));
                    }
                }
                else
                {
                    nodeElement.SetAttribute("inputCount", InputCount.ToString());
                    nodeElement.SetAttribute("outputCount", OutputCount.ToString());
                    nodeElement.SetAttribute("legacyNodeName", LegacyNodeName);
                    nodeElement.SetAttribute("legacyAssembly", LegacyAssembly);
                    nodeElement.SetAttribute("nodeNature", NodeNature.ToString());
                }
            }
        }