Example #1
0
 internal TBoundSheetList()
 {
     FSheetNames  = new TSheetNameList();
     FBoundSheets = new TBoundSheetRecordList();
     FTabList     = new UInt32List();
     MaxTabId     = 0;
 }
Example #2
0
        /// <summary>
        /// Deletes the listing from the file system.
        /// </summary>
        /// <returns>True if the listing was deleted. Otherwise, false.</returns>
        public override bool Delete()
        {
            if (TheFATFileSystem.FATType != FATFileSystem.FATTypeEnum.FAT32)
            {
                ExceptionMethods.Throw(new Exceptions.NotSupportedException("FATFile.Delete for non-FAT32 not supported!"));
            }

#if FATFILE_TRACE
            BasicConsole.WriteLine("FATFile.Delete : Reading cluster chain...");
#endif
            UInt32List clusters = TheFATFileSystem.ReadClusterChain(Size, FirstClusterNum);
#if FATFILE_TRACE
            BasicConsole.WriteLine("FATFile.Delete : Processing cluster chain...");
#endif
            for (int i = 0; i < clusters.Count; i++)
            {
#if FATFILE_TRACE
                BasicConsole.WriteLine("FATFile.Delete : Writing cluster...");
#endif
                //Write 0s (null) to clusters
                TheFATFileSystem.WriteCluster(clusters[i], null);

#if FATFILE_TRACE
                BasicConsole.WriteLine("FATFile.Delete : Setting FAT entry...");
#endif
                //Write "empty" to FAT entries
                TheFATFileSystem.SetFATEntryAndSave(clusters[i], 0);
            }

            //If the file actually being used to read/write a FATDirectory,
            //      it will not be in the parent listings, the FATDirectory instance will be.
            //      So we should not attempt to edit the parent listings from within the
            //      FATFile instance.
            if (!IsDirectoryFile)
            {
#if FATFILE_TRACE
                BasicConsole.WriteLine("FATFile.Delete : Removing listing...");
#endif
                //Remove listing
                Parent.RemoveListing(this);

#if FATFILE_TRACE
                BasicConsole.WriteLine("FATFile.Delete : Writing listings...");
#endif
                //Write listings
                Parent.WriteListings();
            }

#if FATFILE_TRACE
            BasicConsole.WriteLine("FATFile.Delete : Complete.");
#endif

            return(true);
        }
Example #3
0
 /// <summary>
 /// Gets the list of cluster numbers that are part of the file being read/written from/to.
 /// </summary>
 private void GetClusterNums()
 {
     //Cluster number of 0 is invalid! Minimum is 2. Therefore, we can use
     //  the cluster number to determine whether this stream is to a valid
     //  / non-empty file or not.
     if (TheFATFile.FirstClusterNum > 0 || IgnoreFileSize)
     {
         //BasicConsole.WriteLine("Reading cluster chain...");
         ClusterNums = TheFATFileSystem.ReadClusterChain(TheFile.Size, TheFATFile.FirstClusterNum);
         //BasicConsole.WriteLine("Read cluster chain.");
     }
 }
Example #4
0
        private void ParseDatFile(Stream inStream)
        {
            Dat = new DatContainer(inStream, datName);

            try
            {
                var containerData = DataEntries.ToList();

                foreach (var keyValuePair in containerData)
                {
                    if (keyValuePair.Value is UnicodeString)
                    {
                        Strings.Add((UnicodeString)keyValuePair.Value);
                    }
                    else if (keyValuePair.Value is UInt64List)
                    {
                        UInt64List ul = (UInt64List)keyValuePair.Value;
                        Strings.Add((UnicodeString) new UnicodeString(ul.Offset, ul.dataTableOffset, ul.ToString()));
                    }
                    else if (keyValuePair.Value is UInt32List)
                    {
                        UInt32List ul = (UInt32List)keyValuePair.Value;
                        Strings.Add((UnicodeString) new UnicodeString(ul.Offset, ul.dataTableOffset, ul.ToString()));
                    }
                    else if (keyValuePair.Value is Int32List)
                    {
                        Int32List ul = (Int32List)keyValuePair.Value;
                        Strings.Add((UnicodeString) new UnicodeString(ul.Offset, ul.dataTableOffset, ul.ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format(Settings.Strings["DatWrapper_ParseDatFile_Failed"], ex.Message), ex);
            }
        }