Exemplo n.º 1
0
        // Updates files (settings)
        public static void UpdateFiles()
        {
            try
            {
                // Update files
                Rasu SettingsTemplate = new Rasu(Resources.settings);
                Reference.RSettings.MergeFile(SettingsTemplate);

                SettingsTemplate.Set("version", Application.ProductVersion);

                File.WriteAllText(Reference.RSettings.GetFilePath(), SettingsTemplate.GetFileContent());
                Reference.RSettings.ReloadFile();
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(Program.mainForm, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        public static void UpdateFiles()
        {
            try
            {
                // Merge update
                Rasu UpdateSettings = new Rasu(Resources.settings);
                Reference.RasuSettings.MergeFile(UpdateSettings);

                // Replace informations
                Reference.RasuSettings.Set("version", Application.ProductVersion);

                // Save
                File.WriteAllText(Reference.RasuSettings.GetFilePath(), UpdateSettings.GetFileContent());
                Reference.RasuSettings.ReloadFile();
            }
            catch (Exception ex)
            {
                Utils.ThrowException(ex);
            }
        }
Exemplo n.º 3
0
        public WatchFile(String name, String extension)
        {
            try
            {
                this.Name      = name;
                this.Extension = extension;
                this.Path      = Reference.PlaylistsPath + Program.mainForm.playlistsList.Text + "\\" + name;

                if (Extension != ".web")
                {
                    var player = new WindowsMediaPlayer();
                    var clip   = player.newMedia(this.Path + this.Extension);
                    this.Duration = TimeSpan.FromSeconds(clip.duration).ToString();
                }

                Rasu VideoInfo = new Rasu(this.Path + ".info");

                // Check updates
                if (VideoInfo.Get("video_file_version") != Application.ProductVersion)
                {
                    Rasu VideoInfoTemplate = new Rasu(Resources.video);
                    VideoInfo.MergeFile(VideoInfoTemplate);

                    VideoInfoTemplate.Set("video_file_version", Application.ProductVersion);

                    File.WriteAllText(VideoInfo.GetFilePath(), VideoInfoTemplate.GetFileContent());
                    VideoInfo.ReloadFile();
                }

                this.Description = VideoInfo.Get("video_description");
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(Program.mainForm, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }