Exemplo n.º 1
0
        /// <summary>
        /// 获取本地升级文件列表
        /// </summary>
        /// <returns></returns>
        public static List <UpdateFileInfo> GetUpdateFileInfo()
        {
            List <UpdateFileInfo> listUpdateFileInfo = new List <UpdateFileInfo>();
            string fileDir = System.Configuration.ConfigurationManager.AppSettings["UpdateFilesDir"];

            string[] fileNames = Directory.GetFiles(fileDir);
            if (fileNames.Length > 0)
            {
                for (int i = 0; i < fileNames.Length; i++)
                {
                    UpdateFileInfo updateFileInfoBuff = new UpdateFileInfo();
                    FileInfo       fileInfo           = new FileInfo(fileNames[i]);
                    if (File.Exists(fileInfo.FullName))
                    {
                        updateFileInfoBuff.FileName   = fileInfo.Name;
                        updateFileInfoBuff.FileLength = fileInfo.Length;
                        updateFileInfoBuff.OffSet     = 0;
                        updateFileInfoBuff.FileMd5    = FileOpteration.GetFileMD5(fileInfo.FullName);
                        updateFileInfoBuff.FileDir    = fileInfo.FullName;
                        listUpdateFileInfo.Add(updateFileInfoBuff);
                    }
                }
            }
            return(listUpdateFileInfo);
        }
Exemplo n.º 2
0
        public string InfoExchangeAPI(string strMessageToWeService)
        {
            Log.WriteLog(strMessageToWeService);
            MessageToWebService messageToWebService = new MessageToWebService();
            string result = string.Empty;

            try
            {
                messageToWebService = Newtonsoft.Json.JsonConvert.DeserializeObject <MessageToWebService>(strMessageToWeService);
                result = FileOpteration.InformationExchange(messageToWebService);
                Log.WriteLog(result);
            }
            catch (Exception)
            {
                //throw;
                //return "";
            }
            return(result);
        }