// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:06:15
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   com/macromedia/generator/commands/JPEGSetCommand

package com.macromedia.generator.commands;

import com.macromedia.generator.api.Context;
import com.macromedia.generator.api.Script;
import com.macromedia.generator.app.*;
import java.util.Hashtable;
import java.util.Properties;

public class JPEGSetCommand extends GenericCommand
{

    public JPEGSetCommand()
    {
    }

    public void doCommand(FlashEnvironment flashenvironment, Script script, Context context, int i, Properties properties)
        throws FlashCommandException
    {
        Integer integer = new Integer(-1);
        Integer integer1 = new Integer(-1);
        Integer integer2 = new Integer(70);
        Boolean boolean1 = new Boolean(true);
        Boolean boolean2 = (Boolean)flashenvironment.get("JPEGInitialized");
        if(boolean2 != null && boolean2.booleanValue())
        {
            logError(flashenvironment, "MultiJPEGInit", null);
            return;
        }
        String s = context.apply(properties.getProperty("width", "-1"));
        String s1 = context.apply(properties.getProperty("height", "-1"));
        String s2 = context.apply(properties.getProperty("rate", "true"));
        String s3 = context.apply(properties.getProperty("quality", "70"));
        if(!s.equalsIgnoreCase("default"))
            try
            {
                if(Integer.valueOf(s).intValue() > 0)
                    integer = Integer.valueOf(s);
            }
            catch(NumberFormatException _ex)
            {
                logError(flashenvironment, "InvalWidth", null);
            }
        if(!s1.equalsIgnoreCase("default"))
            try
            {
                if(Integer.valueOf(s1).intValue() > 0)
                    integer1 = Integer.valueOf(s1);
            }
            catch(NumberFormatException _ex)
            {
                logError(flashenvironment, "InvalHeight", null);
            }
        if(!s3.equalsIgnoreCase("default"))
            try
            {
                int j = Integer.valueOf(s3).intValue();
                if(j >= 0 && j <= 100)
                    integer2 = Integer.valueOf(s3);
            }
            catch(NumberFormatException _ex)
            {
                logError(flashenvironment, "InvalQuality", null);
            }
        if(!s2.equalsIgnoreCase("true"))
            boolean1 = new Boolean(false);
        flashenvironment.put("JPEGQuality", integer2);
        flashenvironment.put("JPEGWidth", integer);
        flashenvironment.put("JPEGHeight", integer1);
        flashenvironment.put("JPEGProgressive", boolean1);
        flashenvironment.put("JPEGInitialized", new Boolean(true));
    }
}