/// <summary> /// Des the serialise. /// </summary> /// <param name="filename">The filename.</param> /// <returns></returns> public static SymbolIdentity DeSerialise(string filename) { var ret = new SymbolIdentity(); try { var text = FileExtras.LoadFile(filename); var t1 = text.Split(new[] { v }, StringSplitOptions.RemoveEmptyEntries); var w = int.Parse(t1[0]); var h = int.Parse(t1[1]); var letters = new List <HistogramLetter>(); for (var a = 2; a < t1.Count(); a++) { var ltext = t1[a]; var l = HistogramLetter.DeSerialise(ltext); if (letters.Any(s => s.Letter.Equals(l.Letter)) == false) { letters.Add(l); } } ret.HistogramHeight = h; ret.HistogramWidth = w; ret.Letters = letters; } catch (ArgumentException) { } return(ret); }
private void загрузитьСловарьToolStripMenuItem_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); ofd.Title = "Загрузка словаря"; ofd.Filter = "Словарь (*.ilin)|"; ofd.Multiselect = false; ofd.InitialDirectory = "C:\\Users\\milins\\Desktop\\II\\fonts"; var res = ofd.ShowDialog(); if (res != DialogResult.OK) { return; } var fn = ofd.FileName; symbol = SymbolIdentity.DeSerialise(fn); RefreshLettersList(); onFunc(); }
private void Form1_Load(object sender, EventArgs e) { symbol = new SymbolIdentity(); RefreshLettersList(); offFunc(); }