/// <summary> /// /// </summary> /// <returns></returns> public override bool Save(XmlWriter writer) { if (writer == null) { return(false); } writer.WriteStartElement(Tag); writer.WriteAttributeString("side", Side.ToString()); writer.WriteAttributeString("reusable", Reusable.ToString()); writer.WriteAttributeString("activateitem", NeededItem); writer.WriteAttributeString("consumeitem", ConsumeItem.ToString()); writer.WriteAttributeString("picklock", LockLevel.ToString()); writer.WriteAttributeString("activated", ActivatedDecoration.ToString()); writer.WriteAttributeString("deactivated", DeactivatedDecoration.ToString()); if (Scripts.Count > 0) { writer.WriteStartElement("scripts"); foreach (WallSwitchScript script in Scripts) { script.Save(writer); } writer.WriteEndElement(); } base.Save(writer); writer.WriteEndElement(); return(true); }
public override void Run() { Workspace workspace = GetWorkspaceFromCache(); List <string> paths; ConfirmFilesSpecified(); paths = VerifiedFullPaths(Arguments); LockLevel lockLevel = LockLevelFromString(OptionLock); int rc = workspace.SetLock(paths.ToArray(), lockLevel, OptionRecursive ? RecursionType.Full : RecursionType.None); if (LockLevel.None == lockLevel) { Console.WriteLine("{0} file(s) unlocked.", rc); } else { Console.WriteLine("{0} file(s) locked for {1}.", rc, lockLevel.ToString().ToLower()); } }
internal void ToXml(XmlWriter writer, string element) { writer.WriteStartElement("ChangeRequest"); writer.WriteAttributeString("req", RequestType.ToString()); if (RequestType == RequestType.Lock || LockLevel != LockLevel.None) { writer.WriteAttributeString("lock", LockLevel.ToString()); } if (RequestType == RequestType.Add) { writer.WriteAttributeString("enc", Encoding.ToString()); } writer.WriteAttributeString("type", ItemType.ToString()); //writer.WriteAttributeString("did", DeletionId.ToString()); //writer.WriteAttributeString("targettype", TargetType.ToString()); if (!String.IsNullOrEmpty(Target)) { // convert local path specs from platform paths to tfs paths as needed string fxdTarget; if (VersionControlPath.IsServerItem(Target)) { fxdTarget = Target; } else { fxdTarget = TfsPath.FromPlatformPath(Target); } writer.WriteAttributeString("target", fxdTarget); } this.Item.ToXml(writer, "item"); //this.VersionSpec.ToXml(writer, "vspec"); writer.WriteEndElement(); }