MCSI-5 GUI enabled option #25
@ -1,5 +1,3 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:minecraft_server_installer/main/adapter/presentation/installation_state.dart';
|
import 'package:minecraft_server_installer/main/adapter/presentation/installation_state.dart';
|
||||||
import 'package:minecraft_server_installer/main/adapter/presentation/progress_view_model.dart';
|
import 'package:minecraft_server_installer/main/adapter/presentation/progress_view_model.dart';
|
||||||
@ -34,8 +32,9 @@ class InstallationBloc extends Bloc<InstallationEvent, InstallationState> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final startScriptFilePath = path.join(savePath, Constants.startScriptFileName);
|
final startScriptFilePath = path.join(savePath, Constants.startScriptFileName);
|
||||||
|
final serverFilePath = path.join('.', Constants.serverFileName);
|
||||||
final startScriptContent =
|
final startScriptContent =
|
||||||
'java -Xmx${state.ramSize.max}M -Xms${state.ramSize.min}M -jar ${Platform.isWindows ? '.${Constants.serverFileName}\r\n' : './${Constants.serverFileName}\n'}';
|
'java -Xmx${state.ramSize.max}M -Xms${state.ramSize.min}M -jar $serverFilePath ${state.isGuiEnabled ? '' : 'nogui'}';
|
||||||
await writeFileUseCase(startScriptFilePath, startScriptContent);
|
await writeFileUseCase(startScriptFilePath, startScriptContent);
|
||||||
await grantFilePermissionUseCase(startScriptFilePath);
|
await grantFilePermissionUseCase(startScriptFilePath);
|
||||||
|
|
||||||
@ -67,6 +66,7 @@ class InstallationBloc extends Bloc<InstallationEvent, InstallationState> {
|
|||||||
gameVersion: event.gameVersion,
|
gameVersion: event.gameVersion,
|
||||||
savePath: event.savePath,
|
savePath: event.savePath,
|
||||||
isEulaAgreed: event.isEulaAgreed,
|
isEulaAgreed: event.isEulaAgreed,
|
||||||
|
isGuiEnabled: event.isGuiEnabled,
|
||||||
isCustomRamSizeEnabled: event.isCustomRamSizeEnabled,
|
isCustomRamSizeEnabled: event.isCustomRamSizeEnabled,
|
||||||
customRamSize: event.customRamSize,
|
customRamSize: event.customRamSize,
|
||||||
);
|
);
|
||||||
@ -89,6 +89,7 @@ class InstallationConfigurationUpdatedEvent extends InstallationEvent {
|
|||||||
final GameVersionViewModel? gameVersion;
|
final GameVersionViewModel? gameVersion;
|
||||||
final String? savePath;
|
final String? savePath;
|
||||||
final bool? isEulaAgreed;
|
final bool? isEulaAgreed;
|
||||||
|
final bool? isGuiEnabled;
|
||||||
final bool? isCustomRamSizeEnabled;
|
final bool? isCustomRamSizeEnabled;
|
||||||
final RangeViewModel? customRamSize;
|
final RangeViewModel? customRamSize;
|
||||||
|
|
||||||
@ -96,6 +97,7 @@ class InstallationConfigurationUpdatedEvent extends InstallationEvent {
|
|||||||
this.gameVersion,
|
this.gameVersion,
|
||||||
this.savePath,
|
this.savePath,
|
||||||
this.isEulaAgreed,
|
this.isEulaAgreed,
|
||||||
|
this.isGuiEnabled,
|
||||||
this.isCustomRamSizeEnabled,
|
this.isCustomRamSizeEnabled,
|
||||||
this.customRamSize,
|
this.customRamSize,
|
||||||
});
|
});
|
||||||
|
@ -9,6 +9,7 @@ class InstallationState with EquatableMixin {
|
|||||||
final GameVersionViewModel? gameVersion;
|
final GameVersionViewModel? gameVersion;
|
||||||
final String? savePath;
|
final String? savePath;
|
||||||
final bool isEulaAgreed;
|
final bool isEulaAgreed;
|
||||||
|
final bool isGuiEnabled;
|
||||||
final bool isCustomRamSizeEnabled;
|
final bool isCustomRamSizeEnabled;
|
||||||
final RangeViewModel? _customRamSize;
|
final RangeViewModel? _customRamSize;
|
||||||
final ProgressViewModel downloadProgress;
|
final ProgressViewModel downloadProgress;
|
||||||
@ -18,6 +19,7 @@ class InstallationState with EquatableMixin {
|
|||||||
required this.gameVersion,
|
required this.gameVersion,
|
||||||
required this.savePath,
|
required this.savePath,
|
||||||
required this.isEulaAgreed,
|
required this.isEulaAgreed,
|
||||||
|
required this.isGuiEnabled,
|
||||||
required this.isCustomRamSizeEnabled,
|
required this.isCustomRamSizeEnabled,
|
||||||
required RangeViewModel? customRamSize,
|
required RangeViewModel? customRamSize,
|
||||||
required this.downloadProgress,
|
required this.downloadProgress,
|
||||||
@ -29,6 +31,7 @@ class InstallationState with EquatableMixin {
|
|||||||
gameVersion: null,
|
gameVersion: null,
|
||||||
savePath: null,
|
savePath: null,
|
||||||
isEulaAgreed: false,
|
isEulaAgreed: false,
|
||||||
|
isGuiEnabled: false,
|
||||||
isCustomRamSizeEnabled: false,
|
isCustomRamSizeEnabled: false,
|
||||||
customRamSize: _defaultRamSize,
|
customRamSize: _defaultRamSize,
|
||||||
downloadProgress: const ProgressViewModel.zero(),
|
downloadProgress: const ProgressViewModel.zero(),
|
||||||
@ -40,6 +43,7 @@ class InstallationState with EquatableMixin {
|
|||||||
gameVersion,
|
gameVersion,
|
||||||
savePath,
|
savePath,
|
||||||
isEulaAgreed,
|
isEulaAgreed,
|
||||||
|
isGuiEnabled,
|
||||||
isCustomRamSizeEnabled,
|
isCustomRamSizeEnabled,
|
||||||
_customRamSize,
|
_customRamSize,
|
||||||
downloadProgress,
|
downloadProgress,
|
||||||
@ -50,6 +54,7 @@ class InstallationState with EquatableMixin {
|
|||||||
GameVersionViewModel? gameVersion,
|
GameVersionViewModel? gameVersion,
|
||||||
String? savePath,
|
String? savePath,
|
||||||
bool? isEulaAgreed,
|
bool? isEulaAgreed,
|
||||||
|
bool? isGuiEnabled,
|
||||||
bool? isCustomRamSizeEnabled,
|
bool? isCustomRamSizeEnabled,
|
||||||
RangeViewModel? customRamSize,
|
RangeViewModel? customRamSize,
|
||||||
ProgressViewModel? downloadProgress,
|
ProgressViewModel? downloadProgress,
|
||||||
@ -59,6 +64,7 @@ class InstallationState with EquatableMixin {
|
|||||||
gameVersion: gameVersion ?? this.gameVersion,
|
gameVersion: gameVersion ?? this.gameVersion,
|
||||||
savePath: savePath ?? this.savePath,
|
savePath: savePath ?? this.savePath,
|
||||||
isEulaAgreed: isEulaAgreed ?? this.isEulaAgreed,
|
isEulaAgreed: isEulaAgreed ?? this.isEulaAgreed,
|
||||||
|
isGuiEnabled: isGuiEnabled ?? this.isGuiEnabled,
|
||||||
isCustomRamSizeEnabled: isCustomRamSizeEnabled ?? this.isCustomRamSizeEnabled,
|
isCustomRamSizeEnabled: isCustomRamSizeEnabled ?? this.isCustomRamSizeEnabled,
|
||||||
customRamSize: customRamSize ?? _customRamSize,
|
customRamSize: customRamSize ?? _customRamSize,
|
||||||
downloadProgress: downloadProgress ?? this.downloadProgress,
|
downloadProgress: downloadProgress ?? this.downloadProgress,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user