Ejemplo n.º 1
0
        private bool TryOneWorkItem()
        {
            KeyValuePair <SendOrPostCallback, object?> work = default;

            lock (this.messageQueue)
            {
                if (this.messageQueue.Count == 0)
                {
                    Monitor.Wait(this.messageQueue);
                    return(false);
                }

                work = this.messageQueue.Dequeue();
            }

            try
            {
                if (this.aggregator is object)
                {
                    this.aggregator.Run(() => work.Key(work.Value));
                }
                else
                {
                    work.Key(work.Value);
                }

                return(true);
            }
            finally
            {
                this.workItemDone.Set();
            }
        }
        private UserControl CreateControlByType(InstanceMember instanceMember, Type type)
        {
            UserControl controlToAdd = null;

            if (instanceMember.PreferredDisplayer != null)
            {
                controlToAdd = (UserControl)Activator.CreateInstance(instanceMember.PreferredDisplayer);
            }

            if (controlToAdd == null)
            {
                foreach (var kvp in mTypeDisplayerAssociation)
                {
                    if (kvp.Key(type))
                    {
                        controlToAdd = (UserControl)Activator.CreateInstance(kvp.Value);
                    }
                }
            }


            if (controlToAdd == null)
            {
                controlToAdd = new TextBoxDisplay();
            }


            IDataUi display = (IDataUi)controlToAdd;

            display.InstanceMember = instanceMember;

            return(controlToAdd);
        }
Ejemplo n.º 3
0
        internal void DispatchEvent(string _eventName, params object[] _objs)
        {
            if (dicWithEvent.ContainsKey(_eventName))
            {
                Dictionary <Action <SuperEvent>, SuperEventListenerUnit> dic = dicWithEvent[_eventName];

                KeyValuePair <Action <SuperEvent>, SuperEvent>[] arr = new KeyValuePair <Action <SuperEvent>, SuperEvent> [dic.Count];

                Dictionary <Action <SuperEvent>, SuperEventListenerUnit> .Enumerator enumerator = dic.GetEnumerator();

                int i = 0;

                while (enumerator.MoveNext())
                {
                    KeyValuePair <Action <SuperEvent>, SuperEventListenerUnit> pair = enumerator.Current;

                    SuperEvent ev = new SuperEvent(pair.Value.index, _objs);

                    arr[i] = new KeyValuePair <Action <SuperEvent>, SuperEvent>(pair.Key, ev);

                    i++;
                }

                for (i = 0; i < arr.Length; i++)
                {
                    KeyValuePair <Action <SuperEvent>, SuperEvent> pair = arr[i];

                    pair.Key(pair.Value);
                }
            }
        }
Ejemplo n.º 4
0
    public void DispatchEvent(SuperEvent e)
    {
        if (dicWithEvent.ContainsKey(e.eventName))
        {
            Dictionary <Action <SuperEvent>, SuperEventListenerUnit> dic = dicWithEvent[e.eventName];

            Action[] arr = new Action[dic.Count];

            Dictionary <Action <SuperEvent>, SuperEventListenerUnit> .Enumerator enumerator = dic.GetEnumerator();

            int i = 0;

            while (enumerator.MoveNext())
            {
                KeyValuePair <Action <SuperEvent>, SuperEventListenerUnit> pair = enumerator.Current;

                SuperEvent ev = new SuperEvent(e.eventName, pair.Value.index, e.datas);

                Action del = delegate()
                {
                    pair.Key(ev);
                };

                arr[i] = del;

                i++;
            }

            for (i = 0; i < arr.Length; i++)
            {
                arr[i]();
            }
        }
    }
Ejemplo n.º 5
0
            //* ────────────-_______________________*
            //* constructor & destructor ───────────────────────*

            //* -----------------------------------------------------------------------*
            /// <summary>コンストラクタ。</summary>
            ///
            /// <param name="priority">スレッドの優先度。</param>
            /// <param name="sleep">スレッドが動作するたびに休眠する時間(ミリ秒)。</param>
            /// <param name="interval">休眠までのタスク消化回数。</param>
            public CThreadInfo(ThreadPriority priority, int sleep, int interval)
            {
                ThreadStart method = () =>
                {
                    bool loop    = true;
                    int  counter = 0;
                    do
                    {
                        KeyValuePair <WaitCallback, object> info = CThreadPool.pop();
                        if (info.Key != null)
                        {
                            info.Key(info.Value);
                        }
                        Thread.Sleep(++counter % interval == 0 ? sleep : 0);
                        lock (syncLock)
                        {
                            loop = !m_terminate;
                        }
                    }while (loop);
                };

                thread          = new Thread(method);
                thread.Name     = "Nineball:CThreadPool";
                thread.Priority = priority;
                thread.Start();
            }
