public void TestAddNamedTrackCopyWithOwnEnd()
        {
            var          manualMidi     = new MidiEventCollection(1, 200);
            var          noteEvent      = new NoteOnEvent(0, 1, 1, 1, 1);
            const string trackName      = "name";
            var          trackNameEvent = new TextEvent(trackName, MetaEventType.SequenceTrackName, 0);
            var          endTrackEvent  = new MetaEvent(MetaEventType.EndTrack, 0, 90);

            var track = manualMidi.AddTrack();

            track.Add(trackNameEvent);
            track.Add(noteEvent);
            track.Add(noteEvent.OffEvent);
            track.Add(endTrackEvent);

            var extensionMidi = new MidiEventCollection(1, 200);
            var events        = new MidiEvent[] { noteEvent, noteEvent.OffEvent, endTrackEvent };

            extensionMidi.AddNamedTrackCopy(trackName, events);

            MidiAssert.Equal(manualMidi, extensionMidi);

            // Assert they aren't the same objects
            var manualTrack    = manualMidi[0];
            var extensionTrack = extensionMidi[0];

            for (var e = 0; e < manualTrack.Count; e++)
            {
                Assert.That(extensionTrack[e], Is.Not.SameAs(manualTrack[e]));
            }

            // Verify the NoteOnEvent.OffEvent link
            Assert.AreEqual(extensionMidi[0][2], ((NoteOnEvent)extensionMidi[0][1]).OffEvent);
        }
        public void TestAddNamedTrack()
        {
            var          manualMidi     = new MidiEventCollection(1, 200);
            var          noteEvent      = new NoteOnEvent(0, 1, 1, 1, 1);
            const string trackName      = "name";
            var          trackNameEvent = new TextEvent(trackName, MetaEventType.SequenceTrackName, 0);
            var          endTrackEvent  = new MetaEvent(MetaEventType.EndTrack, 0, noteEvent.OffEvent.AbsoluteTime);

            var track = manualMidi.AddTrack();

            track.Add(trackNameEvent);
            track.Add(noteEvent);
            track.Add(noteEvent.OffEvent);
            track.Add(endTrackEvent);

            var extensionMidi = new MidiEventCollection(1, 200);
            var events        = new MidiEvent[] { noteEvent, noteEvent.OffEvent };

            extensionMidi.AddNamedTrack(trackName, events);

            MidiAssert.Equal(manualMidi, extensionMidi);

            // Assert events (not name / end) are the same objects
            var manualTrack    = manualMidi[0];
            var extensionTrack = extensionMidi[0];

            for (var e = 1; e < manualTrack.Count - 1; e++)
            {
                Assert.That(extensionTrack[e], Is.SameAs(manualTrack[e]));
            }
        }
Example #3
0
        private static IMessage FactoryEvento(IFoteable node, ulong msgid, String texto, String gmid, DateTime dt)
        {
            IMessage salida;

            if (texto.StartsWith(CodeStr))
            {
                STrace.Debug(typeof(FmiPacketId).FullName, node.Id,
                             String.Format("llego mensaje predefinido: {0}", texto));
                var code =
                    (MessageIdentifier)
                    Convert.ToUInt32(texto.Substring(CodeStr.Length, texto.IndexOf(';', CodeStr.Length) - CodeStr.Length));
                salida = code.FactoryEvent(node.Id, msgid, null, dt, null, null);
            }
            else
            {
                STrace.Debug(typeof(FmiPacketId).FullName, node.Id,
                             String.Format("llego mensaje personalizado: {0}", texto));
                salida = new TextEvent(node.Id, msgid, dt)
                {
                    Text = texto,
                };
            }

            var dc = BaseDeviceCommand.createFrom(String.Format(Mensaje.GarminFm, "A1062500" + gmid), node, null);

            salida.AddStringToSend(dc.ToString(true));
//            Fota.EnqueueOnTheFly(node, 0, new[] { dc }, ref salida);

            return(salida);
        }
Example #4
0
 /// <summary>
 /// Processes the argument String variables
 /// </summary>
 public static String ProcessString(String args, Boolean dispatch)
 {
     try
     {
         String result = args;
         if (result == null)
         {
             return(String.Empty);
         }
         result = reArgs.Replace(result, new MatchEvaluator(ReplaceVars));
         if (!dispatch || result.IndexOf('$') < 0)
         {
             return(result);
         }
         TextEvent te = new TextEvent(EventType.ProcessArgs, result);
         EventManager.DispatchEvent(Globals.MainForm, te);
         result = ReplaceArgsWithGUI(te.Value);
         return(result);
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
         return(String.Empty);
     }
 }
