33 BusyDialog dialog =
new(
"Please wait",
"Migrating 1.26 data to 1.27 format...");
40 int num =
MigrateFolder(
"app:/.config/.isolated-storage",
"data:");
41 empty =
"Migration Successful";
42 empty2 = $
"{num} file(s) were migrated from 1.26 to 1.27.";
44 catch (Exception ex2) {
45 empty =
"Migration Failed";
47 Log.
Error(
"Migration to 1.27 failed, reason: {0}", ex2.Message);
56 catch (Exception ex) {
57 Log.
Error(
"Failed to migrate data. Reason: {0}", ex.Message);
63 foreach (XElement item
in node.DescendantsAndSelf(
"Value")) {
64 XAttribute xAttribute = item.Attribute(
"Type");
65 if (xAttribute !=
null) {
66 if (xAttribute.Value ==
"Microsoft.Xna.Framework.Vector2") {
67 xAttribute.Value =
"Engine.Vector2";
69 else if (xAttribute.Value ==
"Microsoft.Xna.Framework.Vector3") {
70 xAttribute.Value =
"Engine.Vector3";
72 else if (xAttribute.Value ==
"Microsoft.Xna.Framework.Vector4") {
73 xAttribute.Value =
"Engine.Vector4";
75 else if (xAttribute.Value ==
"Microsoft.Xna.Framework.Quaternion") {
76 xAttribute.Value =
"Engine.Quaternion";
78 else if (xAttribute.Value ==
"Microsoft.Xna.Framework.Matrix") {
79 xAttribute.Value =
"Engine.Matrix";
81 else if (xAttribute.Value ==
"Microsoft.Xna.Framework.Point") {
82 xAttribute.Value =
"Engine.Point2";
84 else if (xAttribute.Value ==
"Microsoft.Xna.Framework.Color") {
85 xAttribute.Value =
"Engine.Color";
87 else if (xAttribute.Value ==
"Game.Point3") {
88 xAttribute.Value =
"Engine.Point3";
94 public static int MigrateFolder(
string sourceFolderName,
string targetFolderName) {
109 public static void MigrateFile(
string sourceFileName,
string targetFolderName) {
static void Dispatch(Action action, bool waitUntilCompleted=false)
static void Error(object message)
static void Information(object message)
static void CreateDirectory(string path)
static bool DirectoryExists(string path)
static IEnumerable< string > ListDirectoryNames(string path)
static IEnumerable< string > ListFileNames(string path)
static Stream OpenFile(string path, OpenFileMode openFileMode)
static string GetFileName(string path)
static void DeleteDirectory(string path)
static void DeleteFile(string path)
static string CombinePaths(params string[] paths)
static void CopyFile(string sourcePath, string destinationPath)
static void HideDialog(Dialog dialog)
static void ShowDialog(ContainerWidget parentWidget, Dialog dialog)
static bool LoadSettings()
文件存在则读取并返回真否则返回假
override void ConvertWorld(string directoryName)
void ConvertTypesToEngine(XElement node)
override string TargetVersion
override string SourceVersion
static void MigrateFile(string sourceFileName, string targetFolderName)
static int MigrateFolder(string sourceFolderName, string targetFolderName)
override void ConvertProjectXml(XElement projectNode)
static void MigrateDataFromIsolatedStorageWithDialog()
static void SetAttributeValue(XElement node, string attributeName, object value)
static XElement LoadXmlFromStream(Stream stream, Encoding encoding, bool throwOnError)
static void SaveXmlToStream(XElement node, Stream stream, Encoding encoding, bool throwOnError)