private void DiffusionTrack_ValueChanged(object sender, decimal value) { Configer conf = new Configer(DiffusionTrack.Value, null, null); if (EffectsEvent != null) { EffectsEventArgs args = new EffectsEventArgs(conf); EffectsEvent(this, args); } }
public MediaPlayer(Form parent, Configer conf) { _parent = parent; _memoryStream = null; _sound = null; _conf = conf; _dev = new Device(); _dev.SetCooperativeLevel(_parent, CooperativeLevel.Normal); setBufferDesc(); }
private void MQConfig_Load(object sender, EventArgs e) { tbxHostName.Text = Configer.GetSettingsValue("HostName"); tbxPort.Text = Configer.GetSettingsValue("Port"); tbxCCSID.Text = Configer.GetSettingsValue("MQCCSID"); tbxChannel.Text = Configer.GetSettingsValue("Channel"); tbxUserId.Text = Configer.GetSettingsValue("UserId"); tbxQmgrName.Text = Configer.GetSettingsValue("QmgrName"); tbxQueueName.Text = Configer.GetSettingsValue("QueueName"); }
private void button2_Click(object sender, EventArgs e) { Configer.SetSettingsValue("HostName", this.tbxHostName.Text); Configer.SetSettingsValue("Port", this.tbxPort.Text); Configer.SetSettingsValue("MQCCSID", this.tbxCCSID.Text); Configer.SetSettingsValue("Channel", this.tbxChannel.Text); Configer.SetSettingsValue("UserId", this.tbxUserId.Text); Configer.SetSettingsValue("QmgrName", this.tbxQmgrName.Text); Configer.SetSettingsValue("QueueName", this.tbxQueueName.Text); }
private void SpeedTrack_ValueChanged(object sender, decimal value) { Configer conf = new Configer(null, 44100 + SpeedTrack.Value * 400, null); if (EffectsEvent != null) { EffectsEventArgs args = new EffectsEventArgs(conf); EffectsEvent(this, args); } }
private void VolumeTrack_ValueChanged(object sender, decimal value) { Configer conf = new Configer(null, null, (VolumeTrack.Value - 100) * 20); if (EffectsEvent != null) { EffectsEventArgs args = new EffectsEventArgs(conf); EffectsEvent(this, args); } }
private void DistorsnTrack_ValueChanged(object sender, decimal value) { Configer conf = new Configer(null, null, null); if (EffectsEvent != null) { conf.SoundEffects[AudioEffects.Distortion] = DistorsnTrack.Value; EffectsEventArgs args = new EffectsEventArgs(conf); EffectsEvent(this, args); } }
private void ReverbTrack_ValueChanged(object sender, decimal value) { Configer conf = new Configer(null, null, null); if (EffectsEvent != null) { conf.SoundEffects[AudioEffects.WavesReverb] = ReverbTrack.Value; EffectsEventArgs args = new EffectsEventArgs(conf); EffectsEvent(this, args); } }
private void ReverseCheckBox_CheckedChanged(object sender, EventArgs e) { Configer conf = new Configer(null, null, null); if (EffectsEvent != null) { conf.Reverse = ReverseCheckBox.Checked; EffectsEventArgs args = new EffectsEventArgs(conf); EffectsEvent(this, args); } }
// GET: api/messages public List <Msg> Get() { List <Msg> messages; if (MessagesList.Messages.Count != 0) { messages = MessagesList.Messages; } else { messages = Configer.ReadPool(); } return(MessagesList.Messages); }
private static void DownloadWhiteList() { try { var url = new Configer().WhiteListServer; WebClient client = new WebClient(); var listData = client.DownloadData(url); WhiteList.Write(listData); } catch (Exception ex) { Console.WriteLine("download whitelist failed:" + ex.Message); } }
public SamplesForm(Profile profile) { InitializeComponent(); _profile = profile; ProfileComboBox.Items.AddRange(Configer.GetProfiles()); if (!string.IsNullOrEmpty(_profile.Name)) { ProfileComboBox.SelectedIndex = ProfileComboBox.Items.IndexOf(_profile.Name); } WidthSmall = MainSplitContainer.Width + 6; initSoundEditor(); fillCharBox(); this.Width = WidthSmall; }
override public void Init(Profile profile, Form parent) { base.Init(profile, parent); InitializeComponent(); Degree1 = Math.PI / 180; timer1.Interval = _defaultTimerInterval; _initVinil = (Bitmap)VinilLabel.Image; // Vinil image must be fully docked in Label! _radius = VinilLabel.Width / 2; _radius2 = _radius * _radius; _center = new Point(VinilLabel.Width / 2, VinilLabel.Height / 2); _centerPortSize2 = _centerPortSize * _centerPortSize; _lastLocation = new Point(-1, -1); _conf = new Configer(); initPlayers(); }
public Client GetClient(int Id) { int f = 0; f = GetIdClient(Id); Client Clients = new Client(); if (f != -1) { string[] transport = new string[5]; int Count = 0; var client = new RestClient(Rest + Id.ToString()); var request = new RestRequest(Method.GET); request.AddHeader("authorization", Configer.GetToken()); IRestResponse response = client.Execute(request); dynamic dynObj = JsonConvert.DeserializeObject(response.Content); dynamic d = dynObj.data; Clients.id = Id.ToString(); Clients.name = d.name; Clients.phone = d.phone; Clients.assigned_name = d.assigned_name; Clients.avatar = d.avatar; Clients.region_id = d.region_id; Clients.country_id = d.country_id; Clients.external_id = d.external_id; Clients.extra_comment_1 = d.extra_comment_1; Clients.extra_comment_2 = d.extra_comment_2; Clients.extra_comment_3 = d.extra_comment_3; dynamic transports = dynObj.data.channels; foreach (dynamic t in transports)//так как канал это "массив", прогоняем и его в цикле { transport[Count] = t.transports.ToString(); Count++; } Clients.transports = new string[Count];//выделяю память для объекта Client for (int i = 0; i < Count; i++) { Clients.transports[i] = transport[i];//записываю каналы связи } } return(Clients); }
public void AddAsync(Level level, string msg) { Task.Run(() => { int configLevel = Convert.ToInt32(Configer.Get("logLevel")); if ((int)level < configLevel) { return; } Log model = new Log(); model.Level = level.ToString(); model.Logger = "日志博客"; model.Message = msg; Add(model); }); }
public bool SetTokens(string ChatHelpDesk, string Gmail, string Host) { if (ChatHelpDesk != null && ChatHelpDesk != "" && Host != "") { string name = "ChHToken.json"; string path = HostingEnvironment.ApplicationPhysicalPath; try { Configer.SetToken(ChatHelpDesk); var client = new RestClient("https://api.chat2desk.com/v1/companies/web_hook"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", Configer.GetToken()); request.AddParameter("application/json", JsonConvert.SerializeObject(new { url = Host }), ParameterType.RequestBody); IRestResponse response = client.Execute(request); } catch (Exception ex) { string ModelError = ex.Message; } } if (Gmail != null && Gmail != "") { string name = "Google.Apis.Auth.OAuth2.Responses.TokenResponse-user"; string path = HostingEnvironment.ApplicationPhysicalPath; try { using (FileStream fstream = new FileStream(path + name, FileMode.Create)) { //string json = JsonConvert.SerializeObject(Gmail); // преобразуем строку в байты byte[] array = System.Text.Encoding.Default.GetBytes(Gmail); // запись массива байтов в файл fstream.Write(array, 0, array.Length); } } catch (Exception ex) { string ModelError = ex.Message; } } return(true); }
/// <summary> /// GetIdClient проверяет на существование клиента /// </summary> /// <param name="Id">Идентификатор клиента</param> /// <returns>Значение типа int. Если значение 1: Существует, -1: клиента с таким id нет.</returns> public int GetIdClient(int Id) { var client = new RestClient(Rest + Id.ToString()); var request = new RestRequest(Method.GET); request.AddHeader("authorization", Configer.GetToken()); IRestResponse response = client.Execute(request); if (response.ErrorException != null) { Console.WriteLine(" Исключение в методе GetIdClient(int Id) {0}", response.ErrorMessage); return(-1); } dynamic dynObj = JsonConvert.DeserializeObject(response.Content); if (dynObj == null) { return(-1); } return(1); }
// POST: api/Hook/value public async Task <dynamic> Post() { string result = await Request.Content.ReadAsStringAsync(); //dynamic dynMessageString = JsonConvert.DeserializeObject(result); if (result != null) { try { dynamic dynMessage = JsonConvert.DeserializeObject(result); Message msg = Messages.GetMessage(dynMessage.message_id.ToString()); Clients clients = new Clients(); Client client = clients.GetClient(Int32.Parse(msg.clientID)); Msg message = new Msg { text = msg.text, ID = msg.ID, Transport = msg.transport, type = msg.type, Name = client.name, Phone = client.phone, dialog = dynMessage.dialog_id, Date = msg.created, external_id = client.external_id, assigned_name = client.assigned_name }; MessagesList.Messages.Add(message); Configer.WritePool(MessagesList.Messages); Error = null; } catch (Exception ex) { Error = ex.Message; } } HookCount++; value = result; return(Ok()); }
private bool record(string name, string path) { try { RecordForm recf = new RecordForm(_profile, "./" + path + "/" + name + ".wav"); recf.ShowDialog(this); if (Configer.Tmp == "") { return(false); } //AudioModifier.RemoveSilence(Path.Combine(_profile.Name, path + "/" + name + ".wav")); Configer.LoadProfile(_profile, _profile.Name); SetCharBoxItemColor((CharListView.SelectedItems.Count > 0) ? CharListView.SelectedItems[0].Index : CharListView.Items.Count - 1, true); ButtonPlay.Enabled = true; ButtonRemove.Enabled = true; return(true); } catch (Exception ee) { MessageBox.Show("Failed to record sound", ee.Message); } return(false); }
public static List <Dialog> Get() { //возвращает лист диалогов List <Dialog> dialogs = new List <Dialog>(); var client = new RestClient(Rest); var request = new RestRequest(Method.GET); request.AddHeader("authorization", Configer.GetToken()); IRestResponse response = client.Execute(request); dynamic dynObj = JsonConvert.DeserializeObject(response.Content); if (dynObj == null || dynObj.status == "error") { Dialog dlg = new Dialog(); dlg.error = "Диалогов нет или произошла ошибка в запросе."; dialogs.Add(dlg); return(dialogs); } foreach (dynamic dialog in dynObj.data) { Dialog dlg = new Dialog(); dlg.ID = dialog.id; dlg.state = dialog.state; dlg.begin = DateTimeOffset.ParseExact(dialog.begin.ToString().Replace("UTC", "GMT"), "yyyy'-'MM'-'dd'T'HH':'mm':'ss GMT", null).UtcDateTime; if (dlg.end != null) { dlg.end = DateTimeOffset.ParseExact(dialog.end.ToString().Replace("UTC", "GMT"), "yyyy'-'MM'-'dd'T'HH':'mm':'ss GMT", null).UtcDateTime; } dialogs.Add(dlg); } return(dialogs); }
/// <summary> /// 保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void button2_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.tbMTOC.Text.Trim()) || string.IsNullOrEmpty(this.tbHardwareCode.Text.Trim()) || string.IsNullOrEmpty(this.tbsoftwareVersion.Text.Trim()) || string.IsNullOrEmpty(this.tbHW.Text.Trim()) || string.IsNullOrEmpty(this.tbElementCode.Text.Trim()) || string.IsNullOrEmpty(this.tbSW.Text.Trim()) || string.IsNullOrEmpty(this.tbDriver.Text.Trim()) || string.IsNullOrEmpty(this.tbWrite.Text.Trim()) || string.IsNullOrEmpty(this.tbCal.Text.Trim())) { MessageBox.Show("请填写全部信息", "提示"); return; } string localConnectionString = ConfigurationManager.ConnectionStrings["localCnnStr"] + ""; Configer Conbll = new Configer(localConnectionString); if (t_VCUConfig == null) { if (this.btDriver.Text != "已导入" || this.btWrite.Text != "已导入" || this.btCal.Text != "已导入") { MessageBox.Show("请导入文件", "提示"); return; } // VCUconfig item = new VCUconfig(); // item.MTOC = this.tbMTOC.Text.ToUpper(); // item.HardWareCode = this.tbHardwareCode.Text.ToUpper(); // item.HW = this.tbHW.Text; // item.SoftWareVersion = this.tbsoftwareVersion.Text; // item.SW = this.tbSW.Text; ; // item.ElementNum = this.tbElementCode.Text; // item.Sign = this.tbSign.Text; // item.DriverName = this.tbDriver.Text; // item.BinName = this.tbWrite.Text; // item.CalName = this.tbCal.Text; // item.DriverPath = System.Configuration.ConfigurationManager.AppSettings["driverPos"]; // //item.DriverPath = System.Configuration.ConfigurationSettings.AppSettings["driver"]; // item.BinPath = System.Configuration.ConfigurationManager.AppSettings["writePos"]; //// item.BinPath = System.Configuration.ConfigurationSettings.AppSettings["bin"]; // item.CalPath = System.Configuration.ConfigurationManager.AppSettings["calPos"]; //int isRep = Conbll.RepeatVCUconfig(item); // if (isRep > 0) // { // MessageBox.Show("已经拥有该车型的数据了,请重新命名", "提示"); // return; // } // else // { // Conbll.SaveVCUconfig(item); // MessageBox.Show("新增成功"); // } T_VCUConfig item = new T_VCUConfig(); item.mtoc = this.tbMTOC.Text.ToUpper(); item.hardwarecode = this.tbHardwareCode.Text.ToUpper(); item.HW = this.tbHW.Text; item.softwareversion = this.tbsoftwareVersion.Text; item.SW = this.tbSW.Text;; item.elementNum = this.tbElementCode.Text; item.sign = this.tbSign.Text; item.drivername = this.tbDriver.Text; item.binname = this.tbWrite.Text; item.calname = this.tbCal.Text; item.driverpath = System.Configuration.ConfigurationManager.AppSettings["driverPos"]; item.binpath = System.Configuration.ConfigurationManager.AppSettings["writePos"]; item.calpath = System.Configuration.ConfigurationManager.AppSettings["calPos"]; int tmpK = Comm.SqlComm.RepeatVCUconfig(item); if (tmpK > 0) { MessageBox.Show("已经拥有该车型的数据了,请重新命名", "提示"); return; } int tmpAddCount = await Comm.SqlComm.SaveVCUconfig(item); string msg = tmpAddCount > 0 ? "新增成功" : "新增失败"; MessageBox.Show(msg); } else { //VCUconfig item = new VCUconfig(); //item.Id = VCUItem.Id; //item.MTOC = this.tbMTOC.Text.ToUpper(); //item.HardWareCode = this.tbHardwareCode.Text.ToUpper(); //item.HW = this.tbHW.Text; //item.SoftWareVersion = this.tbsoftwareVersion.Text; //item.SW = this.tbSW.Text; ; //item.ElementNum = this.tbElementCode.Text; //item.Sign = this.tbSign.Text; //item.DriverName = this.tbDriver.Text; //item.BinName = this.tbWrite.Text; //item.CalName = this.tbCal.Text; //item.DriverPath = System.Configuration.ConfigurationManager.AppSettings["driverPos"]; ////item.DriverPath = System.Configuration.ConfigurationSettings.AppSettings["driver"]; //item.BinPath = System.Configuration.ConfigurationManager.AppSettings["writePos"]; //// item.BinPath = System.Configuration.ConfigurationSettings.AppSettings["bin"]; //item.CalPath = System.Configuration.ConfigurationManager.AppSettings["calPos"]; //Conbll.UpdateVCUconfig(item); //MessageBox.Show("修改成功"); t_VCUConfig.mtoc = this.tbMTOC.Text.ToUpper(); t_VCUConfig.hardwarecode = this.tbHardwareCode.Text.ToUpper(); t_VCUConfig.HW = this.tbHW.Text; t_VCUConfig.softwareversion = this.tbsoftwareVersion.Text; t_VCUConfig.SW = this.tbSW.Text;; t_VCUConfig.elementNum = this.tbElementCode.Text; t_VCUConfig.sign = this.tbSign.Text; t_VCUConfig.drivername = this.tbDriver.Text; t_VCUConfig.binname = this.tbWrite.Text; t_VCUConfig.calname = this.tbCal.Text; t_VCUConfig.driverpath = System.Configuration.ConfigurationManager.AppSettings["driverPos"]; t_VCUConfig.binpath = System.Configuration.ConfigurationManager.AppSettings["writePos"]; t_VCUConfig.calpath = System.Configuration.ConfigurationManager.AppSettings["calPos"]; int tmpK = await Comm.SqlComm.UpdateVCUconfig(t_VCUConfig); string msg = tmpK > 0 ? "修改成功" : "修改失败"; MessageBox.Show(msg); } this.Dispose(); this.Close(); } catch (Exception) { throw; } }
//为了保证日志不要太多,错误日志只保留前n条 public int Add(Log model) { string cmdText = "insert into Log values(?,?,?,?,?);select last_insert_rowid() newid;"; cmdText += $"DELETE FROM log where logid not in ( select LogId from Log order by date desc limit 0,{Configer.Get("logMaxCount")} )"; object[] paramList = { null, //对应的主键不要赋值了 model.Date, model.Level, model.Logger, model.Message }; object result = SQLiteHelper.ExecuteScalar(cmdText, paramList); int intResult; if (int.TryParse(result.ToString(), out intResult)) { return(intResult); } return(0); }
public FrmExport(string localConnectionString) { this.localConnectionString = localConnectionString; configer = new Configer(this.localConnectionString); InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) { string fileName = Configer.GetLocationText() + "数据展示"; exportData(fileName, this.dataGridView1, "采集器结果", false); }
/// <summary> /// Возвращает указанное сообщение /// </summary> /// <param name="messageId">id сообщения</param> /// <returns></returns> public static Message GetMessage(string messageId) { System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; //формировании url запроса string reqURL = url + "messages/" + messageId;// /v1/messages/<id сообщения>/ //отправка запроса на сервер var client = new RestClient(reqURL); var request = new RestRequest(Method.GET); request.AddHeader("authorization", Configer.GetToken()); IRestResponse response = client.Execute(request); dynamic dynObj = JsonConvert.DeserializeObject(response.Content);//парсим json if (dynObj.status == "success") { Message message = new Message { ID = dynObj.data.id, text = dynObj.data.text, type = dynObj.data.type, read = Boolean.Parse(dynObj.data.read.ToString()), created = DateTimeOffset.ParseExact(dynObj.data.created.ToString().Replace("UTC", "GMT"), "yyyy'-'MM'-'dd'T'HH':'mm':'ss GMT", null).UtcDateTime.AddHour(Configer.GetOffset()), clientID = dynObj.data.client_id, transport = dynObj.data.transport, }; return(message); } else { return(null); } }
private bool DataSender_EventDataSend(byte[] data) { return(Configer.SendData(data)); }
private bool txtCmd_DataSend(byte[] cmd) { return(Configer.SendData(cmd)); }
/// <summary> /// Возвращает список сообщений /// </summary> /// <param name="type">фильтр по типу</param> /// <param name="read">фильтр по прочитанным или непрочитанным</param> /// <param name="setRead">указывает необходимо ли пометить полученные сообщения как прочитанные</param> /// <returns></returns> public static MessagesResponse GetMessages(string type, bool?read, int?limit, bool setRead, string dialog_id, int offset = 0) { string reqURL = url + "messages"; //формирование URL строки с параметрами var uriBuilder = new UriBuilder(reqURL); var query = HttpUtility.ParseQueryString(uriBuilder.Query); if (type != null) { query["type"] = type; } if (read != null) { query["read"] = read.ToString(); } if (limit != null) { query["limit"] = limit.ToString(); } if (dialog_id != null) { query["dialog_id"] = dialog_id; } query["offset"] = offset.ToString(); uriBuilder.Query = query.ToString(); reqURL = uriBuilder.ToString(); //отправка запроса на сервер var client = new RestClient(reqURL); var request = new RestRequest(Method.GET); request.AddHeader("authorization", Configer.GetToken()); IRestResponse response = client.Execute(request); //получение коллекции сообщений List <Message> messages = new List <Message>(); dynamic dynObj = JsonConvert.DeserializeObject(response.Content);//парсим json if (dynObj.data != null) { foreach (dynamic dynMessage in dynObj.data) { Message message = new Message { ID = dynMessage.id.ToString(), text = dynMessage.text.ToString(), type = dynMessage.type.ToString(), read = bool.Parse(dynMessage.read.ToString()), created = DateTimeOffset.ParseExact(dynMessage.created.ToString().Replace("UTC", "GMT"), "yyyy'-'MM'-'dd'T'HH':'mm':'ss GMT", null).UtcDateTime.AddHours(Configer.GetOffset()), clientID = dynMessage.client_id.ToString(), transport = dynMessage.transport.ToString(), dialog_id = dynMessage.dialog_id.ToString() }; if (setRead) //если пометить полученные сообщения как прочитанные { SetRead(message.ID, true); } messages.Add(message); } } MessagesResponse messagesResponse = new MessagesResponse { messages = messages, info = new MessagesResponse.MetaInfo { total = Int32.Parse(dynObj.meta.total.ToString()), limit = Int32.Parse(dynObj.meta.limit.ToString()) } }; return(messagesResponse); }
public override void ClearSelf() { Configer.ClearSelf(); }
public Clients() { Rest = "https://api.chat2desk.com/v1/clients/"; token = Configer.GetToken(); }