Example #1
0
        public Database()
        {
            mFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), DIRECTORY);
            if (!Directory.Exists(mFolder))
            {
                Directory.CreateDirectory(mFolder);
            }

            string        s    = "cYo.Projects.ComicRack.Engine.Database.ComicLibraryListItem";
            ComicListItem item = Program.Database.ComicLists.GetItems <ComicListItem>(false).FirstOrDefault((ComicListItem cli) => cli.GetType().ToString() == s);

            if (item != null)
            {
                libraryGuid = item.Id;
            }

            s    = "[BCR Users]";
            item = Program.Database.ComicLists.GetItems <ComicListItem>(false).FirstOrDefault((ComicListItem cli) => cli.Name == s);
            if (item == null)
            {
                // Add it
                ComicListItemFolder bcrFolder = new ComicListItemFolder(s);
                ((ComicLibrary)Program.Database).ComicLists.Add(bcrFolder);
                item = Program.Database.ComicLists.GetItems <ComicListItem>(false).FirstOrDefault((ComicListItem cli) => cli.Name == s);
            }

            if (item != null)
            {
                bcrGuid = item.Id;
            }
        }
Example #2
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            string path = Path.Combine(BCRInstaller.Instance.InstallFolder, "about.html");

            webBrowserAbout.Url = new Uri("file://" + path);

            textBoxPort.Text    = Database.Instance.GlobalSettings.webserver_port.ToString();
            actualPort          = Database.Instance.GlobalSettings.webserver_port;
            textBoxUrlBase.Text = Database.Instance.GlobalSettings.url_base;

            string        s    = "cYo.Projects.ComicRack.Engine.Database.ComicLibraryListItem";
            ComicListItem item = Program.Database.ComicLists.GetItems <ComicListItem>(false).FirstOrDefault((ComicListItem cli) => cli.GetType().ToString() == s);

            if (item != null)
            {
                libraryGuid = item.Id;
            }

            FillComboHomeList();
            FillComboUsers();

            SetEnabledState();
        }
Example #3
0
        public static ComboTreeNode ToComboTreeNode(this ComicListItem x)
        {
            ComboTreeNode node = new ComboTreeNode(x.Name);

            node.Tag = x.Id;

            ComicListItemFolder folderList = x as ComicListItemFolder;

            if (folderList != null)
            {
                node.Nodes.AddRange(folderList.Items.Select(c => c.ToComboTreeNode()));
            }

            return(node);
        }
Example #4
0
        public static ComicList ToComicList(this ComicListItem x, int depth = -1)
        {
            ComicList list = new ComicList
            {
                Name       = x.Name,
                Id         = x.Id,
                ListsCount = 0,
                Type       = x.GetType().ToString().Split('.').LastOrDefault()
            };

            ComicListItemFolder folderList = x as ComicListItemFolder;

            if (folderList != null)
            {
                list.ListsCount = folderList.Items.Count;
                // recurse ?
                if (depth != 0)
                {
                    list.Lists = folderList.Items.Select(c => c.ToComicList(depth - 1));
                }
            }

            return(list);
        }