Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/AdvancedOptions #186

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
166 changes: 100 additions & 66 deletions FASTER/Models/ServerCfg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
private string passwordAdmin;
private string password;
private string hostname;
private int maxPlayers = 32;
private List<string> motd = new();
private int maxPlayers = 32;
private List<string> motd = new();
private int motdInterval;
private List<string> admins = new();
private List<string> headlessClients = new();
private List<string> localClient = new();
private List<string> admins = new();
private List<string> headlessClients = new();
private List<string> localClient = new();
private bool headlessClientEnabled;
private bool votingEnabled;
private bool netlogEnabled;
Expand All @@ -47,17 +47,12 @@
private bool autoSelectMission = true;
private bool randomMissionOrder = true;
private int briefingTimeOut = 60; // <-
private int roleTimeOut = 90; // <- These are BI base figues
private int votingTimeOut = 60; // <-
private int roleTimeOut = 90; // <- These are BI base figues
private int votingTimeOut = 60; // <-
private int debriefingTimeOut = 45; // <-
private bool LogObjectNotFound = true; // logging enabled
private bool SkipDescriptionParsing = false; // parse description.ext
private bool ignoreMissionLoadErrors = false; // do not ingore errors
private int armaUnitsTimeout = 30; // Defines how long the player will be stuck connecting and wait for armaUnits data. Player will be notified if timeout elapsed and no units data was received
private int queueSizeLogG = 1000000; // if a specific players message queue is larger than 1MB and '#monitor' is running, dump his messages to a logfile for analysis
private string forcedDifficulty = "Custom"; // By default forcedDifficulty is only applying Custom


//Arma server only
private short verifySignatures = 0; // 0 = Disabled (FASTER Default); 1 = Deprecated Activated ; 2 = Activated (Arma Default)
private bool drawingInMap = true;
Expand All @@ -78,14 +73,14 @@
private string doubleIdDetected;
private string onUserConnected;
private string onUserDisconnected;
private string onHackedData = "kick (_this select 0)";
private string onHackedData = "kick (_this select 0)";
private string onDifferentData;
private string onUnsignedData = "kick (_this select 0)";
private string onUnsignedData = "kick (_this select 0)";
private string onUserKicked;

private bool missionSelectorChecked;
private string missionContentOverride;
private List<ProfileMission> _missions = new();
private List<ProfileMission> _missions = new();
private bool autoInit;
private string difficulty = "Custom";

Expand All @@ -97,8 +92,6 @@

private string serverCfgContent;



#region Server Options
public string PasswordAdmin
{
Expand Down Expand Up @@ -394,36 +387,6 @@
}
}

public bool logObjectNotFound
{
get => LogObjectNotFound;
set
{
LogObjectNotFound = value;
RaisePropertyChanged("logObjectNotFound");
}
}

public bool skipDescriptionParsing
{
get => SkipDescriptionParsing;
set
{
SkipDescriptionParsing = value;
RaisePropertyChanged("skipDescriptionParsing");
}
}

public bool IgnoreMissionLoadErrors
{
get => ignoreMissionLoadErrors;
set
{
ignoreMissionLoadErrors = value;
RaisePropertyChanged("IgnoreMissionLoadErrors");
}
}

public int ArmaUnitsTimeout
{
get => armaUnitsTimeout;
Expand All @@ -434,16 +397,6 @@
}
}

public int QueueSizeLogG
{
get => queueSizeLogG;
set
{
queueSizeLogG = value;
RaisePropertyChanged("QueueSizeLogG");
}
}

public string ForcedDifficulty
{
get => forcedDifficulty;
Expand Down Expand Up @@ -818,6 +771,87 @@
{ ServerCfgContent = ProcessFile(); }
}

public object LogObjectNotFound { get; private set; }
public object SkipDescriptionParsing { get; private set; }
public object IgnoreMissionLoadErrors { get; private set; }
public object QueueSizeLogG { get; private set; }

