mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Bug fixes, installer, [Export]
Fixed a bunch of bugs in aggregate const initializers Fixed ZIP bugs Fixed a compilation case where we change protection while reifying a type Added another project kind - Dynamic Library Added [Export] for DLL method exporting Fixed some issues of things being generated as __NOINLINE incorrectly Fixed an issue with module extensions with not-yet-demanded on-demand methods Started adding Installer
This commit is contained in:
parent
efa22e51fb
commit
09016c8dc0
135 changed files with 3615 additions and 2337 deletions
|
@ -1,11 +0,0 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "BeefInstall"
|
||||
StartupObject = "BeefInstall.Program"
|
||||
|
||||
[ProjectFolder]
|
||||
|
||||
[[ProjectFolder.Items]]
|
||||
Type = "Source"
|
||||
Path = "../../IDE/src/util/Zip.bf"
|
|
@ -1,6 +0,0 @@
|
|||
FileVersion = 1
|
||||
Projects = {BeefInstall = {Path = "."}}
|
||||
Unlocked = ["corlib"]
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "BeefInstall"
|
|
@ -1,136 +0,0 @@
|
|||
FileVersion = 1
|
||||
LastConfig = "Debug"
|
||||
LastPlatform = "Win64"
|
||||
RecentFilesList = ["c:\\Beef\\BeefTools\\BeefInstall\\src\\Program.bf", "c:\\Beef\\IDE\\src\\util\\Zip.bf", "c:\\beef\\BeefLibs\\corlib\\src\\System\\String.bf"]
|
||||
|
||||
[MainWindow]
|
||||
X = 148
|
||||
Y = 85
|
||||
Width = 1724
|
||||
Height = 1830
|
||||
|
||||
[MainDockingFrame]
|
||||
Type = "DockingFrame"
|
||||
SplitType = 2
|
||||
|
||||
[[MainDockingFrame.DockedWidgets]]
|
||||
RequestedWidth = 350.0
|
||||
RequestedHeight = 200.0
|
||||
SizePriority = 200.0
|
||||
Type = "DockingFrame"
|
||||
SplitType = 1
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets]]
|
||||
RequestedWidth = 200.0
|
||||
RequestedHeight = 200.0
|
||||
Type = "TabbedView"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
Active = true
|
||||
TabLabel = "Workspace"
|
||||
TabWidth = 115.0
|
||||
Type = "ProjectPanel"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets]]
|
||||
IsFillWidget = true
|
||||
Permanent = true
|
||||
RequestedWidth = 150.0
|
||||
RequestedHeight = 150.0
|
||||
SizePriority = 150.0
|
||||
DefaultDocumentsTabbedView = true
|
||||
Type = "TabbedView"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
TabLabel = "String.bf"
|
||||
TabWidth = 89.0
|
||||
Type = "SourceViewPanel"
|
||||
FilePath = "c:\\beef\\BeefLibs\\corlib\\src\\System\\String.bf"
|
||||
CursorPos = 41778
|
||||
VertPos = 24600.0
|
||||
ProjectName = "corlib"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
TabLabel = "Zip.bf"
|
||||
TabWidth = 63.0
|
||||
Type = "SourceViewPanel"
|
||||
FilePath = "c:\\Beef\\IDE\\src\\util\\Zip.bf"
|
||||
CursorPos = 3000
|
||||
VertPos = 540.0
|
||||
ProjectName = "BeefInstall"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
Active = true
|
||||
TabLabel = "Program.bf"
|
||||
TabWidth = 96.0
|
||||
Type = "SourceViewPanel"
|
||||
FilePath = "c:\\Beef\\BeefTools\\BeefInstall\\src\\Program.bf"
|
||||
CursorPos = 1398
|
||||
ProjectName = "BeefInstall"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets]]
|
||||
RequestedWidth = 250.0
|
||||
RequestedHeight = 250.0
|
||||
Type = "DockingFrame"
|
||||
SplitType = 1
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets]]
|
||||
RequestedWidth = 250.0
|
||||
RequestedHeight = 250.0
|
||||
SizePriority = 0.5
|
||||
Type = "TabbedView"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
TabLabel = "Memory"
|
||||
TabWidth = 99.0
|
||||
Type = "MemoryPanel"
|
||||
AutoResize = "Auto_Mul8"
|
||||
RequestedWidth = 300.0
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
TabLabel = "Watch"
|
||||
TabWidth = 86.0
|
||||
Type = "WatchPanel"
|
||||
Columns = [{Width = 200.0}, {Width = 200.0}, {Width = 200.0}]
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
Active = true
|
||||
TabLabel = "Auto"
|
||||
TabWidth = 77.0
|
||||
Type = "AutoWatchPanel"
|
||||
Columns = [{Width = 200.0}, {Width = 200.0}, {Width = 200.0}]
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets]]
|
||||
RequestedWidth = 250.0
|
||||
RequestedHeight = 250.0
|
||||
SizePriority = 0.5
|
||||
Type = "TabbedView"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
TabLabel = "Find Results"
|
||||
TabWidth = 119.0
|
||||
Type = "FindResultsPanel"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
TabLabel = "Threads"
|
||||
TabWidth = 97.0
|
||||
Type = "ThreadPanel"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
TabLabel = "Call Stack"
|
||||
TabWidth = 105.0
|
||||
Type = "CallStackPanel"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
TabLabel = "Immediate"
|
||||
TabWidth = 111.0
|
||||
Type = "ImmediatePanel"
|
||||
|
||||
[[MainDockingFrame.DockedWidgets.DockedWidgets.Tabs]]
|
||||
Active = true
|
||||
TabLabel = "Output"
|
||||
TabWidth = 90.0
|
||||
Type = "OutputPanel"
|
||||
|
||||
[DebuggerDisplayTypes.""]
|
||||
IntDisplayType = "Default"
|
||||
MmDisplayType = "Default"
|
25
BeefTools/BeefInstall/Stub/BeefProj.toml
Normal file
25
BeefTools/BeefInstall/Stub/BeefProj.toml
Normal file
|
@ -0,0 +1,25 @@
|
|||
FileVersion = 1
|
||||
|
||||
[Project]
|
||||
Name = "Stub"
|
||||
StartupObject = "BIStub.Program"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
TargetDirectory = "$(WorkspaceDir)/../dist"
|
||||
TargetName = "$(ProjectName)_d"
|
||||
BeefLibType = "Static"
|
||||
|
||||
[Configs.Release.Win64]
|
||||
TargetDirectory = "$(WorkspaceDir)/../dist"
|
||||
|
||||
[Configs.Paranoid.Win64]
|
||||
TargetDirectory = "$(WorkspaceDir)/../dist"
|
||||
|
||||
[Configs.Test.Win64]
|
||||
TargetDirectory = "$(WorkspaceDir)/../dist"
|
||||
|
||||
[ProjectFolder]
|
||||
|
||||
[[ProjectFolder.Items]]
|
||||
Type = "Source"
|
||||
Path = "../../../IDE/src/util/Zip.bf"
|
11
BeefTools/BeefInstall/Stub/BeefSpace.toml
Normal file
11
BeefTools/BeefInstall/Stub/BeefSpace.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
FileVersion = 1
|
||||
Projects = {Stub = {Path = "."}}
|
||||
Unlocked = ["corlib"]
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "Stub"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
AllocType = "CRT"
|
||||
EnableObjectDebugFlags = false
|
||||
IntermediateType = "ObjectAndIRCode"
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
namespace BeefInstall
|
||||
|
||||
namespace System.Windows
|
||||
{
|
||||
class CabFile
|
||||
{
|
236
BeefTools/BeefInstall/Stub/src/PEFile.bf
Normal file
236
BeefTools/BeefInstall/Stub/src/PEFile.bf
Normal file
|
@ -0,0 +1,236 @@
|
|||
using System;
|
||||
|
||||
namespace System.Windows
|
||||
{
|
||||
class PEFile
|
||||
{
|
||||
public const uint16 PE_MACHINE_X86 = 0x14c;
|
||||
public const uint16 PE_MACHINE_X64 = 0x8664;
|
||||
|
||||
[CRepr]
|
||||
public struct PEHeader
|
||||
{
|
||||
public uint16 e_magic; // Magic number
|
||||
public uint16 e_cblp; // uint8s on last page of file
|
||||
public uint16 e_cp; // Pages in file
|
||||
public uint16 e_crlc; // Relocations
|
||||
public uint16 e_cparhdr; // Size of header in paragraphs
|
||||
public uint16 e_minalloc; // Minimum extra paragraphs needed
|
||||
public uint16 e_maxalloc; // Maximum extra paragraphs needed
|
||||
public uint16 e_ss; // Initial (relative) SS value
|
||||
public uint16 e_sp; // Initial SP value
|
||||
public uint16 e_csum; // Checksum
|
||||
public uint16 e_ip; // Initial IP value
|
||||
public uint16 e_cs; // Initial (relative) CS value
|
||||
public uint16 e_lfarlc; // File address of relocation table
|
||||
public uint16 e_ovno; // Overlay number
|
||||
public uint16[4] e_res; // Reserved uint16s
|
||||
public uint16 e_oemid; // OEM identifier (for e_oeminfo)
|
||||
public uint16 e_oeminfo; // OEM information; e_oemid specific
|
||||
public uint16[10] e_res2; // Reserved uint16s
|
||||
public int32 e_lfanew; // File address of new exe header
|
||||
};
|
||||
|
||||
|
||||
[CRepr]
|
||||
public struct PEFileHeader
|
||||
{
|
||||
public uint16 mMachine;
|
||||
public uint16 mNumberOfSections;
|
||||
public uint32 mTimeDateStamp;
|
||||
public uint32 mPointerToSymbolTable;
|
||||
public uint32 mNumberOfSymbols;
|
||||
public uint16 mSizeOfOptionalHeader;
|
||||
public uint16 mCharacteristics;
|
||||
};
|
||||
|
||||
[CRepr]
|
||||
public struct PEImportObjectHeader
|
||||
{
|
||||
public uint16 mSig1;
|
||||
public uint16 mSig2;
|
||||
public uint16 mVersion;
|
||||
public uint16 mMachine;
|
||||
public uint32 mTimeDateStamp;
|
||||
public uint32 mDataSize;
|
||||
public uint16 mHint;
|
||||
public uint16 mType;
|
||||
};
|
||||
|
||||
[CRepr]
|
||||
public struct PEDataDirectory
|
||||
{
|
||||
public uint32 mVirtualAddress;
|
||||
public uint32 mSize;
|
||||
};
|
||||
|
||||
[CRepr]
|
||||
public struct PEOptionalHeader32
|
||||
{
|
||||
//
|
||||
// Standard fields.
|
||||
//
|
||||
|
||||
public uint16 mMagic;
|
||||
public uint8 mMajorLinkerVersion;
|
||||
public uint8 mMinorLinkerVersion;
|
||||
public uint32 mSizeOfCode;
|
||||
public uint32 mSizeOfInitializedData;
|
||||
public uint32 mSizeOfUninitializedData;
|
||||
public uint32 mAddressOfEntryPoint;
|
||||
public uint32 mBaseOfCode;
|
||||
public uint32 mBaseOfData;
|
||||
|
||||
//
|
||||
// NT additional fields.
|
||||
//
|
||||
|
||||
public uint32 mImageBase;
|
||||
public uint32 mSectionAlignment;
|
||||
public uint32 mFileAlignment;
|
||||
public uint16 mMajorOperatingSystemVersion;
|
||||
public uint16 mMinorOperatingSystemVersion;
|
||||
public uint16 mMajorImageVersion;
|
||||
public uint16 mMinorImageVersion;
|
||||
public uint16 mMajorSubsystemVersion;
|
||||
public uint16 mMinorSubsystemVersion;
|
||||
public uint32 mReserved1;
|
||||
public uint32 mSizeOfImage;
|
||||
public uint32 mSizeOfHeaders;
|
||||
public uint32 mCheckSum;
|
||||
public uint16 mSubsystem;
|
||||
public uint16 mDllCharacteristics;
|
||||
public uint32 mSizeOfStackReserve;
|
||||
public uint32 mSizeOfStackCommit;
|
||||
public uint32 mSizeOfHeapReserve;
|
||||
public uint32 mSizeOfHeapCommit;
|
||||
public uint32 mLoaderFlags;
|
||||
public uint32 mNumberOfRvaAndSizes;
|
||||
public PEDataDirectory[16] mDataDirectory;
|
||||
};
|
||||
|
||||
[CRepr]
|
||||
public struct PEOptionalHeader64
|
||||
{
|
||||
//
|
||||
// Standard fields.
|
||||
//
|
||||
|
||||
public uint16 mMagic;
|
||||
public uint8 mMajorLinkerVersion;
|
||||
public uint8 mMinorLinkerVersion;
|
||||
public uint32 mSizeOfCode;
|
||||
public uint32 mSizeOfInitializedData;
|
||||
public uint32 mSizeOfUninitializedData;
|
||||
public uint32 mAddressOfEntryPoint;
|
||||
public uint32 mBaseOfCode;
|
||||
|
||||
//
|
||||
// NT additional fields.
|
||||
//
|
||||
|
||||
public uint64 mImageBase;
|
||||
public uint32 mSectionAlignment;
|
||||
public uint32 mFileAlignment;
|
||||
public uint16 mMajorOperatingSystemVersion;
|
||||
public uint16 mMinorOperatingSystemVersion;
|
||||
public uint16 mMajorImageVersion;
|
||||
public uint16 mMinorImageVersion;
|
||||
public uint16 mMajorSubsystemVersion;
|
||||
public uint16 mMinorSubsystemVersion;
|
||||
public uint32 mReserved1;
|
||||
public uint32 mSizeOfImage;
|
||||
public uint32 mSizeOfHeaders;
|
||||
public uint32 mCheckSum;
|
||||
public uint16 mSubsystem;
|
||||
public uint16 mDllCharacteristics;
|
||||
public uint64 mSizeOfStackReserve;
|
||||
public uint64 mSizeOfStackCommit;
|
||||
public uint64 mSizeOfHeapReserve;
|
||||
public uint64 mSizeOfHeapCommit;
|
||||
public uint32 mLoaderFlags;
|
||||
public uint32 mNumberOfRvaAndSizes;
|
||||
public PEDataDirectory[16] mDataDirectory;
|
||||
};
|
||||
|
||||
[CRepr]
|
||||
struct PE_NTHeaders32
|
||||
{
|
||||
uint32 mSignature;
|
||||
PEFileHeader mFileHeader;
|
||||
PEOptionalHeader32 mOptionalHeader;
|
||||
};
|
||||
|
||||
[CRepr]
|
||||
public struct PE_NTHeaders64
|
||||
{
|
||||
public uint32 mSignature;
|
||||
public PEFileHeader mFileHeader;
|
||||
public PEOptionalHeader64 mOptionalHeader;
|
||||
};
|
||||
|
||||
const int IMAGE_SIZEOF_SHORT_NAME = 8;
|
||||
|
||||
[CRepr]
|
||||
public struct PESectionHeader
|
||||
{
|
||||
public char8[IMAGE_SIZEOF_SHORT_NAME] mName;
|
||||
public uint32 mVirtualSize;
|
||||
public uint32 mVirtualAddress;
|
||||
public uint32 mSizeOfRawData;
|
||||
public uint32 mPointerToRawData;
|
||||
public uint32 mPointerToRelocations;
|
||||
public uint32 mPointerToLineNumbers;
|
||||
public uint16 mNumberOfRelocations;
|
||||
public uint16 mNumberOfLineNumbers;
|
||||
public uint32 mCharacteristics;
|
||||
};
|
||||
|
||||
[CRepr]
|
||||
struct COFFRelocation
|
||||
{
|
||||
uint32 mVirtualAddress;
|
||||
uint32 mSymbolTableIndex;
|
||||
uint16 mType;
|
||||
};
|
||||
|
||||
[CRepr]
|
||||
struct PE_SymInfo
|
||||
{
|
||||
[Union]
|
||||
public struct Name
|
||||
{
|
||||
public char8[8] mName;
|
||||
public int32[2] mNameOfs;
|
||||
}
|
||||
|
||||
public Name mName;
|
||||
|
||||
/*union
|
||||
{
|
||||
char mName[8];
|
||||
int32 mNameOfs[2];
|
||||
};*/
|
||||
|
||||
public int32 mValue;
|
||||
public uint16 mSectionNum;
|
||||
public uint16 mType;
|
||||
public int8 mStorageClass;
|
||||
public int8 mNumOfAuxSymbols;
|
||||
};
|
||||
|
||||
[CRepr]
|
||||
struct PE_SymInfoAux
|
||||
{
|
||||
public uint32 mLength;
|
||||
public uint16 mNumberOfRelocations;
|
||||
public uint16 mNumberOfLinenumbers;
|
||||
public uint32 mCheckSum;
|
||||
public uint16 mNumber;
|
||||
public uint8 mSelection;
|
||||
public char8 mUnused;
|
||||
public char8 mUnused2;
|
||||
public char8 mUnused3;
|
||||
};
|
||||
}
|
||||
}
|
179
BeefTools/BeefInstall/Stub/src/Program.bf
Normal file
179
BeefTools/BeefInstall/Stub/src/Program.bf
Normal file
|
@ -0,0 +1,179 @@
|
|||
using System;
|
||||
using IDE.Util;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
namespace BIStub
|
||||
{
|
||||
class Program
|
||||
{
|
||||
bool mFailed;
|
||||
|
||||
void Fail(StringView str)
|
||||
{
|
||||
if (mFailed)
|
||||
return;
|
||||
mFailed = true;
|
||||
Windows.MessageBoxA(default, scope String..AppendF("ERROR: {}", str), "FATAL ERROR", Windows.MB_ICONHAND);
|
||||
}
|
||||
|
||||
bool HandleCommandLineParam(String key, String value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void UnhandledCommandLine(String key, String value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ParseCommandLine(String[] args)
|
||||
{
|
||||
for (var str in args)
|
||||
{
|
||||
int eqPos = str.IndexOf('=');
|
||||
if (eqPos == -1)
|
||||
{
|
||||
if (!HandleCommandLineParam(str, null))
|
||||
UnhandledCommandLine(str, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var cmd = scope String(str, 0, eqPos);
|
||||
var param = scope String(str, eqPos + 1);
|
||||
if (!HandleCommandLineParam(cmd, param))
|
||||
UnhandledCommandLine(cmd, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Result<void> ExtractTo(ZipFile zipFile, StringView destDir, StringView subStr)
|
||||
{
|
||||
String fileName = scope .();
|
||||
String destPath = scope .();
|
||||
|
||||
for (int i < zipFile.GetNumFiles())
|
||||
{
|
||||
ZipFile.Entry entry = scope .();
|
||||
if (zipFile.SelectEntry(i, entry) case .Err)
|
||||
continue;
|
||||
|
||||
fileName.Clear();
|
||||
entry.GetFileName(fileName);
|
||||
|
||||
if (!fileName.StartsWith(subStr))
|
||||
continue;
|
||||
|
||||
destPath.Clear();
|
||||
destPath.Append(destDir);
|
||||
destPath.Append('/');
|
||||
destPath.Append(fileName);
|
||||
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
if (Directory.CreateDirectory(destPath) case .Err)
|
||||
return .Err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entry.ExtractToFile(destPath) case .Err)
|
||||
return .Err;
|
||||
}
|
||||
}
|
||||
|
||||
return .Ok;
|
||||
}
|
||||
|
||||
void CheckPE()
|
||||
{
|
||||
let module = Windows.GetModuleHandleW(null);
|
||||
uint8* moduleData = (uint8*)(int)module;
|
||||
PEFile.PEHeader* header = (.)moduleData;
|
||||
|
||||
PEFile.PE_NTHeaders64* hdr64 = (.)(moduleData + header.e_lfanew);
|
||||
if (hdr64.mFileHeader.mMachine == PEFile.PE_MACHINE_X64)
|
||||
{
|
||||
int fileEnd = 0;
|
||||
|
||||
for (int sectIdx < hdr64.mFileHeader.mNumberOfSections)
|
||||
{
|
||||
PEFile.PESectionHeader* sectHdrHead = (.)((uint8*)(hdr64 + 1)) + sectIdx;
|
||||
fileEnd = Math.Max(fileEnd, sectHdrHead.mPointerToRawData + sectHdrHead.mSizeOfRawData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function void InstallFunc(StringView dest, StringView filter);
|
||||
public function int ProgressFunc();
|
||||
public function void CancelFunc();
|
||||
|
||||
public function void StartFunc(InstallFunc installFunc, ProgressFunc progressFunc, CancelFunc cancelFunc);
|
||||
|
||||
static void UI_Install(StringView dest, StringView filter)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int UI_GetProgress()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void UI_Cancel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void StartUI(StringView dir)
|
||||
{
|
||||
String destLib = scope .();
|
||||
destLib.Append(dir);
|
||||
destLib.Append("/../dist/StubUI_d.dll");
|
||||
|
||||
var lib = Windows.LoadLibraryW(destLib.ToScopedNativeWChar!());
|
||||
if (lib.IsInvalid)
|
||||
{
|
||||
Fail(scope String()..AppendF("Failed to load installer UI '{}'", destLib));
|
||||
return;
|
||||
}
|
||||
|
||||
StartFunc startFunc = (.)Windows.GetProcAddress(lib, "Start");
|
||||
if (startFunc == null)
|
||||
{
|
||||
Fail(scope String()..AppendF("Failed to initialize installer UI '{}'", destLib));
|
||||
return;
|
||||
}
|
||||
|
||||
startFunc(=> UI_Install, => UI_GetProgress, => UI_Cancel);
|
||||
}
|
||||
|
||||
void Run()
|
||||
{
|
||||
String cwd = scope .();
|
||||
Directory.GetCurrentDirectory(cwd);
|
||||
StartUI(cwd);
|
||||
|
||||
CheckPE();
|
||||
|
||||
ZipFile zipFile = scope .();
|
||||
zipFile.Open(@"c:\\temp\\build_1827.zip");
|
||||
ExtractTo(zipFile, @"c:\temp\unzip", .());
|
||||
|
||||
CabFile cabFile = scope .();
|
||||
cabFile.Init();
|
||||
cabFile.Copy();
|
||||
}
|
||||
|
||||
static int Main(String[] args)
|
||||
{
|
||||
|
||||
Program pg = new Program();
|
||||
pg.ParseCommandLine(args);
|
||||
pg.Run();
|
||||
delete pg;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
BIN
BeefTools/BeefInstall/StubUI/Beef042Dbg64.dll
Normal file
BIN
BeefTools/BeefInstall/StubUI/Beef042Dbg64.dll
Normal file
Binary file not shown.
BIN
BeefTools/BeefInstall/StubUI/Beef042RT64.dll
Normal file
BIN
BeefTools/BeefInstall/StubUI/Beef042RT64.dll
Normal file
Binary file not shown.
24
BeefTools/BeefInstall/StubUI/BeefProj.toml
Normal file
24
BeefTools/BeefInstall/StubUI/BeefProj.toml
Normal file
|
@ -0,0 +1,24 @@
|
|||
FileVersion = 1
|
||||
Dependencies = {corlib = "*", Beefy2D = "*"}
|
||||
|
||||
[Project]
|
||||
Name = "StubUI"
|
||||
TargetType = "BeefDynLib"
|
||||
StartupObject = "Program"
|
||||
DefaultNamespace = "BIStubUI"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
TargetDirectory = "$(WorkspaceDir)/../dist"
|
||||
TargetName = "$(ProjectName)_d"
|
||||
OtherLinkFlags = "$(LinkFlags) BeefySysLib64_d.lib"
|
||||
PostBuildCmds = ["Sleep(1000)", "cmd.exe /c echo Hey!", "CopyFilesIfNewer(\"$(WorkspaceDir)/../../../IDE/dist/BeefySysLib*.*\", \"$(WorkspaceDir)/../dist\")"]
|
||||
DebugCommand = "$(WorkspaceDir)\\..\\dist\\Stub_d.exe"
|
||||
|
||||
[Configs.Release.Win64]
|
||||
TargetDirectory = "$(WorkspaceDir)/../dist"
|
||||
|
||||
[Configs.Paranoid.Win64]
|
||||
TargetDirectory = "$(WorkspaceDir)/../dist"
|
||||
|
||||
[Configs.Test.Win64]
|
||||
TargetDirectory = "$(WorkspaceDir)/../dist"
|
10
BeefTools/BeefInstall/StubUI/BeefSpace.toml
Normal file
10
BeefTools/BeefInstall/StubUI/BeefSpace.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
FileVersion = 1
|
||||
Projects = {StubUI = {Path = "."}, Beefy2D = "*"}
|
||||
Unlocked = ["corlib"]
|
||||
|
||||
[Workspace]
|
||||
StartupProject = "StubUI"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
AllocType = "CRT"
|
||||
IntermediateType = "ObjectAndIRCode"
|
BIN
BeefTools/BeefInstall/StubUI/StubUI_d.dll
Normal file
BIN
BeefTools/BeefInstall/StubUI/StubUI_d.dll
Normal file
Binary file not shown.
2
BeefTools/BeefInstall/StubUI/StubUI_d.dll.build.txt
Normal file
2
BeefTools/BeefInstall/StubUI/StubUI_d.dll.build.txt
Normal file
File diff suppressed because one or more lines are too long
BIN
BeefTools/BeefInstall/StubUI/StubUI_d.exp
Normal file
BIN
BeefTools/BeefInstall/StubUI/StubUI_d.exp
Normal file
Binary file not shown.
BIN
BeefTools/BeefInstall/StubUI/StubUI_d.lib
Normal file
BIN
BeefTools/BeefInstall/StubUI/StubUI_d.lib
Normal file
Binary file not shown.
BIN
BeefTools/BeefInstall/StubUI/StubUI_d.pdb
Normal file
BIN
BeefTools/BeefInstall/StubUI/StubUI_d.pdb
Normal file
Binary file not shown.
41
BeefTools/BeefInstall/StubUI/src/BIApp.bf
Normal file
41
BeefTools/BeefInstall/StubUI/src/BIApp.bf
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using Beefy;
|
||||
using Beefy.widgets;
|
||||
|
||||
namespace BIStubUI
|
||||
{
|
||||
class BIApp : BFApp
|
||||
{
|
||||
public function void InstallFunc(StringView dest, StringView filter);
|
||||
public function int ProgressFunc();
|
||||
public function void CancelFunc();
|
||||
|
||||
public InstallFunc mInstallFunc;
|
||||
public ProgressFunc mProgressFunc;
|
||||
public CancelFunc mCancelFunc;
|
||||
|
||||
Widget mRootWidget;
|
||||
WidgetWindow mMainWindow;
|
||||
|
||||
const int cWidth = 700;
|
||||
const int cHeight = 700;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
BFWindow.Flags windowFlags = BFWindow.Flags.Border | BFWindow.Flags.SysMenu | //| BFWindow.Flags.CaptureMediaKeys |
|
||||
BFWindow.Flags.Caption | BFWindow.Flags.Minimize | BFWindow.Flags.QuitOnClose;
|
||||
|
||||
mRootWidget = new Widget();
|
||||
mMainWindow = new WidgetWindow(null, "Beef Installer", 0, 0, cWidth, cHeight, windowFlags, mRootWidget);
|
||||
mMainWindow.SetMinimumSize(480, 360);
|
||||
mMainWindow.mIsMainWindow = true;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
public static BIApp gApp;
|
||||
}
|
||||
}
|
38
BeefTools/BeefInstall/StubUI/src/Program.bf
Normal file
38
BeefTools/BeefInstall/StubUI/src/Program.bf
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace BIStubUI
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static this()
|
||||
{
|
||||
Debug.WriteLine("Initializing StubUI");
|
||||
}
|
||||
|
||||
public static ~this()
|
||||
{
|
||||
Debug.WriteLine("Deinitializing StubUI");
|
||||
}
|
||||
|
||||
[Export]
|
||||
public static void Start(BIApp.InstallFunc installFunc, BIApp.ProgressFunc progressFunc, BIApp.CancelFunc cancelFunc)
|
||||
{
|
||||
gApp = new BIApp();
|
||||
gApp.mInstallFunc = installFunc;
|
||||
gApp.mProgressFunc = progressFunc;
|
||||
gApp.mCancelFunc = cancelFunc;
|
||||
gApp.Run();
|
||||
}
|
||||
|
||||
public static void Hello()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static int Main(String[] args)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
using System;
|
||||
using IDE.Util;
|
||||
using System.IO;
|
||||
|
||||
namespace BeefInstall
|
||||
{
|
||||
class Program
|
||||
{
|
||||
bool HandleCommandLineParam(String key, String value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void UnhandledCommandLine(String key, String value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ParseCommandLine(String[] args)
|
||||
{
|
||||
for (var str in args)
|
||||
{
|
||||
int eqPos = str.IndexOf('=');
|
||||
if (eqPos == -1)
|
||||
{
|
||||
if (!HandleCommandLineParam(str, null))
|
||||
UnhandledCommandLine(str, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var cmd = scope String(str, 0, eqPos);
|
||||
var param = scope String(str, eqPos + 1);
|
||||
if (!HandleCommandLineParam(cmd, param))
|
||||
UnhandledCommandLine(cmd, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Result<void> ExtractTo(ZipFile zipFile, StringView destDir, StringView subStr)
|
||||
{
|
||||
String fileName = scope .();
|
||||
String destPath = scope .();
|
||||
|
||||
for (int i < zipFile.GetNumFiles())
|
||||
{
|
||||
ZipFile.Entry entry = scope .();
|
||||
if (zipFile.SelectEntry(i, entry) case .Err)
|
||||
continue;
|
||||
|
||||
fileName.Clear();
|
||||
entry.GetFileName(fileName);
|
||||
|
||||
if (!fileName.StartsWith(subStr))
|
||||
continue;
|
||||
|
||||
destPath.Clear();
|
||||
destPath.Append(destDir);
|
||||
destPath.Append('/');
|
||||
destPath.Append(fileName);
|
||||
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
if (Directory.CreateDirectory(destPath) case .Err)
|
||||
return .Err;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entry.ExtractToFile(destPath) case .Err)
|
||||
return .Err;
|
||||
}
|
||||
}
|
||||
|
||||
return .Ok;
|
||||
}
|
||||
|
||||
void Run()
|
||||
{
|
||||
ZipFile zipFile = scope .();
|
||||
zipFile.Open(@"c:\\temp\\build_1827.zip");
|
||||
ExtractTo(zipFile, @"c:\temp\unzip", .());
|
||||
|
||||
CabFile cabFile = scope .();
|
||||
cabFile.Init();
|
||||
cabFile.Copy();
|
||||
}
|
||||
|
||||
static int Main(String[] args)
|
||||
{
|
||||
Program pg = new Program();
|
||||
pg.ParseCommandLine(args);
|
||||
pg.Run();
|
||||
delete pg;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue