예제 #1
0
        private void Initialize(string format, string formatParameters)
        {
            string str1 = SampleDataFormatHelper.NormalizeFormat(this.SampleType, format, false);

            if (str1 != this.Format)
            {
                this.SetConfigurationValue(ConfigurationPlaceholder.StringFormat, (object)str1);
            }
            string str2 = SampleDataFormatHelper.NormalizeFormatParameters(this.SampleType, formatParameters, false);

            if (str2 == this.FormatParameters || string.IsNullOrEmpty(str2))
            {
                return;
            }
            string[] strArray = str2.Split(',');
            if (strArray.Length != 2)
            {
                return;
            }
            string s1 = strArray[0];
            string s2 = strArray[1];
            int    result1;

            if (int.TryParse(s1, out result1))
            {
                this.SetConfigurationValue(ConfigurationPlaceholder.RandomLatinWordCount, (object)result1);
            }
            int result2;

            if (int.TryParse(s2, out result2))
            {
                this.SetConfigurationValue(ConfigurationPlaceholder.RandomLatinWordLength, (object)result2);
            }
            this.formatParameters = str2;
        }
예제 #2
0
 public SampleNumberConfiguration(string formatParameters)
 {
     if (int.TryParse(SampleDataFormatHelper.NormalizeFormatParameters(this.SampleType, formatParameters, false), NumberStyles.Any, (IFormatProvider)CultureInfo.InvariantCulture, out this.numberLength))
     {
         return;
     }
     this.numberLength = Convert.ToInt32(ConfigurationPlaceholder.NumberLength.DefaultValue, (IFormatProvider)CultureInfo.InvariantCulture);
 }