Example #5
0
 // Use this for initialization
 void Awake()
 {
     PauseEvent   = Pause;
     ClockEvent   = UpdateClock;
     DescripEvent = UpdateDescrip;
     UpdateText   = SetText;
 }
Example #6
0
 public static void OnText(Message Msg, bool isEdited)
 {
     TextEvent?.Invoke(new MessageEventArgs()
     {
         msg = Msg, isEdited = isEdited
     });
 }
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
        {
            switch (e.Type)
            {
            case EventType.Command:
                DataEvent evnt = (DataEvent)e;
                if (evnt.Action == "FileExplorer.BrowseTo")
                {
                    this.pluginUI.BrowseTo(evnt.Data.ToString());
                    evnt.Handled = true;
                    this.OpenPanel(null, null);
                }
                if (evnt.Action == "FileExplorer.GetContextMenu")
                {
                    evnt.Data    = this.pluginUI.GetContextMenu();
                    evnt.Handled = true;
                }
                break;

            case EventType.FileOpen:
                TextEvent evnt2 = (TextEvent)e;
                if (File.Exists(evnt2.Value))
                {
                    this.pluginUI.AddToMRU(evnt2.Value);
                }
                break;
            }
        }
Example #8
0
 /// <summary>
 /// Processes the argument String variables
 /// </summary>
 public static String ProcessString(String args, Boolean dispatch)
 {
     try
     {
         String result = args;
         if (result == null)
         {
             return(String.Empty);
         }
         result = ProcessCodeStyleLineBreaks(result);
         if (!PluginBase.Settings.UseTabs)
         {
             result = reTabs.Replace(result, new MatchEvaluator(ReplaceTabs));
         }
         result = reArgs.Replace(result, new MatchEvaluator(ReplaceVars));
         if (!dispatch || result.IndexOf('$') < 0)
         {
             return(result);
         }
         TextEvent te = new TextEvent(EventType.ProcessArgs, result);
         EventManager.DispatchEvent(Globals.MainForm, te);
         result      = ReplaceArgsWithGUI(te.Value);
         PrevSelWord = String.Empty;
         PrevSelText = String.Empty;
         return(result);
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
         return(String.Empty);
     }
 }
Example #9
0
 // Token: 0x06002A63 RID: 10851 RVA: 0x001380BC File Offset: 0x001362BC
 private static void smethod_5(EventsCollection eventsCollection_0, Song gclass27_0)
 {
     if (!GClass30.bool_0)
     {
         foreach (MidiEvent midiEvent in eventsCollection_0)
         {
             TimeSignatureEvent timeSignatureEvent = midiEvent as TimeSignatureEvent;
             if (timeSignatureEvent != null)
             {
                 long absoluteTime = midiEvent.AbsoluteTime;
                 gclass27_0.method_39(new GClass25((uint)absoluteTime, (uint)timeSignatureEvent.Numerator, (uint)timeSignatureEvent.Denominator), false);
             }
             else
             {
                 SetTempoEvent setTempoEvent = midiEvent as SetTempoEvent;
                 if (setTempoEvent != null)
                 {
                     long absoluteTime2 = midiEvent.AbsoluteTime;
                     gclass27_0.method_39(new GClass24((uint)absoluteTime2, (uint)(60000000.0 / (double)setTempoEvent.MicrosecondsPerQuarterNote * 1000.0)), false);
                 }
                 else
                 {
                     TextEvent textEvent = midiEvent as TextEvent;
                     if (textEvent != null)
                     {
                         gclass27_0.string_0 = textEvent.Text;
                     }
                 }
             }
         }
         gclass27_0.method_15();
     }
 }
Example #10
0
        public static bool TryParse(TextEvent textEvent, out DrumMixEvent drumMixEvent)
        {
            drumMixEvent = null;
            if (textEvent.MetaEventType != MetaEventType.TextEvent)
            {
                return(false);
            }

            var match = Regex.Match(textEvent.Text, @"^\[mix (?<difficulty>[0-3]) (?<configuration>.*)\]$");

            if (!match.Success)
            {
                return(false);
            }

            var configuration = match.Groups["configuration"].Value;

            if (!ValidConfigurations.Contains(configuration))
            {
                return(false);
            }

            var difficulty = int.Parse(match.Groups["difficulty"].Value);

            drumMixEvent = new DrumMixEvent(difficulty, configuration, textEvent);
            return(true);
        }
