Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Administrator
Alter Hase
Beruf: Softwareentwickler (aktuell Web/Node); Freiberuflicher Google Proxy
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C#-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
// Von Klasse Fixture public XElement ToSaveData() { return new XElement(TypeName, new XAttribute("PresetName", PresetName), new XAttribute("FixtureName", FixtureName), new XAttribute("StartAddress", StartAddress), new XAttribute("Universe", Universe), new XAttribute("Hue", RGBValue.ToHexColorString(Hue)), new XElement("Functions", Functions.Select(f => f.ToSaveData()))); } // Von Klasse "Function" public XElement ToSaveData() { return new XElement(TypeName, new XAttribute("FunctionName", FunctionName), new XAttribute("Hue", RGBValue.ToHexColorString(Hue)), new XAttribute("IsFreezed", IsFreezed), new XAttribute("IsEnabled", IsEnabled), new XElement("Input", Input.ToSaveData()), new XElement("Value", Value.ToSaveData())); } |
C#-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
public Fixture(XElement SaveData) { Functions = new List<IFunction>(); Hue = RGBValue.FromHexColorString(SaveData.Attribute("Hue").Value); FixtureName = SaveData.Attribute("FixtureName").Value; PresetName = SaveData.Attribute("PresetName").Value; Universe = Convert.ToByte(SaveData.Attribute("Universe").Value); StartAddress = Convert.ToUInt16(SaveData.Attribute("StartAddress").Value); // Funktionen aus Preset und Save laden var FunctionsPresetData = Presets.LoadPreset(PresetName).Element("Functions").Elements(); var FunctionsSaveData = SaveData.Element("Functions").Elements(); foreach (var DataPair in FunctionsPresetData.Zip(FunctionsSaveData, (fpd, fsd) => new KeyValuePair<XElement, XElement>(fpd, fsd))) Functions.Add(GenericBuilder.CreateFunction(this, DataPair.Key, DataPair.Value)); foreach (var f in Functions) f.PropertyChanged += Function_PropertyChanged; } public Function(Fixture Owner, XElement PresetData, XElement SaveData) { Hue = RGBValue.FromHexColorString(SaveData.Attribute("Hue").Value); FunctionName = PresetData.Attribute("FunctionName").Value; this.Owner = Owner; IsFreezed = Convert.ToBoolean(SaveData.Attribute("IsFreezed").Value); IsEnabled = Convert.ToBoolean(SaveData.Attribute("IsEnabled").Value); Value = (T)GenericBuilder.CreateValue(SaveData.Element("Value").GetFirstElement()); // Eingang erzeugen Input = new InputPin<T>(this, SaveData.Element("Input").GetFirstElement()); Input.ValueChanged += Input_ValueChanged; // Kanäle aus Preset laden Channels = new List<Channel>(); foreach (var ChannelPresetData in PresetData.Element("Channels").Elements()) Channels.Add(new Channel(ChannelPresetData) { StartAddress = Owner.StartAddress, Universe = Owner.Universe }); } |
Lass solche persönlichen Angriffe lieber bleiben, meine sind härter.
... und diese Signatur kürzer!
- übersichtlicher
- logischer
- verständlicher
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Werbeanzeige