コード例 #1
0
 private static void UpdateFile(S3FileInfo file, AWSS3Object dbFile)
 {
     dbFile.FileModified = GetLastModifiedFromS3(file.FullName);
     dbFile.FileSize     = file.Length;
     dbFile.LastScanned  = scanTime;
     updated++;
 }
コード例 #2
0
        private static void ScanFile(S3FileInfo file)
        {
            if (scanned >= 5000)
            {
                SubmitBatch();
            }

            DateTime fileModified = new SqlDateTime(GetLastModifiedFromS3(file.FullName)).Value;

            // if file is already in database
            try
            {
                AWSS3Object dbFile = db.AWSS3Objects.Single(f => f.FileKey == file.FullName);

                // if file was modified, update database record
                if (!fileModified.Equals(dbFile.FileModified))
                {
                    UpdateFile(file, dbFile);
                }
                else
                {
                    dbFile.LastScanned = scanTime;
                }
            }
            catch (Exception e)
            {
                InsertFile(file);
            }
            scanned++;
        }
コード例 #3
0
        private static void InsertFile(S3FileInfo file)
        {
            AWSS3Object dbFile = new AWSS3Object()
            {
                FileKey         = file.FullName,
                FileName        = file.Name,
                FileModified    = GetLastModifiedFromS3(file.FullName),
                FileSize        = file.Length,
                WindowsFilePath = GetLocalNameFromS3(file.FullName),
                LastScanned     = scanTime
            };

            insertionList.Add(dbFile);
            inserted++;
        }
コード例 #4
0
 partial void DeleteAWSS3Object(AWSS3Object instance);
コード例 #5
0
 partial void UpdateAWSS3Object(AWSS3Object instance);
コード例 #6
0
 partial void InsertAWSS3Object(AWSS3Object instance);