Platforms to show: All Mac Windows Linux Cross-Platform

/Main/Obfuscate/Obfuscate Xojo Plugins


Required plugins for this example: MBS Compression Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Obfuscate/Obfuscate Xojo Plugins

This example is the version from Fri, 1st Oct 2015.

Project "Obfuscate Xojo Plugins.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() run End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() // does not work right currently. run_Internal End EventHandler
End Control
Function ObfuscateDLLName(name as string) As string if right(name, 4) = ".dll" then CountDLLChanges = CountDLLChanges + 1 dim parts() as string = split(name, "/") parts(UBound(parts)) = PluginPrefix+format(CountDLLChanges,"000")+".dll" Return Join(parts, "/") elseif right(name, 6) = ".dylib" then CountDLLChanges = CountDLLChanges + 1 dim parts() as string = split(name, "/") parts(UBound(parts)) = PluginPrefix+format(CountDLLChanges,"000")+".dylib" Return Join(parts, "/") elseif right(name, 3) = ".so" then CountDLLChanges = CountDLLChanges + 1 dim parts() as string = split(name, "/") parts(UBound(parts)) = PluginPrefix+format(CountDLLChanges,"000")+".so" Return Join(parts, "/") else Return name end if End Function
Function ObfuscatePluginName(name as string) As string CountPluginChanges = CountPluginChanges + 1 Return PluginPrefix+Format(CountPluginChanges,"000")+".xojo_plugin" End Function
Sub Process(source as FolderItem, dest as FolderItem) dim uz as new UnZipMBS(source) dim z as new ZipMBS(dest,0) uz.GoToFirstFile do dim path as string = uz.FileName dim info as UnZipFileInfoMBS = uz.FileInfo dim buffer as string uz.OpenCurrentFile if uz.Lasterror=0 then buffer = uz.ReadCurrentFile(50000000) uz.CloseCurrentFile dim finfo as new ZipFileInfoMBS finfo.ExternalFileAttributes = info.ExternalFileAttributes finfo.InternalFileAttributes = info.InternalFileAttributes finfo.Day = info.Day finfo.Hour = info.Hour finfo.Minute = info.Minute finfo.Month = info.Month finfo.Second = info.Second finfo.Year = info.Year path = ObfuscateDLLName(path) z.CreateFile path, finfo, "", "", "", z.MethodDeflated, z.CompressionBestCompression z.Write buffer z.CloseFile end if uz.GoToNextFile loop until uz.Lasterror<>0 z.Close("") End Sub
Sub ProcessFolder(f as FolderItem) dim files() as FolderItem dim c as integer = f.Count for i as integer = 1 to c dim g as FolderItem = f.TrueItem(i) if g<>Nil then files.append g end if next for each item as FolderItem in files if item.Directory then ProcessFolder item else item.name = ObfuscateDLLName(item.name) end if next End Sub
Sub WalkFolder(f as FolderItem) dim g,files(-1) as FolderItem dim i,c as integer c=f.Count for i=1 to c g=f.TrueItem(i) if g<>Nil and right(g.name, 12)=".xojo_plugin" then files.Append g end if next for each g in files dim name as string = ObfuscatePluginName(g.name) if g.Directory then ProcessFolder g g.name = name else dim dest as FolderItem = g.parent.Child(name) Process g, dest g.Delete end if next End Sub
Sub run() dim f as FolderItem CountPluginChanges = 0 CountDLLChanges = 0 PluginPrefix = "Lib_" f=SelectFolder if f=nil then Return WalkFolder f MsgBox "Changed "+str(CountPluginChanges)+" plugin names and "+str(CountDLLChanges)+" DLL names." End Sub
Sub run_Internal() Dim MyTypes as New FileType MyTypes.Name="App Types" MyTypes.Extensions=".app" dim f as FolderItem F = GetOpenFolderItem(MyTypes) if f=nil then Return CountPluginChanges = 0 CountDLLChanges = 0 PluginPrefix = "iLib_" Dim G as FolderItem G = F.Child("Contents") If G <> nil And G.Exists then G = G.Child("Resources") If G <> nil And G.Exists then G = G.Child("Internal Plugins") If G <> nil And G.Exists then WalkFolder G Else Return End If End If End If MsgBox "Changed "+str(CountPluginChanges)+" plugin names and "+str(CountDLLChanges)+" DLL names." End Sub
Property CountDLLChanges As Integer
Property CountPluginChanges As Integer
Property PluginPrefix As String
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

See also:

The items on this page are in the following plugins: MBS Main Plugin.


The biggest plugin in space...