コード例 #1
0
        public void SaveDocument(ref tagWSDOCUMENT wsDoc)
        {
            try
            {
                m_docprov.SaveDocument(ref wsDoc, 0);
            }
            catch (Exception e)
            {
                int hr = Marshal.GetHRForException(e);

                if (hr == -2146233087)
                {
                    var error = m_docprov.GetErrorDescription(hr);
                    Logger.LogError(error);

                    if (error.Contains("is checked out for editing"))
                        throw new CheckedOutByAnotherUserException(error);

                    throw new InvalidPresentationException(error, e);
                }

                if (hr == -2146233079)
                {
                    var error = m_docprov.GetErrorDescription(hr);
                    Logger.LogError(error);
                    throw new UnauthorizedAccessException(error);
                }
                throw;
            }
        }
コード例 #2
0
ファイル: ActiveDocument.cs プロジェクト: killbug2004/WSProf
        protected void InitializeWsDocument(string path)
        {
            using (new WsActivationContext())
            {
                try
                {
                    _wsDocument = new tagWSDOCUMENT
                    {
                        bstrLocalFile = path
                    };
                    _docProvider = new DocProviderClass();
                    _docProvider.Resolve(ref _wsDocument);
                    _wsDocument = _docProvider.GetDocument(_wsDocument.bstrDocumentID, (int)wsGetDocFlags.DF_INFO_ONLY);
                    _wsDocument.lConversation = 1;

                    GetVersionInformation();

                    ModifiedTime = _wsDocument.dModifiedTime;
                    DocumentId = _wsDocument.bstrDocumentID;
                    Description = _wsDocument.bstrDescription;

                }
                catch (Exception e)
                {
                    Logger.LogError(e);
                }
            }
        }
コード例 #3
0
 void CreateWdDoc(tagWSDOCUMENT wsDoc, ref WdDocument wdDoc)
 {
     Logger.LogTrace(string.Format("Create wdDocument from wsDocument {0}", wsDoc.bstrDescription));
     wdDoc = wdDoc ?? new WdDocument();
     wdDoc.DocId = string.IsNullOrEmpty(wsDoc.bstrDocumentID) ? "" : WsDocumentID.GetWdDocID(wsDoc.bstrDocumentID);
     wdDoc.Ext = string.IsNullOrEmpty(wsDoc.bstrExtension) ? "" : wsDoc.bstrExtension;
     wdDoc.FIleName = string.IsNullOrEmpty(wsDoc.bstrDescription) ? "" : Path.GetFileName(wsDoc.bstrDescription);
     wdDoc.LocalFilePath = string.IsNullOrEmpty(wsDoc.bstrLocalFile) ? "" : wsDoc.bstrLocalFile;
 }
コード例 #4
0
 void UpdateWsDocData(ref tagWSDOCUMENT wsDoc, WdDocument wdDoc)
 {
     Logger.LogTrace(string.Format("Update Ws local data from wdDocument. {0}", wdDoc.AsString()));
     wsDoc.bstrDocumentID = WsDocumentID.Create(wdDoc.DocId, wdDoc.VersionNumber);
     wsDoc.bstrDescription = wdDoc.FIleName;
     wsDoc.bstrExtension = wdDoc.Ext;
     wsDoc.bstrType = FileUtils.GetFileTypeFromExt(wdDoc.Ext);
     wsDoc.dModifiedTime = wdDoc.ModifiedTime;
     wsDoc.bstrAuthor = wdDoc.Author;
     wsDoc.bstrClass = wdDoc.SecurityClassName;
     wsDoc.bstrOperator = wdDoc.Operator;
 }
コード例 #5
0
		public Int32 GetSaveInfo(int hWnd, string filter, ref tagWSDOCUMENT wsDoc)
		{
			int flags = (int) (wsGetSaveInfoFlags.DF_NO_WORKSHARE_SAVEAS_UI | wsGetSaveInfoFlags.DF_NEW_DOCUMENT);
			// Apparently the DocProvider class uses 1-based indexing for the file-type list
			int filterIndex = (string.IsNullOrEmpty(filter) ? 0 : 1);

			Int32 retValue = 0;
			try
			{
				retValue = m_docprov.GetSaveInfoEx(hWnd, filter, flags, (int)MessageBranding.WsDefault, ref filterIndex, ref wsDoc);
			}
			catch (UnauthorizedAccessException) // XP/2003 just throws from the file dialog if we do not have write permissions
			{
				retValue = EAccessdenied;
			}

			return retValue;
		}
