コード例 #1
0
        public static void TestMethod()
        {
            //var path = @"E:\AfterRecFileDirector.exe -upload";
            //ProcessExtensions.StartProcessAsCurrentUser(path, out var pid);
            RVMCore.GoogleWarpper.GoogleDrive googleDrive = new RVMCore.GoogleWarpper.GoogleDrive();
            string uri  = "";
            string path = @"D:\迅雷下载\1.Bank\Learning\新求精德语初级1_mp3.rar";

            string getUri(bool force)
            {
                if (string.IsNullOrWhiteSpace(uri) || force)
                {
                    uri = googleDrive.GenerateUploadID(path, @"\");
                }
                return(uri);
            }

            googleDrive.UploadResumableAsync(path, getUri);
        }
コード例 #2
0
        /// <summary>
        /// Append an array after another array.
        /// </summary>
        /// <typeparam name="T">Array collection <see cref="Type"/>.</typeparam>
        /// <param name="source">Base array, index from 0.</param>
        /// <param name="array">Second array, index after base array's last item.</param>
        /// <returns>A full array.</returns>
        //public static void AppendArray2<T>(this ref T[] source, T[] array)
        //{
        //    if (source == null & array == null) return;
        //    if (source == null)
        //    {
        //        source = array;
        //        return;
        //    }

        //    if (array == null) return;
        //    int ltmp = source.Length;
        //    var tmp = source;
        //    Array.Resize(ref tmp, ltmp + array.Length);
        //    Array.Copy(array, 0, tmp, ltmp, array.Length);
        //    source = tmp;
        //}

        public static string GetFolderIDbyPath(string path)
        {
            var service = new RVMCore.GoogleWarpper.GoogleDrive();

            return(service.GetGoogleFolderByPath(path, false)?.Id);
        }