示例#1
0
 private void PriceFileOpen(string priceFilePath)
 {
     int lineNumber;
     string[] buffer = new string[100];
     using (StreamReader sr = new StreamReader(priceFilePath))
     {
         String line;
         lineNumber = 0;
         while ((line = sr.ReadLine()) != null)
         {
             buffer[lineNumber++] = line;
         }
         lineNumber -= 1;
         for (int i = 1; i <= lineNumber; i++)
         {
             price[i] = new Price();
             price[i].buffer = buffer[i].Split(new char[] { ';' });
             price[i].DataAssign();
         }
     }
 } 
示例#2
0
文件: Form1.cs 项目: juyingnan/VS
 private string PriceGet(string p)
 {
     Price[] price = new Price[57];
     int lineNumber;
     string[] buffer = new string[100];
     using (StreamReader sr = new StreamReader(Application.StartupPath + "\\price" + CurrencySelectionBox.SelectedItem.ToString() + ".dat"))  /////
     {
         String line;
         lineNumber = 0;
         while ((line = sr.ReadLine()) != null)
         {
             buffer[lineNumber++] = line;
         }
         lineNumber -= 1;
         for (int i = 1; i <= lineNumber; i++)
         {
             price[i] = new Price();
             price[i].buffer = buffer[i].Split(new char[] { ';' });
             price[i].DataAssign();
         }
     }
     for (int i = 1; i <= 56; i++)
     {
         String pTemp = price[i].type + " " + price[i].height + " * " + price[i].width;
         if (pTemp.ToString() == p)
         {
             return price[i].price.ToString();
         }
     }
     return "0";
 }