Exemplo n.º 1
0
        private bool DoLoadSource(SourceArgs args, StringBuilder output)
        {
            SampleSource source = SampleSource.Create(output, this, args.Name, args.Path, args.SourceReference);

            output.AppendLine(Invariant($"Loading source '{args.Name}'"));

            this.loadedSources.Add(source);

            this.adapter.Protocol.SendEvent(
                new LoadedSourceEvent(
                    reason: LoadedSourceEvent.ReasonValue.New,
                    source: source.GetProtocolSource()));

            return(true);
        }
Exemplo n.º 2
0
        private bool DoUnloadSource(SourceArgs args, StringBuilder output)
        {
            SampleSource source = this.loadedSources.FirstOrDefault(m => String.Equals(m.Name, args.Name, StringComparison.OrdinalIgnoreCase));

            if (source == null)
            {
                output.AppendLine(Invariant($"Error: Unknown source '{args.Name}'!"));
                return(false);
            }

            output.AppendLine(Invariant($"Unloading source '{args.Name}'"));
            this.adapter.Protocol.SendEvent(
                new LoadedSourceEvent(
                    reason: LoadedSourceEvent.ReasonValue.Removed,
                    source: source.GetProtocolSource()));

            return(true);
        }