示例#1
0
    public static void DoSDKMigration()
    {
        Debug.Log(MigrationBegin);

        if (DoesExist(RedundantDir))
        {
            OS.RmDir(RedundantDir);
        }
        if (DoesExist(RedundantLib))
        {
            OS.Rm(RedundantLib);
            var redundantJarDir         = RedundantLib.Remove(RedundantLib.LastIndexOf("/", StringComparison.Ordinal)) + "/";
            var redundantJarDirContents = OS.GetFileSystemEntries(redundantJarDir);
            if (!redundantJarDirContents.Any())
            {
                OS.RmDir(redundantJarDir);
            }
        }

        foreach (var jar in RedundantJars.Where(DoesExist))
        {
            OS.Rm(jar);
        }

        var allSucceeded = true;

        foreach (var entry in LocationMapping)
        {
            var source = Path.Combine("Assets", entry.Key);
            var dest   = Path.Combine("Assets", entry.Value);
            if (!DoesExist(source))
            {
                continue;
            }
            allSucceeded &= OS.Mv(source, dest);
        }

        var showNote      = false;
        var migrationNote = new StringBuilder(ManualMigrationNote);

        foreach (var entry in ManualMapping)
        {
            if (DoesExist(Path.Combine("Assets", entry.Key)))
            {
                showNote = true;
                migrationNote.AppendFormat("'{0}' to '{1}'\n", entry.Key, entry.Value);
            }
        }
        if (showNote)
        {
            Debug.LogWarning(migrationNote);
        }

        if (!allSucceeded)
        {
            Debug.LogWarning(ManualFollowUpWarning);
        }
        AssetDatabase.Refresh();
        Debug.Log(MigrationEnd);
    }
示例#2
0
    public static void DoMigration()
    {
        Debug.Log(MigrationBegin);

        if (Directory.Exists(RedundantDir))
        {
            OS.RmDir(RedundantDir);
        }

        var allSucceeded = true;

        foreach (var entry in LocationMapping)
        {
            var source = Path.Combine("Assets", entry.Key);
            var dest   = Path.Combine("Assets", entry.Value);
            if (!DoesExist(source))
            {
                continue;
            }
            allSucceeded &= OS.Mv(source, dest);
        }

        bool showNote      = false;
        var  migrationNote = new StringBuilder(ManualMigrationNote);

        foreach (var entry in ManualMapping)
        {
            if (DoesExist(Path.Combine("Assets", entry.Key)))
            {
                showNote = true;
                migrationNote.Append(string.Format("'{0}' to '{1}'\n", entry.Key, entry.Value));
            }
        }
        if (showNote)
        {
            Debug.LogWarning(migrationNote);
        }

        if (!allSucceeded)
        {
            Debug.LogWarning(ManualFollowUpWarning);
        }
        AssetDatabase.Refresh();
        Debug.Log(MigrationEnd);
    }