Skip to content

Commit ed25c19

Browse files
committed
Refactor model classes and fix property assignments
Aligned variable declarations for consistency in Arma3Profile and BasicCfg. Removed unused properties and redundant event handling from ServerCfg. Ensured AdvancedOptions and its content are properly initialized in ServerProfile constructors.
1 parent 0261dde commit ed25c19

File tree

4 files changed

+15
-26
lines changed

4 files changed

+15
-26
lines changed

FASTER/Models/Arma3Profile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class Arma3Profile : INotifyPropertyChanged
4141
private ushort mapContentMines = 1;
4242
private ushort autoReport = 0;
4343
private ushort multipleSaves = 0;
44-
private int tacticalPing = 1;
44+
private int tacticalPing = 1;
4545

4646
private ushort aiLevelPreset = 3;
4747
private double skillAi = 0.5;

FASTER/Models/BasicCfg.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public static class BasicCfgArrays
1414
[Serializable]
1515
public class BasicCfg : INotifyPropertyChanged
1616
{
17-
private uint viewDistance = 2000;
18-
private double terrainGrid = 25;
17+
private uint viewDistance = 2000;
18+
private double terrainGrid = 25;
1919

2020
private ushort maxMsgSend = 128;
2121
private ushort maxSizeGuaranteed = 256;
@@ -158,10 +158,10 @@ public string PerfPreset
158158
MaxMsgSend = 256;
159159
MaxSizeGuaranteed = 512;
160160
MaxSizeNonGuaranteed = 256;
161-
MinErrorToSend = 0.001;
162-
MinErrorToSendNear = 0.01;
163-
MaxPacketSize = 1400;
164-
MaxCustomFileSize = 160;
161+
MinErrorToSend = 0.001;
162+
MinErrorToSendNear = 0.01;
163+
MaxPacketSize = 1400;
164+
MaxCustomFileSize = 160;
165165

166166

167167
switch ((short)Array.IndexOf(BasicCfgArrays.PerfPresets, value))
@@ -177,8 +177,8 @@ public string PerfPreset
177177
MinBandwidth = 250000000;
178178
break;
179179
case 4:
180-
MaxMsgSend = 512;
181-
MinBandwidth = 1000000000;
180+
MaxMsgSend = 512;
181+
MinBandwidth = 1000000000;
182182
break;
183183
}
184184
RaisePropertyChanged("PerfPreset");

FASTER/Models/ServerCfg.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,6 @@ public ServerCfg()
771771
{ ServerCfgContent = ProcessFile(); }
772772
}
773773

774-
public object LogObjectNotFound { get; private set; }
775-
public object SkipDescriptionParsing { get; private set; }
776-
public object IgnoreMissionLoadErrors { get; private set; }
777-
public object QueueSizeLogG { get; private set; }
778-
779774
[Serializable]
780775
public class AdvancedOptions : INotifyPropertyChanged
781776
{
@@ -824,7 +819,7 @@ public int QueueSizeLogG
824819
}
825820
}
826821

827-
private string advancedOptionsContent;
822+
private string advancedOptionsContent;
828823

829824
public string AdvancedOptionsContent
830825
{
@@ -842,16 +837,6 @@ public AdvancedOptions()
842837
{ AdvancedOptionsContent = ProcessFile(); }
843838
}
844839

845-
public event PropertyChangedEventHandler PropertyChanged;
846-
847-
private void RaisePropertyChanged(string property)
848-
{
849-
if (PropertyChanged == null) return;
850-
PropertyChanged(this, new PropertyChangedEventArgs(property));
851-
if(property != "AdvancedOptionsContent") AdvancedOptionsContent = ProcessFile();
852-
}
853-
}
854-
855840
private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
856841
{
857842
RaisePropertyChanged("MissionChecked");
@@ -1025,4 +1010,5 @@ private void RaisePropertyChanged(string property)
10251010
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
10261011
}
10271012
}
1013+
}
10281014
}

FASTER/Models/ServerProfile.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,14 @@ public ServerProfile(string name, bool createFolder = true)
428428
Name = name;
429429
Executable = Path.Combine(Properties.Settings.Default.serverPath, "arma3server_x64.exe");
430430
ServerCfg = new ServerCfg(){ Hostname = name};
431+
AdvancedOptions = new AdvancedOptions();
431432
ArmaProfile = new Arma3Profile();
432433
BasicCfg = new BasicCfg();
433434
ServerCfg.ServerCfgContent = ServerCfg.ProcessFile();
435+
ServerCfg.AdvancedOptionsContent = AdvancedOptions.ProcessFile();
434436
ArmaProfile.ArmaProfileContent = ArmaProfile.ProcessFile();
435437
BasicCfg.BasicContent = BasicCfg.ProcessFile();
436-
438+
ServerCfg.AdvancedOptionsContent = AdvancedOptions.ProcessFile();
437439
if (createFolder)
438440
{ Directory.CreateDirectory(Path.Combine(Properties.Settings.Default.serverPath, "Servers", Id)); }
439441
}
@@ -446,6 +448,7 @@ public ServerProfile()
446448
ArmaProfile = new Arma3Profile();
447449
BasicCfg = new BasicCfg();
448450
ServerCfg.ServerCfgContent = ServerCfg.ProcessFile();
451+
ServerCfg.AdvancedOptionsContent = AdvancedOptions.ProcessFile();
449452
ArmaProfile.ArmaProfileContent = ArmaProfile.ProcessFile();
450453
BasicCfg.BasicContent = BasicCfg.ProcessFile();
451454
}

0 commit comments

Comments
 (0)