Nexus.Client.ModManagement.CategoryManager.Backup C# (CSharp) Method

Backup() public method

This backs up the category file.
public Backup ( ) : void
return void
		public void Backup()
		{
			if (File.Exists(CategoryFilePath))
			{
				string strBackupCategoryPath = CategoryFilePath + ".bak";
				FileInfo fifCategory = new FileInfo(CategoryFilePath);
				FileInfo fifCategoryBak = File.Exists(strBackupCategoryPath) ? new FileInfo(strBackupCategoryPath) : null;

				if ((fifCategoryBak == null) || (fifCategoryBak.LastWriteTimeUtc != fifCategory.LastWriteTimeUtc))
				{
					for (Int32 i = 4; i > 0; i--)
					{
						if (File.Exists(strBackupCategoryPath + i))
							File.Copy(strBackupCategoryPath + i, strBackupCategoryPath + (i + 1), true);
					}
					if (File.Exists(strBackupCategoryPath))
						File.Copy(strBackupCategoryPath, strBackupCategoryPath + "1", true);
					FileUtil.Move(CategoryFilePath, strBackupCategoryPath, true);
				}
			}
		}