alazhuabc304 2015-09-16 13:52 采纳率: 0%
浏览 1582

c#异步通信代码错误问题

public void ConnectCallback(IAsyncResult ar)
{
Socket client = (Socket)ar.AsyncState;
client.EndConnect(ar);
bool connect_flag = false;
connect_flag = true;
ManualResetEvent connectDone = new ManualResetEvent(false); //连接的信号
connectDone.Set();
}
//vs的这段代码中 ,bool connect_flag的connect_flag报了一个警告错误,变量connect_flag已赋值,但是其值从未使用过。如何修改?
public static MODEL.DataSourceVersionQuery BrowseDataSource_QueryVersionData()
{
MODEL.DataSourceVersionQuery result = new MODEL.DataSourceVersionQuery();
//获取数据包
string strPacket = BrowseDataSource_PrepareVersionPacket();
//向服务端提交查询版本信息
string str = DAL.socket.GetSocketData(strPacket);
//DAL.socket.GetSocketData(strPacket) vs报了一个错误,非静态字段、方法或属性DAL.socket.GetSocketData(string)“要求对象引用。如何修改?
还有这个错误图片说明
另外我想把DAL中的socket.cs的 public byte[] bytesReceived { get; set; }这段移动到Model中而不报错要如何修改?
DAL中socket完整代码如下:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
using System.Threading;

namespace DAL
{
///
/// Socket接口
///

class socket
{
    //Socket
    public Socket clientSocket;

    /// <summary>
    /// socket连接
    /// </summary>
    /// <returns>
    /// true    成功
    /// false   失败
    /// </returns>

    public bool SocketConnect()
    {

        byte[] bytesReceived = new byte[256];
        ManualResetEvent connectDone = new ManualResetEvent(false); //连接的信号

        ManualResetEvent sendDone = new ManualResetEvent(false); //发送结束

        //从配置文件获取IP
        string SocketIP = DAL.Common.ReadConfigString("Recover", "IP");
        //从配置文件获取端口
        int SocketPort = Convert.ToInt32(DAL.Common.ReadConfigString("Recover", "Port"));
        //创建IP地址
        IPAddress IP = IPAddress.Parse(SocketIP);

        try
        {

            //创建socket实例
            clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            //创建网络端点
            IPEndPoint ipEnd = new IPEndPoint(IP, SocketPort);

            //与目标终端连接
            clientSocket.BeginConnect(ipEnd,

            new AsyncCallback(ConnectCallback), clientSocket);//调用回调函数


            connectDone.WaitOne();
            if (clientSocket.Connected)
            {
                return true;
            }
            else
            {
                return false;
            }




        }
        catch (Exception e)
        {
            string strError = "";
            strError += "\r\n SocketIP = " + SocketIP.ToString();
            strError += "\r\n SocketPort = " + SocketPort.ToString();
            DAL.Common.WriteErrorLog(e, strError);
            return false;
        }
    }
    /// <summary>

    /// 异步连接的回调函数

    /// </summary>

    /// <param name="ar"></param>
    public void ConnectCallback(IAsyncResult ar)
    {
        Socket client = (Socket)ar.AsyncState;
        client.EndConnect(ar);
        bool connect_flag = false;
        connect_flag = true;
        ManualResetEvent connectDone = new ManualResetEvent(false); //连接的信号
        connectDone.Set();
    }

    /// <summary>
    /// Socket发送数据
    /// </summary>
    /// <param name="strSend">
    /// 数据的内容
    /// </param>
    public void SocketSend(string strSend)
    {
        Socket clientSocket; //发送创建套接字

        int length = strSend.Length;
        Byte[] bytesSent = new byte[length];
        clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        try
        {

            bytesSent = System.Text.Encoding.Default.GetBytes(strSend); //将字符串指定到指定Byte数组
            clientSocket.BeginSend(bytesSent, 0, bytesSent.Length, 0, new AsyncCallback(SendCallback), clientSocket); //异步发送数据
            ManualResetEvent sendDone = new ManualResetEvent(false);//发送结束
            sendDone.WaitOne();
        }
        catch (Exception e)
        {
            string strError = "";
            DAL.Common.WriteErrorLog(e, strError);
        }
    }
    public void SendCallback(IAsyncResult ar) //发送的回调函数
    {
        ManualResetEvent sendDone = new ManualResetEvent(false);    //发送结束
        Socket client = (Socket)ar.AsyncState;
        int bytesSend = client.EndSend(ar); //完成发送
        sendDone.Set();
    }
    /// <summary>
    /// Socket接收数据
    /// </summary>
    /// <returns>
    /// 收到的数据
    /// </returns>
    public string SocketReceive()
    {
        string result = "";
        try
        {
            MemoryStream stream = new MemoryStream();
            Byte[] bytesReceived = new Byte[256];
            clientSocket.BeginReceive(bytesReceived, 0, bytesReceived.Length, 0, new AsyncCallback(ReceiveCallback), clientSocket);
            ManualResetEvent sendDone = new ManualResetEvent(false); //发送结束
            sendDone.WaitOne();
        }
        catch (Exception e)
        {
            string strError = "";
            DAL.Common.WriteErrorLog(e, strError);
        }
        return result;
    }
    public void ReceiveCallback(IAsyncResult ar)
    {
        Socket client = (Socket)ar.AsyncState; //获取句柄
        int bytesread = client.EndReceive(ar);
        if (bytesread > 0)
        {
            clientSocket.BeginReceive(bytesReceived, 0, bytesReceived.Length, 0, new AsyncCallback(ReceiveCallback), client);
            string content = Encoding.ASCII.GetString(bytesReceived, 0, bytesReceived.Length);

        }
        else
        {
            ManualResetEvent readDone = new ManualResetEvent(false); //读信号
            readDone.Set();
        }
    }


    /// <summary>
    /// Socket通信
    /// </summary>
    /// <param name="strSend">
    /// 发送的信息
    /// </param>
    /// <returns>
    /// 包体的内容
    /// </returns>
    public string GetSocketData(string strSend)
    {
        string strDatas = "";
        string strResult = "";
        string strExtLength = "";
        try
        {
            //Socket连接
            SocketConnect();
            //发送信息
            SocketSend(strSend);
            //接收服务器的信息
            strResult = SocketReceive();
            //获取扩展信息的长度
            strExtLength = strResult.Substring(16, 12);
            int ExtLength = Convert.ToInt32(strExtLength);
            //扩展信息,暂不使用
            //string strExtInfo = strResult.Substring(32, ExtLength);
            //获取包体的内容
            strDatas = strResult.Substring(ExtLength + 32);

            //strDatas = decodedString;
        }
        catch (Exception e)
        {
            string strError = "";
            strError += "\r\n strResult = " + strResult;
            strError += "\r\n strExtLength = " + strExtLength;
            DAL.Common.WriteErrorLog(e, strError);
            strDatas = "";
        }
        return strDatas;
    }

    public string SocketReceiveFile(string FileName)
    {
        string result = "";
        try
        {
            MemoryStream streamPacketLength = new MemoryStream();
            Byte[] bytesPacketLength = new Byte[16];

            clientSocket.Receive(bytesPacketLength, bytesPacketLength.Length, 0);
            streamPacketLength.Write(bytesPacketLength, 0, bytesPacketLength.Length);
            result = System.Text.Encoding.Default.GetString(streamPacketLength.ToArray());
            int PacketLength = Convert.ToInt32(result);
            streamPacketLength.Close();

            MemoryStream streamExtLength = new MemoryStream();
            Byte[] bytesExtLength = new Byte[12];
            clientSocket.Receive(bytesExtLength, bytesExtLength.Length, 0);
            streamExtLength.Write(bytesExtLength, 0, bytesExtLength.Length);
            result = System.Text.Encoding.Default.GetString(streamExtLength.ToArray());
            int ExtLength = Convert.ToInt32(result);
            streamExtLength.Close();

            MemoryStream streamProtocol = new MemoryStream();
            Byte[] bytesProtocol = new Byte[4];
            clientSocket.Receive(bytesProtocol, bytesProtocol.Length, 0);
            streamProtocol.Write(bytesProtocol, 0, bytesProtocol.Length);
            result = System.Text.Encoding.Default.GetString(streamProtocol.ToArray());
            string Protocol = result;
            streamProtocol.Close();

            MemoryStream streamExtInfo = new MemoryStream();
            Byte[] bytesExtInfo = new Byte[ExtLength];
            clientSocket.Receive(bytesExtInfo, bytesExtInfo.Length, 0);
            streamExtInfo.Write(bytesExtInfo, 0, bytesExtInfo.Length);
            result = System.Text.Encoding.Default.GetString(streamExtInfo.ToArray());
            byte[] Buffer = Convert.FromBase64String(result);
            string strExtInfo = UTF8Encoding.UTF8.GetString(Buffer);
            streamExtInfo.Close();

            MODEL.FileTrackQuery ExtInfo = new MODEL.FileTrackQuery();
            ExtInfo = JsonConvert.DeserializeObject<MODEL.FileTrackQuery>(strExtInfo);

            if (ExtInfo.code == "00")
            {
                FileInfo fi = new FileInfo(FileName);
                DirectoryInfo di = fi.Directory;
                if (!di.Exists)
                {
                    di.Create();
                }

                FileStream streamPacketInfo = new FileStream(FileName, FileMode.Create);

                if (PacketLength > 0)
                {
                    Byte[] bytesPacketInfo = new Byte[PacketLength];

                    int bytes = 0;
                    do
                    {
                        bytes = clientSocket.Receive(bytesPacketInfo, bytesPacketInfo.Length, 0);
                        streamPacketInfo.Write(bytesPacketInfo, 0, bytes);
                    }
                    while (bytes > 0);
                }
                streamPacketInfo.Close();
            }
            clientSocket.Close();

            string strLogFile = System.AppDomain.CurrentDomain.BaseDirectory + "debug.txt";
            StreamWriter sw = new StreamWriter(strLogFile, true);
            sw.WriteLine("PacketLength : " + PacketLength.ToString());
            sw.WriteLine("ExtLength : " + ExtLength.ToString());
            sw.WriteLine("strExtInfo : " + strExtInfo);
            sw.WriteLine("ExtInfo.code : " + ExtInfo.code);
            sw.WriteLine("\n------------------------------------------------------------------------\n");
            sw.Flush();
            sw.Close();

        }
        catch (Exception e)
        {
            string strError = "";
            DAL.Common.WriteErrorLog(e, strError);
        }
        return result;
    }

    public string GetSocketFile(string strSend, string FileName)
    {
        string strDatas = "";
        string strResult = "";
        string strExtLength = "";
        try
        {
            //Socket连接
            SocketConnect();
            //发送信息
            SocketSend(strSend);
            //接收服务器的信息
            strResult = SocketReceiveFile(FileName);
            //获取扩展信息的长度
            //strExtLength = strResult.Substring(16, 12);
            //int ExtLength = Convert.ToInt32(strExtLength);
            //扩展信息,暂不使用
            //string strExtInfo = strResult.Substring(32, ExtLength);
            //获取包体的内容
            //strDatas = strResult.Substring(ExtLength + 32);
        }
        catch (Exception e)
        {
            string strError = "";
            strError += "\r\n strResult = " + strResult;
            strError += "\r\n strExtLength = " + strExtLength;
            DAL.Common.WriteErrorLog(e, strError);
            strDatas = "";
        }
        return strDatas;
    }




    public byte[] bytesReceived { get; set; }
}

}
MODEL完整代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MODEL
{
public enum ClientEditionEnum
{
Enterprise,//企业版
Personal,//个人版
Internal,//内部版
None,//error
}

/// <summary>
/// 授权文件内容
/// </summary>
public class AuthorizeFileInfo
{
    public string startTime { get; set; }
    public string expiryTime { get; set; }
    public string licenseID { get; set; }
    public string licensePassword { get; set; }
    public string terminalID { get; set; }
    public string customName { get; set; }
    public string customID { get; set; }
    public AuthorizeFileInfo()
    {
        startTime = "";
        expiryTime = "";
        licenseID = "";
        licensePassword = "";
        terminalID = "";
        customName = "";
        customID = "";
    }
}

/// <summary>
/// 通用返回值
/// </summary>
/// 
public class CommonResult
{
    public string code { get; set; }
    public string message { get; set; }
    public CommonResult()
    {
        code = "";
        message = "";
    }
}

public class EnterpriseConfirmAuthorizeDatas
{
    public string sessionID { get; set; }
    public EnterpriseConfirmAuthorizeDatas()
    {
        sessionID = "";
    }
}

/// <summary>
/// 企业版授权校验接口
/// </summary>
public class EnterpriseConfirmAuthorizeResult
{
    public string code { get; set; }
    public string message { get; set; }
    public EnterpriseConfirmAuthorizeDatas datas { get; set; }
    public EnterpriseConfirmAuthorizeResult()
    {
        code = "";
        message = "";
        datas = new EnterpriseConfirmAuthorizeDatas();
    }
}

public class PersonalConfirmAuthorizeDatas
{
    public string sessionID { get; set; }
    public string licenseInfo { get; set; }
    public PersonalConfirmAuthorizeDatas()
    {
        sessionID = "";
        licenseInfo = "";
    }
}

/// <summary>
/// 个人版授权校验接口
/// </summary>
public class PersonalConfirmAuthorizeResult
{
    public string code { get; set; }
    public string message { get; set; }
    public PersonalConfirmAuthorizeDatas datas { get; set; }
    public PersonalConfirmAuthorizeResult()
    {
        code = "";
        message = "";
        datas = new PersonalConfirmAuthorizeDatas();
    }
}

/// <summary>
/// 鉴权信息,每次调用安全接口时使用
/// </summary>
public class LicInfo
{
    public string licenseID { get; set; }
    public string licensePassword { get; set; }
    public string terminalID { get; set; }
    public string deviceID { get; set; }
    public string sessionID { get; set; }
    public LicInfo()
    {
        licenseID = "";
        licensePassword = "";
        terminalID = "";
        deviceID = "";
        sessionID = "";
    }
}

/// <summary>
/// java引擎的参数
/// </summary>
public class JavaEngineArg
{
    public string licenseID { get; set; }
    public string licensePassword { get; set; }
    public string terminalID { get; set; }
    public string customName { get; set; }
    public string customID { get; set; }
    public string deviceID { get; set; }
    public JavaEngineArg()
    {
        licenseID = "";
        licensePassword = "";
        terminalID = "";
        customName = "";
        customID = "";
        deviceID = "";
    }
}

/// <summary>
/// 用户登录接口(一),非安全接口
/// </summary>
/// 
public class UserInfoUnSafe
{
    public string userID { get; set; }
    public string userName { get; set; }
    public string departmentName { get; set; }
    public UserInfoUnSafe()
    {
        userID = "";
        userName = "";
        departmentName = "";
    }
}

public class UserLoginUnSafe
{
    public string code { get; set; }
    public string message { get; set; }
    public UserInfoUnSafe datas { get; set; }
    public UserLoginUnSafe()
    {
        code = "";
        message = "";
        datas = new UserInfoUnSafe();
    }
}

/// <summary>
/// 个人版用户登录接口,非安全接口
/// </summary>
/// 
public class UserInfoForPersonal
{
    public string userID { get; set; }
    public string userName { get; set; }
    public string departmentName { get; set; }
    public string licenseInfo { get; set; }
    public UserInfoForPersonal()
    {
        userID = "";
        userName = "";
        departmentName = "";
        licenseInfo = "";
    }
}

public class UserLoginForPersonal
{
    public string code { get; set; }
    public string message { get; set; }
    public UserInfoForPersonal datas { get; set; }
    public UserLoginForPersonal()
    {
        code = "";
        message = "";
        datas = new UserInfoForPersonal();
    }
}

/// <summary>
/// 用户登录接口(二),安全接口
/// </summary>
/// 
public class UserInfoSafe
{
    public string userSessionID { get; set; }
    public string userID { get; set; }
    public string userName { get; set; }
    public string departmentName { get; set; }
    public string activeTime { get; set; }
    public UserInfoSafe()
    {
        userSessionID = "";
        userID = "";
        userName = "";
        departmentName = "";
        activeTime = "";
    }
}

public class UserLoginSafe
{
    public string code { get; set; }
    public string message { get; set; }
    public UserInfoSafe datas { get; set; }
    public UserLoginSafe()
    {
        code = "";
        message = "";
        datas = new UserInfoSafe();
    }
}

/// <summary>
/// 更新检查接口
/// </summary>
/// 
public class SingleVersion
{
    public string softID { get; set; }
    public int version { get; set; }
    public SingleVersion()
    {
        softID = "";
        version = new int();
    }
}

public class Versions
{
    public List<SingleVersion> versions { get; set; }
    public Versions()
    {
        versions = new List<SingleVersion>();
    }
}

public class VersionUpdate
{
    public string softID { get; set; }
    public int version { get; set; }
    public string url { get; set; }
    public VersionUpdate()
    {
        softID = "";
        version = new int();
        url = "";
    }
}

public class VersionCheck
{
    public string code { get; set; }
    public string message { get; set; }
    public List<VersionUpdate> datas { get; set; }
    public VersionCheck()
    {
        code = "";
        message = "";
        datas = new List<VersionUpdate>();
    }
}


/// <summary>
/// 数据源信息查询接口
/// </summary>
/// 
public class OptInfoQuery
{
    public string createUserID { get; set; }
    public string createUserName { get; set; }
    public string createUserTime { get; set; }

    public OptInfoQuery()
    {
        createUserID = "";
        createUserName = "";
        createUserTime = "";
    }
}

public class Period
{
    public int cycle { get; set; }
    public int cycleUnit { get; set; }
    public string timer { get; set; }
    public Period()
    {
        cycle = 1;
        cycleUnit = 1;
        timer = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
    }
}

public class StrategyConfig
{
    public int backType { get; set; }
    public int taskType { get; set; }
    public Period config { get; set; }
    public StrategyConfig()
    {
        backType = 0;
        taskType = 1;
        config = new Period();
    }
}
public class FilterFileSuffix
{
    public string suffix { get; set; }

    public FilterFileSuffix()
    {
        suffix = "";
    }
}

public class Scan
{
    public int scanType { get; set; }
    public string root { get; set; }
    public bool scanHideFile { get; set; }
    public string verifyCompleteName { get; set; }
    public int verifyCompleteMaxCount { get; set; }
    public int verifyCompleteTimer { get; set; }
    public string fileAttrGainer { get; set; }
    public bool recordCanNotReadFileInfo { get; set; }
    public bool recordEmptyDirectory { get; set; }
    public bool recordEmptyFile { get; set; }
    public List<FilterFileSuffix> filterFileSuffix { get; set; }
    public Scan()
    {
        scanType = 2;
        root = "";
        scanHideFile = false;
        verifyCompleteName = "";
        verifyCompleteMaxCount = 5;
        verifyCompleteTimer = 10000;
        fileAttrGainer = "null";
        recordCanNotReadFileInfo = false;
        recordEmptyDirectory = false;
        recordEmptyFile = false;
        filterFileSuffix = new List<FilterFileSuffix>();
    }
}

public class DataSourceConfigQuery
{
    public int status { get; set; }
    public int dataSourceType { get; set; }
    public string dataSourceID { get; set; }
    public string dataSourceName { get; set; }
    public string dataSourceDescription { get; set; }
    public Scan config { get; set; }
    public DataSourceConfigQuery()
    {
        status = 0;
        dataSourceType = 0;
        dataSourceID = "";
        dataSourceName = "";
        dataSourceDescription = "";
        config = new Scan();
    }
}

public class DatasQuery
{
    public OptInfoQuery optInfo { get; set; }
    public StrategyConfig strategyConfig { get; set; }
    public DataSourceConfigQuery dataSourceConfig { get; set; }
    public DatasQuery()
    {
        optInfo = new OptInfoQuery();
        strategyConfig = new StrategyConfig();
        dataSourceConfig = new DataSourceConfigQuery();
    }
}

public class DataSourceInfoQuery
{
    public string code { get; set; }
    public string message { get; set; }
    public List<DatasQuery> datas { get; set; }
    public DataSourceInfoQuery()
    {
        code = "";
        message = "";
        datas = new List<DatasQuery>();
    }
}

public class WebSite
{
    public string ExpirationTime { get; set; }
    public string WebSiteSpace { get; set; }
    public bool DataBaseEnable { get; set; }
    public string DataBaseUserName { get; set; }
    public string DataBasePassword { get; set; }
    public string DataBaseMark { get; set; }
    public string WebSiteAdmin { get; set; }
    public string WebSitePassword { get; set; }
    public WebSite()
    {
        ExpirationTime = "";
        WebSiteSpace = "";
        DataBaseEnable = false;
        DataBaseUserName = "";
        DataBasePassword = "";
        DataBaseMark = "";
        WebSiteAdmin = "";
        WebSitePassword = "";
    }
}

public class WebSiteDatasQuery
{
    public OptInfoQuery optInfo { get; set; }
    public StrategyConfig strategyConfig { get; set; }
    public DataSourceConfigQuery dataSourceConfig { get; set; }
    public WebSite webSiteConfig { get; set; }
    public WebSiteDatasQuery()
    {
        optInfo = new OptInfoQuery();
        strategyConfig = new StrategyConfig();
        dataSourceConfig = new DataSourceConfigQuery();
        webSiteConfig = new WebSite();
    }
}

public class WebSiteDataSourceInfoQuery
{
    public string code { get; set; }
    public string message { get; set; }
    public List<WebSiteDatasQuery> datas { get; set; }
    public WebSiteDataSourceInfoQuery()
    {
        code = "";
        message = "";
        datas = new List<WebSiteDatasQuery>();
    }
}

/// <summary>
/// 新增数据源接口
/// </summary>
/// 
public class OptInfoNew
{
    public bool forceFlag { get; set; }
    public OptInfoNew()
    {
        forceFlag = true;
    }
}

public class DataSourceConfigNew
{
    public int dataSourceType { get; set; }
    public string dataSourceName { get; set; }
    public string dataSourceDescription { get; set; }
    public Scan config { get; set; }
    public DataSourceConfigNew()
    {
        dataSourceType = 0;
        dataSourceName = "";
        dataSourceDescription = "";
        config = new Scan();
    }
}

public class DataSourceNew
{
    public OptInfoNew optInfo { get; set; }
    public StrategyConfig strategyConfig { get; set; }
    public DataSourceConfigNew dataSourceConfig { get; set; }
    public DataSourceNew()
    {
        optInfo = new OptInfoNew();
        strategyConfig = new StrategyConfig();
        dataSourceConfig = new DataSourceConfigNew();
    }
}

/// <summary>
/// 修改数据源接口
/// </summary>
/// 
public class DataSourceModify
{
    public StrategyConfig strategyConfig { get; set; }
    public DataSourceConfigQuery dataSourceConfig { get; set; }
    public DataSourceModify()
    {
        strategyConfig = new StrategyConfig();
        dataSourceConfig = new DataSourceConfigQuery();
    }
}

/// <summary>
/// 停用/启用数据源接口
/// </summary>
/// 
public class DataSourceStatus
{
    public string dataSourceID { get; set; }
    public int optType { get; set; }
    public DataSourceStatus()
    {
        dataSourceID = "";
        optType = new int();
    }
}

/// <summary>
/// 数据源数据,仅用于存放数据
/// </summary>
/// 
public class DataSourceData
{
    public List<DatasQuery> datas { get; set; }
    public DataSourceData()
    {
        datas = new List<DatasQuery>();
    }
}

/// <summary>
/// WebSite数据源数据,仅用于存放数据
/// </summary>
/// 
public class WebSiteDataSourceData
{
    public List<WebSiteDatasQuery> datas { get; set; }
    public WebSiteDataSourceData()
    {
        datas = new List<WebSiteDatasQuery>();
    }
}

/// <summary>
/// 文件恢复,版本查询
/// </summary>
/// 
public class DataSourceVersionArg
{
    // 通讯令牌
    public string secretKey { get; set; }//由token进过MD5->BASE64->MD5获得
    // 任务令牌
    public string token { get; set; }//客户端生成一个UUID
    // 前置机编号
    public string terminalId { get; set; }
    // 操作用户编号
    public string optUserID { get; set; }

    public DataSourceVersionArg()
    {
        secretKey = "";
        token = "";
        terminalId = "";
        optUserID = "";
    }
}

public class FileVersions
{
    public int file_count { get; set; }
    public long space_size { get; set; }
    public string task_id { get; set; }
    public string task_time { get; set; }
    public int total_count { get; set; }
    public string version { get; set; }
    public FileVersions()
    {
        file_count = new int();
        space_size = new long();
        task_id = "";
        task_time = "";
        total_count = new int();
        version = "";
    }
}

public class DataSourceVersion
{
    public Scan datasourceConfig { get; set; }
    public string datasourceId { get; set; }
    public string datasourceName { get; set; }
    public int datasourceStatus { get; set; }
    public int datasourceType { get; set; }
    public List<FileVersions> versions { get; set; }
    public DataSourceVersion()
    {
        datasourceConfig = new Scan();
        datasourceId = "";
        datasourceName = "";
        datasourceStatus = new int();
        datasourceType = new int();
        versions = new List<FileVersions>();
    }
}

/// <summary>
/// 查询数据源接口
/// </summary>
public class DataSourceVersionQuery
{
    public string code { get; set; }
    public string message { get; set; }
    public List<DataSourceVersion> datas { get; set; }
    public DataSourceVersionQuery()
    {
        code = "";
        message = "";
        datas = new List<DataSourceVersion>();
    }
}

/// <summary>
/// 数据源版本信息
/// </summary>
public class DataSourceVersionDatas
{
    public List<DataSourceVersion> datas { get; set; }
    public DataSourceVersionDatas()
    {
        datas = new List<DataSourceVersion>();
    }
}

/// <summary>
/// 文件恢复,文件信息查询
/// </summary>
/// 
public class QueryFileInfoArg
{
    // 通讯令牌
    public string secretKey { get; set; }//由token进过MD5->BASE64->MD5获得
    // 任务令牌
    public string token { get; set; }//客户端生成一个UUID
    // 数据源编号
    public string datasourceId { get; set; }
    // 操作用户编号
    public string optUserID { get; set; }
    // 目录文件编号--如果为根目录使用 DS_ROOT
    public string fileID { get; set; }
    // 查询的版本编号  如果是综合分析  这个字段设置为 ALL
    public string taskID { get; set; }

    public QueryFileInfoArg()
    {
        secretKey = "";
        token = "";
        datasourceId = "";
        optUserID = "";
        fileID = "";
        taskID = "";
    }
}

public class FileInfoCondition
{
    public string datasourceId { get; set; }
    public string parentId { get; set; }
    public string taskID { get; set; }
    public FileInfoCondition()
    {
        datasourceId = "";
        parentId = "";
        taskID = "";
    }
}

public class FileInfo
{
    // 文件唯一编号
    public string file_id { get; set; }
    // 源相对目录
    public string file_src_path { get; set; }
    // 文件名
    public string file_name { get; set; }
    // 文件后缀
    public string file_suffix { get; set; }
    // 是否为文件
    public bool is_file { get; set; }
    // 上级文件编号
    public string parent_id { get; set; }
    // 是否删除
    public bool is_del { get; set; }
    // 是否隐藏
    public bool is_hide { get; set; }
    // 文件大小
    public int size { get; set; }
    // 文件创建时间
    public string create_time { get; set; }
    // 文件创建人
    public string create_user { get; set; }
    // 文件最后修改时间
    public string lm_time { get; set; }
    // 文件最后修改人
    public string lm_user { get; set; }
    // 是否可读
    public bool can_read { get; set; }

    public FileInfo()
    {
        file_id = "";
        file_src_path = "";
        file_name = "";
        file_suffix = "";
        is_file = new bool();
        parent_id = "";
        is_del = new bool();
        is_hide = new bool();
        size = new int();
        create_time = "";
        create_user = "";
        lm_time = "";
        lm_user = "";
        can_read = new bool();
    }
}

public class FileInfoAndCondition
{
    public FileInfoCondition condition { get; set; }
    public List<FileInfo> fileInfos { get; set; }
    public FileInfoAndCondition()
    {
        condition = new FileInfoCondition();
        fileInfos = new List<FileInfo>();
    }
}

/// <summary>
/// 查询文件信息接口
/// </summary>
public class FileInfoQuery
{
    public string code { get; set; }
    public string message { get; set; }
    public FileInfoAndCondition datas { get; set; }
    public FileInfoQuery()
    {
        code = "";
        message = "";
        datas = new FileInfoAndCondition();
    }
}

/// <summary>
/// 文件信息
/// </summary>
public class FileInfoData
{
    public List<FileInfo> datas { get; set; }
    public FileInfoData()
    {
        datas = new List<FileInfo>();
    }
}

public class QueryFileTrackArg
{
    // 通讯令牌
    public string secretKey { get; set; }//由token进过MD5->BASE64->MD5获得
    // 任务令牌
    public string token { get; set; }//客户端生成一个UUID
    // 文件编号
    public string fileID { get; set; }
    // 操作用户编号
    public string optUserID { get; set; }
    // 查询的版本编号
    public string taskID { get; set; }

    public QueryFileTrackArg()
    {
        secretKey = "";
        token = "";
        fileID = "";
        optUserID = "";
        taskID = "";
    }
}

public class FileTrack
{
    // 文件操作
    public string act_cmd { get; set; }
    // 是否可读
    public bool can_read { get; set; }
    // 文件创建时间
    public string create_time { get; set; }
    // 文件创建人
    public string create_user { get; set; }
    // 是否删除
    public bool is_del { get; set; }
    // 是否隐藏
    public bool is_hide { get; set; }
    // 文件最后修改时间
    public string lm_time { get; set; }
    // 文件最后修改人
    public string lm_user { get; set; }
    // 文件大小
    public int size { get; set; }
    public string taskID { get; set; }

    public FileTrack()
    {
        act_cmd = "";
        can_read = new bool();
        create_time = "";
        create_user = "";
        is_del = new bool();
        is_hide = new bool();
        lm_time = "";
        lm_user = "";
        size = new int();
        taskID = "";
    }
}

public class FileTrackCondition
{
    public string fileID { get; set; }
    public string taskID { get; set; }
    public FileTrackCondition()
    {
        fileID = "";
        taskID = "";
    }
}

/// <summary>
/// 查询文件轨迹接口
/// </summary>
public class FileTrackQuery
{
    public string code { get; set; }
    public string message { get; set; }
    public FileTrackCondition condition { get; set; }
    public List<FileTrack> datas { get; set; }

    public FileTrackQuery()
    {
        code = "";
        message = "";
        condition = new FileTrackCondition();
        datas = new List<FileTrack>();
    }
}

/// <summary>
/// 文件轨迹
/// </summary>
public class FileTrackData
{
    public List<FileTrack> datas { get; set; }
    public FileTrackData()
    {
        datas = new List<FileTrack>();
    }
}

/// <summary>
/// 字典item
/// </summary>
public class DictionaryData
{
    public string version { get; set; }
    public string task_time { get; set; }
    public DictionaryData()
    {
        version = "";
        task_time = "";
    }
}

public class FileRecoverArg
{
    // 通讯令牌
    public string secretKey { get; set; }//由token进过MD5->BASE64->MD5获得
    // 任务令牌
    public string token { get; set; }//客户端生成一个UUID
    // 操作用户编号
    public string optUserID { get; set; }

    public string fileID { get; set; }
    public string taskID { get; set; }
    public string password { get; set; }

    public FileRecoverArg()
    {
        secretKey = "";
        token = "";
        optUserID = "";
        fileID = "";
        taskID = "";
        password = "";
    }
}

}

  • 写回答

2条回答 默认 最新

  • threenewbee 2015-09-16 14:14
    关注

    你的图是另一个问题,你转到定义看不到这些函数的定义,因为找不到dll

    报了一个错误,非静态字段、方法或属性DAL.socket.GetSocketData(string)“要求对象引用。如何修改
    这个是因为你在静态方法中调用成员方法,要么你把那个方法也定义成static,要么你先new 一个对象,再调用

    评论

报告相同问题?

悬赏问题

  • ¥15 彩灯控制电路,会的加我QQ1482956179
  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出
  • ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
  • ¥15 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件
  • ¥15 visual studio2022中文乱码无法解决
  • ¥15 关于华为5g模块mh5000-31接线问题
  • ¥15 keil L6007U报错