Пример #1
0
 private bool CSS_insert(ByteClass align_def, ByteClass align_j, ByteClass align_c, ByteClass align_l, ByteClass align_r, ByteClass align, ByteClass bufout, ref int p_ct, ByteClass buf, ref int p_count2, int max, CSS_params CSS_param, ref bool font_color_default, ByteClass font_color_temp, ByteClass color_stack, ref int color_stack_num, ref bool may_use_space, ref bool font_size_default, ByteClass font_size_temp, ArrayList font_list, ArrayList color_list, CSS_tag_type css_tag_type)
 {
     new ByteClass();
     int index = p_ct;
     int num2 = p_count2;
     int num3 = 0;
     int num4 = 0;
     ByteClass class2 = new ByteClass(20);
     int num5 = 0;
     int num6 = 0;
     bool flag = false;
     ByteClass valueStr = new ByteClass(0x40);
     int ct = 0;
     if (bufout.b[index] == 60)
     {
         index++;
     }
     num3 = index;
     num5 = 1;
     num6 = 0;
     while ((index < bufout.len) && (num5 != num6))
     {
         if (bufout.b[index] == 0x3e)
         {
             num6++;
         }
         if (num5 == num6)
         {
             break;
         }
         if (((((bufout.b[index] == 0x73) || (bufout.b[index] == 0x53)) && ((bufout.b[index + 1] == 0x74) || (bufout.b[index + 1] == 0x54))) && (((bufout.b[index + 2] == 0x79) || (bufout.b[index + 2] == 0x59)) && ((bufout.b[index + 3] == 0x6c) || (bufout.b[index + 3] == 0x4c)))) && (((bufout.b[index + 4] == 0x65) || (bufout.b[index + 4] == 0x45)) && (this.IS_DELIMITER(bufout.b[index + 5]) || (bufout.b[index + 5] == 0x3d))))
         {
             index += 6;
             this.ReadValue(bufout, ref index, valueStr);
             break;
         }
         index++;
     }
     int len = valueStr.len;
     index = num3;
     num3 = 0;
     ct = 0;
     CSS_param.found = false;
     num5 = 1;
     num6 = 0;
     while ((index < max) && (num5 != num6))
     {
         if (bufout.b[index] == 0x3e)
         {
             num6++;
         }
         if (num5 == num6)
         {
             break;
         }
         if (((((bufout.b[index] == 0x63) || (bufout.b[index] == 0x43)) && ((bufout.b[index + 1] == 0x6c) || (bufout.b[index + 1] == 0x4c))) && (((bufout.b[index + 2] == 0x61) || (bufout.b[index + 2] == 0x41)) && ((bufout.b[index + 3] == 0x73) || (bufout.b[index + 3] == 0x53)))) && (((bufout.b[index + 4] == 0x73) || (bufout.b[index + 4] == 0x53)) && ((bufout.b[index + 5] == 0x3d) || (bufout.b[index + 5] == 0x20))))
         {
             if (bufout.b[index + 5] == 0x20)
             {
                 index += 6;
             }
             else
             {
                 index += 5;
             }
             this.read_value_exact(bufout, ref index, max, CSS_param.style_name);
             if (CSS_param.style_name.len > 0)
             {
                 CSS_param.found = true;
             }
         }
         if ((((bufout.b[index] == 0x69) || (bufout.b[index] == 0x49)) && ((bufout.b[index + 1] == 100) || (bufout.b[index + 1] == 0x44))) && (bufout.b[index + 2] == 0x3d))
         {
             index += 2;
             this.read_value_exact(bufout, ref index, max, CSS_param.style_name);
             if (CSS_param.style_name.len > 0)
             {
                 CSS_param.found = true;
             }
         }
         if ((((((this._preserveAlignment == 1) && (bufout.b[index] == 0x20)) && ((bufout.b[index + 1] == 0x61) || (bufout.b[index + 1] == 0x41))) && ((bufout.b[index + 2] == 0x6c) || (bufout.b[index + 2] == 0x4c))) && (((bufout.b[index + 3] == 0x69) || (bufout.b[index + 3] == 0x49)) && ((bufout.b[index + 4] == 0x67) || (bufout.b[index + 4] == 0x47)))) && ((bufout.b[index + 5] == 110) || (bufout.b[index + 5] == 0x4e)))
         {
             index += 6;
             this.read_value(bufout, ref index, class2);
             flag = true;
             align.Clear();
             if (class2.byteCmpi("center") == 0)
             {
                 align.Add(@"\qc ");
             }
             else if (class2.byteCmpi("middle") == 0)
             {
                 align.Add(@"\qc ");
             }
             else if (class2.byteCmpi("left") == 0)
             {
                 align.Add(@"\ql ");
             }
             else if (class2.byteCmpi("right") == 0)
             {
                 align.Add(@"\qr ");
             }
             else if (class2.byteCmpi("justify") == 0)
             {
                 align.Add(@"\qj ");
             }
         }
         index++;
     }
     if ((this._preserveAlignment == 1) && flag)
     {
         buf.Add(align);
         num2 += align.len;
     }
     for (num3 = 0; num3 < CSS_param.styles; num3++)
     {
         if (((((CSS_styles)CSS_param.CSS_style[num3]).name.len == 0) && (((CSS_styles)CSS_param.CSS_style[num3]).css_tag_type != CSS_tag_type.UNKNOWN_CSS)) && (((CSS_styles)CSS_param.CSS_style[num3]).css_tag_type == css_tag_type))
         {
             CSS_stack_element _element = new CSS_stack_element();
             CSS_param.stack_tag.Add(_element);
             ((CSS_stack_element)CSS_param.stack_tag[CSS_param.stack_tag_num]).style_index = num3;
             ((CSS_stack_element)CSS_param.stack_tag[CSS_param.stack_tag_num]).css_tag_type = css_tag_type;
             if (CSS_param.stack_tag_num < (this.STK_MAX - 1))
             {
                 CSS_param.stack_tag_num++;
             }
             this.CSS_insert_styles(((CSS_styles)CSS_param.CSS_style[num3]).ablaze, (CSS_styles)CSS_param.CSS_style[num3], CSS_param, align_def, align_j, align_c, align_l, align_r, align, bufout, ref index, buf, ref num2, max, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, css_tag_type);
             break;
         }
     }
     if (css_tag_type != CSS_tag_type.FONT_CSS)
     {
         CSS_styles _styles = new CSS_styles();
         CSS_param.CSS_style_str_stack.Add(_styles);
         this.CSS_reset_style((CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num]);
         if (this.CSS_read_style_params(valueStr, ref ct, len, (CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num], CSS_param, font_list, color_list))
         {
             if (CSS_param.style_str_stack_num > (this.STK_MAX - 1))
             {
                 CSS_param.style_str_stack_num = this.STK_MAX - 1;
             }
             this.CSS_insert_styles(((CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num]).ablaze, (CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num], CSS_param, align_def, align_j, align_c, align_l, align_r, align, bufout, ref index, buf, ref num2, max, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, css_tag_type);
             ((CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num]).css_tag_type = css_tag_type;
             if (CSS_param.style_str_stack_num < (this.STK_MAX - 1))
             {
                 CSS_param.style_str_stack_num++;
             }
         }
         else
         {
             CSS_param.CSS_style_str_stack.RemoveAt(CSS_param.style_str_stack_num);
         }
     }
     if (CSS_param.found)
     {
         CSS_param.found = false;
         num3 = 0;
         while (num3 < CSS_param.styles)
         {
             if ((((CSS_styles)CSS_param.CSS_style[num3]).name.byteCmp(CSS_param.style_name) == 0) && ((((CSS_styles)CSS_param.CSS_style[num3]).css_tag_type == css_tag_type) || (((CSS_styles)CSS_param.CSS_style[num3]).css_tag_type == CSS_tag_type.UNKNOWN_CSS)))
             {
                 CSS_param.found = true;
                 break;
             }
             num3++;
         }
         if (CSS_param.found)
         {
             CSS_stack_element _element2 = new CSS_stack_element();
             CSS_param.stack.Add(_element2);
             ((CSS_stack_element)CSS_param.stack[CSS_param.stack_num]).style_index = num3;
             ((CSS_stack_element)CSS_param.stack[CSS_param.stack_num]).css_tag_type = css_tag_type;
             if (CSS_param.stack_num < (this.STK_MAX - 1))
             {
                 CSS_param.stack_num++;
             }
             for (num4 = 0; num4 < this.STYLES_KNOW; num4++)
             {
                 CSS_param.ablaze.b[num4] = ((CSS_styles)CSS_param.CSS_style[num3]).ablaze.b[num4];
             }
             this.CSS_insert_styles(CSS_param.ablaze, (CSS_styles)CSS_param.CSS_style[num3], CSS_param, align_def, align_j, align_c, align_l, align_r, align, bufout, ref index, buf, ref num2, max, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, css_tag_type);
             if (css_tag_type == CSS_tag_type.SPAN_CSS)
             {
                 CSS_param.span++;
             }
             else if (css_tag_type == CSS_tag_type.DIV_CSS)
             {
                 CSS_param.div++;
             }
             else if (css_tag_type == CSS_tag_type.P_CSS)
             {
                 CSS_param.p_tag_open++;
             }
             else if (css_tag_type == CSS_tag_type.EM_CSS)
             {
                 CSS_param.em_tag_open++;
             }
             else if (css_tag_type == CSS_tag_type.FONT_CSS)
             {
                 CSS_param.font_tag_open++;
             }
         }
     }
     p_ct = index;
     p_count2 = num2;
     return CSS_param.found;
 }
