Advertisement
Guest User

Untitled

a guest
May 29th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1.         String pfold[] = {"", " (ja)", "(ja)"};
  2.         String pfnew[] = {"", " (ja)", " (ja)"};
  3.         int raold[] = {1,309,309};
  4.         int ranew[] = {580,333,333};
  5.        
  6.         for (int p = 0; p < 3; p++) {
  7.             for (int i = raold[p]; i <=ranew[p]; i++) {
  8.                 String oldFileName = "Episode"+String.Format("{0:000}",i)+pfold[p];
  9.                 String newFileName = "Episode "+String.Format("{0:000}",i)+pfnew[p];
  10.                
  11.                 //Dateien umbenennen
  12.                 //Episodenbilder
  13.                 Page p = new Page(site,"Datei:"+oldFileName+".jpg");
  14.                 p.Load(); if(p.Exists()) p.RenameTo("Datei:"+newFileName+".jpg",reason);
  15.                 //NextHints
  16.                 p = new Page(site,"Datei:"+oldFileName+"-Hint.jpg");
  17.                 p.Load(); if(p.Exists()) p.RenameTo("Datei:"+newFileName+"-Hint.jpg",reason);
  18.                 //Diashows
  19.                 int maxj = 0;
  20.                 for (int j = 1; j <= 20; j++) {
  21.                     p = new Page(site,"Datei:"+oldFileName+"-"+j.ToString()+".jpg");
  22.                     p.Load(); if(p.Exists()) p.RenameTo("Datei:"+newFileName+"-"+j.ToString()+".jpg",reason); else { maxj = j-1; break; }
  23.                 }
  24.    
  25.                 //Verlinkungen auf allen Seiten korrigieren
  26.                 PageList pl = new PageList(site);
  27.                 pl.FillFromPagesUsingImage(oldFileName+".jpg");
  28.                 pl.FillFromPagesUsingImage(oldFileName+"-Hint.jpg");
  29.                 for (int j = 1; j <= maxj; j++) {
  30.                     pl.FillFromPagesUsingImage(oldFileName+"-"+j.ToString()+".jpg");
  31.                 }
  32.                 pl.RemoveRecurring();
  33.                 foreach(Page page in pl) {
  34.                     page.Load();
  35.                     page.text = page.text.Replace(oldFileName+".jpg",newFileName+".jpg");
  36.                     page.text = page.text.Replace(oldFileName+"-Hint.jpg",newFileName+"-Hint.jpg");
  37.                     for (int j = 1; j <= maxj; j++) {
  38.                         page.text = page.text.Replace(oldFileName+"-"+j.ToString()+".jpg",newFileName+"-"+j.ToString()+".jpg");
  39.                     }
  40.                     page.Save(reason,true);
  41.                 }
  42.             }
  43.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement