public InstallerFileInfo GetFileInfo(string folder, string fileName)
        {
            var path = Path.Combine(Globals.Destination, folder);

            fileName = Path.Combine(path, fileName);

            var info = files.Where(v => v.Name == fileName).FirstOrDefault();

            if (info == null)
            {
                info      = new InstallerFileInfo();
                info.Name = fileName;

                var fileInfo = new FileInfo(fileName);
                if (fileInfo.Exists)
                {
                    info.Hash       = ComputeHash(fileName);
                    info.ModifiedOn = fileInfo.LastWriteTimeUtc;
                    info.Size       = fileInfo.Length;
                }
                else
                {
                    info.Hash       = string.Empty;
                    info.ModifiedOn = DateTime.MinValue;
                    info.Size       = 0;
                }

                files.Add(info);
            }

            return(info);
        }
        public void UpdateCache()
        {
            var all = GetFiles(Globals.Destination);

            files.Clear();
            foreach (var fileName in all)
            {
                var info = new FileInfo(fileName);
                var file = new InstallerFileInfo();

                file.Path       = GetLocalPath(info.DirectoryName);
                file.Name       = info.Name;
                file.Size       = info.Length;
                file.ModifiedOn = info.LastWriteTimeUtc;
                file.Hash       = ComputeHash(fileName);

                files.Add(file);
            }

            var binary = Serializer.ToBinary(files);

            File.WriteAllBytes(Path.Combine(Globals.Destination, "Installer.dat"), binary);
        }
        public static InstallerFileInfo[] GetAllFiles()
        {
            if (fileList == null)
            {
                var query = DataQuery.Create("Application", "ws_InstallerProgram_List", new
                {
                    SolutionName = AppConfig.SolutionName
                });
                var ds    = Globals.Execute(query);
                var table = ds.FirstTable();
                if (table == null)
                {
                    fileList = new InstallerFileInfo[0];
                }
                else
                {
                    var list = new List <InstallerFileInfo>();
                    var rows = table.Select();
                    foreach (var row in rows)
                    {
                        var item = new InstallerFileInfo();
                        item.Path        = row["Path"] + "";
                        item.Name        = row["Name"] + "";
                        item.Extension   = row["Extension"] + "";
                        item.Hash        = row["Hash"] + "";
                        item.Version     = row["Version"] + "";
                        item.Size        = Convert.ToInt64(row["Size"]);
                        item.Description = row["Description"] + "";
                        item.ModifiedOn  = Convert.ToDateTime(row["ModifiedOn"]);
                        list.Add(item);
                    }
                    fileList = list.ToArray();
                }
            }

            return(fileList);
        }