Exemplo n.º 1
0
        public static Gdk.Pixbuf GetThumb(VolumeItem item, VolumeDatabase db, int size)
        {
            string dbDataPath     = PathUtil.GetDbDataPath(db);
            string volumeDataPath = DbData.GetVolumeDataPath(dbDataPath, item.VolumeID);
            string thumbsPath     = DbData.GetVolumeDataThumbsPath(volumeDataPath);
            string thumbName      = System.IO.Path.Combine(
                thumbsPath,
                string.Format("{0}.png", item.ItemID));

            if (File.Exists(thumbName))
            {
                if (size > 0)
                {
                    return(new Gdk.Pixbuf(thumbName, size, size, false));
                }
                else
                {
                    return(new Gdk.Pixbuf(thumbName));
                }
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        private void PurgeVolume(TreeIter volumeIter)
        {
            Volume volume = tvVolumes.GetVolume(volumeIter);

            database.RemoveVolume(volume.VolumeID);

            // remove external db data
            string dbDataPath     = PathUtil.GetDbDataPath(database);
            string volumeDataPath = DbData.GetVolumeDataPath(dbDataPath, volume.VolumeID);

            if (Directory.Exists(volumeDataPath))
            {
                Directory.Delete(volumeDataPath, true);
            }

            tvVolumes.RemoveVolume(volumeIter);
        }
Exemplo n.º 3
0
        private void SaveLog(long volumeID)
        {
            string dbDataPath     = PathUtil.GetDbDataPath(database);
            string volumeDataPath = DbData.GetVolumeDataPath(dbDataPath, volumeID);

            if (!IO.Directory.Exists(volumeDataPath))
            {
                IO.Directory.CreateDirectory(volumeDataPath);
            }

            string logfile = IO.Path.Combine(volumeDataPath, "scanner.log");

            using (IO.StreamWriter w = new IO.StreamWriter(IO.File.OpenWrite(logfile))) {
                w.WriteLine(string.Format("{0} scanner log ({0} version: {1}, VolumeDB version: {2}) saved on {3}",
                                          App.Name,
                                          App.Version,
                                          Util.GetVolumeDBVersion(),
                                          DateTime.Now.ToString("yyyyy-MM-dd")));
                w.WriteLine();
                w.WriteLine(scannerLog.ToString());
            }
        }