Exemple #1
0
        private Queue <Command> lex_stream(System.IO.TextReader sr)
        {
            var     res  = new Queue <Command>();
            Command c    = null; //new Command(); // Dummy
            var     line = sr.ReadLine();

            while (line != null)
            {
                if (line.StartsWith("**"))
                {
                    //comment
                }
                else
                {
                    if (line.StartsWith("*"))
                    {
                        var kv = parse_keyword(line);
                        c            = new Command(kv.Key);
                        c.parameters = kv.Value;
                        res.Enqueue(c);
                    }
                    else
                    {
                        c.datablock.Add(line);
                    }
                }
                line = sr.ReadLine();
            }
            return(res);
        }
Exemple #2
0
 public BaselineActivity(System.IO.TextReader Input_S)
 {
     Priv_KEY     = Input_S.ReadLine();
     Priv_ETH     = Input_S.ReadLine();
     Priv_IP      = Input_S.ReadLine();
     Priv_TCP_UDP = Input_S.ReadLine();
 }
Exemple #3
0
        public static List <StockInfo> ParseData(System.IO.TextReader file, String symbol)
        {
            // Yoink header info and validate.
            String header = file.ReadLine();

            String[] headerPieces = header.Split(',');
            if (headerPieces.Length < 5)
            {
                return(null);
            }

            // Process file contents.
            String           line      = String.Empty;
            List <StockInfo> stockInfo = new List <StockInfo>();

            while (line != null)
            {
                line = file.ReadLine();
                if (line != null)
                {
                    StockInfo info = StockData.StockInfo.ParseLine(line, symbol);
                    // We can get nulls back if the data is invalid, or if the volume is
                    // zero.  Google posts prices on non-trading days with a volume of
                    // zero and this is data we can safely discard.
                    if (info != null)
                    {
                        stockInfo.Add(info);
                    }
                }
            }
            file.Close();
            return(stockInfo);
        }
Exemple #4
0
        public Terrain(Stage theStage, string label, string terrainDataFile)
            : base(theStage, label)
        {
            constructorInit();      // common constructor initialization code, base call sets "stage"
            // read vertex data from "terrain.dat" file
            System.IO.TextReader file = System.IO.File.OpenText(terrainDataFile);
            file.ReadLine(); // skip the first description line x y z r g b
            int    i = 0;    // index for vertex[]
            string line;

            string[] token;
            for (int z = 0; z < height; z++)
            {
                for (int x = 0; x < width; x++)
                {
                    line  = file.ReadLine();
                    token = line.Split(' ');
                    terrainHeight[x, z] = int.Parse(token[1]) * multiplier;                                             // Y
                    vertex[i]           = new VertexPositionColor(
                        new Vector3(int.Parse(token[0]) * spacing, terrainHeight[x, z], int.Parse(token[2]) * spacing), // position
                        new Color(int.Parse(token[3]), int.Parse(token[4]), int.Parse(token[5])));                      // material
                    i++;
                }
            }
            file.Close();
            makeIndicesSetData();
        }
        public static CSVData Parse(System.IO.TextReader reader, bool hasHeaders)
        {
            int line = 0;

            string[]       headers  = null;
            List <CSVItem> all      = new List <CSVItem>();
            string         linedata = reader.ReadLine();

            while (null != linedata)
            {
                CSVItem item = ParseItem(linedata);
                if (null != item)
                {
                    if (hasHeaders && line == 0)
                    {
                        headers = item.ToArray();
                    }
                    else
                    {
                        all.Add(item);
                    }
                }
                line++;
                linedata = reader.ReadLine();
            }
            CSVData csv = new CSVData();

            csv.Headings = headers;
            csv.Items    = all.ToArray();

            return(csv);
        }
Exemple #6
0
        internal virtual System.IO.TextReader LoadImageMatrix(System.IO.TextReader tr)
        {
            string[] line;
            line = tr.ReadLine().Split();
            if (Convert.ToInt32(line[0]) != _width || Convert.ToInt32(line[1]) != _height)
            {
                Console.Error.WriteLine("Could not load file, height or width does not match");
                return(tr);
            }

            //Get the image matrix
            int    r, c;
            string l;

            for (r = 0; r < _height; ++r)
            {
                l = tr.ReadLine();
                if (l == null)
                {
                    break;
                }
                line = l.Split();

                for (c = 0; c < _width; ++c)
                {
                    matrix[r, c] = Convert.ToDouble(line[c]);
                }
            }
            _cached_distances = null;
            return(tr);
        }
