コード例 #1
0
        public void Rename(IFile file, string newName)
        {
            var callLog = Log.Call();

            try
            {
                var path = Path.Combine(_serverPaths.FullContentPath(AdamContext.Site.ContentPath), file.Path);

                var currentFilePath = Path.Combine(path, file.FullName);
                if (TryToRenameFile(newName, currentFilePath, path))
                {
                    return;
                }

                var dnnFile = OqtFileRepository.GetFile(file.AsOqt().SysId);
                dnnFile.Name = newName;
                OqtFileRepository.UpdateFile(dnnFile);
                Log.Add($"VirtualFile {dnnFile.FileId} renamed to {dnnFile.Name}");

                callLog("ok");
            }
            catch (Exception e)
            {
                callLog($"Error:{e.Message}; {e.InnerException}");
            }
        }
コード例 #2
0
        public void Delete(IFile file)
        {
            var callLog = Log.Call();
            var dnnFile = OqtFileRepository.GetFile(file.AsOqt().SysId);

            OqtFileRepository.DeleteFile(dnnFile.FileId);
            callLog("ok");
        }
コード例 #3
0
        //public int MaxUploadKb()
        //    => (ConfigurationManager.GetSection("system.web/httpRuntime") as HttpRuntimeSection)
        //       ?.MaxRequestLength ?? 1;

        #endregion

        #region Files

        public File <int, int> GetFile(int fileId)
        {
            var file = OqtFileRepository.GetFile(fileId);

            return(OqtToAdam(file));
        }