예제 #1
0
        public string DisplayError_FileReadError(string value)
        {
            DataFileFoldConfig config   = DataFileFoldConfig.Load();
            string             FileName = config.BaseFold + "/" + value;

            return(string.Format("文件{0} 读取错误", FileName));
        }
예제 #2
0
        public bool IsFileExist(string value)
        {
            //该类用于读取指定配置文件中写入的“共享路径”
            DataFileFoldConfig config = DataFileFoldConfig.Load();

            return(File.Exists(config.BaseFold + "/" + value));
        }
예제 #3
0
        public bool ReadFileValue(string value)
        {
            bool result = false;

            try
            {
                DataFileFoldConfig config   = DataFileFoldConfig.Load();
                string             FileName = config.BaseFold + "/" + value;
                using (FileStream fs = new FileStream(FileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read))
                {
                    using (StreamReader sw = new StreamReader(fs, Encoding.UTF8))
                    {
                        Result = sw.ReadToEnd();
                    }
                }
                result = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine("ReadFileValue {0} ", ex.Message);
            }
            return(result);
        }