/// <summary>
 /// Disposes of the unamanged resources.
 /// </summary>
 /// <param name="p_booDisposing">Whether the method is being called from the <see cref="IDisposable.Dispose()"/> method.</param>
 protected override void Dispose(bool p_booDisposing)
 {
     if (PluginOrderManager != null)
     {
         PluginOrderManager.Dispose();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Setup for the plugin management libraries.
        /// </summary>
        protected virtual void SetupPluginManagement(FileUtil p_futFileUtility)
        {
            string strPath = EnvironmentInfo.ApplicationPersonalDataFolderPath;

            strPath = Path.Combine(Path.Combine(Path.Combine(strPath, "loot"), ModeId), "masterlist.yaml");

            if (SupportsPluginAutoSorting)
            {
                if (!File.Exists(strPath))
                {
                    if (!Directory.Exists(strPath))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(strPath));
                    }

                    using (Stream masterlist = new MemoryStream(Properties.Resources.masterlist))
                    {
                        using (ZipArchive archive = new ZipArchive(masterlist, ZipArchiveMode.Read))
                        {
                            archive.GetEntry(String.Format("{0}.yaml", ModeId.ToLower())).ExtractToFile(strPath);
                        }
                    }
                }

                PluginSorter = new PluginSorter(EnvironmentInfo, this, p_futFileUtility, strPath);
            }

            PluginOrderManager = new PluginOrderManager(EnvironmentInfo, this, p_futFileUtility);
        }
        /// <summary>
        /// Setup for the plugin management libraries.
        /// </summary>
        protected virtual void SetupPluginManagement(FileUtil p_futFileUtility)
        {
            string strPath = EnvironmentInfo.ApplicationPersonalDataFolderPath;

            strPath = Path.Combine(Path.Combine(Path.Combine(strPath, "loot"), ModeId), "masterlist.yaml");

            if (SupportsPluginAutoSorting)
            {
                ManageMasterlistFile(strPath, false);

                try
                {
                    PluginSorter = new PluginSorter(EnvironmentInfo, this, p_futFileUtility, strPath);
                }
                catch (NotSupportedException)
                {
                    ManageMasterlistFile(strPath, true);
                    PluginSorter = new PluginSorter(EnvironmentInfo, this, p_futFileUtility, strPath);
                }
            }

            PluginOrderManager = new PluginOrderManager(EnvironmentInfo, this, p_futFileUtility);
        }