Esempio n. 1
0
        ///// <summary>
        ///// Initializes a new instance of the <see cref="ServerWrapper" /> class.
        ///// </summary>
        ///// <param name="plugin">The interface to get access to the plugin.</param>
        ///// <param name="assembly">TAn assembly containing the plug-in.</param>
        ///// <param name="userInterface">The user interaction interface that provides basic functionality to implement user interactivity.</param>
        ///// <param name="configuration">The file path containing the configuration.</param>
        //public ServerWrapper(IConfiguration plugin, Assembly assembly, IGraphicalUserInterface userInterface, string configuration) : this(plugin, assembly, userInterface, BaseDirectoryHelper.Instance.GetBaseDirectory(), configuration) { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerWrapper" /> class.
        /// </summary>
        /// <param name="plugin">The interface to get access to the plugin.</param>
        /// <param name="assembly">TAn assembly containing the plug-in.</param>
        /// <param name="userInterface">The user interaction interface that provides basic functionality to implement user interactivity.</param>
        /// <param name="solutionPath">The solution path.</param>
        /// <param name="configuration">The file path containing the configuration.</param>
        public ServerWrapper(IConfiguration plugin, Assembly assembly, IGraphicalUserInterface userInterface, ISolutionDirectoryPathManagement solutionPath, string configuration)
        {
            this.SolutionPath = solutionPath;
            Initialize(plugin, assembly);
            FileInfo _file = null;

            if (!string.IsNullOrEmpty(configuration))
            {
                //TODO Error while using Save operation #129
                if (!IO.RelativeFilePathsCalculator.TestIfPathIsAbsolute(configuration))
                {
                    _file = new FileInfo(Path.Combine(solutionPath.BaseDirectory, configuration));
                }
                else
                {
                    _file = new FileInfo(configuration);
                }
            }
            if (_file == null)
            {
                Configuration = new ConfigurationWrapper(null, m_Server, userInterface);
            }
            else
            {
                Configuration = new ConfigurationWrapper(_file, m_Server, userInterface);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerWrapper" /> class.
        /// </summary>
        /// <param name="plugin">he interface to get access to the plugin.</param>
        /// <param name="assembly">TAn assembly containing the plug-in.</param>
        /// <param name="userInterface">The user interaction interface that provides basic functionality to implement user interactivity.</param>
        /// <param name="solutionPath">The solution path.</param>
        /// <param name="configuration">The file path containing the configuration.</param>
        public ServerWrapper(IConfiguration plugin, Assembly assembly, IGraphicalUserInterface userInterface, string solutionPath, string configuration)
        {
            Initialize(plugin, assembly);
            FileInfo _file = null;

            if (!string.IsNullOrEmpty(configuration))
            {
                if (!RelativeFilePathsCalculator.TestIfPathIsAbsolute(configuration))
                {
                    _file = new FileInfo(Path.Combine(solutionPath, configuration));
                }
                else
                {
                    _file = new FileInfo(configuration);
                }
            }
            if (_file == null)
            {
                Configuration = new ConfigurationWrapper(null, m_Server, userInterface);
            }
            else
            {
                Configuration = new ConfigurationWrapper(_file, m_Server, userInterface);
            }
        }
Esempio n. 3
0
            /// <summary>
            /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> method.
            /// </summary>
            /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that can be used to gain additional context information.</param>
            /// <param name="provider">An <see cref="T:System.IServiceProvider"/> that this editor can use to obtain services.</param>
            /// <param name="value">The object to edit.</param>
            /// <returns>
            /// The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
            /// </returns>
            public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
            {
                ConfigurationWrapper ptr = context.Instance as ConfigurationWrapper;

                if (ptr == null)
                {
                    return(value);
                }
                ptr.m_ServerConfiguration.EditConfiguration();
                return(value);
            }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerWrapper" /> class.
        /// </summary>
        /// <param name="plugin">The interface to get access to the plugin.</param>
        /// <param name="assembly">The assembly containing the plug-in.</param>
        /// <param name="gui">The user interaction interface that provides basic functionality to implement user interactivity.</param>
        /// <param name="configuration">The file path containing the configuration.</param>
        public ServerWrapper(IConfiguration plugin, IDataProviderDescription assembly, IGraphicalUserInterface gui, string configuration)
        {
            m_Server                      = plugin ?? throw new ArgumentNullException(nameof(plugin));
            PluginDescription             = assembly ?? throw new ArgumentNullException(nameof(plugin));
            m_GraphicalUserInterfaceField = gui ?? throw new ArgumentNullException(nameof(plugin));
            m_Server.OnModified          += new EventHandler <UAServerConfigurationEventArgs>(OnConfigurationDataChangeHandler);
            FileInfo _file = null;

            if (!string.IsNullOrEmpty(configuration))
            {
                if (!Path.IsPathRooted(configuration))
                {
                    throw new ArgumentOutOfRangeException(nameof(configuration));
                }
                _file = new FileInfo(configuration);
            }
            Configuration = new ConfigurationWrapper(_file, m_Server, gui);
        }