Example #1
0
        public ModDependency(ReleaseData sourceRelease, string rawDependencyString)
        {
            SourceRelease = sourceRelease;

            Match match = DependencyRegex.Match(rawDependencyString);

            TargetModName = match.Groups["name"].Value; // that mod might not even exist

            DependencyType = match.Groups["prefix"].Value switch
            {
                "?" => ModDependencyType.Optional,
                "(?)" => ModDependencyType.HiddenOptional,
                "!" => ModDependencyType.Incompatible,
                "~" => ModDependencyType.Unordered,
                _ => ModDependencyType.Regular,
            };

            Operator = match.Groups["operator"].Value switch
            {
                "<" => ModDependencyOperator.Less,
                "<=" => ModDependencyOperator.LessEquals,
                "=" => ModDependencyOperator.Equals,
                "==" => ModDependencyOperator.Equals,
                ">=" => ModDependencyOperator.GreaterEquals,
                ">" => ModDependencyOperator.Greater,
                _ => ModDependencyOperator.None,
            };

            if (match.Groups["version"].Success)
            {
                TargetVersion = FactorioVersion.Parse(match.Groups["version"].Value);
            }
        }
Example #2
0
 public ModDependency(ReleaseData sourceRelease, string targetModName, ModDependencyType dependencyType)
 {
     SourceRelease  = sourceRelease;
     TargetModName  = targetModName;
     DependencyType = dependencyType;
 }
 /// <summary>
 ///
 /// </summary>
 /// <returns>The file name of the release. Follows the pattern "{name}_{version}.zip"</returns>
 public string GetFileName()
 {
     return(ReleaseData.GetFileName(Mod.Name, Version));
 }