示例#1
0
 //Rekursive Factory Method
 public static FLP_Event FromEventID(FLP_File.EventID id)
 {
     FLP_Event ev = null;
     if (id < (FLP_File.EventID)FLP_File.FLP_Text) ev = FLPE_Val.FromEventID(id);
     else ev = FLPE_Data.FromEventID(id);
     return ev;
 }
示例#2
0
        //Rekursive Factory Method, propagates to further subclasses depending on ID
        public static new FLP_Event FromEventID(FLP_File.EventID id)
        {
            //FLP_Ctrl_Init_RecChan - Initial ctrl values
            //ID_Playlist_Events - Arrangement!
            //Special classes...
            if (id == FLP_File.EventID.ID_MixerTrack_Parameters) return new FLPE_MixerTrack_Parameters(id);
            if (id == FLP_File.EventID.FLP_Ctrl_Init_RecChan) return new FLPE_Ctrl_Init_RecChan(id);
            if (id == FLP_File.EventID.ID_Playlist_Track_Info) return new ID_Playlist_Track_Info(id);
            if (id == FLP_File.EventID.ID_Channel_Delay) return new FLPE_Channel_Delay(id);
            if (id == FLP_File.EventID.ID_Channel_Levels) return new FLPE_Channel_Levels(id);
            if (id == FLP_File.EventID.ID_Channel_LevelOffsets) return new FLPE_Channel_LevelOffsets(id);
            if (id == FLP_File.EventID.ID_Channel_Tracking) return new FLPE_Channel_Tracking(id);
            if (id == FLP_File.EventID.ID_Channel_Poly) return new FLPE_Channel_Poly(id);

            if (id == FLP_File.EventID.ID_Pattern_Ctrl_Events) return new FLPE_Pattern_Ctrl_Events(id);
            if (id == FLP_File.EventID.ID_Pattern_Note_Events) return new FLPE_Pattern_Note_Events(id);
            if (id == FLP_File.EventID.ID_MixerTrack_Routing) return new FLPE_MixerTrack_Routing(id);
            if (id == FLP_File.EventID.ID_Project_Time) return new FLPE_Project_Time(id);
            if (id == FLP_File.EventID.ID_Playlist_Events) return new FLPE_Playlist_Events(id);
            //Typed generic classes...
            if (Enum.IsDefined(typeof(FLPE_Unicode.ValidIDs), (byte)id)) return new FLPE_Unicode(id);
            if (Enum.IsDefined(typeof(FLPE_Values.ValidIDs), (byte)id)) return new FLPE_Values(id);
            //Default fallback class
            //if (Enum.IsDefined(typeof(FLPE_Bytes.ValidIDs), (byte)id))
                return new FLPE_Bytes(id);
            //else
            //    throw new InvalidDataException(id + " is not a valid DATA ID.");
        }
示例#3
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                //TODO: behavior not yet implemented.
                Console.WriteLine("Usage: FLP-XML.exe <FLP, XML or Dir> [action, action, action ...] \nwhere action:"
                    + "\n-rup : Remove Unusued Patterns"
                    + "\n-clean : Remove redundant default values"
                    + "\n-xml : Export to XML");
                return;
            }
            string filename = args[0];

            if (filename.EndsWith(".flp"))
            {
                FLP_File flp = new FLP_File(filename, null);

                // Perform various options here:


                XmlSerializer xmlserializer = new XmlSerializer(typeof(FLP_File));

                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Encoding = new UnicodeEncoding(false, false);
                settings.NewLineChars = "\n";
                settings.Indent = true;
                settings.OmitXmlDeclaration = false;

                using (StringWriter textWriter = new StringWriter())
                {
                    using (XmlWriter xmlWriter = XmlWriter.Create(textWriter, settings))
                    {
                        xmlserializer.Serialize(xmlWriter, flp);
                        File.WriteAllText(filename + ".xml", textWriter.ToString(), Encoding.Unicode);
                    }
                }
            }
            else if (Directory.Exists(filename))
            {

            }
            else if (filename.EndsWith(".xml"))
            {
                using (FileStream stream = File.OpenRead(filename))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(FLP_File));
                    FLP_File loaded = (FLP_File)serializer.Deserialize(stream);
                    BinaryWriter w = new BinaryWriter(File.OpenWrite(filename + "_fromXML.flp"));
                    loaded.Serialize(w);
                    w.Close();
                }
            }

        }
