Npcap issues addressed

This commit is contained in:
Wiktor Mazur
2020-05-03 17:21:17 +02:00
parent 71cf41d8ca
commit 1d722338a0
5 changed files with 28 additions and 4 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ try:
except: except:
class aostats: # type: ignore class aostats: # type: ignore
@staticmethod @staticmethod
def initialize(_): def initialize():
return InitializationResult.NetworkInterfaceListMissing return InitializationResult.NetworkInterfaceListMissing
@staticmethod @staticmethod
+13 -2
View File
@@ -5,6 +5,7 @@ from PySide2.QtCore import Qt # type: ignore
from PySide2 import QtGui # type: ignore from PySide2 import QtGui # type: ignore
from PySide2.QtWidgets import QApplication # type: ignore from PySide2.QtWidgets import QApplication # type: ignore
from PySide2.QtWidgets import QMessageBox # type: ignore from PySide2.QtWidgets import QMessageBox # type: ignore
from PySide2.QtWidgets import QPushButton # type: ignore
from ..engine import InitializationResult from ..engine import InitializationResult
from ..engine import initialize from ..engine import initialize
@@ -16,9 +17,13 @@ from ..utils.version import current_version as get_current_version
from ..utils.version import latest_url from ..utils.version import latest_url
from ..utils.version import latest_version as get_latest_version from ..utils.version import latest_version as get_latest_version
from ..utils.assets import path from ..utils.assets import path
from ..utils.assets import scripts
sys.path.append(os.path.dirname(os.path.abspath('__file__'))) sys.path.append(os.path.dirname(os.path.abspath('__file__')))
def fix_npcap():
os.system(scripts('fixnpcap.bat'))
sys.exit(0)
def run(): def run():
initialization_result = initialize() initialization_result = initialize()
@@ -70,9 +75,15 @@ def run():
msg.setWindowTitle("Unable to track network traffic data!") msg.setWindowTitle("Unable to track network traffic data!")
msg.setText( msg.setText(
"On windows make sure that WinPcap is installed in your system.") "On windows make sure that WinPcap is installed in your system.")
msg.setInformativeText("WinPcap can be installed from <a href='{}'>here</a> <br> <b>Make sure to install with the \"Install Npcap in WinPcap API-compatible Mode\"<b> option" msg.setInformativeText("WinPcap can be installed from <a href='{}'>here</a> <br>\
.format('https://nmap.org/npcap/dist/npcap-0.9986.exe')) <b>Make sure to install with the \"Install Npcap in WinPcap API-compatible Mode\"<b> option<br><br>\
In case where npcap is installed try to fix npcap and restart the app"
.format('https://nmap.org/npcap/dist/npcap-0.9990.exe'))
msg.setStandardButtons(QMessageBox.Ok) msg.setStandardButtons(QMessageBox.Ok)
button = QPushButton("Fix npcap")
button.clicked.connect(fix_npcap)
msg.addButton(button, QMessageBox.NoRole)
msg.show() msg.show()
sys.exit(app.exec_()) sys.exit(app.exec_())
+6
View File
@@ -0,0 +1,6 @@
@echo off
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
net stop npcap
net start npcap
pause
+7
View File
@@ -3,6 +3,13 @@ import os
assets_path = os.path.join(os.path.dirname( assets_path = os.path.join(os.path.dirname(
os.path.abspath(__file__)), '..', 'assets') os.path.abspath(__file__)), '..', 'assets')
scripts_path = os.path.join(os.path.dirname(
os.path.abspath(__file__)), '..', 'scripts')
def path(file): def path(file):
return os.path.join(assets_path, file) return os.path.join(assets_path, file)
def scripts(script_name):
return os.path.join(scripts_path, script_name)
+1 -1
View File
@@ -39,7 +39,7 @@ build_script:
- ps: .\env\Scripts\activate.ps1 - ps: .\env\Scripts\activate.ps1
- python -m pip install dataclasses - python -m pip install dataclasses
- python -m pip install -v -r application\requirements.txt - python -m pip install -v -r application\requirements.txt
- pyinstaller -F -w -i assets\albion-stats-icon.ico --add-data application\src\assets;src\assets application\albion-online-stats.py - pyinstaller -F -w -i assets\albion-stats-icon.ico --add-data application\src\assets;src\assets --add-data application\src\scripts;src\scripts application\albion-online-stats.py
- ps: deactivate - ps: deactivate
after_build: after_build:
- ps: mv dist\albion-online-stats.exe albion-online-stats.exe - ps: mv dist\albion-online-stats.exe albion-online-stats.exe