예제 #1
0
        /// <summary>
        /// Get information for each app GUId and then creates an output file formatted in json
        /// </summary>
        /// <param name="appGuids">Array of GUIDs</param>
        /// <param name="behavior">Behavior describing the Store App kind</param>
        /// <param name="outputName">Name for the output file</param>
        private static void GetInformationAndCreateOutput(string[] appGuids, StoreBehavior behavior, string outputName)
        {
            if (appGuids.Length > 0 && !string.IsNullOrWhiteSpace(outputName))
            {
                var wsaf = new StoreParser(behavior);

                Console.WriteLine("Getting information for {0} from internet...", outputName);

                try
                {
                    var listaStoreApps = wsaf.GetStoreAppDataCollection(appGuids);
                    Console.WriteLine("{0} Done", outputName);

                    Console.WriteLine("Generating output in {0}", outputName);
                    File.WriteAllText(outputName,
                        JsonConvert.SerializeObject(listaStoreApps, Formatting.Indented));

                    Console.WriteLine("{0} output file generated", outputName);
                }
                catch (WebException)
                {
                    Console.WriteLine("This program requires internet connection to work properly");
                }
            }
        }
예제 #2
0
        static void Main()
        {
            var phoneGuid = "d2d17da2-e6ad-4b6b-bdcd-ffdea39ba78d";
            var parser = new StoreParser(new PhoneStoreBehavior());

            IStoreApp appData = parser.GetStoreAppDataAsync(phoneGuid).Result;

            Console.WriteLine(appData);
            Console.ReadLine();

            List<string> phoneGuids = new List<string>()
                        {"d2d17da2-e6ad-4b6b-bdcd-ffdea39ba78d",
                            "f4232c0b-24e5-4f01-b8bb-69a892d06e28"};

            //this will open a Thread (Task) for each Guid in list
            IEnumerable<IStoreApp> appDataList = parser.GetStoreAppDataCollection(phoneGuids);

            foreach (var app in appDataList)
            {
                Console.WriteLine(app);
                Console.WriteLine("__________________________");
            }

            Console.ReadLine();
        }