public bool GetValue <T>(string name, out T value, T defaultValue) { try{ value = (T)info.GetValue(name, typeof(T)); return(true); }catch { value = defaultValue; return(false); } }
//========================================================================== // ISerializable //========================================================================== SftpAccountGw(Ser::SerializationInfo info, Ser::StreamingContext context) { this.name = info.GetString("name"); this.gwchain = (Gen::List <SshUserData>)info.GetValue("gwchain", typeof(Gen::List <SshUserData>)); SerializationInfoReader reader = new SerializationInfoReader(info); reader.GetValue("offline", out this.s_offline, false); reader.GetValue("rootdir", out this.rootdir, "."); reader.GetValue("s_readonly", out this.s_readonly, false); reader.GetValue("s_reconnect_count", out this.s_reconnect_count, 1); reader.GetValue("s_discon_interval", out this.s_discon_interval, 300); reader.GetValue("s_beat_interval", out this.s_beat_interval, 60); int symlink; if (reader.GetValue("symlink", out symlink)) { this.symlink = (SftpSymlink)symlink; } reader.GetValue("s_enabled", out this.s_enabled, true); }