Exemple #7
0
        /// <summary>
        /// The load method to parse the file format. This will throw a format
        /// exception if it fails.
        /// </summary>
        /// <param name="Stream">The stream to parse from.</param>
        /// <returns>The grid world.</returns>
        public override void Load(System.IO.TextReader Stream,
                                  out GenericGridWorldStaticState StaticState,
                                  out GenericGridWorldDynamicState DynamicState)
        {
            // First and Second lines of input are grid dimensions. @see Input 1.
            int columns = int.Parse(Stream.ReadLine( ));
            int rows    = int.Parse(Stream.ReadLine( ));

            DynamicState = new GenericGridWorldDynamicState( );
            StaticState  = new GenericGridWorldStaticState(rows, columns,
                                                           DynamicState);

            // Grid Next in input @see Input 2.
            String line = null;

            List <Unit> Units = new List <Unit>( );
            int         i     = 0;

            while ((line = Stream.ReadLine( ).Trim( )) != null &&
                   !line.Equals("--- end units ---"))
            {
                String[] split = line.Split( );
                int      x     = int.Parse(split[0]);
                int      y     = int.Parse(split[1]);
                int      dstX  = int.Parse(split[2]);
                int      dstY  = int.Parse(split[3]);
                // ignore split[4] which is LOS.
                Units.Add(new Unit(x, y, rows, columns, dstX, dstY, LOS, i++));
            }

            GridWorldFormat.FromTileStream(Stream, StaticState, DynamicState, Units);
        }
Exemple #8
0
        public FOVX()
        {
            SessionControl openSession = new SessionControl();

            fovdir   = openSession.FOVIDataFolder;
            fovfile  = fovdir + "\\My Equipment.txt";
            fovXfile = fovdir + "\\My Equipment.xml";
            System.IO.TextReader fovDataFile = System.IO.File.OpenText(fovfile);
            //create xml object
            xFovList = new XElement("FieldOfViewIndicators");

            string fovline = fovDataFile.ReadLine();

            //skip past all field definition lines for now, maybe forever
            while (fovline != null)
            {
                if ((fovline.Contains("[F]")) && (fovline[0] != ';'))
                {
                    XElement xfovI = new XElement(FOVIndicatorXName);
                    string[] splitline;
                    int      fElementCount;

                    splitline     = fovline.Split('|');
                    fElementCount = (splitline.Length - headerLength) / elementLength;
                    xfovI.Add(new XElement(ActiveFieldXName, splitline[1]));
                    xfovI.Add(new XElement(ReferenceFrameFieldXName, splitline[2]));
                    xfovI.Add(new XElement(Description1FieldXName, splitline[3]));
                    xfovI.Add(new XElement(PositionAngleFieldXName, splitline[4]));
                    xfovI.Add(new XElement(OffsetXFieldXName, splitline[5]));
                    xfovI.Add(new XElement(OffsetYFieldXName, splitline[6]));
                    xfovI.Add(new XElement(ScaleFieldXName, splitline[7]));
                    xfovI.Add(new XElement(EnabledFieldXName, splitline[8]));
                    xfovI.Add(new XElement(Description2FieldXName, splitline[9]));
                    xfovI.Add(new XElement(UnitsFieldXName, splitline[10]));

                    for (int elm = 0; elm < fElementCount; elm++)
                    {
                        int      splitIndx = elementLength * elm + headerLength;
                        XElement xelm      = new XElement(FOVElementXName);
                        xelm.Add(new XElement(ShapeFieldXName, splitline[splitIndx + 0]));
                        xelm.Add(new XElement(ElementDescriptionFieldXName, splitline[splitIndx + 1]));
                        xelm.Add(new XElement(SizeXFieldXName, splitline[splitIndx + 2]));
                        xelm.Add(new XElement(SizeYFieldXName, splitline[splitIndx + 3]));
                        xelm.Add(new XElement(PixelsXFieldXName, splitline[splitIndx + 4]));
                        xelm.Add(new XElement(PixelsYFieldXName, splitline[splitIndx + 5]));
                        xelm.Add(new XElement(CenterOffsetXFieldXName, splitline[splitIndx + 6]));
                        xelm.Add(new XElement(CenterOffsetYFieldXName, splitline[splitIndx + 7]));
                        //xelm.Add(new XElement(Field_19, splitline(splitIndx + 8)));
                        //xelm.Add(new XElement(Field_20, splitline(splitIndx + 9)));
                        xelm.Add(new XElement(FOVElementNumberXName, elm.ToString()));
                        xfovI.Add(xelm);
                    }
                    xFovList.Add(xfovI);
                }
                fovline = fovDataFile.ReadLine();
            }
            xFovList.Save(fovXfile);
            fovDataFile.Close();
        }