コード例 #6
0
 internal int Resolve(ref tagWSDOCUMENT pwsDocument)
 {
     Logger.LogTrace(string.Format("Resolve start. LocalPath={0}", pwsDocument.bstrLocalFile));
     var ndLocalStorageFile = LocalStorage.GetFile(pwsDocument.bstrLocalFile);
     if (ndLocalStorageFile != null)
     {
         pwsDocument.bstrDocumentID = ndLocalStorageFile.DocId;
         Logger.LogTrace(string.Format("Resolved"));
         return DP_HRESULTS.S_OK;
     }
     Logger.LogTrace(string.Format("Not resolved"));
     return DP_HRESULTS.S_FALSE;
 }
コード例 #7
0
        internal int SaveDocumentEx(ref tagWSDOCUMENT pwsDocument, bool bShowUIForSaveType, int lSaveInfoFlags, int hWnd)
        {
            Logger.LogTrace(string.Format("SaveDocumentEx start. id={0}", pwsDocument.bstrDocumentID));
            if (!IsLogged()) return DP_HRESULTS.E_LOGIN_FAILURE;

            using (var stream = new FileStream(pwsDocument.bstrLocalFile, FileMode.Open))
            {
                var fileId = DocumentID.GetFileID(pwsDocument.bstrDocumentID);
                var verId = int.Parse(DocumentID.GetVersionId(pwsDocument.bstrDocumentID));
                _adapter.UpdateDocument(fileId, verId, stream, false, false);
            }

            wsDocCache.Clear(pwsDocument.bstrDocumentID);
            LocalStorage.UpdateFile(pwsDocument.bstrDocumentID, pwsDocument.bstrLocalFile);

            return DP_HRESULTS.S_OK;
        }
コード例 #8
0
        internal int GetSaveInfoEx(int lHWnd, string szFormatString, int lFlags, int lBrand, ref int plFormatIndex, ref tagWSDOCUMENT pwsDocument, out int plRetval)
        {
            Logger.LogTrace(string.Format("GetSaveInfoEx start. Formats={0}",szFormatString));
            using (_dialogfactiry.SetHandle(lHWnd))
            {
                plRetval = 0;

                if (!EnsureLoggedIn()) return DP_HRESULTS.S_FALSE;

                var dlg = new NdSaveDialog
                {
                    Filters = szFormatString,
                    plFormatIndex = plFormatIndex,
                    FileName = pwsDocument.bstrDescription
                };
                if (!dlg.ShowDialog()) return DP_HRESULTS.S_FALSE;
                pwsDocument.lFlags |= (int)wsDocLockFlags.DOCUMENT_LOCKED_BY_US;
                pwsDocument.bstrDocumentID = DocumentID.Create(dlg.SelectedDocument.Identifier, dlg.SelectedDocument.Version.ToString());
                plFormatIndex = dlg.plFormatIndex;
                TryCheckOut(dlg.SelectedDocument.Identifier);

                wsDocCache.Clear(pwsDocument.bstrDocumentID);

                return DP_HRESULTS.S_OK;
            }
        }
コード例 #9
0
        internal int CloseDocument(ref tagWSDOCUMENT pwsDocument, int lFlags)
        {
            Workshare.Interop.Logging.Logger.LogTrace(string.Format("CloseDocument. id={0}. LocalPath={1}. Flags={2}", pwsDocument.bstrDocumentID, pwsDocument.bstrLocalFile,lFlags));
            UnlockDocument(pwsDocument);

            if ((lFlags & (int)wsCloseDocFlags.DF_UNLOCK_ONLY) != 0)
            {
                
            }
            else
            {
                LocalStorage.Clean(pwsDocument.bstrDocumentID,pwsDocument.bstrLocalFile);
            }
            return DP_HRESULTS.S_OK;
        }
