Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.20 KB | None | 0 0
  1. private static string getRealPathCurrent(string prefix, string path, string title_id)
  2.         {
  3.             string savePath = Program.root + "/" + prefix + "/" + title_id;
  4.             string[] stringSeparators = new string[] { "vol/content/", "vol\\content\\" };
  5.             string[] result;
  6.             string resultstr = "";
  7.             result = path.Split(stringSeparators, StringSplitOptions.None);
  8.             if (result.Length >= 2)
  9.             {
  10.                 resultstr = result[result.Length - 1];
  11.                 stringSeparators = new string[] { "/", "\\" };
  12.                 result = resultstr.Split(stringSeparators, StringSplitOptions.None);
  13.                
  14.                 savePath += "/" + "content";
  15.                 resultstr = "";
  16.                
  17.                 for (int i = 0; i < result.Length; i++)
  18.                 {
  19.                     resultstr += "/" + result[i];
  20.                 }
  21.  
  22.                 savePath += resultstr;
  23.  
  24.                 return savePath;
  25.             }
  26.             else {
  27.                 if (currentPersistentID == 0) return "";
  28.                 stringSeparators = new string[] { "vol/save/", "vol\\save\\" };
  29.  
  30.                 result = path.Split(stringSeparators, StringSplitOptions.None);
  31.                 if (result.Length < 2) return "";
  32.                 resultstr = result[result.Length - 1];
  33.                 stringSeparators = new string[] { "/", "\\" };
  34.                 result = resultstr.Split(stringSeparators, StringSplitOptions.None);
  35.                 if (result.Length < 2)
  36.                 {
  37.                     if (result[0] != "common") return savePath + "/" + String.Format("{0:X}", currentPersistentID);
  38.                     return savePath + "/" + "common";
  39.                 }
  40.                 resultstr = "";
  41.                 if (result[0] != "common")
  42.                     savePath += "/" + String.Format("{0:X}", currentPersistentID);
  43.                 else
  44.                     savePath += "/" + "common";
  45.                 for (int i = 1; i < result.Length; i++)
  46.                 {
  47.                     resultstr += "/" + result[i];
  48.                 }
  49.  
  50.                 savePath += resultstr;
  51.                 return savePath;
  52.             }
  53.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement