<html><head></head><body>Greg is right, but concerning VerseKey objects. The problem with instancing a VerseKey is that it defaults to the KJV v11n system. The module may use another. So, then you need to setVersification appropriately on the newly instantiated VerseKey to access all the verses correctly for the module. The alternative is either to:<br>
<br>
Simply call: SWModule::createKey()<br>
Which will give you back an SWKey appropriate for the module.<br>
<br>
Or simply send strings to SWModule::setKey(...)<br>
<br>
All keys can be reduced to a string representation and each module type will ask its own key representation to deal with the string accordingly.<br>
<br>
In C++, this is allowed in the engine by providing a const char * c-tor on the base of all keys, the SWKey object. Then SWModule::setKey(const SWKey &) will accept strings by constructing a temporary for you.<br>
<br>
module.setKey("jas.1.18")<br>
<br>
So, in essense, your C# code to create an SWKey with a string, and then set the module with this key does the same thing, though in multiple steps.<br>
<br>
So, to summarize. Gregs warning about constructing a VerseKey manually is important. You're not doing this in your example so there's not danger of using the wrong versification system. I'm not sure if you need to even construct a key at all; i.e., I don't know if C# will imply the temporary SWKey and simply allow the module.setKey("jas.1.18"), as C++ provides for.<br>
<br>
Hope this is more help than confusion.<br>
<br>
Troy<br>
-- <br>
Sent from my Android phone with K-9 Mail. Please excuse my brevity.<br><br><div class="gmail_quote">Greg Hellings <greg.hellings@gmail.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre style="white-space: pre-wrap; word-wrap:break-word; font-family: sans-serif">On Sat, Aug 11, 2012 at 9:38 PM, Daniel Hughes <trampster@gmail.com> wrote:<br />> I managed to get it working with the following code:<br />><br />> using(SWMgr mgr = new SWMgr())<br />> using(SWModule module = mgr.getModule("ESV"))<br />> using(SWKey key = new SWKey("jas 1:18"))<br /><br />In SWORD you should _never_ instantiate an instance of SWKey. You<br />should use the module's methods for fetching its particular instance<br />of the SWKey and set the value using the appropriate methods (or<br />assignment overload in C++).<br /><br />Because each module might have a different versification scheme, the<br />default when you instantiate one is to follow the KJV's versification<br />but that can lead to improper results when assigned to a module that<br />does not use KJV.<br /><br />> {<br />> module.setKey(key);<br />> Console.WriteLine
(module.RenderText());<br />> }<br />><br />> I wouldn't go as far as to say that I have working c# bindings, I only have<br />> a very small subset working. I was planning on publishing what I have on<br />> bitbucket under GPL3.<br />><br />> I must confess that as a C# developer I have no understanding of how to use<br />> make or how to integrate what I have with the rest of your repository and<br />> build system.<br /><br />If you publish what you have, I can work with you to integrate it into<br />the engine's swig bindings. I have been the "pumpkin holder" for them<br />for a while now as well as for the CMake system that is the main way<br />to build them at present.<br /><br />--Greg<br /><br />><br />> On Sun, Aug 12, 2012 at 4:22 AM, Peter von Kaehne <refdoc@gmx.net> wrote:<br />>><br />>> On Sat, 2012-08-11 at 20:25 +1200, Daniel Hughes wrote:<br />>><br />>> > I'm trying to use sword from c#. I have used
swig to generate a<br />>> > wrapper for just enough of sword to open a module and render some<br />>> > text.<br />>><br />>> If you have working C# bindings, could you update the existing ones?<br />>> There is a not totally infrequent question on this mailing list for<br />>> those.<br />>><br />>> That aside, I second the other response. No need to go into the details<br />>> of module construction, if you use SWMgr.<br />>><br />>> Peter<br />>><br />>><br />>><br />>><br />>><hr /><br />>> sword-devel mailing list: sword-devel@crosswire.org<br />>> <a href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br />>> Instructions to unsubscribe/change your settings at above page<br />><br />><br />><br />><hr /><br />> sword-devel mailing list: sword-devel@crosswire.org<br />> <a
href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br />> Instructions to unsubscribe/change your settings at above page<br /><br /><hr /><br />sword-devel mailing list: sword-devel@crosswire.org<br /><a href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br />Instructions to unsubscribe/change your settings at above page<br /></pre></blockquote></div></body></html>