Example #1
0
        public static byte[] readfile(string fullFilePath)
        {
            WebFile.imsg("openread");
            FileStream fileStream = (FileStream)null;

            WebFile.imsg("openread2");
            try
            {
                fileStream = File.OpenRead(fullFilePath);
                WebFile.imsg("openread3");
                byte[] buffer = new byte[fileStream.Length];
                fileStream.Read(buffer, 0, Convert.ToInt32(fileStream.Length));
                WebFile.imsg("Read worked");
                return(buffer);
            }
            catch (Exception ex)
            {
                WebFile.imsg("openread4");
                WebFile.imsg("File error {0}", (object)ex.ToString());
                return((byte[])null);
            }
            finally
            {
                if (fileStream != null)
                {
                    fileStream.Close();
                    fileStream.Dispose();
                }
            }
        }
Example #2
0
 public override void data_in(byte[] inbf, int inlen)
 {
     WebFile.imsg("Got {0} bytes", (object)inlen);
 }
Example #3
0
 public override bool do_body_end(Websvc w)
 {
     WebFile.imsg("Got END of body - webfile...");
     return(true);
 }
Example #4
0
 public override bool isforme(string path, string url)
 {
     WebFile.imsg("isforme [{0}]", (object)path);
     return(path.StartsWith("/img") || path.StartsWith("/web/") || (path == "/web" || url.StartsWith("/favicon")));
 }
Example #5
0
 public override bool do_body(Websvc w, byte[] inbf, int inlen)
 {
     WebFile.imsg("Got body packet of {0} bytes", (object)inlen);
     return(true);
 }