Ejemplo n.º 1
0
    private void AddTask(InputCommand cmd, TransportClassMainAshx oTransportClassMainAshx)
    {
        try
        {
            
            int nToFormat = FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS;

            TaskQueueData oTaskQueueData = new TaskQueueData(cmd.id, nToFormat, "Editor.bin");

            oTaskQueueData.m_sFromUrl = cmd.url;
            oTaskQueueData.m_sFromFormat = cmd.format;

            if (cmd.codepage.HasValue)
                oTaskQueueData.m_nCsvTxtEncoding = cmd.codepage.Value;
            if (cmd.delimiter.HasValue)
                oTaskQueueData.m_nCsvDelimiter = cmd.delimiter.Value;
            oTaskQueueData.m_bEmbeddedFonts = false;

            CTaskQueue oTaskQueue = new CTaskQueue();
            TransportClassTaskQueue oTransportClassTaskQueue = new TransportClassTaskQueue(oTransportClassMainAshx, oTaskQueue, null);

            oTaskQueue.AddTaskBegin(oTaskQueueData, Priority.High, TaskQueueAddCallback, oTransportClassTaskQueue);
			
            WriteOutputCommand(oTransportClassTaskQueue, new OutputCommand("waitopen", "0"));
        }
        catch
        {
            WriteOutputCommand(oTransportClassMainAshx, new OutputCommand(ErrorTypes.Unknown));
        }
    }
Ejemplo n.º 2
0
    private void TaskResultUpdateCallback(IAsyncResult ar)
    {
        TransportClassTaskResult oTransportClassTaskResult = ar.AsyncState as TransportClassTaskResult;
        try
        {
            ErrorTypes eError = oTransportClassTaskResult.m_oTaskResult.UpdateEnd(ar);
            if (ErrorTypes.NoError == eError)
            {
                
                InputCommand cmd = oTransportClassTaskResult.m_oInputCommand;
                int nToFormat = FileFormats.AVS_OFFICESTUDIO_FILE_CANVAS;
                TaskQueueData oTaskQueueData = new TaskQueueData(cmd.id, nToFormat, "Editor.bin");
                if ("reopen" == cmd.c)
                {
                    oTaskQueueData.m_sFromKey = cmd.id;
                    oTaskQueueData.m_bFromSettings = true;
                }
                else
                    oTaskQueueData.m_sFromUrl = cmd.url;

                oTaskQueueData.m_sFromFormat = cmd.format;
                if (cmd.codepage.HasValue)
                    oTaskQueueData.m_nCsvTxtEncoding = cmd.codepage.Value;
                if (cmd.delimiter.HasValue)
                    oTaskQueueData.m_nCsvDelimiter = cmd.delimiter.Value;
                oTaskQueueData.m_bEmbeddedFonts = false;

                CTaskQueue oTaskQueue = new CTaskQueue();
                TransportClassTaskQueue oTransportClassTaskQueue = new TransportClassTaskQueue(oTransportClassTaskResult, oTaskQueue, null);
                oTaskQueue.AddTaskBegin(oTaskQueueData, Priority.High, TaskQueueAddCallback, oTransportClassTaskQueue);

				WriteOutputCommand(oTransportClassTaskQueue, new OutputCommand("waitopen", "0"));
            }
            else
                WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(eError));
        }
        catch
        {
            WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(ErrorTypes.Unknown));
        }
    }
