public override int GetHashCode()
        {
            unchecked
            {
                var hash = 17;

                hash = hash * 23 + Fields.GetHashCode();
                hash = hash * 23 + Properties.GetHashCode();
                hash = hash * 23 + Methods.GetHashCode();
                hash = hash * 23 + Constructors.GetHashCode();
                hash = hash * 23 + Gettable.GetHashCode();
                hash = hash * 23 + Settable.GetHashCode();
                hash = hash * 23 + Indexers.GetHashCode();
                hash = hash * 23 + Events.GetHashCode();

                hash = hash * 23 + Inherited.GetHashCode();
                hash = hash * 23 + Targeted.GetHashCode();
                hash = hash * 23 + NonTargeted.GetHashCode();
                hash = hash * 23 + Public.GetHashCode();
                hash = hash * 23 + NonPublic.GetHashCode();
                hash = hash * 23 + ReadOnly.GetHashCode();
                hash = hash * 23 + WriteOnly.GetHashCode();
                hash = hash * 23 + Extensions.GetHashCode();
                hash = hash * 23 + Operators.GetHashCode();
                hash = hash * 23 + Conversions.GetHashCode();
                hash = hash * 23 + Parameters.GetHashCode();
                hash = hash * 23 + Obsolete.GetHashCode();
                hash = hash * 23 + OpenConstructedGeneric.GetHashCode();
                hash = hash * 23 + TypeInitializers.GetHashCode();

                return(hash);
            }
        }
        public Api()
        {
            try
            {
                Log.Debug("Api constructor called.");
#if DEBUG
                Log.Warning("ScriptingMod is compiled in DEBUG mode! This can hurt server performance significantly and will fill the logfile with useless information fast.");
#endif
                Log.Out("Initializing phase 1/3 ...");
                NonPublic.Init();
                PersistentData.Load();
                LitJsonTypeBindings.Register();
            }
            catch (Exception ex)
            {
                CommandTools.HandleEventException(ex, true);
                throw;
            }
        }
Exemple #3
0
        public Media(dynamic input)
        {
            try
            {
                OriginalObject = input;

                Enum.TryParse(input.type, true, out MediaType mediaType);

                MediaKey = input.media_key;
                Type     = mediaType;
                Height   = input.height;
                Width    = input.width;
                if (Helpers.HasProperty(input, "duration_ms"))
                {
                    Duration = input.duration_ms;
                }
                if (Helpers.HasProperty(input, "preview_image_url"))
                {
                    PreviewImageUrl = new Uri(input.preview_image_url);
                }

                if (Helpers.HasProperty(input, "non_public_metrics"))
                {
                    NonPublicMetrics = new NonPublic(input.non_public_metrics);
                }
                if (Helpers.HasProperty(input, "organic_metrics"))
                {
                    OrganicMetrics = new Organic(input.organic_metrics);
                }
                if (Helpers.HasProperty(input, "promoted_metrics"))
                {
                    PromotedMetrics = new Promoted(input.promoted_metrics);
                }
            }
            catch {
                // any missing properties that are not on the input object
                // and not caught with Helpers.HasProperty if statement,
                // do not fail (for now)
            }
        }
Exemple #4
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 17;

                hash = hash * 23 + Matching.GetHashCode();

                foreach (var type in types)
                {
                    if (type != null)
                    {
                        hash = hash * 23 + type.GetHashCode();
                    }
                }

                hash = hash * 23 + Value.GetHashCode();
                hash = hash * 23 + Reference.GetHashCode();
                hash = hash * 23 + Classes.GetHashCode();
                hash = hash * 23 + Interfaces.GetHashCode();
                hash = hash * 23 + Structs.GetHashCode();
                hash = hash * 23 + Enums.GetHashCode();
                hash = hash * 23 + Delegates.GetHashCode();
                hash = hash * 23 + Public.GetHashCode();
                hash = hash * 23 + NonPublic.GetHashCode();
                hash = hash * 23 + Abstract.GetHashCode();
                hash = hash * 23 + Generic.GetHashCode();
                hash = hash * 23 + OpenConstructedGeneric.GetHashCode();
                hash = hash * 23 + Static.GetHashCode();
                hash = hash * 23 + Sealed.GetHashCode();
                hash = hash * 23 + Nested.GetHashCode();
                hash = hash * 23 + Primitives.GetHashCode();
                hash = hash * 23 + Object.GetHashCode();
                hash = hash * 23 + NonSerializable.GetHashCode();
                hash = hash * 23 + Obsolete.GetHashCode();
                hash = hash * 23 + GenericParameterAttributeFlags.GetHashCode();

                return(hash);
            }
        }
Exemple #5
0
        public Tweet(dynamic input)
        {
            try
            {
                OriginalObject = input;

                Id                = input.id;
                Text              = input.text;
                AuthorId          = input.author_id;
                ConversationId    = input.conversation_id;
                CreatedAt         = input.created_at;
                Entities          = BaseEntity.GetEntities(input.entities);
                InReplyToUserId   = input.in_reply_to_user_id;
                Language          = input.lang;
                PossiblySensitive = input.possibly_sensitive;
                PublicMetrics     = new Metrics.Public(input.public_metrics);
                Source            = input.source;

                if (Helpers.HasProperty(input, "attachments"))
                {
                    Attachments = new Attachments(input.attachments);
                }

                if (Helpers.HasProperty(input, "geo"))
                {
                    Geo            = input.geo;
                    OriginalObject = input;
                }

                if (Helpers.HasProperty(input, "reply_settings"))
                {
                    ReplySettings = Helpers.ToTitleCase(input.reply_settings);
                }

                if (Helpers.HasProperty(input, "withheld"))
                {
                    Withheld = new WithheldContent(input.withheld);
                }

                if (Helpers.HasProperty(input, "referenced_tweets"))
                {
                    List <ReferencedTweet> referencedTweets = new List <ReferencedTweet>();
                    foreach (dynamic refTweet in input.referenced_tweets)
                    {
                        referencedTweets.Add(new ReferencedTweet(refTweet));
                    }
                    ReferencedTweets = referencedTweets;
                }

                if (Helpers.HasProperty(input, "context_annotations"))
                {
                    List <Context.ContextAnnotation> contextAnnotations = new List <Context.ContextAnnotation>();
                }

                if (Helpers.HasProperty(input, "non_public_metrics"))
                {
                    NonPublicMetrics = new NonPublic(input.non_public_metrics);
                }
                if (Helpers.HasProperty(input, "organic_metrics"))
                {
                    OrganicMetrics = new Organic(input.organic_metrics);
                }
                if (Helpers.HasProperty(input, "promoted_metrics"))
                {
                    PromotedMetrics = new Promoted(input.promoted_metrics);
                }
            }
            catch
            {
                // any missing properties that are not on the input object
                // and not caught with Helpers.HasProperty if statement,
                // do not fail (for now)
            }
        }