예제 #1
0
        public ChangeSet(ConfigNode vn, string cfgDirName)
        {
            string _version = "";

            if (!vn.TryGetValue("version", ref _version))
            {
                Debug.Log("[KCL] Badly formatted version in directory " + cfgDirName);
                _version = "null";
            }
            string _versionName = "";

            if (!vn.TryGetValue("versionName", ref _versionName))
            {
                version = new ChangelogVersion(_version, cfgDirName);
            }
            else
            {
                version = new ChangelogVersion(_version, cfgDirName, _versionName);
            }

            //loads change fields (needed for backwards compatibility
            foreach (string change in vn.GetValues("change"))
            {
                changes.Add(new Change(change, new List <string>()));
            }
            //loads change nodes
            foreach (ConfigNode chn in vn.GetNodes("CHANGE"))
            {
                changes.Add(new Change(chn, cfgDirName));
            }
        }
예제 #2
0
        /// <summary>
        /// Initialize a change set based on a config node
        /// </summary>
        /// <param name="vn">Config node for this change set</param>
        /// <param name="cfgDirName">Path where we found this file</param>
        public ChangeSet(ConfigNode vn, string cfgDirName)
        {
            // TryGetValue returns true if the node exists, and false if the node doesn't
            // By negating the value it allows you to catch bad TryGets
            string _version = "";

            if (!vn.TryGetValue("version", ref _version))
            {
                Debug.Log("[KCL] Badly formatted version in directory " + cfgDirName);
                _version = "null";
            }
            string _versionName = null;

            vn.TryGetValue("versionName", ref _versionName);
            string _versionDate = null;

            vn.TryGetValue("versionDate", ref _versionDate);
            string _versionKSP = null;

            vn.TryGetValue("versionKSP", ref _versionKSP);

            version = new ChangelogVersion(_version, cfgDirName, _versionName, _versionDate, _versionKSP);

            // Loads change fields (needed for backwards compatibility
            foreach (string change in vn.GetValues("change"))
            {
                changes.Add(new Change(change, new List <string>()));
            }
            // Loads change nodes
            foreach (ConfigNode chn in vn.GetNodes("CHANGE"))
            {
                changes.Add(new Change(chn, cfgDirName));
            }
            changes = changes.OrderBy(o => o.type).ToList();
        }
예제 #3
0
 public ChangeSet(ChangelogVersion v, List <Change> ch)
 {
     version = v;
     changes = ch;
 }