protected bladeOwnership(SQLiteConnection conn, string newFriendlyName, ushort newDebugPort, string newDebugKey, bladeLockType permittedAccessRead, bladeLockType permittedAccessWrite) { this.conn = conn; _state = bladeStatus.unused; _friendlyName = newFriendlyName; _kernelDebugPort = newDebugPort; _kernelDebugKey = newDebugKey; this.permittedAccessRead = permittedAccessRead; this.permittedAccessWrite = permittedAccessWrite; if (permittedAccessRead.HasFlag(bladeLockType.lockVirtualHW)) { _availableUsersCSV = makeUsersCSV(new[] { new userDesc(Settings.Default.vmUsername, Settings.Default.vmPassword) }); } }
protected void parseFromDBRow(SQLiteDataReader reader) { string[] fieldList = new string[reader.FieldCount]; for (int i = 0; i < reader.FieldCount; i++) { fieldList[i] = reader.GetName(i); } if (fieldList.Contains("kernelDebugKey") && !(reader["kernelDebugKey"] is DBNull)) { _kernelDebugKey = (string)reader["kernelDebugKey"]; } if (fieldList.Contains("availableUsersCSV") && !(reader["availableUsersCSV"] is DBNull)) { _availableUsersCSV = (string)reader["availableUsersCSV"]; } if (fieldList.Contains("friendlyName") && !(reader["friendlyName"] is DBNull)) { _friendlyName = (string)reader["friendlyName"]; } if (fieldList.Contains("state") && !(reader["state"] is DBNull)) { long enumIdx = (long)reader["state"]; _state = (bladeStatus)((int)enumIdx); } if (fieldList.Contains("ownershipKey")) { ownershipRowID = (long?)reader["ownershipKey"]; } if (fieldList.Contains("currentOwner") && !(reader["currentOwner"] is DBNull)) { _currentOwner = (string)reader["currentOwner"]; } if (fieldList.Contains("nextOwner") && !(reader["nextOwner"] is DBNull)) { _nextOwner = (string)reader["nextOwner"]; } if (fieldList.Contains("currentSnapshot")) { if (reader["currentSnapshot"] is DBNull) { _currentSnapshot = "clean"; } else { _currentSnapshot = (string)reader["currentSnapshot"]; } } if (fieldList.Contains("lastKeepAlive")) { if (reader["lastKeepAlive"] is DBNull) { lastKeepAlive = DateTime.MinValue; } else { lastKeepAlive = DateTime.Parse((string)reader["lastKeepAlive"]); } } }