diff --git a/README.md b/README.md index 67d2af7..a282ab4 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ The root menu is a small directory of available services, can be disabled, but no service can be used as root. +Sunfish embeds Json.Net from Newtonsoft. + ### Editor |![](doc/editor.png)| @@ -46,9 +48,12 @@ **Allow execute:** Execute the file on the server side (See warinigs). -### Plugin development +### Modifications and plugin development -See [Plugin development](doc/plugins.md) file +A fresh compiled Sunfish.exe does not contain the default resources, place the $sunfish directory on the same path of the .exe with the resources or seal it into the .exe +To seal resources open sunfish.exe and open the root webpage on a browser. Enter path /$sunfish/info and you will find the seal link. A new sunfish.exe will be generated with the resources inside. + +For [Plugin development](doc/plugins.md) open the plugins.md document inside doc folder. ### Notes @@ -56,4 +61,13 @@ | Waring | |:--:| -| Sunfish uses the C# web server implementation, and this implementation requires elevated user to allow remote computers connections, will be dropped on next versions | \ No newline at end of file +| Sunfish uses the C# web server implementation, and this implementation requires elevated user to allow remote computers connections, will be dropped on next versions | + +### Roadmap +In future version of Sunfish .Net Framework will be replaced by .Net Core that will add the next great changes: + +· Add Web administration panel with a lot more of configuration options. +· Custom resources for plugins. +· Reduce the windows GUI to a more basic version embedding the administration panel. +· Add alternative GUI for Linux / Macos or switch to electron app. +· A way for Dynamic Web Pages. diff --git a/Sunfish Test Plugin.sln b/Sunfish Test Plugin.sln new file mode 100644 index 0000000..046967a --- /dev/null +++ b/Sunfish Test Plugin.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30907.101 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sunfish Test Plugin", "Sunfish Test Plugin\Sunfish Test Plugin.csproj", "{A4837DE3-E840-41E9-9617-6D6D53EFF2F9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sunfish", "Sunfish\Sunfish.csproj", "{5511BE4E-6AE1-479B-B5CD-5A20DC4C13F7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A4837DE3-E840-41E9-9617-6D6D53EFF2F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4837DE3-E840-41E9-9617-6D6D53EFF2F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4837DE3-E840-41E9-9617-6D6D53EFF2F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4837DE3-E840-41E9-9617-6D6D53EFF2F9}.Release|Any CPU.Build.0 = Release|Any CPU + {5511BE4E-6AE1-479B-B5CD-5A20DC4C13F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5511BE4E-6AE1-479B-B5CD-5A20DC4C13F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5511BE4E-6AE1-479B-B5CD-5A20DC4C13F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5511BE4E-6AE1-479B-B5CD-5A20DC4C13F7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EF305306-A83C-44CC-A1E1-F4C9E4B5CB95} + EndGlobalSection +EndGlobal diff --git a/Sunfish Test Plugin/HelloWorldService.cs b/Sunfish Test Plugin/HelloWorldService.cs new file mode 100644 index 0000000..1fa67de --- /dev/null +++ b/Sunfish Test Plugin/HelloWorldService.cs @@ -0,0 +1,69 @@ +using Sunfish; +using Sunfish.Middleware; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sunfish_Test_Plugin +{ + [DefineConfigurator(typeof(HelloWorldServiceConfigurator))] + public class HelloWorldService : SunfishService + { + private string thing; + private string pass; + private bool ronly; + + public HelloWorldService(SunfishServiceConfiguration ssc) : base(ssc) + { + thing = ssc.GetConf(HelloWorldServiceConfigurator.CFG_THING, "default-value"); + pass = ssc.GetConf(HelloWorldServiceConfigurator.CFG_PWD); + ronly = ssc.GetConf(HelloWorldServiceConfigurator.CFG_RONLY); + } + + public override string Description => throw new NotImplementedException(); + + public override void Process(string path, HttpCall call) + { + WebUI.WriteTemplate("sunfish-header", call, null); + if (thing == "konosuba") + { + call.Write("

