public void LoadBase(string path) { NUSContent.Format format = NUSContent.GetFormat(path); if (format == NUSContent.Format.Decrypted) { ValidateBase(path); if (Directory.Exists(BasePath)) { Directory.Delete(BasePath, true); Base = null; } if (Useful.DirectoryCopy(path, BasePath, true)) { Base = GetLoadedBase(); } else { throw new Exception("Could not load base \"" + path + "\"."); } } else if (format == NUSContent.Format.Encrypted) { ValidateEncryptedBase(path); if (Directory.Exists(BasePath)) { Directory.Delete(BasePath, true); Base = null; } Directory.CreateDirectory(BasePath); NUSContent.Decrypt(path, BasePath); Base = GetLoadedBase(); } else { StringBuilder strBuilder = new StringBuilder(); strBuilder.AppendLine("The folder not contains a valid NUS content."); strBuilder.AppendLine("If it is an unpackaged (decrypted) NUS content, then:"); strBuilder.AppendLine("The \"" + path + "\\code\" folder not exist."); strBuilder.AppendLine("Or \"" + path + "\\content\" folder not exist."); strBuilder.AppendLine("Or \"" + path + "\\meta\" folder not exist."); strBuilder.AppendLine("If it is an packaged (encrypted) NUS content, then:"); strBuilder.AppendLine("The \"" + path + "\\title.tmd\" file not exist."); strBuilder.AppendLine("Or \"" + path + "\\title.tik\" file not exist."); strBuilder.AppendLine("Or \"" + path + "\\title.cert\" file not exist."); throw new Exception(strBuilder.ToString()); } }
protected void CopyBase(string outPath) { Useful.DirectoryCopy(BasePath, outPath, true); if (Directory.Exists(Path.Combine(outPath, "content", "app", ".tern-defs"))) { Directory.Delete(Path.Combine(outPath, "content", "app", ".tern-defs"), true); } if (Directory.Exists(Path.Combine(outPath, "content", "app", "plugins"))) { Directory.Delete(Path.Combine(outPath, "content", "app", "plugins"), true); } if (Directory.Exists(Path.Combine(outPath, "content", "app", "www"))) { Directory.Delete(Path.Combine(outPath, "content", "app", "www"), true); } if (File.Exists(Path.Combine(outPath, "content", "app", ".gitignore"))) { File.Delete(Path.Combine(outPath, "content", "app", ".gitignore")); } if (File.Exists(Path.Combine(outPath, "content", "app", ".jscodehints"))) { File.Delete(Path.Combine(outPath, "content", "app", ".jscodehints")); } if (File.Exists(Path.Combine(outPath, "content", "app", "appinfo.xml"))) { File.Delete(Path.Combine(outPath, "content", "app", "appinfo.xml")); } if (File.Exists(Path.Combine(outPath, "content", "app", "intelxdk.config.additions.xml"))) { File.Delete(Path.Combine(outPath, "content", "app", "intelxdk.config.additions.xml")); } if (File.Exists(Path.Combine(outPath, "content", "app", "intelxdk.config.android.xml"))) { File.Delete(Path.Combine(outPath, "content", "app", "intelxdk.config.android.xml")); } if (File.Exists(Path.Combine(outPath, "content", "app", "intelxdk.config.chrome.xml"))) { File.Delete(Path.Combine(outPath, "content", "app", "intelxdk.config.chrome.xml")); } if (File.Exists(Path.Combine(outPath, "content", "app", "intelxdk.config.ios.xml"))) { File.Delete(Path.Combine(outPath, "content", "app", "intelxdk.config.ios.xml")); } if (File.Exists(Path.Combine(outPath, "content", "app", "intelxdk.config.windows.xml"))) { File.Delete(Path.Combine(outPath, "content", "app", "intelxdk.config.windows.xml")); } if (File.Exists(Path.Combine(outPath, "content", "app", "intelxdk.config.windows8.xml"))) { File.Delete(Path.Combine(outPath, "content", "app", "intelxdk.config.windows8.xml")); } if (File.Exists(Path.Combine(outPath, "content", "app", "intelxdk.config.wp81.xml"))) { File.Delete(Path.Combine(outPath, "content", "app", "intelxdk.config.wp81.xml")); } if (File.Exists(Path.Combine(outPath, "content", "app", "xdk-publish-meta-data.json"))) { File.Delete(Path.Combine(outPath, "content", "app", "xdk-publish-meta-data.json")); } }