Exemple #9
0
        string[] kelimeler = new String[203];//istenilen formata uygun olması icin
        private void button1_Click(object sender, EventArgs e)
        {
            //dosya secme
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter = "Metin dosyaları|*.txt|" + "Bütün dosyalar|*.*";
            openFileDialog1.Title  = "Açılacak dosyayı seçiniz";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string dosya_adi;
                dosya_adi = openFileDialog1.FileName;
                System.IO.TextReader dosya = System.IO.File.OpenText(dosya_adi);
                string x;
                x = dosya.ReadLine();
                //satır satır okuma islemi
                while (x != null)
                {
                    x = x.ToLower();                 // kelimeyi kucuk harfe cevirdim
                    char[] ayir   = x.ToCharArray(); //kelimeyi harflere ayirdim
                    int    toplam = 0;
                    //agirlik hesabi
                    for (int i = 0; i < ayir.Length; i++)
                    {
                        toplam += (int)ayir[i] * (i + 1) * (i + 1);//harfin ascıı karsiligi ile indisinin karesini carptim
                    }
                    int agirlik = toplam;
                    toplam = toplam % 203;
                    if (dizi[toplam] <= 0)//o indisdeki deger bos mu diye baktim.Bos ise;
                    {
                        dizi[toplam]      = agirlik;
                        kelimeler[toplam] = x;
                    }
                    else//bos degil ise ;
                    {
                        int i       = 0;
                        int toplam1 = toplam;
                        while (dizi[toplam1] > 0)
                        {
                            toplam1 = ((i * i) + toplam) % 203;
                            i++;
                        }
                        dizi[toplam1]      = agirlik;
                        kelimeler[toplam1] = x;
                    }


                    x = dosya.ReadLine();
                }
                dosya.Close();

                int j = 0;
                //listboxa yazdirdim
                foreach (var item in dizi)
                {
                    listBox1.Items.Add(j + "  -  " + item + "  -  " + kelimeler[j]);
                    j++;
                }
            }
        }
Exemple #10
0
        public CustomerAccount(System.IO.TextReader textIn)
        {
            accountNumber = textIn.ReadLine();
            name          = textIn.ReadLine();
            string balanceText = textIn.ReadLine();

            balance = decimal.Parse(balanceText);
        }
Exemple #11
0
        /// <summary>
        /// The load method to parse the file format. This will throw a format
        /// exception if it fails.
        /// </summary>
        /// <param name="Stream">The stream to parse from.</param>
        /// <returns>The grid world.</returns>
        public override void Load(System.IO.TextReader Stream,
                                  out GenericGridWorldStaticState StaticState,
                                  out GenericGridWorldDynamicState DynamicState)
        {
            String type = Stream.ReadLine( ).Split( )[1];

            System.Console.WriteLine("Got HOG File Type " + type);
            int rows    = int.Parse(Stream.ReadLine( ).Split( )[1]);
            int columns = int.Parse(Stream.ReadLine( ).Split( )[1]);

            Stream.ReadLine( );

            DynamicState = new GenericGridWorldDynamicState( );
            StaticState  = new GenericGridWorldStaticState(rows, columns,
                                                           DynamicState);

            // Grid Next in input @see Input 2.
            String line = null;

            DynamicState.AddWorldObject(new Unit(xS, yS, rows, columns, xD, yD,
                                                 LOS, 0));

            for (int y = 0; rows > y &&
                 (line = Stream.ReadLine( )) != null; y++)
            {
                if (line.Length != columns)
                {
                    System.Console.WriteLine(line.Length);
                    System.Console.WriteLine(line);
                    throw new FormatException(
                              "Stream Load Failed, Invalid Grid Format");
                }
                int x = 0;
                foreach (char c in line)
                {
                    switch (c)
                    {
                    case ' ':
                    case '@':
                    case 'O':
                    case 'S':
                    case 'W':
                    case 'T':
                        StaticState.Tiles[y][x] =
                            new BlockedTile <GenericGridWorldStaticState,
                                             GenericGridWorldDynamicState>(x, y, rows, columns);
                        break;

                    default:
                        StaticState.Tiles[y][x] =
                            new PassableTile <GenericGridWorldStaticState,
                                              GenericGridWorldDynamicState>(x, y, rows, columns);
                        break;
                    }
                    x++;
                }
            }
        }
