System.IO.FileInfo.Replace C# (CSharp) Method

Replace() public method

public Replace ( String destinationFileName, String destinationBackupFileName ) : FileInfo
destinationFileName String
destinationBackupFileName String
return FileInfo
        public FileInfo Replace(String destinationFileName, String destinationBackupFileName)
        {
            return Replace(destinationFileName, destinationBackupFileName, ignoreMetadataErrors: false);
        }

Same methods

FileInfo::Replace ( String destinationFileName, String destinationBackupFileName, bool ignoreMetadataErrors ) : FileInfo
FileInfo::Replace ( string destinationFileName, string destinationBackupFileName ) : System.IO.FileInfo
FileInfo::Replace ( string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors ) : System.IO.FileInfo

Usage Example

Example #1
0
        /// <summary>
        /// 编译器器开始变以前处理逻辑
        /// </summary>
        public override void BeginCompile()
        {
            ScreenPermissionData = new Dictionary <int, int>();
            var targetDirectory = new System.IO.FileInfo(new Uri(this.GetType().Assembly.CodeBase).AbsolutePath).Directory.FullName;

            OutputPath = Path.Combine(targetDirectory.Replace("\\Wilmar.PlatformService\\bin\\Extension", "").Replace("\\Wilmar.Service\\bin\\Extension", ""), @"Wilmar.Terminate\Projects", this.Project.Identity);
            OutputPath = HttpUtility.UrlDecode(OutputPath);
            if (!Directory.Exists(OutputPath))
            {
                Directory.CreateDirectory(OutputPath);
            }
            Permission = GlobalServices.SecurityService.CreatePermissionContext(this);

            //屏幕权限操作
            var screenItems = ProjectItems.Where(a => a.Value.DocumentType == GlobalIds.DocumentType.Screen).ToList();

            foreach (var item in screenItems)
            {
                var screen = GetDocumentBody(item.Value) as ScreenDefinition;
                if (screen != null && screen.PermissionConfigure.EnableAuth)
                {
                    var doc = item.Value as ProjectDocument;
                    int screenPermissionId = this.Permission.Write(doc.Id, DojoCompile.PermissionScreen, doc.Id.ToString(), doc.Title + "的屏幕权限", doc.Title);
                    this.ScreenPermissionData.Add(doc.Id, screenPermissionId);
                }
            }
        }
All Usage Examples Of System.IO.FileInfo::Replace