private List <string> getLockTypeFlags(lockType value) { List <string> list = new List <string>(); foreach (Enum locktype in Enum.GetValues(typeof(lockType))) { if (value.HasFlag(locktype)) { list.Add(Enum.GetName(typeof(lockType), locktype)); } } return(list); }
public void LoadXml(XmlNode node, Room room) { Owner = room; Area = room.Area; Name = node["Name"].InnerText; Description = node["Description"].InnerText; DoorLabel = node["DoorDescription"].InnerText; roomName = node["Room"].InnerText; areaName = node["Area"].InnerText; Visible = Convert.ToBoolean(node["Visible"].InnerText); Breakable = Convert.ToBoolean(node["Breakable"].InnerText); ExitType = (exitType)Enum.Parse(typeof(exitType), node["ExitType"].InnerText); var lockNode = node.SelectSingleNode("Lock"); if (lockNode != null) { LockType = new lockType(); XmlNodeList locks = node["Lock"].SelectNodes("LockType"); foreach (XmlNode locktype in locks) { LockType |= (lockType)Enum.Parse(typeof(lockType), locktype.InnerText); } } var doorNode = node.SelectSingleNode("Door"); if (doorNode != null) { DoorType = new doorType(); XmlNodeList doors = node["Door"].SelectNodes("DoorType"); foreach (XmlNode doortype in doors) { DoorType |= (doorType)Enum.Parse(typeof(doorType), doortype.InnerText); } } var restrictionNode = node.SelectSingleNode("Restrictions"); if (restrictionNode != null) { Restrictions = new exitRestrictions(); XmlNodeList restrictions = node["Restrictions"].SelectNodes("Restriction"); foreach (XmlNode restriction in restrictions) { Restrictions |= (exitRestrictions)Enum.Parse(typeof(exitRestrictions), restriction.InnerText); } } }
private static error @lock(File f, lockType lt) { // Per https://golang.org/issue/19098, “Programs currently expect the Fd // method to return a handle that uses ordinary synchronous I/O.” // However, LockFileEx still requires an OVERLAPPED structure, // which contains the file offset of the beginning of the lock range. // We want to lock the entire file, so we leave the offset as zero. ptr <object> ol = @new <syscall.Overlapped>(); var err = windows.LockFileEx(syscall.Handle(f.Fd()), uint32(lt), reserved, allBytes, allBytes, ol); if (err != null) { return(error.As(addr(new os.PathError(Op: lt.String(), Path: f.Name(), Err: err, )) !) !); } return(error.As(null !) !); }
private static error @lock(File f, lockType lt) { return(error.As(addr(new os.PathError(Op: lt.String(), Path: f.Name(), Err: ErrNotSupported, )) !) !); }
private List<string> getLockTypeFlags(lockType value) { List<string> list = new List<string>(); foreach(Enum locktype in Enum.GetValues(typeof(lockType))) { if (value.HasFlag(locktype)) { list.Add(Enum.GetName(typeof(lockType), locktype)); } } return list; }
private static error @lock(File f, lockType lt) { error err = default !;