示例#1
0
    public static ConverterRules NewFromString(string converterRulesString)
    {
        XmlSerializer  serializer = new XmlSerializer(typeof(ConverterRules));
        ConverterRules tt         = (ConverterRules)serializer.Deserialize(new MemoryStream(Encoding.UTF8.GetBytes(converterRulesString)));

        return(tt);
    }
        private ConverterRule ProcessClientRules(string AccountName)
        {
            ConverterRules cc = null;

            try {
                cc = ConverterRules.NewFromFile(RulesPath);
            } catch (Exception ex) {
                internalErrors.Add($"Could not load converter rules file, the error was, \"{ex.Message}\".");
                publicErrors.Add($"Could not get internal rules to convert the file.");
            }

            ConverterRule crr = cc.ConverterRule.Where(t => String.Equals(t.Name, AccountName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();

            return(crr);
        }
示例#3
0
 public void LoadConverterRules()
 {
     //simple test to see if we can load a known good converter rules file.
     ConverterRules cc = ConverterRules.NewFromFile("ConverterRules.xml");
 }