Exemplo n.º 1
0
        private static async Task AutoSelectDeck(Deck currentDeck, string heroClass, GameMode mode, Format?currentFormat, List <IGrouping <string, Entity> > cardEntites = null)
        {
            _waitingForDraws++;
            await Task.Delay(500);

            _waitingForDraws--;
            if (_waitingForDraws > 0)
            {
                return;
            }
            var validDecks = DeckList.Instance.Decks.Where(x => x.Class == heroClass && !x.Archived).ToList();

            if (currentDeck != null)
            {
                validDecks.Remove(currentDeck);
            }
            validDecks = validDecks.FilterByMode(mode, currentFormat);
            if (cardEntites != null)
            {
                validDecks = validDecks.Where(x => cardEntites.All(ce => x.GetSelectedDeckVersion().Cards.Any(c => c.Id == ce.Key && c.Count >= ce.Count()))).ToList();
            }
            if (_autoSelectCount > 1)
            {
                Log.Info("Too many auto selects. Showing dialog.");
                ShowDeckSelectionDialog(validDecks);
                return;
            }
            if (validDecks.Count == 0)
            {
                Log.Info("Could not find matching deck.");
                if (cardEntites == null || !AutoSelectDeckVersion(heroClass, mode, currentFormat, cardEntites))
                {
                    ShowDeckSelectionDialog(validDecks);
                }
                return;
            }
            if (validDecks.Count == 1)
            {
                var deck = validDecks.Single();
                Log.Info("Found one matching deck: " + deck);
                Core.MainWindow.SelectDeck(deck, true);
                _autoSelectCount++;
                return;
            }
            var lastUsed = DeckList.Instance.LastDeckClass.FirstOrDefault(x => x.Class == heroClass);

            if (lastUsed != null)
            {
                var deck = validDecks.FirstOrDefault(x => x.DeckId == lastUsed.Id);
                if (deck != null)
                {
                    Log.Info($"Last used {heroClass} deck matches!");
                    Core.MainWindow.SelectDeck(deck, true);
                    _autoSelectCount++;
                    return;
                }
            }
            if (cardEntites == null || !AutoSelectDeckVersion(heroClass, mode, currentFormat, cardEntites))
            {
                ShowDeckSelectionDialog(validDecks);
            }
        }