Ejemplo n.º 3
0
    private void TaskResultAddRandomKeyAsyncCallback2(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;
                TaskQueueData oTaskQueueData = new TaskQueueData(oTaskResultData.sKey, FileFormats.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF, "output.pdf");
                oTaskQueueData.m_sFromKey = cmd.id;
                oTaskQueueData.m_sFromFormat = "pdf";
                oTaskQueueData.m_bFromOrigin = true;
                if (cmd.codepage.HasValue)
                    oTaskQueueData.m_nCsvTxtEncoding = cmd.codepage.Value;
                if (cmd.delimiter.HasValue)
                    oTaskQueueData.m_nCsvDelimiter = cmd.delimiter.Value;
                if (null != cmd.vkey)
                {
                    
                    bool bPaid;
                    Signature.getVKeyParams(cmd.vkey, out bPaid);
                    oTaskQueueData.m_bPaid = bPaid;
                }

                CTaskQueue oTaskQueue = new CTaskQueue();
                TransportClassTaskQueue oTransportClassTaskQueue = new TransportClassTaskQueue(oTransportClassTaskResult, oTaskQueue, oTaskQueueData);
                oTaskQueue.AddTaskBegin(oTaskQueueData, Priority.Low, TaskQueueAddCallbackSave, oTransportClassTaskQueue);
            }
            else
                WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(eError));
        }
        catch
        {
            WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(ErrorTypes.Unknown));
        }
    }
Ejemplo n.º 4
0
    private void StorageWriteFileAsyncCallback(IAsyncResult ar)
    {
        TransportClassStorage oTransportClassStorage = ar.AsyncState as TransportClassStorage;
        try
        {
            int nReadWriteBytes;
            ErrorTypes eError = oTransportClassStorage.m_oStorage.WriteFileEnd(ar, out nReadWriteBytes);
            if (null != oTransportClassStorage.m_oStream)
                oTransportClassStorage.m_oStream.Dispose();
            if (ErrorTypes.NoError == eError)
            {
                InputCommand cmd = oTransportClassStorage.m_oInputCommand;
                if (c_sSaveTypeCompleteAll == cmd.savetype || c_sSaveTypeComplete == cmd.savetype)
                {
                    
                    int nOutputFormat = cmd.outputformat.Value;
                    TaskQueueData oTaskQueueData = new TaskQueueData(oTransportClassStorage.m_sKey, nOutputFormat, "output." + FileFormats.ToString(nOutputFormat));
                    oTaskQueueData.m_sFromKey = cmd.id;
                    oTaskQueueData.m_sFromFormat = "bin";
                    if (cmd.codepage.HasValue)
                        oTaskQueueData.m_nCsvTxtEncoding = cmd.codepage.Value;
                    if (cmd.delimiter.HasValue)
                        oTaskQueueData.m_nCsvDelimiter = cmd.delimiter.Value;
                    if (null != cmd.vkey)
                    {
                        bool bPaid;
                        Signature.getVKeyParams(cmd.vkey, out bPaid);
                        oTaskQueueData.m_bPaid = bPaid;
                    }

                    Priority oPriority = Priority.Low;
                    if (cmd.innersave)
                        oPriority = Priority.Normal;
                    CTaskQueue oTaskQueue = new CTaskQueue();
                    TransportClassTaskQueue oTransportClassTaskQueue = new TransportClassTaskQueue(oTransportClassStorage, oTaskQueue, oTaskQueueData);
                    oTaskQueue.AddTaskBegin(oTaskQueueData, oPriority, TaskQueueAddCallbackSave, oTransportClassTaskQueue);
                }
                else
                {
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    OutputSavePartData oOutputSavePartData = new OutputSavePartData(oTransportClassStorage.m_sKey, cmd.outputformat.Value);
                    WriteOutputCommand(oTransportClassStorage, new OutputCommand("savepart", serializer.Serialize(oOutputSavePartData)));
                }
            }
            else
                WriteOutputCommand(oTransportClassStorage, new OutputCommand(eError));

        }
        catch
        {
            WriteOutputCommand(oTransportClassStorage, new OutputCommand(ErrorTypes.Unknown));
        }
    }
