Skip to content

Commit

Permalink
Merge pull request #172 from strusoft/21.0.0
Browse files Browse the repository at this point in the history
21.0.0
  • Loading branch information
andosca authored Jan 21, 2022
2 parents c03dd25 + d11b4ad commit 1fcace6
Show file tree
Hide file tree
Showing 9 changed files with 3,753 additions and 15 deletions.
2 changes: 1 addition & 1 deletion FemDesign.Core/Calculate/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public partial class Application
/// <summary>
/// Target version of class library.
/// </summary>
internal string FdTargetVersion = "20";
internal string FdTargetVersion = "21";

public Application()
{
Expand Down
14 changes: 14 additions & 0 deletions FemDesign.Core/Model/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,20 @@ public void SerializeModel(string filePath)
serializer.Serialize(writer, this);
}
}

/// <summary>
/// Serialize Model to string.
/// </summary>
public string SerializeToString()
{
// serialize
XmlSerializer serializer = new XmlSerializer(typeof(Model));
using (TextWriter writer = new StringWriter())
{
serializer.Serialize(writer, this);
return writer.ToString();
}
}
#endregion

#region addEntities
Expand Down
5 changes: 3 additions & 2 deletions FemDesign.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("20.2.1.0")]
[assembly: AssemblyFileVersion("20.2.1.0")]

[assembly: AssemblyVersion("21.0.0.0")]
[assembly: AssemblyFileVersion("21.0.0.0")]
4 changes: 2 additions & 2 deletions FemDesign.Dynamo/PackageData/pkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"license": "",
"file_hash": null,
"name": "FemDesign",
"version": "20.2.1",
"version": "21.0.0",
"description": "FemDesign Api",
"group": "",
"keywords": null,
Expand All @@ -15,6 +15,6 @@
"repository_url": "",
"contains_binaries": true,
"node_libraries": [
"FemDesign.Dynamo, Version=20.2.1.0, Culture=neutral, PublicKeyToken=null"
"FemDesign.Dynamo, Version=21.0.0.0, Culture=neutral, PublicKeyToken=null"
]
}
32 changes: 23 additions & 9 deletions FemDesign.Grasshopper/FemDesign.Grasshopper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -38,18 +40,21 @@
<RootNamespace>FemDesign</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Reference Include="GH_IO">
<HintPath>..\..\..\Program Files\Rhino 6\Plug-ins\Grasshopper\GH_IO.dll</HintPath>
<Private>False</Private>
<Reference Include="Eto, Version=2.5.0.0, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
<HintPath>..\packages\RhinoCommon.6.35.21222.17001\lib\net45\Eto.dll</HintPath>
</Reference>
<Reference Include="Grasshopper">
<HintPath>..\..\..\Program Files\Rhino 6\Plug-ins\Grasshopper\Grasshopper.dll</HintPath>
<Private>False</Private>
<Reference Include="GH_IO, Version=6.35.21222.17000, Culture=neutral, PublicKeyToken=6a29997d2e6b4f97, processorArchitecture=MSIL">
<HintPath>..\packages\Grasshopper.6.35.21222.17001\lib\net45\GH_IO.dll</HintPath>
</Reference>
<Reference Include="Grasshopper, Version=6.35.21222.17000, Culture=neutral, PublicKeyToken=dda4f5ec2cd80803, processorArchitecture=MSIL">
<HintPath>..\packages\Grasshopper.6.35.21222.17001\lib\net45\Grasshopper.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="RhinoCommon">
<HintPath>..\..\..\Program Files\Rhino 6\System\RhinoCommon.dll</HintPath>
<Private>False</Private>
<Reference Include="Rhino.UI, Version=6.35.21222.17000, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
<HintPath>..\packages\RhinoCommon.6.35.21222.17001\lib\net45\Rhino.UI.dll</HintPath>
</Reference>
<Reference Include="RhinoCommon, Version=6.35.21222.17000, Culture=neutral, PublicKeyToken=552281e97c755530, processorArchitecture=MSIL">
<HintPath>..\packages\RhinoCommon.6.35.21222.17001\lib\net45\RhinoCommon.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -750,4 +755,13 @@
<Copy SourceFiles="@(Pdbs)" DestinationFolder="$(appdata)\Grasshopper\Libraries\FemDesign\" />
<Copy SourceFiles="@(Pdbs)" DestinationFolder="$(appdata)\Grasshopper\Libraries\FemDesign\" />
</Target>
<Import Project="..\packages\RhinoCommon.6.35.21222.17001\build\net45\RhinoCommon.targets" Condition="Exists('..\packages\RhinoCommon.6.35.21222.17001\build\net45\RhinoCommon.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\RhinoCommon.6.35.21222.17001\build\net45\RhinoCommon.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RhinoCommon.6.35.21222.17001\build\net45\RhinoCommon.targets'))" />
<Error Condition="!Exists('..\packages\Grasshopper.6.35.21222.17001\build\net45\Grasshopper.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grasshopper.6.35.21222.17001\build\net45\Grasshopper.targets'))" />
</Target>
<Import Project="..\packages\Grasshopper.6.35.21222.17001\build\net45\Grasshopper.targets" Condition="Exists('..\packages\Grasshopper.6.35.21222.17001\build\net45\Grasshopper.targets')" />
</Project>
2 changes: 2 additions & 0 deletions FemDesign.Grasshopper/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
<packages>
<package id="DynamoVisualProgramming.DynamoServices" version="2.10.1.3976" targetFramework="net48" />
<package id="DynamoVisualProgramming.ZeroTouchLibrary" version="2.10.1.3976" targetFramework="net48" />
<package id="Grasshopper" version="6.35.21222.17001" targetFramework="net472" />
<package id="RhinoCommon" version="6.35.21222.17001" targetFramework="net472" />
</packages>
5 changes: 4 additions & 1 deletion FemDesign.Tests/FemDesign.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Expand All @@ -66,6 +66,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Model\global-test-model.struxml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand Down
26 changes: 26 additions & 0 deletions FemDesign.Tests/Model/ModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,31 @@ public void ModelTest()
Assert.IsNotNull(model, "Can construct model");
Assert.IsTrue(model.Country == FemDesign.Country.S, "Should construct model with country code preserved");
}

/// <summary>
/// Test if global test model can be deserialised from path and then serialised to string.
/// To check which version the test file was generated in check source software attribute in file.
/// </summary>
[TestMethod("ReadWriteConsole")]
public void ReadWriteConsole()
{
string input = "Model/global-test-model.struxml";
Model model = Model.DeserializeFromFilePath(input);
Console.Write(model.SerializeToString());
}

/// <summary>
/// Test if global test model can be deserialised from path and then serialised to file.
/// The file can then be opened in FEM-Design to look for errors.
/// To check which version the test file was generated in check source software attribute in file.
/// </summary>
[TestMethod("ReadWriteFile")]
public void ReadWriteFile()
{
string input = "Model/global-test-model.struxml";
string output = "Model/readWriteFile.struxml";
Model model = Model.DeserializeFromFilePath(input);
model.SerializeModel(output);
}
}
}
Loading

0 comments on commit 1fcace6

Please sign in to comment.