コード例 #1
0
 public void DownloadFileFromCDN(string fileName)
 {
     if (BibaUtility.CheckForInternetConnection())
     {
         RetrieveAndWriteData(BibaContentConstants.GetRelativePath(fileName), BibaContentConstants.GetPersistedPath(fileName));
     }
 }
コード例 #2
0
 public void DownloadFilesFromCDN()
 {
     if (BibaUtility.CheckForInternetConnection())
     {
         ReloadContent();
         RetrieveAndWriteData(BibaContentConstants.GetRelativePath(BibaContentConstants.MANIFEST_FILENAME), BibaContentConstants.GetPersistedPath(BibaContentConstants.MANIFEST_FILENAME), ManifestRetrieved);
     }
 }
コード例 #3
0
        public bool ShouldDownloadOptionalFile(string fileName)
        {
            var localFilePath = BibaContentConstants.GetPersistedPath(fileName);

            if (!File.Exists(localFilePath))
            {
                return(true);
            }

            var localManifestLine = _localManifest.Lines.Find(line => line.FileName == fileName);

            if (localManifestLine == null)
            {
                return(true);
            }

            return(BibaUtility.GetHashString(localFilePath) != localManifestLine.HashCode);
        }
コード例 #4
0
        void ManifestRetrieved(string remoteManifestString)
        {
            if (string.IsNullOrEmpty(remoteManifestString))
            {
                return;
            }

            var remoteManifest = DataService.ReadFromDisk <BibaManifest>(BibaContentConstants.GetPersistedPath(BibaContentConstants.MANIFEST_FILENAME));

            if (remoteManifest != null && remoteManifest.TimeStamp > _localManifest.TimeStamp)
            {
                foreach (var remoteLine in remoteManifest.Lines)
                {
                    var localLine = _localManifest.Lines.Find(line => line.FileName == remoteLine.FileName);
                    if ((localLine == null || localLine.TimeStamp < remoteLine.TimeStamp) && !remoteLine.OptionalDownload)
                    {
                        RetrieveAndWriteData(BibaContentConstants.GetRelativePath(remoteLine.FileName), BibaContentConstants.GetPersistedPath(remoteLine.FileName));
                    }
                }
                _localManifest = remoteManifest;
            }
        }