示例#1
0
        public static IResource [] ExtractResources(string fileName, string content)
        {
            var extractorType = AutoDetect.ResourceExtractorType(fileName);

            if (extractorType == null)
            {
                throw new ArgumentException(Format(UnknownResourceFileFormat, Path.GetFileName(fileName)), nameof(fileName));
            }

            return(ExtractResources(extractorType, new MemoryStream(Encoding.UTF8.GetBytes(content))));
        }
示例#2
0
        public static IResource [] ExtractResources(string fileName)
        {
            var extractorType = AutoDetect.ResourceExtractorType(fileName);

            if (extractorType == null)
            {
                throw new ArgumentException(Format(UnknownResourceFileFormat, Path.GetFileName(fileName)), nameof(fileName));
            }

            return(ExtractResources(extractorType, fileName));
        }
示例#3
0
        public void Save()
        {
            try
            {
                setConf("AutoDetectExeName", AutoDetectExeName);
                setConf("AutoStart", AutoStart.ToString());
                setConf("AutoDetect", AutoDetect.ToString());
                setConf("Culture", Culture.Name);
                setConf("IgnoredKeys", ConcatenateIntList(IgnoredKeys));

                conf.Save();
            }
            catch
            {
                throw;
            }
        }
示例#4
0
        public static void ConfigureFileBasedResourceManager(this ResourceTypeSettings settings, string baseName, string path, string resourceSetType = null)
        {
            resourceSetType = resourceSetType ?? AutoDetect.ResourceSetType(path).FullName;

            settings.ResourceNamingStrategy = ResourceNamingStrategy.Default;

            var pathFormat      = AutoDetect.PathFormat(path, out var neutralCultureName);
            var resourceManager = Code.Type <FileBasedResourceManager> ( );

            settings.ResourceManagerType        = resourceManager;
            settings.ResourceManagerInitializer = resourceManager.Construct(Code.Constant(baseName),
                                                                            Code.Constant(pathFormat),
                                                                            Code.Constant(neutralCultureName),
                                                                            Code.TypeOf(Code.Type(resourceSetType)));

            settings.LocalizerType        = Code.Type <ResourceManagerLocalizer> ( );
            settings.LocalizerInitializer = ConstructLocalizer(settings.ResourceNamingStrategyInitializer);
        }