public String GetInSessionPath(ExternalResourceReference resourceReference, String originalPath)
        {
            string file = resourceReference.GetReferenceInformation()["File"];

            DBUtils.DBItem dbItem = DBUtils.FindDBItem(file);
            return(GetPath(dbItem));
        }
        public void LoadResource(Guid loadRequestId, ExternalResourceType resourceType,
                                 ExternalResourceReference resourceReference, ExternalResourceLoadContext loadContext,
                                 ExternalResourceLoadContent content)
        {
            LinkLoadContent linkLoadContent = (LinkLoadContent)content;

            string file = resourceReference.GetReferenceInformation()["File"];

            DBUtils.DBItem dbItem = DBUtils.FindDBItem(file);
            if ((dbItem == null) || (dbItem.Private))
            {
                content.LoadStatus = ExternalResourceLoadStatus.Failure;
                return;
            }

            ModelPath linksPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(Application.BaseFolder + file);

            linkLoadContent.SetLinkDataPath(linksPath);
            content.LoadStatus = ExternalResourceLoadStatus.Success;
            return;
        }
        public void HandleLoadResourceResults(Document document, IList <ExternalResourceLoadData> loadData)
        {
            loadData.ToList().ForEach(data =>
            {
                if (data.LoadStatus == ExternalResourceLoadStatus.Success)
                {
                    return;
                }

                string file         = data.GetExternalResourceReference().GetReferenceInformation()["File"];
                DBUtils.DBItem item = DBUtils.FindDBItem(file);
                if (item == null)
                {
                    MessageBox.Show($"The file {file} could not be found in the database.", ServerName);
                    data.ErrorsReported = true;
                }
                if (item.Private)
                {
                    string path = LinksMultiLanguageServer.GetPath(item);
                    MessageBox.Show($"You do not have permissions to open {path}.", ServerName);
                    data.ErrorsReported = true;
                }
            });
        }
 public static String GetPath(DBUtils.DBItem item)
 {
     return(ServerName + "://" + DBUtils.GetDBItemName(item, Application.CurrentLanguage));
 }