示例#1
0
 public TextFieldParser(TextReader reader)
 {
     this.m_CommentTokens   = new string[0];
     this.m_LineNumber      = 1L;
     this.m_EndOfData       = false;
     this.m_ErrorLine       = "";
     this.m_ErrorLineNumber = -1L;
     this.m_TextFieldType   = FieldType.Delimited;
     this.m_WhitespaceCodes = new int[] {
         9, 11, 12, 0x20, 0x85, 160, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008,
         0x2009, 0x200a, 0x200b, 0x2028, 0x2029, 0x3000, 0xfeff
     };
     this.m_WhiteSpaceRegEx           = new Regex(@"\s", RegexOptions.CultureInvariant);
     this.m_TrimWhiteSpace            = true;
     this.m_Position                  = 0;
     this.m_PeekPosition              = 0;
     this.m_CharsRead                 = 0;
     this.m_NeedPropertyCheck         = true;
     this.m_Buffer                    = new char[0x1000];
     this.m_HasFieldsEnclosedInQuotes = true;
     this.m_MaxLineSize               = 0x989680;
     this.m_MaxBufferSize             = 0x989680;
     this.m_LeaveOpen                 = false;
     if (reader == null)
     {
         throw ExceptionUtils.GetArgumentNullException("reader");
     }
     this.m_Reader = reader;
     this.ReadToBuffer();
 }
 public AssemblyInfo(Assembly currentAssembly)
 {
     if (currentAssembly == null)
     {
         throw ExceptionUtils.GetArgumentNullException("CurrentAssembly");
     }
     this.m_Assembly = currentAssembly;
 }
示例#3
0
 public void PlaySystemSound(SystemSound systemSound)
 {
     if (systemSound == null)
     {
         throw ExceptionUtils.GetArgumentNullException("systemSound");
     }
     systemSound.Play();
 }
示例#4
0
 private string ValidateFilename(string location)
 {
     if (location == "")
     {
         throw ExceptionUtils.GetArgumentNullException("location");
     }
     return(location);
 }
示例#5
0
 public void Play(Stream stream, AudioPlayMode playMode)
 {
     this.ValidateAudioPlayModeEnum(playMode, "playMode");
     if (stream == null)
     {
         throw ExceptionUtils.GetArgumentNullException("stream");
     }
     this.Play(new SoundPlayer(stream), playMode);
 }
示例#6
0
        public void Play(byte[] data, AudioPlayMode playMode)
        {
            if (data == null)
            {
                throw ExceptionUtils.GetArgumentNullException("data");
            }
            this.ValidateAudioPlayModeEnum(playMode, "playMode");
            MemoryStream stream = new MemoryStream(data);

            this.Play(stream, playMode);
            stream.Close();
        }
示例#7
0
        private void InitializeFromPath(string path, Encoding defaultEncoding, bool detectEncoding)
        {
            if (path == "")
            {
                throw ExceptionUtils.GetArgumentNullException("path");
            }
            if (defaultEncoding == null)
            {
                throw ExceptionUtils.GetArgumentNullException("defaultEncoding");
            }
            FileStream stream = new FileStream(this.ValidatePath(path), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            this.m_Reader = new StreamReader(stream, defaultEncoding, detectEncoding);
            this.ReadToBuffer();
        }
        public void WriteException(Exception ex, TraceEventType severity, string additionalInfo, int id)
        {
            if (ex == null)
            {
                throw ExceptionUtils.GetArgumentNullException("ex");
            }
            StringBuilder builder = new StringBuilder();

            builder.Append(ex.Message);
            if (additionalInfo != "")
            {
                builder.Append(" ");
                builder.Append(additionalInfo);
            }
            this.m_TraceSource.TraceEvent(severity, id, builder.ToString());
        }
示例#9
0
 private void InitializeFromStream(Stream stream, Encoding defaultEncoding, bool detectEncoding)
 {
     if (stream == null)
     {
         throw ExceptionUtils.GetArgumentNullException("stream");
     }
     if (!stream.CanRead)
     {
         throw ExceptionUtils.GetArgumentExceptionWithArgName("stream", "TextFieldParser_StreamNotReadable", new string[] { "stream" });
     }
     if (defaultEncoding == null)
     {
         throw ExceptionUtils.GetArgumentNullException("defaultEncoding");
     }
     this.m_Reader = new StreamReader(stream, defaultEncoding, detectEncoding);
     this.ReadToBuffer();
 }