Example #11
0
        private void ReportarAssistCargo(LogMensajeBase log, string assistCargoCode)
        {
            try
            {
                if (!log.Coche.ReportaAssistCargo)
                {
                    return;
                }

                STrace.Debug(GetType().FullName, log.Dispositivo.Id, String.Format("AssistCargo Event: {0} -> {1}: {2}", log.Coche.Patente, Config.AssistCargo.AssistCargoEventQueue, assistCargoCode));

                var queue = new IMessageQueue(Config.AssistCargo.AssistCargoEventQueue);

                if (queue.LoadResources())
                {
                    var data = new TextEvent(log.Dispositivo.Id, 0, DateTime.UtcNow)
                    {
                        Text     = assistCargoCode,
                        GeoPoint = new GPSPoint(log.Fecha, (float)log.Latitud, (float)log.Longitud)
                    };
                    queue.Send(data, MessageQueueTransactionType.Automatic);
                }
                else
                {
                    STrace.Error(GetType().FullName, log.Dispositivo.Id, String.Format("Problemas cargando la cola: {0}", Config.AssistCargo.AssistCargoEventQueue));
                }
            }
            catch (Exception e)
            {
                STrace.Exception(GetType().FullName, e, log.Dispositivo.Id);
            }
        }
Example #12
0
        bool OnTextEvent(TextEvent e, Action continuation)
        {
            var eventManager = Resolve <IEventManager>();
            var mapManager   = Resolve <IMapManager>();

            var(useEventText, textSourceId) = eventManager.Context?.Source switch
            {
                EventSource.Map map => (false, (int)map.MapId),
                EventSource.EventSet eventSet => (true, (int)eventSet.EventSetId),
                _ => (false, (int)mapManager.Current.MapId)
            };

            var textEvent =
                useEventText
                    ?  (BaseTextEvent) new EventTextEvent(
                    (EventSetId)textSourceId,
                    e.TextId,
                    e.Location,
                    e.PortraitId)
                    : new MapTextEvent(
                    (MapDataId)textSourceId,
                    e.TextId,
                    e.Location,
                    e.PortraitId);

            return(OnBaseTextEvent(textEvent, continuation));
        }
        // Receives only eventMask events
        public void HandleEvent(object sender, NotifyEvent e)
        {
            if (e.Type == EventType.FileOpen)
            {
                string path      = MainForm.CurFile;
                string extension = Path.GetExtension(path);

                if (extension.ToLower() == ".swf")
                {
                    DisplaySwf(MainForm.CurFile);
                }
            }
            else if (e.Type == EventType.Command)
            {
                TextEvent te = e as TextEvent;
                if (te.Text.StartsWith(COMMAND_POPUPSWF))
                {
                    string[] split  = te.Text.Split(';');
                    string   path   = split[2];
                    int      width  = int.Parse(split[3]);
                    int      height = int.Parse(split[4]);
                    PopupSwf(path, width, height);
                }
            }
        }
Example #14
0
        bool OnPartyMemberTextEvent(PartyMemberTextEvent e, Action continuation)
        {
            var party     = Resolve <IParty>();
            var textEvent = new TextEvent(ContextTextSource, e.TextId, TextLocation.PortraitLeft, e.MemberId);

            return(OnBaseTextEvent(textEvent, continuation));
        }
Example #15
0
        void updater_Tick(object sender, EventArgs e)
        {
            updater.Stop();
            string          src     = File.Exists(logFile) ? File.ReadAllText(logFile) : "";
            MatchCollection matches = reError.Matches(src);

            TextEvent te;

            if (matches.Count == 0)
            {
                te = new TextEvent(EventType.ProcessEnd, "Done(0)");
                EventManager.DispatchEvent(this, te);
                if (!te.Handled)
                {
                    PlaySWF();
                }
                return;
            }

            NotifyEvent ne = new NotifyEvent(EventType.ProcessStart);

            EventManager.DispatchEvent(this, ne);
            foreach (Match m in matches)
            {
                string file = m.Groups["file"].Value;
                string line = m.Groups["line"].Value;
                string desc = m.Groups["desc"].Value.Trim();
                TraceManager.Add(String.Format("{0}:{1}: {2}", file, line, desc), -3);
            }
            te = new TextEvent(EventType.ProcessEnd, "Done(" + matches.Count + ")");
            EventManager.DispatchEvent(this, te);

            (PluginBase.MainForm as Form).Activate();
            (PluginBase.MainForm as Form).Focus();
        }
