Esempio n. 1
0
        public SmFile(string filePath)
        {
            if (!Path.IsPathRooted(filePath))
            {
                filePath = Path.GetFullPath(filePath);
            }

            var validExtensions = new[] { ".sm", ".ssc" };

            if (File.Exists(filePath) == false || !validExtensions.Contains(Path.GetExtension(filePath)))
            {
                throw new ArgumentException($"The given .sm or .ssc file path is either invalid or a file was not found. Path: {filePath}");
            }

            FilePath = filePath;

            Group = Path.GetFullPath(Path.Combine(filePath, @"..\.."))
                    .Split(Path.DirectorySeparatorChar)
                    .Last();

            Directory = Path.GetDirectoryName(filePath);

            ChartMetadata = new ChartMetadata();
            _attributes   = new Dictionary <SmFileAttribute, string>();

            ParseFile();
            SetDisplayBpm();
        }
Esempio n. 2
0
        public void ChartMetadataSaveRequired(ChartMetadata metadata)
        {
            m_chartMetadata             = metadata;
            m_chartMetadataSaveRequired = true;

            m_jcwChartCtl.SaveRequired(m_chartMetadataSaveRequired, m_chartMetadata);
            m_jcwChartMetadataCtl.SaveRequired(m_chartMetadataSaveRequired, m_chartMetadata);
        }
Esempio n. 3
0
        private void RefreshMetadata()
        {
            ChartMetadata = new ChartMetadata();
            _attributes   = new Dictionary <SmFileAttribute, string>();

            ParseFile();
            SetDisplayBpm();
        }
Esempio n. 4
0
 public void RefreshChartMetadataControl(ChartMetadata metadata)
 {
     if (DisplayChartMetadataDockingPanel)
     {
         m_jcwChartMetadataCtl.BeginInit();
         m_jcwChartMetadataCtl.Metadata = metadata;
         m_jcwChartMetadataCtl.EndInit();
     }
 }
Esempio n. 5
0
        public JcwChartFrm(ChartMetadata metadata, DisplayOptions displayOptions, IJcwCustomizeChart customizer)
            : base()
        {
            // set the default skin to use
            DevExpress.LookAndFeel.UserLookAndFeel.Default.Style                 = LookAndFeelStyle.Skin;
            DevExpress.LookAndFeel.UserLookAndFeel.Default.UseWindowsXPTheme     = false;
            DevExpress.LookAndFeel.UserLookAndFeel.Default.UseDefaultLookAndFeel = true;

            // enabled form skinning
            SkinManager.EnableFormSkins();

            m_displayOptions        = displayOptions;
            m_originalChartMetadata = metadata;
            m_chartMetadata         = metadata.Clone() as ChartMetadata;

            ChartStatistics = new Dictionary <StatisticTypes, Dictionary <string, double> > ();

            InitializeComponent();

            m_jcwChartCtl           = new JcwChartCtl(m_chartMetadata, this, customizer);
            m_jcwChartMetadataCtl   = new JcwChartMetadataCtl();
            m_jcwChartStatisticsCtl = new JcwChartStatisticsCtl();
            m_jcwChartCtl.SuspendLayout();
            m_jcwChartMetadataCtl.SuspendLayout();
            m_jcwChartStatisticsCtl.SuspendLayout();
            jcwDockManager.SuspendLayout();
            SuspendLayout();
            //
            // jcwChartCtl
            //
            m_jcwChartCtl.Dock = DockStyle.Fill;
            //
            // jcwChartMetadataCtl
            //
            m_jcwChartMetadataCtl.AutoHide     = true;
            m_jcwChartMetadataCtl.ChartControl = m_jcwChartCtl;
            m_jcwChartMetadataCtl.ChartForm    = this;
            m_jcwChartMetadataCtl.Metadata     = m_chartMetadata;
            m_jcwChartMetadataCtl.PanelCaption = JcwResources.GetString("MetadataBarText");
            //
            // jcwChartStatisticsCtl
            //
            m_jcwChartStatisticsCtl.AutoHide     = true;
            m_jcwChartStatisticsCtl.ChartControl = m_jcwChartCtl;
            m_jcwChartStatisticsCtl.Metadata     = m_chartMetadata;
            m_jcwChartStatisticsCtl.PanelCaption = JcwResources.GetString("StatisticsBarText");

            Controls.Add(m_jcwChartCtl);
            ProcessDisplayOptions();

            m_jcwChartCtl.ResumeLayout(false);
            m_jcwChartMetadataCtl.ResumeLayout(false);
            m_jcwChartStatisticsCtl.ResumeLayout(false);
            jcwDockManager.ResumeLayout(false);
            ResumeLayout(false);
        }
