internal void AddGUID(Upset package, InstallSpecType kind, string guid) { InstalledPackage internalPackage; if (!SetupInternalPackage(package, out internalPackage)) { return; } // Note: not catching in case of internalPackage not found // as it is valid error throwing condition // Check if guid doesn't exist and return if it does if (internalPackage.Install.Any(spec => spec is InstallSpecGUID && spec.Type == kind && (spec as InstallSpecGUID).Guid == guid)) { return; } // Create new spec InstallSpec newSpec = new InstallSpecGUID { Type = kind, Guid = guid }; InstallSpec[] newArray = new InstallSpec[internalPackage.Install.Length + 1]; internalPackage.Install.CopyTo(newArray, 0); newArray[newArray.Length - 1] = newSpec; internalPackage.Install = newArray; }
internal void AddLocation(Upset package, InstallSpecType kind, string path) { string unixPath = Uplift.Common.FileSystemUtil.MakePathUnix(path); InstalledPackage internalPackage; if (!SetupInternalPackage(package, out internalPackage)) { return; } // Note: not catching in case of internalPackage not found // as it is valid error throwing condition // Check if path doesn't exist and return if it does if (internalPackage.Install.Any(spec => spec is InstallSpecPath && spec.Type == kind && (spec as InstallSpecPath).Path == unixPath)) { return; } // Create new spec InstallSpec newSpec = new InstallSpecPath { Type = kind, Path = unixPath }; InstallSpec[] newArray = new InstallSpec[internalPackage.Install.Length + 1]; internalPackage.Install.CopyTo(newArray, 0); newArray[newArray.Length - 1] = newSpec; internalPackage.Install = newArray; }
private void TryUpringAddGUID(Upbring upbring, string file, Upset package, InstallSpecType type, string destination) { if (file.EndsWith(".meta")) { return; } string metaPath = Path.Combine(destination, file + ".meta"); if (!File.Exists(metaPath)) { upbring.AddLocation(package, type, Path.Combine(destination, file)); return; } string guid = LoadGUID(metaPath); upbring.AddGUID(package, type, guid); }