Exemple #12
0
        public async System.Threading.Tasks.Task InputLoop()
        {
            string input = null;

            while (!nameof(Commands.Quit).Equals(input, StringComparison.OrdinalIgnoreCase))
            {
                txtOut.WriteLine("Syntax: Origin-Destination outDate [inDate]");
                txtOut.Write(">>");
                input = txtIn.ReadLine();
                await Run(input);
            }
        }
Exemple #13
0
        public static bool Is2005(string path)
        {
            System.IO.TextReader reader = System.IO.File.OpenText(path);
            string line = reader.ReadLine();

            while (line.Length == 0)
            {
                reader.ReadLine();
            }
            reader.Close();
            return(line.Trim().Equals("Microsoft Visual Studio Solution File, Format Version 9.00"));
        }
Exemple #14
0
 public string Read()
 {
     if (inputStream.Count != 0)
     {
         return(inputStream.Dequeue());
     }
     string[] tmp = _stream.ReadLine().Split(separator);
     for (int i = 0; i < tmp.Length; ++i)
     {
         inputStream.Enqueue(tmp[i]);
     }
     return(inputStream.Dequeue());
 }
        ///<summary>
        ///reads the number of Customers and loops for each artist reading them in and then adding it to the list of artists
        ///</summary>
        public void CustomerLoad(System.IO.TextReader textIn)
        {
            textIn.ReadLine();
            int NumberofCustomers = int.Parse(textIn.ReadLine());

            for (int i = 0; i < NumberofCustomers; i++)
            {
                string customerName = textIn.ReadLine();
                int    customerID   = int.Parse(textIn.ReadLine());

                AddCustomer(customerName);
            }
        }
        ///<summary>
        ///reads the number of artists and loops for each artist reading them in and then adding it to the list of artists
        ///</summary>
        public void PurchasesLoad(System.IO.TextReader textIn)
        {
            textIn.ReadLine();
            int NumberofPurchases = int.Parse(textIn.ReadLine());

            for (int i = 0; i < NumberofPurchases; i++)
            {
                int    customerID   = int.Parse(textIn.ReadLine());
                string purchaseDate = textIn.ReadLine();
                int    purchaseID   = int.Parse(textIn.ReadLine());

                AddPurchase(customerID, purchaseID, purchaseDate);
            }
        }
        ///<summary>
        ///reads the number of artists and loops for each artist reading them in and then adding it to the list of artists
        ///</summary>
        public void ArtistLoad(System.IO.TextReader textIn)
        {
            textIn.ReadLine();
            int NumberofArtists = int.Parse(textIn.ReadLine());

            for (int i = 0; i < NumberofArtists; i++)
            {
                string artistName    = textIn.ReadLine();
                string artistAddress = textIn.ReadLine();
                int    ArtistID      = int.Parse(textIn.ReadLine());

                AddArtist(artistName, artistAddress);
            }
        }
Exemple #18
0
        private async void Load_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new OpenFileDialog()
            {
                Filter = "Model Files (*.model)|*.model|All Files (*.*)|*.*"
            };

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            /// Clear everything befor upload
            this.Clear(true, true);

            using (System.IO.TextReader reader = System.IO.File.OpenText(dialog.FileName))
            {
                var line = reader.ReadLine();
                while (!string.IsNullOrEmpty(line))
                {
                    var parts = line.Split(';');

                    var color = Color.FromArgb(byte.Parse(parts[0]), byte.Parse(parts[1]), byte.Parse(parts[2]), byte.Parse(parts[3]));

                    this.viewModel.AddCategory(color);

                    var category = this.viewModel.FindCategory(color);

                    var x = double.Parse(parts[4]);
                    var y = double.Parse(parts[5]);

                    this.viewModel.AddPoint(category.Color, x, y);

                    line = reader.ReadLine();
                }
            }

            var features =
                this.viewModel.DrawnCategories
                .Select(c => new KeyValuePair <Brush, List <Diagrams.Point> >(c.Brush, c.Features.Select(f => new Diagrams.Point(f.X, f.Y)).ToList()))
                .ToDictionary(k => k.Key, v => v.Value);

            var host = await Bus.Query(new CreateShapesContainer(this.Surface.ActualWidth, this.Surface.ActualHeight));

            await Bus.Send(new DrawPoints(features, host as IShapeComposite));

            this.Surface.Children.Clear();
            this.Surface.Children.Add(host);
        }
