예제 #1
0
        /// <summary>
        ///     Load localization texts from and embedded json file
        /// </summary>
        /// <param name="assembly"></param>
        /// <param name="resourceId"></param>
        /// <param name="caseSensitivity">Case sensitivity when searching for property names</param>
        /// <param name="jsonMaxDepth">
        ///     <see cref="JsonDocumentOptions.MaxDepth" />
        /// </param>
        public JsonLocalizationSource(Assembly assembly, string resourceId, PropertyCaseSensitivity caseSensitivity,
                                      int jsonMaxDepth = 128)
        {
            this.caseSensitivity = caseSensitivity;
            var em   = new EmbdRes(assembly);
            var json = em.ReadAsString(resourceId);

            root = ToRootElement(json, jsonMaxDepth);
        }
        /// <summary>
        /// Load localization texts from and embedded json file
        /// </summary>
        /// <param name="assembly"></param>
        /// <param name="resourceId"></param>
        public LocalizationSource(Assembly assembly, string resourceId)
        {
            var em = new EmbdRes(assembly);

            root = JObject.Parse(em.ReadAsString(resourceId));
        }