Exemplo n.º 1
0
        public void ParseIndexWeight()
        {
            SEd         mysed = SEd.StartofDay;
            TimeSpan    ts    = new TimeSpan(0, 04, 10, 00, 000);
            string      data  = "Iw;i2550;s2;t041000.000;IDo1024;WPe0.224202;FFr0.44;Wf1;WFv341510400;CAp776160000;SEd1;";
            IndexWeight Iw    = new IndexWeight(data);

            Assert.AreEqual(2550, Iw.i);
            Assert.AreEqual(2, Iw.s);
            Assert.AreEqual(ts, Iw.t);
            Assert.AreEqual(1024, Iw.IDo);
            Assert.AreEqual(0.224202, Iw.WPe);
            Assert.AreEqual(0.44, Iw.FFr);
            Assert.AreEqual(1, Iw.Wf);
            Assert.AreEqual(341510400, Iw.WFv);
            Assert.AreEqual(776160000, Iw.CAp);
            Assert.AreEqual(mysed, Iw.Sed);
        }
Exemplo n.º 2
0
        public void ParseIndexSummary()
        {
            SEd          mysed = SEd.StartofDay;
            TimeSpan     ts    = new TimeSpan(0, 04, 10, 00, 000);
            string       data  = "Is;i2550;s2;t041000.000;o0;f0;ODXv78322.7848;IXDv1944808.183487;Dn0;Dd0;CAp152322792848.566803;SEd1;";
            IndexSummary Is    = new IndexSummary(data);

            Assert.AreEqual(2550, Is.i);
            Assert.AreEqual(2, Is.s);
            Assert.AreEqual(ts, Is.t);
            Assert.AreEqual(0, Is.o);
            Assert.AreEqual(0, Is.f);
            Assert.AreEqual(78322.7848, Is.ODXv);
            Assert.AreEqual(1944808.183487, Is.IXDv);
            Assert.AreEqual(0, Is.Dn);
            Assert.AreEqual(0, Is.Dd);
            Assert.AreEqual(152322792848.566803, Is.CAp);
            Assert.AreEqual(mysed, Is.Sed);
        }
Exemplo n.º 3
0
 public IndexWeight(string name)
 {
     string[] words = name.Split(';');
     foreach (string word in words)
     {
         foreach (string check in checks)
         {
             if (word.StartsWith(checks[0]))
             {
                 i = Int32.Parse(word.Substring(1, word.Length - 1));
             }
             else if (word.StartsWith(checks[1]))
             {
                 s = Int32.Parse(word.Substring(1, word.Length - 1));
             }
             else if (word.StartsWith(checks[2]))
             {
                 t = TimeSpan.ParseExact(word.Substring(1, word.Length - 1), "hhmmss\\.fff", CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[3]))
             {
                 IDo = Int32.Parse(word.Substring(3, word.Length - 3));
             }
             else if (word.StartsWith(checks[4]))
             {
                 WPe = decimal.Parse(word.Substring(3, word.Length - 3), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[5]))
             {
                 FFr = decimal.Parse(word.Substring(3, word.Length - 3), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[6]))
             {
                 Wf = decimal.Parse(word.Substring(2, word.Length - 2), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[7]))
             {
                 WFv = decimal.Parse(word.Substring(3, word.Length - 3), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[8]))
             {
                 CAp = decimal.Parse(word.Substring(3, word.Length - 3), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[9]))
             {
                 if (word.Substring(3, word.Length - 3) == "1")
                 {
                     Sed = SEd.StartofDay;
                 }
                 else if (word.Substring(3, word.Length - 3) == "2")
                 {
                     Sed = SEd.EndofDay;
                 }
                 else
                 {
                     Sed = SEd.None;
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 public IndexSummary(string name)
 {
     string[] words = name.Split(';');
     foreach (string word in words)
     {
         foreach (string check in checks)
         {
             if (word.StartsWith(checks[0]))
             {
                 i = Int32.Parse(word.Substring(1, word.Length - 1));
             }
             else if (word.StartsWith(checks[1]))
             {
                 s = Int32.Parse(word.Substring(1, word.Length - 1));
             }
             else if (word.StartsWith(checks[2]))
             {
                 t = TimeSpan.ParseExact(word.Substring(1, word.Length - 1), "hhmmss\\.fff", CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[3]))
             {
                 CLv = decimal.Parse(word.Substring(3, word.Length - 3), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[4]))
             {
                 Vh = decimal.Parse(word.Substring(2, word.Length - 2), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[5]))
             {
                 Vl = decimal.Parse(word.Substring(2, word.Length - 2), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[6]))
             {
                 o = decimal.Parse(word.Substring(1, word.Length - 1), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[7]))
             {
                 f = decimal.Parse(word.Substring(1, word.Length - 1), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[8]))
             {
                 OVa = decimal.Parse(word.Substring(3, word.Length - 3), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[9]))
             {
                 ODXv = decimal.Parse(word.Substring(4, word.Length - 4), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[10]))
             {
                 IXDv = decimal.Parse(word.Substring(4, word.Length - 4), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[11]))
             {
                 Dn = decimal.Parse(word.Substring(2, word.Length - 2), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[12]))
             {
                 Dd = decimal.Parse(word.Substring(2, word.Length - 2), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[13]))
             {
                 CAp = decimal.Parse(word.Substring(3, word.Length - 3), CultureInfo.InvariantCulture);
             }
             else if (word.StartsWith(checks[14]))
             {
                 if (word.Substring(3, word.Length - 3) == "1")
                 {
                     Sed = SEd.StartofDay;
                 }
                 else if (word.Substring(3, word.Length - 3) == "2")
                 {
                     Sed = SEd.EndofDay;
                 }
                 else
                 {
                     Sed = SEd.None;
                 }
             }
         }
     }
 }