[sword-svn] r3201 - in branches/sword-1-7-x: . bindings/csharp
greg.hellings at crosswire.org
greg.hellings at crosswire.org
Mon Apr 28 21:06:19 MST 2014
Author: greg.hellings
Date: 2014-04-28 21:06:19 -0700 (Mon, 28 Apr 2014)
New Revision: 3201
Added:
branches/sword-1-7-x/bindings/csharp/examples/
branches/sword-1-7-x/bindings/csharp/tests/
Removed:
branches/sword-1-7-x/bindings/csharp/FlatApiLookup.cs
branches/sword-1-7-x/bindings/csharp/InstallManagerTests.cs
branches/sword-1-7-x/bindings/csharp/ManagerTests.cs
branches/sword-1-7-x/bindings/csharp/ModuleTests.cs
branches/sword-1-7-x/bindings/csharp/Sword.Tests.csproj
Modified:
branches/sword-1-7-x/
branches/sword-1-7-x/bindings/csharp/AssemblyInfo.cs
branches/sword-1-7-x/bindings/csharp/Module.cs
Log:
Merging r3199 - Changes to C# bindings
Property changes on: branches/sword-1-7-x
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:2989-2991,2997,3001-3004,3006,3010-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155,3190-3192,3198
+ /trunk:2989-2991,2997,3001-3004,3006,3010-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155,3190-3192,3198-3199
Modified: branches/sword-1-7-x/bindings/csharp/AssemblyInfo.cs
===================================================================
--- branches/sword-1-7-x/bindings/csharp/AssemblyInfo.cs 2014-04-29 04:05:11 UTC (rev 3200)
+++ branches/sword-1-7-x/bindings/csharp/AssemblyInfo.cs 2014-04-29 04:06:19 UTC (rev 3201)
@@ -38,43 +38,3 @@
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
-// Copyright 2014 CrossWire Bible Society (http://www.crosswire.org)
-// CrossWire Bible Society
-// P. O. Box 2528
-// Tempe, AZ 85280-2528
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation version 2.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("Sword")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("daniel")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-
Deleted: branches/sword-1-7-x/bindings/csharp/FlatApiLookup.cs
===================================================================
--- branches/sword-1-7-x/bindings/csharp/FlatApiLookup.cs 2014-04-29 04:05:11 UTC (rev 3200)
+++ branches/sword-1-7-x/bindings/csharp/FlatApiLookup.cs 2014-04-29 04:06:19 UTC (rev 3201)
@@ -1,99 +0,0 @@
-// Copyright 2014 CrossWire Bible Society (http://www.crosswire.org)
-// CrossWire Bible Society
-// P. O. Box 2528
-// Tempe, AZ 85280-2528
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation version 2.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-using System;
-
-namespace Sword.Tests
-{
- class FlatApiLookup
- {
- public static void Main (string[] args)
- {
- using(var manager = new Manager())
- {
- var module = manager.GetModuleByName(args[0]);
-
- if (module == null)
- {
- Console.Error.WriteLine("Could not find module {0}. Available modules:", args[0]);
- foreach(var modInfo in manager.GetModInfoList())
- {
- Console.WriteLine ("{0}\t - {1}", modInfo.Name, modInfo.Description);
- }
- return;
- }
- foreach(var locale in manager.AvailableLocales)
- {
- Console.WriteLine (locale);
- }
- }
- }
-
- public static void Search()
- {
- using(var manager = new Manager())
- {
- var module = manager.GetModuleByName("ESV");
-
- if (module == null)
- {
- Console.Error.WriteLine("Could not find module {0}. Available modules:", "ESV");
- foreach(var modInfo in manager.GetModInfoList())
- {
- Console.WriteLine ("{0}\t - {1}", modInfo.Name, modInfo.Description);
- }
- return;
- }
-
- foreach(var hit in module.Search("sin", SearchType.REGEX, 0, null))
- {
- Console.WriteLine(hit.Key);
- }
- module.TerminateSearch();
- }
- }
-
- public static void ParseKeyList()
- {
- using(var manager = new Manager())
- {
- var module = manager.GetModuleByName("ESV");
-
- if (module == null)
- {
- Console.Error.WriteLine("Could not find module {0}. Available modules:", "ESV");
- foreach(var modInfo in manager.GetModInfoList())
- {
- Console.WriteLine ("{0}\t - {1}", modInfo.Name, modInfo.Description);
- }
- return;
- }
-
- module.KeyText = "jn.3.16";
-
- Console.WriteLine("==Render=Entry============");
- Console.WriteLine(module.KeyText);
- Console.WriteLine("RenderText: " + module.Rendertext());
- Console.WriteLine("StripText: " + module.StripText());
-
- Console.WriteLine("RawText: " + module.RawEntry);
- Console.WriteLine("==========================");
-
- foreach(var key in module.ParseKeyList("James 1:19-30"))
- {
- Console.WriteLine (key);
- }
- }
- }
- }
-}
\ No newline at end of file
Deleted: branches/sword-1-7-x/bindings/csharp/InstallManagerTests.cs
===================================================================
--- branches/sword-1-7-x/bindings/csharp/InstallManagerTests.cs 2014-04-29 04:05:11 UTC (rev 3200)
+++ branches/sword-1-7-x/bindings/csharp/InstallManagerTests.cs 2014-04-29 04:06:19 UTC (rev 3201)
@@ -1,132 +0,0 @@
-// Copyright 2014 CrossWire Bible Society (http://www.crosswire.org)
-// CrossWire Bible Society
-// P. O. Box 2528
-// Tempe, AZ 85280-2528
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation version 2.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-using System;
-using NUnit.Framework;
-using System.Linq;
-
-namespace Sword.Tests
-{
- [TestFixture]
- public class InstallManagerTests
- {
- InstallManager _installManager;
-
- [SetUp]
- public void Setup()
- {
- _installManager = new InstallManager("baseDirectory");
- }
-
- [TearDown]
- public void TearDown()
- {
- _installManager.Dispose();
- }
-
- [Test]
- public void SetUserDisclaimerConfirmed_Called_DoesntCrash()
- {
- _installManager.SetUserDisclaimerConfirmed();
- }
-
- [Test]
- public void SyncConfig_UserDisclaimerConfirmed_ReturnsTrue()
- {
- //arrange
- _installManager.SetUserDisclaimerConfirmed();
-
- //act
- bool result = _installManager.SyncConfig();
-
- //assert
- Assert.That (result, Is.True);
- }
-
- [Test]
- public void SyncConfig_UserDisclaimerNotConfirmed_ReturnsFalse()
- {
- //act
- bool result = _installManager.SyncConfig();
-
- //assert
- Assert.That (result, Is.False);
- }
-
- [Test]
- public void RemoteSources_Called_ReturnsRemoteSources()
- {
- //arrange
- _installManager.SetUserDisclaimerConfirmed();
- _installManager.SyncConfig();
-
- //act
- var remoteSources = _installManager.RemoteSources.ToArray();
-
- //assert
- Assert.That (remoteSources.Length > 0);
- }
-
- [Test]
- public void RefreshRemoteSource_Called_ReturnsTrue()
- {
- //arrange
- _installManager.SetUserDisclaimerConfirmed();
- _installManager.SyncConfig();
- string firstSource = _installManager.RemoteSources.First();
- bool result = _installManager.RefreshRemoteSource(firstSource);
-
- //act
- Assert.That (result, Is.True);
- }
-
- [Test]
- public void GetRemoteModInfoList_FirstSource_ReturnsModInfoList()
- {
- //arrange
- _installManager.SetUserDisclaimerConfirmed();
- _installManager.SyncConfig();
- string firstSource = _installManager.RemoteSources.First();
- _installManager.RefreshRemoteSource(firstSource);
-
- ModInfo[] remoteModInfos;
- using(Manager manager = new Manager())
- {
- //act
- remoteModInfos = _installManager.GetRemoteModInfoList(manager, firstSource).ToArray();
- }
-
- //assert
- Assert.That (remoteModInfos.Length, Is.GreaterThan(0));
- }
-
- [Test]
- public void RemoteInstallModule_KJV_ReturnsTrue()
- {
- //arrange
- _installManager.SetUserDisclaimerConfirmed();
- Assert.That (_installManager.SyncConfig(), Is.True);
- Assert.That (_installManager.RefreshRemoteSource("CrossWire"), Is.True);
-
- using(Manager manager = new Manager("LocalManager"))
- {
- //act
- bool result = _installManager.RemoteInstallModule(manager, "CrossWire", "KJV");
-
- //assert
- Assert.That (result, Is.True);
- }
- }
- }
-}
-
Deleted: branches/sword-1-7-x/bindings/csharp/ManagerTests.cs
===================================================================
--- branches/sword-1-7-x/bindings/csharp/ManagerTests.cs 2014-04-29 04:05:11 UTC (rev 3200)
+++ branches/sword-1-7-x/bindings/csharp/ManagerTests.cs 2014-04-29 04:06:19 UTC (rev 3201)
@@ -1,111 +0,0 @@
-// Copyright 2014 CrossWire Bible Society (http://www.crosswire.org)
-// CrossWire Bible Society
-// P. O. Box 2528
-// Tempe, AZ 85280-2528
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation version 2.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-using System;
-using NUnit.Framework;
-using System.IO;
-using System.Linq;
-
-namespace Sword.Tests
-{
- [TestFixture]
- public class ManagerTests
- {
- Manager _manager;
-
- [TestFixtureSetUp]
- public void Setup()
- {
- _manager = new Manager();
- }
-
- [TestFixtureTearDown]
- public void TearDown()
- {
- _manager.Dispose();
- }
-
- [Test]
- public void Version_Get_ReturnsAVersion()
- {
- //act
- string swordVersion = _manager.Version;
-
- //assert
- Version version;
- Assert.That (Version.TryParse(swordVersion, out version));
- }
-
- [Test]
- public void PrefixPath_Get_ReturnsValidPath()
- {
- //act
- string prefixPath = _manager.PrefixPath;
-
- //assert
- Assert.That (Directory.Exists(prefixPath), Is.True);
- }
-
- [Test]
- public void ConfigPath_Get_ReturnsValidPath()
- {
- //act
- string configPath = _manager.ConfigPath;
-
- //assert
- Assert.That (Directory.Exists(configPath), Is.True);
- }
-
- [Test]
- public void SetCipherKey_Called_DoesntCrash()
- {
- //act
- _manager.SetCipherKey("ESV", new byte[32]);
- }
-
- [Test]
- public void Javascript_Set_DoesntCrash()
- {
- //act
- _manager.Javascript = true;
- }
-
- [Test]
- public void AvailableLocales_Get_DoesntCrash()
- {
- //act
- var availableLocales = _manager.AvailableLocales.ToArray();
-
- //Assert
- Assert.That (availableLocales[0].Contains("en"));
- }
-
- [Test]
- public void DefaultLocale_SetToEn_DoesntCrash()
- {
- //act
- _manager.DefaultLocale = "en";
- }
-
- [Test]
- public void Translate_EnglishToEnglish_ReturnsOrginal()
- {
- //act
- var result = _manager.Translate("love", "en");
-
- //assert
- Assert.That (result, Is.EqualTo("love"));
- }
- }
-}
-
Modified: branches/sword-1-7-x/bindings/csharp/Module.cs
===================================================================
--- branches/sword-1-7-x/bindings/csharp/Module.cs 2014-04-29 04:05:11 UTC (rev 3200)
+++ branches/sword-1-7-x/bindings/csharp/Module.cs 2014-04-29 04:06:19 UTC (rev 3201)
@@ -74,7 +74,7 @@
}
}
- public string Rendertext()
+ public string RenderText()
{
IntPtr keyTextPtr = NativeMethods.org_crosswire_sword_SWModule_renderText(_handle);
return Marshal.PtrToStringAnsi(keyTextPtr);
Deleted: branches/sword-1-7-x/bindings/csharp/ModuleTests.cs
===================================================================
--- branches/sword-1-7-x/bindings/csharp/ModuleTests.cs 2014-04-29 04:05:11 UTC (rev 3200)
+++ branches/sword-1-7-x/bindings/csharp/ModuleTests.cs 2014-04-29 04:06:19 UTC (rev 3201)
@@ -1,162 +0,0 @@
-// Copyright 2014 CrossWire Bible Society (http://www.crosswire.org)
-// CrossWire Bible Society
-// P. O. Box 2528
-// Tempe, AZ 85280-2528
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the
-// Free Software Foundation version 2.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-using System;
-using NUnit.Framework;
-using System.IO;
-
-namespace Sword.Tests
-{
- [TestFixture]
- public class ModuleTests
- {
- Module _swordModule;
- Manager _swordManager;
-
- [TestFixtureSetUp]
- public void Setup()
- {
- _swordManager = new Manager("LocalManager");
- _swordModule = _swordManager.GetModuleByName("ESV");
-
- if(_swordModule != null)
- {
- return;
- }
- using(var installManager = new InstallManager("baseDirectory"))
- {
- installManager.SetUserDisclaimerConfirmed();
- installManager.SyncConfig();
- installManager.RefreshRemoteSource("CrossWire");
-
- installManager.RemoteInstallModule(_swordManager, "CrossWire", "ESV");
- _swordModule = _swordManager.GetModuleByName("ESV");
- }
- }
-
- [TestFixtureTearDown]
- public void TearDown()
- {
- _swordManager.Dispose();
- }
-
- [Test]
- public void Name_Get_Esv()
- {
- //arrange
- //act
- string name =_swordModule.Name;
-
- //assert
- Assert.That (name, Is.EqualTo ("ESV"));
- }
-
- [Test]
- public void Description_Get_DescriptionCorrect()
- {
- //arrange
- //act
- string description =_swordModule.Description;
-
- //assert
- Assert.That (description, Is.EqualTo ("English Standard Version"));
- }
-
- [Test]
- public void Catagory_Get_CatagoryCorrect()
- {
- //arrange
- //act
- string catagory =_swordModule.Category;
-
- //assert
- Assert.That (catagory, Is.EqualTo ("Biblical Texts"));
- }
-
- [Test]
- public void Previous_John3v16_John3v15()
- {
- //arrange
- _swordModule.KeyText = "jn.3.16";
-
- //act
- _swordModule.Prevous();
-
- //assert
- Assert.That (_swordModule.KeyText, Is.EqualTo( "John 3:15"));
- }
-
- [Test]
- public void Next_John3v15_John3v16()
- {
- //arrange
- _swordModule.KeyText = "jn.3.15";
-
- //act
- _swordModule.Next();
-
- //assert
- Assert.That (_swordModule.KeyText, Is.EqualTo( "John 3:16"));
- }
-
- [Test]
- public void Begin_John3v15_Genesis1v1()
- {
- //arrange
- _swordModule.KeyText = "jn.3.15";
-
- //act
- _swordModule.Begin();
-
- //assert
- Assert.That (_swordModule.KeyText, Is.EqualTo( "Genesis 1:1"));
- }
-
- [Test]
- public void RenderHeader_John3v16_ReturnsNonNullOrEmpty()
- {
- //arrange
- _swordModule.KeyText = "jn.3.16";
-
- //act
- string header = _swordModule.RenderHeader;
-
- //assert
- Assert.That (!string.IsNullOrEmpty(header));
- }
-
- [Test]
- public void RawEntry_Get_ContainsVerse()
- {
- //arrange
- _swordModule.KeyText = "jn.3.16";
-
- //act
- string rawEntry = _swordModule.RawEntry;
-
- //assert
- Assert.That (rawEntry.Contains ("God so loved"));
- }
-
- public void HasSearchFramework_Doesnt_ReturnsFalse()
- {
- //arrange
- //act
- bool hasSearchFramework = _swordModule.HasSearchFramework();
-
- //assert
- Assert.That (hasSearchFramework, Is.False);
- }
- }
-}
-
Deleted: branches/sword-1-7-x/bindings/csharp/Sword.Tests.csproj
===================================================================
--- branches/sword-1-7-x/bindings/csharp/Sword.Tests.csproj 2014-04-29 04:05:11 UTC (rev 3200)
+++ branches/sword-1-7-x/bindings/csharp/Sword.Tests.csproj 2014-04-29 04:06:19 UTC (rev 3201)
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>10.0.0</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{72212684-1186-4F68-8FBD-BDBFDB8CC9BC}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <RootNamespace>Sword.Tests</RootNamespace>
- <AssemblyName>CSSword.Tests</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug</OutputPath>
- <DefineConstants>DEBUG;</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Externalconsole>true</Externalconsole>
- <Commandlineparameters>ESV jn.3.16</Commandlineparameters>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>none</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Release</OutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <Externalconsole>true</Externalconsole>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="nunit.core, Version=2.5.10.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
- <Private>False</Private>
- <Package>mono-nunit</Package>
- </Reference>
- <Reference Include="nunit.framework, Version=2.5.10.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
- <Private>False</Private>
- <Package>mono-nunit</Package>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="FlatApiLookup.cs" />
- <Compile Include="ModuleTests.cs" />
- <Compile Include="ManagerTests.cs" />
- <Compile Include="InstallManagerTests.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup>
- <ProjectReference Include="..\Sword\Sword.csproj">
- <Project>{EFEE3557-86F2-4E46-AF7E-8BADEE240764}</Project>
- <Name>Sword</Name>
- </ProjectReference>
- </ItemGroup>
-</Project>
\ No newline at end of file
More information about the sword-cvs
mailing list