コード例 #10
0
 internal int SaveDocumentEx(ref tagWSDOCUMENT pwsDocument, bool p1, int p2, int p3)
 {
     Logger.LogTrace(string.Format("Save document {0}", pwsDocument.bstrDocumentID));
     try
     {
         var path = _dpCache.GetFileWorldoxPathFromCache(pwsDocument.bstrDocumentID);
         if (string.IsNullOrEmpty(path))
         {
             Debug.Assert(false,"We should not be here as we suppose that we here after GetSaveInfo() so path should be in the cache");
             using (var session = _sessionManager.Create())
             {
                 Logger.LogError(
                     string.Format(
                         "99% that file will not be found by ByDocId() as it was not indexd yet. File={0}. Please Investigate as path should be get from cache",
                         pwsDocument.bstrDocumentID));
                 var wdDoc = _wdDocRepo.GetByDocId(session.Handle,
                     WsDocumentID.GetWdDocID(pwsDocument.bstrDocumentID),
                     WsDocumentID.GetVersionId(pwsDocument.bstrDocumentID));
                 path = wdDoc.LocalFilePath;
             }
         }
         if (!string.Equals(pwsDocument.bstrLocalFile, path, StringComparison.InvariantCultureIgnoreCase))
         {
             _fileSystemWorker.CopyFile(pwsDocument.bstrLocalFile, path, true);
         }
         return DP_HRESULTS.S_OK;
     }
     catch (WdFileNotFoundException ex)
     {
         Debug.Assert(false, "SaveDocumentEx(). File was not found during saving");
         throw new DPFileNotFoundException(pwsDocument.bstrDocumentID, ex);
     }
 }
コード例 #11
0
		public void Resolve(ref tagWSDOCUMENT wsDoc)
		{
			m_docprov.Resolve(ref wsDoc);
		}
コード例 #12
0
 public void Update(string wsDocId, tagWSDOCUMENT doc)
 {
     _docProviderCache[wsDocId]= doc;
 }
コード例 #13
0
 public int GetDocument(string szDocumentID, int lFlags, out Interop.DocProviders.tagWSDOCUMENT pwsDocument)
 {
     try
     {
         return _docProviderImpl.GetDocument(szDocumentID, lFlags, out pwsDocument);
     }
     catch (Exception ex)
     {
         pwsDocument = new tagWSDOCUMENT();
         return HandleException(ex);
     }
 }
コード例 #14
0
 public void CloseDocument(ref tagWSDOCUMENT wsDoc)
 {
     CloseDocument(ref wsDoc, 1);
 }
コード例 #15
0
 public tagWSDOCUMENT GetDocument(string docid)
 {
     tagWSDOCUMENT wsDoc = new tagWSDOCUMENT();
     wsDoc = m_docprov.GetDocument(docid, 0);
     return wsDoc;
 }
コード例 #16
0
 public bool ShouldBeOpenedDirectlyFromDmsAfterSave(ref tagWSDOCUMENT doc)
 {
     //we should open file directly from Worldox DMS instead of opening temporary copy - in this case worldox will get all document information by itself.
     return IsWorldox(doc.bstrDocumentID);
 }
コード例 #17
0
 public void OpenDocument(tagWSDOCUMENT doc)
 {
     m_docprov.OpenDocument(ref doc);
 }
コード例 #18
0
		public static void UpdateWsdocumentWithLocalCopy(ref tagWSDOCUMENT wsDoc, string filename)
		{
			if (string.IsNullOrEmpty(wsDoc.bstrLocalFile) || !File.Exists(wsDoc.bstrLocalFile))
			{
				wsDoc.bstrLocalFile = filename;
			}
			else if (!filename.Equals(wsDoc.bstrLocalFile, StringComparison.CurrentCultureIgnoreCase))
			{
				File.Copy(filename, wsDoc.bstrLocalFile, true);
			}
		}
コード例 #19
0
        internal int OpenDocument(ref tagWSDOCUMENT pwsDocument)
        {
            Logger.LogTrace(string.Format("OpenDocument start. Id={0}", pwsDocument.bstrDocumentID));
            var fileId = DocumentID.GetFileID(pwsDocument.bstrDocumentID);
            var verId = int.Parse(DocumentID.GetVersionId(pwsDocument.bstrDocumentID));

            string fileToOpen;
            var localFile = LocalStorage.GetForDocId(pwsDocument.bstrDocumentID);
            if (localFile != null)
            {
                Logger.LogTrace(string.Format("open from storage. Path={0}",localFile.LocalPath));
                fileToOpen = localFile.LocalPath;
            }
            else
            {
                Logger.LogTrace(string.Format("open from netdocuments."));
                var ndFileInfo = GetFileInfo(fileId);
                if (ndFileInfo == null) return DP_HRESULTS.E_FAIL;
                if (ndFileInfo.Version == verId)
                {
                    fileToOpen = DownloadFile(pwsDocument.bstrDocumentID, ndFileInfo.Name, false);
                }
                else
                {
                    throw  new NotImplementedException();
                }
            }
            Process.Start(fileToOpen);
            return DP_HRESULTS.S_OK;
        }