Exemplo n.º 2
0
        public static void Run(string[] args)
        {
            #region Inputs Validation
            if (args.Length == 0)
            {
                Console.WriteLine(_SHORTHELP);
                return;
            }
            else if (args[0] == "-help")
            {
                Console.WriteLine(_LONGHELP);
                return;
            }

            var input = new FileInfo(args[0]);

            if (!input.Exists)
            {
                Console.WriteLine(_FILENOTFOUND, _INPUTFILE, input.FullName);
                return;
            }

            Console.WriteLine(_FILEFOUND, _INPUTFILE, input.FullName);
            #endregion

            #region Initial Parsing
            FileInfo output        = null;
            Format?  _inputFormat  = null;
            Format?  _outputFormat = null;

            var flags = new List <string>();
            int i     = 1;
            for (; i < args.Length; i++)
            {
                var arg = args[i];

                if (arg.StartsWith("-"))
                {
                    break;
                }

                // Read optional parameters that haven't been set yet in their specific order
                if (output == null && TryReadOutput(arg) ||
                    !_inputFormat.HasValue && TryReadInputFormat(arg) ||
                    !_outputFormat.HasValue && TryReadOutputFormat(arg))
                {
                    continue;
                }
            }
            #endregion

            #region Flags
            for (; i < args.Length; i++)
            {
                var arg = args[i];
                if (!arg.StartsWith("-"))
                {
                    Console.WriteLine(_INVALIDFLAG, arg);
                }
                flags.Add(arg.Substring(1).ToLowerInvariant());
            }

            if (flags.Count > 0)
            {
                Console.WriteLine();
            }
            foreach (string flag in flags)
            {
                switch (flag)
                {
                case "minify":
                    Minify = true;
                    Console.WriteLine(_FLAG, flag, _MINIFY);
                    break;

                case "noindent":
                    NoIndent = true;
                    Console.WriteLine(_FLAG, flag, _NOINDENT);
                    break;

                case "newlines":
                    NewLines = true;
                    Console.WriteLine(_FLAG, flag, _NEWLINES);
                    break;

                case "timer":
                    Timer = true;
                    Console.WriteLine(_FLAG, flag, _TIMER);
                    break;

                case "watch":
                    Watch = true;
                    Console.WriteLine(_FLAG, flag, _WATCH);
                    break;

                case "test":
                    Console.WriteLine(_FLAG, flag, _TEST);
                    Test = true;
                    break;

                default:
                    Console.WriteLine(_UNKNOWNFLAG, flag);
                    break;
                }
            }
            if (flags.Count > 0)
            {
                Console.WriteLine();
            }
            #endregion

            #region Input/Output
            // For some reason, VS can't see how outputFormat will always be assigned a value
            Format inputFormat, outputFormat = Format.XML;

            if (!_inputFormat.HasValue)
            {
                if (TryReadFormat(input.Extension.Substring(1), out Format format))
                {
                    Console.WriteLine(_INFERFORMAT, _INPUT, format.ToString());
                    inputFormat = format;
                }
                else
                {
                    Console.WriteLine(_DEFAUTFORMAT, _INPUT, _BIN);
                    inputFormat = Format.Binary;
                }
            }
            else
            {
                inputFormat = _inputFormat.Value;
            }

            // Test command only needs inputFormat, we need not decide other parameters and log them
            if (Test)
            {
                Console.WriteLine();

                // Watch bad
                Watch = false;

                var xml  = input.ChangeExtension(".xml");
                var json = input.ChangeExtension(".json");

                // Input -> XML
                Start(input, xml, inputFormat, Format.XML);
                // Input -> JSON
                Start(input, json, inputFormat, Format.JSON);

                // XML -> Binary
                Start(xml, xml.AddExtension(".bin"), Format.XML, Format.Binary);
                // JSON -> Binary
                Start(json, json.AddExtension(".bin"), Format.JSON, Format.Binary);

                return;
            }

            if (!_outputFormat.HasValue && output == null)
            {
                AutoOutputFormat();
                AutoOutput();
            }
            else if (!_outputFormat.HasValue)
            {
                if (TryReadFormat(output.Extension.Substring(1), out Format format))
                {
                    Console.WriteLine(_INFERFORMAT, _OUTPUT, format.ToString());
                    outputFormat = format;
                }
                else
                {
                    AutoOutputFormat();
                }
            }
            else if (output == null)
            {
                outputFormat = _outputFormat.Value;
                AutoOutput();
            }
            #endregion

            #region Serialization
            Console.WriteLine();
            Start(input, output, inputFormat, outputFormat);
            #endregion

            #region Utils
            void AutoOutput()
            {
                output = input.ChangeExtension(FormatToExt(outputFormat));
                Console.WriteLine(_AUTOFILE, output.FullName);
            }

            void AutoOutputFormat()
            {
                switch (inputFormat)
                {
                case Format.Binary:
                    Console.WriteLine(_DEFAUTFORMAT, _OUTPUT, _XML);
                    outputFormat = Format.XML;
                    break;

                default:
                    Console.WriteLine(_DEFAUTFORMAT, _OUTPUT, _BIN);
                    outputFormat = Format.Binary;
                    break;
                }
            }

            string FormatToExt(Format format)
            {
                switch (format)
                {
                case Format.Binary:
                    return(".bin");

                case Format.JSON:
                    return(".json");

                default:
                    return(".xml");
                }
            }

            #endregion

            #region Argument Parsers
            bool TryReadOutput(string arg)
            {
                var test = arg.ToLowerInvariant();

                // TODO: Figure out a better test
                if (test.Contains("."))
                {
                    output = new FileInfo(arg);
                    Console.WriteLine(_FILEFOUND, _OUTPUTFILE, output.FullName);
                    return(true);
                }

                return(false);
            }

            bool TryReadFormat(string arg, out Format format)
            {
                switch (arg.ToLowerInvariant())
                {
                case "xml":
                    format = Format.XML;
                    break;

                case "json":
                    format = Format.JSON;
                    break;

                default:
                    if (arg.StartsWith("bin"))
                    {
                        format = Format.Binary;
                    }
                    else
                    {
                        format = Format.XML;
                        return(false);
                    }
                    break;
                }

                return(true);
            }

            bool TryReadInputFormat(string arg)
            {
                if (TryReadFormat(arg, out Format format))
                {
                    _inputFormat = format;
                    Console.WriteLine(_FORMATFOUND, _INPUTFILE, _inputFormat.ToString());
                }

                return(false);
            }

            bool TryReadOutputFormat(string arg)
            {
                if (TryReadFormat(arg, out Format format))
                {
                    _inputFormat = format;
                    Console.WriteLine(_FORMATFOUND, _OUTPUTFILE, _inputFormat.ToString());
                }

                return(false);
            }

            #endregion
        }
Exemplo n.º 3
0
        public static List <Deck> FilterByMode(this List <Deck> decks, GameMode mode, Format?format)
        {
            var filtered = new List <Deck>(decks);

            if (mode == GameMode.Arena)
            {
                filtered = filtered.Where(x => x.IsArenaDeck && x.IsArenaRunCompleted != true).ToList();
            }
            else if (mode != GameMode.None)
            {
                filtered = filtered.Where(x => !x.IsArenaDeck).ToList();
                if (format == Format.Standard)
                {
                    filtered = filtered.Where(x => x.StandardViable).ToList();
                }
            }
            return(filtered);
        }
Exemplo n.º 4
0
        public AndroidHardwareBufferFormatPropertiesANDROID
        (
            StructureType?sType  = StructureType.AndroidHardwareBufferFormatPropertiesAndroid,
            void *pNext          = null,
            Format?format        = null,
            ulong?externalFormat = null,
            FormatFeatureFlags?formatFeatures = null,
            ComponentMapping?samplerYcbcrConversionComponents = null,
            SamplerYcbcrModelConversion?suggestedYcbcrModel   = null,
            SamplerYcbcrRange?suggestedYcbcrRange             = null,
            ChromaLocation?suggestedXChromaOffset             = null,
            ChromaLocation?suggestedYChromaOffset             = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (format is not null)
            {
                Format = format.Value;
            }

            if (externalFormat is not null)
            {
                ExternalFormat = externalFormat.Value;
            }

            if (formatFeatures is not null)
            {
                FormatFeatures = formatFeatures.Value;
            }

            if (samplerYcbcrConversionComponents is not null)
            {
                SamplerYcbcrConversionComponents = samplerYcbcrConversionComponents.Value;
            }

            if (suggestedYcbcrModel is not null)
            {
                SuggestedYcbcrModel = suggestedYcbcrModel.Value;
            }

            if (suggestedYcbcrRange is not null)
            {
                SuggestedYcbcrRange = suggestedYcbcrRange.Value;
            }

            if (suggestedXChromaOffset is not null)
            {
                SuggestedXChromaOffset = suggestedXChromaOffset.Value;
            }

            if (suggestedYChromaOffset is not null)
            {
                SuggestedYChromaOffset = suggestedYChromaOffset.Value;
            }
        }
 /// <summary>
 /// Desired format for the query results.
 /// </summary>
 /// <param name="format">An <see cref="Format" /> enum.</param>
 /// <returns>
 /// A reference to the current <see cref="IQueryRequest" /> for method chaining.
 /// </returns>
 /// <remarks>
 /// Optional.
 /// </remarks>
 public IQueryRequest Format(Format format)
 {
     _format = format;
     return this;
 }
