<%@ Property 
    Name="ClassNames" 
    Type="System.String[]" 
    Category="Context" 
    Description="The names of the classes to be generated."             %>
    
<%  string version = "3";                                               %>
<%  string nm = "";                                                     %>
<%  string id = "";                                                     %>
<%  string[] splt = null;                                               %>
    
        #region GenTag
        private void GenTag(ISwfAction tag)
        {
            if(tag.ActionType == SwfActionId.Empty) return;

            switch(tag.ActionType)
            {   
<% for(int i = 0; i < ClassNames.Length; i++)                           %>
<% {    string ln = ClassNames[i];                                      %>
<%      if(ln == "")                                                    %>
<%      {                                                               %>
<%      continue;}else if(ln.StartsWith(@"//"))                         %>
<%      {                                                               %>
<%       version = ln.Substring(2,1);                                   %>
                // Version <%= version %> Tags
<%      continue;}else if(ln.IndexOf(",") != -1)                        %>
<%      {                                                               %>
<%        splt =    ln.Split(new Char[]{','});                          %>
<%        nm = splt[1];                                                 %>
<%        id = splt[0];                                                 %>
<%        string tabLine = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";    %>
<%        string tbs = tabLine.Substring(0, 6-((int)(nm.Length/4)));    %>
                    <% if(splt.Length > 2){ %>
                case SwfActionId.<%= nm %> :
                {
                    Gen((<%= nm %>Action)tag);
                    break;
                }
                    <% } %>
<%      }                                                               %>
<% }                                                                    %>
                default :
                {
                    // if is valid action write tag number etc.
                    if(Enum.IsDefined(tag.ActionType.GetType(), tag.ActionType))
                    {
                        w.WriteByte((byte)(tag.ActionType));
                    }
                    else
                    {
                        throw(new InvalidCastException(
                            "Invalid swf action tag: " + ((int)tag.ActionType) ));
                    }
                    break;
                }
            }
        }
        #endregion


                                            <% for(int i = 0; i < ClassNames.Length; i++)           %>
                                            <% {    string ln = ClassNames[i];                      %>
                                            <%      if(ln == "" || ln.StartsWith(@"//"))            %>
                                            <%      {  continue;                                    %>
                                            <%      }                                               %>
                                            <%      else if(ln.IndexOf(",") != -1)                  %>
                                            <%      {                                               %>
                                            <%        splt = ln.Split(new Char[]{','});             %>
                                            <%        if(splt.Length > 2)                           %>
                                            <%        {  nm = splt[1];                              %>
                                            <%           id = splt[0];                              %>
        #region Gen <%= nm %>Action
        private void Gen(<%= nm %>Action tag)
        {
            w.WriteByte((byte)(tag.ActionType));
                                                        <% for(int j = 2; j < splt.Length; j+=2)            %>
                                                        <% {                                                %>
                                                        <%      string propName = splt[j];                  %>
                                                        <%      string propType = splt[j+1];                %>
<% if(propType == "bool")           %>
<% {                                %>
            w.WriteBit(tag.<%= propName %>);
<% }                                %>
<% else if(propType == "uint")      %>
<% {                                %>
            w.WriteUI16(tag.<%= propName %>);
<% }                                %>
<% else if(propType == "double")        %>
<% {                                %>
            //w.WriteUI32(tag.<%= propName %>);
<% }                                %>
<% else if(propType == "float")     %>
<% {                                %>
            w.WriteFixedBits(tag.<%= propName %>);
<% }                                %>
<% else if(propType == "byte")      %>
<% {                                %>
            w.WriteByte(tag.<%= propName %>);
<% }                                %>
<% else if(propType == "string")    %>
<% {                                %>
            w.WriteString(tag.<%= propName %>);
<% }                                %>
<% else if(propType == "string[]")  %>
<% {                                %>
            for(int i = 0; i < tag.<%= propName %>.Length; i++)
            {
                w.WriteString(tag.<%= propName %>[i]);
            }
<% }                                %>
<% else                             %>
<% {                                %>
            //w.WriteBytes(tag.<%= propName %>); // <%= propType %>
<% }                                %>
                                                        <% }                                                %>

        }
        #endregion
                                            <%          }                                           %>  
                                            <%      }                                               %>  
                                            <% }                                                    %>