/// <summary> /// Generates an image in the specified format /// </summary> /// <param name="format">One of the PVFSOutputFormat constants indicating the format</param> /// <returns>true if generation was successful, false otherwise</returns> public override bool Generate(PVFSOutputFormat format) { // Start with nothing as the output name generatedImageName = null; // Make sure all paths exist if (!Directory.Exists(localPath)) { log.Add("\r\nERROR: Output directory \"" + localPath + "\" does not exist!"); return(false); } // Make sure we have some files if (files.Count == 0) { return(false); } try { // Write any index files that have changed indexUpdated = dynVarParser.WriteIndices(); } catch (Exception e) { log.Add("ERROR: " + e.Message); return(false); } // Determine address of each file and string UInt32 numFiles = (UInt32)files.Count; UInt32 lenHeader = 12; // "WEBF01nn" UInt32 lenHashes = 2 * numFiles; UInt32 lenFAT = 4 * numFiles; UInt32 baseAddr = lenHeader + lenHashes + lenFAT; UInt32 counter = 0; UInt32 loopCntr = 0; UInt32 numFileRecrds = 0; foreach (PVFSFileRecord file in files) { file.locStr = baseAddr; baseAddr += (UInt32)file.FileName.Length + 1 + 8; file.locData = baseAddr; baseAddr += (UInt32)file.data.Length; } /* foreach (PVFSFileRecord file in files) * { * file.locData = baseAddr; * baseAddr += (UInt32)file.data.Length; * } */ // Set up the writer try { PVFS2Writer w; w = new PVFS2BINWriter(localPath + localFile); w.ImgLen = baseAddr; WriteImage(w); } catch (Exception e) { log.Add("\r\nERROR: " + e.Message); return(false); } return(true); }
/// <summary> /// Generates an image in the specified format /// </summary> /// <param name="format">One of the PVFSOutputFormat constants indicating the format</param> /// <returns>true if generation was successful, false otherwise</returns> public override bool Generate(PVFSOutputFormat format) { // Start with nothing as the output name generatedImageName = null; // Make sure all paths exist if (!Directory.Exists(localPath)) { log.Add("\r\nERROR: Output directory \"" + localPath + "\" does not exist!"); return false; } // Make sure we have some files if (files.Count == 0) return false; try { // Write any index files that have changed indexUpdated = dynVarParser.WriteIndices(); } catch (Exception e) { log.Add("ERROR: " + e.Message); return false; } // Determine address of each file and string UInt32 numFiles = (UInt32)files.Count; UInt32 lenHeader = 12; // "WEBF01nn" UInt32 lenHashes = 2 * numFiles; UInt32 lenFAT = 4 * numFiles; UInt32 baseAddr = lenHeader + lenHashes + lenFAT; UInt32 counter=0; UInt32 loopCntr=0; UInt32 numFileRecrds = 0; foreach (PVFSFileRecord file in files) { file.locStr = baseAddr; baseAddr += (UInt32)file.FileName.Length + 1 + 8; file.locData = baseAddr; baseAddr += (UInt32)file.data.Length; } /* foreach (PVFSFileRecord file in files) { file.locData = baseAddr; baseAddr += (UInt32)file.data.Length; } */ // Set up the writer try { PVFS2Writer w; w = new PVFS2BINWriter(localPath + localFile); w.ImgLen = baseAddr; WriteImage(w); } catch (Exception e) { log.Add("\r\nERROR: " + e.Message); return false; } return true; }