Exemplo n.º 6
0
 public Card GetCardForFormat(Format?format) => GetCardForFormat(HearthDbConverter.GetFormatType(format));
Exemplo n.º 7
0
 /// <summary>
 /// Desired format for the query results.
 /// </summary>
 /// <param name="format">An <see cref="Format" /> enum.</param>
 /// <returns>
 /// A reference to the current <see cref="IQueryRequest" /> for method chaining.
 /// </returns>
 /// <remarks>
 /// Optional.
 /// </remarks>
 public IQueryRequest Format(Format format)
 {
     _format = format;
     return(this);
 }
Exemplo n.º 8
0
        /// <param name="format">Format to be used</param>
        /// <returns>Result</returns>
        /// <exception cref="EDPSymbologyException">A server side error occurred.</exception>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        public async System.Threading.Tasks.Task <Symbology> GetConvertAsync(string universe, System.Collections.Generic.IEnumerable <FieldEnum> to, Format?format, System.Threading.CancellationToken cancellationToken)
        {
            if (universe == null)
            {
                throw new System.ArgumentNullException("universe");
            }


            var urlBuilder_ = new System.Text.StringBuilder();

            urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/convert?");
            urlBuilder_.Append("universe=").Append(System.Uri.EscapeDataString(ConvertToString(universe, System.Globalization.CultureInfo.InvariantCulture))).Append("&");

            if (to != null && to.Count() > 0)
            {
                urlBuilder_.Append("to=");
                foreach (var item_ in to)
                {
                    urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture)));
                    if (item_ != to.Last())
                    {
                        urlBuilder_.Append(",");
                    }
                    else
                    {
                        urlBuilder_.Append("&");
                    }
                }
            }
            if (format != null)
            {
                urlBuilder_.Append("format=").Append(System.Uri.EscapeDataString(ConvertToString(format, System.Globalization.CultureInfo.InvariantCulture))).Append("&");
            }
            urlBuilder_.Length--;

            var client_ = _httpClient;

            try
            {
                using (var request_ = new System.Net.Http.HttpRequestMessage())
                {
                    request_.Method = new System.Net.Http.HttpMethod("GET");
                    request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));

                    PrepareRequest(client_, request_, urlBuilder_);
                    var url_ = urlBuilder_.ToString();
                    request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);
                    PrepareRequest(client_, request_, url_);

                    var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);

                    try
                    {
                        var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
                        if (response_.Content != null && response_.Content.Headers != null)
                        {
                            foreach (var item_ in response_.Content.Headers)
                            {
                                headers_[item_.Key] = item_.Value;
                            }
                        }

                        ProcessResponse(client_, response_);

                        var status_ = ((int)response_.StatusCode).ToString();
                        if (status_ == "200")
                        {
                            var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);

                            var result_ = default(Symbology);
                            try
                            {
                                result_ = Newtonsoft.Json.JsonConvert.DeserializeObject <Symbology>(responseData_, _settings.Value);
                                return(result_);
                            }
                            catch (System.Exception exception_)
                            {
                                throw new EDPSymbologyException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
                            }
                        }
                        else
                        {
                            var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);

                            var result_ = default(Error);
                            try
                            {
                                result_ = Newtonsoft.Json.JsonConvert.DeserializeObject <Error>(responseData_, _settings.Value);
                            }
                            catch (System.Exception exception_)
                            {
                                throw new EDPSymbologyException("Could not deserialize the response body.", (int)response_.StatusCode, responseData_, headers_, exception_);
                            }
                            throw new EDPSymbologyException <Error>("Error", (int)response_.StatusCode, responseData_, headers_, result_, null);
                        }
                    }
                    finally
                    {
                        if (response_ != null)
                        {
                            response_.Dispose();
                        }
                    }
                }
            }
            finally
            {
            }
        }
Exemplo n.º 9
0
        public VideoSessionCreateInfoKHR
        (
            StructureType?sType                  = StructureType.VideoSessionCreateInfoKhr,
            void *pNext                          = null,
            uint?queueFamilyIndex                = null,
            VideoSessionCreateFlagsKHR?flags     = null,
            VideoProfileKHR *pVideoProfile       = null,
            Format?pictureFormat                 = null,
            Extent2D?maxCodedExtent              = null,
            Format?referencePicturesFormat       = null,
            uint?maxReferencePicturesSlotsCount  = null,
            uint?maxReferencePicturesActiveCount = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (queueFamilyIndex is not null)
            {
                QueueFamilyIndex = queueFamilyIndex.Value;
            }

            if (flags is not null)
            {
                Flags = flags.Value;
            }

            if (pVideoProfile is not null)
            {
                PVideoProfile = pVideoProfile;
            }

            if (pictureFormat is not null)
            {
                PictureFormat = pictureFormat.Value;
            }

            if (maxCodedExtent is not null)
            {
                MaxCodedExtent = maxCodedExtent.Value;
            }

            if (referencePicturesFormat is not null)
            {
                ReferencePicturesFormat = referencePicturesFormat.Value;
            }

            if (maxReferencePicturesSlotsCount is not null)
            {
                MaxReferencePicturesSlotsCount = maxReferencePicturesSlotsCount.Value;
            }

            if (maxReferencePicturesActiveCount is not null)
            {
                MaxReferencePicturesActiveCount = maxReferencePicturesActiveCount.Value;
            }
        }
