private void AddItems(Item old) { var oldIt = old; var newIt = UtilsIO.DeepClone(oldIt); Helper._elReader.AddItem(GetCurrentList(), newIt); }
public void Save(BinaryWriter bw, ConfigList ls) { for (int i = 0; i < Values.Length / 2; i++) { var type = ls.Types[i]; if (type.Size == 236) { type.Size = 236; } switch (type._type) { case "wstring:": // bw.Write(Encoding.Unicode.GetBytes(Values[i, 1]), 0, type.Size); bw.Write(UtilsIO.GenerateArray(Encoding.Unicode.GetBytes(Values[i, 1]), type.Size)); break; case "string:": // bw.Write(Encoding.GetEncoding(936).GetBytes(Values[i, 1]),0,type.Size); bw.Write(UtilsIO.GenerateArray(Encoding.GetEncoding(936).GetBytes(Values[i, 1]), type.Size)); break; case "int32": bw.Write(Convert.ToInt32(Values[i, 1])); break; case "float": bw.Write(Convert.ToSingle(Values[i, 1])); break; default: bw.Write(Values[i, 1]); break; } } }
public MeditationToolbox(AnimatedPaint_IContainer animatedPaint_iContainer) { var stopFilename = UtilsIO.GetFileFromThisAppDirectory(Settings.Default.StopMp3Filename); MeditateOnStop = new InvokeAtRandomIntervals( TimeSpan.FromSeconds(Settings.Default.StopMedMinSec), TimeSpan.FromSeconds(Settings.Default.StopMedMaxSec), () => { playa = new AudioPlaya(stopFilename); playa.Play(); playa.Finished += (playaDone) => { playaDone.Dispose(); playaDone = null; }; }); MeditateOnStopQuicker = new InvokeAtRandomIntervals( TimeSpan.FromSeconds(Settings.Default.StopMed2MinSec), TimeSpan.FromSeconds(Settings.Default.StopMed2MaxSec), () => { playa = new AudioPlaya(stopFilename); playa.Play(); playa.Finished += (playaDone) => { playaDone.Dispose(); playaDone = null; }; }); CurAnimation = new AnimatedPaintThread(animatedPaint_iContainer) { DelayMs = Settings.Default.AnimationsDelay, }; }
private void dataGridView1_CurrentCellChanged(object sender, EventArgs e) { if (dataGridView1.CurrentCell == null) { return; } if (pictureBox1.Image != null) { if (BeforeDot2 == null || ImageChanged) { BeforeDot2 = UtilsIO.DeepClone(pictureBox1.Image); ImageChanged = false; } else { pictureBox1.Image.Dispose(); pictureBox1.Image = (Image)BeforeDot2.Clone(); pictureBox1.Update(); } } dynamic val; if (tabControl1.SelectedIndex == 0) { val = (Region)listBox1.SelectedItem; } else { val = (Transport)listBox1.SelectedItem; } Point p = ((List <Point>)val.Points)[dataGridView1.CurrentCell.RowIndex]; if (pictureBox1.Image == null) { return; } using (Graphics g = Graphics.FromImage(pictureBox1.Image)) { g.FillEllipse(new SolidBrush(Color.Crimson), GetX(p.x) - 5, GetZ(p.z) - 5, 10, 10); } panel1.VerticalScroll.Value = 0; panel1.HorizontalScroll.Value = 0; if (Convert.ToInt32(GetZ(p.z) - 70) > panel1.VerticalScroll.Maximum || Convert.ToInt32(GetX(p.x) - 60) > panel1.HorizontalScroll.Maximum) { return; } panel1.VerticalScroll.Value = Convert.ToInt32(GetZ(p.z) - 70); panel1.HorizontalScroll.Value = Convert.ToInt32(GetX(p.x) - 60); }
public Item GetItem(string key, int pos) { return(UtilsIO.DeepClone(Items[key][pos])); }
private static void PrintInfo(Item i) { Console.WriteLine("ID {0}{1} Name {2}", i.GetByKey("ID"), Environment.NewLine, UtilsIO.NormalizeString(i.GetByKey("Name"))); }