public void PageChat() { byte[] smsByteLenght = new byte[Buffersize]; _stream.Read(smsByteLenght, 0, smsByteLenght.Length); string smsLenght = Encoding.Unicode.GetString(smsByteLenght); int smsBuffLenght = int.Parse(smsLenght); byte[] smsByte = new byte[smsBuffLenght]; _stream.Write(_wait1, 0, _wait1.Length); _stream.Read(smsByte, 0, smsByte.Length); var sms = Encoding.Unicode.GetString(smsByte); _smsMas = sms.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); var time = _smsMas[0]; _countMes = _smsMas.Last(); var smsLine = ""; for (int i = 1; i < _smsMas.Length; i++) { smsLine += _smsMas[i]; smsLine += " "; } Console.WriteLine($"{_login}: {smsLine} {time}"); var storage = new XmlStorage("UserBase.xml"); var users = storage.Load(); _user.Message += $"{Environment.NewLine} {time} {smsLine.Remove(smsLine.Length - 2, 1)}"; //user.Count = int.Parse(countMes); var c = _user.Count + int.Parse(_countMes); _user.Count = c; users.Add(_user); storage.Save(users); List <User> listUser = new List <User>(); foreach (var item in users) { if (item.Login == _login) { listUser.Add(item); } } var a = listUser[0]; users.Remove(a); storage.Save(users); }
public Sonic4Ep1() { Sonic4Ep1.pInstance = this; AppMain.storePath = System.IO.Directory.GetCurrentDirectory(); var config = XmlStorage.Load(); if (config == null) { config = new Sonic4Save(); } var backup = gs.backup.SSave.CreateInstance(); backup.SetSave(config); XmlStorage.Save(config, false, false); this.graphics = new GraphicsDeviceManager((Game)this); this.graphics.PreferredBackBufferWidth = 480 * 3; this.graphics.PreferredBackBufferHeight = 288 * 3; this.graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft; this.graphics.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(this.graphics_PreparingDeviceSettings); this.graphics.SynchronizeWithVerticalRetrace = true; this.graphics.IsFullScreen = false; this.IsMouseVisible = true; this.Content.RootDirectory = "Content"; this.TargetElapsedTime = TimeSpan.FromSeconds(1d / 60); this.Activated += new EventHandler <EventArgs>(OnActivated); this.Deactivated += new EventHandler <EventArgs>(OnDeactivated); }
public void PageRegistr(bool b) { if (b) { _password = _dateMas[1]; _name = _dateMas[2]; _mail = _dateMas[3]; _createTime = _dateMas[4] + " " + _dateMas[5]; _modifiedTime = _dateMas[7] + " " + _dateMas[8]; var storage = new XmlStorage("UserBase.xml"); var users = storage.Load(); users.Add(new User() { Login = _login, Name = _name, Password = _password, Mail = _mail, CreatedAt = _createTime, ModifiedAt = _modifiedTime }); storage.Save(users); Console.WriteLine($"Система: Данные пользователя при регистрации {_data} (Пользователь добавлен)"); string otvet = "0"; byte[] otvetRegistra = Encoding.Unicode.GetBytes(otvet); _stream.Write(otvetRegistra, 0, otvetRegistra.Length); } else { Console.WriteLine($"Система:\tДанные пользователя при регистрации {_data} (Уже существует)"); string otvet = "1"; byte[] otvetRegistra = Encoding.Unicode.GetBytes(otvet); _stream.Write(otvetRegistra, 0, otvetRegistra.Length); } }
private static void DmCmnBackupSave(bool is_first, bool is_new, bool is_del) { AppMain.GSS_MAIN_SYS_INFO mainSysInfo = AppMain.GsGetMainSysInfo(); var save = SSave.CreateInstance().GetSave(); if (save == null) { SSave.CreateInstance().SetSave((save = new gs.Sonic4Save())); } if (is_first) { XmlStorage.Save(save, true, false); //mainSysInfo.cmp_backup.setData(mainSysInfo.backup.getData()); } else if (is_new) { XmlStorage.Save(save, false, true); //mainSysInfo.cmp_backup.setData(mainSysInfo.backup.getData()); } else { if (mainSysInfo.is_save_run == 0U || !AppMain.dmCmnBackupIsCmpSaveData()) { return; } XmlStorage.Save(save, false, false); // mainSysInfo.cmp_backup.setData(mainSysInfo.backup.getData()); } }
private void Kvvm_PropertyChanged(object sender, PropertyChangedEventArgs e) { var vm = sender as PluginKVViewModel; var kv = _pluginKvSgs.PluginKvSgList.Find(o => o.Key == vm.Key); if (kv != null) { kv.Value = vm.Value; } _xmlPluginKvSgsStorage.Save(); }
/// <summary> /// Save gloabl mask settings. /// </summary> public void Save() { var currentAggregationKey = XmlStorage.CurrentAggregationName; XmlStorage.ChangeAggregation(CommonSettingEntity.XMLAggregationKey); XmlStorage.FileName = CommonSettingEntity.XMLAggregationKey; XmlStorage.Set<float>(_topMaskProp, TopMask.Value); XmlStorage.Set<float>(_bottomMaskProp, BottomMask.Value); XmlStorage.Set<float>(_leftMaskProp, LeftMask.Value); XmlStorage.Set<float>(_rightMaskProp, RightMask.Value); XmlStorage.Save(); XmlStorage.ChangeAggregation(currentAggregationKey); }
/// <summary> /// Save common settings. /// </summary> public void Save() { var currentAggregationKey = XmlStorage.CurrentAggregationName; XmlStorage.ChangeAggregation(XMLAggregationKey); XmlStorage.FileName = XMLAggregationKey; XmlStorage.Set<int>(_numOfColProjectorsProp, NumOfColProjectors.Value); XmlStorage.Set<int>(_numOfRowProjectorsProp, NumOfRowProjectors.Value); XmlStorage.Set<float>(_blacknessProp, Blackness.Value); XmlStorage.Set<float>(_curveProp, Curve.Value); XmlStorage.Set<float>(_brightnessProp, Brightness.Value); XmlStorage.Set<bool>(_symmetry, Symmetry.Value); XmlStorage.Save(); XmlStorage.ChangeAggregation(currentAggregationKey); }
public void Execute() { this.qua.eulerAngles = new Vector3(10f, 20f, 30f); this.SetData2XmlStorage(1); XmlStorage.ChangeAggregation("Test1"); this.SetData2XmlStorage(11); XmlStorage.ChangeAggregation("Test2"); XmlStorage.FileName = "Test2"; this.SetData2XmlStorage(111); XmlStorage.Save(); Debug.Log("Finish"); }
static void Main(string[] args) { IEnumerable <string> uris = new List <string> { "https://github.com/AnzhelikaKravchuk?tab=repositories", "https://git_hub..com/AnzhelikaKr.avchuk.?tab=.repositories", "https://github.com/AnzhelikaKravchuk/2017-2018.MMF.BSU", "https://habrahabr.ru/company/it-grad/blog/341486/", "http://habrahabr.ru/company///it-grad/?blog/341486/" }; IValidator <string> validator = new UrlValidator(); IParser <UrlAddress> parser = new UrlParser(validator, uris); IEnumerable <UrlAddress> urlAddresses = parser.Parse(); IStorage <UrlAddress> storage = new XmlStorage(urlAddresses); storage.Save(); Console.ReadLine(); }
/// <summary> /// Save rect mask settings. /// </summary> public void Save() { var currentAggregationKey = XmlStorage.CurrentAggregationName; XmlStorage.ChangeAggregation(CommonSettingEntity.XMLAggregationKey); XmlStorage.FileName = CommonSettingEntity.XMLAggregationKey; for (int i = 0; i < MAX_RECTMASKS; i++) { XmlStorage.Set <float>(_rectMaskXPropPrefix + i.ToString(), RectMaskX[i].Value); XmlStorage.Set <float>(_rectMaskYPropPrefix + i.ToString(), RectMaskY[i].Value); XmlStorage.Set <float>(_rectMaskWidthPropPrefix + i.ToString(), RectMaskWidth[i].Value); XmlStorage.Set <float>(_rectMaskHeightPropPrefix + i.ToString(), RectMaskHeight[i].Value); } XmlStorage.Save(); XmlStorage.ChangeAggregation(currentAggregationKey); }
private void Kvm_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (sender is PluginKVViewModel kvm) { var kvsg = _pluginKvSgs.PluginKvSgList.FirstOrDefault(p => p.Key == kvm.Key); if (kvsg == null) { _pluginKvSgs.PluginKvSgList.Add(new PluginKvSg() { Key = kvm.Key, Value = kvm.Value }); } else { kvsg.Value = kvm.Value; } _xmlPluginKvSgsStorage.Save(); } }
/// <summary> /// Save settings. /// </summary> public void Save() { var currentAggregationKey = XmlStorage.CurrentAggregationName; XmlStorage.ChangeAggregation(CommonSettingEntity.XMLAggregationKey); XmlStorage.FileName = CommonSettingEntity.XMLAggregationKey; XmlStorage.Set <float>(_topBlendProp, TopBlend.Value); XmlStorage.Set <float>(_bottomBlendProp, BottomBlend.Value); XmlStorage.Set <float>(_leftBlendProp, LeftBlend.Value); XmlStorage.Set <float>(_rightBlendProp, RightBlend.Value); XmlStorage.Set <float>(_topMaskProp, topMask.Value); XmlStorage.Set <float>(_bottomMaskProp, bottomMask.Value); XmlStorage.Set <float>(_leftMaskProp, leftMask.Value); XmlStorage.Set <float>(_rightMaskProp, rightMask.Value); XmlStorage.Set <Vector2>(_topLeftMaskProp, topLeftMask.Value); XmlStorage.Set <Vector2>(_topRightMaskProp, topRightMask.Value); XmlStorage.Set <Vector2>(_bottomLeftMaskProp, bottomLeftMask.Value); XmlStorage.Set <Vector2>(_bottomRightMaskProp, bottomRightMask.Value); XmlStorage.Set <Vector2>(_uvShiftProp, uvShift.Value); XmlStorage.Save(); XmlStorage.ChangeAggregation(currentAggregationKey); }
public void PageRemimdPas(bool b) { var storage = new XmlStorage("UserBase.xml"); var users = storage.Load(); #region Прием названия кнопки которая нажата в "Remind" //stream.Write(wait1, 0, wait1.Length); byte[] methodTypeByteLenght = new byte[Buffersize]; _stream.Read(methodTypeByteLenght, 0, methodTypeByteLenght.Length); string methodTypeLenght = Encoding.Unicode.GetString(methodTypeByteLenght); int methodTypeBuffLenght = int.Parse(methodTypeLenght); byte[] methodTypeByte = new byte[methodTypeBuffLenght]; _stream.Write(_wait1, 0, _wait1.Length); _stream.Read(methodTypeByte, 0, methodTypeByte.Length); var methodType = Encoding.Unicode.GetString(methodTypeByte); //stream.Write(wait1, 0, wait1.Length); #endregion if (methodType == "btOK_Click") { if (b) { int random = _rnd.Next(10000, 99999); foreach (var item in users) { if (item.Login == _login) { _mail = item.Mail; } } string otvet = "0"; byte[] otvetRegistra = Encoding.Unicode.GetBytes(otvet); _stream.Write(otvetRegistra, 0, otvetRegistra.Length); Console.WriteLine($"Система: Такой логин для восстановления есть"); _stream.Read(_wait1, 0, _wait1.Length); string userMail = _mail + " " + random; byte[] userMailByte = Encoding.Unicode.GetBytes(userMail); string userMailLenght = userMailByte.Length.ToString(); byte[] userMailLenghtByte = Encoding.Unicode.GetBytes(userMailLenght); _stream.Write(userMailLenghtByte, 0, userMailLenghtByte.Length); _stream.Read(_wait1, 0, _wait1.Length); _stream.Write(userMailByte, 0, userMailByte.Length); MailAddress from = new MailAddress("*****@*****.**"); MailAddress to = new MailAddress(_mail); MailMessage mailSend = new MailMessage(from, to); mailSend.Body = "<h2>Код для восстановления пароля </h2>" + random; mailSend.IsBodyHtml = true; SmtpClient smtp = new SmtpClient("smtp.mail.ru", 25); smtp.Credentials = new NetworkCredential("*****@*****.**", "45626336rustam"); smtp.EnableSsl = true; smtp.Send(mailSend); } else { Console.WriteLine($"Система:\tТакого логина для восстановления нет"); string otvet = "1"; byte[] otvetRegistra = Encoding.Unicode.GetBytes(otvet); _stream.Write(otvetRegistra, 0, otvetRegistra.Length); } } if (methodType == "btChangePas_Click") { #region Прием пароля для изменения byte[] pasByteLenght = new byte[Buffersize]; _stream.Read(pasByteLenght, 0, pasByteLenght.Length); string pasLenght = Encoding.Unicode.GetString(pasByteLenght); int pasBuffLenght = int.Parse(pasLenght); byte[] pasByte = new byte[pasBuffLenght]; _stream.Write(_wait1, 0, _wait1.Length); _stream.Read(pasByte, 0, pasByte.Length); var pas_time = Encoding.Unicode.GetString(pasByte); var pasTime = pas_time.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); #endregion User p = users.First(x => x.Login == _login); p.Password = pasTime[0]; p.ModifiedAt = pasTime[1] + " " + pasTime[2]; users.Add(p); storage.Save(users); List <User> listUser = new List <User>(); foreach (var item in users) { if (item.Login == _login) { listUser.Add(item); } } var a = listUser[0]; users.Remove(a); storage.Save(users); } }
public static void Save() { XmlStorage ps = new XmlStorage (); ps.New ("ThemeConfiguration"); ps.Add (themes); ps.Save (Path.Combine (Defines.DATA_DIR, Defines.THEMES_FILE)); }
public void Write() { if (!Directory.Exists (config_path)) Directory.CreateDirectory (config_path); XmlStorage storage = new XmlStorage (); storage.New (RECENT_TAG); foreach (RecentFile item in items) storage.Add <RecentFile> (item); storage.Save (filename); }
public void PageAdmin() { #region Прием названия кнопки которая нажата в "Admin" byte[] methodTypeByteLenght = new byte[Buffersize]; _stream.Read(methodTypeByteLenght, 0, methodTypeByteLenght.Length); string methodTypeLenght = Encoding.Unicode.GetString(methodTypeByteLenght); int methodTypeBuffLenght = int.Parse(methodTypeLenght); byte[] methodTypeByte = new byte[methodTypeBuffLenght]; _stream.Write(_wait1, 0, _wait1.Length); _stream.Read(methodTypeByte, 0, methodTypeByte.Length); var methodType = Encoding.Unicode.GetString(methodTypeByte); #endregion var storage = new XmlStorage("UserBase.xml"); var users = storage.Load(); int count = users.Count() - 1; if (methodType == "ButtonLoadUsers") { byte[] countByte = Encoding.Unicode.GetBytes(count.ToString()); string countLenght = countByte.Length.ToString(); byte[] countLenghtByte = Encoding.Unicode.GetBytes(countLenght); _stream.Write(countLenghtByte, 0, countLenghtByte.Length); _stream.Read(_wait1, 0, _wait1.Length); _stream.Write(countByte, 0, countByte.Length); foreach (var item in users) { if (item.Login != "admin") { byte[] lognameByte = Encoding.Unicode.GetBytes(item.Login + " " + item.Name + " " + item.Password + " " + item.Count.ToString() + " " + item.CreatedAt + " " + item.ModifiedAt); byte[] lognameLenght = Encoding.Unicode.GetBytes(lognameByte.Length.ToString()); _stream.Write(lognameLenght, 0, lognameLenght.Length); _stream.Read(_wait1, 0, _wait1.Length); _stream.Write(lognameByte, 0, lognameByte.Length); if (item.Message != null) { string otvet = "0"; byte[] otvetRegistra = Encoding.Unicode.GetBytes(otvet); _stream.Write(otvetRegistra, 0, otvetRegistra.Length); _stream.Read(_wait1, 0, _wait1.Length); byte[] messageByte = Encoding.Unicode.GetBytes(item.Message); byte[] messageByteLenght = Encoding.Unicode.GetBytes(messageByte.Length.ToString()); _stream.Write(messageByteLenght, 0, messageByteLenght.Length); _stream.Read(_wait1, 0, _wait1.Length); _stream.Write(messageByte, 0, messageByte.Length); } else { string otvet = "1"; byte[] otvetRegistra = Encoding.Unicode.GetBytes(otvet); _stream.Write(otvetRegistra, 0, otvetRegistra.Length); } } } } if (methodType == "ButtonDelete") { #region Получаем логин пользователя которого нужно удалить из базы byte[] selectedByteLenght = new byte[Buffersize]; _stream.Read(selectedByteLenght, 0, selectedByteLenght.Length); string selectedLenght = Encoding.Unicode.GetString(selectedByteLenght); int selectedBuffLenght = int.Parse(selectedLenght); byte[] selectedByte = new byte[selectedBuffLenght]; _stream.Write(_wait1, 0, _wait1.Length); _stream.Read(selectedByte, 0, selectedByte.Length); var selectedLogin = Encoding.Unicode.GetString(selectedByte); #endregion User p = users.First(x => x.Login == selectedLogin); users.Remove(p); storage.Save(users); } }
public void Save(string file) { XmlStorage ps = new XmlStorage (); ps.New ("project"); ps.Add (details, "details"); details.Filename = file; // // Save elements in separate arrays classified by type // List <VideoProjectElement> videos = new List <VideoProjectElement> (); List <SlideShowProjectElement> slides = new List <SlideShowProjectElement> (); List <ButtonProjectElement> bts = new List <ButtonProjectElement> (); for (int i = 0; i < Elements.Count; i++) { if (typeof (Video) == Elements[i].GetType ()) { videos.Add ((VideoProjectElement)Elements [i]); continue; } if (typeof (SlideShow) == Elements[i].GetType ()) { slides.Add ((SlideShowProjectElement) Elements [i]); continue; } Logger.Debug ("Project.Save. Skipping {0}", Elements[i].GetType ()); } foreach (Button button in Buttons) bts.Add (button); ps.Add (videos, "videos"); ps.Add (slides, "slides"); ps.Add (bts, "buttons"); Logger.Debug ("Project.Save. Saving {0}", Details.Filename); ps.Save (Details.Filename); for (int i = 0; i < Elements.Count; i++) Logger.Debug ("Project.Save. {0}", Elements[i]); }