Beispiel #1
0
        public static cvnBase Open(Stream fp, cvnType FileType, Stream pfp = null)
        {
            switch (FileType)
            {
            case cvnType.Text: return(new cv0(fp));

            case cvnType.CSV: return(new cv1(fp));

            case cvnType.Graphic:
                cv2 result = new cv2();
                try
                {
                    result.Open(fp, pfp);
                }
                catch (System.ArgumentException)
                {
                    result = null;
                }
                return(result);

            case cvnType.Audio: return(new cv3(fp));

            default: return(null);
            }
        }
Beispiel #2
0
        private void ChangeEnabled(cvnType type)
        {
            MenuExtract.Enabled = true;
            MenuImport.Enabled  = true;
            Control[] controls   = new Control[] { cv0Data, cv1List, cv2Image, cv3Play };
            string[]  names      = new string[] { "텍스트", "CSV 리스트", "비트맵", "오디오" };
            int       pass_index = 4;

            switch (type)
            {
            case cvnType.Text:
                pass_index            = 0;
                MenuEncodings.Visible = MenuEncodings.Enabled = MenuChangeEncoding.Enabled = true;
                break;

            case cvnType.CSV:
                pass_index            = 1;
                MenuEncodings.Visible = MenuEncodings.Enabled = MenuChangeEncoding.Enabled = true;
                break;

            case cvnType.Graphic:
                pass_index = 2;
                break;

            case cvnType.Audio:
                pass_index = 3;
                break;
            }
            this.Text = "(" + names[pass_index] + ") " + Path.GetFileName(m_workingpath) + " - cvn 에디터";
            for (int i = 0; i < controls.Length; i++)
            {
                if (pass_index == i)
                {
                    break;
                }
                controls[i].Visible = false;
                controls[i].Enabled = false;
                controls[i].Dock    = DockStyle.None;
            }
            if (pass_index >= controls.Length)
            {
                return;
            }
            controls[pass_index].Visible = true;
            controls[pass_index].Enabled = true;
            controls[pass_index].Dock    = DockStyle.Fill;
        }
Beispiel #3
0
        public static cvnBase Open(string Path, cvnType FileType = cvnType.Unknown, string PalettePath = "")
        {
            cvnType file_type = FileType;

            if (file_type == cvnType.Unknown)
            {
                string extension = Path.Substring(Path.IndexOf('.') + 1);
                switch (extension)
                {
                case "cv0": file_type = cvnType.Text; break;

                case "cv1": file_type = cvnType.CSV; break;

                case "cv2": file_type = cvnType.Graphic; break;

                case "cv3": file_type = cvnType.Audio; break;

                default: throw new FormatException("지원하지 않는 확장자입니다.");
                }
            }
            switch (file_type)
            {
            case cvnType.Text: return(new cv0(Path));

            case cvnType.CSV: return(new cv1(Path));

            case cvnType.Graphic:
                cv2 result = new cv2();
                try
                {
                    result.Open(Path, PalettePath);
                }
                catch (ArgumentException)
                {
                    result = null;
                }
                return(result);

            case cvnType.Audio: return(new cv3(Path));

            default: return(null);
            }
        }
Beispiel #4
0
        public TenshiEntry(Stream MainStream, string EntryName, long Offset, long Length)
        {
            m_mainstream    = MainStream;
            m_entry         = EntryName;
            m_offset        = Offset;
            m_length        = Length;
            m_changedstream = null;
            m_position      = 0;

            m_type = cvnType.Unknown;
            string extension = Path.GetExtension(m_entry);

            switch (extension)
            {
            case ".cv0": m_type = cvnType.Text; break;

            case ".cv1": m_type = cvnType.CSV; break;

            case ".cv2": m_type = cvnType.Graphic; break;

            case ".cv3": m_type = cvnType.Audio; break;
            }
        }
Beispiel #5
0
 private void ChangeEnabled(cvnType type)
 {
     MenuExtract.Enabled = true;
     MenuImport.Enabled = true;
     Control[] controls = new Control[] { cv0Data, cv1List, cv2Image, cv3Play };
     string[] names = new string[] { "텍스트", "CSV 리스트", "비트맵", "오디오" };
     int pass_index = 4;
     switch (type)
     {
         case cvnType.Text:
             pass_index = 0;
             MenuEncodings.Visible = MenuEncodings.Enabled = MenuChangeEncoding.Enabled = true;
             break;
         case cvnType.CSV:
             pass_index = 1;
             MenuEncodings.Visible = MenuEncodings.Enabled = MenuChangeEncoding.Enabled = true;
             break;
         case cvnType.Graphic:
             pass_index = 2;
             break;
         case cvnType.Audio:
             pass_index = 3;
             break;
     }
     this.Text = "(" + names[pass_index] + ") " + Path.GetFileName(m_workingpath) + " - cvn 에디터";
     for (int i = 0; i < controls.Length; i++)
     {
         if (pass_index == i) break;
         controls[i].Visible = false;
         controls[i].Enabled = false;
         controls[i].Dock = DockStyle.None;
     }
     if (pass_index >= controls.Length) return;
     controls[pass_index].Visible = true;
     controls[pass_index].Enabled = true;
     controls[pass_index].Dock = DockStyle.Fill;
 }