Exemple #1
0
        public static bool Save(Form formMain)
        {
            // save main window size/position
            settings.window.left   = formMain.Left;
            settings.window.top    = formMain.Top;
            settings.window.height = formMain.Height;
            settings.window.width  = formMain.Width;

            // save maximized state
            settings.window.maximized = formMain.WindowState == FormWindowState.Maximized ? true : false;

            // set modified, version
            settings.about = GetConfigSettingsAbout();

            string configFile = MyFile.EnsureDataFile("settings", settings.exportExt, "config");

            if (configFile == null)
            {
                return(false);
            }

            MyLog.RotateFiles(configFile);

            // save new settings
            MySerialize.ToFile(settings.exportFormat, configFile, settings);

            return(true);
        }
Exemple #2
0
        public static bool Save()
        {
            if (listVideoInfos == null)
            {
                return(false);
            }

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            MyLog.Add("Saving VideoItems -->");

            foreach (ConfigSettings.Source settingsSource in Config.settings.sources)
            {
                string dataFile = MyFile.EnsureDataFile("videos", Config.settings.exportExt, "data", settingsSource.alias);
                if (dataFile == null)
                {
                    continue;
                }

                List <VideoInfo> saveVideoInfos = new List <VideoInfo>(listVideoInfos.Count());
                saveVideoInfos = listVideoInfos.Where(x => x.sourceAlias == settingsSource.alias && x.videoItem != null && x.videoItem.title != null).OrderBy(x => x.videoItem.title).ToList();


                if (saveVideoInfos == null)
                {
                    continue;
                }
                int nbrVideoInfos = saveVideoInfos.Count();
                if (nbrVideoInfos == 0)
                {
                    continue;
                }

                MyLog.RotateFiles(dataFile);
                MySerialize.ToFile(Config.settings.exportFormat, dataFile, saveVideoInfos);


                FileInfo fileInfo = MyFile.FileInfo(dataFile);
                string   toFile   = "to " + dataFile.Replace(MyFile.exeDirectory, "");
                if (fileInfo != null)
                {
                    toFile += " " + MyFile.FormatSize(fileInfo.Length);
                }
                MyLog.Add("Saved " + nbrVideoInfos + " VideoItems " + toFile);
            }

            stopWatch.Stop();
            MyLog.AddElapsed("<-- in ", stopWatch.Elapsed);

            return(true);
        }
        public static bool Save()
        {
            string dataFile = MyFile.EnsureDataFile("stats", Config.settings.exportExt, "stats");

            if (dataFile == null)
            {
                return(false);
            }

            MyLog.RotateFiles(dataFile);

            MySerialize.ToFile(Config.settings.exportFormat, dataFile, videoInfoStats);

            return(true);
        }
        public static bool Save()
        {
            string syncFile = MyFile.EnsureDataFile("sync", Config.settings.exportExt, "sync");

            if (syncFile == null)
            {
                return(false);
            }

            MyLog.RotateFiles(syncFile);

            // save new settings
            MySerialize.ToFile(Config.settings.exportFormat, syncFile, syncSettings);

            return(true);
        }
        /// <summary>
        /// parse the MVE .mve file
        /// </summary>
        /// <param name="mveFile"></param>
        /// <returns></returns>
        public bool UpdateMVE(VideoInfo videoInfo)
        {
            if (!Config.settings.createMVE)
            {
                return(false);
            }

            string videoInfoFile = videoInfo.videoDirectory + @"\movie.mve";
            bool   ret           = MySerialize.ToFile(Config.settings.exportFormat, videoInfoFile, videoInfo);
            string message       = "mve video item to " + videoInfoFile;

            if (ret)
            {
                MyLog.Add("wrote " + videoInfoFile);
            }
            else
            {
                MyLog.Add("error writing to " + videoInfoFile);
            }
            return(ret);
        }
Exemple #6
0
        public bool SaveFilter(string filterName)
        {
            if (filterName.Length == 0)
            {
                return(false);
            }
            string dataFile;

            if (filterName == "<_reset_>")
            {
                MessageBox.Show("Cannot Save filter");
                subFormFilterForm.ResetForm();
                return(false);
            }
            else if (filterName == "<filter when closed>")
            {
                dataFile = MyFile.EnsureDataFile("Filter", Config.settings.exportExt, "filters", "filter when closed");
                if (dataFile == null)
                {
                    return(false);
                }
            }
            else if (filterName == "<last saved filter>")
            {
                MessageBox.Show("Cannot Save filter.\nThis Filter will be automaticlly be saved when you Save another Filter.");
                return(false);
            }
            else
            {
                filterName = MyFile.SafeFileName(filterName);
                dataFile   = MyFile.EnsureDataFile("Filter", Config.settings.exportExt, "filters", filterName);
                if (dataFile == null)
                {
                    return(false);
                }
                allow_comboBoxPreset_SelectedIndexChanged = false;
                comboBoxFilters.Text = filterName;
                allow_comboBoxPreset_SelectedIndexChanged = true;
            }

            FilterInfo filterInfo = subFormFilterForm.GetFilterForm();

            MyLog.RotateFiles(dataFile);

            filterInfo.about = Config.GetConfigSettingsAbout();
            filterInfo.name  = filterName;
            if (filterInfo.description == null)
            {
                filterInfo.description = "";
            }

            MySerialize.ToFile(Config.settings.exportFormat, dataFile, filterInfo);

            MyLog.Add("Saved Filter Preset " + dataFile.Replace(MyFile.exeDirectory, ""));

            // make a copy of last saved filter
            if (filterName != "<last saved filter>" && filterName != "<filter when closed>")
            {
                dataFile = MyFile.EnsureDataFile("Filter", Config.settings.exportExt, "filters", "last saved filter");
                if (dataFile == null)
                {
                    return(false);
                }
                MyLog.RotateFiles(dataFile);


                MySerialize.ToFile(Config.settings.exportFormat, dataFile, filterInfo);
                MyLog.Add("Saved Filter Preset " + dataFile.Replace(MyFile.exeDirectory, ""));
            }


            return(true);
        }