Ejemplo n.º 1
0
		private void LoadDocumentProperties(Redemption.Attachment _attachment)
        {
            try
            {
                if (_size > 0) // This is needed as 0 byte .doc files have no custom property storage.
                {
					Logger.LogInfo(string.Format("Loading .... {0}", _displayName));
                    string tempfile = Utils.GetTempFile(System.IO.Path.GetExtension(_fileName));
                    _attachment.SaveAsFile(tempfile);
                    var idoc = new IntelligentDocument();
                    idoc.SetFileName(tempfile);
                    if (idoc.IsDocumentBeingTracked())
                    {
						_checkSum = idoc.CalculateDocumentChecksum();
                        _trackingId = idoc.GetDocumentTrackingId();
                        _isModified = idoc.IsDocumentModified();
                    }
                    else
                    {
                        // set the tracking id to an unique value to ensure that it isn't discovered during the 
                        // comparison stage
                        _trackingId = Guid.NewGuid().ToString();
                    }
                    
                    Utils.SafeDeleteFile(tempfile);
                }
            }
            catch (System.Exception e)
            {
                Logger.LogError(e);
            }
        }