예제 #1
0
        private void ImportDialog_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (this.DialogResult == DialogResult.OK)
            {
                ImportOptions type = ImportOptions.None;
                if (ckxNewScore.Checked)
                {
                    type |= ImportOptions.New;
                }
                if (ckxMergeExisting.Checked)
                {
                    if (ckxNames.Checked)
                    {
                        type |= ImportOptions.Names;
                    }
                    if (ckxUrl.Checked)
                    {
                        type |= ImportOptions.Parsing;
                    }
                    if (ckxRules.Checked)
                    {
                        type |= ImportOptions.Rules;
                    }
                }

                ExchangeManager.Import(m_center, m_fileName, type);
            }
        }
예제 #2
0
        private static bool OnlineUpdate(ScoreCenter center, string url, ImportOptions options)
        {
            bool result = false;

            if (String.IsNullOrEmpty(url) == false)
            {
                ScoreCenter online = Tools.ReadOnlineSettings(url, false);
                if (online != null)
                {
                    int nb = ExchangeManager.Import(center, online, options);
                    Tools.LogMessage("Imported: {0}", nb);
                    result = (nb > 0);

                    // if scores imported
                    if (result)
                    {
                        // check icons
                        UpdateIcons(center);
                    }
                }
            }

            return(result);
        }
예제 #3
0
        /// <summary>
        /// Import scores from an XML file.
        /// </summary>
        /// <param name="center">The existing center.</param>
        /// <param name="fileName">The path of the file to import.</param>
        /// <param name="mergeOptions">The merge options.</param>
        public static void Import(ScoreCenter center, string fileName, ImportOptions mergeOptions)
        {
            ScoreCenter imported = Tools.ReadSettings(fileName, true);

            ExchangeManager.Import(center, imported, mergeOptions);
        }