private bool LoadFrom(string path) { if (File.Exists(path)) { //Load class BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(path, FileMode.Open); SaveClass saveCopy = (SaveClass)bf.Deserialize(file); save.CopyFrom(saveCopy); //Apply class to 'keys' foreach (KeySave keySave in save.keySaves) { Key key = GetKeyByName(keySave.keyName); if (key != null) { key.SetKeyCode(keySave.keycode); } } file.Close(); return(true); } return(false); }