Beispiel #1
0
        /// <summary>
        /// Initializes an instance of MediaDripDownloader that initializes a source handler and queue collection.
        /// </summary>
        public MediaDripDownloader()
        {
            _sourceHandler = new SourceHandler();

            _queue = new ObservableCollection <DownloadObject>();
            _queue.CollectionChanged += OnCollectionChange_Event;
        }
Beispiel #2
0
 public WsServer()
 {
     _listener          = new HttpListener();
     _clients           = new ConcurrentDictionary <IPEndPoint, WsClient>();
     _wsCancellation    = new CancellationTokenSource();
     _statsCancellation = new CancellationTokenSource();
     _mainCancellation  =
         CancellationTokenSource.CreateLinkedTokenSource(_wsCancellation.Token, _statsCancellation.Token);
     _config  = Singleton.Of <Configuration>();
     _sources = Singleton.Of <SourceHandler>();
 }
Beispiel #3
0
        public void CreateTest()
        {
            string assemblyName = "NArrange.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
            SourceHandlerConfiguration configuration = new SourceHandlerConfiguration();

            configuration.AssemblyName = assemblyName;

            SourceHandler handler = new SourceHandler(configuration);

            Assert.IsNotNull(handler.CodeParser, "Parser was not created.");
            Assert.IsNotNull(handler.CodeWriter, "Writer was not created.");
        }
Beispiel #4
0
        public AudioEngine(WsVoiceClient voiceClient, WebSocket socket)
        {
            _voiceClient = voiceClient;
            _socket      = socket;

            _rtpCodec  = new RtpCodec();
            _opusCodec = new OpusCodec();

            Packets = new ConcurrentQueue <AudioPacket>();
            _stream = new AudioStream(this);

            _sources = Singleton.Of <SourceHandler>();
            _cache   = Singleton.Of <CacheHandler>();

            IsReady = true;
        }
Beispiel #5
0
 internal FieldReader(SourceHandler sourceHandler)
 {
     _sourceHandler = sourceHandler;
 }
Beispiel #6
0
 private FluentReader(string source, T result)
 {
     _result        = result;
     _sourceHandler = new SourceHandler(source);
     ReaderResult   = new FluentReaderResult <T>();
 }
Beispiel #7
0
    public void Place(ItemSlot source)
    {
        if (!source || source.IsEmpty || source.Data.IsEmpty)
        {
            return;
        }
        var slot = source.Data;
        int have = SourceHandler.GetAmount(slot.item);

        if (slot == null || slot.Model == null || have < 0)
        {
            return;
        }
        if (slot.Model.StackAble && SelectionType == ItemSelectionType.SelectNum)
        {
            if (!canSelect(source))
            {
                return;
            }
            if (typeLimit > 0 && copySlots.Count >= typeLimit)
            {
                MessageManager.Instance.New($"每次最多只能选择{typeLimit}样物品");
                return;
            }
            if (have < 2)
            {
                if (SourceHandler.CanLose(slot.item, 1))
                {
                    MakeSlot(slot.item, 1);
                }
            }
            else if (amountLimit == 1)
            {
                if (SourceHandler.CanLose(slot.item, 1))
                {
                    MakeSlot(slot.item, 1);
                }
            }
            else
            {
                AmountWindow.StartInput(delegate(long amount)
                {
                    if (SourceHandler.CanLose(slot.item, (int)amount))
                    {
                        if (copySlots.TryGetValue(slot.item.ID, out var copy))
                        {
                            copy.Data.amount = (int)amount;
                            copy.Refresh();
                        }
                        else
                        {
                            MakeSlot(slot.item, (int)amount);
                        }
                        if (copySlots.Count > 0)
                        {
                            ZetanUtility.SetActive(tips, false);
                        }
                    }
                }, amountLimit > 0 ? amountLimit : have);
            }
        }
        else if ((!slot.Model.StackAble && SelectionType == ItemSelectionType.SelectNum || SelectionType == ItemSelectionType.SelectAll) &&
                 canSelect(source) && SourceHandler.CanLose(slot.item, have))
        {
            if (copySlots.ContainsKey(slot.item.ID))
            {
                MessageManager.Instance.New("已选择该物品");
                return;
            }
            if (typeLimit > 0 && copySlots.Count >= typeLimit)
            {
                MessageManager.Instance.New($"每次最多只能选择{typeLimit}样物品");
            }
            else
            {
                MakeSlot(slot.item, have);
            }
        }

        void MakeSlot(ItemData data, int amount)
        {
            ItemSlot copy = caches.Get(itemCellsParent);

            copy.SetScrollRect(gridScrollRect);
            copy.SetCallbacks(GetHandleButtons, (s) => TakeOut(s, true), OnSlotEndDrag);
            copySlots.Add(data.ID, copy);
            selectedItems.Add(data);
            copy.Refresh(new ItemSlotData(data, amount));
            SourceContainer.MarkIf(s => selectedItems.Contains(s.Item));
            if (copySlots.Count > 0)
            {
                ZetanUtility.SetActive(tips, false);
            }
        }
    }
 public abstract object Resolve(NestedArgument argument, SourceHandler source,
                                NamespaceHandler scope, ExtensionResolver resolver, Type targettype);