コード例 #20
0
ファイル: DPCache.cs プロジェクト: killbug2004/WSProf
 internal void UpdateCache(string szDocumentID, WdDocument wdDoc, tagWSDOCUMENT wsDoc)
 {
     UpdateL1Cache(szDocumentID.ToUpper(), wdDoc, wsDoc);
     UpdateL2Cach(szDocumentID.ToUpper(), wdDoc.LocalFilePath);
 }
コード例 #21
0
 internal int RelateDocument(ref tagWSDOCUMENT pNewDocument, string szExistingDocumentId)
 {
     return DP_HRESULTS.S_FALSE;
 }
コード例 #22
0
        tagWSDOCUMENT SimulateSaving(DocumentProvider dp, WdDocument newWdDocument,string filters, int filterIndex)
        {
            Mock.Get(dp.module.Resolve<ISaveFileDialog>()).Setup(p => p.ShowDialog()).Returns(true);
            Mock.Get(dp.module.Resolve<ISaveFileDialog>()).Setup(p => p.FilePath).Returns(newWdDocument.LocalFilePath);
            Mock.Get(dp.module.Resolve<ISaveFileDialog>()).Setup(p => p.FormatIndex).Returns(filterIndex);

            int index = 0;
            var wsDoc = new tagWSDOCUMENT();
            int ret;
            dp.GetSaveInfoEx(123, filters, 0, 0, ref index, ref wsDoc, out ret).Assert_Is_S_OK();
            wsDoc.bstrLocalFile = Path.GetTempFileName();
            dp.SaveDocument(ref wsDoc, 0).Assert_Is_S_OK();

            return wsDoc;
        }
コード例 #23
0
ファイル: TaskSavePdf.cs プロジェクト: killbug2004/WSProf
        private void SaveLocal()
        {
            try
            {
                var wsDocument = new tagWSDOCUMENT
                {
                    bstrLocalFile = _options.Destination,
                    bstrDescription = Path.GetFileName(_options.Destination)
                };
                    
                var docProvider = new DocProviderClass();
                docProvider.Resolve(ref wsDocument);
                int iFormatIndex = 1;
                docProvider.GetLFSSaveInfo(_options.ParentWindow.Handle.ToInt32(), "PDF Documents (*.pdf)|*.pdf||",
                    (int)(wsGetSaveInfoFlags.DF_NEW_DOCUMENT | wsGetSaveInfoFlags.DF_NO_WORKSHARE_SAVEAS_UI), ref iFormatIndex, ref wsDocument);

                wsDocument.bstrLocalFile = _options.Destination;
                docProvider.SaveDocument(ref wsDocument, 0);
                docProvider.CloseDocument(ref wsDocument, (int)wsCloseDocFlags.DF_UNLOCK_ONLY);
				_options.LocalFile = wsDocument.bstrLocalFile; // for open once if necc
				_activeDocument.AddActivityToDmsHistory(DmsActivityType.Print);
            }
            catch (COMException e)
            {
                const int cancelledOperation = -2146303990;

                if (e.ErrorCode == cancelledOperation)
                    return;

                Logger.LogError(e);
            }
            catch (Exception e)
            {
                Logger.LogError(e);
            }
        }
コード例 #24
0
		public void CloseDocument(ref tagWSDOCUMENT wsDoc, int iFlags)
		{
			m_docprov.CloseDocument(ref wsDoc, iFlags);
		}
コード例 #25
0
ファイル: DPCache.cs プロジェクト: killbug2004/WSProf
 private void UpdateL1Cache(string szDocumentID, WdDocument wdDoc, tagWSDOCUMENT wsDoc)
 {
     Logger.LogTrace(string.Format("WsDoc added to L1 cache. WsDocId={0}. wsDesc={1}. WdDocId={2}. WdDocLocalPath={3}", szDocumentID,wsDoc.bstrDescription,wdDoc.DocId,wdDoc.LocalFilePath));
     m_docProviderCache[szDocumentID] = new CacheEntity()
     {
         wsDoc = wsDoc,
         wsPath = wdDoc.LocalFilePath
     };
 }
