Skip to content
This repository was archived by the owner on Aug 7, 2022. It is now read-only.

Commit

Permalink
Moved all scripting to OMODFramework.Scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
erri120 committed Feb 14, 2020
1 parent b3746f8 commit 4acbf25
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 41 deletions.
61 changes: 61 additions & 0 deletions OMODFramework.Scripting/OMODFramework.Scripting.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F53B7974-2131-4907-B503-80562EA3DD39}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OMODFramework.Scripting</RootNamespace>
<AssemblyName>OMODFramework.Scripting</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Scripting\DotNetScriptFunctions.cs" />
<Compile Include="Scripting\DotNetScriptHandler.cs" />
<Compile Include="Scripting\IScriptFunctions.cs" />
<Compile Include="Scripting\OBMMScriptHandler.cs" />
<Compile Include="Scripting\Public.cs" />
<Compile Include="Scripting\ScriptRunner.cs" />
<Compile Include="Scripting\SharedFunction.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OMODFramework\OMODFramework.csproj">
<Project>{715a10c0-cac4-49b2-8a1d-0d6dd2e31f45}</Project>
<Name>OMODFramework</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
36 changes: 36 additions & 0 deletions OMODFramework.Scripting/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OMODFramework.Scripting")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OMODFramework.Scripting")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f53b7974-2131-4907-b503-80562ea3dd39")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ You should have received a copy of the GNU General Public License
using System.Windows.Forms;
using OblivionModManager.Scripting;
using OMODFramework.Classes;
using Directory = Alphaleonis.Win32.Filesystem.Directory;
using File = Alphaleonis.Win32.Filesystem.File;
using Path = Alphaleonis.Win32.Filesystem.Path;

namespace OMODFramework.Scripting
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Security;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using Alphaleonis.Win32.Filesystem;
using Microsoft.CSharp;
using Microsoft.VisualBasic;
using OblivionModManager.Scripting;
using OMODFramework;

namespace OMODFramework.Scripting
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,8 @@ You should have received a copy of the GNU General Public License

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using OMODFramework.Classes;
using Directory = Alphaleonis.Win32.Filesystem.Directory;
using File = Alphaleonis.Win32.Filesystem.File;
using Path = Alphaleonis.Win32.Filesystem.Path;

namespace OMODFramework.Scripting
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,23 @@ You should have received a copy of the GNU General Public License

namespace OMODFramework.Scripting
{
internal class ScriptRunner
public class ScriptRunner
{
public static ScriptReturnData RunScript(OMOD omod, IScriptFunctions scriptFunctions)
{
return ExecuteScript(omod.GetScript(), omod.GetDataFiles(), omod.GetPlugins(), scriptFunctions);
}

public static ScriptReturnData RunScript(OMOD omod, IScriptFunctions scriptFunctions, string data)
{
return ExecuteScript(omod.GetScript(), data, omod.GetPlugins(), scriptFunctions);
}

public static ScriptReturnData RunScript(OMOD omod, IScriptFunctions scriptFunctions, string data, string plugin)
{
return ExecuteScript(omod.GetScript(), data, plugin, scriptFunctions);
}

internal static ScriptReturnData ExecuteScript(string script, string dataPath, string pluginsPath, IScriptFunctions scriptFunctions)
{
Utils.Info("Starting script execution...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ You should have received a copy of the GNU General Public License
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using Alphaleonis.Win32.Filesystem;
using OblivionModManager.Scripting;
using OMODFramework.Classes;

namespace OMODFramework.Scripting
Expand Down
6 changes: 6 additions & 0 deletions OMODFramework.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OMODFramework.Test", "OMODFramework.Test\OMODFramework.Test.csproj", "{6CE95134-55F1-40E9-910A-A9A4FBB02902}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OMODFramework.Scripting", "OMODFramework.Scripting\OMODFramework.Scripting.csproj", "{F53B7974-2131-4907-B503-80562EA3DD39}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -26,6 +28,10 @@ Global
{6CE95134-55F1-40E9-910A-A9A4FBB02902}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CE95134-55F1-40E9-910A-A9A4FBB02902}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CE95134-55F1-40E9-910A-A9A4FBB02902}.Release|Any CPU.Build.0 = Release|Any CPU
{F53B7974-2131-4907-B503-80562EA3DD39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F53B7974-2131-4907-B503-80562EA3DD39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F53B7974-2131-4907-B503-80562EA3DD39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F53B7974-2131-4907-B503-80562EA3DD39}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
16 changes: 0 additions & 16 deletions OMODFramework/Classes/OMOD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ You should have received a copy of the GNU General Public License
using System.Drawing;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using OMODFramework.Scripting;
using Path = Alphaleonis.Win32.Filesystem.Path;

namespace OMODFramework
Expand Down Expand Up @@ -314,21 +313,6 @@ public static void CreateOMOD(OMODCreationOptions ops, string omodFileName)
Utils.Info("Finished OMOD creation");
}

public ScriptReturnData RunScript(IScriptFunctions scriptFunctions)
{
return ScriptRunner.ExecuteScript(GetScript(), GetDataFiles(), GetPlugins(), scriptFunctions);
}

public ScriptReturnData RunScript(IScriptFunctions scriptFunctions, string data)
{
return ScriptRunner.ExecuteScript(GetScript(), data, GetPlugins(), scriptFunctions);
}

public ScriptReturnData RunScript(IScriptFunctions scriptFunctions, string data, string plugin)
{
return ScriptRunner.ExecuteScript(GetScript(), data, plugin, scriptFunctions);
}

private HashSet<string> GetPluginSet()
{
var tempStream = ExtractWholeFile("plugins.crc");
Expand Down
7 changes: 0 additions & 7 deletions OMODFramework/OMODFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@
<Compile Include="ICodeProgress.cs" />
<Compile Include="ILogger.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Scripting\DotNetScriptFunctions.cs" />
<Compile Include="Scripting\DotNetScriptHandler.cs" />
<Compile Include="Scripting\IScriptFunctions.cs" />
<Compile Include="Scripting\OBMMScriptHandler.cs" />
<Compile Include="Scripting\Public.cs" />
<Compile Include="Scripting\ScriptRunner.cs" />
<Compile Include="Scripting\SharedFunction.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions OMODFramework/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: InternalsVisibleTo("OMODFramework.Test")]
[assembly: InternalsVisibleTo("OMODFramework.Scripting")]
[assembly: NeutralResourcesLanguage("en")]

0 comments on commit 4acbf25

Please sign in to comment.