[Serializable]
public class AdvancedOptions : INotifyPropertyChanged
{
private bool logObjectNotFound = true; // logging enabled
private bool skipDescriptionParsing = false; // Parse description.ext
private bool ignoreMissionLoadErrors = false; // Do not ingore errors
private int queueSizeLogG = 0; // If a specific players message queue is larger than <Value> and '#monitor' is running, dump his messages to a logfile for analysis

public bool LogObjectNotFound
{
get => logObjectNotFound;
set
{
logObjectNotFound = value;
RaisePropertyChanged("LogObjectNotFound");
}
}

public bool SkipDescriptionParsing
{
get => skipDescriptionParsing;
set
{
skipDescriptionParsing = value;
RaisePropertyChanged("SkipDescriptionParsing");
}
}

public bool IgnoreMissionLoadErrors
{
get => ignoreMissionLoadErrors;
set
{
ignoreMissionLoadErrors = value;
RaisePropertyChanged("IgnoreMissionLoadErrors");
}
}

public int QueueSizeLogG
{
get => queueSizeLogG;
set
{
queueSizeLogG = value;
RaisePropertyChanged("QueueSizeLogG");
}
}

private string advancedOptionsContent;

public string AdvancedOptionsContent
{
get => AdvancedOptionsContent;
set
{
AdvancedOptionsContent = value;
RaisePropertyChanged("AdvancedOptionsContent");
}
}

public AdvancedOptions()
{
if(string.IsNullOrWhiteSpace(AdvancedOptionsContent))
{ AdvancedOptionsContent = ProcessFile(); }

Check failure on line 842 in FASTER/Models/ServerCfg.cs

View workflow job for this annotation

GitHub Actions / Analyze with CodeQL (csharp)

An object reference is required for the non-static field, method, or property 'ServerCfg.ProcessFile()'

Check failure on line 842 in FASTER/Models/ServerCfg.cs

View workflow job for this annotation

GitHub Actions / Analyze with CodeQL (csharp)

An object reference is required for the non-static field, method, or property 'ServerCfg.ProcessFile()'
}

public event PropertyChangedEventHandler PropertyChanged;

private void RaisePropertyChanged(string property)
{
if (PropertyChanged == null) return;
PropertyChanged(this, new PropertyChangedEventArgs(property));
if(property != "AdvancedOptionsContent") AdvancedOptionsContent = ProcessFile();

Check failure on line 851 in FASTER/Models/ServerCfg.cs

View workflow job for this annotation

GitHub Actions / Analyze with CodeQL (csharp)

An object reference is required for the non-static field, method, or property 'ServerCfg.ProcessFile()'

Check failure on line 851 in FASTER/Models/ServerCfg.cs

View workflow job for this annotation

GitHub Actions / Analyze with CodeQL (csharp)

An object reference is required for the non-static field, method, or property 'ServerCfg.ProcessFile()'
}
}

private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
RaisePropertyChanged("MissionChecked");
Expand Down Expand Up @@ -888,14 +922,14 @@
+ $"disableVoN = {disableVoN};\t\t\t\t// If set to 1, Voice over Net will not be available\r\n"
+ $"vonCodec = {vonCodec};\t\t\t\t// If set to 1 then it uses IETF standard OPUS codec, if to 0 then it uses SPEEX codec (since Arma 3 update 1.58+) \r\n"
+ $"skipLobby = {(skipLobby ? "1" : "0")};\t\t\t\t// Overridden by mission parameters\r\n"
+ $"vonCodecQuality = {vonCodecQuality};\t\t\t// since 1.62.95417 supports range 1-20 //since 1.63.x will supports range 1-30 //8kHz is 0-10, 16kHz is 11-20, 32kHz(48kHz) is 21-30 \r\n"
+ $"vonCodecQuality = {vonCodecQuality};\t\t\t// Since 1.62.95417 supports range 1-20 //since 1.63.x will supports range 1-30 //8kHz is 0-10, 16kHz is 11-20, 32kHz(48kHz) is 21-30 \r\n"
+ $"persistent = {persistent};\t\t\t\t// If 1, missions still run on even after the last player disconnected.\r\n"
+ $"timeStampFormat = \"{timeStampFormat}\";\t\t// Set the timestamp format used on each report line in server-side RPT file. Possible values are \"none\" (default),\"short\",\"full\".\r\n"
+ $"BattlEye = {battlEye};\t\t\t\t// Server to use BattlEye system\r\n"
+ $"queueSizeLogG = {queueSizeLogG};\t\t\t// If a specific players message queue is larger than 1MB and #monitor is running, dump his messages to a logfile for analysis \r\n"
+ $"LogObjectNotFound = {logObjectNotFound};\t\t// When false to skip logging 'Server: Object not found messages'.\r\n"
+ $"SkipDescriptionParsing = {skipDescriptionParsing};\t\t// When true to skip parsing of description.ext/mission.sqm. Will show pbo filename instead of configured missionName. OverviewText and such won't work, but loading the mission list is a lot faster when there are many missions \r\n"
+ $"ignoreMissionLoadErrors = {ignoreMissionLoadErrors};\t\t// When set to true, the mission will load no matter the amount of loading errors. If set to false, the server will abort mission's loading and return to mission selection.\r\n"
+ $"queueSizeLogG = {QueueSizeLogG};\t\t\t// If a specific players message queue is larger than Value number and #monitor is running, dump his messages to a logfile for analysis \r\n"
+ $"LogObjectNotFound = {LogObjectNotFound};\t\t// When false to skip logging 'Server: Object not found messages'.\r\n"
+ $"SkipDescriptionParsing = {SkipDescriptionParsing};\t\t// When true to skip parsing of description.ext/mission.sqm. Will show pbo filename instead of configured missionName. OverviewText and such won't work, but loading the mission list is a lot faster when there are many missions \r\n"
+ $"ignoreMissionLoadErrors = {IgnoreMissionLoadErrors};\t\t// When set to true, the mission will load no matter the amount of loading errors. If set to false, the server will abort mission's loading and return to mission selection.\r\n"
+ $"forcedDifficulty = {forcedDifficulty};\t\t\t// Forced difficulty (Recruit, Regular, Veteran, Custom)\r\n"
+ "\r\n"
+ "// TIMEOUTS\r\n"
Expand All @@ -917,9 +951,9 @@
+ $"doubleIdDetected = \"{doubleIdDetected}\";\t\t\t//\r\n"
+ "\r\n"
+ "// SIGNATURE VERIFICATION\r\n"
+ $"onUnsignedData = \"{onUnsignedData}\";\t// unsigned data detected\r\n"
+ $"onHackedData = \"{onHackedData}\";\t// tampering of the signature detected\r\n"
+ $"onDifferentData = \"{onDifferentData}\";\t\t\t// data with a valid signature, but different version than the one present on server detected\r\n"
+ $"onUnsignedData = \"{onUnsignedData}\";\t// Unsigned data detected\r\n"
+ $"onHackedData = \"{onHackedData}\";\t// Tampering of the signature detected\r\n"
+ $"onDifferentData = \"{onDifferentData}\";\t\t\t// Data with a valid signature, but different version than the one present on server detected\r\n"
+ "\r\n"
+ "\r\n"
+ "// MISSIONS CYCLE (see below)\r\n"
Expand Down Expand Up @@ -991,4 +1025,4 @@
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
}
}
}
}
29 changes: 22 additions & 7 deletions FASTER/Models/ServerProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ public ServerProfileCollection()

