/// <summary> /// Convert StringsStreamData to RVClient.StreamDataV1 /// </summary> /// <returns>Converted struct</returns> /// <remarks>This method uses Int32.Parse() which may throw an exception in case /// string port value conversion to int failes.</remarks> public RVClient.StreamDataV1 Convert() { RVClient.StreamDataV1 converted = new RVClient.StreamDataV1() { port = Int32.Parse(this.port), streamName = this.streamName, proxiedName = this.proxiedName, }; return converted; }
/// <summary> /// Initializes the settings file with default data /// </summary> /// <param name="stream">Settings file opened stream</param> /// <remarks>This method is used as WinAppStock initializer</remarks> private void InitializeSettingsFile(FileStream stream) { SettingsTab.ConnectionSettingsStruct connectionData = new SettingsTab.ConnectionSettingsStruct() { host = "127.0.0.1", port = 27960, period = 5, username = "******", password = "******" }; RVClient.StreamDataV1[] streamData = new RVClient.StreamDataV1[1]; streamData[0].streamName = "my_local_stream_name"; streamData[0].port = 554; streamData[0].proxiedName = "my_stream_name"; SerializedSettings settings = new SerializedSettings(); settings.connectionData = connectionData; settings.streamData = streamData; XmlSerializer serializer = new XmlSerializer(typeof(SerializedSettings)); serializer.Serialize(stream, settings); }