Files
StockSharp/Community/FileClient.cs
T

55 lines
1.6 KiB
C#

#region S# License
/******************************************************************************************
NOTICE!!! This program and source code is owned and licensed by
StockSharp, LLC, www.stocksharp.com
Viewing or use of this code requires your acceptance of the license
agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE
Removal of this comment is a violation of the license agreement.
Project: StockSharp.Community.Community
File: FileClient.cs
Created: 2015, 11, 11, 2:32 PM
Copyright 2010 by StockSharp, LLC
*******************************************************************************************/
#endregion S# License
namespace StockSharp.Community
{
using System;
using Ecng.Common;
/// <summary>
/// The client for access to the service of work with files and documents.
/// </summary>
public class FileClient : BaseCommunityClient<IFileService>
{
/// <summary>
/// Initializes a new instance of the <see cref="FileClient"/>.
/// </summary>
public FileClient()
: this("http://stocksharp.com/services/fileservice.svc".To<Uri>())
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FileClient"/>.
/// </summary>
/// <param name="address">Service address.</param>
public FileClient(Uri address)
: base(address, "file")
{
}
/// <summary>
/// To upload the file to the site .
/// </summary>
/// <param name="fileName">File name.</param>
/// <param name="body">File body.</param>
/// <returns>Uploaded file link.</returns>
public string Upload(string fileName, byte[] body)
{
return Invoke(f => f.Upload(SessionId, fileName, body));
}
}
}