Ejemplo n.º 1
0
        public CardTempFile(Stream stream)
        {
            reader = new FileReader(stream);
            int len = (int)(reader.ReadUInt32());
            if (len > 0)
            {
                style = reader.ReadGB2312(len);
            }

            Stream cardFileStream = new MemoryStream(reader.ReadBytes((int)(stream.Length - len - 4)));

            cardFile = new CardFile(cardFileStream);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// �����ļ�
        /// </summary>
        private void SaveFile()
        {
            string fileType, fileGuid,fileUid;
            if (Request.Headers["FILE_TYPE"] != null && Request.Headers["FILE_GUID"] != null && Request.Headers["FILE_UID"] != null)
            {
                fileType = Request.Headers["FILE_TYPE"].Trim();
                fileGuid = Request.Headers["FILE_GUID"].Trim();
                fileUid = Request.Headers["FILE_UID"].Trim();

                IFile file = null;
                if (fileType == "logo")
                {
                    file = new LogoFile(Request.InputStream);
                }
                else if (fileType == "card")
                {
                    file = new CardFile(Request.InputStream);
                }
                else if (fileType == "cardTemp")
                {
                    file = new CardTempFile(Request.InputStream);
                }

                if (file != null)
                {
                    file.Save();
                }

                Response.Clear();
                Response.ContentType = "text/xml";
                Response.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                Response.Write("<RESPONSE>");
                Response.Write("<Result status=\"1\" guid=\"" + fileGuid + "\"/>");
                Response.Write("</RESPONSE>");
                Response.End();
            }
            else
            {
                Response.Clear();
                Response.ContentType = "text/xml";
                Response.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                Response.Write("<RESPONSE>");
                Response.Write("<Result status=\"0\"/>");
                Response.Write("</RESPONSE>");
                Response.End();
                return;
            }
        }