Beispiel #1
0
        public static void Rename(string from, string to)
        {
            fhandle fhFrom = LookupFileHandle(from);
            fhandle fhTo   = LookupFileHandle(to);

            if (fhFrom != null && fhTo == null)
            {
                // Most likely
                LookupFileEntry(fhFrom).Name = to;
            }
            else if (fhFrom != null && fhTo != null)
            {
                // Next most likely
                Remove(fhTo);
                LookupFileEntry(fhFrom).Name = to;
            }
            if (fhFrom == null && fhTo != null)
            {
                // Nothing to do
            }
            else if (fhFrom == null && fhTo == null)
            {
                Add(new FileEntry(to));
            }
        }
Beispiel #2
0
        public static FileEntry LookupFileEntry(fhandle fh)
        {
            try
            {
                return((FileEntry)files[fh.Index]);
            }
            catch (IndexOutOfRangeException)
            {
#if DEBUG
                Console.WriteLine("LookupFileEntry({0}) failed", fh.Index);
#endif
                return(null);
            }
        }
Beispiel #3
0
 public static void Remove(fhandle fh)
 {
     files.Remove(fh.Index);
 }