Exemple #19
0
        public static CustomerAccount Load(System.IO.TextReader textIn)
        {
            CustomerAccount result = null;

            try {
                string  name        = textIn.ReadLine();
                string  balanceText = textIn.ReadLine();
                decimal balance     = decimal.Parse(balanceText);
                result = new CustomerAccount(name, balance);
            }
            catch {
                return(null);
            }
            return(result);
        }
Exemple #20
0
        public static DictionaryBank Load(System.IO.TextReader textIn)
        {
            DictionaryBank result      = new DictionaryBank();
            string         countString = textIn.ReadLine();
            int            count       = int.Parse(countString);

            for (int i = 0; i < count; i++)
            {
                string   className = textIn.ReadLine();
                IAccount account   =
                    AccountFactory.MakeAccount(className, textIn);
                result.StoreAccount(account);
            }
            return(result);
        }
Exemple #21
0
        private void dummydata()
        {
            uint OldTimeStamp = 0, NewTimeStamp = 0, TimeDiff = 0;

            byte[]   data;
            TimeSpan t = new TimeSpan(5000);
            String   line;
            int      Front;

            // grab 1st line
            line = fs.ReadLine();
            while (line != null)
            {
                line += "\n";
                //Convert to bytes
                data = ascii.GetBytes(line);
                if (data.Length > 9)
                {
                    // find $
                    Front = Array.IndexOf(data, (byte)36);
                    // convert timestamp
                    NewTimeStamp = ParseHex(data, Front + 3, 6);
                    // get difference from last line
                    if (OldTimeStamp > NewTimeStamp)
                    {
                        TimeDiff = 1;
                    }
                    else
                    {
                        TimeDiff = NewTimeStamp - OldTimeStamp;
                    }
                    if (TimeDiff < 75)
                    {
                        TimeDiff = 75;
                    }
                    OldTimeStamp = NewTimeStamp;
                    // sleep for this time difference.
                    Thread.Sleep((int)TimeDiff);
                    // now send to regular handlers
                    PortBuffer.AddRange(data);
                    ProcessIncomingData(PortBuffer);
                    log.Write(data, 0, data.Length);
                }
                purelog.Write(data, 0, data.Length);
                // read another line
                line = fs.ReadLine();
            }
        }
Exemple #22
0
 public void run()
 {
     try
     {
         string line = @in.ReadLine();
         while (line != null)
         {
             buf.AppendLine(line);
             line = @in.ReadLine();
         }
     }
     catch (IOException)
     {
         Console.Error.WriteLine("can't read output from process");
     }
 }
Exemple #23
0
        static void main(System.IO.TextReader s)
        {
            var input = s.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            int  fd      = (input[0] + input[4] - input[3]) % input[0];
            int  bd      = input[0] - fd;
            int  fv      = input[2] + input[1];
            int  bv      = input[2] - input[1];
            bool forward = fv > 0;
            bool back    = bv > 0;

            double a, b;

            a = b = input[0] + 1;
            if (forward)
            {
                a = (double)fd / fv;
            }
            if (back)
            {
                b = (double)bd / bv;
            }

            double ans = Math.Min(a, b);

            Console.WriteLine(string.Format("{0}", ans));
        }
Exemple #24
0
        /// <summary> Reads lines from a Reader and adds every non-comment line as an entry to a HashSet (omitting
        /// leading and trailing whitespace). Every line of the Reader should contain only
        /// one word. The words need to be in lowercase if you make use of an
        /// Analyzer which uses LowerCaseFilter (like StandardAnalyzer).
        ///
        /// </summary>
        /// <param name="reader">Reader containing the wordlist
        /// </param>
        /// <param name="comment">The string representing a comment.
        /// </param>
        /// <returns> A HashSet with the reader's words
        /// </returns>
        public static List <string> GetWordSet(System.IO.TextReader reader, System.String comment)
        {
            List <string> result = new List <string>();

            System.IO.StreamReader br = null;
            try
            {
                System.String word = null;
                while ((word = reader.ReadLine()) != null)
                {
                    if (word.StartsWith(comment) == false)
                    {
                        result.Add(word.Trim());
                    }
                }
            }
            finally
            {
                if (br != null)
                {
                    br.Close();
                }
            }
            return(result);
        }
