bool Execute(string prefix = null) { IList <CAliasCommand> cmds = CRegistery.ListAliases(prefix); if (cmds.Count > 0) { if (shortList) { string[] names = CCollection.Map(cmds, delegate(CAliasCommand cmd) { return(cmd.Name); }); Print(names); } else { foreach (CAliasCommand cmd in cmds) { PrintIndent("{0} {1}", cmd.Name, cmd.Alias); } } } return(true); }
public void Play() { if (this.CAPathPerformance != null) { this.CAPathPerformance.StopAll(); } this.CSegment1.ReleaseSegment(); this.CSegment1.UnloadAllPerformances(); this.CLoader.UnloadCollection(this.CCollectionA); this.CLoader.LoadSegment(this.Midi, out this.CSegment1, true); if (this.UseDLS) { this.CLoader.LoadDLS(this.DLS, out this.CCollectionA); this.CSegment1.ConnectToDLS(this.CCollectionA); this.CLoader.UnloadCollection(this.CCollectionA); this.CCollectionA.Dispose(); this.CCollectionA = new CCollection(); } this.CSegment1.Download((CPerformance)this.CAPathPerformance); if (this.useLoop) { this.CSegment1.SetLoopPoints(this.LoopStart, this.LoopEnd); if (this.times != -1) { this.CSegment1.SetRepeats((uint)this.times); } else { this.CSegment1.SetRepeats(DMUS_SEG.REPEAT_INFINITE); } } this.CAPathPerformance.PlaySegment((ISegment)this.CSegment1, (IAudioPath)null); }
public static IList <string> ListAliasesConfig() { return(CCollection.Map(CRegistery.ListAliases(), delegate(CAliasCommand alias) { return ToString(alias); })); }
public void TestEachIndex() { string[] array = { "1", "2", "3" }; CCollection.Each(array, delegate(String element, int index) { AddResult(index + ":" + element); }); AssertResult("0:1", "1:2", "2:3"); }
public void TestEach() { string[] array = { "1", "2", "3" }; CCollection.Each(array, delegate(String element) { AddResult(element); }); AssertResult("1", "2", "3"); }
private string[] ListCommandNames(string prefix, CCommandListOptions options) { IList <CCommand> commands = CRegistery.ListCommands(delegate(CCommand cmd) { return(!(cmd is CVarCommand) && CRegistery.ShouldListCommand(cmd, prefix, options)); }); return(CCollection.Map(commands, delegate(CCommand cmd) { return C(cmd.Name, cmd.ColorCode); })); }
public void TestMapIndex() { string[] array = { "a", "b", "c" }; string[] expected = { "a0", "b1", "c2" }; string[] actual = CCollection.Map(array, delegate(String element, int index) { return(element + index); }); AssertArray(actual, expected); }
public void TestMap() { string[] array = { "a", "b", "c" }; char[] expected = { 'A', 'B', 'C' }; char[] actual = CCollection.Map(array, delegate(String element) { return(char.ToUpper(element[0])); }); AssertArray(actual, expected); }
internal static IList <string> AutoCompleteArgs(string token) { IList <CAliasCommand> aliases = CRegistery.ListAliases(); if (aliases != null && aliases.Count > 0) { return(CCollection.Map(aliases, delegate(CAliasCommand alias) { return alias.Name; })); } return(null); }
internal static IList <string> AutoCompleteArgs(string prefix) { IList <CVar> vars = CRegistery.ListVars(prefix, CCommand.DefaultListOptions); if (vars.Count == 0) { return(null); } return(CCollection.Map(vars, delegate(CVar cvar) { return CStringUtils.C(cvar.Name, CColorCode.TableVar); })); }
protected override IList <string> AutoCompleteArgs(string commandLine, string prefix) { IList <CVar> vars = CRegistery.ListVars(delegate(CVarCommand cmd) { return(cmd.IsBool && CRegistery.ShouldListCommand(cmd, prefix, CCommand.DefaultListOptions)); }); if (vars.Count == 0) { return(null); } return(CCollection.Map(vars, delegate(CVar cvar) { return CStringUtils.C(cvar.Name, CColorCode.TableVar); })); }
bool Execute(string prefix = null) { CCommandListOptions options = CCommand.DefaultListOptions; if (includeSystem) { options |= CCommandListOptions.System; } // TODO: refactoring IList <CVar> vars = CRegistery.ListVars(prefix, options); if (vars.Count > 0) { if (shortList) { string[] names = CCollection.Map(vars, delegate(CVar cvar) { return(CStringUtils.C(cvar.Name, CColorCode.TableVar)); }); Print(names); } else { StringBuilder result = new StringBuilder(); for (int i = 0; i < vars.Count; ++i) { CVar cvar = vars[i]; result.AppendFormat(" {0} {1}", CStringUtils.C(cvar.Name, CColorCode.TableVar), CStringUtils.Arg(cvar.Value)); // TODO: better color highlight if (!cvar.IsDefault) { result.AppendFormat(" {0} {1}", CStringUtils.C("default", CColorCode.TableVar), cvar.DefaultValue); } if (i < vars.Count - 1) { result.Append('\n'); } } Print(result.ToString()); } } return(true); }
protected override IList <string> AutoCompleteArgs(string commandLine, string token) { IList <CCommand> commands = CRegistery.ListCommands(delegate(CCommand command) { return(!(command is CVarCommand) && !(command is CDelegateCommand) && !(command is CAliasCommand) && CRegistery.ShouldListCommand(command, token, CCommand.DefaultListOptions)); }); if (commands.Count == 0) { return(null); } return(CCollection.Map(commands, delegate(CCommand cmd) { return CStringUtils.C(cmd.Name, cmd.ColorCode); })); }
public static void StartCoroutine(IEnumerator aCoroutine) { if (m_CollectionNull == null) { m_CollectionNull = new CCollection <VCoroutineStruct>(4) { new VCoroutineStruct() { m_Iter = aCoroutine } }; EditorApplication.update += OnUpdate; } else { m_CollectionNull.Add(new VCoroutineStruct() { m_Iter = aCoroutine }); } }
public void Play(string pt, bool loop = true) { if (cdm == null) { cdm = new CDirectMusic(); cdm.Initialize(); loader = new CDLSLoader(); loader.Initialize(); loader.LoadSegment(pt, out segment); ccollection = new CCollection(); string pathDLS = Path.Combine(Memory.FF8DIRdata, "Music/dmusic_backup/FF8.dls"); if (!File.Exists(pathDLS)) { pathDLS = Path.Combine(Memory.FF8DIRdata, "Music/dmusic/FF8.dls"); } loader.LoadDLS(pathDLS, out ccollection); uint dwInstrumentIndex = 0; while (ccollection.EnumInstrument(++dwInstrumentIndex, out INSTRUMENTINFO iInfo) == S_OK) { Debug.WriteLine(iInfo.szInstName); } instruments = new CInstrument[dwInstrumentIndex]; path = new CAPathPerformance(); path.Initialize(cdm, null, null, DMUS_APATH.DYNAMIC_3D, 128); cport = new CPortPerformance(); cport.Initialize(cdm, null, null); outport = new COutputPort(); outport.Initialize(cdm); uint dwPortCount = 0; INFOPORT infoport; do { outport.GetPortInfo(++dwPortCount, out infoport); }while ((infoport.dwFlags & DMUS_PC.SOFTWARESYNTH) == 0); outport.SetPortParams(0, 0, 0, DirectMidi.SET.REVERB | DirectMidi.SET.CHORUS, 44100); outport.ActivatePort(infoport); cport.AddPort(outport, 0, 1); for (int i = 0; i < dwInstrumentIndex; i++) { ccollection.GetInstrument(out instruments[i], i); outport.DownloadInstrument(instruments[i]); } segment.Download(cport); if (!loop) { segment.SetRepeats(0); } cport.PlaySegment(segment); } else { cport.Stop(segment); segment.Dispose(); //segment.ConnectToDLS loader.LoadSegment(pt, out segment); segment.Download(cport); if (!loop) { segment.SetRepeats(0); } cport.PlaySegment(segment); cdm.Dispose(); } //GCHandle.Alloc(cdm, GCHandleType.Pinned); //GCHandle.Alloc(loader, GCHandleType.Pinned); //GCHandle.Alloc(segment, GCHandleType.Pinned); //GCHandle.Alloc(path, GCHandleType.Pinned); //GCHandle.Alloc(cport, GCHandleType.Pinned); //GCHandle.Alloc(outport, GCHandleType.Pinned); //GCHandle.Alloc(infoport, GCHandleType.Pinned); }
public static void StopAllCoroutine() { EditorApplication.update -= OnUpdate; m_CollectionNull = null; }