コード例 #26
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!this.Dispatcher.CheckAccess())
            {
                this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.SystemIdle, TimeSpan.FromSeconds(1),
                   new System.Action(delegate()
                   {
                       btnSave_Click(sender, e);
                   }
                ));
            }
            else
            {
                try
                {
                    Button b = sender as Button;
                    if (b == null)
                        return;

                    AttachedComparison comp = b.DataContext as AttachedComparison;
                    if (comp == null)
                        return;

                    tagWSDOCUMENT doc = new tagWSDOCUMENT();
                    doc.bstrDescription = Path.ChangeExtension(comp.Title, "rtf");
                    doc.bstrExtension = "rtf";
                    doc.bstrLocalFile = comp.RedlineRtfPath;
                    int formatIndex = 1;

                    DocProviderClass docProv = new DocProviderClass();
                    if (docProv != null)
                    {
						HwndSource source = HwndSource.FromVisual(this) as HwndSource;
						int hWnd = source == null ? 0 : (int) source.Handle;
                        Int32 retVal = docProv.GetSaveInfoEx(hWnd, "Rich text documents (*.rtf)|*.rtf||", (int)wsGetSaveInfoFlags.DF_NEW_DOCUMENT, 1, ref formatIndex, ref doc);

                        if (retVal == 0) // 0 == S_OK
                        {
                            doc.bstrLocalFile = comp.RedlineRtfPath;
                            const int DF_UNLOCK_ONLY = 1;
                            docProv.SaveDocument(ref doc, 0);
                            docProv.CloseDocument(ref doc, DF_UNLOCK_ONLY);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError(ex);
                    Forms.MessageBox.Show(ex.Message);
                }
            }
        }
コード例 #27
0
        public void CanCompareAndManageChanges()
        {
            var module = GetTestModule();
            var wdOriginal = MockUtils.GetDefaultDoc("a.docx");
            var wdModified = MockUtils.GetDefaultDoc("a.doc");
            
            try
            {
                File.WriteAllText(wdOriginal.LocalFilePath, @"Workshare Placeholder");
                File.WriteAllText(wdModified.LocalFilePath, @"Workshare Placeholder");
                var mockRepo = Mock.Get(module.Resolve<IWdDocumentRepository>());
                mockRepo.Setup_GetByPath(wdOriginal);
                mockRepo.Setup_GetByPath(wdModified);

                //DeltaView
                var dp = new DocumentProvider(module);
                var wsId1 = SimulateSelectionOfFile(dp, wdOriginal, "Word 2003|*.doc|Word 2010|*.docx");
                var wsId2 = SimulateSelectionOfFile(dp, wdModified, "Word 2003|*.doc|Word 2010|*.docx");

                var wsDocs = SimulateComparison(dp, wdOriginal, wdModified);

                dp.CloseDocument(ref wsDocs[0], 0).Assert_Is_S_OK();
                dp.CloseDocument(ref wsDocs[1], 0).Assert_Is_S_OK();

                //W3Launcher
                var dp2 = new DocumentProvider(GetTestModule());
                var mockRepo2 = Mock.Get(dp2.module.Resolve<IWdDocumentRepository>());
                mockRepo2.Setup_GetByPath(wdOriginal);
                mockRepo2.Setup(
                    p =>
                        p.GetVersions(It.IsAny<int>(),
                            It.Is<string>(
                                a => string.Equals(a, wdOriginal.DocId, StringComparison.InvariantCultureIgnoreCase))))
                    .Returns(() => new List<WdDocument> {wdOriginal});

                SimulateOpeningOfLastVersion(dp2, wdOriginal);

                //word
                var dp3 = new DocumentProvider(GetTestModule());
                var mockRepo3 = Mock.Get(dp3.module.Resolve<IWdDocumentRepository>());
                mockRepo3.Setup_GetByPath(wdOriginal);
                mockRepo3.Setup(
                    p =>
                        p.GetVersions(It.IsAny<int>(),
                            It.Is<string>(
                                a => string.Equals(a, wdOriginal.DocId, StringComparison.InvariantCultureIgnoreCase))))
                    .Returns(() => new List<WdDocument> {wdOriginal});

                var doc3 = new tagWSDOCUMENT
                {
                    bstrLocalFile = wdOriginal.LocalFilePath
                };
                dp3.Resolve(ref doc3).Assert_Is_S_OK();
                Assert.That(doc3.bstrDocumentID, Is.EqualTo(WsDocumentID.Create(wdOriginal)).IgnoreCase);
            }
            finally
            {
                File.Delete(wdOriginal.LocalFilePath);
                File.Delete(wdModified.LocalFilePath);
            }
        }
コード例 #28
0
        internal int GetDocument(string szDocumentID, int lFlags, out tagWSDOCUMENT pwsDocument)
        {
            pwsDocument = new tagWSDOCUMENT();
            var infoOnly = (lFlags & (int)wsGetDocFlags.DF_INFO_ONLY) != 0;
            bool bLock = (lFlags & (int)wsGetDocFlags.DF_LOCK) != 0;
            Workshare.Interop.Logging.Logger.LogTrace(string.Format("Download id={0}, lock={1}, infoOnly={2}, flags={3}", szDocumentID, bLock, infoOnly,lFlags));

            if (!IsLogged()) return DP_HRESULTS.E_LOGIN_FAILURE;

            var docId = DocumentID.GetFileID(szDocumentID);
            var verId = int.Parse(DocumentID.GetVersionId(szDocumentID));
            DocumentInfo ndFileInfo = null;
            tagWSDOCUMENT? cached=null;
            if (infoOnly && !bLock)
            {
                cached = wsDocCache.Get(szDocumentID);
            }
            if (!cached.HasValue)
            {
                ndFileInfo = GetFileInfo(docId);

                if (ndFileInfo == null) return DP_HRESULTS.E_FAIL;
                
                if (ndFileInfo.Version == verId)
                {
                    pwsDocument.bstrDocumentID = szDocumentID;
                    pwsDocument.bstrAuthor = "nd author";
                    pwsDocument.bstrExtension = ndFileInfo.Extension;
                    pwsDocument.bstrDescription = Path.GetFileNameWithoutExtension(ndFileInfo.FileName);
                    pwsDocument.bstrType = FileUtils.GetFileTypeFromExt(pwsDocument.bstrExtension);
                    wsDocCache.Update(szDocumentID, pwsDocument);
                }
                else
                {
                    Debug.Assert(false); //TODO GET VERSOIN
                    return DP_HRESULTS.E_IM_INVALID_DOCID;
                }

                if (!infoOnly)
                {
                    pwsDocument.bstrLocalFile = DownloadFile(szDocumentID, ndFileInfo.FileName, bLock);
                    if (bLock)
                    {
                        pwsDocument.lFlags |= (int)wsDocLockFlags.DOCUMENT_LOCKED_BY_US;
                    }
                }
            }
            else
            {
                pwsDocument = cached.Value;
            }
            return DP_HRESULTS.S_OK;
        }
コード例 #29
0
        public void CanOpenPdfAfterSaveItToDMS_ForNonIndexedFile()
        {
            var newWdDocument = MockUtils.GetDefaultDoc("a.pdf");

            var dp = new DocumentProvider(GetTestModule());

            var wsDocumentToConvert = new tagWSDOCUMENT();
            wsDocumentToConvert.bstrLocalFile = Path.GetTempFileName();
            dp.Resolve(ref wsDocumentToConvert).Assert_Is_S_FALSE();
            Assert.IsNullOrEmpty(wsDocumentToConvert.bstrDocumentID);

            var mockRepo = Mock.Get(dp.module.Resolve<IWdDocumentRepository>());
            mockRepo.Setup_GetByPath(newWdDocument);

            var wsDoc = SimulateSaving(dp, newWdDocument, "Pdf|*.pdf", 1);

            //PdfCreator opens document is another AppDomain
            var dp1 = new DocumentProvider(GetTestModule());
            var mockRepo1 = Mock.Get(dp1.module.Resolve<IWdDocumentRepository>());
            mockRepo1.Setup_GetByPath(newWdDocument);
            dp1.OpenDocument(ref wsDoc).Assert_Is_S_OK();
        }
コード例 #30
0
 bool UnlockDocument(tagWSDOCUMENT pwsDocument)
 {
     if ((pwsDocument.lFlags & (int)wsDocLockFlags.DOCUMENT_LOCKED_BY_US) != 0)
     {
         Logger.LogTrace(string.Format("Unlocking document {0}", pwsDocument.bstrDocumentID));
         var fileId = DocumentID.GetFileID(pwsDocument.bstrDocumentID);
        return TryCheckIn(fileId);
     }
     else
     {
         Logger.LogTrace(string.Format("Document {0} was not locked by us",pwsDocument.bstrDocumentID));
         return false;
     }
 }