Ejemplo n.º 1
0
        public string ContainerDataForLanguageAndDevice(string dataField, string language, string device)
        {
            try
            {
                if (DisplayFamily.Find(device) == null)
                {
                    throw new Exception($"{device} isn't a valid device name");
                }

                var languages = RawDataDetails.FindAll(d => d.language == language);

                // IDEA: better error for non existing language
                if (languages.Count() < 1)
                {
                    throw new Exception($"{language} isn't an activated language");
                }

                var langDetails     = languages.First();
                var displayFamilies = langDetails.displayFamilies.value;
                var deviceDetails   = displayFamilies.Find(df => df.name == device);

                if (deviceDetails == null)
                {
                    throw new Exception($"Couldn't find device family for {device}");
                }

                if (deviceDetails.GetType().GetProperty(dataField) == null)
                {
                    throw new Exception($"Unexpected state: missing device details for {device}");
                }

                var          jsonSerializer = new JsonSerializer();
                StringWriter textWriter     = new StringWriter();

                if (dataField == "messagesScreenshots")
                {
                    jsonSerializer.Serialize(textWriter, deviceDetails.messagesScreenshots.value);
                    return(textWriter.ToString());
                    //return deviceDetails.messagesScreenshots.value;
                }
                else if (dataField == "trailers")
                {
                    jsonSerializer.Serialize(textWriter, deviceDetails.trailers.value);
                    return(textWriter.ToString());
                    //return deviceDetails.trailers.value;
                }
                else
                {
                    jsonSerializer.Serialize(textWriter, deviceDetails.screenshots.value);
                    return(textWriter.ToString());
                    //return deviceDetails.screenshots.value;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw new Exception($"App Store Connect error: {ex.Message}");
            }
        }
Ejemplo n.º 2
0
        private Dictionary <string, string> PictureTypeMap()
        {
            Dictionary <string, string> _lookup = new Dictionary <string, string>();

            foreach (var displayFamily in DisplayFamily.All())
            {
                _lookup.Add(displayFamily.name.ToString(), displayFamily.pictureType.ToString());
            }

            return(_lookup);
        }
Ejemplo n.º 3
0
        private Dictionary <string, List <List <int> > > DeviceResolutionMap()
        {
            Dictionary <string, List <List <int> > > _lookup = new Dictionary <string, List <List <int> > >();

            foreach (var displayFamily in DisplayFamily.All())
            {
                if (displayFamily.IsMessagesSupported())
                {
                    _lookup.Add(displayFamily.name.ToString(), displayFamily.screenshotResolutions);
                }
            }

            return(_lookup);
        }
Ejemplo n.º 4
0
        private Dictionary <string, string> MessagePictureTypeMap()
        {
            Dictionary <string, string> _lookup = new Dictionary <string, string>();

            foreach (var displayFamily in DisplayFamily.All())
            {
                if (displayFamily.IsMessagesSupported())
                {
                    _lookup.Add(displayFamily.name.ToString(), displayFamily.messagesPictureType.ToString());
                }
            }

            return(_lookup);
        }