diff --git a/Sunfish/Sunfish/FServiceConf.Designer.cs b/Sunfish/Sunfish/FServiceConf.Designer.cs index 2ec6df4..00b91a6 100644 --- a/Sunfish/Sunfish/FServiceConf.Designer.cs +++ b/Sunfish/Sunfish/FServiceConf.Designer.cs @@ -28,11 +28,15 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.lbType = new System.Windows.Forms.Label(); this.cbType = new System.Windows.Forms.ComboBox(); this.lbName = new System.Windows.Forms.Label(); this.tbName = new System.Windows.Forms.TextBox(); this.cbActive = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.SuspendLayout(); // // lbType @@ -52,6 +56,7 @@ this.cbType.Name = "cbType"; this.cbType.Size = new System.Drawing.Size(353, 28); this.cbType.TabIndex = 1; + this.toolTip1.SetToolTip(this.cbType, "Type of service."); // // lbName // @@ -70,6 +75,7 @@ this.tbName.Name = "tbName"; this.tbName.Size = new System.Drawing.Size(269, 26); this.tbName.TabIndex = 3; + this.toolTip1.SetToolTip(this.tbName, "Name of the service.\r\n(only for management)"); // // cbActive // @@ -82,11 +88,30 @@ this.cbActive.Text = "Active"; this.cbActive.UseVisualStyleBackColor = true; // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 143); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(74, 20); + this.label1.TabIndex = 5; + this.label1.Text = "Location:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(25, 166); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(353, 26); + this.textBox1.TabIndex = 6; + this.toolTip1.SetToolTip(this.textBox1, "Document root on the server:\r\nThis works as a virtual directory in the url."); + // // FServiceConf // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(401, 408); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); this.Controls.Add(this.cbActive); this.Controls.Add(this.tbName); this.Controls.Add(this.lbName); @@ -109,5 +134,8 @@ private System.Windows.Forms.Label lbName; private System.Windows.Forms.TextBox tbName; private System.Windows.Forms.CheckBox cbActive; + private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; } } \ No newline at end of file diff --git a/Sunfish/Sunfish/FServiceConf.resx b/Sunfish/Sunfish/FServiceConf.resx index 1af7de1..df8339b 100644 --- a/Sunfish/Sunfish/FServiceConf.resx +++ b/Sunfish/Sunfish/FServiceConf.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/Sunfish/Sunfish/Services/AdminService.cs b/Sunfish/Sunfish/Services/AdminService.cs new file mode 100644 index 0000000..6e82aa7 --- /dev/null +++ b/Sunfish/Sunfish/Services/AdminService.cs @@ -0,0 +1,30 @@ +using DolphinWebXplorer2.Services.UI; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DolphinWebXplorer2.Services +{ + class AdminService : SunfishService + { + public AdminService(SunfishServiceConfiguration ssc) : base(ssc) + { + + } + + protected override ConfigurationScreen GetConfigurationScreen() + { + return new ConfigurationScreen() + { + elements = new ConfigurationElement[] + { + new ConfigurationMessage(ConfigurationMessage.MessageType.ERROR,"Error loading or initializing this service") + } + }; + } + + public override string Description => "Allow remote configuration of Sunfish server"; + } +} diff --git a/Sunfish/Sunfish/Services/ErrorService.cs b/Sunfish/Sunfish/Services/ErrorService.cs index 170513f..74cb50e 100644 --- a/Sunfish/Sunfish/Services/ErrorService.cs +++ b/Sunfish/Sunfish/Services/ErrorService.cs @@ -1,4 +1,5 @@ -using System; +using DolphinWebXplorer2.Services.UI; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -11,5 +12,19 @@ public ErrorService(SunfishServiceConfiguration ssc) : base(ssc) { } + + protected override ConfigurationScreen GetConfigurationScreen() + { + return new ConfigurationScreen() + { + elements = new ConfigurationElement[] + { + new ConfigurationMessage(ConfigurationMessage.MessageType.ERROR,"Error loading or initializing this service") + } + }; + } + + public override string Description => null; + } } diff --git a/Sunfish/Sunfish/Services/UI/ConfigurationElement.cs b/Sunfish/Sunfish/Services/UI/ConfigurationElement.cs new file mode 100644 index 0000000..0586fd0 --- /dev/null +++ b/Sunfish/Sunfish/Services/UI/ConfigurationElement.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DolphinWebXplorer2.Services.UI +{ + public abstract class ConfigurationElement + { + protected ConfigurationElement(string id) + { + Id = id; + } + + public string Id { get; } + public string Label { get; set; } + } +} diff --git a/Sunfish/Sunfish/Services/UI/ConfigurationMessage.cs b/Sunfish/Sunfish/Services/UI/ConfigurationMessage.cs new file mode 100644 index 0000000..31ed9c8 --- /dev/null +++ b/Sunfish/Sunfish/Services/UI/ConfigurationMessage.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DolphinWebXplorer2.Services.UI +{ + class ConfigurationMessage:ConfigurationElement + { + public enum MessageType + { + INFO,WARNING,ERROR + } + + public ConfigurationMessage(MessageType t,string message) : base(null) + { + Type = t; + Message = message; + } + + public MessageType Type { get; } + public string Message { get; } + } +} diff --git a/Sunfish/Sunfish/Services/UI/ConfigurationScreen.cs b/Sunfish/Sunfish/Services/UI/ConfigurationScreen.cs new file mode 100644 index 0000000..0024fad --- /dev/null +++ b/Sunfish/Sunfish/Services/UI/ConfigurationScreen.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DolphinWebXplorer2.Services.UI +{ + public class ConfigurationScreen + { + public ConfigurationElement[] elements; + } +} diff --git a/Sunfish/Sunfish/Services/UI/ConfigurationString.cs b/Sunfish/Sunfish/Services/UI/ConfigurationString.cs new file mode 100644 index 0000000..fc3e7a9 --- /dev/null +++ b/Sunfish/Sunfish/Services/UI/ConfigurationString.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DolphinWebXplorer2.Services.UI +{ + public class ConfigurationString:ConfigurationElement + { + public ConfigurationString(string id,string defvalue) : base(id) + { + DefaultValue = defvalue; + } + + public string DefaultValue { get; } + } +} diff --git a/Sunfish/Sunfish/Services/WebService.cs b/Sunfish/Sunfish/Services/WebService.cs index eb7c6b0..5b1b843 100644 --- a/Sunfish/Sunfish/Services/WebService.cs +++ b/Sunfish/Sunfish/Services/WebService.cs @@ -1,4 +1,5 @@ -using System; +using DolphinWebXplorer2.Services.UI; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -11,5 +12,18 @@ public WebService(SunfishServiceConfiguration ssc) : base(ssc) { } + + protected override ConfigurationScreen GetConfigurationScreen() + { + return new ConfigurationScreen() + { + elements = new ConfigurationElement[] + { + new ConfigurationMessage(ConfigurationMessage.MessageType.ERROR,"Error loading or initializing this service") + } + }; + } + + public override string Description => "For Webpages or file sharing"; } } diff --git a/Sunfish/Sunfish/Sunfish.cs b/Sunfish/Sunfish/Sunfish.cs index 2447f5b..65e5e21 100644 --- a/Sunfish/Sunfish/Sunfish.cs +++ b/Sunfish/Sunfish/Sunfish.cs @@ -13,6 +13,7 @@ { public int Port = 90; public bool Active = false; + public bool SunfishRoot = true; public List Services = new List(); } diff --git a/Sunfish/Sunfish/Sunfish.csproj b/Sunfish/Sunfish/Sunfish.csproj index 3c3c823..a20b5cb 100644 --- a/Sunfish/Sunfish/Sunfish.csproj +++ b/Sunfish/Sunfish/Sunfish.csproj @@ -138,7 +138,12 @@ True + + + + + diff --git a/Sunfish/Sunfish/SunfishService.cs b/Sunfish/Sunfish/SunfishService.cs index 88397be..7a9bb89 100644 --- a/Sunfish/Sunfish/SunfishService.cs +++ b/Sunfish/Sunfish/SunfishService.cs @@ -1,4 +1,5 @@ using DolphinWebXplorer2.Services; +using DolphinWebXplorer2.Services.UI; using System; using System.Collections.Generic; using System.Linq; @@ -26,19 +27,19 @@ ServiceTypes = st.ToArray(); } - private static void ScanForServices(Assembly a,List st) + private static void ScanForServices(Assembly a, List st) { Type tme = typeof(SunfishService); - foreach(Type t in a.GetTypes()) + foreach (Type t in a.GetTypes()) { - if (tme.IsAssignableFrom(t) && !t.IsAbstract && t!=typeof(ErrorService)) + if (tme.IsAssignableFrom(t) && !t.IsAbstract && t != typeof(ErrorService)) st.Add(t); } } public static SunfishService Instance(SunfishServiceConfiguration ssc) { - Type stype=null; + Type stype = null; foreach (Type t in ServiceTypes) if (t.Name == ssc.Name) stype = t; @@ -53,13 +54,17 @@ #endregion - protected SunfishServiceConfiguration conf; + protected SunfishServiceConfiguration ssc; - public SunfishService(SunfishServiceConfiguration cfg) + public SunfishService(SunfishServiceConfiguration ssc) { - this.conf = cfg; + Configuration = ssc; } - public SunfishServiceConfiguration Configuration => conf; + protected abstract ConfigurationScreen GetConfigurationScreen(); + + public SunfishServiceConfiguration Configuration { get; } + public abstract string Description { get; } + public ConfigurationScreen ConfigurationScreen => GetConfigurationScreen(); } } diff --git a/Sunfish/Sunfish/SunfishServiceConfiguration.cs b/Sunfish/Sunfish/SunfishServiceConfiguration.cs index cf94949..bbbaf56 100644 --- a/Sunfish/Sunfish/SunfishServiceConfiguration.cs +++ b/Sunfish/Sunfish/SunfishServiceConfiguration.cs @@ -11,6 +11,7 @@ public string Type { get; set; } public string Name { get; set; } public bool Enabled { get; set; } + public bool BasePath { get; set; } public Dictionary conf { get; set; } = new Dictionary(); } }