Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit27d5615

Browse files
committed
added more logs and error handling
1 parentc0cde3f commit27d5615

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

‎ConvertPackage.ps1‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,17 @@ for ($k = 0; $k -lt $packages.count; $k++) {
4242
for ($i=0;$i-lt$resources.Count;$i++) {
4343
Write-Host Converting$resources[$i].resource"..."
4444
if ($resources[$i].newId) {
45-
(Get-Content-LiteralPath$_.FullName)-replace$resources[$i].oldId,$resources[$i].newId|Set-Content-LiteralPath$_.FullName
46-
Write-host" [Success]"-ForegroundColor Green-NoNewline
47-
Write-host$($resources[$i].resource) converted
45+
try {
46+
$content=Get-Content-LiteralPath$_.FullName-ErrorAction Stop
47+
$content-replace$resources[$i].oldId,$resources[$i].newId|Set-Content-LiteralPath$_.FullName
48+
Write-host" [Success]"-ForegroundColor Green-NoNewline
49+
Write-host$($resources[$i].resource) converted
50+
}
51+
catch {
52+
Write-host" [Error]"-ForegroundColor Red-NoNewline
53+
Write-host"Failed to process file:$($_.FullName)"
54+
Write-host" Error:$_"-ForegroundColor Red
55+
}
4856
}
4957
else {
5058
if ($resources[$i].resource-match".aspx"-eq$false) {
@@ -73,7 +81,15 @@ for ($k = 0; $k -lt $packages.count; $k++) {
7381
$files|ForEach-Object {
7482
for ($i=0;$i-lt$resources.Count;$i++) {
7583
if ([System.String]::IsNullOrEmpty($resources[$i].newId)-eq$false) {
76-
(Get-Content-LiteralPath$_.FullName)-replace$resources[$i].oldId,$resources[$i].newId|Set-Content-LiteralPath$_.FullName
84+
try {
85+
$content=Get-Content-LiteralPath$_.FullName-ErrorAction Stop
86+
$content-replace$resources[$i].oldId,$resources[$i].newId|Set-Content-LiteralPath$_.FullName
87+
}
88+
catch {
89+
Write-host" [Error]"-ForegroundColor Red-NoNewline
90+
Write-host"Failed to process MSAPP file:$($_.FullName)"
91+
Write-host" Error:$_"-ForegroundColor Red
92+
}
7793
}
7894
else {
7995
if ($resources[$i].resource-match".aspx"-eq$false) {

‎MISC/Move-Lists.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ if ($MigrationType -eq "Export") {
110110
"0x0100415C46DF0F4B45939BDEC96C5014A10E",# Microblog Properties Content Type
111111
"0x0101009148F5A04DDD49CBA7127AADA5FB792B",# Rich Media Asset Content Type
112112
"0x0101009148F5A04DDD49CBA7127AADA5FB792B00291D173ECE694D56B19D111489C4369D"# Video Rendition Content Type
113-
"0x0101009D1CB255DA76424F860D91F20E6C41180043153F945E98468297E67C3EEE43AB70"# Space Content Type
114-
)
113+
"0x0101009D1CB255DA76424F860D91F20E6C41180043153F945E98468297E67C3EEE43AB70",# Space Content Type
114+
"0x0101009D1CB255DA76424F860D91F20E6C411800C57E7DC123744954AACC08D1D5260154")# Content Freshness
115115

116116
foreach ($nodeIdin$nodesToRemove) {
117117
$nodes=$xml.SelectNodes("//*[@ID='$nodeId']")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp