Example #1
0
        private void Resync()
        {
#if DIALOG_CHECK_MODS
            Log.Warning("Begin Dialog_CheckMods.Resync");
#endif
#if TRACE && DIALOG_CHECK_MODS
            Log.Message("    Mods:");
#endif
            foreach (ModToSync mod in this.modsToSync)
            {
#if TRACE && DIALOG_CHECK_MODS
                Log.Message("        " + mod.Mod.Name);
#endif
                if (mod.Host != null)
                {
                    RestUtil.GetModSyncXml(mod.Host.ModSyncXmlUri, (XmlDocument xml) =>
                    {
#if TRACE && DIALOG_CHECK_MODS
                        Log.Message("ModCheck Callback: " + mod.Mod.Name);
#endif
                        mod.RequestDone = true;

                        ModSyncInfo info;
                        IHost host;
                        if (xml != null)
                        {
                            if (mod.Host is HugsLibVersionHost)
                            {
                                if (ModToSyncFactory.ReadVersion(xml, mod.Mod.Name, out info, out host))
                                {
                                    mod.RemoteInfo = info;
                                }
                            }
                            else if (mod.Host is ManifestHost)
                            {
                                if (ModToSyncFactory.ReadManifest(xml, mod.Mod.Name, out info, out host))
                                {
                                    mod.RemoteInfo = info;
                                }
                            }
                            else
                            {
                                if (ModToSyncFactory.ReadModSync(xml, mod.Mod.Name, out info, out host))
                                {
                                    mod.RemoteInfo = info;
                                }
                            }
                        }
                    });
                }
                else
                {
                    mod.RequestDone = true;
                }
            }
#if DIALOG_CHECK_MODS
            Log.Warning("End Dialog_CheckMods.Resync");
#endif
        }