x2f6133cd59233dfd.cs
上传用户:xlxx0122
上传日期:2015-04-24
资源大小:3904k
文件大小:4k
源码类别:

.net编程

开发平台:

C#

  1. namespace Sunisoft.IrisSkin.Design
  2. {
  3.     using Sunisoft.IrisSkin;
  4.     using System;
  5.     using System.CodeDom;
  6.     using System.ComponentModel;
  7.     using System.ComponentModel.Design.Serialization;
  8.     public class x2f6133cd59233dfd : CodeDomSerializer
  9.     {
  10.         public override object Deserialize(IDesignerSerializationManager manager, object codeDomObject)
  11.         {
  12.             CodeDomSerializer serializer = (CodeDomSerializer) manager.GetSerializer(typeof(SkinEngine).BaseType, typeof(CodeDomSerializer));
  13.             return serializer.Deserialize(manager, codeDomObject);
  14.         }
  15.         public override object Serialize(IDesignerSerializationManager manager, object value)
  16.         {
  17.             object obj2 = ((CodeDomSerializer) manager.GetSerializer(typeof(SkinEngine).BaseType, typeof(CodeDomSerializer))).Serialize(manager, value);
  18.             bool flag = true;
  19.             if (obj2 is CodeStatementCollection)
  20.             {
  21.                 CodeExpression left;
  22.                 CodePropertyReferenceExpression expression4;
  23.                 CodeStatementCollection statements = (CodeStatementCollection) obj2;
  24.                 foreach (CodeStatement statement in statements)
  25.                 {
  26.                     if (statement is CodeAssignStatement)
  27.                     {
  28.                         left = ((CodeAssignStatement) statement).Left;
  29.                         if (left is CodePropertyReferenceExpression)
  30.                         {
  31.                             expression4 = (CodePropertyReferenceExpression) left;
  32.                             if ((expression4.PropertyName == "BuiltIn") && (((CodeAssignStatement) statement).Right is CodePrimitiveExpression))
  33.                             {
  34.                                 CodePrimitiveExpression right = (CodePrimitiveExpression) ((CodeAssignStatement) statement).Right;
  35.                                 if (right.Value is bool)
  36.                                 {
  37.                                     flag = (bool) right.Value;
  38.                                 }
  39.                             }
  40.                         }
  41.                         else if (left is CodeFieldReferenceExpression)
  42.                         {
  43.                             CodeFieldReferenceExpression expression = (CodeFieldReferenceExpression) ((CodeAssignStatement) statement).Left;
  44.                             if ((expression.FieldName == manager.GetName(value)) && (((CodeAssignStatement) statement).Right is CodeObjectCreateExpression))
  45.                             {
  46.                                 CodeObjectCreateExpression expression2 = new CodeObjectCreateExpression(typeof(SkinEngine), new CodeExpression[] { new CodeCastExpression(typeof(Component), new CodeThisReferenceExpression()) });
  47.                                 ((CodeAssignStatement) statement).Right = expression2;
  48.                             }
  49.                         }
  50.                     }
  51.                 }
  52.                 if (flag)
  53.                 {
  54.                     return obj2;
  55.                 }
  56.                 for (int i = statements.Count - 1; i >= 0; i--)
  57.                 {
  58.                     CodeStatement statement2 = statements[i];
  59.                     if (statement2 is CodeAssignStatement)
  60.                     {
  61.                         left = ((CodeAssignStatement) statement2).Left;
  62.                         if (left is CodePropertyReferenceExpression)
  63.                         {
  64.                             expression4 = (CodePropertyReferenceExpression) left;
  65.                             if (expression4.PropertyName == "SkinStream")
  66.                             {
  67.                                 statements.RemoveAt(i);
  68.                             }
  69.                             else if (expression4.PropertyName == "SkinStreamMain")
  70.                             {
  71.                                 statements.RemoveAt(i);
  72.                             }
  73.                         }
  74.                     }
  75.                 }
  76.             }
  77.             return obj2;
  78.         }
  79.     }
  80. }