Exemplo n.º 1
0
        public static string GetCompatLaunchString(string launchParams)
        {
            Versions VC      = new Versions();
            string   working = launchParams;

            bool isVersionValid = Versions.MednafenVersionCheck(false);

            if (isVersionValid == false)
            {
                // skip processing
                return(working);
            }

            // iterate through version changes
            foreach (MednafenChangeHistory c in GetMednafenCompatibilityMatrix())
            {
                // process changes
                foreach (var change in c.Changes)
                {
                    StringBuilder sb = new StringBuilder();
                    switch (change.ChangeMethod)
                    {
                    case ChangeType.ToRemove:                   // explicitly remove the entire command
                        string[] arr = working.Split('-');
                        foreach (string s in arr)
                        {
                            if (!s.Contains(change.Item))
                            {
                                sb.Append("-" + s);
                            }
                        }
                        working = sb.ToString();
                        break;

                    case ChangeType.ToRemoveCompletely:
                        string[] arr2 = working.Split('-');
                        foreach (string s in arr2)
                        {
                            if (!s.Contains(change.Item))
                            {
                                sb.Append("-" + s);
                            }
                        }
                        working = sb.ToString();
                        break;

                    case ChangeType.ToRename:
                        string[] arr3 = working.Split('-');
                        foreach (string s in arr3)
                        {
                            if (!s.Contains(change.Item))
                            {
                                sb.Append("-" + s);
                            }
                            else
                            {
                                sb.Append("-" + s.Replace(change.Item, change.ChangeItem));
                            }
                        }
                        working = sb.ToString();
                        break;

                    case ChangeType.ToAdd:
                        // currently not used
                        break;
                    }
                }

                working = working.TrimStart('-');

                if (ReturnMednafenMajor(VC.CurrentMednafenVersion) == ReturnMednafenMajor(c.Version))
                {
                    // we have reached the targeted version and all transformations should have been applied
                    break;
                }
            }
            return(working);
        }
Exemplo n.º 2
0
 // constructors
 public Versions()
 {
     CurrentMednafenVersion          = LogParser.GetMednafenVersion();
     LatestCompatMednafenVersion     = Versions.GetMednafenCompatibilityMatrix().First().Version;
     LatestCompatMednafenDownloadURL = Versions.GetMednafenCompatibilityMatrix().First().DownloadURL;
 }