public static TypeDescriptionProvider AddAttributes(object instance, params Attribute[] attributes)
 {
     if (instance == null)
     {
         throw new ArgumentNullException("instance");
     }
     if (attributes == null)
     {
         throw new ArgumentNullException("attributes");
     }
     TypeDescriptionProvider provider = new AttributeProvider(GetProvider(instance), attributes);
     AddProvider(provider, instance);
     return provider;
 }
 public static TypeDescriptionProvider AddAttributes(Type type, params Attribute[] attributes)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (attributes == null)
     {
         throw new ArgumentNullException("attributes");
     }
     TypeDescriptionProvider provider = new AttributeProvider(GetProvider(type), attributes);
     AddProvider(provider, type);
     return provider;
 }
Exemple #3
0
        public EntityValidatorBuilder(AttributeProvider attributeProvider)
        {
            DebugCheck.NotNull(attributeProvider);

            _attributeProvider = attributeProvider;
        }
Exemple #4
0
        public AttributeMapper(AttributeProvider attributeProvider)
        {
            DebugCheck.NotNull(attributeProvider);

            _attributeProvider = attributeProvider;
        }
 /// <summary>
 ///     Initializes a new instance of <see cref="ValidationProvider" /> class.
 /// </summary>
 public ValidationProvider(EntityValidatorBuilder builder = null, AttributeProvider attributeProvider = null)
 {
     _entityValidators       = new Dictionary <Type, EntityValidator>();
     _entityValidatorBuilder = builder ?? new EntityValidatorBuilder(attributeProvider ?? new AttributeProvider());
 }
        private AttributeConfigurationConvention(AttributeProvider attributeProvider)
        {
            DebugCheck.NotNull(attributeProvider);

            _attributeProvider = attributeProvider;
        }
        public void Refresh()
        {
            if (Configuration == null || !Configuration.IsValid())
            {
                return;
            }

            if (Instance != null)
            {
                return;
            }

            Enabled  = true;
            _current = Thread.CurrentThread;
            CaptureUnityMessages();
            _reportLimitWatcher      = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin));
            _clientReportAttachments = Configuration.GetAttachmentPaths();

            BacktraceApi = new BacktraceApi(
                credentials: new BacktraceCredentials(Configuration.GetValidServerUrl()),

#if UNITY_2018_4_OR_NEWER
                ignoreSslValidation: Configuration.IgnoreSslValidation
#else
                ignoreSslValidation: false
#endif
                );
            BacktraceApi.EnablePerformanceStatistics = Configuration.PerformanceStatistics;

            if (!Configuration.DestroyOnLoad)
            {
                DontDestroyOnLoad(gameObject);
                _instance = this;
            }

#if !UNITY_WEBGL
            EnableMetrics(false);
#endif
            var nativeAttachments = _clientReportAttachments.ToList()
                                    .Where(n => !string.IsNullOrEmpty(n))
                                    .OrderBy(System.IO.Path.GetFileName, StringComparer.InvariantCultureIgnoreCase).ToList();

            if (Configuration.Enabled)
            {
                Database = GetComponent <BacktraceDatabase>();
                if (Database != null)
                {
                    Database.Reload();
                    Database.SetApi(BacktraceApi);
                    Database.SetReportWatcher(_reportLimitWatcher);
                    if (Database.Breadcrumbs != null)
                    {
                        nativeAttachments.Add(Database.Breadcrumbs.GetBreadcrumbLogPath());
                    }
                    _nativeClient = NativeClientFactory.CreateNativeClient(Configuration, name, AttributeProvider.GenerateAttributes(false), nativeAttachments);
                    Database.EnableBreadcrumbsSupport();
                }
            }

            AttributeProvider.AddDynamicAttributeProvider(_nativeClient);

            if (Configuration.SendUnhandledGameCrashesOnGameStartup && isActiveAndEnabled)
            {
                var nativeCrashUplaoder = new NativeCrashUploader(AttributeProvider, BacktraceApi);
                StartCoroutine(nativeCrashUplaoder.SendUnhandledGameCrashesOnGameStartup());
            }
        }
	public static TypeDescriptionProvider AddAttributes (object instance, params Attribute [] attributes)
	{
		if (instance == null)
			throw new ArgumentNullException ("instance");
		if (attributes == null)
			throw new ArgumentNullException ("attributes");

		var ret = new AttributeProvider (attributes, GetProvider (instance));
		AddProvider (ret, instance);

		return ret;
	}
Exemple #9
0
 internal InheritedCustomAttributeAccessor(AttributeProvider attributeProvider) : base(attributeProvider) => this.attributeProvider = attributeProvider;
Exemple #10
0
 internal CustomAttributeAccessor(AttributeProvider attributeProvider) => this.attributeProvider = attributeProvider;
 public void Setup()
 {
     _attributeProvider = new AttributeProvider();
     _defaultUniqueEventsSubmissionUrl = string.Format("{0}/unique-events/submit?token={1}&universe={2}", _defaultSubmissionUrl, _token, _universeName);
     _defaultSummedEventsSubmissionUrl = string.Format("{0}/summed-events/submit?token={1}&universe={2}", _defaultSubmissionUrl, _token, _universeName);
 }
Exemple #12
0
 public EntityValidatorBuilder(AttributeProvider attributeProvider)
 {
     this._attributeProvider = attributeProvider;
 }
        protected override string GetAnnotatedDescription()
        {
            ArgumentAttribute descriptionAttribute = AttributeProvider.GetCustomAttribute <ArgumentAttribute>();

            return(descriptionAttribute?.Description);
        }
 private void StartupMetrics()
 {
     AttributeProvider.AddScopedAttributeProvider(Metrics);
     _metrics.SendStartupEvent();
 }
Exemple #15
0
 public void Cleanup()
 {
     _attributeProvider = new AttributeProvider();
 }
Exemple #16
0
 public IEnumerable <Attribute> GetAttributes()
 {
     return(AttributeProvider.GetCustomAttributes(true).Cast <Attribute>());
 }
Exemple #17
0
 public TAttribute GetAttribute <TAttribute>() where TAttribute : Attribute
 {
     return(AttributeProvider.GetAttribute <TAttribute>());
 }
	public static TypeDescriptionProvider AddAttributes (Type type, params Attribute [] attributes)
	{
		if (type == null)
			throw new ArgumentNullException ("type");
		if (attributes == null)
			throw new ArgumentNullException ("attributes");

		var ret = new AttributeProvider (attributes, GetProvider (type));
		AddProvider (ret, type);
		
		return ret;
	}
Exemple #19
0
 public bool HasAttribute <TAttribute>() where TAttribute : Attribute
 {
     return(AttributeProvider.HasAttribute <TAttribute>());
 }
Exemple #20
0
        public static TypeDescriptionProvider AddAttributes(object instance, params Attribute[] attributes)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            if (attributes == null)
            {
                throw new ArgumentNullException(nameof(attributes));
            }

            TypeDescriptionProvider existingProvider = GetProvider(instance);
            TypeDescriptionProvider provider = new AttributeProvider(existingProvider, attributes);
            TypeDescriptor.AddProvider(provider, instance);
            return provider;
        }
 /// <summary>
 /// Number of client attributes
 /// </summary>
 public int GetAttributesCount()
 {
     return(AttributeProvider.Count());
 }