private void SaveMaterialContentFromFile(MaterialContent content)
        {
            SourceFileInfo.NullCheck("SourceFileInfo");

            if (CheckSourceFileExists)
            {
                ExceptionHelper.FalseThrow(SourceFileInfo.Exists, string.Format(Resources.FileNotFound, SourceFileInfo.Name));
            }

            if (SourceFileInfo.Exists)
            {
                content.FileSize = SourceFileInfo.Length;

                using (TransactionScope scope = TransactionScopeFactory.Create())
                {
                    using (FileStream stream = SourceFileInfo.OpenRead())
                    {
                        MaterialContentAdapter.Instance.Update(content, stream);

                        TransactionScopeFactory.AttachCommittedAction(new Action <TransactionEventArgs>(Current_TransactionCompleted), false);
                    }

                    scope.Complete();
                }
            }
        }
Exemplo n.º 2
0
        public override void SaveMaterialContent(MaterialContent content)
        {
            SourceFileInfo.NullCheck("SourceFileInfo");
            DestFileInfo.NullCheck("DestFileInfo");

            if (CheckSourceFileExists)
            {
                ExceptionHelper.FalseThrow(SourceFileInfo.Exists, string.Format(Resource.FileNotFound, SourceFileInfo.Name));
            }

            MoveFile(SourceFileInfo, DestFileInfo);
        }