Exemplo n.º 10
0
 /// <param name="format">Format to be used</param>
 /// <returns>Result</returns>
 /// <exception cref="EDPSymbologyException">A server side error occurred.</exception>
 public System.Threading.Tasks.Task <Symbology> PostConvertAsync(ConvertRequest convertRequest, Format?format)
 {
     return(PostConvertAsync(convertRequest, format, System.Threading.CancellationToken.None));
 }
Exemplo n.º 11
0
 /// <param name="format">Format to be used</param>
 /// <returns>Result</returns>
 /// <exception cref="EDPSymbologyException">A server side error occurred.</exception>
 public System.Threading.Tasks.Task <Symbology> GetConvertAsync(string universe, System.Collections.Generic.IEnumerable <FieldEnum> to, Format?format)
 {
     return(GetConvertAsync(universe, to, format, System.Threading.CancellationToken.None));
 }
Exemplo n.º 12
0
        private static async Task AutoSelectDeck(Deck currentDeck, string heroClass, GameMode mode, Format?currentFormat, List <IGrouping <string, Entity> > cardEntites = null)
        {
            _waitingForDraws++;
            await Task.Delay(500);

            _waitingForDraws--;
            if (_waitingForDraws > 0)
            {
                return;
            }
            var validDecks = DeckList.Instance.Decks.Where(x => x.Class == heroClass && !x.Archived).ToList();

            if (currentDeck != null)
            {
                validDecks.Remove(currentDeck);
            }
            if (mode == GameMode.Arena)
            {
                validDecks = validDecks.Where(x => x.IsArenaDeck && x.IsArenaRunCompleted != true).ToList();
            }
            else if (mode != GameMode.None)
            {
                validDecks = validDecks.Where(x => !x.IsArenaDeck).ToList();
                if (currentFormat == Format.Wild)
                {
                    validDecks = validDecks.Where(x => !x.StandardViable).ToList();
                }
            }
            if (validDecks.Count > 1 && cardEntites != null)
            {
                validDecks = validDecks.Where(x => cardEntites.All(ce => x.GetSelectedDeckVersion().Cards.Any(c => c.Id == ce.Key && c.Count >= ce.Count()))).ToList();
            }
            if (validDecks.Count == 0)
            {
                Log.Info("Could not find matching deck.");
                ShowDeckSelectionDialog(validDecks);
                return;
            }
            if (validDecks.Count == 1)
            {
                var deck = validDecks.Single();
                Log.Info("Found one matching deck: " + deck);
                Core.MainWindow.SelectDeck(deck, true);
                return;
            }
            var lastUsed = DeckList.Instance.LastDeckClass.FirstOrDefault(x => x.Class == heroClass);

            if (lastUsed != null)
            {
                var deck = validDecks.FirstOrDefault(x => x.DeckId == lastUsed.Id);
                if (deck != null)
                {
                    Log.Info($"Last used {heroClass} deck matches!");
                    Core.MainWindow.SelectDeck(deck, true);
                    return;
                }
            }
            ShowDeckSelectionDialog(validDecks);
        }
Exemplo n.º 13
0
        public PresentParameters
        (
            uint?backBufferWidth            = null,
            uint?backBufferHeight           = null,
            Format?backBufferFormat         = null,
            uint?backBufferCount            = null,
            MultisampleType?multiSampleType = null,
            uint?multiSampleQuality         = null,
            Swapeffect?swapEffect           = null,
            nint?hDeviceWindow            = null,
            int?windowed                  = null,
            int?enableAutoDepthStencil    = null,
            Format?autoDepthStencilFormat = null,
            uint?flags = null,
            uint?fullScreenRefreshRateInHz = null,
            uint?presentationInterval      = null
        ) : this()
        {
            if (backBufferWidth is not null)
            {
                BackBufferWidth = backBufferWidth.Value;
            }

            if (backBufferHeight is not null)
            {
                BackBufferHeight = backBufferHeight.Value;
            }

            if (backBufferFormat is not null)
            {
                BackBufferFormat = backBufferFormat.Value;
            }

            if (backBufferCount is not null)
            {
                BackBufferCount = backBufferCount.Value;
            }

            if (multiSampleType is not null)
            {
                MultiSampleType = multiSampleType.Value;
            }

            if (multiSampleQuality is not null)
            {
                MultiSampleQuality = multiSampleQuality.Value;
            }

            if (swapEffect is not null)
            {
                SwapEffect = swapEffect.Value;
            }

            if (hDeviceWindow is not null)
            {
                HDeviceWindow = hDeviceWindow.Value;
            }

            if (windowed is not null)
            {
                Windowed = windowed.Value;
            }

            if (enableAutoDepthStencil is not null)
            {
                EnableAutoDepthStencil = enableAutoDepthStencil.Value;
            }

            if (autoDepthStencilFormat is not null)
            {
                AutoDepthStencilFormat = autoDepthStencilFormat.Value;
            }

            if (flags is not null)
            {
                Flags = flags.Value;
            }

            if (fullScreenRefreshRateInHz is not null)
            {
                FullScreenRefreshRateInHz = fullScreenRefreshRateInHz.Value;
            }

            if (presentationInterval is not null)
            {
                PresentationInterval = presentationInterval.Value;
            }
        }
