コード例 #1
0
        /// <summary>
        /// 新建文件夹
        /// </summary>
        /// <param name="u"></param>
        /// <param name="dname">文件夹名字</param>
        public static void makedir(User u, string dname)
        {
            if (dname.StartsWith(@".\"))
            {
                dname = dname.Substring(2);
            }
            string tpath = TruepathParser.parse(u);

            if (Directory.Exists(tpath + @"\" + dname))
            {
                Console.WriteLine("该文件夹已存在");
            }
            else
            {
                Directory.CreateDirectory(tpath + @"\" + dname);
            }
            //向索引表添加记录
            IndexTableWriter.Write(u, u.GetPath() + @"\" + dname, true);
        }
        /// <summary>
        /// 创建文件
        /// </summary>
        /// <param name="u"></param>
        /// <param name="fname"></param>
        public static void create(User u, string fname)
        {
            if (fname.StartsWith(@".\"))
            {
                fname = fname.Substring(2);
            }
            string tpath = TruepathParser.parse(u);

            if (File.Exists(tpath + @"\" + fname))
            {
                Console.WriteLine("该文件夹已存在");
            }
            else
            {
                File.Create(tpath + @"\" + fname).Close();
            }
            //向索引表添加记录
            IndexTableWriter.Write(u, u.GetPath() + @"\" + fname, true);
        }