internal static void AddServerProfile(string profileName)
{
var currentProfiles = Properties.Settings.Default.Profiles;
var currentProfiles = Properties.Settings.Default.Profiles;
var p = new ServerProfile(profileName);
p.ServerCfg.ServerCfgContent = p.ServerCfg.ProcessFile();
p.BasicCfg.BasicContent = p.BasicCfg.ProcessFile();
p.ArmaProfile.ArmaProfileContent = p.ArmaProfile.ProcessFile();
p.ServerCfg.ServerCfgContent = p.ServerCfg.ProcessFile();
p.ServerCfg.ServerCfgContent = p.AdvancedOptions.ProcessFile();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go over this file again as it might be why ProcessFile isn't working

p.BasicCfg.BasicContent = p.BasicCfg.ProcessFile();
p.ArmaProfile.ArmaProfileContent = p.ArmaProfile.ProcessFile();
currentProfiles.Add(p);
Properties.Settings.Default.Profiles = currentProfiles;
Properties.Settings.Default.Profiles = currentProfiles;
Properties.Settings.Default.Save();
MainWindow.Instance.LoadServerProfiles();
}
Expand Down Expand Up @@ -71,6 +72,7 @@ public class ServerProfile : INotifyPropertyChanged
private bool _profileModsFilterIsRegex = false;
private bool _profileModsFilterIsInvalid = false;
private ServerCfg _serverCfg;
private ServerCfg _advancedOptions;
private Arma3Profile _armaProfile;
private BasicCfg _basicCfg;

Expand Down Expand Up @@ -367,8 +369,8 @@ public bool ProfileModsFilterIsInvalid
}
}

public ServerCfg ServerCfg
{
public ServerCfg ServerCfg
{
get => _serverCfg;
set
{
Expand All @@ -379,6 +381,19 @@ public ServerCfg ServerCfg
RaisePropertyChanged("ServerCfg");
}
}

public ServerCfg AdvancedOptions
{
get => _advancedOptions;
set
{
if(_advancedOptions != null)
_advancedOptions.PropertyChanged -= Class_PropertyChanged;
_advancedOptions = value;
_advancedOptions.PropertyChanged += Class_PropertyChanged;
RaisePropertyChanged("AdvancedOptions");
}
}

public Arma3Profile ArmaProfile
{
Expand Down
4 changes: 2 additions & 2 deletions FASTER/Views/Profile.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@
<ComboBox SelectedItem="{Binding Path=Profile.ServerCfg.VerifySignatures}" ItemsSource="{Binding Path=VerifySignatures}" mah:TextBoxHelper.UseFloatingWatermark="True" mah:TextBoxHelper.Watermark="Verify Signatures" Margin="5"/>
<CheckBox IsChecked="{Binding Path=Profile.ServerCfg.KickDuplicates}" Content="Kick Duplicates" Margin="5,2"/>
<CheckBox IsChecked="{Binding Path=Profile.ServerCfg.KickClientOnSlowNetwork}" Content="Kick on Slow Network" Margin="5,2"/>
<CheckBox IsChecked="{Binding Path=Profile.ServerCfg.logObjectNotFound}" Content="Log Object Not Found" Margin="5,2"/>
<CheckBox IsChecked="{Binding Path=Profile.ServerCfg.skipDescriptionParsing}" Content="Skip Description Parsing" Margin="5,2"/>
<CheckBox IsChecked="{Binding Path=Profile.ServerCfg.LogObjectNotFound}" Content="Log Object Not Found" Margin="5,2"/>
<CheckBox IsChecked="{Binding Path=Profile.ServerCfg.SkipDescriptionParsing}" Content="Skip Description Parsing" Margin="5,2"/>
<CheckBox IsChecked="{Binding Path=Profile.ServerCfg.IgnoreMissionLoadErrors}" Content="Ignore Mission Load Errors" Margin="5,2"/>

<StackPanel>
Expand Down
Loading