Exemple #25
0
        protected override void GetUserInput()
        {
            // Get user input
            System.IO.TextReader tIn = Console.In;

            string input = tIn.ReadLine();

            // convert to lower case
            input = input.ToLower();


            switch (input)
            {
            case "a":
                CustomerDB customerDB = new CustomerDB();
                Customer   customer   = customerDB.FindCustomerById(1);
                Console.WriteLine(customer.Id);
                Console.WriteLine(customer.FullName);
                Console.WriteLine(customer.Username);
                break;

            case "b":
                Console.Out.WriteLine("Option B chosen");
                break;

            default:
                break;
            }
        }
        private static void LoadOption()
        {
            if (System.IO.File.Exists(FilePathOptions))
            {
                System.IO.TextReader tr = System.IO.File.OpenText(FilePathOptions);
                string line             = string.Empty;

                while (null != (line = tr.ReadLine()))
                {
                    string[] opt = line.Split('=');

                    if ((opt != null) && (opt.Length == 2))
                    {
                        switch (opt[0])
                        {
                        case "SaveOption":
                            try { Configuration.SaveOption = (ESaveOption)Enum.Parse(typeof(ESaveOption), opt[1], true); }
                            catch { }
                            break;

                        default:
                            break;
                        }
                    }
                }

                tr.Close();
                tr.Dispose();
            }
        }
Exemple #27
0
        new protected bool LoadRecord(System.IO.TextReader reader)
        {
            _data.Content.Clear();
            int contentMultiRecordInterval = _format.ContentMultiRecordInterval;

            if (_format.IsContentMultiRecord == false)
            {
                contentMultiRecordInterval = 1;
            }

            for (int i = 0; i < contentMultiRecordInterval; i++)
            {
                string line;
                try
                {
                    line = reader.ReadLine();
                }
                catch
                {
                    line = string.Empty;
                    return(false);
                }

                if (line == null)
                {
                    return(false);
                }

                string[] valueAry = this.SplitString(line, _format.ContentColumnSeparator);
                iTotalColumns = valueAry.Length;
                _data.SetContent(i, valueAry);
            }

            return(true);
        }
Exemple #28
0
        public Settings(System.IO.TextReader conf)
        {
            QuickFix.Dictionary currentSection = null;

            string line = null;

            while ((line = conf.ReadLine()) != null)
            {
                line = line.Trim();
                if (IsComment(line))
                {
                    continue;
                }
                else if (IsSection(line))
                {
                    currentSection = Add(new Dictionary(SplitSection(line)));
                }
                else if (IsKeyValue(line))
                {
                    string[] kv = line.Split('=');
                    if (currentSection != null)
                    {
                        currentSection.SetString(kv[0].Trim(), kv[1].Trim());
                    }
                }
            }
        }
Exemple #29
0
        public IList <string> ReadStopWords()
        {
            var result = new List <string>();

            System.IO.FileInfo   stopFileInfo = new System.IO.FileInfo(stopFileName);;
            System.IO.TextReader reader       = stopFileInfo.OpenText();;

            try
            {
                while (((System.IO.StreamReader)reader).EndOfStream == false)
                {
                    string word = reader.ReadLine();


                    result.Add(word.Trim());
                }
            }
            catch { } //TODO: Catch überarbeiten
            finally {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
            return(result);
        }
Exemple #30
0
        public Project(System.IO.TextReader inStream)
        {
            var projectDefinition = inStream.ReadLine();

            section = System.Text.RegularExpressions.Regex.Split(projectDefinition, Seperator);

            var end = inStream.ReadLine();

            System.Diagnostics.Debug.Assert(end == "EndProject");

            // Load project from text
            Type        = GetProjectType();
            Name        = GetProjectName();
            Location    = GetProjectLocation();
            ProjectGuid = GetProjectGuid();
        }
 public PosEventReader(System.IO.TextReader data, IPosContextGenerator contextGenerator)
 {
     mContextGenerator = contextGenerator;
     mTextReader = data;
     string nextLine = mTextReader.ReadLine();
     if (nextLine != null)
     {
         AddEvents(nextLine);
     }
 }
 protected virtual StringTemplate LoadTemplate( string name, TextReader r )
 {
     string line;
     string nl = Environment.NewLine;
     StringBuilder buf = new StringBuilder( 300 );
     while ( ( line = r.ReadLine() ) != null )
     {
         buf.Append( line );
         buf.Append( nl );
     }
     // strip newlines etc.. from front/back since filesystem
     // may add newlines etc...
     string pattern = buf.ToString().Trim();
     if ( pattern.Length == 0 )
     {
         Error( "no text in template '" + name + "'" );
         return null;
     }
     return DefineTemplate( name, pattern );
 }