Ejemplo n.º 1
0
        /// <summary>
        /// Copies specified patch file from published directory to application directory.
        /// </summary>
        /// <param name="patchFile"></param>
        /// <returns></returns>
        public static bool Download(PatchFile patchFile)
        {
            if (patchFile == null)
            {
                return(false);
            }

            string serverPath           = null;
            string applicationPath      = null;
            string applicationDirectory = ApplicationStartupPath;

            serverPath = Path.Combine(patchFile.FilePath, patchFile.FileName);
            if (File.Exists(serverPath))
            {
                applicationPath = Path.Combine(applicationDirectory, patchFile.FileName);
                if (File.Exists(applicationPath))
                {
                    FileInfo fileInfo = new FileInfo(applicationPath);
                    if (fileInfo.IsReadOnly)
                    {
                        fileInfo.IsReadOnly = false;
                        fileInfo.Refresh();
                    }
                }
                File.Copy(serverPath, applicationPath, true);
            }
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads data from <c>OracleDataReader</c> instance and returns <c>PatchFile</c> instance.
        /// </summary>
        /// <param name="record"><c>OracleDataReader</c> instance to read.</param>
        /// <returns><c>PatchFile</c> instance.</returns>
        private static PatchFile FillDataRecord(IDataRecord record)
        {
            PatchFile patchFile = new PatchFile();

            if (!record.IsDBNull(record.GetOrdinal("SETUP_NO")))
            {
                patchFile.SetupNumber = (int)record.GetDecimal(record.GetOrdinal("SETUP_NO"));
            }
            patchFile.PatchId     = (int)record.GetDecimal(record.GetOrdinal("PATCH_ID"));
            patchFile.PatchFileId = (int)record.GetDecimal(record.GetOrdinal("PATCH_FILE_ID"));
            if (!record.IsDBNull(record.GetOrdinal("FILE_NAME")))
            {
                patchFile.FileName = record.GetString(record.GetOrdinal("FILE_NAME"));
            }
            if (!record.IsDBNull(record.GetOrdinal("FILE_VERSION")))
            {
                patchFile.Version = record.GetString(record.GetOrdinal("FILE_VERSION"));
            }
            if (!record.IsDBNull(record.GetOrdinal("FILE_PATH")))
            {
                patchFile.FilePath = record.GetString(record.GetOrdinal("FILE_PATH"));
            }
            return(patchFile);
        }