Ejemplo n.º 1
0
        public void UpdateFrom(String path)
        {
            //var uploadStream = System.IO.File.OpenRead(path);

            byte[] byteArray = System.IO.File.ReadAllBytes(path);
            System.IO.MemoryStream uploadStream = new System.IO.MemoryStream(byteArray);

            DriveFile body = new DriveFile();

            //body.Name = GoogleDriveFile.Name;
            //body.Parents = GoogleDriveFile.Parents;
            //body.MimeType = OriginalMimeType;
            //body.Id = ID;
            body.Description = "Test upload with Multisync!";

            var up = this.GDrive.Service().Files.Update(body,
                                                        ID, uploadStream, base.OriginalMimeType);

            up.Fields = "*";
            up.Upload();
            up.AddParents = GetParent()?.ID;


            var newFile = GDrive.GetFileById(up.FileId);

            this.GoogleDriveFile = newFile.GoogleDriveFile;

            uploadStream.Close();
            var res = up.ResponseBody;

            Multisync.App.ModifiedFileLog.Main.SetFileLastWriteTime(path, (DateTime)this.LastMod);
            // System.IO.File.SetLastWriteTime(path, (DateTime)newFile.LastMod);
        }
 static void Main(string[] args)
 {
     g         = new GDrive(ServiceType.Drive);
     Revisions = new List <Revision>();
     GetRevisions();
     RevisionPooling();
     Console.ReadKey();
 }
Ejemplo n.º 3
0
        private void TelaInicial_Load(object sender, EventArgs e)
        {
            GDrive drive = new GDrive();

            this.Loginlbl.Text = drive.getLogin();
            this.Datalbl.Text  = DateTime.Now.ToString();
            AtualizaHora();
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();
            g             = new GDrive(ServiceType.Drive);
            FileRevisions = new ObservableCollection <Revision>();
            win           = new winNotify();
            XmlDocument doc = new XmlDocument();

            doc.Load("conf.xml");
            fileID = doc.GetElementsByTagName("file-id")[0].InnerText.Trim();
            delay  = int.Parse(doc.GetElementsByTagName("delay")[0].InnerText.Trim());
        }