Ejemplo n.º 1
0
    public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
    {

        TransportClassMainAshx oTransportClassMainAshx = new TransportClassMainAshx(context, cb);
        ErrorTypes eError = ErrorTypes.NoError;
        try
        {
            _log.Info("Starting process request...");
            _log.Info(context.Request.QueryString.ToString());

            string sGuid = context.Request.QueryString["key"];
            int nMaxBytes = Convert.ToInt32(ConfigurationSettings.AppSettings["limits.image.size"] ?? "25000000");
            if (context.Request.ContentLength <= nMaxBytes)
            {
                if (context.Request.Files.Count > 0)
                {
                    
                    int nParamsCount = 0;
                    string sInputParams = "";
                    for (int i = 0, length = context.Request.QueryString.Count; i < length; ++i)
                    {
                        sInputParams += context.Request.QueryString.Get(i) + ":" + context.Request.QueryString.GetKey(i);
                        if (nParamsCount > 0)
                            sInputParams += ",";
                        nParamsCount++;
                    }
                    AsyncMediaXmlOperation oAsyncMediaXmlOperation = new AsyncMediaXmlOperation();
                    List<string> aUrls = new List<string>();
                    TransportClass1 oTransportClass1 = new TransportClass1(oTransportClassMainAshx, oAsyncMediaXmlOperation, context.Request.QueryString, aUrls, sGuid, Path.Combine(sGuid, @"media/media.xml"), context.Request.Files, context.Request.Files.GetEnumerator());
                    oAsyncMediaXmlOperation.GetMediaXmlBegin(oTransportClass1.m_sMediaXml, GetMediaXmlCallback, oTransportClass1);
                }
                else
                    eError = ErrorTypes.UploadCountFiles;
            }
            else
                eError = ErrorTypes.UploadContentLength;
        }
        catch(Exception e)
        {
            eError = ErrorTypes.Upload;
            
            _log.Error(context.Request.QueryString.ToString());
            _log.Error("Exeption: ", e);
        }
        if (ErrorTypes.NoError != eError)
            WriteToResponse(oTransportClassMainAshx, eError, null, context.Request.QueryString);
        return new AsyncOperationData(extraData);
    }
Ejemplo n.º 2
0
 private void ImageUrlCommand(TransportClassContextRead oTransportClassContextRead, InputCommand cmd)
 {
     AsyncMediaXmlOperation oAsyncMediaXmlOperation = new AsyncMediaXmlOperation();
     TransportClassMediaXml oTransportClassMediaXml = new TransportClassMediaXml(oTransportClassContextRead, cmd, oAsyncMediaXmlOperation, null);
     oAsyncMediaXmlOperation.GetMediaXmlBegin(Path.Combine(cmd.id, "media/media.xml"), GetMediaXmlCallback, oTransportClassMediaXml);
 }
Ejemplo n.º 3
0
 public TransportClassMediaXml(TransportClassMainAshx m_oTransportClassMainAshx, InputCommand oInputCommand, AsyncMediaXmlOperation oAsyncMediaXmlOperation, object oParam)
     : base(m_oTransportClassMainAshx.m_oHttpContext, m_oTransportClassMainAshx.m_oAsyncCallback)
 {
     m_oAsyncMediaXmlOperation = oAsyncMediaXmlOperation;
     m_oInputCommand = oInputCommand;
     m_oParam = oParam;
 }
Ejemplo n.º 4
0
 public TransportClass1(TransportClassMainAshx oTransportClassMainAshx, AsyncMediaXmlOperation oAsyncMediaXmlOperation, NameValueCollection aInputParams, List<string> aUrls, string sKey, string sMediaXml, HttpFileCollection oFiles, IEnumerator oFilesEnumerator)
     : base(oTransportClassMainAshx.m_oHttpContext, oTransportClassMainAshx.m_oAsyncCallback)
 {
     m_oAsyncMediaXmlOperation = oAsyncMediaXmlOperation;
     m_aInputParams = aInputParams;
     m_sKey = sKey;
     m_oFiles = oFiles;
     m_oFilesEnumerator = oFilesEnumerator;
     m_sMediaXml = sMediaXml;
     m_aUrls = aUrls;
 }