CobaltCore assembly

故事扮演 提交于 2019-12-13 16:52:23

问题


I try to implement a custom Wopi host in C# that can handle the Cobalt Protocol using the CobaltCore assembly.

But I didn't found any documentation for CobaltCore.dll Object browser is a little helpful..

Please provide some details if someone had similar issue. How I should use Cobalt to decipher the messages?


回答1:


For word editing implementation go here:

Can I just use Office Web Apps Server

// fsshttpb payload, basically decode from base64 encoded

byte[] test1 = System.Convert.FromBase64String("DAALAJzPKfM5lAabBgIAAO4CAABaBBYADW1zd29yZAd3YWN6AggA1RyhD3cBFgIGAAMFABoEIAAL3Do4buY4RJXm4575cgEiigICAAALAawCAFUDAQ==");

// create an atom object from the fsshttp input
AtomFromByteArray atomRequest = new AtomFromByteArray(test1);

RequestBatch requestBatch = new RequestBatch();
requestBatch.DeserializeInputFromProtocol(atomRequest);

// now you can inspect requestBatch to view the decoded objects

edit:

Here is a sample implementation using CobaltCore. Pretty much a combination of my answers about WOPI/FSSHTTP on this website in one project.

https://github.com/thebitllc/WopiBasicEditor




回答2:


Also implementing the Cobalt approach to edits and like Julia it stops at a "cant edit screen" even after lockingstore callbacks including co-author etc. What I have found however is the log system for OWA reveals quite considerable detail about what the OWA server is attempting to do. C:\ProgramData\Microsoft\OfficeWebApps\Data\Logs\ULS I can see from these logs it complains about a missing access token, by providing

    &access_token=1&access_token_ttl=0 

to the end of the wopi url this error goes away.

I also tested many of the file info fields and was able to see how the OWA server caches information. If we keep changing the cfi.Version

FileInfo info = new FileInfo("C:\\WOPI OWA WORD EDITOR\\OWA_Source_Documents\\" + fi.Name);
cfi.Version = info.LastWriteTimeUtc.ToString("s");

we get a fresh cached item each time we change the files contents via normal word.

These also affect the View mode for Word and I suspect will lock us out of the word edit mode but since I don't have that working I cant tell yet.

 cfi.SupportsCoauth = true; // all three (3) needed to see the edit in browser menu in view mode .
 cfi.SupportsCobalt = true; // all three (3) needed to see the edit in browser menu in view mode .
 cfi.SupportsFolders = true; // all three (3) needed to see the edit in browser menu in view mode .
 cfi.SupportsLocks = true;
 cfi.SupportsScenarioLinks = false;
 cfi.SupportsSecureStore = true;
 cfi.SupportsUpdate = true;

This one locks out the word edit function and unless you update the version of the file it will stay locked even if you change it back to false.

cfi.WebEditingDisabled = false;

Roger Hogg




回答3:


thanks to thebitllc for the correct approach to getting back the file.

 System.IO.FileStream _FileStream = new System.IO.FileStream("C:\\WOPI OWA WORD EDITOR\\OWA_Updated_Documents\\output.docx", System.IO.FileMode.Create, System.IO.FileAccess.Write);
GenericFdaStream myCobaltStream =  new GenericFda(cobaltFile.CobaltEndpoint, null).GetContentStream();
myCobaltStream.CopyTo(_FileStream);
_FileStream.Close(); 


来源:https://stackoverflow.com/questions/23872142/cobaltcore-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!