Ejemplo n.º 6
0
 /// <summary>
 /// Calls the callback method for <see cref="GetVersionAsync"/>.
 /// </summary>
 /// <param name="p_kvpCallback">An object whose key is the callback method to call and whose value is the user-supplied state info to pass to the callback method.</param>
 /// <param name="p_mifInfo">The info of the mod that was retrieved in the asynchronous call.</param>
 private void CallGetFileVersionAsyncCallback(KeyValuePair <Action <object, ModInfo>, object> p_kvpCallback, ModInfo p_mifInfo)
 {
     if (p_kvpCallback.Key != null)
     {
         p_kvpCallback.Key(p_kvpCallback.Value, p_mifInfo);
     }
 }
Ejemplo n.º 7
0
 public void Refresh()
 {
     foreach (KeyValuePair <EventHandler, Dispatcher> eventHandler in (IEnumerable <KeyValuePair <EventHandler, Dispatcher> >) this.EventHandlers)
     {
         KeyValuePair <EventHandler, Dispatcher> pair = eventHandler;
         pair.Value.Invoke((Action)(() => pair.Key((object)this, EventArgs.Empty)));
     }
 }
Ejemplo n.º 8
0
        UserControl CreateInternalControl()
        {
            if (InstanceMember == null)
            {
                throw new NullReferenceException(nameof(InstanceMember));
            }


            UserControl controlToAdd = null;

            if (InstanceMember.PreferredDisplayer != null)
            {
                controlToAdd = (UserControl)Activator.CreateInstance(InstanceMember.PreferredDisplayer);
            }

            if (controlToAdd == null)
            {
                var type = InstanceMember.PropertyType;

                foreach (var kvp in mTypeDisplayerAssociation)
                {
                    if (kvp.Key(type))
                    {
                        controlToAdd = (UserControl)Activator.CreateInstance(kvp.Value);
                    }
                }
            }

            if (controlToAdd == null && InstanceMember.CustomOptions != null && InstanceMember.CustomOptions.Count != 0)
            {
                controlToAdd = new ComboBoxDisplay();
            }

            if (controlToAdd == null)
            {
                controlToAdd = new TextBoxDisplay();
            }

            var displayerType = controlToAdd.GetType();

            foreach (var kvp in InstanceMember.PropertiesToSetOnDisplayer)
            {
                var propertyInfo = displayerType.GetProperty(kvp.Key);

                propertyInfo?.SetValue(controlToAdd, kvp.Value, null);
            }

            IDataUi display = (IDataUi)controlToAdd;

            display.InstanceMember = InstanceMember;

            InstanceMember.CallUiCreated(controlToAdd);

            // can we share them like this? Is it safe? OK?
            this.ContextMenu = controlToAdd.ContextMenu;

            return(controlToAdd);
        }
Ejemplo n.º 9
0
        bool loadData(E_StaticDB_DBType type)
        {
            KeyValuePair <Action <string>, string> keyValue = m_dictLists[type];

            if (string.IsNullOrEmpty(keyValue.Value))
            {
                return(false);
            }
            else
            {
                keyValue.Key(keyValue.Value);
            }
            return(true);
        }
        public IEnumerator <clsAutoCompleteItem> GetEnumerator()
        {
            string strFragment = menu.Fragment.Text;

            clsFragmentPart[] aryParts = clsFragmentPart.ArrayFromString(strFragment);
            List <KeyValuePair <string, object> > aryPartObjects = new List <KeyValuePair <string, object> >();

            aryPartObjects.AddRange(clsFragmentPart.ObjectsFromArray(context, aryParts));
            aryPartObjects.AddRange(clsFragmentPart.ObjectsFromArray(ProjectDef.ScriptContextFunctions, aryParts));
            int idxEnd = (aryParts.Length > 0)?aryPartObjects.FindIndex(itm => aryParts[aryParts.Length - 1].Name == itm.Key):-1;

            if (idxEnd >= 0)
            {
                if (strFragment.LastIndexOf("[") > strFragment.LastIndexOf("."))
                {
                    IEnumerable ary = aryPartObjects[idxEnd].Value as IEnumerable;
                    if (ary != null)
                    {
                        foreach (var itm in ary)
                        {
                            if (TryKeyPairParse(itm, out KeyValuePair <dynamic, dynamic> kvp))
                            {
                                yield return(new clsAutoCompleteItem($"{aryPartObjects[idxEnd].Key}[\"{kvp.Key}\"]", $"\"{kvp.Key}\""));
                            }
                        }
                    }
                    yield break;
                }
                KeyValuePair <string, object> part = aryPartObjects[idxEnd];
                foreach (var itm in GetAutoCompleteItems(part.Value.GetType()))
                {
                    itm.Text = $"{part.Key}{((part.Key != "") ? (".") : (""))}{itm.Text}";
                    yield return(itm);
                }
            }
            else
            {
                foreach (var part in aryPartObjects)
                {
                    foreach (var itm in GetAutoCompleteItems(part.Value.GetType()))
                    {
                        itm.Text = $"{part.Key}{((part.Key != "") ? (".") : (""))}{itm.Text}";
                        yield return(itm);
                    }
                }
            }
            yield break;
        }