Exemplo n.º 14
0
 public Config(TimeSpan?initialTime = null, TimeSpan?duration = null, VideoCodec?videoCodec = null, AudioCodec?audioCodec = null, AudioOption?audioOption = null, AudioBitrate?audioBitrate = null, int?height = null, int?width = null, TranscodeSpeed?doitSpeed = null, Format?outputFormat = Format.mp4)
 {
     this.initialTime  = initialTime;
     this.duration     = duration;
     this.videoCodec   = videoCodec;
     this.audioCodec   = audioCodec;
     this.audioOption  = audioOption;
     this.audioBitrate = audioBitrate;
     this.height       = height;
     this.width        = width;
     this.doitSpeed    = doitSpeed;
     this.outputFormat = outputFormat;
 }
Exemplo n.º 15
0
        public ImageCreateInfo
        (
            StructureType?sType        = StructureType.ImageCreateInfo,
            void *pNext                = null,
            ImageCreateFlags?flags     = null,
            ImageType?imageType        = null,
            Format?format              = null,
            Extent3D?extent            = null,
            uint?mipLevels             = null,
            uint?arrayLayers           = null,
            SampleCountFlags?samples   = null,
            ImageTiling?tiling         = null,
            ImageUsageFlags?usage      = null,
            SharingMode?sharingMode    = null,
            uint?queueFamilyIndexCount = null,
            uint *pQueueFamilyIndices  = null,
            ImageLayout?initialLayout  = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (flags is not null)
            {
                Flags = flags.Value;
            }

            if (imageType is not null)
            {
                ImageType = imageType.Value;
            }

            if (format is not null)
            {
                Format = format.Value;
            }

            if (extent is not null)
            {
                Extent = extent.Value;
            }

            if (mipLevels is not null)
            {
                MipLevels = mipLevels.Value;
            }

            if (arrayLayers is not null)
            {
                ArrayLayers = arrayLayers.Value;
            }

            if (samples is not null)
            {
                Samples = samples.Value;
            }

            if (tiling is not null)
            {
                Tiling = tiling.Value;
            }

            if (usage is not null)
            {
                Usage = usage.Value;
            }

            if (sharingMode is not null)
            {
                SharingMode = sharingMode.Value;
            }

            if (queueFamilyIndexCount is not null)
            {
                QueueFamilyIndexCount = queueFamilyIndexCount.Value;
            }

            if (pQueueFamilyIndices is not null)
            {
                PQueueFamilyIndices = pQueueFamilyIndices;
            }

            if (initialLayout is not null)
            {
                InitialLayout = initialLayout.Value;
            }
        }
Exemplo n.º 16
0
        public IDirect3DSurface9
        (
            char *name    = null,
            uint?width    = null,
            uint?height   = null,
            uint?usage    = null,
            Format?format = null,
            Pool?pool     = null,
            MultisampleType?multiSampleType = null,
            uint?multiSampleQuality         = null,
            uint?priority  = null,
            uint?lockCount = null,
            uint?dCCount   = null,
            void **lpVtbl  = null
        ) : this()
        {
            if (name is not null)
            {
                Name = name;
            }

            if (width is not null)
            {
                Width = width.Value;
            }

            if (height is not null)
            {
                Height = height.Value;
            }

            if (usage is not null)
            {
                Usage = usage.Value;
            }

            if (format is not null)
            {
                Format = format.Value;
            }

            if (pool is not null)
            {
                Pool = pool.Value;
            }

            if (multiSampleType is not null)
            {
                MultiSampleType = multiSampleType.Value;
            }

            if (multiSampleQuality is not null)
            {
                MultiSampleQuality = multiSampleQuality.Value;
            }

            if (priority is not null)
            {
                Priority = priority.Value;
            }

            if (lockCount is not null)
            {
                LockCount = lockCount.Value;
            }

            if (dCCount is not null)
            {
                DCCount = dCCount.Value;
            }

            if (lpVtbl is not null)
            {
                LpVtbl = lpVtbl;
            }
        }
Exemplo n.º 17
0
        public static BnetGameType GetBnetGameType(GameType gameType, Format?format)
        {
            switch (gameType)
            {
            case GameType.GT_UNKNOWN:
                return(BGT_UNKNOWN);

            case GameType.GT_VS_AI:
                return(BGT_VS_AI);

            case GameType.GT_VS_FRIEND:
                return(BGT_FRIENDS);

            case GameType.GT_TUTORIAL:
                return(BGT_TUTORIAL);

            case GameType.GT_ARENA:
                return(BGT_ARENA);

            case GameType.GT_TEST:
                return(BGT_TEST1);

            case GameType.GT_RANKED:
                return(format == Format.Standard ? BGT_RANKED_STANDARD : BGT_RANKED_WILD);

            case GameType.GT_CASUAL:
                return(format == Format.Standard ? BGT_CASUAL_STANDARD : BGT_CASUAL_WILD);

            case GameType.GT_TAVERNBRAWL:
                return(BGT_TAVERNBRAWL_PVP);

            case GameType.GT_TB_1P_VS_AI:
                return(BGT_TAVERNBRAWL_1P_VERSUS_AI);

            case GameType.GT_TB_2P_COOP:
                return(BGT_TAVERNBRAWL_2P_COOP);

            case GameType.GT_FSG_BRAWL:
                return(BGT_FSG_BRAWL_VS_FRIEND);

            case GameType.GT_FSG_BRAWL_1P_VS_AI:
                return(BGT_FSG_BRAWL_1P_VERSUS_AI);

            case GameType.GT_FSG_BRAWL_2P_COOP:
                return(BGT_FSG_BRAWL_2P_COOP);

            case GameType.GT_FSG_BRAWL_VS_FRIEND:
                return(BGT_FSG_BRAWL_VS_FRIEND);

            case GameType.GT_BATTLEGROUNDS:
                return(BGT_BATTLEGROUNDS);

            case GameType.GT_BATTLEGROUNDS_FRIENDLY:
                return(BGT_BATTLEGROUNDS_FRIENDLY);

            case GameType.GT_PVPDR:
                return(BGT_PVPDR);

            case GameType.GT_PVPDR_PAID:
                return(BGT_PVPDR_PAID);

            default:
                return(BGT_UNKNOWN);
            }
        }
