public void GetSKFileInfoList_ByXmlFilePathTest()
        {
            string            XMLFileName = @"C:\Users\Administrator\Desktop\FileVerInfo.xml";
            List <SKFileInfo> sKFileInfos = FileOperat.GetSKFileInfoList_ByXmlFilePath(XMLFileName);

            Assert.AreEqual(sKFileInfos.Count, 1);
        }
        public void ContrastSKFileInfoTest()
        {
            //string XMLFileName = @"C:\Users\Administrator\Desktop\新建文件夹 (2)\FileVerInfo.xml";
            string            XMLFileName = @"C:\Users\Administrator\Desktop\FileVerInfo.xml";
            List <SKFileInfo> sKFileInfos = FileOperat.GetSKFileInfoList_ByXmlFilePath(XMLFileName);

            XMLFileName = @"C:\Users\Administrator\Desktop\FileVerInfo.xml";
            List <SKFileInfo> sKFileInfos1 = FileOperat.GetSKFileInfoList_ByXmlFilePath(XMLFileName);

            bool OK = FileOperat.ContrastSKFileInfo(sKFileInfos, sKFileInfos1);

            Assert.IsTrue(OK);
        }
        public void ContrastTest()
        {
            string            XMLFileName = @"C:\Users\hongdongcheng\Desktop\客户端远程功能更新包\FileVerInfo.xml";
            List <SKFileInfo> sKFileInfos = FileOperat.GetSKFileInfoList_ByXmlFilePath(XMLFileName);

            XMLFileName = @"C:\Users\hongdongcheng\Desktop\测试_接警客户端V3.1更新包_190927_01\FileVerInfo.xml";
            List <SKFileInfo> sKFileInfos1 = FileOperat.GetSKFileInfoList_ByXmlFilePath(XMLFileName);

            //List<SKFileInfo> AddOrUpList = new List<SKFileInfo>();
            //List<SKFileInfo> DelList = new List<SKFileInfo>();
            //FileOperat.ContrastSKFileInfo(sKFileInfos, sKFileInfos1, ref AddOrUpList, ref DelList);
            List <SKFileInfo> lstUpdateFile = FileOperat.ContrastSKFileInfo(sKFileInfos, sKFileInfos1, "path", new string[] { "modifytime" });

            Assert.AreEqual(sKFileInfos.Count, sKFileInfos.Count);
        }
        public void ContrastTest1()
        {
            string            XMLFileName = @"F:\SK3000\XiangYou_1\FileVerInfo.xml";
            List <SKFileInfo> sKFileInfos = FileOperat.GetSKFileInfoList_ByXmlFilePath(XMLFileName);

            XMLFileName = @"G:\Working\SK3000\Cu\InstallPackage\ReleaseFile_XY\FileVerInfo.xml";
            List <SKFileInfo> sKFileInfos1 = FileOperat.GetSKFileInfoList_ByXmlFilePath(XMLFileName);


            string Key = "path";

            string[] Contrast = { "modifytime" };

            List <SKFileInfo> returnList = FileOperat.ContrastSKFileInfo(sKFileInfos, sKFileInfos1, Key, Contrast);

            Assert.AreEqual(returnList.Count, 1);
        }
Example #5
0
        public void HFSHttpFileTest()
        {
            //先对比得出要添加或更新的东西
            string            XMLFileName = @"C:\Users\Administrator\Desktop\新建文件夹 (2)\FileVerInfo.xml"; //服务器上的XML文件
            List <SKFileInfo> sKFileInfos = FileOperat.GetSKFileInfoList_ByXmlFilePath(XMLFileName);

            XMLFileName = @"C:\Users\Administrator\Desktop\FileVerInfo.xml";  //本地的XML文件
            List <SKFileInfo> sKFileInfos1 = FileOperat.GetSKFileInfoList_ByXmlFilePath(XMLFileName);


            string Key = "name";

            string[] Contrasts = { "path", "fileversion", "size" };

            List <SKFileInfo> returnList = FileOperat.ContrastSKFileInfo(sKFileInfos, sKFileInfos1, Key, Contrasts);

            //获取HFS文件列表
            string strUrl       = "http://192.168.2.19:8008/SK3000ClientRemoteUpdate/Trunk"; //获取的链接
            string strLocalPath = @"C:\Users\Administrator\Desktop\新建文件夹 (4)";               //下载到本地的路径

            List <HFSDownLoadFileInfo> result = Common_Web.HFSHttpGetFileNameList(strUrl);

            //对比查出要下载的列表
            List <HFSDownLoadFileInfo> DownList = new List <HFSDownLoadFileInfo>();

            foreach (SKFileInfo SKFile in returnList)
            {
                foreach (HFSDownLoadFileInfo HFSFile in result)
                {
                    //if (SKFile.path.Replace(@".\", "").Replace(@"\", "/") == HFSFile.SaveName)
                    if (SKFile.path == HFSFile.SaveName)
                    {
                        HFSFile.SaveName = strLocalPath + "/" + HFSFile.SaveName;
                        HFSFile.DownName = strUrl + "/" + HFSFile.DownName;
                        DownList.Add(HFSFile);
                        break;
                    }
                }
            }

            //下载文件列表
            if (DownList != null && DownList.Count > 0)
            {
                bool bolResult = Common_Web.HFSHttpGetFile(DownList);
            }
        }