/// <summary> /// Open a MEGA file link providing its decryption key. /// </summary> /// <param name="api">MegaSDK object that started the request</param> /// <param name="request">Information about the request.</param> /// <param name="decryptionKey">Decryption key of the link.</param> private void OpenLink(MegaSDK api, MRequest request, String decryptionKey) { // Get the used link only if the request type is for login to a folder link // or get a public node from a file link if (request.getType() == MRequestType.TYPE_LOGIN || request.getType() == MRequestType.TYPE_GET_PUBLIC_NODE) { _link = request.getLink(); } string[] splittedLink = SplitLink(_link); // If the decryption key already includes the "!" character, delete it. if (decryptionKey.StartsWith("!")) { decryptionKey = decryptionKey.Substring(1); } string link = String.Format("{0}!{1}!{2}", splittedLink[0], splittedLink[1], decryptionKey); // If is a folder link if (splittedLink[0].EndsWith("#F")) { api.loginToFolder(link, new LoginToFolderRequestListener(_folderLinkViewModel)); } else { api.getPublicNode(link, this); } }