public void Save(GridEX grid, IGridLayoutKey key) { Stream stream = new FileStream(LayoutFileName(key), FileMode.Create); grid.SaveLayoutFile(stream); stream.Close(); }
public void Load(GridEX grid, IGridLayoutKey key) { try { Stream stream = new FileStream(LayoutFileName(key), FileMode.Open); grid.LoadLayoutFile(stream); stream.Close(); } catch (FileNotFoundException) { } }
private string KeyString(IGridLayoutKey key) { byte[] inputBytes = Encoding.ASCII.GetBytes(key.Value); byte[] hash = md5.ComputeHash(inputBytes); StringBuilder sb = new StringBuilder(); foreach (byte b in hash) { sb.Append(b.ToString("X2")); } return(sb.ToString()); }
private string LayoutFileName(IGridLayoutKey key) { return(String.Format("{0}{1}.GridLayout.xml", Path, KeyString(key))); }