Beispiel #1
0
        public int CompareTo(SegmentIndex other)
        {
            int partCompare = PartIndex.CompareTo(other.PartIndex);

            if (partCompare != 0)
            {
                return(partCompare);
            }

            return(LocalIndex.CompareTo(other.LocalIndex));
        }
Beispiel #2
0
 public void AddPartIndex(PartIndex idx, PartIdType partIdType)
 {
     if (partIdType == PartIdType.SHEETNUMBER)
     {
         SheetNumberPartIndicies.Add(idx);
     }
     else
     {
         SheetNamePartIndicies.Add(idx);
     }
 }
Beispiel #3
0
        public async Task <string> SaveAs(bool overwrite = false, bool autoCreateDirectory = true)
        {
            var rootDir     = UploadId.ToString("N");
            var destination = Path.Combine(_uploadDir, DateTime.Now.ToString("yyyyMM"),
                                           rootDir.Substring(00, 02), rootDir.Substring(02, 03),

                                           /** OPTIONAL
                                           ** keep the files send with same uploadId
                                           ** united in the same folder
                                           ** rootDir.Substring(05, 27),
                                           ***/UUI.ToString("N"));

            if (!JoinFiles)
            {
                var directory = new DirectoryInfo(destination);
                destination = Path.Combine(destination, PartIndex.ToString("0000000000"));
                if (autoCreateDirectory)
                {
                    directory.Create();
                }
                using (var file = new FileStream(destination, overwrite ? FileMode.OpenOrCreate : FileMode.CreateNew))
                {
                    await InputStream.CopyToAsync(file);
                }
                if (TotalParts == 0)
                {
                    var moveTo = Path.Combine(directory.FullName, Filename);
                    File.Move(destination, moveTo);
                    destination = moveTo;
                }
            }
            else
            {
                destination = await JoinFilesInOne(destination);
            }
            return(destination);
        }