Complete sources for a monero webminer.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. // The MIT License (MIT)
  2. // Copyright (c) 2018-2019 - the webminerpool developer
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy of
  4. // this software and associated documentation files (the "Software"), to deal in
  5. // the Software without restriction, including without limitation the rights to
  6. // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  7. // the Software, and to permit persons to whom the Software is furnished to do so,
  8. // subject to the following conditions:
  9. // The above copyright notice and this permission notice shall be included in all
  10. // copies or substantial portions of the Software.
  11. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  13. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  14. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  15. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  16. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17. using System.Collections.Concurrent;
  18. using System.Collections.Generic;
  19. namespace Server
  20. {
  21. public class CcDictionary<T, V> : ConcurrentDictionary<T, V>
  22. {
  23. public bool TryRemove(T item)
  24. {
  25. V dummy;
  26. return this.TryRemove(item, out dummy);
  27. }
  28. }
  29. public class CcQueue<T> : ConcurrentQueue<T> { }
  30. public class CcHashset<T>
  31. {
  32. ConcurrentDictionary<T, byte> dictionary = new ConcurrentDictionary<T, byte>();
  33. public bool TryAdd(T item)
  34. {
  35. return dictionary.TryAdd(item, byte.MaxValue);
  36. }
  37. public ICollection<T> Values
  38. {
  39. get { return dictionary.Keys; }
  40. }
  41. public int Count { get { return dictionary.Count; } }
  42. public bool Contains(T item)
  43. {
  44. return dictionary.ContainsKey(item);
  45. }
  46. public bool TryRemove(T item)
  47. {
  48. byte dummy;
  49. return dictionary.TryRemove(item, out dummy);
  50. }
  51. }
  52. }