Пример #1
0
        public static List <HashItem> ParseFromFileLineList(List <string> fileLine)
        {
            List <HashItem> lst = new List <HashItem>();

            foreach (var item in fileLine)
            {
                var tmp = new HashItem();
                tmp.ParseFromFileLine(item);
                lst.Add(tmp);
            }
            return(lst);
        }
Пример #2
0
        public static List <HashItem> GenerateHashFileStructure(string sourceFolder, List <string> sourceFiles)
        {
            var data = new List <HashItem>();

            foreach (var file in sourceFiles)
            {
                string diffName = FileHelper.RemoveBaseFolder(sourceFolder, file);
                byte[] fArray   = FileHelper.SafeFileRead(file);
                if (fArray == null)
                {
                    throw new IOException("Source file could not readed = " + file);
                }

                var tmpHsh = new HashItem(file, Hash512(fArray));
                data.Add(tmpHsh);
            }

            return(data);
        }
Пример #3
0
        private List <string> PrepareFileList(string sourceFolder, AutoDeploySetting setting, out List <HashItem> fileHashInfo)
        {
            bool isDiffDeployment = setting.Mode == AutoDeploySetting.KeyDiff;
            var  filteredFiles    = FindFilesandFilter(sourceFolder, setting);
            var  hfNewData        = HashOperationHelper.GenerateHashFileStructure(sourceFolder, filteredFiles);

            fileHashInfo = hfNewData;
            List <HashItem> oldhfData = new List <HashItem>();

            if (isDiffDeployment)
            {
                string oldFile = setting.DeployFolder + "\\" + KeyHashFileName;
                if (File.Exists(oldFile))
                {
                    oldhfData = HashItem.ParseFromFileLineList(FileHelper.SafeFileReadLines(oldFile));
                }
            }

            List <string> files = FindDeploymentFiles(sourceFolder, filteredFiles, hfNewData, oldhfData);

            return(files);
        }