This class represents one field (which may be one line or multiple lines) from a standard format file.
示例#1
0
        protected override void Init()
        {
            try
            {
                string sfm;
                byte[] sfmData;
                byte[] badSfmData;
                int    lineNum = 0;
                while (GetNextSfmMarkerAndData(out sfm, out sfmData, out badSfmData))
                {
                    if (sfm.Length == 0)
                    {
                        lineNum = LineNumber;
                        continue;                         // no action if empty sfm - case where data before first marker
                    }
                    if (m_sfmUsage.ContainsKey(sfm))
                    {
                        int val = m_sfmUsage[sfm] + 1;
                        m_sfmUsage[sfm] = val;
                    }
                    else
                    {
                        if (sfm.Length > m_longestSfmSize)
                        {
                            m_longestSfmSize = sfm.Length;
                        }

                        m_sfmUsage.Add(sfm, 1);
                        m_sfmOrder.Add(sfm);
                        m_sfmWithDataUsage.Add(sfm, 0);                         // create the key - not sure on data yet
                    }
                    SfmField line = new SfmField(sfm, sfmData, lineNum);
                    m_rgFields.Add(line);
                    // if there is data, then bump the sfm count with data
                    if (sfmData.Length > 0 && (!String.IsNullOrEmpty(line.Data) || line.ErrorConvertingData))
                    {
                        int val = m_sfmWithDataUsage[sfm] + 1;
                        m_sfmWithDataUsage[sfm] = val;
                    }
                    lineNum = LineNumber;
                }
            }
            catch
            {
                // just eat the exception since the data members will be empty
            }
        }
示例#2
0
		protected override void Init()
		{
			try
			{
				string sfm;
				byte[] sfmData;
				byte[] badSfmData;
				int lineNum = 0;
				while (GetNextSfmMarkerAndData(out sfm, out sfmData, out badSfmData))
				{
					if (sfm.Length == 0)
					{
						lineNum = LineNumber;
						continue; // no action if empty sfm - case where data before first marker
					}
					if (m_sfmUsage.ContainsKey(sfm))
					{
						int val = m_sfmUsage[sfm] + 1;
						m_sfmUsage[sfm] = val;
					}
					else
					{
						if (sfm.Length > m_longestSfmSize)
							m_longestSfmSize = sfm.Length;

						m_sfmUsage.Add(sfm, 1);
						m_sfmOrder.Add(sfm);
						m_sfmWithDataUsage.Add(sfm, 0);	// create the key - not sure on data yet
					}
					SfmField line = new SfmField(sfm, sfmData, lineNum);
					m_rgFields.Add(line);
					// if there is data, then bump the sfm count with data
					if (sfmData.Length > 0 && (!String.IsNullOrEmpty(line.Data) || line.ErrorConvertingData))
					{
						int val = m_sfmWithDataUsage[sfm] + 1;
						m_sfmWithDataUsage[sfm] = val;
					}
					lineNum = LineNumber;
				}
			}
			catch
			{
				// just eat the exception since the data members will be empty
			}
		}