示例#1
0
        /// <summary>
        /// Construct a service
        /// </summary>
        public AndroidService()
        {
            if (!File.Exists(BotTokenFilePath))
            {
                throw new Exception("Could not find bot token file at " + BotTokenFilePath);
            }

            Instance = this;
        }
        /// <summary>
        /// Save all instances in the given service to the state files
        /// </summary>
        public static void SaveAll(AndroidService service)
        {
            Console.WriteLine("Saving Android service...");

            //I want exceptions as a concept to die
            try
            {
                foreach (var instance in service.AndroidInstances)
                {
                    Save(instance.Value);
                }

                Console.WriteLine("Saved succesfully");
            }
            catch (Exception e)
            {
                Console.WriteLine("Saving failure: {0}", e.Message);
            }
        }