Пример #1
0
        } /* OpenSipperDiskFile */

        //**********************************************************************************************************************
        // Will be called by 'SipperDiskFile' 'Close' method to let the controlling 'SipperDisk' objct know the file is close. *
        //**********************************************************************************************************************
        public void  CloseSipperDiskFile(SipperDiskFile sdf)
        {
            BlockStart();

            int x = 0;
            int indexBeingUsed = -1;

            for (x = 0; x < openedSipperFiles.Count; x++)
            {
                if (openedSipperFiles[x] == sdf)
                {
                    indexBeingUsed = x;
                    break;
                }
            }

            if (indexBeingUsed < 0)
            {
                // We are trying to close a SipperDiskFile that we don't know anything about.
                BlockEnd();
                throw new Exception("'SipperDisk'::'CloseSipperDiskFile'  Trying to close file that is not supposed to be oppend.");
            }

            openedSipperFiles.RemoveAt(indexBeingUsed);

            if (openedSipperFiles.Count == 0)
            {
                // Since no 'SipperDiskFile' objects are open can close the PhysicalDisk handle.
                CloseHandleToPhysicalDisk();
            }

            BlockEnd();
        } /* CloseSipperDiskFile */
Пример #2
0
        public void  Dispose()
        {
            if (openedSipperFiles != null)
            {
                // Close all SipperDiskFiles that are still opened.
                while (openedSipperFiles.Count > 0)
                {
                    SipperDiskFile sdf = openedSipperFiles[0];
                    sdf.Close(); //The close method will call 'CloseSipperDiskFile' which will remove from 'openedSipperFiles' list.
                    sdf.Dispose();
                    sdf = null;
                }
            }

            BlockStart();

            if (fs != null)
            {
                CloseHandleToPhysicalDisk();
            }

            if (mbr != null)
            {
                mbr.Dispose();
                mbr = null;
            }

            BlockEnd();

            sipperFiles = null;
        } /* Dispose */
Пример #3
0
        } /* Dispose */

        public SipperDiskFile  OpenSipperDiskFile(string _fileName)
        {
            BlockStart();
            if (fs == null)
            {
                ReOpen(false);
            }

            SipperFileControlBlock fcb = sipperFiles.LookUpByName(_fileName);

            if (fcb == null)
            {
                return(null);
            }

            SipperDiskFile sipperDiskFile = new SipperDiskFile(fcb, this);

            openedSipperFiles.Add(sipperDiskFile);

            BlockEnd();
            return(sipperDiskFile);
        } /* OpenSipperDiskFile */
Пример #4
0
        } /* OpenSipperDiskFile */

        public SipperDiskFile  OpenSipperDiskFile(int fcbIndex)
        {
            BlockStart();

            if (fs == null)
            {
                ReOpen(false);
            }

            if ((fs == null) || (mbr == null) || (sipperFiles == null))
            {
                BlockEnd();
                return(null);
            }

            if (fcbIndex < 0)
            {
                BlockEnd();
                return(null);
            }

            SipperFileControlBlock fcb = sipperFiles.LookUpByFcbIndex(fcbIndex);

            if (fcb == null)
            {
                BlockEnd();
                return(null);
            }

            SipperDiskFile sipperDiskFile = new SipperDiskFile(fcb, this);

            openedSipperFiles.Add(sipperDiskFile);

            BlockEnd();

            return(sipperDiskFile);
        } /* OpenSipperDiskFile */