Exemplo n.º 18
0
        public SamplerYcbcrConversionCreateInfoKHR
        (
            StructureType?sType = StructureType.SamplerYcbcrConversionCreateInfo,
            void *pNext         = null,
            Format?format       = null,
            SamplerYcbcrModelConversion?ycbcrModel = null,
            SamplerYcbcrRange?ycbcrRange           = null,
            ComponentMapping?components            = null,
            ChromaLocation?xChromaOffset           = null,
            ChromaLocation?yChromaOffset           = null,
            Filter?chromaFilter = null,
            Bool32?forceExplicitReconstruction = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (format is not null)
            {
                Format = format.Value;
            }

            if (ycbcrModel is not null)
            {
                YcbcrModel = ycbcrModel.Value;
            }

            if (ycbcrRange is not null)
            {
                YcbcrRange = ycbcrRange.Value;
            }

            if (components is not null)
            {
                Components = components.Value;
            }

            if (xChromaOffset is not null)
            {
                XChromaOffset = xChromaOffset.Value;
            }

            if (yChromaOffset is not null)
            {
                YChromaOffset = yChromaOffset.Value;
            }

            if (chromaFilter is not null)
            {
                ChromaFilter = chromaFilter.Value;
            }

            if (forceExplicitReconstruction is not null)
            {
                ForceExplicitReconstruction = forceExplicitReconstruction.Value;
            }
        }
Exemplo n.º 19
0
        public static async void Convert(CommandInformation cmdinfo)
        {
            // Set input format to ASCII as standard
            Format?input = knownFormats[3];
            // Set input format to Unicode as standard
            Format?output = knownFormats[4];
            string mode   = cmdinfo.arguments[0].ToLower();

            switch (mode)
            {
            case "-to":
                output = findFormat(cmdinfo.arguments[1]);
                break;

            case "-from":
                input = findFormat(cmdinfo.arguments[1]);
                break;

            default:
                await cmdinfo.messages.Send("Expected '-to' or '-from' as first argument!");

                return;
            }
            bool readExtraData = false;

            if (cmdinfo.arguments.Length >= 4)
            {
                string secondaryMode = cmdinfo.arguments[2].ToLower();

                switch (secondaryMode)
                {
                case "-to":
                    output        = findFormat(cmdinfo.arguments[3]);
                    readExtraData = true;
                    break;

                case "-from":
                    input         = findFormat(cmdinfo.arguments[3]);
                    readExtraData = true;
                    break;
                }
            }

            if (!input.HasValue)
            {
                await cmdinfo.messages.Send($"Unrecognized input format.\n{listFormats()}");

                return;
            }

            if (!output.HasValue)
            {
                await cmdinfo.messages.Send($"Unrecognized output format.\n{listFormats()}");

                return;
            }

            try
            {
                // All whitespace is treated the same; Beware
                string toConvert = String.Join(' ', Util.SubArray(cmdinfo.arguments, readExtraData ? 4: 2));
                byte[] raw       = input.Value.Decode(toConvert);
                await cmdinfo.messages.Send(output.Value.Encode(raw));
            }
            catch
            {
                await cmdinfo.messages.Send("Your input was in an incorrect format!");
            }
        }
        public AttachmentDescription2KHR
        (
            StructureType?sType = StructureType.AttachmentDescription2,
            void *pNext         = null,
            AttachmentDescriptionFlags?flags = null,
            Format?format                    = null,
            SampleCountFlags?samples         = null,
            AttachmentLoadOp?loadOp          = null,
            AttachmentStoreOp?storeOp        = null,
            AttachmentLoadOp?stencilLoadOp   = null,
            AttachmentStoreOp?stencilStoreOp = null,
            ImageLayout?initialLayout        = null,
            ImageLayout?finalLayout          = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (flags is not null)
            {
                Flags = flags.Value;
            }

            if (format is not null)
            {
                Format = format.Value;
            }

            if (samples is not null)
            {
                Samples = samples.Value;
            }

            if (loadOp is not null)
            {
                LoadOp = loadOp.Value;
            }

            if (storeOp is not null)
            {
                StoreOp = storeOp.Value;
            }

            if (stencilLoadOp is not null)
            {
                StencilLoadOp = stencilLoadOp.Value;
            }

            if (stencilStoreOp is not null)
            {
                StencilStoreOp = stencilStoreOp.Value;
            }

            if (initialLayout is not null)
            {
                InitialLayout = initialLayout.Value;
            }

            if (finalLayout is not null)
            {
                FinalLayout = finalLayout.Value;
            }
        }
