public static void SaveData(WorkPriceConfig priceConfig) { StringBuilder sb= new StringBuilder(); sb.AppendLine(priceConfig.WorkPriceName); foreach (WorkPriceItem item in priceConfig.PriceList) { sb.AppendLine(string.Format("{0}{2}{1:F2}", item.WorkName, item.WorkPrice, mSplitString[0])); } //File.WriteAllText(mFileName, sb.ToString()); byte[] data = Encoding.UTF8.GetBytes(sb.ToString()); string base64 = Convert.ToBase64String(data); File.WriteAllText(mBinFileName,base64); }
private void button2_Click(object sender, EventArgs e) { WorkPriceConfig conf = new WorkPriceConfig(textBox1.Text, (IEnumerable<WorkPriceItem>)workPriceItemBindingSource.DataSource); PriceConfigWorker.SaveData(conf); MessageBox.Show(@"Сохранено!"); }