Пример #1
0
        private void Subscribe(string id, long timestamp, IFileSource file_source)
        {
            string text   = file_source.Read("mod.yaml");
            Header header = (!string.IsNullOrEmpty(text)) ? YamlIO.Parse <Header>(text, file_source.GetRoot() + "\\mod.yaml", null, null) : null;

            if (header == null)
            {
                Header header2 = new Header();
                header2.title       = id;
                header2.description = id;
                header = header2;
            }
            Label label = default(Label);

            label.id = id;
            label.distribution_platform = distribution_platform;
            label.version = id.GetHashCode();
            label.title   = header.title;
            Label label2 = label;
            Mod   mod    = new Mod(label2, header.description, file_source, UI.FRONTEND.MODS.TOOLTIPS.MANAGE_LOCAL_MOD, delegate
            {
                Application.OpenURL("file://" + file_source.GetRoot());
            });

            if (file_source.GetType() == typeof(Directory))
            {
                mod.status = Mod.Status.Installed;
            }
            Global.Instance.modManager.Subscribe(mod, this);
        }