Example #1
0
 public bool Equals(WorldMetadata other)
 {
     if (ReferenceEquals(other, null))
     {
         return(false);
     }
     if (ReferenceEquals(other, this))
     {
         return(true);
     }
     if (!object.Equals(EnvironmentMetadata, other.EnvironmentMetadata))
     {
         return(false);
     }
     if (!LifeFormMetadata.Equals(other.LifeFormMetadata))
     {
         return(false);
     }
     if (Name != other.Name)
     {
         return(false);
     }
     if (Age != other.Age)
     {
         return(false);
     }
     return(Equals(_unknownFields, other._unknownFields));
 }
Example #2
0
        /// <summary>
        /// Инициализирует метаданные из их прототипа.
        /// </summary>
        /// <param name="protoMetadata">Прототип googleProtobuff</param>
        public LifeFormMetadata(Protobuff.Metadata.LifeFormMetadata protoMetadata)
        {
            Place = new Place(protoMetadata.Place);
            Id    = protoMetadata.Id;

            foreach (var state in protoMetadata.StatesMetadata)
            {
                this.Add(state.Name, new StateMetadata(state));
            }
        }
 /// <summary>
 /// Инициализирует метаданные из их прототипа.
 /// </summary>
 /// <param name="protoMetadata">Прототип googleProtobuff</param>
 public LifeFormMetadata(Protobuff.Metadata.LifeFormMetadata protoMetadata)
 {
     log.Trace(LogMetadataMessages.MetadataFromProtobuff, "LifeFormMetadata");
     Place = new Place(protoMetadata.Place);
     Id    = protoMetadata.Id;
     log.Info(protoMetadata.StatesMetadata.Count + " дополнительных параметров содержит данный экземпляр");
     foreach (var state in protoMetadata.StatesMetadata)
     {
         this.Add(state.Name, new StateMetadata(state));
     }
     log.Trace(LogMetadataMessages.OkMetadataFromProtobuff);
 }
Example #4
0
        /// <summary>
        /// Получает прототип метаданных формы жизни
        /// </summary>
        /// <returns>Прототип googleProtobuf</returns>
        public Protobuff.Metadata.LifeFormMetadata GetProtoMetadata()
        {
            Protobuff.Metadata.LifeFormMetadata ret = new Protobuff.Metadata.LifeFormMetadata();

            ret.Id    = Id;
            ret.Place = Place.GetProtoPlace();

            foreach (var state in this.Values)
            {
                ret.StatesMetadata.Add(state.GetProtoMetadata());
            }


            return(ret);
        }
        /// <summary>
        /// Получает прототип метаданных формы жизни
        /// </summary>
        /// <returns>Прототип googleProtobuf</returns>
        public Protobuff.Metadata.LifeFormMetadata GetProtoMetadata()
        {
            log.Trace(LogMetadataMessages.ProtobuffFromMetadata, "LifeFormMetadata");
            Protobuff.Metadata.LifeFormMetadata ret = new Protobuff.Metadata.LifeFormMetadata();

            ret.Id    = Id;
            ret.Place = Place.GetProtoPlace();
            log.Info(this.Values.Count + " дополнительных параметров содержит данный экземпляр");
            foreach (var state in this.Values)
            {
                ret.StatesMetadata.Add(state.GetProtoMetadata());
            }

            log.Trace(LogMetadataMessages.OkProtobuffFromMetadata);
            return(ret);
        }
Example #6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (environmentMetadata_ != null)
            {
                hash ^= EnvironmentMetadata.GetHashCode();
            }
            hash ^= LifeFormMetadata.GetHashCode();
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Age != 0)
            {
                hash ^= Age.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }