コード例 #1
0
		public override void Claim(FileSystemCommandConnection connection)
		{
			if (!connection.Socket.RemoteEndPoint.Equals(this.OwnerEndPoint))
			{
				connection.WriteError(ErrorCodes.INVALID_PARAM, "ticket");

				connection.RunLevel = DisconnectedRunLevel.Default;

				return;
			}

			var src = this.file.GetContent().GetInputStream(this.fileShare);

			if (this.offset > 0 || this.length != -1)
			{
				src = new PartialStream(src, this.offset, this.length);
			}
			
			connection.WriteOk("length", src.Length.ToString(CultureInfo.InvariantCulture));
			connection.Flush();
			
			var des = connection.WriteStream;

			var pump = new StreamCopier(src, des);
        
			pump.Run();

			connection.RunLevel = DisconnectedRunLevel.Default;
		}
コード例 #2
0
		public DownloadTicket(FileSystemCommandConnection connection, IFile file, FileShare fileShare, int offset, int length)
			: base(connection)
		{
			this.file = file;
			this.offset = offset;
			this.length = length;
			this.fileShare = fileShare;
		}
コード例 #3
0
		public static void PrintAttribute(FileSystemCommandConnection connection, string name, object value)
		{
			var typeName = ProtocolTypes.GetTypeName(value.GetType());

			if (typeName != null)
			{
				connection.WriteTextBlock(" {0}=\"{1}:{2}\"", name,
					typeName, ProtocolTypes.ToEscapedString(value));
			}
		}
		private static void PrintNodeType(FileSystemCommandConnection connection, NodeType nodeType)
		{
			if (nodeType == NodeType.File)
			{
				connection.WriteTextPartialBlock("f");
			}
			else if (nodeType == NodeType.Directory)
			{
				connection.WriteTextPartialBlock("d");
			}
		}
コード例 #5
0
		public static void PrintAttributes(FileSystemCommandConnection connection, INode node)
		{
			foreach (var keyValuePair in node.Attributes)
			{
				if (!keyValuePair.Key.EqualsIgnoreCase("exists"))
				{
					if (keyValuePair.Value != null)
					{
						PrintAttribute(connection, keyValuePair.Key, keyValuePair.Value);
					}
				}
			}
		}
コード例 #6
0
 public static void PrintAttributes(FileSystemCommandConnection connection, INode node)
 {
     foreach (var keyValuePair in node.Attributes)
     {
         if (!keyValuePair.Key.EqualsIgnoreCase("exists"))
         {
             if (keyValuePair.Value != null)
             {
                 PrintAttribute(connection, keyValuePair.Key, keyValuePair.Value);
             }
         }
     }
 }
 internal DeterministicBinaryReadContext(FileSystemCommandConnection connection)
 {
     this.acquired   = false;
     this.connection = connection;
 }
			internal DeterministicBinaryReadContext(FileSystemCommandConnection connection)
			{
				this.acquired = false;
				this.connection = connection;				
			}
コード例 #9
0
 public abstract void Claim(FileSystemCommandConnection connection);
コード例 #10
0
 protected Ticket(string ticketId, FileSystemCommandConnection connection)
 {
     this.TicketId      = ticketId;
     this.OwnerEndPoint = connection.Socket.RemoteEndPoint;
 }
コード例 #11
0
 protected Ticket(FileSystemCommandConnection connection)
     : this(NewTicketId(), connection)
 {
 }
コード例 #12
0
		public abstract void Claim(FileSystemCommandConnection connection);
コード例 #13
0
		protected Ticket(string ticketId, FileSystemCommandConnection connection)
		{
			this.TicketId = ticketId;
			this.OwnerEndPoint = connection.Socket.RemoteEndPoint;
		}
コード例 #14
0
		protected Ticket(FileSystemCommandConnection connection)
			: this(NewTicketId(), connection)
		{
			
		}