Compare commits

...

2 Commits

Author SHA1 Message Date
feyris-tan
d1ba3976cb Merge branch 'master' of http://172.20.20.19:3000/ft/skyscraper8
All checks were successful
🚀 Pack skyscraper8 / make-zip (push) Successful in 6m46s
2026-01-20 17:01:49 +01:00
feyris-tan
fa0abb84f2 Refactored the Equipments. 2026-01-20 17:01:31 +01:00
36 changed files with 462 additions and 222 deletions

View File

@ -107,12 +107,12 @@ namespace skyscraper5.Data.MySql
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void UiSatellitesAdd(SatellitePosition newPosition) public void UiSatellitesAdd(SatellitePositionEntity newPosition)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void UiSatellitesDelete(SatellitePosition satellitePosition) public void UiSatellitesDelete(SatellitePositionEntity satellitePosition)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -233,22 +233,22 @@ namespace skyscraper5.Data.MySql
throw new NotImplementedException(); throw new NotImplementedException();
} }
public List<LnbType> UiLnbTypesListAll() public List<LnbEntity> UiLnbTypesListAll()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void UiLnbTypesAdd(LnbType defaultLnbType) public void UiLnbTypesAdd(LnbEntity defaultLnbType)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public List<DishType> UiDishTypesListAll() public List<DishEntity> UiDishTypesListAll()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void UiDishTypesAdd(DishType defaultDishType) public void UiDishTypesAdd(DishEntity defaultDishType)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -50,9 +50,9 @@ namespace skyscraper5.Data.MySql
} }
public List<SatellitePosition> UiSatellitesListAll() public List<SatellitePositionEntity> UiSatellitesListAll()
{ {
List<SatellitePosition> result = new List<SatellitePosition>(); List<SatellitePositionEntity> result = new List<SatellitePositionEntity>();
using (MySqlConnection connection = new MySqlConnection(_mcsb.ToString())) using (MySqlConnection connection = new MySqlConnection(_mcsb.ToString()))
{ {
connection.Open(); connection.Open();
@ -62,9 +62,9 @@ namespace skyscraper5.Data.MySql
MySqlDataReader dataReader = command.ExecuteReader(); MySqlDataReader dataReader = command.ExecuteReader();
while (dataReader.Read()) while (dataReader.Read())
{ {
SatellitePosition satellitePosition = new SatellitePosition(); SatellitePositionEntity satellitePosition = new SatellitePositionEntity();
satellitePosition.angle = dataReader.GetFloat(2); satellitePosition.angle = dataReader.GetFloat(2);
satellitePosition.cardinalDirection = dataReader.GetBoolean(3) ? 0 : 1; //satellitePosition.cardinalDirection = dataReader.GetBoolean(3) ? 0 : 1;
satellitePosition.name = dataReader.GetString(4); satellitePosition.name = dataReader.GetString(4);
result.Add(satellitePosition); result.Add(satellitePosition);
} }

View File

@ -328,7 +328,7 @@ namespace skyscraper5.Data.PostgreSql
string note = null; string note = null;
if (!dataReader.IsDBNull(15)) if (!dataReader.IsDBNull(15))
note = dataReader.GetString(15); note = dataReader.GetString(15);
result = new DbBlindscanJob(uuid, tuner_mac, (STD_TYPE)tuner_std, diseqc_index, new DummyGpsReceiver(true,(float)gps_lat,(float)gps_lon), SatellitePosition.FromChecksum(sat_position)); result = new DbBlindscanJob(uuid, tuner_mac, (STD_TYPE)tuner_std, diseqc_index, new DummyGpsReceiver(true,(float)gps_lat,(float)gps_lon), SatellitePositionEntity.FromChecksum(sat_position));
result.DateAdded = date_added; result.DateAdded = date_added;
result.HorizontalHighState = (DbBlindscanJobPolarizationStatus)horizontal_high; result.HorizontalHighState = (DbBlindscanJobPolarizationStatus)horizontal_high;
result.HorizontalLowState = (DbBlindscanJobPolarizationStatus)horizontal_low; result.HorizontalLowState = (DbBlindscanJobPolarizationStatus)horizontal_low;
@ -546,11 +546,11 @@ namespace skyscraper5.Data.PostgreSql
dgr = new DummyGpsReceiver(true, gpsLat, gpsLon); dgr = new DummyGpsReceiver(true, gpsLat, gpsLon);
} }
SatellitePosition satPositionObj = null; SatellitePositionEntity satPositionObj = null;
if (!dataReader.IsDBNull("sat_position")) if (!dataReader.IsDBNull("sat_position"))
{ {
int satPosition = dataReader.GetInt32("sat_position"); int satPosition = dataReader.GetInt32("sat_position");
satPositionObj = SatellitePosition.FromChecksum(satPosition); satPositionObj = SatellitePositionEntity.FromChecksum(satPosition);
} }
int diseqcIndex = dataReader.GetInt32("diseqc_index"); int diseqcIndex = dataReader.GetInt32("diseqc_index");
int version = dataReader.GetInt32("version"); int version = dataReader.GetInt32("version");

View File

@ -19,9 +19,9 @@ namespace skyscraper5.Data.PostgreSql
this.uiVersion = version; this.uiVersion = version;
} }
public List<LnbType> UiLnbTypesListAll() public List<LnbEntity> UiLnbTypesListAll()
{ {
List<LnbType> lnbTypes = new List<LnbType>(); List<LnbEntity> lnbTypes = new List<LnbEntity>();
using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString())) using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString()))
{ {
conn.Open(); conn.Open();
@ -38,7 +38,7 @@ namespace skyscraper5.Data.PostgreSql
int lofSw = dataReader.GetInt32(5); int lofSw = dataReader.GetInt32(5);
int minFreq = dataReader.GetInt32(6); int minFreq = dataReader.GetInt32(6);
int maxFreq = dataReader.GetInt32(7); int maxFreq = dataReader.GetInt32(7);
lnbTypes.Add(new LnbType(name, lof1, lof2, lofSw, minFreq, maxFreq) { DateAdded = added, Id = id }); lnbTypes.Add(new LnbEntity("", name, lof1, lof2, lofSw, minFreq, maxFreq) { DateAdded = added, Id = id });
} }
dataReader.Close(); dataReader.Close();
@ -49,7 +49,7 @@ namespace skyscraper5.Data.PostgreSql
return lnbTypes; return lnbTypes;
} }
public void UiLnbTypesAdd(LnbType defaultLnbType) public void UiLnbTypesAdd(LnbEntity defaultLnbType)
{ {
using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString())) using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString()))
{ {
@ -69,9 +69,9 @@ namespace skyscraper5.Data.PostgreSql
} }
} }
public List<DishType> UiDishTypesListAll() public List<DishEntity> UiDishTypesListAll()
{ {
List<DishType> result = new List<DishType>(); List<DishEntity> result = new List<DishEntity>();
using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString())) using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString()))
{ {
conn.Open(); conn.Open();
@ -85,14 +85,14 @@ namespace skyscraper5.Data.PostgreSql
string name = dataReader.GetString(2); string name = dataReader.GetString(2);
int diameter = dataReader.GetInt32(3); int diameter = dataReader.GetInt32(3);
DishShape shape = (DishShape)dataReader.GetInt32(4); DishShape shape = (DishShape)dataReader.GetInt32(4);
result.Add(new DishType(name, diameter, shape) { DateAdded = added, Id = id }); result.Add(new DishEntity("", name, diameter, shape) { DateAdded = added, Id = id });
} }
} }
return result; return result;
} }
public void UiDishTypesAdd(DishType defaultDishType) public void UiDishTypesAdd(DishEntity defaultDishType)
{ {
using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString())) using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString()))
{ {
@ -109,9 +109,9 @@ namespace skyscraper5.Data.PostgreSql
} }
public List<SatellitePosition> UiSatellitesListAll() public List<SatellitePositionEntity> UiSatellitesListAll()
{ {
List<SatellitePosition> positions = new List<SatellitePosition>(); List<SatellitePositionEntity> positions = new List<SatellitePositionEntity>();
using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString())) using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString()))
{ {
conn.Open(); conn.Open();
@ -123,7 +123,7 @@ namespace skyscraper5.Data.PostgreSql
float angle = (float)reader.GetDouble(0); float angle = (float)reader.GetDouble(0);
int cardinal = reader.GetInt32(1); int cardinal = reader.GetInt32(1);
string name = reader.GetString(2); string name = reader.GetString(2);
SatellitePosition child = new SatellitePosition(angle, cardinal, name); SatellitePositionEntity child = new SatellitePositionEntity(angle, name);
positions.Add(child); positions.Add(child);
} }
@ -135,7 +135,7 @@ namespace skyscraper5.Data.PostgreSql
return positions; return positions;
} }
public void UiSatellitesAdd(SatellitePosition newPosition) public void UiSatellitesAdd(SatellitePositionEntity newPosition)
{ {
using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString())) using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString()))
{ {
@ -145,7 +145,7 @@ namespace skyscraper5.Data.PostgreSql
"insert into skyscraper5_satellite_positions (angle, cardinal, name, keyversion, key) " + "insert into skyscraper5_satellite_positions (angle, cardinal, name, keyversion, key) " +
"values (@angle, @cardinal, @name, @keyversion, @key)"; "values (@angle, @cardinal, @name, @keyversion, @key)";
cmd.Parameters.AddWithValue("@angle", NpgsqlDbType.Real, newPosition.angle); cmd.Parameters.AddWithValue("@angle", NpgsqlDbType.Real, newPosition.angle);
cmd.Parameters.AddWithValue("@cardinal", NpgsqlDbType.Integer, newPosition.cardinalDirection); cmd.Parameters.AddWithValue("@cardinal", NpgsqlDbType.Integer, newPosition.GetCardinalDirectionAsInt());
cmd.Parameters.AddWithValue("@name", NpgsqlDbType.Text, newPosition.name); cmd.Parameters.AddWithValue("@name", NpgsqlDbType.Text, newPosition.name);
cmd.Parameters.AddWithValue("@keyversion", NpgsqlDbType.Integer, uiVersion); cmd.Parameters.AddWithValue("@keyversion", NpgsqlDbType.Integer, uiVersion);
cmd.Parameters.AddWithValue("@key", NpgsqlDbType.Text, newPosition.Checksum.ToString()); cmd.Parameters.AddWithValue("@key", NpgsqlDbType.Text, newPosition.Checksum.ToString());
@ -155,7 +155,7 @@ namespace skyscraper5.Data.PostgreSql
} }
} }
public void UiSatellitesDelete(SatellitePosition satellitePosition) public void UiSatellitesDelete(SatellitePositionEntity satellitePosition)
{ {
using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString())) using (NpgsqlConnection conn = new NpgsqlConnection(connectionStringBuilder.ToString()))
{ {

View File

@ -127,7 +127,7 @@ namespace skyscraper5.UI.Overrides
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void OnBlindscanBeforeSetChannel(BlindscanSearchResult blindscanResult, LnbType lnbType) public void OnBlindscanBeforeSetChannel(BlindscanSearchResult blindscanResult, LnbEntity lnbType)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -21,9 +21,9 @@ namespace skyscraper8.UI.MonoGame
public DataStorage DataStorage { get; set; } public DataStorage DataStorage { get; set; }
public ObjectStorage ObjectStorage { get; set; } public ObjectStorage ObjectStorage { get; set; }
public IGpsReceiver Gps { get; set; } public IGpsReceiver Gps { get; set; }
public List<SatellitePosition> SatellitePositions { get; set; } public List<SatellitePositionEntity> SatellitePositions { get; set; }
public List<LnbType> LnbTypes { get; set; } public List<LnbEntity> LnbTypes { get; set; }
public List<DishType> DishTypes { get; set; } public List<DishEntity> DishTypes { get; set; }
public ReadOnlyCollection<KeyValuePair<TunerFactoryIdAttribute, ITunerFactory>> AllTunerFactories { get; set; } public ReadOnlyCollection<KeyValuePair<TunerFactoryIdAttribute, ITunerFactory>> AllTunerFactories { get; set; }
public IStreamReader StreamReader { get; set; } public IStreamReader StreamReader { get; set; }
public List<TunerMetadata> Tuners { get; set; } public List<TunerMetadata> Tuners { get; set; }

View File

@ -14,13 +14,14 @@ namespace SDL2Demo.Forms
internal class ConfigureDishTypes : IRenderable internal class ConfigureDishTypes : IRenderable
{ {
private readonly DataStorage _scraperStroage; private readonly DataStorage _scraperStroage;
private List<DishType> dishTypes; private List<DishEntity> dishTypes;
private string tableUuid; private string tableUuid;
private string manufacturer;
private string name; private string name;
private int diameter; private int diameter;
private DishShape shape; private DishShape shape;
public ConfigureDishTypes(DataStorage scraperStroage, List<DishType> dishTypes) public ConfigureDishTypes(DataStorage scraperStroage, List<DishEntity> dishTypes)
{ {
_scraperStroage = scraperStroage; _scraperStroage = scraperStroage;
this.dishTypes = dishTypes; this.dishTypes = dishTypes;
@ -37,12 +38,14 @@ namespace SDL2Demo.Forms
if (justSaved) if (justSaved)
{ {
name = ""; name = "";
manufacturer = "";
diameter = 0; diameter = 0;
shape = DishShape.Offset; shape = DishShape.Offset;
justSaved = false; justSaved = false;
} }
if (ImGui.TreeNode("Add Dish Type")) if (ImGui.TreeNode("Add Dish Type"))
{ {
ImGui.InputText("Manufacturer", ref manufacturer, 255);
ImGui.InputText("Name", ref name, 255); ImGui.InputText("Name", ref name, 255);
ImGui.InputInt("Diameter", ref diameter, 5, 10); ImGui.InputInt("Diameter", ref diameter, 5, 10);
@ -63,7 +66,7 @@ namespace SDL2Demo.Forms
ImGui.BeginDisabled(!SaveButtonEnabled()); ImGui.BeginDisabled(!SaveButtonEnabled());
if (ImGui.Button("Add")) if (ImGui.Button("Add"))
{ {
DishType newDish = new DishType(name, diameter, shape); DishEntity newDish = new DishEntity(manufacturer, name, diameter, shape);
dishTypes.Add(newDish); dishTypes.Add(newDish);
_scraperStroage.UiDishTypesAdd(newDish); _scraperStroage.UiDishTypesAdd(newDish);
justSaved = true; justSaved = true;
@ -84,7 +87,7 @@ namespace SDL2Demo.Forms
ImGui.TableSetColumnIndex(2); ImGui.TableSetColumnIndex(2);
ImGui.Text("Type"); ImGui.Text("Type");
foreach (DishType dishType in dishTypes) foreach (DishEntity dishType in dishTypes)
{ {
ImGui.TableNextRow(); ImGui.TableNextRow();
ImGui.TableSetColumnIndex(0); ImGui.TableSetColumnIndex(0);
@ -120,7 +123,7 @@ namespace SDL2Demo.Forms
return false; return false;
} }
foreach (DishType dishType in dishTypes) foreach (DishEntity dishType in dishTypes)
{ {
if (dishType.Name.Equals(name)) if (dishType.Name.Equals(name))
return false; return false;

View File

@ -16,19 +16,21 @@ namespace SDL2Demo.Forms
internal class ConfigureLnbTypes : IRenderable internal class ConfigureLnbTypes : IRenderable
{ {
private readonly DataStorage _scraperStroage; private readonly DataStorage _scraperStroage;
private List<LnbType> lnbTypes; private List<LnbEntity> lnbTypes;
private string tableUuid; private string tableUuid;
private string lnbPopupUuid; private string lnbPopupUuid;
private string manufacturer;
private string name; private string name;
private int lof1, lof2, lofSw, minFreq, maxFreq; private int lof1, lof2, lofSw, minFreq, maxFreq;
public ConfigureLnbTypes(DataStorage scraperStroage, List<LnbType> lnbTypes) public ConfigureLnbTypes(DataStorage scraperStroage, List<LnbEntity> lnbTypes)
{ {
_scraperStroage = scraperStroage; _scraperStroage = scraperStroage;
this.lnbTypes = lnbTypes; this.lnbTypes = lnbTypes;
this.tableUuid = Guid.NewGuid().ToString(); this.tableUuid = Guid.NewGuid().ToString();
this.name = ""; this.name = "";
this.manufacturer = "";
this.lnbPopupUuid = Guid.NewGuid().ToString(); this.lnbPopupUuid = Guid.NewGuid().ToString();
} }
@ -39,6 +41,8 @@ namespace SDL2Demo.Forms
ImGui.Begin("Configure LNB Types", ref pOpen, windowFlags); ImGui.Begin("Configure LNB Types", ref pOpen, windowFlags);
if (ImGui.TreeNode("Add LNB Type")) if (ImGui.TreeNode("Add LNB Type"))
{ {
ImGui.InputText("Manufacturer", ref this.manufacturer, 64);
ImGui.SameLine();
ImGui.InputText("Name", ref name, 255); ImGui.InputText("Name", ref name, 255);
ImGui.InputInt("LOF1", ref lof1, 50, 100); ImGui.InputInt("LOF1", ref lof1, 50, 100);
@ -55,7 +59,7 @@ namespace SDL2Demo.Forms
ImGui.BeginDisabled(!SaveButtonEnabled()); ImGui.BeginDisabled(!SaveButtonEnabled());
if (ImGui.Button("Add")) if (ImGui.Button("Add"))
{ {
LnbType newLnb = new LnbType(name, lof1, lof2, lofSw, minFreq, maxFreq); LnbEntity newLnb = new LnbEntity(manufacturer, name, lof1, lof2, lofSw, minFreq, maxFreq);
lnbTypes.Add(newLnb); lnbTypes.Add(newLnb);
_scraperStroage.UiLnbTypesAdd(newLnb); _scraperStroage.UiLnbTypesAdd(newLnb);
} }
@ -98,7 +102,7 @@ namespace SDL2Demo.Forms
ImGui.TableSetColumnIndex(2); ImGui.TableSetColumnIndex(2);
ImGui.Text("Frequency Range"); ImGui.Text("Frequency Range");
foreach (LnbType lnbType in lnbTypes) foreach (LnbEntity lnbType in lnbTypes)
{ {
ImGui.TableNextRow(); ImGui.TableNextRow();
ImGui.TableSetColumnIndex(0); ImGui.TableSetColumnIndex(0);
@ -136,7 +140,7 @@ namespace SDL2Demo.Forms
if (lof1 == 0) if (lof1 == 0)
return false; return false;
foreach (LnbType lnbType in lnbTypes) foreach (LnbEntity lnbType in lnbTypes)
{ {
if (lnbType.MinimumFrequency == minFreq && if (lnbType.MinimumFrequency == minFreq &&
lnbType.MaximumFrequency == maxFreq && lnbType.MaximumFrequency == maxFreq &&

View File

@ -10,9 +10,9 @@ namespace SDL2Demo.Forms
internal class ConfigureTunersWindow : IRenderable internal class ConfigureTunersWindow : IRenderable
{ {
private readonly DataStorage _scraperStroage; private readonly DataStorage _scraperStroage;
private List<SatellitePosition> satPositions; private List<SatellitePositionEntity> satPositions;
private List<LnbType> lnbTypes; private List<LnbEntity> lnbTypes;
private List<DishType> dishTypes; private List<DishEntity> dishTypes;
public ConfigureTunersWindow(List<TunerMetadata> tuners, DataStorage scraperStroage) public ConfigureTunersWindow(List<TunerMetadata> tuners, DataStorage scraperStroage)
{ {

View File

@ -2102,7 +2102,7 @@ namespace SDL2Demo.Forms
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void OnBlindscanBeforeSetChannel(BlindscanSearchResult blindscanResult,LnbType lnbType) public void OnBlindscanBeforeSetChannel(BlindscanSearchResult blindscanResult,LnbEntity lnbType)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -24,7 +24,7 @@ namespace SDL2Demo.Forms
private string lnbPopupUuid; private string lnbPopupUuid;
private string memoryTableUuid; private string memoryTableUuid;
private List<SatellitePosition> allPositions; private List<SatellitePositionEntity> allPositions;
private readonly DataStorage _storage; private readonly DataStorage _storage;
@ -50,8 +50,8 @@ namespace SDL2Demo.Forms
if (allPositions.Count == 0) if (allPositions.Count == 0)
return true; return true;
int currentChecksum = SatellitePosition.GetChecksum(degrees, cardinalDirection); int currentChecksum = SatellitePositionEntity.GetChecksum(degrees);
foreach (SatellitePosition satellitePosition in allPositions) foreach (SatellitePositionEntity satellitePosition in allPositions)
{ {
if (currentChecksum == satellitePosition.Checksum) if (currentChecksum == satellitePosition.Checksum)
return false; return false;
@ -68,9 +68,6 @@ namespace SDL2Demo.Forms
{ {
ImGui.InputText("Name", ref name, 255); ImGui.InputText("Name", ref name, 255);
ImGui.InputFloat("Position", ref degrees, 0.1f); ImGui.InputFloat("Position", ref degrees, 0.1f);
ImGui.RadioButton("East", ref cardinalDirection, 0);
ImGui.SameLine();
ImGui.RadioButton("West", ref cardinalDirection, 1);
CheckBounds(); CheckBounds();
@ -78,7 +75,7 @@ namespace SDL2Demo.Forms
ImGui.BeginDisabled(!SaveButtonEnabled()); ImGui.BeginDisabled(!SaveButtonEnabled());
if (ImGui.Button("Add")) if (ImGui.Button("Add"))
{ {
SatellitePosition newPosition = new SatellitePosition(degrees, cardinalDirection, name); SatellitePositionEntity newPosition = new SatellitePositionEntity(degrees, name);
allPositions.Add(newPosition); allPositions.Add(newPosition);
_storage.UiSatellitesAdd(newPosition); _storage.UiSatellitesAdd(newPosition);
} }
@ -89,13 +86,13 @@ namespace SDL2Demo.Forms
ImGui.Separator(); ImGui.Separator();
ImGui.BeginTable(memoryTableUuid, 4); ImGui.BeginTable(memoryTableUuid, 4);
foreach (SatellitePosition satellitePosition in allPositions) foreach (SatellitePositionEntity satellitePosition in allPositions)
{ {
ImGui.TableNextRow(); ImGui.TableNextRow();
ImGui.TableSetColumnIndex(0); ImGui.TableSetColumnIndex(0);
ImGui.Text(satellitePosition.name); ImGui.Text(satellitePosition.name);
ImGui.TableSetColumnIndex(1); ImGui.TableSetColumnIndex(1);
ImGui.Text(String.Format("{0:0.0}° {1}", satellitePosition.angle, satellitePosition.cardinalDirection == 0 ? "E" : "W")); ImGui.Text(String.Format("{0:0.0}° {1}", satellitePosition.angle, satellitePosition.GetCardinalDirectionAsChar()));
ImGui.TableSetColumnIndex(2); ImGui.TableSetColumnIndex(2);
ImGui.Text(""); ImGui.Text("");

View File

@ -33,7 +33,7 @@ namespace SDL2Demo.Jobs
public class BlindscanTarget public class BlindscanTarget
{ {
public BlindscanTarget(string name, int tunerIndex, STD_TYPE tunerStandard, int diseqcType, public BlindscanTarget(string name, int tunerIndex, STD_TYPE tunerStandard, int diseqcType,
SatellitePosition satPosition, int satIndex, LnbType lnbType, PhysicalAddress tunerMetadataMacAddress) SatellitePositionEntity satPosition, int satIndex, LnbEntity lnbType, PhysicalAddress tunerMetadataMacAddress)
{ {
this.name = name; this.name = name;
this.tunerIndex = tunerIndex; this.tunerIndex = tunerIndex;
@ -50,10 +50,10 @@ namespace SDL2Demo.Jobs
public int tunerIndex; public int tunerIndex;
public STD_TYPE tunerStandard; public STD_TYPE tunerStandard;
public int diseqcType; public int diseqcType;
public SatellitePosition satPosition; public SatellitePositionEntity satPosition;
public int satIndex; public int satIndex;
public string buttonUuid; public string buttonUuid;
public LnbType lnbType; public LnbEntity lnbType;
public readonly PhysicalAddress macAddress; public readonly PhysicalAddress macAddress;
public bool IsTorC() public bool IsTorC()
@ -84,7 +84,7 @@ namespace SDL2Demo.Jobs
private DbBlindscanJob jobInDb; private DbBlindscanJob jobInDb;
private IDbBlindscanJobStorage jobStorage; private IDbBlindscanJobStorage jobStorage;
public Blindscan(List<TunerMetadata> tuners, List<SatellitePosition> satellitePositions, List<LnbType> lnbTypes, DataStorage dataStorage) public Blindscan(List<TunerMetadata> tuners, List<SatellitePositionEntity> satellitePositions, List<LnbEntity> lnbTypes, DataStorage dataStorage)
{ {
this.jobStorage = dataStorage; this.jobStorage = dataStorage;
continuationDataExists = jobStorage.TestForIncompleteJob(); continuationDataExists = jobStorage.TestForIncompleteJob();
@ -98,8 +98,8 @@ namespace SDL2Demo.Jobs
int numSatsFromDiseqcType = tunerMetadata.GetNumSatsFromDiseqcType(); int numSatsFromDiseqcType = tunerMetadata.GetNumSatsFromDiseqcType();
for (int i = 0; i < numSatsFromDiseqcType; i++) for (int i = 0; i < numSatsFromDiseqcType; i++)
{ {
SatellitePosition satellitePosition = satellitePositions.Find(x => x.Checksum == tunerMetadata.Satellites[i]); SatellitePositionEntity satellitePosition = satellitePositions.Find(x => x.Checksum == tunerMetadata.Satellites[i]);
LnbType lnbType = lnbTypes.Find(x => x.Id == tunerMetadata.Lnbs[i]); LnbEntity lnbType = lnbTypes.Find(x => x.Id == tunerMetadata.Lnbs[i]);
if (satellitePosition == null) if (satellitePosition == null)
continue; continue;
if (lnbType == null) if (lnbType == null)
@ -835,7 +835,7 @@ namespace SDL2Demo.Jobs
now.Year, now.Month, now.Day, now.Hour, now.Minute, blindscanResult.sr1.Freq / 1000, now.Year, now.Month, now.Day, now.Hour, now.Minute, blindscanResult.sr1.Freq / 1000,
blindscanResult.sr1.Pol == 0 ? "H" : "V", blindscanResult.sr1.SR / 1000, blindscanResult.sr1.Pol == 0 ? "H" : "V", blindscanResult.sr1.SR / 1000,
(int)(SelectedBlindscanTarget.satPosition.angle * 10), (int)(SelectedBlindscanTarget.satPosition.angle * 10),
SelectedBlindscanTarget.satPosition.cardinalDirection == 0 ? "E" : "W"); SelectedBlindscanTarget.satPosition.GetCardinalDirectionAsChar());
break; break;
case STD_TYPE.STD_DVBC: case STD_TYPE.STD_DVBC:
JobContext.Puppets[1].AutoMoveTo(blindscanResult.Position); JobContext.Puppets[1].AutoMoveTo(blindscanResult.Position);

View File

@ -31,10 +31,10 @@ namespace SDL2Demo.Jobs
private IDbBlindscanJobStorage jobStorage; private IDbBlindscanJobStorage jobStorage;
private List<TunerMetadata> tunerMetadataList; private List<TunerMetadata> tunerMetadataList;
private JobContext jobContext; private JobContext jobContext;
private List<SatellitePosition> satellites; private List<SatellitePositionEntity> satellites;
private List<LnbType> lnbs; private List<LnbEntity> lnbs;
public CoopBlindscan(List<TunerMetadata> tuners, List<SatellitePosition> satellitePositions, List<LnbType> lnbTypes, IDbBlindscanJobStorage jobStorage) public CoopBlindscan(List<TunerMetadata> tuners, List<SatellitePositionEntity> satellitePositions, List<LnbEntity> lnbTypes, IDbBlindscanJobStorage jobStorage)
{ {
this.jobStorage = jobStorage; this.jobStorage = jobStorage;
this.tunerMetadataList = tuners.Where(x => x.Type == STD_TYPE.STD_DVBS || x.Type == STD_TYPE.STD_DVBS2).ToList(); this.tunerMetadataList = tuners.Where(x => x.Type == STD_TYPE.STD_DVBS || x.Type == STD_TYPE.STD_DVBS2).ToList();
@ -166,8 +166,8 @@ namespace SDL2Demo.Jobs
{ {
settingsWindowOpen = false; settingsWindowOpen = false;
int lnbIndex = tunerMetadataList[settingsWindowTunerAselection].Lnbs[settingsWindowDiseqc - 1]; int lnbIndex = tunerMetadataList[settingsWindowTunerAselection].Lnbs[settingsWindowDiseqc - 1];
LnbType lnb = lnbs.Find(x => x.Id == lnbIndex); LnbEntity lnb = lnbs.Find(x => x.Id == lnbIndex);
Configuration = new CoopBlindscanConfiguration(tunerMetadataList[settingsWindowTunerAselection], tunerMetadataList[settingsWindowTunerBselection], settingsWindowScanHorizontalLow, settingsWindowScanHorizontalHigh, settingsWindowScanVerticalLow, settingsWindowScanVerticalHigh, settingsWindowDiseqc, settingsWindowSatellite, SatellitePosition.FromChecksum(satellites[settingsWindowSatellite].Checksum), lnb, settingsWindowCaptureFile); Configuration = new CoopBlindscanConfiguration(tunerMetadataList[settingsWindowTunerAselection], tunerMetadataList[settingsWindowTunerBselection], settingsWindowScanHorizontalLow, settingsWindowScanHorizontalHigh, settingsWindowScanVerticalLow, settingsWindowScanVerticalHigh, settingsWindowDiseqc, settingsWindowSatellite, SatellitePositionEntity.FromChecksum(satellites[settingsWindowSatellite].Checksum), lnb, settingsWindowCaptureFile);
} }
ImGui.SameLine(); ImGui.SameLine();
@ -185,7 +185,7 @@ namespace SDL2Demo.Jobs
public class CoopBlindscanConfiguration public class CoopBlindscanConfiguration
{ {
public CoopBlindscanConfiguration(TunerMetadata tunerA, TunerMetadata tunerB, bool doHorizontalLow, bool doHorizontalHigh, bool doVerticalLow, bool doVerticalHigh, int diseqc, int satelliteId, SatellitePosition direction, LnbType lnbType, bool recordingEnabled) public CoopBlindscanConfiguration(TunerMetadata tunerA, TunerMetadata tunerB, bool doHorizontalLow, bool doHorizontalHigh, bool doVerticalLow, bool doVerticalHigh, int diseqc, int satelliteId, SatellitePositionEntity direction, LnbEntity lnbType, bool recordingEnabled)
{ {
TunerA = tunerA; TunerA = tunerA;
TunerB = tunerB; TunerB = tunerB;
@ -208,8 +208,8 @@ namespace SDL2Demo.Jobs
public bool DoVerticalHigh { get; } public bool DoVerticalHigh { get; }
public int Diseqc { get; } public int Diseqc { get; }
public int SatelliteId { get; } public int SatelliteId { get; }
public SatellitePosition Direction { get; } public SatellitePositionEntity Direction { get; }
public LnbType LnbType { get; } public LnbEntity LnbType { get; }
public bool RecordingEnabled { get; } public bool RecordingEnabled { get; }
} }
#endregion #endregion
@ -689,7 +689,7 @@ namespace SDL2Demo.Jobs
now.Year, now.Month, now.Day, now.Hour, now.Minute, blindscanResult.sr1.Freq / 1000, now.Year, now.Month, now.Day, now.Hour, now.Minute, blindscanResult.sr1.Freq / 1000,
blindscanResult.sr1.Pol == 0 ? "H" : "V", blindscanResult.sr1.SR / 1000, blindscanResult.sr1.Pol == 0 ? "H" : "V", blindscanResult.sr1.SR / 1000,
(int)(Configuration.Direction.angle * 10), (int)(Configuration.Direction.angle * 10),
Configuration.Direction.cardinalDirection == 0 ? "E" : "W"); Configuration.Direction.GetCardinalDirectionAsChar());
RunSkyscraper(blindscanResult); RunSkyscraper(blindscanResult);

View File

@ -13,9 +13,9 @@ namespace SDL2Demo.Jobs
{ {
private bool windowOpen; private bool windowOpen;
private List<TunerMetadata> tuners; private List<TunerMetadata> tuners;
private List<SatellitePosition> satellites; private List<SatellitePositionEntity> satellites;
private List<LnbType> lnbs; private List<LnbEntity> lnbs;
private List<DishType> dishes; private List<DishEntity> dishes;
private readonly TaskQueue _taskQueue; private readonly TaskQueue _taskQueue;
public int settingsWindowBLScanTunerSelection; public int settingsWindowBLScanTunerSelection;
@ -52,7 +52,7 @@ namespace SDL2Demo.Jobs
settingsWindowScanVerticalLow, settingsWindowScanVerticalHigh); settingsWindowScanVerticalLow, settingsWindowScanVerticalHigh);
} }
public InheritedBlindscanConfigWindow(List<TunerMetadata> tunerMetadatas, public InheritedBlindscanConfigWindow(List<TunerMetadata> tunerMetadatas,
List<SatellitePosition> satellitePositions, List<LnbType> lnbTypes, List<DishType> dishTypes, List<SatellitePositionEntity> satellitePositions, List<LnbEntity> lnbTypes, List<DishEntity> dishTypes,
DataStorage dataStorage, ObjectStorage objectStorage, IGpsReceiver gps, Ini ini, IStreamReader streamReader, DataStorage dataStorage, ObjectStorage objectStorage, IGpsReceiver gps, Ini ini, IStreamReader streamReader,
TaskQueue taskQueue) TaskQueue taskQueue)
{ {

View File

@ -1657,7 +1657,7 @@ namespace SDL2Demo.Jobs
return position; return position;
} }
public void OnBlindscanBeforeSetChannel(BlindscanSearchResult blindscanResult, LnbType lnb) public void OnBlindscanBeforeSetChannel(BlindscanSearchResult blindscanResult, LnbEntity lnb)
{ {
Point point = GetFrequencyPosition(blindscanResult.SearchResult, lnb.MinimumFrequency, lnb.MaximumFrequency); Point point = GetFrequencyPosition(blindscanResult.SearchResult, lnb.MinimumFrequency, lnb.MaximumFrequency);
jobContext.Puppets[2 + blindscanResult.SearchResult.Pol].AutoMoveTo(point); jobContext.Puppets[2 + blindscanResult.SearchResult.Pol].AutoMoveTo(point);

View File

@ -211,9 +211,9 @@ namespace SkyscraperUI
private ConfigureDataStorageWindow configureDataStorageWindow; private ConfigureDataStorageWindow configureDataStorageWindow;
private ConfigureObjectStorageWindow configureObjectStorageWindow; private ConfigureObjectStorageWindow configureObjectStorageWindow;
private SatellitesConfigurationWindow satellitesConfigurationWindow; private SatellitesConfigurationWindow satellitesConfigurationWindow;
private List<SatellitePosition> satellitePositions; private List<SatellitePositionEntity> satellitePositions;
private List<LnbType> lnbTypes; private List<LnbEntity> lnbTypes;
private List<DishType> dishTypes; private List<DishEntity> dishTypes;
//private LogWindow logWindow; //private LogWindow logWindow;
private ScrapeFromTcp scrapeFromTcpWindow; private ScrapeFromTcp scrapeFromTcpWindow;
private JobContext jobContext; private JobContext jobContext;

View File

@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using skyscraper5.Docsis; using skyscraper5.Docsis;
@ -998,7 +1000,7 @@ public class DocsisTests : Feyllure
9, 0, 4, 0, 0, 0, 1, 9, 0, 4, 0, 0, 0, 1,
10, 0, 1, 1, 10, 0, 1, 1,
23, 0, 5 + 5 + 5, //length für den SA descriptor 23, 0, 5 + 5 + 5, //length f<EFBFBD>E den SA descriptor
//Hier fängt der SA descriptor an //Hier fängt der SA descriptor an
12, 0, 2, 0, 1, 12, 0, 2, 0, 1,
@ -1058,10 +1060,10 @@ public class DocsisTests : Feyllure
{ {
5, 5,
1, 1,
0, 7, //Länge für darauffolgendes 0, 7, //Länge f<EFBFBD>E darauffolgendes
23, 23,
0, 4, //Länge für darauffolgendes 0, 4, //Länge f<EFBFBD>E darauffolgendes
8, 0, 1, 1 8, 0, 1, 1
}; };
AssertTargetInvocation<NotImplementedException>(() => docsisEnvironment.PushMacManagementMessage(null, 1, 13, srcAddr, dstAddr, payload)); AssertTargetInvocation<NotImplementedException>(() => docsisEnvironment.PushMacManagementMessage(null, 1, 13, srcAddr, dstAddr, payload));
@ -1070,13 +1072,13 @@ public class DocsisTests : Feyllure
{ {
8, //Code 8, //Code
1, //Identifier 1, //Identifier
0, 4 + 7 + 5 + 1 + 2 + 4 + 7 + 4 + 4, //Length für alles darauf folgende 0, 4 + 7 + 5 + 1 + 2 + 4 + 7 + 4 + 4, //Length f<EFBFBD>E alles darauf folgende
10, 0, 1, 1, 10, 0, 1, 1,
11, 0, 4, 0, 0, 0, 1, 11, 0, 4, 0, 0, 0, 1,
12, 0, 2, 0, 1, 12, 0, 2, 0, 1,
13, //TEK parameters 13, //TEK parameters
0, 4 + 7 + 4 + 4, //Length für alles darauf folgende 0, 4 + 7 + 4 + 4, //Length f<EFBFBD>E alles darauf folgende
8, 0, 1, 1, 8, 0, 1, 1,
9, 0, 4, 0, 0, 0, 1, 9, 0, 4, 0, 0, 0, 1,
10, 0, 1, 1, 10, 0, 1, 1,
@ -1211,5 +1213,106 @@ public class DocsisTests : Feyllure
Assert.AreEqual(ucd, dequeue); Assert.AreEqual(ucd, dequeue);
nullDocsisEventHandler = new NullDocsisEventHandler();
MacDomainDescriptor.DownstreamActiveChannel dac = new MacDomainDescriptor.DownstreamActiveChannel(new byte[] {} );
nullDocsisEventHandler.OnDownstreamChannel(dstAddr, dac);
dequeue = nullDocsisEventHandler.GetQueue().Dequeue();
Assert.AreEqual(dac, dequeue);
nullDocsisEventHandler.OnLearnedIpFromMac(PhysicalAddress.None, IPAddress.None);
ReadOnlyDictionary<PhysicalAddress, IPAddress> readOnlyDictionary = nullDocsisEventHandler.GetKnownIps();
Assert.AreEqual(IPAddress.None, readOnlyDictionary[PhysicalAddress.None]);
}
[TestMethod]
public void MacDomainDescriptorTest()
{
Random rng = new Random();
byte[] srcAddrBuffer = new byte[6];
byte[] dstAddrBuffer = new byte[6];
rng.NextBytes(srcAddrBuffer);
rng.NextBytes(dstAddrBuffer);
PhysicalAddress srcAddr = new PhysicalAddress(srcAddrBuffer);
PhysicalAddress dstAddr = new PhysicalAddress(dstAddrBuffer);
byte[] testBuffer = new byte[]
{
1,1,1,1, //Header
1,0, //Downstream Active Channel
2,0, //Downstream Service Group
3,4,0,0,0,0, //DownstreamAmbiguityResolutionFrequencyList
4,0, //ReceiveChannelProfileReportingControlObject
5,0, //IpInitalizationParameters
6,1,1, //EarlyAuthentication
7,0, //ActiveUpstreamChannelList
8,1,1, //UpstreamChannelIds
9,1,1, //UpstreamFrequencyRange
10,1,1, //SymbolClockLocking
11,0, //EventControlEncoding
12,1,1, //UpstreamTransmitPowerReporting
15,2,255,255, //SequenceOutOfRange
16,1,1, //ExtendedUpstreamTransmitPowerSupport
17,0, //CmtsDocsisVersion
18,1,1, //CmPeriodicMaintenanceTimeout
20,4,0,0,255,255, //DownstreamOfdmProfileFailure
};
MacDomainDescriptor mmd = new MacDomainDescriptor(srcAddr,dstAddr,testBuffer);
Assert.AreEqual(1, mmd.ConfigurationChangeCount);
Assert.AreEqual(1, mmd.NumberOfFragments);
Assert.AreEqual(1, mmd.FragmentSequenceNumber);
Assert.AreEqual(1, mmd.CurrentChannelDcid);
Assert.IsNotNull(mmd.DownstreamServiceGroup);
Assert.HasCount(1, mmd.DownstreamAmbiguityResolutionFrequencyList);
Assert.IsNotNull(mmd.ReceiveChannelProfileReportingControl);
Assert.IsNotNull(mmd.IpInitalizationParameters);
Assert.AreEqual(1, mmd.EarlyAuthentication.Value);
Assert.HasCount(1, mmd.ActiveUpstreamChannelList);
Assert.AreEqual(1, mmd.UpstreamChannelIds[0]);
Assert.AreEqual(1, mmd.UpstreamFrequencyRange.Value);
Assert.IsTrue(mmd.SymbolClockLocking);
Assert.HasCount(1, mmd.EventControlEncoding);
Assert.AreEqual(1, mmd.UpstreamTransmitPowerReporting.Value);
Assert.IsTrue(mmd.SequenceOutOfRange);
Assert.IsTrue(mmd.CmOperatingOnBatteryBackup);
Assert.IsTrue(mmd.CmReturnedToAcPower);
Assert.IsTrue(mmd.CmMacAddressRemoval);
Assert.AreEqual(1, mmd.ExtendedUpstreamTransmitPowerSupport.Value);
Assert.IsNotNull(mmd.CmtsDocsisVersion);
Assert.AreEqual(MacDomainDescriptor.CmPeriodicMaintenanceTimeoutEnum.UseProbe, mmd.CmPeriodicMaintenanceTimeout.Value);
Assert.IsTrue(mmd.DownstreamOfdmProfileFailure);
Assert.IsTrue(mmd.PrimaryDownstreamChannelChange);
Assert.IsTrue(mmd.DpdMismatch);
Assert.IsTrue(mmd.NcpProfileFailure);
Assert.IsTrue(mmd.PlcFailure);
Assert.IsTrue(mmd.NcpProfileRecovery);
Assert.IsTrue(mmd.PlcRecovery);
Assert.IsTrue(mmd.OfdmProfileRecovery);
Assert.IsTrue(mmd.OfdmaProfileFailure);
Assert.IsTrue(mmd.MapStorageOverflowIndicator);
Assert.IsTrue(mmd.MapStorageAlmostFullIndicator);
byte[] expTestBuffer = new byte[]
{
1, 1, 1, 1, //Header
254, 0 //Invalid
};
Assert.Throws<NotImplementedException>(() => new MacDomainDescriptor(srcAddr,dstAddr,expTestBuffer));
byte[] cdvoBuffer = new byte[]
{
1, 1, 1,
2, 1, 1
};
MacDomainDescriptor.CmtsDocsisVersionObject cdvo = new MacDomainDescriptor.CmtsDocsisVersionObject(cdvoBuffer);
Assert.AreEqual(1, cdvo.MajorVersion.Value);
Assert.AreEqual(1, cdvo.MinorVersion.Value);
cdvoBuffer = new byte[]
{
254, 0,
};
Assert.Throws<NotImplementedException>(() => new MacDomainDescriptor.CmtsDocsisVersionObject(cdvoBuffer));
} }
} }

View File

@ -40,17 +40,17 @@
&lt;Assembly Path="/home/schiemas/.nuget/packages/allure.net.commons/2.14.1/lib/netstandard2.0/Allure.Net.Commons.dll" /&gt; &lt;Assembly Path="/home/schiemas/.nuget/packages/allure.net.commons/2.14.1/lib/netstandard2.0/Allure.Net.Commons.dll" /&gt;
&lt;/AssemblyExplorer&gt;</s:String> &lt;/AssemblyExplorer&gt;</s:String>
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">/home/schiemas/.cache/JetBrains/Rider2025.1/resharper-host/temp/Rider/vAny/CoverageData/_skyscraper8.1808907683/Snapshot/snapshot.utdcvr</s:String> <s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">/home/schiemas/.cache/JetBrains/Rider2025.1/resharper-host/temp/Rider/vAny/CoverageData/_skyscraper8.1808907683/Snapshot/snapshot.utdcvr</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=145b05c0_002D83b0_002D4386_002Db9fb_002De55ec3152557/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="All tests from &amp;lt;skyscraper8.Tests&amp;gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD; <s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=145b05c0_002D83b0_002D4386_002Db9fb_002De55ec3152557/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="All tests from &amp;lt;skyscraper8.Tests&amp;gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;And&gt;&#xD; &lt;And&gt;
&lt;Namespace&gt;skyscraper8.Tests&lt;/Namespace&gt;&#xD; &lt;Namespace&gt;skyscraper8.Tests&lt;/Namespace&gt;
&lt;Project Location="\home\schiemas\RiderProjects\skyscraper8\skyscraper8.Tests" Presentation="&amp;lt;skyscraper8.Tests&amp;gt;" /&gt;&#xD; &lt;Project Location="\home\schiemas\RiderProjects\skyscraper8\skyscraper8.Tests" Presentation="&amp;lt;skyscraper8.Tests&amp;gt;" /&gt;
&lt;/And&gt;&#xD; &lt;/And&gt;
&lt;/SessionState&gt;</s:String> &lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=58c56b00_002Df81e_002D48fd_002Da74f_002Dc8e84271fcf4/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Continuous Testing" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD; <s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=58c56b00_002Df81e_002D48fd_002Da74f_002Dc8e84271fcf4/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="Continuous Testing" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Project Location="\home\schiemas\RiderProjects\skyscraper8\skyscraper8.Tests" Presentation="&amp;lt;skyscraper8.Tests&amp;gt;" /&gt;&#xD; &lt;Project Location="\home\schiemas\RiderProjects\skyscraper8\skyscraper8.Tests" Presentation="&amp;lt;skyscraper8.Tests&amp;gt;" /&gt;
&lt;/SessionState&gt;</s:String> &lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=ce70f33b_002D9024_002D4750_002Da24e_002D78f4e8e5e879/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="All tests from &amp;lt;skyscraper8.Tests&amp;gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD; <s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=ce70f33b_002D9024_002D4750_002Da24e_002D78f4e8e5e879/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &amp;lt;skyscraper8.Tests&amp;gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Project Location="\home\schiemas\RiderProjects\skyscraper8\skyscraper8.Tests" Presentation="&amp;lt;skyscraper8.Tests&amp;gt;" /&gt;&#xD; &lt;Solution /&gt;
&lt;/SessionState&gt;</s:String> &lt;/SessionState&gt;</s:String>
@ -61,4 +61,7 @@
<s:String x:Key="/Default/Profiling/Configurations/=1/@EntryIndexedValue">&lt;data&gt;&lt;HostParameters type="LocalHostParameters" /&gt;&lt;Argument type="StandaloneArgument"&gt;&lt;Arguments IsNull="False"&gt;&lt;/Arguments&gt;&lt;FileName IsNull="False"&gt;&lt;/FileName&gt;&lt;WorkingDirectory IsNull="False"&gt;&lt;/WorkingDirectory&gt;&lt;Scope&gt;&lt;ProcessFilters /&gt;&lt;/Scope&gt;&lt;/Argument&gt;&lt;Info type="TimelineInfo" /&gt;&lt;CoreOptions type="CoreOptions"&gt;&lt;CoreTempPath IsNull="False"&gt;&lt;/CoreTempPath&gt;&lt;RemoteEndPoint IsNull="False"&gt;&lt;/RemoteEndPoint&gt;&lt;AdditionalEnvironmentVariables /&gt;&lt;/CoreOptions&gt;&lt;HostOptions type="HostOptions"&gt;&lt;HostTempPath IsNull="False"&gt;&lt;/HostTempPath&gt;&lt;/HostOptions&gt;&lt;/data&gt;</s:String> <s:String x:Key="/Default/Profiling/Configurations/=1/@EntryIndexedValue">&lt;data&gt;&lt;HostParameters type="LocalHostParameters" /&gt;&lt;Argument type="StandaloneArgument"&gt;&lt;Arguments IsNull="False"&gt;&lt;/Arguments&gt;&lt;FileName IsNull="False"&gt;&lt;/FileName&gt;&lt;WorkingDirectory IsNull="False"&gt;&lt;/WorkingDirectory&gt;&lt;Scope&gt;&lt;ProcessFilters /&gt;&lt;/Scope&gt;&lt;/Argument&gt;&lt;Info type="TimelineInfo" /&gt;&lt;CoreOptions type="CoreOptions"&gt;&lt;CoreTempPath IsNull="False"&gt;&lt;/CoreTempPath&gt;&lt;RemoteEndPoint IsNull="False"&gt;&lt;/RemoteEndPoint&gt;&lt;AdditionalEnvironmentVariables /&gt;&lt;/CoreOptions&gt;&lt;HostOptions type="HostOptions"&gt;&lt;HostTempPath IsNull="False"&gt;&lt;/HostTempPath&gt;&lt;/HostOptions&gt;&lt;/data&gt;</s:String>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=skyscraper8_002ETests_002FResources1/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=skyscraper8_002ETests_002FResources1/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/Initialized/@EntryValue">True</s:Boolean> <s:Boolean x:Key="/Default/ResxEditorPersonal/Initialized/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/ShowOnlyErrors/@EntryValue">False</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/ResxEditorPersonal/ShowOnlyErrors/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/UnloadedProject/UnloadedProjects/=46caca1c_002Df9b2_002D2fe0_002D2068_002D716f381325e9_0023skyscraper5_002EUI_002EWindowsForms/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UnloadedProject/UnloadedProjects/=ebb6b1cf_002D2597_002D4962_002Daa31_002D2b42b4c28c7d_0023skyscraper8_002EAnagramViewer/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>

View File

@ -1,3 +1,5 @@
using System.Collections.Frozen;
using System.Collections.ObjectModel;
using System.Net; using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using skyscraper5.Docsis.AnnexC; using skyscraper5.Docsis.AnnexC;
@ -82,4 +84,9 @@ public class NullDocsisEventHandler : IDocsisEventHandler
{ {
return timing.Value; return timing.Value;
} }
public ReadOnlyDictionary<PhysicalAddress, IPAddress> GetKnownIps()
{
return knownIps.AsReadOnly();
}
} }

View File

@ -31,7 +31,7 @@ namespace skyscraper5
public ObjectStorage ObjectStorage { get; set; } public ObjectStorage ObjectStorage { get; set; }
private IStreamReader streamReader; private IStreamReader streamReader;
private List<TunerMetadata> tuners; private List<TunerMetadata> tuners;
private List<SatellitePosition> satellitePositions; private List<SatellitePositionEntity> satellitePositions;
private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name); private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name);
public Passing() public Passing()

View File

@ -88,7 +88,7 @@ namespace skyscraper5
logger.DebugFormat("I'm a {0}-bit Process.", Environment.Is64BitProcess ? 64 : 32); logger.DebugFormat("I'm a {0}-bit Process.", Environment.Is64BitProcess ? 64 : 32);
PluginManager.GetInstance(); PluginManager.GetInstance();
SoftcamKeyset.GetInstance().InitializeFromFile(); SoftcamKeyset.GetInstance().AutoInitalize();
if (args.Length != 0) if (args.Length != 0)
{ {

View File

@ -1,11 +1,20 @@
using System; using System;
using System.Xml.Serialization;
namespace skyscraper5.Skyscraper.Equipment namespace skyscraper5.Skyscraper.Equipment
{ {
public class BaseEquipment public class BaseEquipment
{ {
[XmlIgnore]
public int Id { get; set; } public int Id { get; set; }
[XmlAttribute]
public string Manufacturer { get; set; }
[XmlAttribute]
public string Name { get; set; } public string Name { get; set; }
[XmlIgnore]
public DateTime DateAdded { get; set; } public DateTime DateAdded { get; set; }
} }
} }

View File

@ -1,25 +1,29 @@
using System; using System;
using System.Xml.Serialization;
namespace skyscraper5.Skyscraper.Equipment namespace skyscraper5.Skyscraper.Equipment
{ {
public class DishType : BaseEquipment public class DishEntity : BaseEquipment
{ {
public DishType(string name, int diameter, DishShape shape) public DishEntity(string manufac, string name, int diameter, DishShape shape)
{ {
this.Manufacturer = manufac;
this.Name = name; this.Name = name;
this.Diameter = diameter; this.Diameter = diameter;
this.Shape = shape; this.Shape = shape;
} }
public DishType() public DishEntity()
{ {
} }
[XmlAttribute]
public int Diameter { get; set; } public int Diameter { get; set; }
[XmlAttribute]
public DishShape Shape { get; set; } public DishShape Shape { get; set; }
protected bool Equals(DishType other) protected bool Equals(DishEntity other)
{ {
return Diameter == other.Diameter && Shape == other.Shape; return Diameter == other.Diameter && Shape == other.Shape;
} }
@ -29,7 +33,7 @@ namespace skyscraper5.Skyscraper.Equipment
if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true; if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false; if (obj.GetType() != this.GetType()) return false;
return Equals((DishType)obj); return Equals((DishEntity)obj);
} }
public override int GetHashCode() public override int GetHashCode()
@ -48,7 +52,6 @@ namespace skyscraper5.Skyscraper.Equipment
Offset, Offset,
PrimeFocus, PrimeFocus,
Mesh, Mesh,
Mobisat, Other
Selfsat
} }
} }

View File

@ -0,0 +1,20 @@
namespace skyscraper5.Skyscraper.Equipment;
public class EquipmentCollection
{
public EquipmentCollection()
{
Dishes = new List<DishEntity>();
LNBs = new List<LnbEntity>();
SatellitePositions = new List<SatellitePositionEntity>();
}
public List<DishEntity> Dishes { get; set; }
public List<LnbEntity> LNBs { get; set; }
public List<SatellitePositionEntity> SatellitePositions { get; set; }
public override string ToString()
{
return String.Format("{0} dishes, {1} LNBs, {2} satellite positions", Dishes.Count, LNBs.Count, SatellitePositions.Count);
}
}

View File

@ -9,45 +9,47 @@ namespace skyscraper5.Skyscraper.Equipment
{ {
public static void InsertDefaultLnbTypes(DataStorage storage) public static void InsertDefaultLnbTypes(DataStorage storage)
{ {
List<LnbType> knownLnbTypes = storage.UiLnbTypesListAll(); List<LnbEntity> knownLnbTypes = storage.UiLnbTypesListAll();
foreach (LnbType defaultLnbType in GetDefaultLnbTypes()) foreach (LnbEntity defaultLnbType in GetDefaultLnbTypes())
{ {
if (!knownLnbTypes.Contains(defaultLnbType)) if (!knownLnbTypes.Contains(defaultLnbType))
storage.UiLnbTypesAdd(defaultLnbType); storage.UiLnbTypesAdd(defaultLnbType);
} }
} }
private static IEnumerable<LnbType> GetDefaultLnbTypes() private static IEnumerable<LnbEntity> GetDefaultLnbTypes()
{ {
LnbType lnbType = new LnbType(); LnbEntity lnbType = new LnbEntity();
lnbType.Lof1 = 9750; lnbType.Lof1 = 9750;
lnbType.Lof2 = 10600; lnbType.Lof2 = 10600;
lnbType.LofSw = 11700; lnbType.LofSw = 11700;
lnbType.MinimumFrequency = 10700; lnbType.MinimumFrequency = 10700;
lnbType.MaximumFrequency = 12750; lnbType.MaximumFrequency = 12750;
lnbType.Name = "Generic Universal LNB"; lnbType.Manufacturer = "Generic";
lnbType.Name = "Universal LNB";
yield return lnbType; yield return lnbType;
} }
public static void InsertDefaultDishTypes(DataStorage storage) public static void InsertDefaultDishTypes(DataStorage storage)
{ {
List<DishType> knownDishTypes = storage.UiDishTypesListAll(); List<DishEntity> knownDishTypes = storage.UiDishTypesListAll();
foreach (DishType defaultDishType in GetDefaultDishTypes()) foreach (DishEntity defaultDishType in GetDefaultDishTypes())
{ {
if (!knownDishTypes.Contains(defaultDishType)) if (!knownDishTypes.Contains(defaultDishType))
storage.UiDishTypesAdd(defaultDishType); storage.UiDishTypesAdd(defaultDishType);
} }
} }
private static IEnumerable<DishType> GetDefaultDishTypes() private static IEnumerable<DishEntity> GetDefaultDishTypes()
{ {
int[] commonSizes = new int[] { 60, 80, 85, 100 }; int[] commonSizes = new int[] { 60, 80, 85, 100 };
foreach (int commonSize in commonSizes) foreach (int commonSize in commonSizes)
{ {
DishType dishType = new DishType(); DishEntity dishType = new DishEntity();
dishType.Diameter = commonSize; dishType.Diameter = commonSize;
dishType.Shape = DishShape.Offset; dishType.Shape = DishShape.Offset;
dishType.Name = String.Format("Generic {0} cm Offset dish antenna", commonSize); dishType.Manufacturer = "Generic";
dishType.Name = String.Format("{0} cm Offset dish antenna", commonSize);
yield return dishType; yield return dishType;
} }
} }

View File

@ -1,13 +1,15 @@
using System; using System;
using System.Xml.Serialization;
namespace skyscraper5.Skyscraper.Equipment namespace skyscraper5.Skyscraper.Equipment
{ {
public class LnbType : BaseEquipment public class LnbEntity : BaseEquipment
{ {
public LnbType() { } public LnbEntity() { }
public LnbType(string name, int lof1, int lof2, int lofSw, int minFreq, int maxFreq) public LnbEntity(string manufac, string name, int lof1, int lof2, int lofSw, int minFreq, int maxFreq)
{ {
this.Manufacturer = manufac;
this.Name = name; this.Name = name;
this.Lof1 = lof1; this.Lof1 = lof1;
this.Lof2 = lof2; this.Lof2 = lof2;
@ -16,14 +18,22 @@ namespace skyscraper5.Skyscraper.Equipment
this.MaximumFrequency = maxFreq; this.MaximumFrequency = maxFreq;
} }
[XmlAttribute]
public int Lof1 { get; set; } public int Lof1 { get; set; }
[XmlAttribute]
public int Lof2 { get; set; } public int Lof2 { get; set; }
[XmlAttribute]
public int LofSw { get; set; } public int LofSw { get; set; }
[XmlAttribute]
public int MinimumFrequency { get; set; } public int MinimumFrequency { get; set; }
[XmlAttribute]
public int MaximumFrequency { get; set; } public int MaximumFrequency { get; set; }
protected bool Equals(LnbType other) protected bool Equals(LnbEntity other)
{ {
return Lof1 == other.Lof1 && Lof2 == other.Lof2 && LofSw == other.LofSw && MinimumFrequency == other.MinimumFrequency && MaximumFrequency == other.MaximumFrequency; return Lof1 == other.Lof1 && Lof2 == other.Lof2 && LofSw == other.LofSw && MinimumFrequency == other.MinimumFrequency && MaximumFrequency == other.MaximumFrequency;
} }
@ -33,7 +43,7 @@ namespace skyscraper5.Skyscraper.Equipment
if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true; if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false; if (obj.GetType() != this.GetType()) return false;
return Equals((LnbType)obj); return Equals((LnbEntity)obj);
} }
public override int GetHashCode() public override int GetHashCode()
@ -43,7 +53,7 @@ namespace skyscraper5.Skyscraper.Equipment
public override string ToString() public override string ToString()
{ {
return Name; return String.Format("{0} {1}", Manufacturer, Name);
} }
} }
} }

View File

@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper5.Skyscraper
{
public class SatellitePositionEntity
{
public SatellitePositionEntity()
{
}
public SatellitePositionEntity(float angle, string name)
{
this.angle = angle;
this.name = name;
}
public float angle;
public string name;
public int Checksum => GetChecksum(angle);
public static int GetChecksum(float angle)
{
int result = (int)(angle * 10.0f);
return result;
}
public override string ToString()
{
if (angle > 0)
{
return String.Format("{0}°E {1}", angle, name);
}
else
{
float tmpAngle = angle;
tmpAngle *= -1;
return String.Format("{0}°W {1}", tmpAngle, name);
}
}
public static SatellitePositionEntity FromChecksum(int checksum)
{
float newAngle = checksum;
newAngle /= 10.0f;
return new SatellitePositionEntity(newAngle, "???");
}
protected bool Equals(SatellitePositionEntity other)
{
return angle.Equals(other.angle);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((SatellitePositionEntity)obj);
}
public override int GetHashCode()
{
return HashCode.Combine(angle);
}
/// <summary>
/// Returns an integer value for the cardinal direction.
/// </summary>
/// <returns>Returns 0 for east, 1 for west, 2 if satellite is at 0.0</returns>
public int GetCardinalDirectionAsInt()
{
if (angle > 0)
return 0;
else if (angle < 0)
return 1;
else
return 2;
}
/// <summary>
/// Get the letter matching the cardinal direction of the satellite.
/// </summary>
/// <returns>Returns either 'E' or 'W' depending on the angle.</returns>
public char GetCardinalDirectionAsChar()
{
int cardinalDirectionAsInt = GetCardinalDirectionAsInt();
return cardinalDirectionAsInt == 0 ? 'E' : 'W';
}
/// <summary>
/// Get a filename-safe number of the angle. Meaning the angle stripped of its sign and decimal separator.
/// </summary>
/// <returns>For example: For 19.2°E, this will return 192, For 34.5°W, this will return 345</returns>
public int GetCleanAngle()
{
int cleanAngle = (int)(angle * 10.0f);
if (cleanAngle < 0)
cleanAngle /= -1;
return cleanAngle;
}
}
}

View File

@ -707,12 +707,21 @@ namespace skyscraper8.Skyscraper.FrequencyListGenerator
if (tsRecorder.PrepareRecording()) if (tsRecorder.PrepareRecording())
{ {
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
int cardinalDirection = 0;
int angle = config.SatellitePosition.Checksum;
if (angle < 0)
{
angle *= -1;
cardinalDirection = 1;
}
string recordingFilename = string.Format( string recordingFilename = string.Format(
"skyscraper_{0:D4}{1:D2}{2:D2}_{3:D2}{4:D2}_{8:D4}{9}_{5}_{6}_{7}.ts", "skyscraper_{0:D4}{1:D2}{2:D2}_{3:D2}{4:D2}_{8:D4}{9}_{5}_{6}_{7}.ts",
now.Year, now.Month, now.Day, now.Hour, now.Minute, result.GetFrequency() / 1000, now.Year, now.Month, now.Day, now.Hour, now.Minute, result.GetFrequency() / 1000,
result.GetPolarity(config.LnbType.LofSw), result.GetSymbolRate() / 1000, result.GetPolarity(config.LnbType.LofSw), result.GetSymbolRate() / 1000,
(int)(config.SatellitePosition.angle * 10), config.SatellitePosition.GetCleanAngle(),
config.SatellitePosition.cardinalDirection == 0 ? "E" : "W"); config.SatellitePosition.GetCardinalDirectionAsChar());
tsRecorder.SetNextFilename(recordingFilename); tsRecorder.SetNextFilename(recordingFilename);
tsRecorder.CreateBufferedStream(); tsRecorder.CreateBufferedStream();
} }

View File

@ -18,7 +18,7 @@ namespace skyscraper8.Skyscraper.FrequencyListGenerator
public TunerMetadata TunerMetadata { get; set; } public TunerMetadata TunerMetadata { get; set; }
public int DiseqcIndex { get; set; } public int DiseqcIndex { get; set; }
public IGpsReceiver Gps { get; set; } public IGpsReceiver Gps { get; set; }
public SatellitePosition SatellitePosition { get; set; } public SatellitePositionEntity SatellitePosition { get; set; }
public bool DoHorizontalHigh { get; set; } public bool DoHorizontalHigh { get; set; }
public bool DoHorizontalLow { get; set; } public bool DoHorizontalLow { get; set; }
@ -29,7 +29,7 @@ namespace skyscraper8.Skyscraper.FrequencyListGenerator
public ObjectStorage ObjectStorage { get; set; } public ObjectStorage ObjectStorage { get; set; }
public ISkyscraperUiJunction Ui { get; set; } public ISkyscraperUiJunction Ui { get; set; }
public bool DoCollectRfSpectrum { get; set; } public bool DoCollectRfSpectrum { get; set; }
public LnbType LnbType { get; set; } public LnbEntity LnbType { get; set; }
public bool DoCollectIqGraphs { get; set; } public bool DoCollectIqGraphs { get; set; }
public bool DoRecordTs { get; set; } public bool DoRecordTs { get; set; }
public Ini Ini { get; set; } public Ini Ini { get; set; }

View File

@ -15,7 +15,7 @@ namespace skyscraper5.src.Skyscraper.FrequencyListGenerator
public class DbBlindscanJob public class DbBlindscanJob
{ {
public DbBlindscanJob(Guid jobGuid, PhysicalAddress tunerMac, STD_TYPE tunerStandard, int diseqCIndex, public DbBlindscanJob(Guid jobGuid, PhysicalAddress tunerMac, STD_TYPE tunerStandard, int diseqCIndex,
IGpsReceiver jobContextGps, SatellitePosition satellitePosition) IGpsReceiver jobContextGps, SatellitePositionEntity satellitePosition)
{ {
this.JobGuid = jobGuid; this.JobGuid = jobGuid;
this.TunerMAC = tunerMac; this.TunerMAC = tunerMac;
@ -37,7 +37,7 @@ namespace skyscraper5.src.Skyscraper.FrequencyListGenerator
} }
public SatellitePosition SatPosition { get; private set; } public SatellitePositionEntity SatPosition { get; private set; }
public GpsCoordinate? GpsCoordinate { get; private set; } public GpsCoordinate? GpsCoordinate { get; private set; }
@ -69,7 +69,7 @@ namespace skyscraper5.src.Skyscraper.FrequencyListGenerator
{ {
case 1: case 1:
if (SatPosition != null) if (SatPosition != null)
return String.Format("{0:0.0}° {1}", SatPosition.angle, SatPosition.cardinalDirection == 0 ? "E" : "W"); return String.Format("{0:0.0}° {1}", SatPosition.angle, SatPosition.GetCardinalDirectionAsChar());
return TunerStandard.ToString(); return TunerStandard.ToString();
case 2: case 2:
return String.Format("({0}/{1}/{2}/{3})", (int)HorizontalLowState, (int)HorizontalHighState, (int)VerticalLowState, (int)VerticalHighState); return String.Format("({0}/{1}/{2}/{3})", (int)HorizontalLowState, (int)HorizontalHighState, (int)VerticalLowState, (int)VerticalHighState);

View File

@ -88,7 +88,7 @@ namespace skyscraper5.Skyscraper.Scraper
/// Called before a SetChannel operation is performed. /// Called before a SetChannel operation is performed.
/// </summary> /// </summary>
/// <param name="blindscanResult"></param> /// <param name="blindscanResult"></param>
void OnBlindscanBeforeSetChannel(BlindscanSearchResult blindscanResult, LnbType lnbType); void OnBlindscanBeforeSetChannel(BlindscanSearchResult blindscanResult, LnbEntity lnbType);
/// <summary> /// <summary>
/// Called after a band (meaning e.g. Horizontal High) has been scraped. /// Called after a band (meaning e.g. Horizontal High) has been scraped.

View File

@ -86,9 +86,9 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
void T2MiSetTimestamp(int currentNetworkId, int currentTransportStreamId, int pid, DateTime resolveTime); void T2MiSetTimestamp(int currentNetworkId, int currentTransportStreamId, int pid, DateTime resolveTime);
bool TestForRelatedContent(EitEvent lEvent, RctLinkInfo rctLinkInfo); bool TestForRelatedContent(EitEvent lEvent, RctLinkInfo rctLinkInfo);
void SetRelatedContent(EitEvent lEvent, RctLinkInfo rctLinkInfo); void SetRelatedContent(EitEvent lEvent, RctLinkInfo rctLinkInfo);
List<SatellitePosition> UiSatellitesListAll(); List<SatellitePositionEntity> UiSatellitesListAll();
void UiSatellitesAdd(SatellitePosition newPosition); void UiSatellitesAdd(SatellitePositionEntity newPosition);
void UiSatellitesDelete(SatellitePosition satellitePosition); void UiSatellitesDelete(SatellitePositionEntity satellitePosition);
bool UiTunerTestFor(TunerMetadata tuner); bool UiTunerTestFor(TunerMetadata tuner);
void UiTunerUpdate(TunerMetadata tuner); void UiTunerUpdate(TunerMetadata tuner);
void UiTunerInsert(TunerMetadata tuner); void UiTunerInsert(TunerMetadata tuner);
@ -108,10 +108,10 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
bool T2MiTestForTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier); bool T2MiTestForTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier);
void T2MiRememberTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier); void T2MiRememberTransmitter(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier);
void T2MiSetTransmitterTimeOffset(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier, ushort timeOffset); void T2MiSetTransmitterTimeOffset(int? currentNetworkId, int? currentTransportStreamId, int relatedPid, ushort txIdentifier, ushort timeOffset);
List<LnbType> UiLnbTypesListAll(); List<LnbEntity> UiLnbTypesListAll();
void UiLnbTypesAdd(LnbType defaultLnbType); void UiLnbTypesAdd(LnbEntity defaultLnbType);
List<DishType> UiDishTypesListAll(); List<DishEntity> UiDishTypesListAll();
void UiDishTypesAdd(DishType defaultDishType); void UiDishTypesAdd(DishEntity defaultDishType);
IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt(); IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt();
SdtService SelectSdtById(int networkId, int tsId, ushort programMappingProgramNumber); SdtService SelectSdtById(int networkId, int tsId, ushort programMappingProgramNumber);

View File

@ -818,30 +818,30 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
} }
} }
public List<SatellitePosition> UiSatellitesListAll() public List<SatellitePositionEntity> UiSatellitesListAll()
{ {
string path = Path.Combine(rootDirectory.FullName, "satellites.json"); string path = Path.Combine(rootDirectory.FullName, "satellites.json");
FileInfo fi = new FileInfo(path); FileInfo fi = new FileInfo(path);
if (!fi.Exists) if (!fi.Exists)
return new List<SatellitePosition>(); return new List<SatellitePositionEntity>();
else else
{ {
return JsonConvert.DeserializeObject<List<SatellitePosition>>(File.ReadAllText(fi.FullName)); return JsonConvert.DeserializeObject<List<SatellitePositionEntity>>(File.ReadAllText(fi.FullName));
} }
} }
public void UiSatellitesAdd(SatellitePosition newPosition) public void UiSatellitesAdd(SatellitePositionEntity newPosition)
{ {
string path = Path.Combine(rootDirectory.FullName, "satellites.json"); string path = Path.Combine(rootDirectory.FullName, "satellites.json");
FileInfo fi = new FileInfo(path); FileInfo fi = new FileInfo(path);
List<SatellitePosition> satellites; List<SatellitePositionEntity> satellites;
if (!fi.Exists) if (!fi.Exists)
{ {
satellites = new List<SatellitePosition>(); satellites = new List<SatellitePositionEntity>();
} }
else else
{ {
satellites = JsonConvert.DeserializeObject<List<SatellitePosition>>(File.ReadAllText(fi.FullName)); satellites = JsonConvert.DeserializeObject<List<SatellitePositionEntity>>(File.ReadAllText(fi.FullName));
} }
satellites.Add(newPosition); satellites.Add(newPosition);
@ -849,11 +849,11 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
File.WriteAllText(fi.FullName, JsonConvert.SerializeObject(satellites, Formatting.Indented)); File.WriteAllText(fi.FullName, JsonConvert.SerializeObject(satellites, Formatting.Indented));
} }
public void UiSatellitesDelete(SatellitePosition satellitePosition) public void UiSatellitesDelete(SatellitePositionEntity satellitePosition)
{ {
string path = Path.Combine(rootDirectory.FullName, "satellites.json"); string path = Path.Combine(rootDirectory.FullName, "satellites.json");
FileInfo fi = new FileInfo(path); FileInfo fi = new FileInfo(path);
List<SatellitePosition> satellites = JsonConvert.DeserializeObject<List<SatellitePosition>>(File.ReadAllText(fi.FullName)); List<SatellitePositionEntity> satellites = JsonConvert.DeserializeObject<List<SatellitePositionEntity>>(File.ReadAllText(fi.FullName));
satellites.RemoveAll(x => x.Checksum == satellitePosition.Checksum); satellites.RemoveAll(x => x.Checksum == satellitePosition.Checksum);
@ -964,16 +964,16 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
File.WriteAllText(path, timeOffset.ToString()); File.WriteAllText(path, timeOffset.ToString());
} }
public List<LnbType> UiLnbTypesListAll() public List<LnbEntity> UiLnbTypesListAll()
{ {
string path = Path.Combine(rootDirectory.FullName, "0-UI", "LnbTypes"); string path = Path.Combine(rootDirectory.FullName, "0-UI", "LnbTypes");
DirectoryInfo di = new DirectoryInfo(path); DirectoryInfo di = new DirectoryInfo(path);
if (!di.Exists) if (!di.Exists)
{ {
return new List<LnbType>(); return new List<LnbEntity>();
} }
List<LnbType> result = new List<LnbType>(); List<LnbEntity> result = new List<LnbEntity>();
FileInfo[] fileInfos = di.GetFiles("*.json"); FileInfo[] fileInfos = di.GetFiles("*.json");
foreach (FileInfo fileInfo in fileInfos) foreach (FileInfo fileInfo in fileInfos)
{ {
@ -983,7 +983,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
int iid = int.Parse(fid); int iid = int.Parse(fid);
string json = File.ReadAllText(fileInfo.FullName); string json = File.ReadAllText(fileInfo.FullName);
LnbType deserializeObject = JsonConvert.DeserializeObject<LnbType>(json); LnbEntity deserializeObject = JsonConvert.DeserializeObject<LnbEntity>(json);
if (deserializeObject.Id != iid) if (deserializeObject.Id != iid)
continue; continue;
if (result.Contains(deserializeObject)) if (result.Contains(deserializeObject))
@ -1017,7 +1017,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
return result; return result;
} }
public void UiLnbTypesAdd(LnbType defaultLnbType) public void UiLnbTypesAdd(LnbEntity defaultLnbType)
{ {
string path = Path.Combine(rootDirectory.FullName, "0-UI", "LnbTypes"); string path = Path.Combine(rootDirectory.FullName, "0-UI", "LnbTypes");
DirectoryInfo di = new DirectoryInfo(path); DirectoryInfo di = new DirectoryInfo(path);
@ -1030,16 +1030,16 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
File.WriteAllText(path, json); File.WriteAllText(path, json);
} }
public List<DishType> UiDishTypesListAll() public List<DishEntity> UiDishTypesListAll()
{ {
string path = Path.Combine(rootDirectory.FullName, "0-UI", "DishTypes"); string path = Path.Combine(rootDirectory.FullName, "0-UI", "DishTypes");
DirectoryInfo di = new DirectoryInfo(path); DirectoryInfo di = new DirectoryInfo(path);
if (!di.Exists) if (!di.Exists)
{ {
return new List<DishType>(); return new List<DishEntity>();
} }
List<DishType> result = new List<DishType>(); List<DishEntity> result = new List<DishEntity>();
FileInfo[] fileInfos = di.GetFiles("*.json"); FileInfo[] fileInfos = di.GetFiles("*.json");
foreach (FileInfo fileInfo in fileInfos) foreach (FileInfo fileInfo in fileInfos)
{ {
@ -1049,7 +1049,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
int iid = int.Parse(fid); int iid = int.Parse(fid);
string json = File.ReadAllText(fileInfo.FullName); string json = File.ReadAllText(fileInfo.FullName);
DishType deserializeObject = JsonConvert.DeserializeObject<DishType>(json); DishEntity deserializeObject = JsonConvert.DeserializeObject<DishEntity>(json);
if (deserializeObject.Id != iid) if (deserializeObject.Id != iid)
continue; continue;
if (result.Contains(deserializeObject)) if (result.Contains(deserializeObject))
@ -1060,7 +1060,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
return result; return result;
} }
public void UiDishTypesAdd(DishType defaultDishType) public void UiDishTypesAdd(DishEntity defaultDishType)
{ {
string path = Path.Combine(rootDirectory.FullName, "0-UI", "DishTypes"); string path = Path.Combine(rootDirectory.FullName, "0-UI", "DishTypes");
DirectoryInfo di = new DirectoryInfo(path); DirectoryInfo di = new DirectoryInfo(path);

View File

@ -771,23 +771,23 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
throw new NotImplementedException(); throw new NotImplementedException();
} }
private List<SatellitePosition> satellitePositions; private List<SatellitePositionEntity> satellitePositions;
public List<SatellitePosition> UiSatellitesListAll() public List<SatellitePositionEntity> UiSatellitesListAll()
{ {
if (satellitePositions == null) if (satellitePositions == null)
satellitePositions = new List<SatellitePosition>(); satellitePositions = new List<SatellitePositionEntity>();
return satellitePositions.ToList(); return satellitePositions.ToList();
} }
public void UiSatellitesAdd(SatellitePosition newPosition) public void UiSatellitesAdd(SatellitePositionEntity newPosition)
{ {
if (satellitePositions == null) if (satellitePositions == null)
satellitePositions = new List<SatellitePosition>(); satellitePositions = new List<SatellitePositionEntity>();
satellitePositions.Add(newPosition); satellitePositions.Add(newPosition);
} }
public void UiSatellitesDelete(SatellitePosition satellitePosition) public void UiSatellitesDelete(SatellitePositionEntity satellitePosition)
{ {
satellitePositions.RemoveAll(x => x.Checksum == satellitePosition.Checksum); satellitePositions.RemoveAll(x => x.Checksum == satellitePosition.Checksum);
} }
@ -905,37 +905,37 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
t2miTransmitters[t2miTransmitterId].TimeOffset = timeOffset; t2miTransmitters[t2miTransmitterId].TimeOffset = timeOffset;
} }
private List<LnbType> _lnbTypes; private List<LnbEntity> _lnbTypes;
public List<LnbType> UiLnbTypesListAll() public List<LnbEntity> UiLnbTypesListAll()
{ {
if (_lnbTypes == null) if (_lnbTypes == null)
_lnbTypes = new List<LnbType>(); _lnbTypes = new List<LnbEntity>();
return _lnbTypes; return _lnbTypes;
} }
public void UiLnbTypesAdd(LnbType defaultLnbType) public void UiLnbTypesAdd(LnbEntity defaultLnbType)
{ {
if (_lnbTypes == null) if (_lnbTypes == null)
_lnbTypes = new List<LnbType>(); _lnbTypes = new List<LnbEntity>();
if (!_lnbTypes.Contains(defaultLnbType)) if (!_lnbTypes.Contains(defaultLnbType))
_lnbTypes.Add(defaultLnbType); _lnbTypes.Add(defaultLnbType);
} }
private List<DishType> _dishTypes; private List<DishEntity> _dishTypes;
public List<DishType> UiDishTypesListAll() public List<DishEntity> UiDishTypesListAll()
{ {
if (_dishTypes == null) if (_dishTypes == null)
_dishTypes = new List<DishType>(); _dishTypes = new List<DishEntity>();
return _dishTypes; return _dishTypes;
} }
public void UiDishTypesAdd(DishType defaultDishType) public void UiDishTypesAdd(DishEntity defaultDishType)
{ {
if (_dishTypes == null) if (_dishTypes == null)
_dishTypes = new List<DishType>(); _dishTypes = new List<DishEntity>();
if (!_dishTypes.Contains(defaultDishType)) if (!_dishTypes.Contains(defaultDishType))
_dishTypes.Add(defaultDishType); _dishTypes.Add(defaultDishType);
} }

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using skyscraper5.Skyscraper; using skyscraper5.Skyscraper;
using skyscraper5.Skyscraper.Plugins;
namespace skyscraper8.Skyscraper.Security.AccessControl namespace skyscraper8.Skyscraper.Security.AccessControl
{ {
@ -21,45 +22,24 @@ namespace skyscraper8.Skyscraper.Security.AccessControl
return _singleton; return _singleton;
} }
private FileInfo TryFindSoftcamKey() public bool AutoInitalize()
{ {
foreach (FileInfo fi in GetPossibleLocations()) PluginManager pluginManager = PluginManager.GetInstance();
{ Ini ini = pluginManager.Ini;
if (fi.Exists) bool softcamEnabled = ini.ReadValue("softcam", "enable", false);
{ if (!softcamEnabled)
return fi; return false;
}
}
return null; string softcamKeyPath = ini.ReadValue("softcam", "path", FILE_NAME);
FileInfo softcamKeyFileInfo = new FileInfo(softcamKeyPath);
if (!softcamKeyFileInfo.Exists)
return false;
int result = LoadSoftcamKey(softcamKeyFileInfo);
return result > 0;
} }
private const string FILE_NAME = "SoftCam.Key"; private const string FILE_NAME = "SoftCam.Key";
private IEnumerable<FileInfo> GetPossibleLocations()
{
FileInfo self = new FileInfo(FILE_NAME);
yield return self;
string assemblyLocation = this.GetType().Assembly.Location;
FileInfo assemblyLocationFileInfo = new FileInfo(assemblyLocation);
DirectoryInfo assemblyLocationDirectory = assemblyLocationFileInfo.Directory;
string assemblyLocationKeyfileName = Path.Combine(assemblyLocationDirectory.FullName, FILE_NAME);
yield return new FileInfo(assemblyLocationKeyfileName);
DirectoryInfo rootDirectory = self.Directory.Root;
DirectoryInfo selfDirectory = self.Directory;
do
{
selfDirectory = selfDirectory.Parent;
if (selfDirectory == null)
break;
string possibleName = Path.Combine(selfDirectory.FullName, FILE_NAME);
yield return new FileInfo(possibleName);
} while (!selfDirectory.Equals(rootDirectory));
yield return new FileInfo("C:\\FT\\SoftCam_Emu\\SoftCam.Key");
}
private int LoadSoftcamKey(FileInfo fi) private int LoadSoftcamKey(FileInfo fi)
{ {
int result = 0; int result = 0;
@ -181,24 +161,6 @@ namespace skyscraper8.Skyscraper.Security.AccessControl
return result; return result;
} }
private bool doneFileInitalization;
public void InitializeFromFile()
{
if (doneFileInitalization)
{
throw new AccessControlException("Softcam.key Keyset already initalized.");
}
doneFileInitalization = true;
FileInfo keyLocation = TryFindSoftcamKey();
if (keyLocation != null)
{
logger.InfoFormat("Loading keys from: {0}", keyLocation.FullName);
int numKeysLoaded = LoadSoftcamKey(keyLocation);
logger.InfoFormat("I suppose you are legally entitled to use those {0} keys I just loaded, You are, right?",numKeysLoaded);
}
}
private List<ViaccessKey> _viaccessKeys; private List<ViaccessKey> _viaccessKeys;
public IReadOnlyList<ViaccessKey> ViaccessKeys => _viaccessKeys; public IReadOnlyList<ViaccessKey> ViaccessKeys => _viaccessKeys;

View File

@ -14,7 +14,7 @@ namespace skyscraper8.Skyscraper.Security.AccessControl
public void Run() public void Run()
{ {
SoftcamKeyset softcamKeyset = SoftcamKeyset.GetInstance(); SoftcamKeyset softcamKeyset = SoftcamKeyset.GetInstance();
softcamKeyset.InitializeFromFile(); softcamKeyset.AutoInitalize();
byte[] bissKey = softcamKeyset.FindBissKey(2, 85); byte[] bissKey = softcamKeyset.FindBissKey(2, 85);
BissDescrambleFilter descrambler = new BissDescrambleFilter(bissKey); BissDescrambleFilter descrambler = new BissDescrambleFilter(bissKey);