God's blessing on this wonderful world!

"); + } + else + { + call.Write("

Hello world!

"); + call.Write("

"); + call.Write("The thing is: " + thing); + call.Write("

"); + if (!string.IsNullOrEmpty(pass)) + { + string ppass; + if (call.Parameters.TryGetValue("pp", out ppass) && ppass == pass) + call.Write("

it IS the passowrd

"); + else + { + call.Write("

"); + call.Write("Enter:
"); + call.Write("

"); + } + } + call.Write("

"); + call.Write(ronly ? "Read only!" : "You can write (not read only)"); + call.Write("

"); + } + WebUI.WriteTemplate("sunfish-footer", call, null); + } + + protected override void Start() + { + //Notihng to load when service starts + } + + protected override void Stop() + { + //Nothing to unload when service stops + } + } +} diff --git a/Sunfish Test Plugin/HelloWorldServiceConfigurator.cs b/Sunfish Test Plugin/HelloWorldServiceConfigurator.cs new file mode 100644 index 0000000..b4b40c2 --- /dev/null +++ b/Sunfish Test Plugin/HelloWorldServiceConfigurator.cs @@ -0,0 +1,42 @@ +using Sunfish.Configurator; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sunfish_Test_Plugin +{ + class HelloWorldServiceConfigurator : SunfishServiceConfigurator + { + internal const string CFG_THING = "Thing"; + internal const string CFG_PWD = "Pass"; + internal const string CFG_RONLY = "ReadOnly"; + + protected override ConfigurationScreen GetConfigurationScreen() + { + return new ConfigurationScreen() + { + Elements = new ConfigurationElement[] + { + new ConfigurationString(CFG_THING,"A Thing") + { + Tooltip = "A thing to write here (mandatory)", + Mandatory = true + }, + new ConfigurationString(CFG_PWD,"Pass") + { + Tooltip = "A Password, (saved with a little security but not plain)", + IsPassword=true + }, + new ConfigurationMessage(ConfigurationMessage.MessageType.INFO,"The below option do exactly nothing."), + new ConfigurationBool(CFG_RONLY,"Read only") + { + Tooltip = "Really nothing to modify", + DefaultValue = true, + }, + } + }; + } + } +} diff --git a/Sunfish Test Plugin/Properties/AssemblyInfo.cs b/Sunfish Test Plugin/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..22c9c38 --- /dev/null +++ b/Sunfish Test Plugin/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("Sunfish Test Plugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Sunfish Test Plugin")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a4837de3-e840-41e9-9617-6d6d53eff2f9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Sunfish Test Plugin/Sunfish Test Plugin.csproj b/Sunfish Test Plugin/Sunfish Test Plugin.csproj new file mode 100644 index 0000000..cc1213d --- /dev/null +++ b/Sunfish Test Plugin/Sunfish Test Plugin.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {A4837DE3-E840-41E9-9617-6D6D53EFF2F9} + Library + Properties + Sunfish_Test_Plugin + sf-hello-world + v4.5 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + {5511be4e-6ae1-479b-b5cd-5a20dc4c13f7} + Sunfish + + + + \ No newline at end of file diff --git a/Sunfish/Configurator/ConfigurationBool.cs b/Sunfish/Configurator/ConfigurationBool.cs index 737ef0a..a9e0edc 100644 --- a/Sunfish/Configurator/ConfigurationBool.cs +++ b/Sunfish/Configurator/ConfigurationBool.cs @@ -1,7 +1,7 @@ using System.Drawing; using System.Windows.Forms; -namespace DolphinWebXplorer2.Configurator +namespace Sunfish.Configurator { public class ConfigurationBool : ConfigurationElement { diff --git a/Sunfish/Configurator/ConfigurationElement.cs b/Sunfish/Configurator/ConfigurationElement.cs index 545c8d1..51f816b 100644 --- a/Sunfish/Configurator/ConfigurationElement.cs +++ b/Sunfish/Configurator/ConfigurationElement.cs @@ -1,7 +1,7 @@ using System.Drawing; using System.Windows.Forms; -namespace DolphinWebXplorer2.Configurator +namespace Sunfish.Configurator { public abstract class ConfigurationElement { diff --git a/Sunfish/Configurator/ConfigurationMessage.cs b/Sunfish/Configurator/ConfigurationMessage.cs index 4a9fea0..102940c 100644 --- a/Sunfish/Configurator/ConfigurationMessage.cs +++ b/Sunfish/Configurator/ConfigurationMessage.cs @@ -1,9 +1,9 @@ using System.Drawing; using System.Windows.Forms; -namespace DolphinWebXplorer2.Configurator +namespace Sunfish.Configurator { - class ConfigurationMessage : ConfigurationElement + public class ConfigurationMessage : ConfigurationElement { public enum MessageType { diff --git a/Sunfish/Configurator/ConfigurationScreen.cs b/Sunfish/Configurator/ConfigurationScreen.cs index 9e564dd..9fc3530 100644 --- a/Sunfish/Configurator/ConfigurationScreen.cs +++ b/Sunfish/Configurator/ConfigurationScreen.cs @@ -1,4 +1,4 @@ -namespace DolphinWebXplorer2.Configurator +namespace Sunfish.Configurator { public class ConfigurationScreen { diff --git a/Sunfish/Configurator/ConfigurationString.cs b/Sunfish/Configurator/ConfigurationString.cs index 56f25fb..edeacf2 100644 --- a/Sunfish/Configurator/ConfigurationString.cs +++ b/Sunfish/Configurator/ConfigurationString.cs @@ -1,7 +1,7 @@ using System.Drawing; using System.Windows.Forms; -namespace DolphinWebXplorer2.Configurator +namespace Sunfish.Configurator { public class ConfigurationString : ConfigurationElement { diff --git a/Sunfish/Configurator/SunfishServiceConfigurator.cs b/Sunfish/Configurator/SunfishServiceConfigurator.cs index 2f0dbca..b2e82e1 100644 --- a/Sunfish/Configurator/SunfishServiceConfigurator.cs +++ b/Sunfish/Configurator/SunfishServiceConfigurator.cs @@ -1,7 +1,7 @@ using System; using System.Reflection; -namespace DolphinWebXplorer2.Configurator +namespace Sunfish.Configurator { public abstract class SunfishServiceConfigurator { diff --git a/Sunfish/DefineConfigurator.cs b/Sunfish/DefineConfigurator.cs index 2a86774..1a6aefe 100644 --- a/Sunfish/DefineConfigurator.cs +++ b/Sunfish/DefineConfigurator.cs @@ -1,7 +1,7 @@ -using DolphinWebXplorer2.Configurator; +using Sunfish.Configurator; using System; -namespace DolphinWebXplorer2 +namespace Sunfish { [AttributeUsage(AttributeTargets.Class)] public class DefineConfigurator : Attribute diff --git a/Sunfish/Extensions.cs b/Sunfish/Extensions.cs index 6e185cb..ff3076d 100644 --- a/Sunfish/Extensions.cs +++ b/Sunfish/Extensions.cs @@ -3,7 +3,7 @@ using System.IO; using System.Windows.Forms; -namespace DolphinWebXplorer2 +namespace Sunfish { public static class Extensions { diff --git a/Sunfish/FServiceConf.Designer.cs b/Sunfish/FServiceConf.Designer.cs index 91c6bfa..a588608 100644 --- a/Sunfish/FServiceConf.Designer.cs +++ b/Sunfish/FServiceConf.Designer.cs @@ -1,4 +1,4 @@ -namespace DolphinWebXplorer2 +namespace Sunfish { partial class FServiceConf { diff --git a/Sunfish/FServiceConf.cs b/Sunfish/FServiceConf.cs index 678c523..a37a598 100644 --- a/Sunfish/FServiceConf.cs +++ b/Sunfish/FServiceConf.cs @@ -1,9 +1,9 @@ -using DolphinWebXplorer2.Configurator; +using Sunfish.Configurator; using System; using System.Drawing; using System.Windows.Forms; -namespace DolphinWebXplorer2 +namespace Sunfish { public partial class FServiceConf : Form { diff --git a/Sunfish/Form1.Designer.cs b/Sunfish/Form1.Designer.cs index bc5c41b..c34cfd2 100644 --- a/Sunfish/Form1.Designer.cs +++ b/Sunfish/Form1.Designer.cs @@ -1,4 +1,4 @@ -namespace DolphinWebXplorer2 +namespace Sunfish { partial class Form1 { @@ -197,7 +197,7 @@ // this.btShowIp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btShowIp.Font = new System.Drawing.Font("Lucida Console", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btShowIp.Image = global::DolphinWebXplorer2.Properties.Resources.messagebox_info; + this.btShowIp.Image = global::Sunfish.Properties.Resources.messagebox_info; this.btShowIp.Location = new System.Drawing.Point(126, 298); this.btShowIp.Name = "btShowIp"; this.btShowIp.Size = new System.Drawing.Size(23, 23); diff --git a/Sunfish/Form1.cs b/Sunfish/Form1.cs index 753a16c..9121248 100644 --- a/Sunfish/Form1.cs +++ b/Sunfish/Form1.cs @@ -1,4 +1,4 @@ -using DolphinWebXplorer2.Properties; +using Sunfish.Properties; using System; using System.Collections.Generic; using System.ComponentModel; @@ -9,7 +9,7 @@ using System.Text; using System.Windows.Forms; -namespace DolphinWebXplorer2 +namespace Sunfish { public partial class Form1 : Form { diff --git a/Sunfish/IpInfo.cs b/Sunfish/IpInfo.cs index 673863e..222dfb0 100644 --- a/Sunfish/IpInfo.cs +++ b/Sunfish/IpInfo.cs @@ -1,6 +1,6 @@ using System.Net.NetworkInformation; -namespace DolphinWebXplorer2 +namespace Sunfish { class IpInfo { diff --git a/Sunfish/Middleware/HttpServer.cs b/Sunfish/Middleware/HttpServer.cs index b9dc15c..669e983 100644 --- a/Sunfish/Middleware/HttpServer.cs +++ b/Sunfish/Middleware/HttpServer.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Web; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { class HttpServer { diff --git a/Sunfish/Middleware/MimeTypes.cs b/Sunfish/Middleware/MimeTypes.cs index 848e9af..0960558 100644 --- a/Sunfish/Middleware/MimeTypes.cs +++ b/Sunfish/Middleware/MimeTypes.cs @@ -4,9 +4,9 @@ using System.Text; using System.Threading.Tasks; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { - class MimeTypes + public class MimeTypes { private static IDictionary _mappings = new Dictionary(StringComparer.InvariantCultureIgnoreCase) { diff --git a/Sunfish/Middleware/Templater.cs b/Sunfish/Middleware/Templater.cs index 6a8d5b7..016d839 100644 --- a/Sunfish/Middleware/Templater.cs +++ b/Sunfish/Middleware/Templater.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using System.Xml; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { public class Templater { diff --git a/Sunfish/Middleware/VFS.cs b/Sunfish/Middleware/VFS.cs index cb8b210..0abb2c4 100644 --- a/Sunfish/Middleware/VFS.cs +++ b/Sunfish/Middleware/VFS.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { public class VFS { diff --git a/Sunfish/Middleware/VFSFolder.cs b/Sunfish/Middleware/VFSFolder.cs index 0fe8a27..867455e 100644 --- a/Sunfish/Middleware/VFSFolder.cs +++ b/Sunfish/Middleware/VFSFolder.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { public abstract class VFSFolder { diff --git a/Sunfish/Middleware/VFSFolderFileSystem.cs b/Sunfish/Middleware/VFSFolderFileSystem.cs index 4d6b60f..a27689e 100644 --- a/Sunfish/Middleware/VFSFolderFileSystem.cs +++ b/Sunfish/Middleware/VFSFolderFileSystem.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { public class VFSFolderFileSystem : VFSFolder { diff --git a/Sunfish/Middleware/VFSItem.cs b/Sunfish/Middleware/VFSItem.cs index e5f8548..67979dc 100644 --- a/Sunfish/Middleware/VFSItem.cs +++ b/Sunfish/Middleware/VFSItem.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { public class VFSItem { diff --git a/Sunfish/Middleware/WebUI.cs b/Sunfish/Middleware/WebUI.cs index db2443f..9c71643 100644 --- a/Sunfish/Middleware/WebUI.cs +++ b/Sunfish/Middleware/WebUI.cs @@ -7,9 +7,9 @@ using System.Text; using System.Threading.Tasks; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { - class WebUI + public class WebUI { static WebUI() { diff --git a/Sunfish/Middleware/Win32.cs b/Sunfish/Middleware/Win32.cs index a7da4e7..b770d1b 100644 --- a/Sunfish/Middleware/Win32.cs +++ b/Sunfish/Middleware/Win32.cs @@ -2,7 +2,7 @@ using System.Drawing; using System.Runtime.InteropServices; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHFILEINFO diff --git a/Sunfish/Middleware/WindowsFirewall.cs b/Sunfish/Middleware/WindowsFirewall.cs index 5631736..6171ae0 100644 --- a/Sunfish/Middleware/WindowsFirewall.cs +++ b/Sunfish/Middleware/WindowsFirewall.cs @@ -6,7 +6,7 @@ using System.Reflection; using System.Security.Cryptography; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { public class WindowsFirewall { diff --git a/Sunfish/Middleware/ZipDownload.cs b/Sunfish/Middleware/ZipDownload.cs index 7090450..bcfe206 100644 --- a/Sunfish/Middleware/ZipDownload.cs +++ b/Sunfish/Middleware/ZipDownload.cs @@ -6,9 +6,9 @@ using System.Text; using System.Threading.Tasks; -namespace DolphinWebXplorer2.Middleware +namespace Sunfish.Middleware { - class ZipDownload : IDisposable + public class ZipDownload : IDisposable { private HttpCall call; private ZipArchive z; diff --git a/Sunfish/Program.cs b/Sunfish/Program.cs index afd6e0c..107ae7e 100644 --- a/Sunfish/Program.cs +++ b/Sunfish/Program.cs @@ -1,8 +1,8 @@ -using DolphinWebXplorer2.Middleware; +using Sunfish.Middleware; using System; using System.Windows.Forms; -namespace DolphinWebXplorer2 +namespace Sunfish { static class Program { diff --git a/Sunfish/Properties/Resources.Designer.cs b/Sunfish/Properties/Resources.Designer.cs index 5cc81cb..32a4a91 100644 --- a/Sunfish/Properties/Resources.Designer.cs +++ b/Sunfish/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace DolphinWebXplorer2.Properties { +namespace Sunfish.Properties { using System; @@ -39,7 +39,7 @@ internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DolphinWebXplorer2.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sunfish.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Sunfish/Properties/Settings.Designer.cs b/Sunfish/Properties/Settings.Designer.cs index 7878348..54915ad 100644 --- a/Sunfish/Properties/Settings.Designer.cs +++ b/Sunfish/Properties/Settings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace DolphinWebXplorer2.Properties { +namespace Sunfish.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/Sunfish/Services/ErrorService.cs b/Sunfish/Services/ErrorService.cs index 63aedd6..b27677e 100644 --- a/Sunfish/Services/ErrorService.cs +++ b/Sunfish/Services/ErrorService.cs @@ -1,7 +1,7 @@ -using DolphinWebXplorer2.Middleware; +using Sunfish.Middleware; using System.Net; -namespace DolphinWebXplorer2.Services +namespace Sunfish.Services { [DefineConfigurator(typeof(ErrorServiceConfigurator))] class ErrorService : SunfishService diff --git a/Sunfish/Services/ErrorServiceConfigurator.cs b/Sunfish/Services/ErrorServiceConfigurator.cs index 14651ac..06174bc 100644 --- a/Sunfish/Services/ErrorServiceConfigurator.cs +++ b/Sunfish/Services/ErrorServiceConfigurator.cs @@ -1,6 +1,6 @@ -using DolphinWebXplorer2.Configurator; +using Sunfish.Configurator; -namespace DolphinWebXplorer2.Services +namespace Sunfish.Services { class ErrorServiceConfigurator : SunfishServiceConfigurator { diff --git a/Sunfish/Services/RootService.cs b/Sunfish/Services/RootService.cs index 6fc07dd..66482b1 100644 --- a/Sunfish/Services/RootService.cs +++ b/Sunfish/Services/RootService.cs @@ -1,11 +1,11 @@ -using DolphinWebXplorer2.Middleware; +using Sunfish.Middleware; using System; using System.Collections.Generic; using System.IO; using System.Linq.Expressions; using System.Reflection; -namespace DolphinWebXplorer2.Services +namespace Sunfish.Services { [DefineConfigurator(typeof(RootServiceConfigurator))] class RootService : SunfishService diff --git a/Sunfish/Services/RootServiceConfigurator.cs b/Sunfish/Services/RootServiceConfigurator.cs index bf2d172..bdb663c 100644 --- a/Sunfish/Services/RootServiceConfigurator.cs +++ b/Sunfish/Services/RootServiceConfigurator.cs @@ -1,6 +1,6 @@ -using DolphinWebXplorer2.Configurator; +using Sunfish.Configurator; -namespace DolphinWebXplorer2.Services +namespace Sunfish.Services { class RootServiceConfigurator : SunfishServiceConfigurator { diff --git a/Sunfish/Services/WebService.cs b/Sunfish/Services/WebService.cs index 6e2e496..f2ff66f 100644 --- a/Sunfish/Services/WebService.cs +++ b/Sunfish/Services/WebService.cs @@ -1,11 +1,11 @@ -using DolphinWebXplorer2.Middleware; +using Sunfish.Middleware; using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; -namespace DolphinWebXplorer2.Services +namespace Sunfish.Services { [DefineConfigurator(typeof(WebServiceConfigurator))] class WebService : SunfishService diff --git a/Sunfish/Services/WebServiceConfigurator.cs b/Sunfish/Services/WebServiceConfigurator.cs index f4f02be..32f4118 100644 --- a/Sunfish/Services/WebServiceConfigurator.cs +++ b/Sunfish/Services/WebServiceConfigurator.cs @@ -1,7 +1,7 @@ -using DolphinWebXplorer2.Configurator; +using Sunfish.Configurator; using System; -namespace DolphinWebXplorer2.Services +namespace Sunfish.Services { class WebServiceConfigurator : SunfishServiceConfigurator { diff --git a/Sunfish/Sunfish.cs b/Sunfish/Sunfish.cs index f995148..3fa62d8 100644 --- a/Sunfish/Sunfish.cs +++ b/Sunfish/Sunfish.cs @@ -1,12 +1,12 @@ -using DolphinWebXplorer2.Middleware; -using DolphinWebXplorer2.Services; +using Sunfish.Middleware; +using Sunfish.Services; using Json.Net; using System; using System.Collections.Generic; using System.IO; using System.Net; -namespace DolphinWebXplorer2 +namespace Sunfish { static class Sunfish { diff --git a/Sunfish/Sunfish.csproj b/Sunfish/Sunfish.csproj index edc8a0c..aea205d 100644 --- a/Sunfish/Sunfish.csproj +++ b/Sunfish/Sunfish.csproj @@ -8,7 +8,7 @@ {5511BE4E-6AE1-479B-B5CD-5A20DC4C13F7} WinExe Properties - DolphinWebXplorer2 + Sunfish Sunfish v4.5 512 diff --git a/Sunfish/SunfishService.cs b/Sunfish/SunfishService.cs index ca793fb..ac522fb 100644 --- a/Sunfish/SunfishService.cs +++ b/Sunfish/SunfishService.cs @@ -1,11 +1,12 @@ -using DolphinWebXplorer2.Configurator; -using DolphinWebXplorer2.Middleware; -using DolphinWebXplorer2.Services; +using Sunfish.Configurator; +using Sunfish.Middleware; +using Sunfish.Services; using System; using System.Collections.Generic; +using System.IO; using System.Reflection; -namespace DolphinWebXplorer2 +namespace Sunfish { public abstract class SunfishService : IDisposable { @@ -22,6 +23,17 @@ { List st = new List(); ScanForServices(Assembly.GetExecutingAssembly(), st); + string sfpath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + foreach (string s in Directory.GetFiles(sfpath)) try + { + var sname = Path.GetFileName(s); + if (sname.StartsWith("sf-") && sname.EndsWith(".dll")) + ScanForServices(Assembly.LoadFile(s), st); + } + catch (Exception e) + { + //TODO: LOG + } ServiceTypes = st.ToArray(); } @@ -51,7 +63,7 @@ Type stype = GetServiceTypeOf(ssc.Type); try { - return (SunfishService)stype.GetConstructor(new Type[] { typeof(SunfishServiceConfiguration) }).Invoke(new Object[] { ssc }); + return (SunfishService)stype.GetConstructor(new Type[] { typeof(SunfishServiceConfiguration) }).Invoke(new object[] { ssc }); } catch { return new ErrorService(ssc); } } diff --git a/Sunfish/SunfishServiceConfiguration.cs b/Sunfish/SunfishServiceConfiguration.cs index a01de08..23c9144 100644 --- a/Sunfish/SunfishServiceConfiguration.cs +++ b/Sunfish/SunfishServiceConfiguration.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace DolphinWebXplorer2 +namespace Sunfish { public class SunfishServiceConfiguration { diff --git a/Sunfish/_OLD_/AdminServiceConfigurator.cs b/Sunfish/_OLD_/AdminServiceConfigurator.cs index a301577..9bf562a 100644 --- a/Sunfish/_OLD_/AdminServiceConfigurator.cs +++ b/Sunfish/_OLD_/AdminServiceConfigurator.cs @@ -1,6 +1,6 @@ -using DolphinWebXplorer2.Configurator; +using Sunfish.Configurator; -namespace DolphinWebXplorer2.Services +namespace Sunfish.Services { class AdminServiceConfigurator : SunfishServiceConfigurator { diff --git a/Sunfish/_OLD_/RemoteScreen.cs b/Sunfish/_OLD_/RemoteScreen.cs index eadba9c..ff06173 100644 --- a/Sunfish/_OLD_/RemoteScreen.cs +++ b/Sunfish/_OLD_/RemoteScreen.cs @@ -6,7 +6,7 @@ using System.Threading; using System.Windows.Forms; -namespace DolphinWebXplorer2.wx +namespace Sunfish.wx { class RemoteScreen { diff --git a/doc/plugins.md b/doc/plugins.md index 1b6103e..bd24072 100644 --- a/doc/plugins.md +++ b/doc/plugins.md @@ -1,5 +1,20 @@ Sunfish allow plugin creation too add more functionality through service types. +For details see Sunfish Text Plugin solution. + # Create new plugin -Create a new C# library project and use Sunfish.exe as reference. \ No newline at end of file +Create a new C# library project, the assembly name should start with "sf-" and use Sunfish.exe as reference. +If the Sunfish reference is set as project, also copy the $sunfish directory + +If the resulting assemlby is not a .dll and not starts with sf- Sunfish will not load it. + +Also is hight recomendable to set the startup program on debug as the Sunfish.exe inside bin/debug folder. + +# Use the plugin + +Place the plugin on the same path ans sunfish.exe + +# Notes + +Newtonsoft's Json.NET is available for plugins. \ No newline at end of file