Beispiel #1
0
        /// <summary>
        ///   Add an empty dir
        /// </summary>
        ///   <returns> the newly created dir </returns>
        private SqlDir __addDir(string dirName)
        {
            if ((dirName = checkInvalidChars(dirName)) == null)
            {
                SqlFsErrCode.CurrentError = FsErr.InvalidChars;
                return(null);
            }

            if (__isAlreadyExist(dirName))
            {
                SqlFsErrCode.CurrentError = FsErr.NameAlreadyExists;
                return(null);
            }

            FsID newID = SqlDir.addDir(db, dirName, this.ID);

            if (newID.compare(SqlFsConst.INVALIDID) <= 0)
            {
                SqlFsErrCode.CurrentError = FsErr.NoNewIDForNewFsNode;
                return(null);
            }

            if (!updateChildList(SqlFsConst.FSOP.ADD, newID, FsID.toFsID(0)))
            {
                // delete entry just created
                SqlFs.deleteEntryByID(db, SqlFs.DBNAMES.FsBlock.ToString(), SqlFs.FSBLOCK.fsID.ToString(), newID);
                return(null);
            }

            return(SqlDir.getDir(db, fsLocker, newID));
        }
Beispiel #2
0
 /// <summary>
 ///  Create root dir entry, which will have an ID of 1 and parent 0
 /// </summary>
 private void createRootDir()
 {
     SqlDir.addDir(db, SqlFsConst.ROOTDIRNAME, SqlFsConst.ROOTPARENTID);
 }