Ejemplo n.º 1
0
 private void TaskResultGetOrCreateCallback2(IAsyncResult ar)
 {
     TransportClassTaskResult oTransportClassTaskResult = ar.AsyncState as TransportClassTaskResult;
     try
     {
         TaskResultData oTaskResultData;
         bool bCreate;
         ErrorTypes eError = oTransportClassTaskResult.m_oTaskResult.GetOrCreateEnd(ar, out oTaskResultData, out bCreate);
         if (ErrorTypes.NoError == eError)
         {
             if (bCreate)
             {
                 InputCommand cmd = oTransportClassTaskResult.m_oInputCommand;
                 Storage oStorage = new Storage();
                 TransportClassStorage oTransportClassStorage = new TransportClassStorage(oTransportClassTaskResult, oTransportClassTaskResult.m_oInputCommand, oStorage, null, null);
                 oStorage.CreateDirectoryBegin(cmd.id + "/media", CreateDirectoryCallback, oTransportClassStorage);
             }
             else
             {
                 TaskResultData oTaskResultDataTemp = new TaskResultData();
                 oTaskResultDataTemp.eStatus = FileStatus.Ok;
                 oTaskResultDataTemp.nStatusInfo = (int)ErrorTypes.NoError;
                 TaskResultGetProcess(oTaskResultDataTemp, false, oTransportClassTaskResult.m_oInputCommand, oTransportClassTaskResult);
             }
                 
         }
         else
             WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(eError));
     }
     catch
     {
         WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(ErrorTypes.Unknown));
     }
 }
Ejemplo n.º 2
0
    private void TaskResultAddRandomKeyAsyncCallback(IAsyncResult ar)
    {
        TransportClassTaskResult oTransportClassTaskResult = ar.AsyncState as TransportClassTaskResult;
        try
        {
            TaskResultData oTaskResultData;
            ErrorTypes eError = oTransportClassTaskResult.m_oTaskResult.AddRandomKeyEnd(ar, out oTaskResultData);
            if (ErrorTypes.NoError == eError)
            {
                InputCommand cmd = oTransportClassTaskResult.m_oInputCommand;
                string sFilename;
                if (c_sSaveTypeCompleteAll == cmd.savetype)
                    sFilename = "Editor.bin";
                else
                    sFilename = "Editor1.bin";
				try
                {
                    if (FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF == cmd.outputformat && !string.IsNullOrEmpty(cmd.data) && 0 != (cmd.data.Length % 4))
                        _log.ErrorFormat("Print error Request.Headers:{0}", oTransportClassTaskResult.m_oHttpContext.Request.Headers.ToString());
                }
                catch { }
                
                byte[] aBuffer = Encoding.ASCII.GetBytes(cmd.data);
                MemoryStream oMemoryStream = new MemoryStream(aBuffer);
                Storage oStorage = new Storage();
                TransportClassStorage oTransportClassStorage = new TransportClassStorage(oTransportClassTaskResult, cmd, oStorage, oMemoryStream, oTaskResultData.sKey);
                oStorage.WriteFileBegin(Path.Combine(oTaskResultData.sKey, sFilename), oMemoryStream, StorageWriteFileAsyncCallback, oTransportClassStorage);
            }
            else
                WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(eError));
        }
        catch
        {
            WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(ErrorTypes.Unknown));
        }
    }