Ejemplo n.º 5
0
    private void ChangesWriteCallback(IAsyncResult ar)
    {
        TransportClassStorage2 oTransportClassStorage = ar.AsyncState as TransportClassStorage2;
        try
        {
            int nReadWriteBytes;
            oTransportClassStorage.m_oStorage.WriteFileEnd(ar, out nReadWriteBytes);
            if (null != oTransportClassStorage.m_oStream)
                oTransportClassStorage.m_oStream.Dispose();
            InputCommand cmd = oTransportClassStorage.m_oInputCommand;
            if (c_sSaveTypeComplete == cmd.savetype || c_sSaveTypeCompleteAll == cmd.savetype)
            {
                
                int nOutputFormat = cmd.outputformat.HasValue ? cmd.outputformat.Value : FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_TEAMLAB_INNER;
                TaskQueueData oTaskQueueData = new TaskQueueData(oTransportClassStorage.m_sKey, nOutputFormat, "output." + FileFormats.ToString(nOutputFormat));
                oTaskQueueData.m_sFromKey = cmd.id;
                oTaskQueueData.m_sFromFormat = "bin";
                if (cmd.codepage.HasValue)
                    oTaskQueueData.m_nCsvTxtEncoding = cmd.codepage.Value;
                if (cmd.delimiter.HasValue)
                    oTaskQueueData.m_nCsvDelimiter = cmd.delimiter.Value;
                if (null != cmd.vkey)
                {
                    bool bPaid;
                    Signature.getVKeyParams(cmd.vkey, out bPaid);
                    oTaskQueueData.m_bPaid = bPaid;
                }
                Priority oPriority = Priority.Low;
                if (cmd.innersave)
                    oPriority = Priority.Normal;
                CTaskQueue oTaskQueue = new CTaskQueue();
                TransportClassTaskQueue oTransportClassTaskQueue = new TransportClassTaskQueue(oTransportClassStorage, oTaskQueue, oTaskQueueData);
                oTaskQueue.AddTaskBegin(oTaskQueueData, oPriority, TaskQueueAddCallbackSave, oTransportClassTaskQueue);
            }
            else
                WriteOutputCommand(oTransportClassStorage, oTransportClassStorage.m_oOutputCommand);
        }
        catch(Exception e)
        {
			_log.Error("Exception catched in ChangesWriteCallback:", e);
            WriteOutputCommand(oTransportClassStorage, new OutputCommand(ErrorTypes.Unknown));
        }
    }
Ejemplo n.º 6
0
 public TransportClassTaskQueue(TransportClassMainAshx oTransportClassMainAshx, CTaskQueue oTaskQueue, object oParam)
     : base(oTransportClassMainAshx.m_oHttpContext, oTransportClassMainAshx.m_oAsyncCallback)
 {
     m_oTaskQueue = oTaskQueue;
     m_oParam = oParam;
 }
