Skip to content

Commit

Permalink
Minor fix/improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
enkomio committed Nov 12, 2018
1 parent 00dd960 commit 2a03bc3
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 88 deletions.
12 changes: 6 additions & 6 deletions Src/AssembleManagedInstructions/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Sacara")>]
[<assembly: AssemblyCompanyAttribute("Enkomio")>]
[<assembly: AssemblyDescriptionAttribute("A VM stack based IR language well suite for code protection.")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.0.0.*")>]
[<assembly: AssemblyVersionAttribute("2.1.0")>]
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.1.0.*")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "AssembleManagedInstructions"
let [<Literal>] AssemblyProduct = "Sacara"
let [<Literal>] AssemblyCompany = "Enkomio"
let [<Literal>] AssemblyDescription = "A VM stack based IR language well suite for code protection."
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
let [<Literal>] AssemblyInformationalVersion = "2.0.0.*"
let [<Literal>] AssemblyVersion = "2.1.0"
let [<Literal>] AssemblyFileVersion = "2.1.0"
let [<Literal>] AssemblyInformationalVersion = "2.1.0.*"
12 changes: 6 additions & 6 deletions Src/DotNetBinding/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Sacara")>]
[<assembly: AssemblyCompanyAttribute("Enkomio")>]
[<assembly: AssemblyDescriptionAttribute("A VM stack based IR language well suite for code protection.")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.0.0.*")>]
[<assembly: AssemblyVersionAttribute("2.1.0")>]
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.1.0.*")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "DotNetBinding"
let [<Literal>] AssemblyProduct = "Sacara"
let [<Literal>] AssemblyCompany = "Enkomio"
let [<Literal>] AssemblyDescription = "A VM stack based IR language well suite for code protection."
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
let [<Literal>] AssemblyInformationalVersion = "2.0.0.*"
let [<Literal>] AssemblyVersion = "2.1.0"
let [<Literal>] AssemblyFileVersion = "2.1.0"
let [<Literal>] AssemblyInformationalVersion = "2.1.0.*"
12 changes: 6 additions & 6 deletions Src/ES.Sacara.Ir.Assembler/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Sacara")>]
[<assembly: AssemblyCompanyAttribute("Enkomio")>]
[<assembly: AssemblyDescriptionAttribute("A VM stack based IR language well suite for code protection.")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.0.0.*")>]
[<assembly: AssemblyVersionAttribute("2.1.0")>]
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.1.0.*")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "ES.Sacara.Ir.Assembler"
let [<Literal>] AssemblyProduct = "Sacara"
let [<Literal>] AssemblyCompany = "Enkomio"
let [<Literal>] AssemblyDescription = "A VM stack based IR language well suite for code protection."
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
let [<Literal>] AssemblyInformationalVersion = "2.0.0.*"
let [<Literal>] AssemblyVersion = "2.1.0"
let [<Literal>] AssemblyFileVersion = "2.1.0"
let [<Literal>] AssemblyInformationalVersion = "2.1.0.*"
12 changes: 6 additions & 6 deletions Src/ES.Sacara.Ir.Core/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Sacara")>]
[<assembly: AssemblyCompanyAttribute("Enkomio")>]
[<assembly: AssemblyDescriptionAttribute("A VM stack based IR language well suite for code protection.")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.0.0.*")>]
[<assembly: AssemblyVersionAttribute("2.1.0")>]
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.1.0.*")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "ES.Sacara.Ir.Core"
let [<Literal>] AssemblyProduct = "Sacara"
let [<Literal>] AssemblyCompany = "Enkomio"
let [<Literal>] AssemblyDescription = "A VM stack based IR language well suite for code protection."
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
let [<Literal>] AssemblyInformationalVersion = "2.0.0.*"
let [<Literal>] AssemblyVersion = "2.1.0"
let [<Literal>] AssemblyFileVersion = "2.1.0"
let [<Literal>] AssemblyInformationalVersion = "2.1.0.*"
27 changes: 15 additions & 12 deletions Src/ES.Sacara.Ir.Core/Instructions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,22 @@ module Instructions =
member val OpCodes = new List<Int32>() with get, set

let readVmOpCodeBinding() =
let currentDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
let currentDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
let filename = Path.Combine(currentDir, "vm_opcodes.json")
let json = File.ReadAllText(filename)
JsonConvert.DeserializeObject<List<VmOpCodeItem>>(json)
|> Seq.map(fun item ->
let vmOpCode =
FSharpType.GetUnionCases typeof<VmOpCodes>
|> Array.find(fun case -> case.Name.Equals(item.Name, StringComparison.OrdinalIgnoreCase))
|> fun case -> FSharpValue.MakeUnion(case,[||]) :?> VmOpCodes
let bytes = item.OpCodes |> Seq.toList
(vmOpCode, bytes)
)
|> Map.ofSeq
if File.Exists(filename) then
let json = File.ReadAllText(filename)
JsonConvert.DeserializeObject<List<VmOpCodeItem>>(json)
|> Seq.map(fun item ->
let vmOpCode =
FSharpType.GetUnionCases typeof<VmOpCodes>
|> Array.find(fun case -> case.Name.Equals(item.Name, StringComparison.OrdinalIgnoreCase))
|> fun case -> FSharpValue.MakeUnion(case,[||]) :?> VmOpCodes
let bytes = item.OpCodes |> Seq.toList
(vmOpCode, bytes)
)
|> Map.ofSeq
else
raise(new ApplicationException(String.Format("JSON file with opcodes '{0}' not found.", filename)))

// each VM opcode can have different format. The file was generate with the GenerateVmOpCodes utility
let bytes = readVmOpCodeBinding()
12 changes: 6 additions & 6 deletions Src/ES.Sacara.Ir.Obfuscator/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Sacara")>]
[<assembly: AssemblyCompanyAttribute("Enkomio")>]
[<assembly: AssemblyDescriptionAttribute("A VM stack based IR language well suite for code protection.")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.0.0.*")>]
[<assembly: AssemblyVersionAttribute("2.1.0")>]
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.1.0.*")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "ES.Sacara.Ir.Obfuscator"
let [<Literal>] AssemblyProduct = "Sacara"
let [<Literal>] AssemblyCompany = "Enkomio"
let [<Literal>] AssemblyDescription = "A VM stack based IR language well suite for code protection."
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
let [<Literal>] AssemblyInformationalVersion = "2.0.0.*"
let [<Literal>] AssemblyVersion = "2.1.0"
let [<Literal>] AssemblyFileVersion = "2.1.0"
let [<Literal>] AssemblyInformationalVersion = "2.1.0.*"
12 changes: 6 additions & 6 deletions Src/ES.Sacara.Ir.Parser/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Sacara")>]
[<assembly: AssemblyCompanyAttribute("Enkomio")>]
[<assembly: AssemblyDescriptionAttribute("A VM stack based IR language well suite for code protection.")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.0.0.*")>]
[<assembly: AssemblyVersionAttribute("2.1.0")>]
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.1.0.*")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "ES.Sacara.Ir.Parser"
let [<Literal>] AssemblyProduct = "Sacara"
let [<Literal>] AssemblyCompany = "Enkomio"
let [<Literal>] AssemblyDescription = "A VM stack based IR language well suite for code protection."
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
let [<Literal>] AssemblyInformationalVersion = "2.0.0.*"
let [<Literal>] AssemblyVersion = "2.1.0"
let [<Literal>] AssemblyFileVersion = "2.1.0"
let [<Literal>] AssemblyInformationalVersion = "2.1.0.*"
12 changes: 6 additions & 6 deletions Src/ES.SacaraVm/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Sacara")>]
[<assembly: AssemblyCompanyAttribute("Enkomio")>]
[<assembly: AssemblyDescriptionAttribute("A VM stack based IR language well suite for code protection.")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.0.0.*")>]
[<assembly: AssemblyVersionAttribute("2.1.0")>]
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.1.0.*")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "ES.SacaraVm"
let [<Literal>] AssemblyProduct = "Sacara"
let [<Literal>] AssemblyCompany = "Enkomio"
let [<Literal>] AssemblyDescription = "A VM stack based IR language well suite for code protection."
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
let [<Literal>] AssemblyInformationalVersion = "2.0.0.*"
let [<Literal>] AssemblyVersion = "2.1.0"
let [<Literal>] AssemblyFileVersion = "2.1.0"
let [<Literal>] AssemblyInformationalVersion = "2.1.0.*"
2 changes: 1 addition & 1 deletion Src/ES.SacaraVm/SacaraVm.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type SacaraVm() =
let mutable _localVars = List.empty<UInt32 * UInt32>

do
let sacaraVmDll = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SacaraVm.dll")
let sacaraVmDll = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "SacaraVm.dll")
if not(File.Exists(sacaraVmDll)) then
failwith(String.Format("Unable to find the sacara DLL: {0}", sacaraVmDll))

Expand Down
12 changes: 6 additions & 6 deletions Src/GeneratePreBuildInfo/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Sacara")>]
[<assembly: AssemblyCompanyAttribute("Enkomio")>]
[<assembly: AssemblyDescriptionAttribute("A VM stack based IR language well suite for code protection.")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.0.0.*")>]
[<assembly: AssemblyVersionAttribute("2.1.0")>]
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.1.0.*")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "GeneratePreBuildInfo"
let [<Literal>] AssemblyProduct = "Sacara"
let [<Literal>] AssemblyCompany = "Enkomio"
let [<Literal>] AssemblyDescription = "A VM stack based IR language well suite for code protection."
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
let [<Literal>] AssemblyInformationalVersion = "2.0.0.*"
let [<Literal>] AssemblyVersion = "2.1.0"
let [<Literal>] AssemblyFileVersion = "2.1.0"
let [<Literal>] AssemblyInformationalVersion = "2.1.0.*"
12 changes: 6 additions & 6 deletions Src/SacaraAsm/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Sacara")>]
[<assembly: AssemblyCompanyAttribute("Enkomio")>]
[<assembly: AssemblyDescriptionAttribute("A VM stack based IR language well suite for code protection.")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.0.0.*")>]
[<assembly: AssemblyVersionAttribute("2.1.0")>]
[<assembly: AssemblyFileVersionAttribute("2.1.0")>]
[<assembly: AssemblyInformationalVersionAttribute("2.1.0.*")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "SacaraAsm"
let [<Literal>] AssemblyProduct = "Sacara"
let [<Literal>] AssemblyCompany = "Enkomio"
let [<Literal>] AssemblyDescription = "A VM stack based IR language well suite for code protection."
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
let [<Literal>] AssemblyInformationalVersion = "2.0.0.*"
let [<Literal>] AssemblyVersion = "2.1.0"
let [<Literal>] AssemblyFileVersion = "2.1.0"
let [<Literal>] AssemblyInformationalVersion = "2.1.0.*"
15 changes: 15 additions & 0 deletions Src/SacaraSln.sln
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "DotNetBinding", "Examples\D
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ErrorHandler", "Examples\ErrorHandler\ErrorHandler.vcxproj", "{7981A842-9996-4882-8034-44D258818E70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadEncryptedAssembly", "Examples\LoadEncryptedAssembly\LoadEncryptedAssembly.csproj", "{6FA73E74-13E3-4382-82AB-ECF34242CB12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -215,6 +217,18 @@ Global
{7981A842-9996-4882-8034-44D258818E70}.Release|x64.Build.0 = Release|x64
{7981A842-9996-4882-8034-44D258818E70}.Release|x86.ActiveCfg = Release|Win32
{7981A842-9996-4882-8034-44D258818E70}.Release|x86.Build.0 = Release|Win32
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Debug|x64.ActiveCfg = Debug|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Debug|x64.Build.0 = Debug|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Debug|x86.ActiveCfg = Debug|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Debug|x86.Build.0 = Debug|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Release|Any CPU.Build.0 = Release|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Release|x64.ActiveCfg = Release|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Release|x64.Build.0 = Release|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Release|x86.ActiveCfg = Release|Any CPU
{6FA73E74-13E3-4382-82AB-ECF34242CB12}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -234,6 +248,7 @@ Global
{23A1D5D4-E9A0-41E8-A3E4-974FF36FFC88} = {6F0152CF-3F11-4A8E-BD71-15EE6808EB18}
{3CBB34B2-2A0D-467D-BB4A-2F68600D674D} = {CEAF308B-D528-408C-B8E2-AF2D827FC80C}
{7981A842-9996-4882-8034-44D258818E70} = {CEAF308B-D528-408C-B8E2-AF2D827FC80C}
{6FA73E74-13E3-4382-82AB-ECF34242CB12} = {CEAF308B-D528-408C-B8E2-AF2D827FC80C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {99DA6142-552E-4F17-9197-0D2A0659289A}
Expand Down
44 changes: 23 additions & 21 deletions Src/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,22 @@ Target.create "SetAssemblyInfo" (fun _ ->
|> Seq.iter genFSAssemblyInfo
)

Target.create "SetBuildOptions" (fun _ ->
let buildOptionsContent = new StringBuilder("""
; #########################################################
; # DO NOT EDIT THIS FILE, WAIT FOR BUILDING COMPLETATION #
; #########################################################
""")
let setBuildOptions() =
let buildOptionsContent = new StringBuilder()
buildOptionsContent
.AppendLine("; #########################################################")
.AppendLine("; # DO NOT EDIT THIS FILE, WAIT FOR BUILDING COMPLETATION #")
.AppendLine("; #########################################################")
.AppendLine() |> ignore

buildOptions
|> List.iter(fun (name, value) ->
buildOptionsContent.AppendFormat("{0} = {1}", name, value).AppendLine() |> ignore
)
File.WriteAllText(buildOptionsFilename, buildOptionsContent.ToString())
)

let restoreBuildOptions() =
File.WriteAllText(buildOptionsFilename, savedBuildOptions)

Target.create "Compile" (fun _ ->
let build(project: String, buildDir: String) =
Expand All @@ -123,18 +127,18 @@ Target.create "Compile" (fun _ ->
|> Trace.logItems "AppBuild-Output: "

// build all projects
projects
|> List.map(fun projName ->
let projDir = Path.GetFileNameWithoutExtension(projName)
let projFile = Path.Combine(projDir, projName)
Trace.log("Build project: " + projFile)
projFile
)
|> List.iter(fun projectFile -> build(projectFile, buildDir))
)

Target.create "RestoreBuildOptions" (fun _ ->
File.WriteAllText(buildOptionsFilename, savedBuildOptions)
try
setBuildOptions()
projects
|> List.map(fun projName ->
let projDir = Path.GetFileNameWithoutExtension(projName)
let projFile = Path.Combine(projDir, projName)
Trace.log("Build project: " + projFile)
projFile
)
|> List.iter(fun projectFile -> build(projectFile, buildDir))
finally
restoreBuildOptions()
)

Target.create "Release" (fun _ ->
Expand Down Expand Up @@ -191,9 +195,7 @@ Target.create "Default" ignore

"Clean"
==> "SetAssemblyInfo"
==> "SetBuildOptions"
==> "Compile"
==> "RestoreBuildOptions"
==> "Release"
==> "Default"

Expand Down

0 comments on commit 2a03bc3

Please sign in to comment.