Ejemplo n.º 11
0
        public static string Serialize(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            if (handlers.ContainsKey(obj.GetType()))
            {
                KeyValuePair <TypeSerializeHandler, TypeDeserializeHandler> pair = handlers[obj.GetType()];
                return(pair.Key(obj));
            }
            StringBuilder sb     = new StringBuilder();
            StringWriter  writer = new StringWriter(sb);

            new XmlSerializer(obj.GetType()).Serialize((TextWriter)writer, obj);
            writer.Close();
            return(sb.ToString());
        }
Ejemplo n.º 12
0
        private bool TryOneWorkItem()
        {
            KeyValuePair <SendOrPostCallback, object> work = default(KeyValuePair <SendOrPostCallback, object>);

            lock (this.messageQueue)
            {
                if (this.messageQueue.Count == 0)
                {
                    Monitor.Wait(this.messageQueue);
                    return(false);
                }

                work = this.messageQueue.Dequeue();
            }

            work.Key(work.Value);
            return(true);
        }
Ejemplo n.º 13
0
        public static void ExecuteTestCases()
        {
            Console.WriteLine("-------------------------");
            Console.WriteLine("Executing {0} test cases...", TestCaseDelegates.Count);
            Console.WriteLine("-------------------------");
            Console.WriteLine();
            int passed = 0;

            for (int i = 0; i < TestCaseDelegates.Count; i++)
            {
                DateTime start = DateTime.Now;
                KeyValuePair <TestCaseFunction, string> entry = TestCaseDelegates.ElementAt(i);
                Console.WriteLine("Executing: " + entry.Value);
                try
                {
                    bool result = entry.Key();
                    if (result)
                    {
                        passed++;
                    }
                    Console.WriteLine(" Result: " + result.ToString());
                }
                catch (Exception e)
                {
                    Console.WriteLine(" ERROR: failed to execute: " + entry.Value);
                }

                TimeSpan timeItTook = DateTime.Now - start;
                Console.WriteLine(" Duration: " + timeItTook.TotalMilliseconds + " ms");
                Console.WriteLine();
            }

            Console.WriteLine();
            Console.WriteLine("Finished");
            Console.WriteLine("passed: {0}/{1}", passed, TestCaseDelegates.Count);
            TestCaseDelegates.Clear();
            Console.WriteLine("Press enter to continue");
            Console.Read();
        }
Ejemplo n.º 14
0
            private static void DoTask(string lockName)
            {
                if (!lockedTaskQueues.ContainsKey(lockName))
                {
                    return;
                }
                lock (lockedTaskQueues[lockName].Value)
                {
                    if (lockedTaskQueues[lockName].Key.Count <= 0)
                    {
                        return;
                    }
                    KeyValuePair <Task, object[]> p = lockedTaskQueues[lockName].Key.Dequeue();
                    if (p.Key is null)
                    {
                        Console.WriteLine("Error: In DoTask(), dequeued task is null!");
                    }
                    else
                    {
                        try
                        {
                            p.Key(p.Value);     // Task 수행
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.StackTrace);
                        }
                    }
                }

                try
                {
                    System.Threading.Tasks.Task.Run(() => DoTask(lockName));   // 연쇄적으로 다음 Task 수행
                }
                catch (NullReferenceException)
                {
                    DoTask(lockName);
                }
            }
