当前位置: 首页>>代码示例>>C#>>正文


C# Serialization.WorkflowMarkupSerializationManager类代码示例

本文整理汇总了C#中System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationManager的典型用法代码示例。如果您正苦于以下问题:C# WorkflowMarkupSerializationManager类的具体用法?C# WorkflowMarkupSerializationManager怎么用?C# WorkflowMarkupSerializationManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WorkflowMarkupSerializationManager类属于System.Workflow.ComponentModel.Serialization命名空间,在下文中一共展示了WorkflowMarkupSerializationManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateInstance

 protected override object CreateInstance(WorkflowMarkupSerializationManager serializationManager, Type type)
 {
     if (typeof(PropertySegment) == type)
         return Activator.CreateInstance(type, new object[] { serializationManager as IServiceProvider, serializationManager.Context.Current });
     else
         return base.CreateInstance(serializationManager, type);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:PropertySegmentSerializer.cs

示例2: AddChild

 protected internal override void AddChild(WorkflowMarkupSerializationManager serializationManager, object obj, object childObj)
 {
     if (this.containedSerializer != null)
     {
         this.containedSerializer.AddChild(serializationManager, obj, childObj);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:PropertySegmentSerializer.cs

示例3: CanSerializeToString

        protected internal override bool CanSerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
        {
            bool canSerializeToString = false;
            if (value != null)
            {
                ITypeDescriptorContext context = null;
                TypeConverter converter = GetTypeConversionInfoForPropertySegment(serializationManager, value.GetType(), out context);
                if (converter != null)
                    canSerializeToString = converter.CanConvertTo(context, typeof(string));

                if (!canSerializeToString)
                {
                    if (this.containedSerializer != null)
                        canSerializeToString = this.containedSerializer.CanSerializeToString(serializationManager, value);
                    else
                        canSerializeToString = base.CanSerializeToString(serializationManager, value);
                }
            }
            else
            {
                canSerializeToString = true;
            }

            return canSerializeToString;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:PropertySegmentSerializer.cs

示例4: AddChild

 protected internal override void AddChild(WorkflowMarkupSerializationManager serializationManager, object parentObj, object childObj)
 {
     if (parentObj == null)
     {
         throw new ArgumentNullException("parentObj");
     }
     if (childObj == null)
     {
         throw new ArgumentNullException("childObj");
     }
     IDictionary dictionary = parentObj as IDictionary;
     if (dictionary == null)
     {
         throw new InvalidOperationException(SR.GetString("Error_DictionarySerializerNonDictionaryObject"));
     }
     object key = null;
     foreach (DictionaryEntry entry in this.keylookupDictionary)
     {
         if ((!entry.Value.GetType().IsValueType && (entry.Value == childObj)) || (entry.Value.GetType().IsValueType && entry.Value.Equals(childObj)))
         {
             key = entry.Key;
             break;
         }
     }
     if (key == null)
     {
         throw new InvalidOperationException(SR.GetString("Error_DictionarySerializerKeyNotFound", new object[] { childObj.GetType().FullName }));
     }
     dictionary.Add(key, childObj);
     this.keylookupDictionary.Remove(key);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:DictionaryMarkupSerializer.cs

示例5: DeserializeFromString

 protected internal override object DeserializeFromString(WorkflowMarkupSerializationManager serializationManager, Type propertyType, string value)
 {
     if (serializationManager == null)
     {
         throw new ArgumentNullException("serializationManager");
     }
     if (propertyType == null)
     {
         throw new ArgumentNullException("propertyType");
     }
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (string.Equals(value, "*null", StringComparison.Ordinal))
     {
         return null;
     }
     ITypeDescriptorContext context = null;
     TypeConverter converter = this.GetTypeConversionInfoForPropertySegment(serializationManager, propertyType, out context);
     if ((converter != null) && converter.CanConvertFrom(context, typeof(string)))
     {
         return converter.ConvertFromString(context, value);
     }
     if (this.containedSerializer != null)
     {
         return this.containedSerializer.DeserializeFromString(serializationManager, propertyType, value);
     }
     return base.DeserializeFromString(serializationManager, propertyType, value);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:PropertySegmentSerializer.cs

示例6: DeserializeFromString

        protected internal override object DeserializeFromString(WorkflowMarkupSerializationManager serializationManager, Type propertyType, string value)
        {
            if (!propertyType.IsAssignableFrom(typeof(CodeTypeReference)))
                return null;

            // if the string is empty or markup extension,
            // then the object is null
            if (string.IsNullOrEmpty(value) || IsValidCompactAttributeFormat(value))
                return null;

            // value is the fully qualified name of the type
            // however, it may refer to non-existant assemblies, so we may get an error
            CodeTypeReference result;
            try
            {
                Type type = serializationManager.GetType(value);
                if (type != null)
                {
                    result = new CodeTypeReference(type);
                    result.UserData[QualifiedName] = type.AssemblyQualifiedName;
                    return result;
                }
            }
            catch (Exception)
            {
                // something went wrong getting the type, so simply pass in the string and
                // let CodeTypeReference figure it out. Note that CodeTypeReference has a method
                // RipOffAssemblyInformationFromTypeName, so assembly names are ignored.
            }
            result = new CodeTypeReference(value);
            result.UserData[QualifiedName] = value;
            return result;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:33,代码来源:CodeTypeReferenceSerializer.cs

示例7: DeserializeFromString

 protected internal override object DeserializeFromString(WorkflowMarkupSerializationManager serializationManager, Type propertyType, string value)
 {
     CodeTypeReference reference;
     if (!propertyType.IsAssignableFrom(typeof(CodeTypeReference)))
     {
         return null;
     }
     if (string.IsNullOrEmpty(value) || base.IsValidCompactAttributeFormat(value))
     {
         return null;
     }
     try
     {
         Type type = serializationManager.GetType(value);
         if (type != null)
         {
             reference = new CodeTypeReference(type);
             reference.UserData["QualifiedName"] = type.AssemblyQualifiedName;
             return reference;
         }
     }
     catch (Exception)
     {
     }
     reference = new CodeTypeReference(value);
     reference.UserData["QualifiedName"] = value;
     return reference;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:CodeTypeReferenceSerializer.cs

示例8: GetProperties

 protected internal override PropertyInfo[] GetProperties(WorkflowMarkupSerializationManager serializationManager, object obj)
 {
     if (serializationManager == null)
     {
         throw new ArgumentNullException("serializationManager");
     }
     if (obj == null)
     {
         throw new ArgumentNullException("obj");
     }
     XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter;
     PropertyInfo[] properties = base.GetProperties(serializationManager, obj);
     FreeformActivityDesigner designer = obj as FreeformActivityDesigner;
     if (designer == null)
     {
         return properties;
     }
     List<PropertyInfo> list = new List<PropertyInfo>();
     foreach (PropertyInfo info in properties)
     {
         if (((writer == null) || !info.Name.Equals("AutoSizeMargin", StringComparison.Ordinal)) || (designer.AutoSizeMargin != FreeformActivityDesigner.DefaultAutoSizeMargin))
         {
             list.Add(info);
         }
     }
     list.Add(typeof(FreeformActivityDesigner).GetProperty("DesignerConnectors", BindingFlags.NonPublic | BindingFlags.Instance));
     return list.ToArray();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:FreeformActivityDesignerLayoutSerializer.cs

示例9: OnBeforeSerializeContents

        internal override void OnBeforeSerializeContents(WorkflowMarkupSerializationManager serializationManager, object obj)
        {
            base.OnBeforeSerializeContents(serializationManager, obj);

            //For root activity we will go through all the nested activities and put the namespaces at the top level
            CompositeActivity compositeActivity = obj as CompositeActivity;
            XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter;
            if (compositeActivity.Parent == null && writer != null)
            {
                Dictionary<string, Activity> writtenMappings = new Dictionary<string, Activity>();

                string prefix = String.Empty;
                XmlQualifiedName xmlQualifiedName = serializationManager.GetXmlQualifiedName(compositeActivity.GetType(), out prefix);
                writtenMappings.Add(xmlQualifiedName.Namespace, compositeActivity);

                foreach (Activity containedActivity in Helpers.GetNestedActivities(compositeActivity))
                {
                    prefix = String.Empty;
                    xmlQualifiedName = serializationManager.GetXmlQualifiedName(containedActivity.GetType(), out prefix);
                    if (!writtenMappings.ContainsKey(xmlQualifiedName.Namespace))
                    {
                        writer.WriteAttributeString("xmlns", prefix, null, xmlQualifiedName.Namespace);
                        writtenMappings.Add(xmlQualifiedName.Namespace, containedActivity);
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:27,代码来源:CompositeActivityMarkupSerializer.cs

示例10: ClearChildren

 protected internal override void ClearChildren(WorkflowMarkupSerializationManager serializationManager, object obj)
 {
     if (this.containedSerializer != null)
     {
         this.containedSerializer.ClearChildren(serializationManager, obj);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:PropertySegmentSerializer.cs

示例11: GetInstanceDescriptor

 protected override InstanceDescriptor GetInstanceDescriptor(WorkflowMarkupSerializationManager serializationManager, object value)
 {
     ActivityBind activityBind = value as ActivityBind;
     if (activityBind == null)
         throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(ActivityBind).FullName), "value");
     return new InstanceDescriptor(typeof(ActivityBind).GetConstructor(new Type[] { typeof(string) }),
         new object[] { activityBind.Name });
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:BindMarkupExtensionSerializer.cs

示例12: OnBeforeSerialize

        protected override void OnBeforeSerialize(WorkflowMarkupSerializationManager serializationManager, object obj)
        {
            if (serializationManager == null)
                throw new ArgumentNullException("serializationManager");
            if (obj == null)
                throw new ArgumentNullException("obj");

            Activity activity = obj as Activity;
            if (activity == null)
                throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(Activity).FullName), "obj");

            XmlWriter writer = serializationManager.WorkflowMarkupStack[typeof(XmlWriter)] as XmlWriter;
            if (writer == null)
            {
                //We should not throw an exception here as both of the above properties are internal and
                //our serializer makes sure that they are always set. Note that OnBeforeSerialize can be 
                //only called by WorkflowMarkupSerializer.
                Debug.Assert(false);
                return;
            }

            StringWriter stringWriter = serializationManager.WorkflowMarkupStack[typeof(StringWriter)] as StringWriter;
            if (stringWriter != null)
            {
                // we capture the start and end line of the activity getting serialized to xoml
                writer.Flush();
                string currentXoml = stringWriter.ToString();
                int startLine = 0;
                int currentIndex = 0;
                string newLine = stringWriter.NewLine;
                int newLineLength = newLine.Length;

                // Get to the starting line of this activity.
                while (true)
                {
                    int nextNewLineIndex = currentXoml.IndexOf(newLine, currentIndex, StringComparison.Ordinal);
                    if (nextNewLineIndex == -1)
                        break;

                    currentIndex = nextNewLineIndex + newLineLength;
                    startLine++;
                }

                // We always serialize an element start tag onto exactly 1 line.
                activity.SetValue(ActivityMarkupSerializer.StartLineProperty, startLine);
                activity.SetValue(ActivityMarkupSerializer.EndLineProperty, startLine);

                // Cache the index of the beginning of the line.
                activity.SetValue(ActivityMarkupSerializer.EndColumnProperty, currentIndex);
                activity.SetValue(ActivityMarkupSerializer.StartColumnProperty, (currentXoml.IndexOf('<', currentIndex) - currentIndex + 1));
            }

            // write x:Class attribute
            string className = activity.GetValue(WorkflowMarkupSerializer.XClassProperty) as string;
            if (className != null)
                writer.WriteAttributeString(StandardXomlKeys.Definitions_XmlNs_Prefix, StandardXomlKeys.Definitions_Class_LocalName, StandardXomlKeys.Definitions_XmlNs, className);

        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:58,代码来源:ActivityMarkupSerializer.cs

示例13: SerializeToString

        protected internal override string SerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
        {
            if (serializationManager == null)
                throw new ArgumentNullException("serializationManager");
            if (value == null)
                throw new ArgumentNullException("value");

            return SynchronizationHandlesTypeConverter.Stringify(value as ICollection<String>);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:StringCollectionMarkupSerializer.cs

示例14: CanSerializeToString

        protected internal override bool CanSerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
        {
            if (serializationManager == null)
                throw new ArgumentNullException("serializationManager");
            if (value == null)
                throw new ArgumentNullException("value");

            return (value is ICollection<String>);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:StringCollectionMarkupSerializer.cs

示例15: SerializeToString

 protected internal override string SerializeToString(WorkflowMarkupSerializationManager serializationManager, object value)
 {
     TypeConverter converter = TypeDescriptor.GetConverter(value);
     if ((converter != null) && converter.CanConvertTo(typeof(string)))
     {
         return (converter.ConvertTo(value, typeof(string)) as string);
     }
     return base.SerializeToString(serializationManager, value);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:SizeMarkupSerializer.cs


注:本文中的System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。