Esempio n. 6
0
        public void RevertChartMetadataSaveRequired()
        {
            if (m_chartMetadataSaveRequired)
            {
                m_chartMetadataSaveRequired = false;
                m_chartMetadata             = m_originalChartMetadata.Clone() as ChartMetadata;

                m_jcwChartCtl.SaveRequired(m_chartMetadataSaveRequired, m_chartMetadata);
                m_jcwChartMetadataCtl.SaveRequired(m_chartMetadataSaveRequired, m_chartMetadata);
            }
        }
Esempio n. 7
0
        public void SaveRequired(bool saveRequired, ChartMetadata metadata)
        {
            if (saveRequired)
            {
                Metadata = metadata;

                // rebind data grid view to chart metadata binding lists
                NoteDataGridView.DataSource            = GetFilteredChartNotes();
                VerticalLinesDataGridView.DataSource   = GetFilteredChartVerticalLines();
                HorizontalLinesDataGridView.DataSource = GetFilteredChartHorizontalLines();
            }
        }
Esempio n. 8
0
        public void SaveChartMetadata()
        {
            if (CanSaveChartMetadata && m_chartMetadataSaveRequired)
            {
                // make sure that the zooming parameters are not saved in the chart metadata
                m_chartMetadata.IsChartZoomedIn        = false;
                m_chartMetadata.IsChartZoomInSelected  = false;
                m_chartMetadata.IsChartZoomOutSelected = false;
                m_chartMetadata.ChartHorizontalMinimum = m_originalChartMetadata.ChartHorizontalMinimum;
                m_chartMetadata.ChartHorizontalMaximum = m_originalChartMetadata.ChartHorizontalMaximum;

                m_chartMetadataSaveRequired = false;
                m_originalChartMetadata     = m_chartMetadata;

                // raise save metadata required event to any subscribers
                if (OnSaveMetadata != null)
                {
                    OnSaveMetadata(this, new JcwEventArgs <ChartMetadata> (m_chartMetadata));
                }

                m_jcwChartCtl.SaveRequired(m_chartMetadataSaveRequired, m_chartMetadata);
                m_jcwChartMetadataCtl.SaveRequired(m_chartMetadataSaveRequired, m_chartMetadata);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                m_chartMetadata         = null;
                m_originalChartMetadata = null;

                if (m_jcwChartCtl != null)
                {
                    Controls.Remove(m_jcwChartCtl);
                    m_jcwChartCtl.Dispose();
                    m_jcwChartCtl = null;
                }

                if (jcwDockManager != null)
                {
                    Controls.Remove(jcwDockManager);
                    jcwDockManager.Dispose();
                    jcwDockManager = null;
                }
            }

            base.Dispose(disposing);
        }
Esempio n. 10
0
 public JcwChartFrm(ChartMetadata metadata, DisplayOptions displayOptions)
     : this(metadata, displayOptions, null)
 {
 }
Esempio n. 11
0
        public override void OnSelectedSong(Playable[] playable, ChartMetadata chartInfo, PlayLog[] playLogs)
        {
            // Use player1's Playable
            var p = playable[0];

            Lyric = null;
            Lyric = new LyRiCs[p.Sections.Length];

            // *.lrc parse phase
            for (var section = 0; section < Lyric.Length; section++)
            {
                // get path for file
                var audioPath = chartInfo.Audio[section];

                if (audioPath == null)
                {
                    continue;
                }

                var folder  = Path.GetDirectoryName(audioPath);
                var lrcFile = $"{Path.GetFileNameWithoutExtension(audioPath)}.lrc";

                var lrcPath = Path.Combine(folder, lrcFile);

                // read and parse
                if (!File.Exists(lrcPath))
                {
                    continue;
                }

                var file = File.ReadAllText(lrcPath);

                var result = LRCDotNet.Parse(file);

                Lyric[section] = result;
            }
            // phase end

            // Generation texture phase
            LyricAndTimings = new LyricAndTiming[Lyric.Length][];
            for (var section = 0; section < Lyric.Length; section++)
            {
                if (Lyric[section] == null)
                {
                    continue;
                }

                var lyric = Lyric[section].Lyrics;
                LyricAndTimings[section] = new LyricAndTiming[lyric.Count()];

                for (var l = 0; l < lyric.Count(); l++)
                {
                    // convert ms to us
                    var timing = (long)(lyric[l].Time.TotalMilliseconds * 1000.0);
                    // apply offset
                    if (Theme.Offset != 0)
                    {
                        timing += Theme.Offset;
                    }
                    var tex = LyricFont.GetTexture(lyric[l].Text);
                    LyricAndTimings[section][l] = new LyricAndTiming(tex, timing);
                }
            }
            // phase end

            Showing = null;
        }