Ejemplo n.º 7
0
 private void TaskResultAddRandomKeyAsyncCallback3(IAsyncResult ar)
 {
     TransportClassSaveChanges1 oTransportClassSaveChanges = ar.AsyncState as TransportClassSaveChanges1;
     try
     {
         InputCommand cmd = oTransportClassSaveChanges.m_oInputCommand;
         _log.DebugFormat("Enter TaskResultAddRandomKeyAsyncCallback3(id={0})", cmd.id);
         TaskResultData oTaskResultData;
         ErrorTypes eError = oTransportClassSaveChanges.m_oTaskResult.AddRandomKeyEnd(ar, out oTaskResultData);
         if (ErrorTypes.NoError == eError)
         {
             
             string sFilename = "output.zip";
             
             int nOutputFormat = FileFormats.AVS_OFFICESTUDIO_FILE_OTHER_TEAMLAB_INNER;
             if(cmd.outputformat.HasValue)
             {
                 nOutputFormat = cmd.outputformat.Value;
                 sFilename = "output." + FileFormats.ToString(nOutputFormat);
             }
             TaskQueueData oTaskQueueData = new TaskQueueData(oTaskResultData.sKey, nOutputFormat, sFilename);
             oTaskQueueData.m_sFromKey = cmd.id;
             oTaskQueueData.m_sFromFormat = "bin";
             oTaskQueueData.m_bFromChanges = true;
             if (cmd.codepage.HasValue)
                 oTaskQueueData.m_nCsvTxtEncoding = cmd.codepage.Value;
             if (cmd.delimiter.HasValue)
                 oTaskQueueData.m_nCsvDelimiter = cmd.delimiter.Value;
             if (null != cmd.vkey)
             {
                 bool bPaid;
                 Signature.getVKeyParams(cmd.vkey, out bPaid);
                 oTaskQueueData.m_bPaid = bPaid;
             }
             Priority oPriority = Priority.Low;
             if (cmd.innersave)
                 oPriority = Priority.Normal;
             oTaskQueueData.m_sResultCallbackUrl = UrlBuilder.FullUrl(oTransportClassSaveChanges.m_oHttpContext.Request);
             InputCommand oSaveCommand = new InputCommand();
             oSaveCommand.c = "sfcc";
             oSaveCommand.id = cmd.id;
             oSaveCommand.task_queue_data = oTaskQueueData;
             oSaveCommand.url = cmd.url;
             oSaveCommand.status = (int)oTransportClassSaveChanges.m_oTaskResultDataToUpdate.eStatus.Value;
             oSaveCommand.status_info = oTransportClassSaveChanges.m_oTaskResultDataToUpdate.nStatusInfo.Value;
             oTaskQueueData.m_sResultCallbackData = InputCommand.SerializeToJson(oSaveCommand);
             _log.DebugFormat("oTaskQueueData.m_sResultCallbackData = {0}(id={1})", oTaskQueueData.m_sResultCallbackData, cmd.id);
             CTaskQueue oTaskQueue = new CTaskQueue();
             oTransportClassSaveChanges.m_oTaskQueue = oTaskQueue;
             oTransportClassSaveChanges.m_oTaskQueueData = oTaskQueueData;
             oTaskQueue.AddTaskBegin(oTaskQueueData, oPriority, TaskQueueAddCallbackSave2, oTransportClassSaveChanges);
         }
         else
         {
             _log.ErrorFormat("Error in TaskResultAddRandomKeyAsyncCallback3(code={0})", (int)eError);
             WriteOutputCommand(oTransportClassSaveChanges, new OutputCommand(eError));
         }
     }
     catch(Exception e)
     {
         _log.Error("Exception catched in TaskResultAddRandomKeyAsyncCallback3:", e);
         WriteOutputCommand(oTransportClassSaveChanges, new OutputCommand(ErrorTypes.Unknown));
     }
 }
Ejemplo n.º 8
0
    private void TaskResultAddRandomKeyAsyncCallback4(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;
                TaskQueueData oTaskQueueData = new TaskQueueData(oTaskResultData.sKey, cmd.outputformat.Value, "output." + FileFormats.ToString(cmd.outputformat.Value));
                oTaskQueueData.m_sFromKey = cmd.id;
                oTaskQueueData.m_sFromFormat = "doct";
                oTaskQueueData.m_bFromChanges = true;

                CTaskQueue oTaskQueue = new CTaskQueue();
                TransportClassTaskQueue oTransportClassTaskQueue = new TransportClassTaskQueue(oTransportClassTaskResult, oTaskQueue, oTaskQueueData);
                oTaskQueue.AddTaskBegin(oTaskQueueData, Priority.Low, TaskQueueAddCallbackSave3, oTransportClassTaskQueue);
            }
            else
                WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(eError));
        }
        catch
        {
            WriteOutputCommand(oTransportClassTaskResult, new OutputCommand(ErrorTypes.Unknown));
        }
    }
 public TransportClass1(TransportClassMainAshx oTransportClassMainAshx, ITaskResultInterface oTaskResult, CTaskQueue oTaskQueue, InputParams oInputParams)
     : base(oTransportClassMainAshx.m_oHttpContext, oTransportClassMainAshx.m_oAsyncCallback)
 {
     m_oTaskResult = oTaskResult;
     m_oInputParams = oInputParams;
     m_oTaskQueue = oTaskQueue;
     m_oTimer = null;
 }