aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Browser/Properties/AssemblyInfo.cs
blob: 70edee491ab6e6029276ee7024c59591332a17f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Tango Web Browser Module")]
[assembly: AssemblyVersion("2.0.1.1407")]

[assembly: ThemeInfo(
    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
                                     //(used if a resource is not found in the page,
                                     // or application resource dictionaries)
    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
                                              //(used if a resource is not found in the page,
                                              // app, or any theme specific resource dictionaries)
)]
me.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using Tango.Editors;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;

/// <exclude/>
/// <summary>
/// A collection of <see cref="IConfiguration"/> extension methods.
/// </summary>
public static class IConfigurationExtensions
{
    /// <summary>
    /// Creates a new instance of the configurable.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="config">The configuration.</param>
    /// <returns></returns>
    public static T CreateConfigurable<T>(this IConfiguration config) where T : class
    {
        return CreateConfigurable<T>(config, new ConfigurationAnimation());
    }

    /// <summary>
    /// Creates a new instance of the exact type provided and apply the configuration.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="config">The configuration.</param>
    /// <returns></returns>
    public static T CreateConfigurableForceType<T>(this IConfiguration config) where T : class
    {
        return CreateConfigurableForceType<T>(config, new ConfigurationAnimation());
    }

    /// <summary>
    /// Creates a new instance of the configurable.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="config">The configuration.</param>
    /// <param name="animation">The animation configuration.</param>
    /// <returns></returns>
    public static T CreateConfigurable<T>(this IConfiguration config, ConfigurationAnimation animation) where T : class
    {
        IConfigurable instance = Activator.CreateInstance(config.ConfigurableType) as IConfigurable;
        instance.SetConfiguration(config, animation);
        return instance as T;
    }

    /// <summary>
    ///  Creates a new instance of the configurable.
    /// </summary>
    /// <param name="config">The configuration.</param>
    /// <returns></returns>
    public static object CreateConfigurable(this IConfiguration config)
    {
        return CreateConfigurable(config, new ConfigurationAnimation());
    }

    /// <summary>
    /// Creates a new instance of the configurable.
    /// </summary>
    /// <param name="config">The configuration.</param>
    /// <param name="animation">The animation.</param>
    /// <returns></returns>
    public static object CreateConfigurable(this IConfiguration config, ConfigurationAnimation animation)
    {
        IConfigurable instance = Activator.CreateInstance(config.ConfigurableType) as IConfigurable;
        instance.SetConfiguration(config, animation);
        return instance;
    }

    /// <summary>
    /// Creates a new instance of the exact type provided and apply the configuration.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="config">The configuration.</param>
    /// <param name="animation">The animation.</param>
    /// <returns></returns>
    public static T CreateConfigurableForceType<T>(this IConfiguration config, ConfigurationAnimation animation) where T : class
    {
        IConfigurable instance = Activator.CreateInstance<T>() as IConfigurable;
        instance.SetConfiguration(config, animation);
        return instance as T;
    }

    /// <summary>
    /// Saves the configuration as a file.
    /// </summary>
    /// <param name="config">The configuration.</param>
    /// <param name="filePath">The file path.</param>
    public static void SaveToFile(this IConfiguration config, String filePath)
    {

        using (FileStream fs = new FileStream(filePath, FileMode.Create))
        {
            BinaryFormatter f = new BinaryFormatter();
            f.Serialize(fs, config);
        }
    }

    /// <summary>
    /// Saves to configuration to a stream.
    /// </summary>
    /// <param name="config">The configuration.</param>
    /// <param name="stream">The stream.</param>
    public static void SaveToStream(this IConfiguration config, Stream stream)
    {
        BinaryFormatter f = new BinaryFormatter();
        f.Serialize(stream, config);
    }
}