コード例 #1
0
ファイル: UFlexCelReportAux.cs プロジェクト: mwilian/demos
        internal static byte[] OpenInclude(GetIncludeEventArgs ea, ExcelFile Workbook)
        {
            string iPath = Workbook.ActiveFileName;

            try
            {
                if (iPath.Length > 0)
                {
                    iPath = Path.GetDirectoryName(iPath) + Path.DirectorySeparatorChar;
                }
            }
            catch (ArgumentException)
            {
                iPath = String.Empty;
            }
            if (Path.IsPathRooted(ea.FileName))
            {
                iPath = String.Empty;
            }

            ea.FileName = iPath + ea.FileName;
            using (FileStream f = new FileStream(ea.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) //FileShare.ReadWrite is the way we have to open a file even if it is being used by excel.
            {
                byte[] Result = new byte[f.Length];
                Sh.Read(f, Result, 0, Result.Length);
                return(Result);
            }
        }
コード例 #2
0
ファイル: PdfFontFactory.cs プロジェクト: mwilian/demos
 private static byte[] OpenFile(string Path)
 {
     using (FileStream fs = new FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))             //FileShare.ReadWrite is the way we have to open a file even if it is being used by excel.))
     {
         byte[] b = new byte[fs.Length];
         Sh.Read(fs, b, 0, (int)fs.Length);
         return(b);
     }
 }
コード例 #3
0
ファイル: PdfFontFactory.cs プロジェクト: mwilian/demos
        private void LoadFont(string path)
        {
            byte[] b = null;
            using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))             //FileShare.ReadWrite is the way we have to open a file even if it is being used by excel.))
            {
                b = new byte[fs.Length];
                Sh.Read(fs, b, 0, (int)fs.Length);
            }

            LoadFont(path, b);
        }
コード例 #4
0
        private static byte[] DecodeImage(byte[] Img, int w, int h, int ScanLine)
        {
            using (TCompressor Cmp = new TCompressor())
            {
                if (w <= 0)
                {
                    return(new byte[2]);
                }
                byte[] Result = new byte[h * ScanLine];
                using (MemoryStream InflatedStream = new MemoryStream())
                {
                    unchecked
                    {
                        Cmp.Inflate(Img, 0, InflatedStream);
                        InflatedStream.Position = 0;

                        Sh.Read(InflatedStream, Result, 0, h * ScanLine);
                        return(UnFilter(Result, ScanLine, h));
                    }
                }
            }
        }
コード例 #5
0
ファイル: UPxlRecordLoader.cs プロジェクト: mwilian/demos
 private void ShRead(Stream aDataStream, byte[] Data, int IniOfs, int Count)
 {
     Sh.Read(aDataStream, Data, IniOfs, Count);
     DataStreamPosition += Count;
 }
コード例 #6
0
 internal static void ReadtRNS(UInt32 Len, Stream PngImageData, TPdfPngData OutData)
 {
     OutData.tRNS = new byte[Len];
     Sh.Read(PngImageData, OutData.tRNS, 0, (int)Len);
 }