Plugin Developer DiscussionDiscussion for FogBugz Plugin developers |
||
I would greatly prefer putting my static content in embedded resources. This seems like a much more natural approach for static content within plugins. Alternatively, I could live with an IPlugInstallStaticFiles interface with a method InstallGetStaticContent that was called during plugin installation/upgrade, and returned an array of CStaticFile objects. Then it would create/replace all the files returned, and delete any files not in the array.
class CStaticFile { public string FileName; public byte[] Data; } Then I could do something like this: public CStaticFile[] InstallGetStaticContent() { var ns = GetType().Namespace; var assembly = GetType().Assembly; return (from name in assembly.GetManifestResourceNames() let stream = assembly.GetManifestResourceStream(Name) let reader = new BinaryReader(stream) select new CStaticFile() { FileName = name.Substring(ns.Length + 1), Data = reader.ReadBytes((int) stream.Length) } ).ToArray(); }
Another approach which might require even less changes to FB, would be to allow the static content methods to return special resource urls, like so:
return new[] { "resource://KanbanBoard/static/js/loadmenu.js" }; This I think might be my preferred solution, since it would probably involve the least coding for me and for you. |
Powered by FogBugz