예제 #1
0
 public override OpenWOPIDocument ViewDocument(string source, OpenWOPIAccessToken accessToken, bool loadMetadata = false)
 {
     VisioDocument doc = new VisioDocument(source, accessToken, OpenWOPIProofKey.ReadFromConfiguration(OpenWOPIClientConfiguration.Current));
     if (loadMetadata)
         doc.CheckFileInfo();
     doc.GetFile();
     string t = doc.ExtractThumbnail();
     doc.ConvertEMFToPng(t, 200);
     return doc;
 }
예제 #2
0
        public override OpenWOPIDocument ViewDocument(string source, OpenWOPIAccessToken accessToken, bool loadMetadata = false)
        {
            OpenWOPITextDocument doc = new OpenWOPITextDocument(source, accessToken, OpenWOPIProofKey.ReadFromConfiguration(OpenWOPIClientConfiguration.Current));

            if (loadMetadata)
            {
                doc.CheckFileInfo();
            }
            doc.GetFile();
            return(doc);
        }
예제 #3
0
        public OpenWOPIDiscoveryModel()
        {
            _zones = new List <OpenWOPIZone>();

            OpenWOPIClientConfiguration configuration = OpenWOPIClientConfiguration.Current;
            string protocols = configuration["protocols"];

            InternalBaseUrl = configuration["internal-url"];
            ExternalBaseUrl = configuration["external-url"];

            ProofKey = OpenWOPIProofKey.ReadFromConfiguration(configuration);

            if (protocols == "http" || protocols == "both")
            {
                if (!String.IsNullOrEmpty(InternalBaseUrl))
                {
                    _zones.Add(OpenWOPIZone.InternalHttp);
                }
                if (!String.IsNullOrEmpty(ExternalBaseUrl))
                {
                    _zones.Add(OpenWOPIZone.ExternalHttp);
                }
            }
            if (protocols == "https" || protocols == "both")
            {
                if (!String.IsNullOrEmpty(InternalBaseUrl))
                {
                    _zones.Add(OpenWOPIZone.InternalHttps);
                }
                if (!String.IsNullOrEmpty(ExternalBaseUrl))
                {
                    _zones.Add(OpenWOPIZone.ExternalHttps);
                }
            }

            var types = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
                         from type in assembly.GetTypes()
                         where (type.GetCustomAttributes(typeof(OpenWOPIAppAttribute), true).Length > 0)
                         select type).ToList();

            List <OpenWOPIApp> apps = new List <OpenWOPIApp>();

            foreach (var type in types)
            {
                apps.Add(new OpenWOPIApp(type));
            }
            foreach (var zone in _zones)
            {
                zone.Apps = apps;
            }
        }
예제 #4
0
        public ActionResult Save(OpenWOPIDocumentPostData data)
        {
            TextAppModel         model = new TextAppModel();
            OpenWOPITextDocument doc   = new OpenWOPITextDocument(SourceFile, data.AccessToken, OpenWOPIProofKey.ReadFromConfiguration(OpenWOPIClientConfiguration.Current));

            doc.CheckFileInfo();
            doc.Content = data.Content;

            doc.PutFile();
            // TODO: handle errors in the WebException view

            return(Redirect(doc.HostEditUrl));
        }
예제 #5
0
 public GpxDocument(string source, OpenWOPIAccessToken accessToken, OpenWOPIProofKey proofKey) : base(source, accessToken, proofKey)
 {
 }