Exemple #1
0
        /// <summary>
        /// �ر��ļ�
        /// </summary>
        public void CloseFile()
        {
            if (this.m_streamReader != null)
            {
                //�ر�VCT�ļ�
                this.m_streamReader.Close();
                this.m_streamReader = null;
            }
            else if (this.m_streamWriter != null)
            {
                //�ر�VCT�ļ�
                this.m_streamWriter.Close();
                this.m_streamWriter = null;
            }

            //if (this.m_fileStream != null)
            //    this.m_fileStream.Close();
        }
Exemple #2
0
        /// <summary>
        /// ���캯��
        /// </summary>
        /// <param name="bRead">�Ƿ��Ƕ�ȡ</param>
        /// <param name="strFilePathName">�����ļ�����</param>
        public VCTFile(bool bRead, string strFilePathName)
        {
            this.m_bRead = bRead;
            this.m_strFilePathName = strFilePathName;

            FileStream fileStream = null;
            if (this.m_bRead == true)
            {
                //�ж�VCT�ļ��Ƿ����
                if (File.Exists(this.m_strFilePathName) == true)
                {
                    fileStream = new FileStream(this.m_strFilePathName, FileMode.Open);
                    //��VCT�ļ�
                    this.m_streamReader = new StreamReader(fileStream, Encoding.GetEncoding("gb2312"));
                }
            }
            else
            {
                fileStream = new FileStream(this.m_strFilePathName, FileMode.Create);
                //����VCT�ļ�
                this.m_streamWriter = new StreamWriterEx(this.m_strFilePathName, fileStream, Encoding.GetEncoding("gb2312"));
            }
        }