Пример #1
0
        public void Save(GridEX grid, IGridLayoutKey key)
        {
            Stream stream = new FileStream(LayoutFileName(key), FileMode.Create);

            grid.SaveLayoutFile(stream);
            stream.Close();
        }
Пример #2
0
 public void Load(GridEX grid, IGridLayoutKey key)
 {
     try {
         Stream stream = new FileStream(LayoutFileName(key), FileMode.Open);
         grid.LoadLayoutFile(stream);
         stream.Close();
     }
     catch (FileNotFoundException) {
     }
 }
Пример #3
0
        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());
        }
Пример #4
0
 private string LayoutFileName(IGridLayoutKey key)
 {
     return(String.Format("{0}{1}.GridLayout.xml", Path, KeyString(key)));
 }