1 страниц (2 вхождений)
TinyPlugin - A guide to creating a simple extension. - Сообщения
#1 Опубликовано: 06.08.2019 15:50:16




📝 Links:
1. How to create plugins for SMath Studio
2. Command-line build with csc.exe
3. Template project for numerical plugin (VS2017, .Net 2.0+, C#)
4. SMath Studio Core documentation (CHM)
5. Developer Guide (partially obsolete)
For c#:
1. Create file build.cmd
::Autor: Viacheslav N. Mezentsev (viacheslavmezentsev@ya.ru)
@echo off && cls
set dotnet=%windir%\Microsoft.NET\Framework64
if "%~x1" == ".cs" set lang=cs
if "%~x1" == ".vb" set lang=vb
for %%n in (2.0.50727,3.5,4.0.30319) do if exist "%dotnet%\v%%n\%lang%c.exe" set comp="%dotnet%\v%%n\%lang%c.exe"
if exist %comp% (
%comp% -nologo ^
-target:library ^
-lib:"%ProgramFiles(x86)%\SMath Studio" ^
-reference:System.Xml.dll,System.Data.dll,SMath.Controls.dll,SMath.Manager.dll,SMath.Math.Numeric.dll,SMath.Math.Symbolic.dll ^
-out:"%~n1.dll" %1 ) && echo SMath plugin: "%~n1.dll"
)
2. Create source file CSTinyPlugin.cs
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using SMath.Manager;
using SMath.Math;
using SMath.Math.Numeric;
[assembly: AssemblyTitle( "CSTinyPlugin" )]
[assembly: AssemblyDescription( "Template project for numerical plugin." )]
[assembly: AssemblyVersion("0.1.*"
]
// NOTE: Each plugin must have unique GUID. Use online guid generators for this.
[assembly: Guid("3F8D4EC4-637C-4E5E-95D1-4F0422B71A27"
]
public class Plugin : IPluginMathNumericEvaluation
{
private TermInfo[] _terms;
private Dictionary<string, string> _description = new Dictionary<string, string> { { "ENG", "mult function." }, { "RUS", "функция умножения." } };
public TermInfo[] GetTermsHandled( SessionProfile sessionProfile )
{
return _terms;
}
public void Initialize()
{
_terms = new[] {
new TermInfo (
"mult", TermType.Function, _description[ "ENG" ], FunctionSections.Unknown, true,
new[] { new ArgumentInfo( ArgumentSections.RealNumber ), new ArgumentInfo( ArgumentSections.RealNumber ) }
)};
}
public bool NumericEvaluation( Term value, TNumber[] args, ref TNumber result )
{
result = args[0] * args[1];
return true;
}
public void Dispose() {}
}
3. Build assembly using command: build CSTinyPlugin.cs
Also you can use drag and drop technique for this.
You get CSTinyPlugin.dll
5. Copy CSTinyPlugin.dll to the C:\Program Files (x86)\SMath Studio\plugins folder and restart the program.
6. Test it.
7. Read the SMath Studio Core documentation: SSCoreDoc.chm.
Russia ☭ forever, Viacheslav N. Mezentsev
2 пользователям понравился этот пост
#2 Опубликовано: 06.08.2019 17:28:27
📝 Links:
1. How to create plugins for SMath Studio
2. Sample compilation command lines (Visual Basic)
3. Template project for numerical plugin (VS2017, .Net 2.0+, VB.Net)
4. SMath Studio Core documentation (CHM)
5. Developer Guide (partially obsolete)
For vb.net:
1. Create file build.cmd
2. Create source file VBTinyPlugin.vb
3. Build assembly using command: build VBTinyPlugin.vb
Also you can use drag and drop technique for this.

You get VBTinyPlugin.dll
5. Copy VBTinyPlugin.dll to the C:\Program Files (x86)\SMath Studio\plugins folder and restart the program.
6. Test it.

7. Read the SMath Studio Core documentation: SSCoreDoc.chm.

1. How to create plugins for SMath Studio
2. Sample compilation command lines (Visual Basic)
3. Template project for numerical plugin (VS2017, .Net 2.0+, VB.Net)
4. SMath Studio Core documentation (CHM)
5. Developer Guide (partially obsolete)
For vb.net:
1. Create file build.cmd
::Autor: Viacheslav N. Mezentsev (viacheslavmezentsev@ya.ru)
@echo off && cls
set dotnet=%windir%\Microsoft.NET\Framework64
if "%~x1" == ".cs" set lang=cs
if "%~x1" == ".vb" set lang=vb
for %%n in (2.0.50727,3.5,4.0.30319) do if exist "%dotnet%\v%%n\%lang%c.exe" set comp="%dotnet%\v%%n\%lang%c.exe"
if exist %comp% (
%comp% -nologo ^
-target:library ^
-lib:"%ProgramFiles(x86)%\SMath Studio" ^
-reference:System.Xml.dll,System.Data.dll,SMath.Controls.dll,SMath.Manager.dll,SMath.Math.Numeric.dll,SMath.Math.Symbolic.dll ^
-out:"%~n1.dll" %1 ) && echo SMath plugin: "%~n1.dll"
)
2. Create source file VBTinyPlugin.vb
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Collections.Generic
Imports SMath.Manager
Imports SMath.Math
Imports SMath.Math.Numeric
<Assembly: AssemblyTitle("VBTinyPlugin"
>
<Assembly: AssemblyDescription("Template project for numerical plugin."
>
<Assembly: AssemblyVersion("0.1.*"
>
' NOTE: Each plugin must have unique GUID. Use online guid generators for this.
<Assembly: Guid("FB41BCBC-11EC-4D8D-BDE1-C5772608EEA9"
>
Public Class Plugin
Implements IPluginMathNumericEvaluation
Private _terms As TermInfo()
Private _description As Dictionary(Of String, String) = New Dictionary(Of String, String) From {
{"ENG", "mult function."},
{"RUS", "функция умножения."}
}
Public Function GetTermsHandled(sessionProfile As SessionProfile) As TermInfo() Implements IPluginHandleEvaluation.GetTermsHandled
Return _terms
End Function
Public Sub Initialize() Implements IPlugin.Initialize
_terms = {New TermInfo("mult", TermType.[Function], _description("ENG"
, FunctionSections.Unknown, True,
{ New ArgumentInfo(ArgumentSections.RealNumber), New ArgumentInfo(ArgumentSections.RealNumber)}) }
End Sub
Public Function NumericEvaluation(value As Term, args As TNumber(), ByRef result As TNumber) As Boolean Implements IPluginMathNumericEvaluation.NumericEvaluation
result = args(0) * args(1)
Return True
End Function
Public Sub Dispose() Implements IDisposable.Dispose
End Sub
End Class
3. Build assembly using command: build VBTinyPlugin.vb
Also you can use drag and drop technique for this.
You get VBTinyPlugin.dll
5. Copy VBTinyPlugin.dll to the C:\Program Files (x86)\SMath Studio\plugins folder and restart the program.
6. Test it.
7. Read the SMath Studio Core documentation: SSCoreDoc.chm.
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
frapuano 07.08.2019 11:22:00
1 страниц (2 вхождений)
-
Новые сообщения
-
Нет новых сообщений