Exemplo n.º 21
0
        public IDirect3DTexture9
        (
            char *name    = null,
            uint?width    = null,
            uint?height   = null,
            uint?levels   = null,
            uint?usage    = null,
            Format?format = null,
            Pool?pool     = null,
            uint?priority = null,
            uint?lOD      = null,
            Texturefiltertype?filterType = null,
            uint?lockCount = null,
            void **lpVtbl  = null
        ) : this()
        {
            if (name is not null)
            {
                Name = name;
            }

            if (width is not null)
            {
                Width = width.Value;
            }

            if (height is not null)
            {
                Height = height.Value;
            }

            if (levels is not null)
            {
                Levels = levels.Value;
            }

            if (usage is not null)
            {
                Usage = usage.Value;
            }

            if (format is not null)
            {
                Format = format.Value;
            }

            if (pool is not null)
            {
                Pool = pool.Value;
            }

            if (priority is not null)
            {
                Priority = priority.Value;
            }

            if (lOD is not null)
            {
                LOD = lOD.Value;
            }

            if (filterType is not null)
            {
                FilterType = filterType.Value;
            }

            if (lockCount is not null)
            {
                LockCount = lockCount.Value;
            }

            if (lpVtbl is not null)
            {
                LpVtbl = lpVtbl;
            }
        }
 /// <summary>
 /// Desired format for the query results.
 /// </summary>
 /// <param name="format">An <see cref="Format" /> enum.</param>
 /// <returns>
 /// A reference to the current <see cref="QueryOptions" /> for method chaining.
 /// </returns>
 /// <remarks>
 /// Optional.
 /// </remarks>
 public IQueryOptions Format(Format format)
 {
     _format = format;
     return(this);
 }
Exemplo n.º 23
0
        static void Main(string[] args)
        {
            var    diag  = new Diagnoser();
            Op?    op    = null;
            string slang = null;
            string tlang = null;
            Format?fmt   = null;

            var options = new OptionSet
            {
                { "i|import", "Import a source LocRes into an XLIFF.", v => op = Op.Import },
                { "a|align", "Align two (source and target) LocRes into an XLIFF.", v => op = Op.Align },
                { "e|export", "Export an XLIFF to a LocRes.", v => op = Op.Export },
                { "h|help", "Show usage and terminate.", v => op = Op.Help },

                { "s|slang=", "Source language, e.g., en.", v => slang = v },
                { "t|tlang=", "Target language, e.g., fr.", v => tlang = v },
                { "f|format=", "LocRes file format.  VALUE is auto, old or new.  Default is auto.", (Format v) => fmt = v },
            };

            List <string> files = null;

            try
            {
                files = options.Parse(args);
                switch (op)
                {
                case Op.Import:
                    if (slang == null)
                    {
                        diag.Add("Import requires a source language (-s).");
                    }
                    if (tlang == null)
                    {
                        diag.Add("Import requires a target language (-t).");
                    }
                    if (files.Count != 2)
                    {
                        diag.Add("Import requires two files, source LocRes and output XLIFF.");
                    }
                    if (fmt != null)
                    {
                        diag.Add("Import doesn't allow -f option.");
                    }
                    break;

                case Op.Align:
                    if (slang == null)
                    {
                        diag.Add("Align requires a source language (-s).");
                    }
                    if (tlang == null)
                    {
                        diag.Add("Align requires a target language (-t).");
                    }
                    if (files.Count != 3)
                    {
                        diag.Add("Align requires three files, source LocRes, target LocRes and output XLIFF.");
                    }
                    if (fmt != null)
                    {
                        diag.Add("Align doesn't allow -f option.");
                    }
                    break;

                case Op.Export:
                    if (files.Count != 2)
                    {
                        diag.Add("Export requires two files, input XLIFF and target LocRes.");
                    }
                    if (slang != null)
                    {
                        diag.Add("Export doesn't allow -s option.");
                    }
                    if (tlang != null)
                    {
                        diag.Add("Export doesn't allow -t option.");
                    }
                    break;

                case Op.Help:
                    break;

                default:     /* most likely null */
                    diag.Add("One of Import (-i), Align (-a), Export (-e), or Help (-h) is required.");
                    break;
                }
            }
            catch (OptionException e)
            {
                diag.Add(e.Message);
            }

            if (diag.Messages.Count > 0)
            {
                Console.Error.WriteLine("Error on the command line options/parameters.");
                foreach (var msg in diag.Messages)
                {
                    Console.Error.WriteLine("  " + msg);
                }
                Console.Error.WriteLine("use \"{0} --help\" to see command line syntax.", NAME);
                Environment.Exit(1);
            }

            switch (op)
            {
            case Op.Import:
                Converter.Import(files[0], files[1], slang, tlang);
                break;

            case Op.Align:
                Converter.Align(files[0], files[1], files[2], slang, tlang);
                break;

            case Op.Export:
                Converter.Export(files[0], files[1], (LocResFormat)(fmt ?? Format.@auto));
                break;

            case Op.Help:
            {
                Console.Error.WriteLine("Usage: {0} command [options] files...", NAME);
                Console.Error.WriteLine("  To import: {0} -i -s source-language -t target-language source.locres output.xliff", NAME);
                Console.Error.WriteLine("  To align:  {0} -a -s source-language -t target-language source.locres target.locres output.xloiff", NAME);
                Console.Error.WriteLine("  To export: {0} -e -s [-f format] input.xliff output-target.locres", NAME);
                Console.Error.WriteLine("Options:");
                options.WriteOptionDescriptions(Console.Error);
                Console.Error.WriteLine("Example:");
                Console.Error.WriteLine("  {0} -a -s en -t fr en/Tutorial.locres fr/Tutorial.locres Tutorial-en-fr.xliff", NAME);
                Console.Error.WriteLine();
            }
            break;
            }
        }
        public SwapchainCreateInfoKHR
        (
            StructureType?sType                   = StructureType.SwapchainCreateInfoKhr,
            void *pNext                           = null,
            SwapchainCreateFlagsKHR?flags         = null,
            SurfaceKHR?surface                    = null,
            uint?minImageCount                    = null,
            Format?imageFormat                    = null,
            ColorSpaceKHR?imageColorSpace         = null,
            Extent2D?imageExtent                  = null,
            uint?imageArrayLayers                 = null,
            ImageUsageFlags?imageUsage            = null,
            SharingMode?imageSharingMode          = null,
            uint?queueFamilyIndexCount            = null,
            uint *pQueueFamilyIndices             = null,
            SurfaceTransformFlagsKHR?preTransform = null,
            CompositeAlphaFlagsKHR?compositeAlpha = null,
            PresentModeKHR?presentMode            = null,
            Bool32?clipped                        = null,
            SwapchainKHR?oldSwapchain             = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (flags is not null)
            {
                Flags = flags.Value;
            }

            if (surface is not null)
            {
                Surface = surface.Value;
            }

            if (minImageCount is not null)
            {
                MinImageCount = minImageCount.Value;
            }

            if (imageFormat is not null)
            {
                ImageFormat = imageFormat.Value;
            }

            if (imageColorSpace is not null)
            {
                ImageColorSpace = imageColorSpace.Value;
            }

            if (imageExtent is not null)
            {
                ImageExtent = imageExtent.Value;
            }

            if (imageArrayLayers is not null)
            {
                ImageArrayLayers = imageArrayLayers.Value;
            }

            if (imageUsage is not null)
            {
                ImageUsage = imageUsage.Value;
            }

            if (imageSharingMode is not null)
            {
                ImageSharingMode = imageSharingMode.Value;
            }

            if (queueFamilyIndexCount is not null)
            {
                QueueFamilyIndexCount = queueFamilyIndexCount.Value;
            }

            if (pQueueFamilyIndices is not null)
            {
                PQueueFamilyIndices = pQueueFamilyIndices;
            }

            if (preTransform is not null)
            {
                PreTransform = preTransform.Value;
            }

            if (compositeAlpha is not null)
            {
                CompositeAlpha = compositeAlpha.Value;
            }

            if (presentMode is not null)
            {
                PresentMode = presentMode.Value;
            }

            if (clipped is not null)
            {
                Clipped = clipped.Value;
            }

            if (oldSwapchain is not null)
            {
                OldSwapchain = oldSwapchain.Value;
            }
        }
