public void AVFile_File_From_String()
        {
            AVClient.Initialize("uay57kigwe0b6f5n0e1d4z4xhydsml3dor24bzwvzr57wdap", "kfgz7jjfsk55r5a8a3y4ttd3je1ko11bkibcikonk32oozww");
            AVClient.EnableDebugLog((obj) =>
            {
                Trace.WriteLine(obj);
            });
            byte[] data = System.Text.Encoding.UTF8.GetBytes("LeanCloud is great good wonderful great good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderfulgreat good wonderful!");
            AVFile file = new AVFile("resume.txt", data);

            file.SaveAsync().Wait();
        }
        public void AVFile_File_From_String_QCloud()
        {
            AVClient.Initialize("JXyR8vfpeSr8cfaYnob2zYl0-9Nh9j0Va", "Fgq2YlPdnP1KJEoWyF5tk2az");
            AVClient.EnableDebugLog((obj) =>
            {
                Trace.WriteLine(obj);
            });
            byte[] data = System.Text.Encoding.UTF8.GetBytes("LeanCloud is great!");
            AVFile file = new AVFile("resume.txt", data);

            file.SaveAsync().Wait();
        }
        public void AVFile_File_From_File_QCloud()
        {
            AVClient.Initialize("JXyR8vfpeSr8cfaYnob2zYl0-9Nh9j0Va", "Fgq2YlPdnP1KJEoWyF5tk2az");
            AVClient.EnableDebugLog((obj) =>
            {
                Trace.WriteLine(obj);
            });
            var ss         = Directory.GetCurrentDirectory();
            var path       = Path.Combine(ss, "Jay.mp3");
            var fileStream = new FileStream(path, FileMode.Open);

            // read from file or write to file
            AVFile file = new AVFile("Jay.mp3", fileStream);

            file.SaveAsync().Wait();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            AVClient.Initialize("3knLr8wGGKUBiXpVAwDnryNT-gzGzoHsz", "3RpBhjoPXJjVWvPnVmPyFExt");
            string filePath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "1.png");

            AVClient.EnableDebugLog(Console.WriteLine, true, true);
            try
            {
                var fileList = new List <AVFile>();
                for (int i = 0; i < 20; i++)
                {
                    AVFile file = CreateFileWithLocalPath(Path.GetFileName(filePath), filePath);
                    fileList.Add(file);
                }
                var done = 0;
                fileList.ForEach(x =>
                {
                    x.SaveAsync().Wait();
                    done++;
                    Console.WriteLine(done + ".done");
                });
                //AVFile file = CreateFileWithLocalPath(Path.GetFileName(filePath), filePath);

                //var task = file.SaveAsync();
                //task.Wait();
                //AVFile.GetFileWithObjectIdAsync("5836898c67f3560065f3038d").ContinueWith(t =>
                //{
                //    Console.WriteLine(t.Result.ObjectId);
                //}).Wait();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}");
            }

            Console.ReadKey();
        }