Exemplo n.º 1
0
        public void SaveToFile(string pOutputDir)
        {
            string functions    = GenerateFunctionCodeBlock();
            string properties   = GeneratePropertiesCodeBlock();
            string internals    = GenerateInternalsCodeBlock();
            string specifics    = GenerateSpecificCodeBlock();
            string constructors = ConstructorsTemplate.GetConstructorsString(Name);
            string ns           = CSharpGenerator.BaseNs;

            if (!Namespace.Equals(""))
            {
                ns += "." + Namespace;
            }
            string nsPath = ns.Replace('.', '/');

            Directory.CreateDirectory(pOutputDir + "/" + nsPath);
            StreamWriter SW = new StreamWriter(pOutputDir + "/" + nsPath + "/" + Name + ".cs");

            List <string> parentList = Name != "SimObject" ? ParentList : null;

            string code = SimObjectTemplate.GetClassString(ns, Name, parentList, constructors, internals, properties, functions, specifics);

            if (Name.Equals("SimObject"))
            {
                code =
                    code.Replace(" : base(pId)", "")
                    .Replace(" : base(pObjPtr)", "")
                    .Replace(" : base(pName)", "")
                    .Replace(" : base(pObjPtr)", "");
            }

            SW.Write(code);
            SW.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sobre escritura del método equals
        /// </summary>
        /// <param name="obj">Objeto a comparar</param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (!(obj is Measure) || obj == null)
            {
                return(false);
            }
            if (this == obj)
            {
                return(true);
            }
            Measure measureAComparar = (Measure)obj;

            if (Namespace == null && measureAComparar.Namespace == null && LocalName == null && measureAComparar.LocalName == null)
            {
                return(true);
            }

            if ((Namespace == null && measureAComparar.Namespace != null) || (Namespace != null && measureAComparar.Namespace == null))
            {
                return(false);
            }

            if ((LocalName == null && measureAComparar.LocalName != null) || (LocalName != null && measureAComparar.LocalName == null))
            {
                return(false);
            }

            return(Namespace.Equals(measureAComparar.Namespace) && LocalName.Equals(measureAComparar.LocalName));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Check the equivalence of this object and the argument object.
        /// </summary>
        /// <param name="obj">Target object.</param>
        /// <returns>It returns True if equivalent, False otherwise.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            var element       = (Element)obj;
            var boolcollector = new BoolCollector();

            boolcollector.ChangeBool("Accessibility", Accessibility == element.Accessibility);
            boolcollector.ChangeBool("Id", Id.Equals(element.Id));
            boolcollector.ChangeBool("Inheritance", InheritanceList.SequenceEqual(element.InheritanceList));
            boolcollector.ChangeBool("IsAbstract", IsAbstract == element.IsAbstract);
            boolcollector.ChangeBool("IsSealed", IsSealed == element.IsSealed);
            boolcollector.ChangeBool("IsStatic", IsStatic == element.IsStatic);
            boolcollector.ChangeBool("Members", Members.SequenceEqual(element.Members));
            boolcollector.ChangeBool("Name", Name.Equals(element.Name));
            boolcollector.ChangeBool("Namespace", Namespace.Equals(element.Namespace));
            boolcollector.ChangeBool("Namespaces", Namespaces.SequenceEqual(element.Namespaces));
            boolcollector.ChangeBool("Type", Type == element.Type);
            boolcollector.ChangeBool("Value", Value.Equals(element.Value));

            return(boolcollector.Value);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Determines if this package ID equals the provided one
 /// </summary>
 /// <returns>True if both IDs are equal, false otherwise</returns>
 public bool Match(PackageId id)
 {
     return
         (
         Scope.Equals(id.scope) &&
         Owner.Equals(id.Owner) &&
         Namespace.Equals(id.Namespace) &&
         Name.Equals(id.Name)
         );
 }
Exemplo n.º 5
0
        public override bool Equals(object obj)
        {
            MessageDeliveryContextKey key = obj as MessageDeliveryContextKey;

            if (key != null)
            {
                return(Name.Equals(key.Name) && Namespace.Equals(key.Namespace));
            }
            return(false);
        }
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// <c>true</c> if the current object is equal to the other parameter; otherwise, <c>false</c>.
 /// </returns>
 public bool Equals(AttributeKey other)
 {
     return(other != null &&
            FriendlyName.Equals(other.FriendlyName, StringComparison.Ordinal) &&
            Name.Equals(other.Name, StringComparison.Ordinal) &&
            NameFormat.Equals(other.NameFormat, StringComparison.Ordinal) &&
            Namespace.Equals(other.Namespace, StringComparison.Ordinal) &&
            OriginalIssuer.Equals(other.OriginalIssuer, StringComparison.Ordinal) &&
            ValueType.Equals(other.ValueType, StringComparison.Ordinal));
 }
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">An object to compare with this object.</param>
 /// <returns>
 /// <c>true</c> if the current object is equal to the other parameter; otherwise, <c>false</c>.
 /// </returns>
 public bool Equals(AttributeKey other)
 {
     return(other != null &&
            FriendlyName.Equals(other.FriendlyName) &&
            Name.Equals(other.Name) &&
            NameFormat.Equals(other.NameFormat) &&
            Namespace.Equals(other.Namespace) &&
            OriginalIssuer.Equals(other.OriginalIssuer) &&
            ValueType.Equals(other.ValueType));
 }
Exemplo n.º 8
0
        public override bool Equals(object obj)
        {
            var other = obj as CustomField;

            if (other == null)
            {
                return(false);
            }
            return(Namespace.Equals(other.Namespace) && Name.Equals(other.Name) && Event.Equals(other.Event));
        }
Exemplo n.º 9
0
        internal object Encode()
        {
            try
            {
                if (IsJson)
                {
                    StringBuilder Builder = new StringBuilder();

                    if (Type != SocketIOPacketType.UNKNOWN)
                    {
                        Builder.Append((int)Type);
                    }

                    if (Type == SocketIOPacketType.BINARY_EVENT || Type == SocketIOPacketType.BINARY_ACK)
                    {
                        Builder.Append(Attachments.Count);
                        Builder.Append('-');
                    }

                    if (!string.IsNullOrEmpty(Namespace) && !Namespace.Equals("/"))
                    {
                        Builder.Append(Namespace);
                        Builder.Append(',');
                    }

                    if (ID > -1)
                    {
                        Builder.Append(ID);
                    }

                    return(Builder.Append(JsonData?.ToString(Formatting.None) ?? string.Empty).ToString());
                }
                else
                {
                    if (Type != SocketIOPacketType.UNKNOWN)
                    {
                        List <byte> Buffer = new List <byte>()
                        {
                            (byte)Type
                        };
                        Buffer.AddRange(RawData);

                        return(Buffer.ToArray());
                    }
                    else
                    {
                        return(RawData);
                    }
                }
            }
            catch (Exception Exception)
            {
                throw new SocketIOException("Packet encoding failed. " + this, Exception);
            }
        }
Exemplo n.º 10
0
 public override bool Equals(object obj)
 {
     if (obj is PackageId)
     {
         PackageId id = (PackageId)obj;
         return(Owner.Equals(id.Owner) && Namespace.Equals(id.Namespace) && Name.Equals(id.Name));
     }
     else
     {
         return(false);
     }
 }
        /// <summary>
        /// Equals method comparing <see cref="Name"/>, <see cref="Namespace"/>, <see cref="Type"/> and <see cref="HashCode"/>.
        /// </summary>
        /// <param name="obj">Object to compare to.</param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (!(obj is FrameworkElementSmall))
            {
                return(false);
            }
            var comp = (FrameworkElementSmall)obj;

            if (!String.IsNullOrEmpty(Name))
            {
                if (!Name.Equals(comp.Name))
                {
                    return(false);
                }
            }
            else if (!String.IsNullOrEmpty(comp.Name))
            {
                return(false);
            }
            if (!String.IsNullOrEmpty(Namespace))
            {
                if (!Namespace.Equals(comp.Namespace))
                {
                    return(false);
                }
            }
            if (Type != null)
            {
                if (!Type.Equals(comp.Type))
                {
                    return(false);
                }
            }
            else if (comp.Type != null)
            {
                return(false);
            }
            if (HashCode != comp.HashCode)
            {
                return(false);
            }

            return(true);
        }
        public override bool Equals(object obj)
        {
            // If parameter is null return false.
            // ReSharper disable once RedundantNameQualifier
            if (object.Equals(obj, null))
            {
                return(false);
            }

            // If parameter cannot be cast to Point return false.
            var x = obj as EntityType;

            // ReSharper disable once RedundantNameQualifier
            if (object.Equals(x, null))
            {
                return(false);
            }

            // Return true if the fields match:
            return(Name.Equals(x.Name, StringComparison.OrdinalIgnoreCase) && (Namespace.Equals(x.Namespace, StringComparison.OrdinalIgnoreCase)));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Determines whether this instance of <see cref="TypeId" /> refers to the same type as <paramref name="other"/>.
        /// </summary>
        public virtual bool Equals(TypeId?other)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (other == null)
            {
                return(false);
            }

            if (IsNestedType)
            {
                return(DeclaringType !.Equals(other.DeclaringType) &&
                       StringComparer.Ordinal.Equals(Name, other.Name));
            }
            else
            {
                return(Namespace.Equals(other.Namespace) &&
                       StringComparer.Ordinal.Equals(Name, other.Name));
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Check the equivalence of this object and the argument object.
        /// </summary>
        /// <param name="obj">Target object.</param>
        /// <returns>It returns True if equivalent, False otherwise.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            var member        = (Member)obj;
            var boolcollector = new BoolCollector();

            boolcollector.ChangeBool("Accessibility", Accessibility == member.Accessibility);
            boolcollector.ChangeBool("Id", Id.Equals(member.Id));
            boolcollector.ChangeBool("Name", Name.Equals(member.Name));
            boolcollector.ChangeBool("Namespace", Namespace.Equals(member.Namespace));
            boolcollector.ChangeBool("Parameters", ParameterNames.SequenceEqual(member.ParameterNames));
            boolcollector.ChangeBool("ParameterTypes", ParameterTypes.SequenceEqual(member.ParameterTypes));
            boolcollector.ChangeBool("ReturnComment", ReturnComment.Equals(member.ReturnComment));
            boolcollector.ChangeBool("ReturnType", ReturnType.Equals(member.ReturnType));
            boolcollector.ChangeBool("Type", Type == member.Type);
            boolcollector.ChangeBool("Value", Value.Equals(member.Value));

            return(boolcollector.Value);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Returns true if Identifier instances are equal
        /// </summary>
        /// <param name="other">Instance of Identifier to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Identifier other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Namespace == other.Namespace ||
                     Namespace != null &&
                     Namespace.Equals(other.Namespace)
                     ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ));
        }
Exemplo n.º 16
0
 bool IEquatable <IAsyncStream <T> > .Equals(IAsyncStream <T> other)
 => ProviderName.Equals(other.ProviderName) &&
 Namespace.Equals(other.Namespace) &&
 Guid.Equals(other.Guid);
Exemplo n.º 17
0
 public bool Equals(Identifier other) => !ReferenceEquals(other, null) &&
 Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase) &&
 (Namespace == null && other.Namespace == null || Namespace.Equals(other.Namespace));