Example #16
0
        public bool Apply(MidiEvent inEvent, EventRuleArgs args)
        {
            bool match = false;

            TextEvent textEvent = inEvent as TextEvent;

            if (textEvent != null && textEvent.MetaEventType == EventType)
            {
                switch (MatchType)
                {
                case TextMatchType.ExactMatch:
                    match = (textEvent.Text == InValue);
                    break;

                case TextMatchType.Substring:
                    match = textEvent.Text.Contains(InValue);
                    break;

                case TextMatchType.Regex:
                    match = inRegex.Match(textEvent.Text).Success;
                    break;
                }
            }
            if (match)
            {
                textEvent.Text = ProcessText(textEvent.Text, args);
            }
            return(match);
        }
Example #17
0
        /// <summary>
        /// Reverts the document to the orginal state
        /// </summary>
        public void Revert(Boolean showQuestion)
        {
            if (!this.IsEditable)
            {
                return;
            }
            if (showQuestion)
            {
                String dlgTitle = TextHelper.GetString("Title.ConfirmDialog");
                String message  = TextHelper.GetString("Info.AreYouSureToRevert");
                if (MessageBox.Show(Globals.MainForm, message, " " + dlgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }
            TextEvent te = new TextEvent(EventType.FileRevert, Globals.SciControl.FileName);

            EventManager.DispatchEvent(this, te);
            if (!te.Handled)
            {
                while (this.SciControl.CanUndo)
                {
                    this.SciControl.Undo();
                }
                ButtonManager.UpdateFlaggedButtons();
            }
        }
Example #18
0
 // Token: 0x06002A62 RID: 10850 RVA: 0x00137FB8 File Offset: 0x001361B8
 private static void smethod_4(IList <MidiEvent> ilist_0)
 {
     foreach (MidiEvent midiEvent in ilist_0)
     {
         NoteOnEvent noteOnEvent = midiEvent as NoteOnEvent;
         if (noteOnEvent != null)
         {
             Console.WriteLine(string.Concat(new object[]
             {
                 "Note: ",
                 noteOnEvent.NoteNumber,
                 ", Pos: ",
                 noteOnEvent.AbsoluteTime,
                 ", Vel: ",
                 noteOnEvent.Velocity,
                 ", Channel: ",
                 noteOnEvent.Channel,
                 ", Off pos: ",
                 noteOnEvent.OffEvent.AbsoluteTime
             }));
         }
         TextEvent textEvent = midiEvent as TextEvent;
         if (textEvent != null)
         {
             Console.WriteLine(textEvent.Text + " " + textEvent.AbsoluteTime);
         }
     }
 }
Example #19
0
    public IEnumerator BathroomRoll(TextEvent e)
    {
        int i = 0;

        isRollingBathroom = true;

        while (i < toAddBathroom.Length)
        {
            if (roomM.roomIAmIn == "Bathroom")
            {
                masterString += toAddBathroom[i];

                if (toAddBathroom[i] != ' ')
                {
                    //	currentTextSound.pitch = Random.Range(0.99f,1.01f);
                    currentTextSound.Play();
                }
            }



            i++;
            scrb.value  = 0;
            timeTilDone = ((toAddBathroom.Length - i) * del);

            yield return(new WaitForSeconds(del));
        }
        toAddBathroom     = "";
        isRollingBathroom = false;
    }
Example #20
0
    public IEnumerator LivingRoomRoll(TextEvent e)
    {
        int i = 0;

        isRollingLiving = true;

        while (i < toAddLiving.Length)
        {
            if (roomM.roomIAmIn == "Living Room")
            {
                //	if(toAddLiving[i] == '¤'){
                //		masterString += ParsePerson(e);
                //	}


                masterString += toAddLiving[i];

                if (toAddLiving[i] != ' ')
                {
                    //	currentTextSound.pitch = Random.Range(0.99f,1.01f);
                    currentTextSound.Play();
                }
            }

            i++;
            scrb.value  = 0;
            timeTilDone = ((toAddLiving.Length - i) * del);

            yield return(new WaitForSeconds(del));
        }
        isRollingLiving = false;
        toAddLiving     = "";
    }
Example #21
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
        {
            switch (e.Type)
            {
            case EventType.FileOpen:
                TextEvent fo = e as TextEvent;
                if (fo != null)
                {
                    this.pluginUI.CreateDocument(fo.Value);
                }
                break;

            case EventType.FileClose:
                TextEvent fc = e as TextEvent;
                if (fc != null)
                {
                    this.pluginUI.CloseDocument(fc.Value);
                }
                break;

            case EventType.ApplySettings:
                this.pluginUI.UpdateSettings();
                break;

            case EventType.FileEmpty:
                this.pluginUI.CloseAll();
                break;
            }
        }
Example #22
0
 private static void OnText(Message msg, bool isEdited)
 {
     TextEvent?.Invoke(new MessageEventArgs()
     {
         msg = msg, isEdited = isEdited
     });
 }
 /// <summary>
 /// Restores the specified panel layout
 /// </summary>
 public static void RestoreLayout(String file)
 {
     try
     {
         Globals.MainForm.RestoringContents = true;
         Session   session = SessionManager.GetCurrentSession();
         TextEvent te      = new TextEvent(EventType.RestoreLayout, file);
         EventManager.DispatchEvent(Globals.MainForm, te);
         if (!te.Handled)
         {
             Globals.MainForm.CloseAllDocuments(false);
             if (!Globals.MainForm.CloseAllCanceled)
             {
                 session.Type = SessionType.Layout;
                 LayoutManager.BuildLayoutSystems(file);
                 SessionManager.RestoreSession("", session);
             }
         }
         Globals.MainForm.RestoringContents = false;
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
Example #24
0
        /// <summary>
        /// Reloads an editable document
        /// </summary>
        public void Reload(Boolean showQuestion)
        {
            if (!this.IsEditable)
            {
                return;
            }
            if (showQuestion)
            {
                String dlgTitle = TextHelper.GetString("Title.ConfirmDialog");
                String message  = TextHelper.GetString("Info.AreYouSureToReload");
                if (MessageBox.Show(Globals.MainForm, message, " " + dlgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }
            Globals.MainForm.ReloadingDocument = true;
            Int32     position = this.SciControl.CurrentPos;
            TextEvent te       = new TextEvent(EventType.FileReload, this.FileName);

            EventManager.DispatchEvent(Globals.MainForm, te);
            if (!te.Handled)
            {
                EncodingFileInfo info = FileHelper.GetEncodingFileInfo(this.FileName);
                if (info.CodePage == -1)
                {
                    Globals.MainForm.ReloadingDocument = false;
                    return; // If the files is locked, stop.
                }
                Encoding encoding = Encoding.GetEncoding(info.CodePage);
                this.SciControl.IsReadOnly = false;
                this.SciControl.Encoding   = encoding;
                this.SciControl.Text       = info.Contents;
                this.SciControl.IsReadOnly = FileHelper.FileIsReadOnly(this.FileName);
                this.SciControl.SetSel(position, position);
                this.SciControl.EmptyUndoBuffer();
                int lineCount = SciControl.LineCount;
                foreach (var lineNum in this.bookmarks)
                {
                    if (lineNum < 0)
                    {
                        continue;
                    }
                    if (lineNum >= lineCount)
                    {
                        if (!MarkerManager.HasMarker(SciControl, 0, lineCount - 1))
                        {
                            MarkerManager.ToggleMarker(SciControl, 0, lineCount - 1);
                        }
                    }
                    else
                    {
                        MarkerManager.ToggleMarker(SciControl, 0, lineNum);
                    }
                }
                this.InitBookmarks();
                this.fileInfo = new FileInfo(this.FileName);
            }
            Globals.MainForm.OnDocumentReload(this);
        }
Example #25
0
 public Input()
 {
     Key         = new Dictionary <Keyboard.Key, KeyEvent>();
     MouseButton = new Dictionary <Mouse.Button, MouseButtonEvent>();
     Text        = null;
     MouseWheel  = null;
     MouseMove   = null;
 }
Example #26
0
 private bool selectNotice()
 {
     if (notice == null)
     {
         notice = GameObject.Find("Game").transform.Find("GameGraphics").transform.Find("NoticeCanvas").transform.Find("Notice").transform.GetComponent <TextEvent>();
     }
     return(true);
 }
Example #27
0
        /// <summary>
        /// Saves an editable document
        /// </summary>
        public void Save(String file)
        {
            if (!this.IsEditable)
            {
                return;
            }
            if (!this.IsUntitled && FileHelper.FileIsReadOnly(this.FileName))
            {
                String dlgTitle = TextHelper.GetString("Title.ConfirmDialog");
                String message  = TextHelper.GetString("Info.MakeReadOnlyWritable");
                if (MessageBox.Show(Globals.MainForm, message, dlgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ScintillaManager.MakeFileWritable(this.SciControl);
                }
                else
                {
                    return;
                }
            }
            Boolean otherFile = (this.SciControl.FileName != file);

            if (otherFile)
            {
                RecoveryManager.RemoveTemporaryFile(this.FileName);
                TextEvent close = new TextEvent(EventType.FileClose, this.FileName);
                EventManager.DispatchEvent(this, close);
            }
            TextEvent saving = new TextEvent(EventType.FileSaving, file);

            EventManager.DispatchEvent(this, saving);
            if (!saving.Handled)
            {
                this.UpdateDocumentIcon(file);
                this.SciControl.FileName = file;
                ScintillaManager.CleanUpCode(this.SciControl);
                DataEvent de = new DataEvent(EventType.FileEncode, file, this.SciControl.Text);
                EventManager.DispatchEvent(this, de); // Lets ask if a plugin wants to encode and save the data..
                if (!de.Handled)
                {
                    FileHelper.WriteFile(file, this.SciControl.Text, this.SciControl.Encoding, this.SciControl.SaveBOM);
                }
                this.IsModified = false;
                this.SciControl.SetSavePoint();
                RecoveryManager.RemoveTemporaryFile(this.FileName);
                this.fileInfo = new FileInfo(this.FileName);
                if (otherFile)
                {
                    ScintillaManager.UpdateControlSyntax(this.SciControl);
                    Globals.MainForm.OnFileSave(this, true);
                }
                else
                {
                    Globals.MainForm.OnFileSave(this, false);
                }
            }
            this.UpdateToolTipText();
            this.UpdateTabText();
        }
Example #28
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
        {
            switch (e.Type)
            {
            case EventType.FileEncode:
                DataEvent fe  = (DataEvent)e;
                String    ext = Path.GetExtension(fe.Action);
                if (ext == ".fdb" || ext == ".fda" || ext == ".fdm")
                {
                    this.SaveBinaryFile(fe.Action, fe.Data as String);
                    fe.Handled = true;
                }
                break;

            case EventType.FileDecode:
                DataEvent fd   = (DataEvent)e;
                String    ext1 = Path.GetExtension(fd.Action);
                if (ext1 == ".fdb" || ext1 == ".fda" || ext1 == ".fdm")
                {
                    String text = this.LoadBinaryFile(fd.Action);
                    if (text != null)
                    {
                        fd.Data    = text;
                        fd.Handled = true;
                    }
                }
                break;

            case EventType.FileSaving:
                TextEvent se = (TextEvent)e;
                if (this.IsFileOpen(se.Value))
                {
                    if (!this.IsXmlSaveable(se.Value))
                    {
                        se.Handled = true;
                    }
                }
                this.oldFileName = String.Empty;
                break;

            case EventType.FileRenaming:
                TextEvent re    = (TextEvent)e;
                String[]  files = re.Value.Split(';');
                this.oldFileName = files[0];     // Save for later..
                if (this.IsFileOpen(this.oldFileName))
                {
                    foreach (TypeData objType in this.objectTypes)
                    {
                        if (objType.File == this.oldFileName)
                        {
                            objType.File = files[1];
                            break;
                        }
                    }
                }
                break;
            }
        }
Example #29
0
 public void DoTextEvent(TextEvent e)
 {
     try{
         txtMan.AddToText(e, true);
     }
     catch {
         Debug.LogError("COULD NOT PLAY " + e.name);
     }
 }
Example #30
0
    public void CheckForEvents(int roomNumber)
    {
        TextEvent textEvent = textEvents.FirstOrDefault(e => e.segmentToTrigger == roomNumber);

        if (textEvent != null)
        {
            uiManager.TriggerTextEvent(textEvent);
        }
    }
        /// <summary>
        /// is invoked when the text has changed. 
        /// </summary>
        /// <param name="textEvent">The text event.</param>
        public void textChanged(TextEvent textEvent)
        {
            try
            {
                //var textBox = textEvent.Source;
                //String textBoxName = (String)GetProperty(textBox,"Name");
                //if(textBoxName.Equals("commentField")){


                //var crNew = criteriaMap[index];
                //if (crNew is Criterion)
                //{
                //    ((Criterion)crNew).Comment = GetProperty(textBox, "Text") as String;
                //    util.Debug.GetAllProperties(textEvent.Source);
                //}
                //}
                // get the control that has fired the event,
                XControl xControl = (XControl)textEvent.Source;
                XControlModel xControlModel = xControl.getModel();
                XPropertySet xPSet = (XPropertySet)xControlModel;
                String sName = (String)xPSet.getPropertyValue("Name").Value;
                // just in case the listener has been added to several controls,
                // we make sure we refer to the right one
                if (sName.Equals("TextField1"))
                {
                    String sText = (String)xPSet.getPropertyValue("Text").Value;
                    System.Diagnostics.Debug.WriteLine(sText);
                    // insert your code here to validate the text of the control...
                }
            }
            catch (unoidl.com.sun.star.uno.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("uno.Exception:");
                System.Diagnostics.Debug.WriteLine(ex);
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("System.Exception:");
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Example #32
0
 /// <summary>
 /// Renames the found documents based on the specified path
 /// NOTE: Directory paths should be without the last separator
 /// </summary>
 public static void MoveDocuments(String oldPath, String newPath)
 {
     Boolean reactivate = false;
     oldPath = Path.GetFullPath(oldPath);
     newPath = Path.GetFullPath(newPath);
     ITabbedDocument current = PluginBase.MainForm.CurrentDocument;
     foreach (ITabbedDocument document in PluginBase.MainForm.Documents)
     {
         /* We need to check for virtual models, another more generic option would be 
          * Path.GetFileName(document.FileName).IndexOfAny(Path.GetInvalidFileNameChars()) == -1
          * But this one is used in more places */
         if (document.IsEditable && !document.Text.StartsWithOrdinal("[model] "))
         {
             String filename = Path.GetFullPath(document.FileName);
             if (filename.StartsWithOrdinal(oldPath))
             {
                 TextEvent ce = new TextEvent(EventType.FileClose, document.FileName);
                 EventManager.DispatchEvent(PluginBase.MainForm, ce);
                 document.SciControl.FileName = filename.Replace(oldPath, newPath);
                 TextEvent oe = new TextEvent(EventType.FileOpen, document.FileName);
                 EventManager.DispatchEvent(PluginBase.MainForm, oe);
                 if (current != document)
                 {
                     document.Activate();
                     reactivate = true;
                 }
                 else
                 {
                     TextEvent se = new TextEvent(EventType.FileSwitch, document.FileName);
                     EventManager.DispatchEvent(PluginBase.MainForm, se);
                 }
             }
             PluginBase.MainForm.ClearTemporaryFiles(filename);
             document.RefreshTexts();
         }
     }
     PluginBase.MainForm.RefreshUI();
     if (reactivate) current.Activate();
 }
Example #33
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct the text arguments from a text event
 /// </summary>
 /// <param name="e">Text event</param>
 ////////////////////////////////////////////////////////////
 public TextEventArgs(TextEvent e)
 {
     Unicode = Char.ConvertFromUtf32((int)e.Unicode);
 }
Example #34
0
	private bool Load(string fileName)
	{

		string line;
		line = "";


		StringReader theReader = new StringReader(fileName);

		using (theReader)
		{
			// While there's lines left in the text file, do this:
			int lineCounter = 0;
			while(line != null){
				instances.Clear();
				e.Clear();
				//print("reading line");
				line = theReader.ReadLine();
				
				if(line != null && !firstTime && line.Substring(0,4) != "SKIP"){
					//print ("LINE: "+line);
					e = (line.Split(';').ToList()); //U+03B1 THAT SUCKS

					//foreach(string s in e){
					//	print (s);
					//}

					Event ev = null;
					//print(e[0]);
					if(e[0] == "TEXT"){
						//CREATE TEXT EVENT
						ev = new TextEvent(e[1],int.Parse(e[5]),e[2],e[3],e[4]); // ("<"+e[2]+">")
//						print(e[2]);
					}
					else if(e[0] == "AUDIO"){
						ev = new AudioEvent(e[1],int.Parse(e[5]),e[2],e[3]);
					}

					//print("parsed "+ev.name);

					if(ev != null){

						switch(e[3]){
						case "L":
							ev.room = "Living Room";
							break;
						case "K":
							ev.room = "Kitchen";
							break;
						case "B":
							ev.room = "Bedroom";
							break;
						case "T":
							ev.room = "Bathroom";
							break;
						}

						eventsParsed.Add(ev);
						//print("parsed room "+ev.name);
					}

					//print ("EVENT PARSED: "+eventsParsed[lineCounter].name+" "+eventsParsed[lineCounter].time+" "+eventsParsed[lineCounter].room);
					lineCounter++;
				}
				if(firstTime){
					firstTime = false;
				}
			}
			// Done reading, close the reader and return true to broadcast success    
			theReader.Close();
			return true;
		}
		
	}
Example #35
0
	public IEnumerator LivingRoomRoll(TextEvent e){
		int i = 0;
		isRollingLiving = true;

		while(i< toAddLiving.Length){

			if(roomM.roomIAmIn == "Living Room"){
			//	if(toAddLiving[i] == '¤'){
			//		masterString += ParsePerson(e);
			//	}


				masterString += toAddLiving[i];

				if(toAddLiving[i] != ' '){
				//	currentTextSound.pitch = Random.Range(0.99f,1.01f);
					currentTextSound.Play();
				}
			}

			i++;
			scrb.value = 0;
			timeTilDone = ((toAddLiving.Length-i)*del);

			yield return new WaitForSeconds(del);
		}
		isRollingLiving = false;
		toAddLiving = "";
	}
Example #36
0
	public IEnumerator BedroomRoomRoll(TextEvent e){
		int i = 0;
		isRollingBedroom = true;
		//print ("STARTING BEDROOM ROLL");

		while(i< toAddBedroom.Length){
			
			if(roomM.roomIAmIn == "Bedroom"){
				//if(toAddBedroom[i] == '¤'){
				//	print("found Person Marker");
				//	masterString += ParsePerson(e);
				//}
				//ParsePerson(e);
				masterString += toAddBedroom[i];

				if(toAddBedroom[i] != ' '){
				//	currentTextSound.pitch = Random.Range(0.99f,1.01f);
					currentTextSound.Play();
				}
			}



			i++;
			scrb.value = 0;
			timeTilDone = ((toAddBedroom.Length-i)*del);
			
			yield return new WaitForSeconds(del);
		}
		isRollingBedroom = false;
		toAddBedroom = "";
	}
Example #37
0
	public void DoTextEvent(TextEvent e){
		try{
			txtMan.AddToText(e, true);
		}
		catch{
			Debug.LogError("COULD NOT PLAY "+e.name);
		}
	}
Example #38
0
	public IEnumerator BathroomRoll(TextEvent e){
		int i = 0;
		isRollingBathroom = true;

		while(i< toAddBathroom.Length){
			
			if(roomM.roomIAmIn == "Bathroom"){
				masterString += toAddBathroom[i];

				if(toAddBathroom[i] != ' '){
				//	currentTextSound.pitch = Random.Range(0.99f,1.01f);
					currentTextSound.Play();
				}
			}



			i++;
			scrb.value = 0;
			timeTilDone = ((toAddBathroom.Length-i)*del);
			
			yield return new WaitForSeconds(del);
		}
		toAddBathroom = "";
		isRollingBathroom = false;
	}
Example #39
0
	public string ParsePerson(TextEvent e){

		print("parsing");
		switch(e.person){
		case "Alyv":
			print("Alyv detected");
			currentTextSound = alyvTextSound;
			break;
		case "Troma":
			print("Troma detected");
			currentTextSound = tromaTextSound;
			break;
		default:
			print("NO ONE detected");
			currentTextSound = masterTextSound;
			break;
		};

		return personSus[e.person];
	}
Example #40
0
	public void AddToText(TextEvent e, bool addspace){

//		print ("ADDING TEXT "+e.text+" "+toAddBedroom);

		switch(e.room){
		case "Living Room":
			if(addspace){
				toAddLiving += "\n";
			}
			toAddLiving += personSus[e.person]+": "+e.text;
			if(!isRollingLiving){
				StartCoroutine(LivingRoomRoll(e));
			}
			break;
		case "Kitchen":
			if(addspace){
				toAddKitchen += "\n";
			}
			toAddKitchen += personSus[e.person]+": "+e.text;
			if(!isRollingKitchen){
				StartCoroutine(KitchenRoomRoll(e));
			}
			break;
		case "Bedroom":
			if(addspace){
				toAddBedroom += "\n";
			}
			toAddBedroom += personSus[e.person]+": "+e.text;
			if(!isRollingBedroom){
				StartCoroutine(BedroomRoomRoll(e));
			}
			break;
		case "Bathroom":
			if(addspace){
				toAddBathroom += "\n";
			}
			toAddBathroom += personSus[e.person]+": "+e.text;
			if(!isRollingBathroom){
				StartCoroutine(BathroomRoll(e));
			}
			break;
		}
	}