Exemplo n.º 1
0
 internal static RulesContainer LoadFromFile(string rulesFileName, string genderFileName)
 {
     JsonRulesLoader loader = new JsonRulesLoader();
     using (StreamReader reader = new StreamReader(rulesFileName))
     {
         loader.Load(reader);
     }
     using (StreamReader reader = new StreamReader(genderFileName))
     {
         loader.Load(reader);
     }
     return loader.m_data;
 }
        internal static RulesContainer LoadFromFile(string rulesFileName, string genderRulesFileName)
        {
            JsonRulesLoader loader;

            using (StreamReader reader = new StreamReader(rulesFileName))
            {
                loader = new JsonRulesLoader(reader);
            }
            using (StreamReader reader = new StreamReader(genderRulesFileName))
            {
                loader.LoadGenderRules(reader);
            }
            return(loader.m_data);
        }
Exemplo n.º 3
0
        internal static RulesContainer LoadEmbeddedResources()
        {
            Assembly assembly = Assembly.GetExecutingAssembly();

            JsonRulesLoader loader = new JsonRulesLoader();
            using (StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(RULES_RESOURCE_NAME)))
            {
                loader.Load(reader);
            }
            using (StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(GENDER_RESOURCE_NAME)))
            {
                loader.Load(reader);
            }
            return loader.m_data;
        }
        private static readonly int MODIFIERS_COUNT = Enum.GetValues(typeof(Case)).Length - 1; //Nominal case is not listed in the rules, therefore -1

        internal static RulesContainer LoadEmbeddedResources()
        {
            Assembly        assembly = typeof(RulesContainer).Assembly;
            JsonRulesLoader loader;

            using (StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(RULES_RESOURCE_NAME)))
            {
                loader = new JsonRulesLoader(reader);
            }

            using (StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(GENDER_RESOURCE_NAME)))
            {
                loader.LoadGenderRules(reader);
            }
            return(loader.m_data);
        }
Exemplo n.º 5
0
 public Petrovich(string rulesFileName, string genderRulesFileName)
 {
     m_rules = JsonRulesLoader.LoadFromFile(rulesFileName, genderRulesFileName);
 }
Exemplo n.º 6
0
 public Petrovich()
 {
     m_rules = JsonRulesLoader.LoadEmbeddedResources();
 }