private void AddUnityPackages(List <Upset> upsetList) { string[] files = Directory.GetFiles(Path, "*.*"); Version Unity5 = new Version { Major = 5 }; foreach (string FileName in files) { try { if (!IsUnityPackage(FileName)) { continue; } // assume unityPackage doesn't contain an upset file for now. In the future we can support it Upset upset = TryLoadUpset(FileName); if (upset == null) { continue; } // Note: the spec may contain incomplete unity version here (e.g. 5.6). Maybe we should have a ParseThinUnityVersion if (VersionParser.ParseIncompleteVersion(upset.UnityVersion, false) < Unity5) { throw new NotSupportedException("The package has been packed by a Unity version prior to Unity5, and we do not support this. Contact the package maintainer for updated version."); } upsetList.Add(upset); } catch (Exception e) { UnityEngine.Debug.LogErrorFormat("Could not load package at {0}, ignoring it ({1}):\n{2}", FileName, e.Message, e.StackTrace); } } }
public void ParseCorrectUpliftVersions() { Assert.AreEqual(VersionParser.ParseIncompleteVersion("0.9.1"), new Version { Major = 0, Minor = 9, Patch = 1 } ); Assert.AreEqual(VersionParser.ParseIncompleteVersion("1.0.0beta3"), new Version { Major = 1, Minor = 0, Patch = 0, Optional = 3 } ); }