Exemplo n.º 25
0
		public void Reset(bool resetStats = true)
		{
			Log.Info("-------- Reset ---------");

			ReplayMaker.Reset();
			Player.Reset();
			Opponent.Reset();
			if(!_matchInfoCacheInvalid && MatchInfo?.LocalPlayer != null && MatchInfo.OpposingPlayer != null)
			{
				Player.Name = MatchInfo.LocalPlayer.Name;
				Opponent.Name = MatchInfo.OpposingPlayer.Name;
				Player.Id = MatchInfo.LocalPlayer.Id;
				Opponent.Id = MatchInfo.OpposingPlayer.Id;
			}
			Entities.Clear();
			SavedReplay = false;
			OpponentSecretCount = 0;
			OpponentSecrets.ClearSecrets();
			_spectator = null;
			_currentGameMode = GameMode.None;
			_currentFormat = null;
			if(!IsInMenu && resetStats)
				CurrentGameStats = new GameStats(GameResult.None, "", "") {PlayerName = "", OpponentName = "", Region = CurrentRegion};
			PowerLog.Clear();

			if(Core.Game != null && Core.Overlay != null)
			{
				Core.UpdatePlayerCards(true);
				Core.UpdateOpponentCards(true);
			}
		}
Exemplo n.º 26
0
        public GeometryTrianglesNV
        (
            StructureType?sType   = StructureType.GeometryTrianglesNV,
            void *pNext           = null,
            Buffer?vertexData     = null,
            ulong?vertexOffset    = null,
            uint?vertexCount      = null,
            ulong?vertexStride    = null,
            Format?vertexFormat   = null,
            Buffer?indexData      = null,
            ulong?indexOffset     = null,
            uint?indexCount       = null,
            IndexType?indexType   = null,
            Buffer?transformData  = null,
            ulong?transformOffset = null
        ) : this()
        {
            if (sType is not null)
            {
                SType = sType.Value;
            }

            if (pNext is not null)
            {
                PNext = pNext;
            }

            if (vertexData is not null)
            {
                VertexData = vertexData.Value;
            }

            if (vertexOffset is not null)
            {
                VertexOffset = vertexOffset.Value;
            }

            if (vertexCount is not null)
            {
                VertexCount = vertexCount.Value;
            }

            if (vertexStride is not null)
            {
                VertexStride = vertexStride.Value;
            }

            if (vertexFormat is not null)
            {
                VertexFormat = vertexFormat.Value;
            }

            if (indexData is not null)
            {
                IndexData = indexData.Value;
            }

            if (indexOffset is not null)
            {
                IndexOffset = indexOffset.Value;
            }

            if (indexCount is not null)
            {
                IndexCount = indexCount.Value;
            }

            if (indexType is not null)
            {
                IndexType = indexType.Value;
            }

            if (transformData is not null)
            {
                TransformData = transformData.Value;
            }

            if (transformOffset is not null)
            {
                TransformOffset = transformOffset.Value;
            }
        }