Beispiel #1
0
        public static ResourceUri BuildUriForFile(FileUploadDescription fileDescription, ResourceUri sourceStoreFileUri, bool isFilePublic)
        {
            // if filesourcestoreuri==null then local uri
            // else if access is private then local uri
            // else if access is public and filesourcestoreuri!=null then filesourcestoreuri
            ResourceUri route    = null;
            string      localUri = string.Format("{0}{1}", ApplicationSettings.Routing.LocalFilesAccessBaseUri, fileDescription.Id);

            if (sourceStoreFileUri == null)
            {
                route = new ResourceUri(localUri);
            }
            else
            {
                if (!isFilePublic)
                {
                    route = new ResourceUri(localUri);
                }
                else
                {
                    route = sourceStoreFileUri;
                }
            }

            return(route);
        }
Beispiel #2
0
        public void MarkFileAsUploaded(Guid fileId)
        {
            if (!this.IsStarted)
            {
                throw new UploadSessionNotStartedException(Resources.Messages.Error_UploadSession_MarkFilesAsUploadedMethod_SessionIsNotStarted);
            }

            FileUploadDescription fileDescription = this.GetFileUploadDescription(fileId);

            fileDescription.MarkAsUploaded();

            this.AddChange(new UploadSessionFileMarkedAsUploaded(this.Id.ToString(), fileDescription.Id.ToString()));
        }
Beispiel #3
0
        public FileUploadDescription GetFileUploadDescription(Guid fileId)
        {
            if (this.IsNotStarted)
            {
                throw new UploadSessionNotStartedException(Resources.Messages.Error_UploadSession_GetFileUploadDescriptionMethod_SessioIsNotStarted);
            }

            FileUploadDescription fileDescription = (from file in this.InnerFileDescriptions
                                                     where file.Id == fileId
                                                     select file)
                                                    .SingleOrDefault();

            if (fileDescription == null)
            {
                throw new UploadSessionFileNotRegisteredException(fileId);
            }

            return(fileDescription);
        }