示例#1
1
文件: Node.cs 项目: Baks84/RepRest
 public NodeKeys(MegaApi.DataTypes.NodeKeys nk)
 {
     this.DecryptedKey = nk.DecryptedKey;
     this.EncryptedKey = nk.EncryptedKey;
     this.Keys = nk.Keys;
 }
示例#2
0
文件: User.cs 项目: Baks84/RepRest
 public User(MegaApi.MegaUser mu)
 {
     this.Email = mu.Email;
     this.Id = mu.Id;
     this.NodeSid = mu.NodeSid;
     this.PassKey = mu.PassKey;
     this.PrivateKey = mu.PrivateKey;
     this.PublicKey = mu.PublicKey;
     this.Sid = mu.Sid;
     this.Status = mu.Status;
 }
示例#3
0
文件: Node.cs 项目: Baks84/RepRest
 public Node(MegaApi.MegaNode mn)
     : base()
 {
     this.Attributes = mn.Attributes;
     this.encryptedAttributes = mn.encryptedAttributes;
     this.Id = mn.Id;
     this.NodeKey = mn.NodeKey;
     this.ParentId = mn.ParentId;
     this.Size = mn.Size;
     this.Timestamp = mn.Timestamp;
     this.Type = mn.Type;
     this.UserId = mn.UserId;
 }
示例#4
0
文件: Node.cs 项目: Baks84/RepRest
 public NodeAttributes(MegaApi.DataTypes.NodeAttributes na)
 {
     this.Name = na.Name;
 }
示例#5
0
 public UserQuota(MegaApi.DataTypes.UserQuota uq)
 {
     this.Quota = uq.Max_Quota;
     this.Used = uq.Used_Quota;
 }
示例#6
0
 private void OnInitSuccess(MegaApi.Mega m)
 {
     client = m;
     ErrorNb = 0;
 }
示例#7
0
        void HandleServerRequest(object sender, MegaApi.Comms.ServerRequestArgs e)
        {
            if (refreshing) { return; }
            lock (serverNodes)
            {
                bool updates = false;
                bool needRefresh = false;
                foreach (var command in e.commands)
                {
                    if (command.IsMine) { continue; }
                    switch (command.Command)
                    {
                        case ServerCommandType.NodeAddition:
                            var ca = (NodeAdditionCommand)command;
                            var added = new List<MegaNodeHelper>();
                            foreach(var n in ca.Nodes)
                            {
                                if (IsInsideWorkingRoot(n))
                                {
                                    if (n.Type == MegaNodeType.Folder) { needRefresh = true; break; }
                                    else
                                    {
                                        added.Add(HelperFromNode(n));
                                        updates = true;
                                    }
                                }
                            }
                            serverNodes.AddRange(added);
                            break;
                        case ServerCommandType.NodeDeletion:
                            var cd = (NodeDeletionCommand)command;
                            var condemned = serverNodes.Where(n => n.Node.Id == cd.NodeId).FirstOrDefault();
                            if (condemned != null)
                            {
                                if (condemned.Node.Type == MegaNodeType.Folder) { needRefresh = true; }
                                else
                                {
                                    serverNodes.Remove(condemned);
                                    updates = true;
                                }
                            }
                            break;
                        case ServerCommandType.NodeUpdation:
                            var cu = (NodeUpdationCommand)command;
                            {
                                var updating = serverNodes.Where(n => n.Node.Id == cu.NodeId).FirstOrDefault();
                                if (updating != null)
                                {
                                    if (updating.Node.Type == MegaNodeType.Folder) { needRefresh = true; }
                                    else
                                    {
                                        updating.Node.Attributes = cu.Attributes;
                                        updates = true;
                                    }
                                }
                            }
                            break;
                        default:
                            break;
                    }
                    if (needRefresh) { break; }
                }

                if (needRefresh) { RefreshNodeList(); }
                else if (updates) { OnUpdated(); }
            }
        }