/// <summary> /// Gets the asset from a filesystem folder path. /// </summary> /// <param name="path"></param> /// <param name="parent"></param> /// <returns></returns> public static ArkAsset GetAssetFromFolderPath(string path, ArkInstall install) { //Get the fileinfo FileInfo info = new FileInfo(path); //Get the parent namespace ArkNamespace parent = ArkNamespace.GetNamespaceFromFolderPath(info.Directory.FullName, install); //Create object ArkAsset a = new ArkAsset { info = info, filename = path, parent = parent, installation = install }; //Get the name without the extension if (info.Name.Contains(".")) { a.name = info.Name.Substring(0, info.Name.LastIndexOf('.')); a.extension = info.Name.Substring(a.name.Length + 1); } else { a.name = info.Name; a.extension = ""; } //Set name a.fullName = parent.fullName + a.name; return(a); }
/// <summary> /// Creates a package object. /// </summary> /// <param name="patch"></param> /// <param name="install"></param> public DeltaExportPackage(DeltaExportPatch patch, ArkInstall install, string name, string id, bool isMod) { installation = install; this.patch = patch; this.name = name; this.id = id; this.isMod = isMod; }
/// <summary> /// Creates a new branch /// </summary> /// <param name="install"></param> public DeltaExportPatch(ArkInstall install) { //Generate a tag tag = ArkImportTools.ImageTool.GenerateID(12) + "-" + Program.config.enviornment; Log.WriteSuccess("DeltaExportPatch", "Created a new patch with ID " + tag); time = DateTime.UtcNow; this.installation = install; this.queued_images = new List <QueuedImage>(); }
public static ArkAsset GetAssetFromGame(string name, ArkInstall install) { //Verify that we actually match a correct kind of path if (!name.StartsWith("/Game/")) { throw new Exception("This is not a game namespace path."); } //Add the folder names. We're going to assume that this is a .uasset file string path = install.contentFolder + name.Substring("/Game/".Length) + ".uasset"; //Ensure this file exists if (!File.Exists(path)) { throw new Exception("Could not find ArkAsset from game path. Is it not a uasset file?"); } //Now, we'll get it as usualy return(GetAssetFromFolderPath(path, install)); }
/// <summary> /// Gets a namespace from a game path. Will start with /Game/ /// </summary> /// <param name="name"></param> /// <param name="install"></param> /// <returns></returns> public static ArkNamespace GetNamespaceFromGame(string name, ArkInstall install) { //Verify that we actually match a correct kind of path if (!name.StartsWith("/Game/")) { throw new Exception("This is not a game namespace path."); } //Verify that this is not an asset if (!name.EndsWith('/')) { throw new Exception("This is an asset, not a namespaced folder. Use ArkAsset instead."); } //Add the folder names string path = install.contentFolder + name.Substring("/Game/".Length); //Now, we'll get it as usualy return(GetNamespaceFromFolderPath(path, install)); }
/// <summary> /// Gets a namespace from a folder path. /// </summary> /// <param name="path"></param> /// <param name="install"></param> /// <returns></returns> public static ArkNamespace GetNamespaceFromFolderPath(string path, ArkInstall install) { //Get the directory info DirectoryInfo info = new DirectoryInfo(path); //Find root names DirectoryInfo lastParent = info.Parent; List <string> rootNames = new List <string>(); while (lastParent.FullName != install.dir.FullName) { rootNames.Add(lastParent.Name); lastParent = lastParent.Parent; } rootNames.Reverse(); //Reverse so that we match the direction we said //Create the full name string fullName = "/Game/"; foreach (var s in rootNames) { fullName += s + "/"; } fullName += info.Name + "/"; //Make data ArkNamespace n = new ArkNamespace { dir = info, name = info.Name, installation = install, roots = rootNames.ToArray(), fullName = fullName, pathname = path }; return(n); }