Esempio n. 1
0
        /// <summary>
        /// Gets a handle for the specified file or folder.
        /// </summary>
        public GoogleDriveHandle GetHandle(string path)
        {
            Ensure.NotNull(path, "path");

            var segments = GoogleDrivePath.Split(path);

            if (segments.Length == 0 || path.EqualsOrdIgnoreCase(ROOT))
            {
                var root = GetItemInfoById(ROOT);
                return(root);
            }

            var queue = new Queue <string>(segments);

            if (IsRoot(segments[0]))
            {
                queue.Dequeue();
            }

            var info = GetItemInfo(ROOT, queue);

            if (info == null)
            {
                return(null);
            }

            var handle = new GoogleDriveHandle(info);

            return(handle);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a file
        /// </summary>
        public GoogleDriveHandle CreateFile(string parentId, string name)
        {
            Ensure.NotNull(parentId, "parentId");

            var body = new GoogleDriveRequestBody();

            body.SetTitle(name);
            body.SetParent(parentId);

            var res = Post(ApiUrls.Files(), body);

            var handle = new GoogleDriveHandle(res.Data);

            return(handle);
        }
Esempio n. 3
0
 public GoogleDriveStream(FileSystemFile file, Action<FileSystemStream> disposeAction)
     : base(file, disposeAction)
 {
     m_Handle = (GoogleDriveHandle)file.Handle;
     m_Session = file.Session as GoogleDriveSession;
 }
Esempio n. 4
0
        /// <summary>
        /// Gets a handle for the specified file or folder.
        /// </summary>
        public GoogleDriveHandle GetHandle(string path)
        {
          Ensure.NotNull(path, "path");

          var segments = GoogleDrivePath.Split(path);

          if (segments.Length == 0 || path.EqualsOrdIgnoreCase(ROOT))
          {
            var root = GetItemInfoById(ROOT);
            return root;
          }

          var queue = new Queue<string>(segments);

          if (IsRoot(segments[0]))
          {
            queue.Dequeue();
          }

          var info = GetItemInfo(ROOT, queue);

          if (info == null)
          {
            return null;
          }

          var handle = new GoogleDriveHandle(info);

          return handle;
        }
Esempio n. 5
0
        /// <summary>
        /// Creates a file
        /// </summary>
        public GoogleDriveHandle CreateFile(string parentId, string name)
        {
          Ensure.NotNull(parentId, "parentId");

          var body = new GoogleDriveRequestBody();
          body.SetTitle(name);
          body.SetParent(parentId);

          var res = Post(ApiUrls.Files(), body);

          var handle = new GoogleDriveHandle(res.Data);

          return handle;
        }