// Кнопка вызова пульта private void button12_Click(object sender, EventArgs e) { //RemoteController RC = new RemoteController(); //RC.ShowDialog(); LoadDB(); // Get AVDevices from avDeviceDB AVDevice[] AVDevices = avDeviceDB.AVDevices; //Get full name and remove point from name string nameFolderAVDeviceDB = ReverseStringAndDelete(DeletePointFromString(avDeviceDBName)); if (!Directory.Exists(pathClick + "\\" + nameFolderAVDeviceDB)) { Directory.CreateDirectory(pathClick + "\\" + nameFolderAVDeviceDB); } Messages("Создана папка " + nameFolderAVDeviceDB); // It is displaying created folders AddFoldersWithFileFromEnterPath(pathClick); foreach (AVDevice item in AVDevices) { signals += "________" + item.Name + Environment.NewLine; if (!Directory.Exists(pathClick + "\\" + nameFolderAVDeviceDB + "\\" + item.Name)) { Directory.CreateDirectory(pathClick + "\\" + nameFolderAVDeviceDB + "\\" + item.Name); //MessageBox.Show(pathClick + "\\" + nameFolderAVDeviceDB); } else { Messages("Такая папка существует."); } IRPacket[] Signals = item.Signals; foreach (IRPacket element in Signals) { //MessageBox.Show(pathClick + "\\" + nameFolderAVDeviceDB + "\\" + item.Name + "\\" + element.Name + ".xml"); RRUtil.SerializePacketToXML(pathClick + "\\" + nameFolderAVDeviceDB + "\\" + item.Name + "\\" + element.Name + ".xml", element); signals += "-" + element.Name + Environment.NewLine; } } MessageBox.Show(signals); }
// Захват сигнала public void CaptureSignal(string fileName = "") { OpenFileDialog OFD = new OpenFileDialog(); OFD.InitialDirectory = Form1.pathClick; SearchRedRat SRR = new SearchRedRat(); if (SRR.FindRedRat() != null) { RedRat3 = SRR.FindRedRat(); RedRat3.LearningSignalIn += SignalDataHandler; RedRat3.GetModulatedSignal(10000);//Ввод сигнала в RedRat3 осуществляется в течении 10с haveSignal = false; while (!haveSignal) { Thread.Sleep(100); } if (modSignal != null) { var mes = MessageBox.Show("OK - cохранить XML" + Environment.NewLine + "CANCEL - cохранить BIN", "Вариант сохранения файла", MessageBoxButtons.OKCancel); if (mes == DialogResult.OK) { inputName IN = new inputName(); IN.ShowDialog(); RRUtil.SerializePacketToXML(Form1.pathClick + "\\" + IN.name + ".xml", modSignal); tempMessage = "XML файл \"" + IN.name + "\" сохранен."; } else { inputName IN = new inputName(); IN.ShowDialog(); RRUtil.SerializePacketToBinary(Form1.pathClick + "\\" + IN.name + ".bin", modSignal);//SerializePacketToXML //var m = MessageBox.Show("Файл \"" + IN.name + "\" сохранен.", "Прием сигнала", MessageBoxButtons.OK); tempMessage = "BIN файл \"" + IN.name + "\" сохранен."; } } else { MessageBox.Show("Сигнал не был получен. Прием окончен.", "Прием сигнала", MessageBoxButtons.OK); } } }