private void SyncOKbutton_Click(object sender, RoutedEventArgs e) { //최신 목록을 만들어 ㄱㄱ mw.stop(); Entry currentEntry = new Entry(); currentEntry.setRoot(mw.defaultPath); currentEntry.buildEntry(); currentEntry.Root.File.FileId = mw.entry.Root.File.FileId; Entry.compareEntry(mw.entry, currentEntry); foreach (DictionaryEntry k in Entry.metaTable) { if (!currentEntry.Meta.Contains(k.Key)) currentEntry.Meta.Add(k.Key, k.Value); } mw.Request.syncStart(mw.Request.userID, mw.Request.aKey); ContentManager.EntryElement[] fileList = mw.Request.getAllFileList(mw.userID, mw.userToken); Entry entry2 = Entry.buildEntryFromFileList(currentEntry, fileList); Entry.mergeEntry(entry2, currentEntry, mw.Request); mw.Request.syncEnd(mw.Request.userID, mw.Request.aKey); mw.entry = currentEntry; mw.play(); this.Close(); //((EntryElement)main.entry.Root.Children[0]).File.Parent = entry2.Root.FID; //main.Request.uploadFile(main.userID, main.userToken, main.entry, ((EntryElement)main.entry.Root.Children[0]).File); }
public static Entry buildEntryFromFileList(Entry entry, EntryElement[] fileList) { if (fileList.Length > 0) { Entry newEntry = new Entry(); newEntry.setRoot(fileList[0]); entry.Root.File.FileId = newEntry.Root.File.FileId; for (int i = 1; i < fileList.Length; i++) { EntryElement parent = EntryElement.findParent(newEntry.Root, fileList[i]); parent.addChild(entry, fileList[i]); } return newEntry; } return null; }