Пример #2
0
 private bool CSS_del_from_stack_tag(ref int style_num, CSS_params CSS_param, CSS_tag_type css_tag_type)
 {
     int num = 0;
     int num2 = 0;
     CSS_stack_element _element = new CSS_stack_element();
     if (CSS_param.stack_tag_num <= 0)
     {
         CSS_param.stack_tag_num = 0;
         return false;
     }
     num2 = CSS_param.stack_tag_num - 1;
     CSS_param.found = false;
     while (num2 >= 0)
     {
         if (((CSS_stack_element)CSS_param.stack_tag[num2]).css_tag_type == css_tag_type)
         {
             CSS_param.found = true;
             num = num2;
             break;
         }
         num2--;
     }
     if (!CSS_param.found)
     {
         return false;
     }
     if (num > 0)
     {
         CSS_param.CSS_style_default = (CSS_styles)CSS_param.CSS_style[num - 1];
         style_num = num;
     }
     if ((num + 1) != CSS_param.stack_tag_num)
     {
         for (num2 = num; (num2 < CSS_param.stack_tag_num) && (num2 < (CSS_param.stack_tag.Count - 1)); num2++)
         {
             _element = (CSS_stack_element)CSS_param.stack_tag[num2 + 1];
             CSS_param.stack_tag[num2] = _element;
         }
     }
     CSS_param.stack_tag_num--;
     return true;
 }