diff --git a/Makefile b/Makefile
index ea4ad26..792ad85 100755
--- a/Makefile
+++ b/Makefile
@@ -8,10 +8,8 @@ package:
cp -rv helperset deb/opt/apps/deepin-wine-runner/
cp -rv VM-source/VirtualMachine VM
cp -rv VM-source/deepin-wine-runner.svg VM
- cp -rv VM-source/api VM
cp -rv VM-source/Windows7X64Auto.iso VM
cp -rv VM-source/Windows7X86Auto.iso VM
- cp -rv VM-source/run.py VM
cp -rv wine/ deb/opt/apps/deepin-wine-runner/
cp -rv Test/ deb/opt/apps/deepin-wine-runner/
zip -v -q -r package-script.zip package-script
diff --git a/VM-source/VirtualMachine b/VM-source/VirtualMachine
deleted file mode 100755
index 4933a50..0000000
Binary files a/VM-source/VirtualMachine and /dev/null differ
diff --git a/VM-source/VirtualMachine.pro.user b/VM-source/VirtualMachine.pro.user
deleted file mode 100755
index 83c5eef..0000000
--- a/VM-source/VirtualMachine.pro.user
+++ /dev/null
@@ -1,213 +0,0 @@
-
-
-
-
-
- EnvironmentId
- {4ffd6df9-1365-4837-81b1-582e0e2d1f21}
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- 80
- true
- true
- 1
- true
- false
- 0
- true
- true
- 0
- 8
- true
- 1
- true
- true
- true
- false
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
- true
-
-
-
- ProjectExplorer.Project.Target.0
-
- Qt 5.15.6 in PATH (qt5)
- Qt 5.15.6 in PATH (qt5)
- {ab20853c-9d79-473a-820e-8e95c145170e}
- 0
- 0
- 0
-
- /home/gfdgd_xi/Desktop/deep-wine-runner/VM-source
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- false
-
- false
- false
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- false
-
-
- false
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
- false
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Release
- Release
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- true
-
- 1
-
-
- 0
- 部署
-
- ProjectExplorer.BuildSteps.Deploy
-
- 1
- Deploy Configuration
-
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
-
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
- 2
-
-
- Custom Executable
-
- ProjectExplorer.CustomExecutableRunConfiguration
-
- 3768
- false
- true
- false
- false
- true
-
-
-
- 1
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 20
-
-
- Version
- 20
-
-
diff --git a/VM-source/VirtualMachine.pro.user.e6fddbe b/VM-source/VirtualMachine.pro.user.e6fddbe
deleted file mode 100755
index 6762a61..0000000
--- a/VM-source/VirtualMachine.pro.user.e6fddbe
+++ /dev/null
@@ -1,214 +0,0 @@
-
-
-
-
-
- EnvironmentId
- {e6fddbe7-fcb3-41be-bb11-3a30892600b9}
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- 80
- true
- true
- 1
- true
- false
- 0
- true
- true
- 0
- 8
- true
- 1
- true
- true
- true
- false
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
- true
-
-
-
- ProjectExplorer.Project.Target.0
-
- 桌面
- 桌面
- {b6becee2-04dc-4df3-9a41-75e9b60eccc8}
- 0
- 0
- 0
-
- /home/gfdgd_xi/Desktop/deep-wine-runner/VM-source
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- false
-
- false
- false
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- false
-
-
- false
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
- false
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Release
- Release
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- true
-
- 1
-
-
- 0
- 部署
-
- ProjectExplorer.BuildSteps.Deploy
-
- 1
- Deploy Configuration
-
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
-
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
- 2
-
- VirtualMachine
-
- Qt4ProjectManager.Qt4RunConfiguration:/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source/VirtualMachine.pro
- VirtualMachine.pro
-
- 3768
- false
- true
- true
- false
- false
- true
-
- /home/gfdgd_xi/Desktop/deep-wine-runner/VM-source
-
- 1
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 20
-
-
- Version
- 20
-
-
diff --git a/VM-source/VirtualMachine.pro.user.f2c8d71 b/VM-source/VirtualMachine.pro.user.f2c8d71
deleted file mode 100755
index b6d6780..0000000
--- a/VM-source/VirtualMachine.pro.user.f2c8d71
+++ /dev/null
@@ -1,326 +0,0 @@
-
-
-
-
-
- EnvironmentId
- {f2c8d716-7409-4b6a-a949-e01d13120d3a}
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- 80
- true
- true
- 1
- true
- false
- 0
- true
- true
- 0
- 8
- true
- 1
- true
- true
- true
- false
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
- true
-
-
-
- ProjectExplorer.Project.Target.0
-
- 桌面
- 桌面
- {c19ffccf-bd9e-4c0f-b3ec-050420072cca}
- 0
- 0
- 0
-
- /home/gfdgd_xi/build-VirtualMachine-unknown-Debug
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- true
-
- false
- false
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- false
-
-
- false
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
- false
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Debug
- Debug
- Qt4ProjectManager.Qt4BuildConfiguration
- 2
- true
-
-
- /home/gfdgd_xi/build-VirtualMachine-unknown-Release
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- false
-
- false
- false
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- false
-
-
- false
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
- false
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Release
- Release
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- true
-
-
- /home/gfdgd_xi/build-VirtualMachine-unknown-Profile
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- true
-
- false
- true
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- false
-
-
- false
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- true
- clean
-
- false
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Profile
- Profile
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- true
-
- 3
-
-
- 0
- 部署
-
- ProjectExplorer.BuildSteps.Deploy
-
- 1
- Deploy Configuration
-
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
-
- false
- false
- 1000
-
- true
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
- 2
-
- VirtualMachine
-
- Qt4ProjectManager.Qt4RunConfiguration:/home/gfdgd_xi/Desktop/deep-wine-runner/VM-source/VirtualMachine.pro
- VirtualMachine.pro
-
- 3768
- false
- true
- true
- false
- false
- true
-
- /home/gfdgd_xi/build-VirtualMachine-unknown-Debug
-
- 1
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 20
-
-
- Version
- 20
-
-
diff --git a/VM-source/buildvbox.cpp b/VM-source/buildvbox.cpp
index 3602ae1..34582a6 100644
--- a/VM-source/buildvbox.cpp
+++ b/VM-source/buildvbox.cpp
@@ -6,6 +6,8 @@
#include
#include
#include
+// 懒得用 QThread 了(要继承)
+#include
using namespace std;
// 清屏
@@ -36,6 +38,10 @@ QString buildvbox::GetNet(){
return "";
}
+int buildvbox::Download(QString url, QString path, QString fileName){
+ return system(("aria2c -x 16 -s 16 -c " + url + " -d " + path + " -o " + fileName).toUtf8());
+}
+
buildvbox::buildvbox(QString isoPath, int id){
/*QDir vboxPath(QDir::homePath() + "/VirtualBox VMs/Windows");
if(vboxPath.exists()){
@@ -45,6 +51,15 @@ buildvbox::buildvbox(QString isoPath, int id){
return;
}*/
QString programPath = QCoreApplication::applicationDirPath();
+
+ /*if(!QFile::exists(programPath + "/a.iso")){
+ std::thread([=](){
+ while(1){
+ qDebug() << "a";
+ }
+ }).detach();
+ }*/
+
QString net = GetNet();
qDebug() << "使用网卡:" << net << endl;
//vbox *box = new vbox("Window");
@@ -59,17 +74,24 @@ buildvbox::buildvbox(QString isoPath, int id){
vm.Create("WindowsNT_64");
}
vm.CreateDiskControl();
+ //vm.CreateDiskControl("storage_controller_2");
vm.CreateDisk(QDir::homePath() + "/VirtualBox VMs/Windows/Windows.vdi", 131072);
vm.MountDisk(QDir::homePath() + "/VirtualBox VMs/Windows/Windows.vdi");
- vm.MountISO(isoPath);
+ vm.MountISO(isoPath, "storage_controller_1", 0, 1);
switch (id) {
case 0:
- vm.MountISO(programPath + "/Windows7X86Auto.iso", "storage_controller_1", 1);
+ vm.MountISO(programPath + "/Windows7X86Auto.iso", "storage_controller_1", 1, 0);
break;
case 1:
- vm.MountISO(programPath + "/Windows7X64Auto.iso", "storage_controller_1", 1);
+ vm.MountISO(programPath + "/Windows7X64Auto.iso", "storage_controller_1", 1, 0);
break;
}
+ // 判断 VirtualBox Guest ISO 是否存在
+ // 在的话直接挂载
+ if(QFile::exists("/usr/share/virtualbox/VBoxGuestAdditions.iso")){
+ vm.MountISO("/usr/share/virtualbox/VBoxGuestAdditions.iso", "storage_controller_1", 1, 1);
+ }
+
vm.SetCPU(1);
long memory = 0;
long memoryAll = 0;
diff --git a/VM-source/buildvbox.h b/VM-source/buildvbox.h
index 8fc8d0f..fd355b6 100644
--- a/VM-source/buildvbox.h
+++ b/VM-source/buildvbox.h
@@ -9,6 +9,7 @@ public:
buildvbox(QString isoPath, int id=0);
void CleanScreen();
QString GetNet();
+ int Download(QString url, QString path, QString fileName);
};
#endif // BUILDVBOX_H
diff --git a/VM-source/mainwindow.cpp b/VM-source/mainwindow.cpp
index 419dd42..2dd3fe6 100755
--- a/VM-source/mainwindow.cpp
+++ b/VM-source/mainwindow.cpp
@@ -37,8 +37,9 @@ MainWindow::MainWindow(QWidget *parent) :
// QTimer
QTimer *cpuGet = new QTimer(this);
connect(cpuGet, &QTimer::timeout, this, &MainWindow::ShowCPUMessage);
- cpuGet->setInterval(600);
+ cpuGet->setInterval(1000);
cpuGet->start();
+ MainWindow::ShowCPUMessage();
// 读取程序版本号
// / 版本号文件是否存在
QFile fileinfo(QCoreApplication::applicationDirPath() + "/../information.json");
@@ -72,6 +73,12 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->textBrowser_2, &QTextBrowser::anchorClicked, this, [=](const QUrl &link){
QDesktopServices::openUrl(link);
});
+ connect(ui->textBrowser, &QTextBrowser::anchorClicked, this, [=](const QUrl &link){
+ QDesktopServices::openUrl(link);
+ });
+ connect(ui->textBrowser_3, &QTextBrowser::anchorClicked, this, [=](const QUrl &link){
+ QDesktopServices::openUrl(link);
+ });
}
void MainWindow::ShowCPUMessage(){
diff --git a/VM-source/mainwindow.ui b/VM-source/mainwindow.ui
index 200100a..1514281 100755
--- a/VM-source/mainwindow.ui
+++ b/VM-source/mainwindow.ui
@@ -128,13 +128,17 @@
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Noto Sans CJK SC'; font-size:10.5pt; font-weight:400; font-style:normal;">
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">使用迅雷或者网盘下载以下任意一个链接然后在上面选择即可:</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">123 网盘链接:https://www.123pan.com/s/pDSKVv-oypWv</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">迅雷网盘:https://pan.xunlei.com/s/VNKMz3wgbYHg6JIh50ZKIc7pA1?pwd=35e5 提取码:35e5</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">百度网盘:https://pan.baidu.com/s/19WbvinITCQJFZpAdZutrjg?pwd=me4y 提取码: me4y</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">(如果下载这个,系统版本选第一项,一般推荐这个)ed2k://|file|cn_windows_7_ultimate_with_sp1_x86_dvd_u_677486.iso|2653276160|7503E4B9B8738DFCB95872445C72AEFB|/</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">(如果下载这个,系统版本选第二项)ed2k://|file|cn_windows_7_ultimate_with_sp1_x64_dvd_u_677408.iso|3420557312|B58548681854236C7939003B583A8078|/</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">123 网盘链接:</span><a href="https://www.123pan.com/s/pDSKVv-oypWv"><span style=" font-size:11pt; text-decoration: underline; color:#0082fa;">https://www.123pan.com/s/pDSKVv-oypWv</span></a></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">迅雷网盘:</span><a href="https://pan.xunlei.com/s/VNKMz3wgbYHg6JIh50ZKIc7pA1?pwd=35e5"><span style=" font-size:11pt; text-decoration: underline; color:#0082fa;">https://pan.xunlei.com/s/VNKMz3wgbYHg6JIh50ZKIc7pA1?pwd=35e5</span></a><span style=" font-size:10pt;"> 提取码:35e5</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">百度网盘:</span><a href="https://pan.baidu.com/s/19WbvinITCQJFZpAdZutrjg?pwd=me4y"><span style=" font-size:11pt; text-decoration: underline; color:#0082fa;">https://pan.baidu.com/s/19WbvinITCQJFZpAdZutrjg?pwd=me4y</span></a><span style=" font-size:10pt;"> 提取码: me4y</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">(如果下载这个,系统版本选第一项,一般推荐这个)</span><a href="ed2k://|file|cn_windows_7_ultimate_with_sp1_x86_dvd_u_677486.iso|2653276160|7503E4B9B8738DFCB95872445C72AEFB|/"><span style=" font-size:11pt; text-decoration: underline; color:#0082fa;">ed2k://|file|cn_windows_7_ultimate_with_sp1_x86_dvd_u_677486.iso|2653276160|7503E4B9B8738DFCB95872445C72AEFB|/</span></a></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">(如果下载这个,系统版本选第二项)</span><a href="ed2k://|file|cn_windows_7_ultimate_with_sp1_x64_dvd_u_677408.iso|3420557312|B58548681854236C7939003B583A8078|/"><span style=" font-size:11pt; text-decoration: underline; color:#0082fa;">ed2k://|file|cn_windows_7_ultimate_with_sp1_x64_dvd_u_677408.iso|3420557312|B58548681854236C7939003B583A8078|/</span></a></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">RacoonGX 资源镜像站:</span><a href="https://n.racoongx.cn/"><span style=" font-size:11pt; text-decoration: underline; color:#0082fa;">https://n.racoongx.cn/</span></a></p>
<hr /></body></html>
+
+ false
+
@@ -212,6 +216,9 @@ p, li { white-space: pre-wrap; }
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">6、等待安装完毕后,选择“Reboot now”然后点击“Finish”重启此虚拟机即可安装成功(选择“Reboot now”并点“Finish”会自动重新启动)</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/picture/截图/截图_VirtualBox Machine_20220712143103.png" /></p></body></html>
+
+ false
+
diff --git a/VM/api/__init__.py b/VM/api/__init__.py
deleted file mode 100755
index b965da5..0000000
--- a/VM/api/__init__.py
+++ /dev/null
@@ -1,125 +0,0 @@
-################################################
-# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢
-# 版本:1.0
-# 依照 GPL V3 协议开源
-################################################
-# 参考文献:
-# https://juejin.cn/post/7080484519328874510
-################################################
-import os
-import subprocess
-
-homePath = os.path.expanduser('~')
-programPath = os.path.split(os.path.realpath(__file__))[0]
-
-class File:
- def __init__(self, path) -> None:
- self.path = path
-
- def getFileFolderSize(self):
- """get size for file or folder"""
- totalSize = 0
- if not os.path.exists(self.path):
- return totalSize
- if os.path.isfile(self.path):
- totalSize = os.path.getsize(self.path) # 5041481
- return totalSize
- if os.path.isdir(self.path):
- with os.scandir(self.path) as dirEntryList:
- for curSubEntry in dirEntryList:
- curSubEntryFullPath = os.path.join(self.path, curSubEntry.name)
- if curSubEntry.is_dir():
- curSubFolderSize = self.path(curSubEntryFullPath) # 5800007
- totalSize += curSubFolderSize
- elif curSubEntry.is_file():
- curSubFileSize = os.path.getsize(curSubEntryFullPath) # 1891
- totalSize += curSubFileSize
- return totalSize
-
-class Manager:
- def __init__(self, name: str, managerPath: str="VBoxManage") -> None:
- self.name = name
- self.managerPath = managerPath
- self.vboxVersion = subprocess.getoutput(f"\"{self.managerPath}\" -v")
-
- def Create(self, type: str="Windows7") -> None:
- os.system(f"\"{self.managerPath}\" createvm --name \"{self.name}\" --ostype \"{type}\" --register")
-
- def CreateDisk(self, path: str, size: int) -> None:
- os.system(f"\"{self.managerPath}\" createvdi --filename \"{path}\" --size \"{size}\"")
-
- def CreateDiskControl(self, controlName: str="storage_controller_1") -> None:
- os.system(f"\"{self.managerPath}\" storagectl \"{self.name}\" --name \"{controlName}\" --add ide")
-
- def MountDisk(self, diskPath: str, controlName: str="storage_controller_1", port: int=0, device: int=0) -> None:
- os.system(f"\"{self.managerPath}\" storageattach \"{self.name}\" --storagectl \"{controlName}\" --type hdd --port {port} --device {device} --medium \"{diskPath}\"")
-
- def MountISO(self, isoPath: str, controlName: str="storage_controller_1", port: int=1, device: int=0) -> None:
- os.system(f"\"{self.managerPath}\" storageattach \"{self.name}\" --storagectl \"{controlName}\" --type dvddrive --port {port} --device {device} --medium \"{isoPath}\"")
-
- def BootFirst(self, bootDrive: str) -> None:
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --boot1 {bootDrive}")
-
- def SetNetBridge(self, netDriver: str) -> None:
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --nic1 bridged --cableconnected1 on --nictype1 82540EM --bridgeadapter1 \"{netDriver}\" --intnet1 brigh1 --macaddress1 auto")
- #os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --nic1 hostif")
- pass
-
- def SetCPU(self, number: int) -> None:
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --cpus {number}")
-
- def SetMemory(self, memory: int) -> None:
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --memory {memory}")
-
- def SetRemote(self, setting: bool) -> None:
- if setting:
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vrde on")
- return
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vrde off")
-
- def SetRemoteConnectSetting(self, port: int=5540) -> None:
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vrdeport {port} --vrdeaddress """)
-
- def Start(self, unShown: bool = False) -> None:
- if unShown:
- os.system(f"\"{self.managerPath}\" startvm \"{self.name}\" -type headless")
- return
- os.system(f"\"{self.managerPath}\" startvm \"{self.name}\"")
-
- def Stop(self) -> None:
- os.system(f"\"{self.managerPath}\" controlvm \"{self.name}\" poweroff")
-
- def Delete(self) -> None:
- os.system(f"\"{self.managerPath}\" unregistervm --delete \"{self.name}\"")
-
- def SetDisplayMemory(self, memory: int) -> None:
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --vram {memory}")
-
- def InstallGuessAdditions(self, controlName: str="storage_controller_1", port: int=1, device: int=0) -> None:
- self.MountISO("/usr/share/virtualbox/VBoxGuestAdditions.iso", controlName, port, device)
-
- def EnabledAudio(self) -> None:
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --audio pulse --audiocontroller hda --audioin on --audioout on")
- #os.system("")
-
- def EnabledClipboardMode(self):
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --clipboard-mode bidirectional")
-
- def EnabledDraganddrop(self):
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --draganddrop bidirectional")
-
- def ShareFile(self, name, path):
- os.system(f"\"{self.managerPath}\" sharedfolder add \"{self.name}\" -name \"{name}\" -hostpath \"{path}\"")
-
- def SetVBoxSVGA(self):
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --graphicscontroller vboxsvga")
-
- def SetMousePS2(self):
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --mouse usb")
-
- def SetKeyboardPS2(self):
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --keyboard usb")
-
- def OpenUSB(self):
- os.system(f"\"{self.managerPath}\" modifyvm \"{self.name}\" --usbohci on")
- pass
\ No newline at end of file
diff --git a/VM/api/__pycache__/__init__.cpython-37.pyc b/VM/api/__pycache__/__init__.cpython-37.pyc
deleted file mode 100755
index 0e4d5a4..0000000
Binary files a/VM/api/__pycache__/__init__.cpython-37.pyc and /dev/null differ
diff --git a/VM/run.py b/VM/run.py
deleted file mode 100755
index 4a510ed..0000000
--- a/VM/run.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env python3
-import os
-import api
-import sys
-import psutil
-
-if __name__ == "__main__":
- os.system("clear")
- programPath = os.path.split(os.path.realpath(__file__))[0]
- if len(sys.argv) < 3 :
- print("参数不齐!")
- exit()
- net = ""
- for k, v in psutil.net_if_addrs().items():
- for item in v:
- if item[0] == 2 and not item[1] == "127.0.0.1" and not item[1] == "192.168.250.1":
- net = k
- break
- if net == "":
- exit()
- # 创建一个叫Windows的虚拟机
- vm = api.Manager("Windows")
- if sys.argv[2] == "0":
- vm.Create("Windows7")
- elif sys.argv[2] == "1":
- vm.Create("Windows7_64")
- else:
- vm.Create("WindowsNT_64")
- vm.CreateDisk(f"{api.homePath}/VirtualBox VMs/Windows/Windows.vdi", 131072)
- vm.CreateDiskControl()
- vm.MountDisk(f"{api.homePath}/VirtualBox VMs/Windows/Windows.vdi")
- vm.MountISO(sys.argv[1])
- if sys.argv[2] == "0":
- vm.MountISO(f"{programPath}/Windows7X86Auto.iso", device=1)
- elif sys.argv[2] == "1":
- vm.MountISO(f"{programPath}/Windows7X64Auto.iso", device=1)
- vm.SetCPU(1)
- vm.SetMemory(psutil.virtual_memory().total // 1024 // 1024 // 3)
- vm.SetDisplayMemory(32)
- vm.SetNetBridge(net)
- vm.EnabledAudio()
- vm.EnabledClipboardMode()
- vm.EnabledDraganddrop()
- vm.SetVBoxSVGA()
- vm.SetMousePS2()
- vm.SetKeyboardPS2()
- vm.OpenUSB()
- vm.ShareFile("ROOT", "/")
- vm.ShareFile("HOME", api.homePath)
- vm.Start()
\ No newline at end of file