// // Producer.cs - represents a content creator associated with a particular Song, Character, Costume, or other concert asset // // Author: // Michael Becker // // Copyright (c) 2011-2020 Mike Becker's Software // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; using System.Collections.Generic; using UniversalEditor.ObjectModels.Concertroid.Library; namespace UniversalEditor.ObjectModels.Concertroid { /// /// Represents a content creator associated with a particular , , , or other /// concert asset. /// public class Producer : ICloneable { public class ProducerCollection : System.Collections.ObjectModel.Collection { } private static Producer[] _list = null; public static Producer[] GetProducers() { if (_list == null) { List ConfigurationPaths = new List(); ConfigurationPaths.Add(String.Join(System.IO.Path.DirectorySeparatorChar.ToString(), new string[] { Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Mike Becker's Software", "Concertroid" })); ConfigurationPaths.Add(String.Join(System.IO.Path.DirectorySeparatorChar.ToString(), new string[] { Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Mike Becker's Software", "Concertroid" })); ConfigurationPaths.Add(String.Join(System.IO.Path.DirectorySeparatorChar.ToString(), new string[] { Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Mike Becker's Software", "Concertroid" })); ConfigurationPaths.Add(String.Join(System.IO.Path.DirectorySeparatorChar.ToString(), new string[] { System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "..", "Configuration" })); List list = new List(); foreach (string ConfigurationPath in ConfigurationPaths) { if (!System.IO.Directory.Exists(ConfigurationPath)) continue; string[] fileNames = System.IO.Directory.GetFiles(ConfigurationPath, "*.library", System.IO.SearchOption.AllDirectories); foreach (string fileName in fileNames) { if (UniversalEditor.Common.Reflection.GetAvailableObjectModel(fileName, out LibraryObjectModel library)) { foreach (Producer p in library.Producers) { list.Add(p); } } } } _list = list.ToArray(); } return _list; } /// /// Gets or sets the globally-unique identifier (GUID) associated with this . /// /// The globally-unique identifier (GUID) associated with this . public Guid ID { get; set; } = Guid.Empty; /// /// Gets or sets the given name of this . /// /// The given name of this . public string FirstName { get; set; } = String.Empty; /// /// Gets or sets the family name of this . /// /// The family name of this . public string LastName { get; set; } = String.Empty; public object Clone() { Producer clone = new Producer(); clone.ID = ID; clone.FirstName = (FirstName.Clone() as string); clone.LastName = (LastName.Clone() as string); return clone; } public override string ToString() { return FirstName + " " + LastName; } } }