Example #1
0
        public void exportAsMotion()
        {
            if (MotionFile == null)
            {
                return;
            }

            System.Windows.Forms.SaveFileDialog sfd;
            sfd          = new System.Windows.Forms.SaveFileDialog();
            sfd.Title    = "Save motion as anb";
            sfd.FileName = "motion.motion";
            sfd.ShowDialog();
            if (sfd.FileName != "")
            {
                MemoryStream memStream = new MemoryStream();
                MotionFile.toStream().CopyTo(memStream);
                File.WriteAllBytes(sfd.FileName, memStream.ToArray());
            }
        }
Example #2
0
        public Stream toStream()
        {
            Stream stream = new MemoryStream();

            Bar.Entry MotionEntry = new Bar.Entry();
            MotionEntry.Type   = Bar.EntryType.Motion;
            MotionEntry.Index  = MotionIndex;
            MotionEntry.Name   = MotionName;
            MotionEntry.Stream = MotionFile.toStream();

            Bar.Entry TriggerEntry = new Bar.Entry();
            TriggerEntry.Type   = Bar.EntryType.MotionTriggers;
            TriggerEntry.Index  = TriggerIndex;
            TriggerEntry.Name   = TriggerName;
            TriggerEntry.Stream = (MotionTriggerFile != null) ? MotionTriggerFile.toStream() : new MemoryStream();

            Bar.Write(stream, new List <Bar.Entry> {
                MotionEntry, TriggerEntry
            });

            stream.Position = 0;
            return(stream);
        }