示例#4
0
 //Rekursive Factory Method for fixed length values (1,2,4 bytes)
 public static new FLP_Event FromEventID(FLP_File.EventID id)
 {
     if (id == FLP_File.EventID.ID_Channel_CutCutBy) return new FLPE_CutCutBy(id);
     if (id == FLP_File.EventID.ID_Channel_Delay_ModXYChange) return new FLPE_DelayFRes(id);
     if (Enum.IsDefined(typeof(FLPE_Color.ValidIDs), (byte)id)) return new FLPE_Color(id);
     int bytelength = id < (FLP_File.EventID)FLP_File.FLP_Word ? 1 : id < (FLP_File.EventID)FLP_File.FLP_Int ? 2 : 4;
    //if (Enum.IsDefined(typeof(FLPE_Val.ValidIDs), (byte)id))
         return new FLPE_Val(id, bytelength);
    //else
    //   throw new InvalidDataException(id + " is not a valid ID.");
 }
示例#5
0
 private void LoadAndShowFLPFile(string filename)
 {
     //Load
     TextWriter loggy = File.CreateText(filename + ".log");
     DateTime t1 = DateTime.Now;
     if (filename.EndsWith(".flp"))
     {
         this.CurrentFLPFile = new FLP_File(filename,loggy);
     }
     else if(filename.EndsWith(".fst"))
     {
         this.CurrentFLPFile = new FLP_File(filename, loggy);
     }
     else if (filename.EndsWith(".xml"))
     {
         using (FileStream stream = File.OpenRead(filename))
         {
             XmlSerializer serializer = new XmlSerializer(typeof(FLP_File));
             this.CurrentFLPFile = (FLP_File)serializer.Deserialize(stream);
         }
     }
     loggy.Close();
     DateTime t2 = DateTime.Now;
 }
 public FLPE_Channel_Tracking(FLP_File.EventID type) : base(type) { }
示例#7
0
 public FLP_Event Seek(FLP_Event origin, FLP_File.EventID id, bool forward = true)
 {
     int i = this._events.IndexOf(origin);
     if (i == -1) return null;
     int d = forward ? 1 : -1;
     for (; i >= 0 && i < _events.Count; i += d)
     {
         if (_events[i].Id == id) return _events[i];
     }
     return null;
 }
示例#8
0
        public FLP_File ExtractMixer()
        {

            FLP_File mixer = new FLP_File();
            mixer.FLPFormat = FLP_File.FLP_Format.FLP_Format_PlugState;
            mixer.HeaderChunkLength = this.HeaderChunkLength;
            mixer.FLPHeaderChunkID = this.FLPHeaderChunkID;
            mixer.BeatDivision = this.BeatDivision;
            mixer.DataChunkID = this.DataChunkID;
            mixer.RackChannelCount = 0;
            /*
            // TODO
            foreach (FLP_Event n in this.GetEventsWithIDs(EventID.ID_Pattern_Color, EventID.ID_Pattern_Name, EventID.ID_Pattern_Note_Events, EventID.ID_Pattern_Ctrl_Events))
                if (!used_pattern_ids.Contains(((FLPE_Val)this.Seek(n, EventID.ID_Pattern_New, false)).V))
                    _events.Remove(n);
                    */
            return mixer;
        }
示例#9
0
 public FLPE_CutCutBy(FLP_File.EventID type) : base(type) { }
示例#10
0
 public FLPE_Values(FLP_File.EventID type) : base(type) { }
 public FLPE_Ctrl_Init_RecChan(FLP_File.EventID type) : base(type) { }
 public FLPE_Playlist_Events(FLP_File.EventID type) : base(type) { }
示例#13
0
 public FLPE_Project_Time(FLP_File.EventID type) : base(type) { }
 public FLPE_MixerTrack_Parameters(FLP_File.EventID type) : base(type) { }
示例#15
0
 public FLPE_Bytes(FLP_File.EventID type) : base(type) { }
 public ID_Playlist_Track_Info(FLP_File.EventID type) : base(type) { }
 public FLPE_Channel_LevelOffsets(FLP_File.EventID type) : base(type) { }
 public FLPE_Pattern_Note_Events(FLP_File.EventID type) : base(type) { }
示例#19
0
 private static void ProcessFLPFile(FLP_File f, string[] cmds)
 {
     throw new NotImplementedException(); //TODO
 }
示例#20
0
 public FLPE_Channel_Poly(FLP_File.EventID type) : base(type) { }
示例#21
0
 public FLPE_Val(FLP_File.EventID type, int bytelength) : base(type) { this.B = bytelength; }
示例#22
0
 public FLPE_Color(FLP_File.EventID type) : base(type) { }
 public FLPE_MixerTrack_Routing(FLP_File.EventID type) : base(type) { }
示例#24
0
 public FLPE_Data(FLP_File.EventID type) : base(type) { }
示例#25
0
 public FLP_Event(FLP_File.EventID type) { this.Id = type; }
示例#26
0
 public FLPE_DelayFRes(FLP_File.EventID type) : base(type) { }
示例#27
0
 public FLPE_Unicode(FLP_File.EventID type) : base(type) { }