Ejemplo n.º 15
0
 private static void InvokeThreadboxHandler <T>(KeyValuePair <ThreadBoxHandler <T>, T> kvp)
 {
     kvp.Key(kvp.Value);
 }
Ejemplo n.º 16
0
        public IEnumerable <TI> GetAll(int?page, int?pageSize, bool?includeDeleted, IDictionary <Func <IBaseObject, IComparable>, SortOrder> sortProperties, out long totalCount)
        {
            totalCount = 0;
            using (var pc = PersistenceHelper.CreatePersistenceContext())
            {
                IQueryable <T> resultSet = BaseObject <T> .Queryable;

                if (!page.HasValue)
                {
                    page = 0;
                }
                if (!pageSize.HasValue)
                {
                    pageSize = 10;
                }
                if (includeDeleted.HasValue && !includeDeleted.Value)
                {
                    resultSet = resultSet.Where(o => !o.IsDeleted);
                }

                if (sortProperties.Any())
                {
                    IOrderedQueryable <T> sortedResultSet = null;

                    KeyValuePair <Func <IBaseObject, IComparable>, SortOrder> firstCriteria = sortProperties.FirstOrDefault();
                    if (firstCriteria.Key != null)
                    {
                        if (firstCriteria.Value == SortOrder.Ascending)
                        {
                            sortedResultSet = resultSet.OrderBy(element => firstCriteria.Key(element));
                        }
                        else if (firstCriteria.Value == SortOrder.Descending)
                        {
                            sortedResultSet = resultSet.OrderByDescending(element => firstCriteria.Key(element));
                        }
                        if (sortedResultSet != null && sortProperties.Count > 1)
                        {
                            for (int i = 1; i < sortProperties.Count; i++)
                            {
                                var sortProperty = sortProperties.ElementAt(i);
                                if (sortProperty.Value == SortOrder.Ascending)
                                {
                                    sortedResultSet = sortedResultSet.ThenBy(element => sortProperty.Key(element));
                                }
                                else if (sortProperty.Value == SortOrder.Descending)
                                {
                                    sortedResultSet = sortedResultSet.ThenByDescending(element => sortProperty.Key(element));
                                }
                            }
                        }

                        resultSet = sortedResultSet;
                    }
                }

                if (resultSet != null)
                {
                    totalCount = resultSet.Count();
                    return((IEnumerable <TI>)resultSet.Skip(page.Value * pageSize.Value).Take(pageSize.Value));
                }
                return(null);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Helper method to run a single iteration of the URI reading tests in a specified configuration.
        /// </summary>
        /// <typeparam name="T">The type of the payload to read.</typeparam>
        /// <param name="payloadElement">The payload to read.</param>
        /// <param name="setExpectedUriAction">An action to set the URI in question on the payload.</param>
        /// <param name="model">The metadata model.</param>
        /// <param name="payloadUri">The payload URI for the current iteration.</param>
        /// <param name="baseUriValue">The base URI value for the current iteration.</param>
        /// <param name="resolver">The resolver to use.</param>
        /// <param name="testConfiguration">The reader test configuration.</param>
        private void RunBaseUriReadingTest <T>(
            T payloadElement,
            Action <T, Uri, ReaderTestConfiguration> setExpectedUriAction,
            IEdmModel model,
            Uri payloadUri,
            BaseUriValue baseUriValue,
            KeyValuePair <Func <Uri, Uri, Uri, Uri>, Uri> resolver,
            ReaderTestConfiguration testConfiguration,
            bool runInBatch = false) where T : ODataPayloadElement
        {
            this.Assert.IsNull(testConfiguration.MessageReaderSettings.BaseUri, "No base URI expected on reader settings.");
            ExpectedException expectedException = null;

            Uri settingsBaseUri = baseUriValue.ReaderSettingBaseUri;

            // Set the base URI on the message reader settings if specified
            if (settingsBaseUri != null)
            {
                testConfiguration = new ReaderTestConfiguration(testConfiguration);
                testConfiguration.MessageReaderSettings.BaseUri = settingsBaseUri;
            }

            // Create the payload element
            T clonedPayloadElement = payloadElement.DeepCopy();

            setExpectedUriAction(clonedPayloadElement, payloadUri, testConfiguration);

            if (testConfiguration.Format == ODataFormat.Atom)
            {
                XElement xmlRepresentation = this.PayloadElementToXmlConverter.ConvertToXml(clonedPayloadElement);

                // add an xml:base attribute if specified
                Uri xmlBaseUri = baseUriValue.XmlBaseUri;
                if (xmlBaseUri != null)
                {
                    xmlRepresentation.Add(new XAttribute(XNamespace.Xml.GetName("base"), xmlBaseUri.OriginalString));
                }

                clonedPayloadElement.XmlRepresentation(xmlRepresentation);

                if (resolver.Value != null)
                {
                    setExpectedUriAction(clonedPayloadElement, resolver.Value, testConfiguration);
                }
                else
                {
                    // compute the expected URI value for ATOM
                    if (!payloadUri.IsAbsoluteUri)
                    {
                        if (xmlBaseUri != null)
                        {
                            setExpectedUriAction(clonedPayloadElement, new Uri(xmlBaseUri, payloadUri), testConfiguration);
                        }
                        else if (settingsBaseUri != null)
                        {
                            setExpectedUriAction(clonedPayloadElement, new Uri(settingsBaseUri, payloadUri), testConfiguration);
                        }
                        else
                        {
                            // fail for relative URIs without base URI
                            expectedException = ODataExpectedExceptions.ODataException("ODataAtomDeserializer_RelativeUriUsedWithoutBaseUriSpecified", payloadUri.OriginalString);
                        }
                    }
                }
            }
            else
            {
                throw new NotSupportedException("Unsupported configuration format: " + testConfiguration.Format.ToString());
            }

            PayloadReaderTestDescriptor testDescriptor = new PayloadReaderTestDescriptor(resolver.Key == null ? this.Settings : this.NoValidatorSettings)
            {
                PayloadElement    = clonedPayloadElement,
                PayloadEdmModel   = model,
                ExpectedException = expectedException,
                UrlResolver       = resolver.Key == null ? null : new TestUrlResolver {
                    ResolutionCallback = (baseUri, realPayloadUri) => resolver.Key(payloadUri, baseUri, realPayloadUri)
                },
                SkipTestConfiguration = tc => ODataPayloadElementConfigurationValidator.GetSkipTestConfiguration(payloadElement, ODataPayloadElementConfigurationValidator.AllValidators)(tc),
            };

            if (runInBatch)
            {
                // TODO: Batch reader does not enter Exception state upon cross reference error in payload.
                // Once fixed allow the batch tests to run even for error cases.
                if (expectedException != null)
                {
                    return;
                }

                if (testConfiguration.IsRequest)
                {
                    testDescriptor = new PayloadReaderTestDescriptor(testDescriptor)
                    {
                        PayloadElement =
                            PayloadBuilder.BatchRequestPayload(
                                BatchUtils.GetRequestChangeset(
                                    new IMimePart[] { testDescriptor.PayloadDescriptor.InRequestOperation(
                                                          HttpVerb.Put,
                                                          new ODataUri(ODataUriBuilder.Root(new Uri("http://odata.org/service"))),
                                                          this.RequestManager,
                                                          TestMediaTypeUtils.GetDefaultContentType(testDescriptor.PayloadDescriptor.PayloadKind, testConfiguration.Format)) },
                                    this.RequestManager))
                            .AddAnnotation(new BatchBoundaryAnnotation("bb_request"))
                    };
                }
                else
                {
                    testDescriptor = new PayloadReaderTestDescriptor(testDescriptor)
                    {
                        PayloadElement =
                            PayloadBuilder.BatchResponsePayload(
                                testDescriptor.PayloadDescriptor.InResponseOperation(
                                    200,
                                    this.RequestManager,
                                    TestMediaTypeUtils.GetDefaultContentType(testDescriptor.PayloadDescriptor.PayloadKind, testConfiguration.Format)))
                            .AddAnnotation(new BatchBoundaryAnnotation("bb_response"))
                    };
                }

                testConfiguration = new ReaderTestConfiguration(null, testConfiguration.MessageReaderSettings, testConfiguration.IsRequest, testConfiguration.Synchronous, testConfiguration.Version);
            }

            testDescriptor.RunTest(testConfiguration);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Trigger the callback when called GetRequestAsync
        /// For UnitTesting purpose
        /// </summary>
        /// <param name="item">indicate the broker queue item</param>
        public void TriggerGetRequestCallback(BrokerQueueItem item)
        {
            KeyValuePair <BrokerQueueCallback, object> pair = this.callbackQueue.Dequeue();

            pair.Key(item, pair.Value);
        }
        public override void Buy(Player player)
        {
            if (ObjectType == 0x01ca) //Merchant
            {
                int originalPrice = this.Price;
                int Price         = (int)(this.Price * player.AccountPerks.MerchantDiscount());
                if (TryDeduct(player))
                {
                    for (var i = 4; i < player.Inventory.Length; i++)
                    {
                        try
                        {
                            GameServer.Manager.GameData.ObjectTypeToElement.TryGetValue((ushort)MType, out XElement ist);
                            if (player.Inventory[i] == null &&
                                (player.SlotTypes[i] == 10 ||
                                 player.SlotTypes[i] == Convert.ToInt16(ist.Element("SlotType").Value)))
                            // Exploit fix - No more mnovas as weapons!
                            {
                                player.Inventory[i] = GameServer.Manager.GameData.Items[(ushort)MType];

                                var currency = new KeyValuePair <string, double>(null, -1);

                                switch (Currency)
                                {
                                case CurrencyType.Fame:
                                {
                                    GameServer.Manager.Database.UpdateFame(player.Client.Account, -Price);
                                    player.CurrentFame = player.Client.Account.Fame;
                                    currency           = new KeyValuePair <string, double>("fame", player.CurrentFame);
                                }
                                break;

                                case CurrencyType.Gold:
                                {
                                    GameServer.Manager.Database.UpdateCredit(player.Client.Account, -Price);
                                    player.Credits = player.Client.Account.Credits;
                                    currency       = new KeyValuePair <string, double>("gold", player.Credits);
                                }
                                break;

                                case CurrencyType.FortuneTokens:
                                {
                                    GameServer.Manager.Database.UpdateTokens(player.Client.Account, -Price);
                                    player.Tokens = player.Client.Account.FortuneTokens;
                                    currency      = new KeyValuePair <string, double>("fortune token", player.Tokens);
                                }
                                break;

                                default:
                                    break;
                                }
                                if (1 - player.AccountPerks.MerchantDiscount() > 0 && (currency.Key != null && currency.Value != -1))
                                {
                                    player.SendInfo($"You saved {originalPrice - Price} {currency.Key}{(currency.Value > 1 ? "s" : "")} ({(1 - player.AccountPerks.MerchantDiscount()) * 100}% off)!");
                                }
                                player.Client.SendMessage(new BUYRESULT
                                {
                                    Result  = 0,
                                    Message = "{\"key\":\"server.buy_success\"}"
                                });
                                MRemaining--;
                                player.UpdateCount++;
                                player.SaveToCharacter();
                                UpdateCount++;
                                return;
                            }
                        }
                        catch (Exception) { }
                    }
                    player.Client.SendMessage(new BUYRESULT
                    {
                        Result  = 0,
                        Message = "{\"key\":\"server.inventory_full\"}"
                    });
                }
                else
                {
                    if (player.Stars < RankReq)
                    {
                        player.Client.SendMessage(new BUYRESULT
                        {
                            Result  = 0,
                            Message = "{\"key\":\"server.not_enough_star\"}"
                        });
                        return;
                    }
                    switch (Currency)
                    {
                    case CurrencyType.Gold:
                        player.Client.SendMessage(new BUYRESULT
                        {
                            Result  = BUY_NO_GOLD,
                            Message = "{\"key\":\"server.not_enough_gold\"}"
                        });
                        break;

                    case CurrencyType.Fame:
                        player.Client.SendMessage(new BUYRESULT
                        {
                            Result  = BUY_NO_FAME,
                            Message = "{\"key\":\"server.not_enough_fame\"}"
                        });
                        break;

                    case CurrencyType.FortuneTokens:
                        player.Client.SendMessage(new BUYRESULT
                        {
                            Result  = BUY_NO_FORTUNETOKENS,
                            Message = "{\"key\":\"server.not_enough_fortunetokens\"}"
                        });
                        break;
                    }
                }
            }
            ;
        }
Ejemplo n.º 20
0
		/// <summary>
		/// Calls the callback method for <see cref="GetVersionAsync"/>.
		/// </summary>
		/// <param name="p_kvpCallback">An object whose key is the callback method to call and whose value is the user-supplied state info to pass to the callback method.</param>
		/// <param name="p_mifInfo">The info of the mod that was retrieved in the asynchronous call.</param>
		private void CallGetFileVersionAsyncCallback(KeyValuePair<Action<object, ModInfo>, object> p_kvpCallback, ModInfo p_mifInfo)
		{
			if (p_kvpCallback.Key != null)
				p_kvpCallback.Key(p_kvpCallback.Value, p_mifInfo);
		}