/// <summary> /// Registers the web transform in the system. /// </summary> /// <param name="location"> The assembly location.</param> private void RegisterWebTransform(string location) { Assembly assm = Assembly.LoadFile(location); Type[] types = WebTransform.LoadWebTransformsFromAssembly(assm); string configurationSection = "WebTransforms"; WebTransformConfiguration transforms = (WebTransformConfiguration)ConfigManager.Read(configurationSection,false); ArrayList list = new ArrayList(); list.AddRange(transforms.Transforms); transforms.ClearTransformProviders(); ArrayList matchList = new ArrayList(); foreach ( TransformProvider provider in list ) { Type t = Type.GetType(provider.Type); matchList.Add(t); } foreach ( Type type in types ) { if ( !matchList.Contains(type) ) { TransformProvider provider = new TransformProvider(); provider.Type = type.AssemblyQualifiedName; list.Add(provider); } } transforms.Transforms = (TransformProvider[])list.ToArray(typeof(TransformProvider)); // Save Configuration ConfigManager.Write(configurationSection, transforms); }
/// <summary> /// Updates the web transform references. /// </summary> private void UpdateWebTransformsReferences() { WebTransformConfiguration transforms = new WebTransformConfiguration(); ArrayList list = new ArrayList(); foreach ( ListViewItem item in lvWebTransforms.Items ) { // Type name Type type = (Type)item.Tag; TransformProvider provider = new TransformProvider(); provider.Type = type.AssemblyQualifiedName; list.Add(provider); } transforms.Transforms = (TransformProvider[])list.ToArray(typeof(TransformProvider)); // Save Configuration ConfigManager.Write(configurationSection, transforms); }