Ejemplo n.º 1
0
        /// <summary>
        /// Loads from PRD.
        /// </summary>
        /// <param name="prdFilePath">The PRD file path.</param>
        /// <returns></returns>
        static public TPage LoadFromPRD(string prdFilePath)
        {
            MemoryStream prdUnzipStream;

            using (FileStream prdFileStream = new FileStream(prdFilePath, FileMode.Open, FileAccess.Read))
            {
                prdUnzipStream = new MemoryStream(ZipUtil.ZipUnarchive(prdFileStream));
            }

            DataContractSerializer pageSerializer = new DataContractSerializer(typeof(TPage), null, int.MaxValue, false, true, null, null);

            TPage prdPage = pageSerializer.ReadObject(prdUnzipStream) as TPage;

            return(prdPage);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves to PRD.
        /// </summary>
        /// <param name="prdPage">The PRD page.</param>
        /// <param name="prdFilePath">The PRD file path.</param>
        static public void SaveToPRD(TPage prdPage, string prdFilePath)
        {
            DataContractSerializer pageSerializer = new DataContractSerializer(typeof(TPage), null, int.MaxValue, false, true, null, null);

            MemoryStream prdMemory = new MemoryStream();

            pageSerializer.WriteObject(prdMemory, prdPage);

            using (FileStream prdFileStream = new FileStream(prdFilePath, FileMode.Create, FileAccess.Write))
            {
                prdMemory.Position = 0;
                byte [] zipData = ZipUtil.ZipArchive(prdMemory, Compression.Medium);
                prdFileStream.Write(zipData, 0, zipData.Length);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads from raw data.
        /// </summary>
        /// <param name="oRawData">The o raw data.</param>
        /// <returns></returns>
        static public TPage LoadFromRawData(byte[] oRawData)
        {
            string sPRDFileName = System.IO.Path.GetTempFileName();
            string sPRDName     = System.IO.Path.GetFileName(sPRDFileName);
            string sPath        = System.IO.Path.GetDirectoryName(sPRDFileName);

            // Create PRD file...
            //			BLOBStorageImplFS oSavePRD = new BLOBStorageImplFS( sPath ) ;
            //			oSavePRD.WriteBLOB( sPath, sPRDName, oRawData ) ;
            System.IO.FileStream   oFS = new FileStream(sPRDFileName, FileMode.Create);
            System.IO.BinaryWriter oBW = new BinaryWriter(oFS);
            oBW.Write(oRawData);
            oBW.Close();
            oFS.Close();

            TPage oPage = LoadFromPRD(sPRDFileName);

            System.IO.File.Delete(sPRDFileName);

            return(oPage);
        }
Ejemplo n.º 4
0
 public CompareTLines(TPage oPage)
 {
     m_oPage = oPage;
 }