Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AmfEncoder"/> class.
        ///     Constructor.
        /// </summary>
        /// <param name="encodingOptions">
        /// AMF encoding options.
        /// </param>
        public AmfEncoder(AmfEncodingOptions encodingOptions)
        {
            // Construct the default content type string
            this._contentType = string.Format(
                "{0}; charset={1}",
                AmfEncoderFactory.DefaultAmfMediaType,
                AmfEncoderFactory.DefaultAmfCharSet);

            this._serializer = new DataContractAmfSerializer(typeof(AmfPacket), encodingOptions);
        }
Ejemplo n.º 2
0
    internal void Start(string folderPath, string id, string fullName, string description, string author, string groups, string prereq, int videoQuality, string started)
    {
        frameIndex = -1;
        startTime  = DateTime.Now;
        imageType  = "jpeg";

        if (videoQuality > 0)
        {
            if (AmfSerializer == null)
            {
                AmfSerializer = new DataContractAmfSerializer(typeof(VisualAction), new[] { typeof(ReportSummary), typeof(ReportSummaryError), typeof(VisualElement), typeof(VisualReport), typeof(TestBound) });
            }

            if (videoQuality == 4) // max quality level
            {
                imageType                  = "png";
                animationEncoder           = maxQualityEncoder;
                animationEncoderParameters = maxQualityEncoderParameters;
            }
            else
            {
                animationEncoder           = GetEncoder(ImageFormat.Jpeg);
                animationEncoderParameters = new EncoderParameters(2);

                if (videoQuality == 3) // quality level
                {
                    animationEncoderParameters.Param[1] = new EncoderParameter(Encoder.Quality, 70L);
                    animationEncoderParameters.Param[0] = new EncoderParameter(Encoder.Compression, 70L);
                }
                else if (videoQuality == 2)// speed level
                {
                    animationEncoderParameters.Param[1] = new EncoderParameter(Encoder.Quality, 35L);
                    animationEncoderParameters.Param[0] = new EncoderParameter(Encoder.Compression, 20L);
                }
                else // size level
                {
                    animationEncoderParameters.Param[1] = new EncoderParameter(Encoder.Quality, 10L);
                    animationEncoderParameters.Param[0] = new EncoderParameter(Encoder.Compression, 100L);
                }
            }

            if (visualStream == null)
            {
                AtsvFilePath = folderPath + "\\" + fullName + ".tmp";
                try
                {
                    visualStream  = new BufferedStream(new FileStream(AtsvFilePath, FileMode.Create));
                    currentAction = new VisualReport(id, fullName, description, author, groups, prereq, videoQuality, started);
                }
                catch { }
            }
        }
    }
Ejemplo n.º 3
0
        public AmfEndpointContext(ServiceEndpoint endpoint)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException("endpoint");
            }

            _contracts = new List <Type>();
            ResolveContracts(endpoint);

            ServiceEndpoint = endpoint;
            AmfSerializer   = new DataContractAmfSerializer(typeof(AmfPacket), _contracts);
        }
Ejemplo n.º 4
0
    public string GetDownloadFile()
    {
        if (visualStream != null)
        {
            visualStream.Flush();
            visualStream.Close();
        }

        visualStream  = null;
        AmfSerializer = null;

        return(AtsvFilePath);
    }
Ejemplo n.º 5
0
    internal void Stop()
    {
        Flush();

        if (visualStream != null)
        {
            visualStream.Flush();

            AmfSerializer.WriteObject(visualStream, summary);
            visualStream.Flush();

            visualStream.Close();
        }

        visualStream  = null;
        AmfSerializer = null;
    }