Esempio n. 1
0
        static void Main(string[] args)
        {
            var          pathToGameFolder = args[0];
            var          lumina           = new GameData(pathToGameFolder);
            var          weatherService   = new FFXIVWeatherLuminaService(lumina);
            const string zone             = "Eureka Pyros";
            const uint   count            = 15U;

            /*var stopwatch = new Stopwatch();
             * for (var i = 0; i < 100000; i++)
             * {
             *  stopwatch.Start();
             *  weatherService.GetForecast(zone, count);
             *  stopwatch.Stop();
             * }
             *
             * Console.WriteLine($"Finished in {stopwatch.ElapsedMilliseconds}ms.");*/

            var forecast = weatherService.GetForecast(zone, count);

            Console.WriteLine($"Weather for {zone}:");
            Console.WriteLine("|\tWeather\t\t|\tTime\t|");
            Console.WriteLine("+-----------------------+---------------+");
            foreach (var(weather, startTime) in forecast)
            {
                Console.WriteLine($"|\t{(((string)weather.Name).Length < 8 ? weather.Name + '\t' : weather.Name)}\t|\t{Math.Round((startTime - DateTime.UtcNow).TotalMinutes)}m\t|");
            }
        }
Esempio n. 2
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;

            this.config = (WeatherWidgetConfiguration)this.pluginInterface.GetPluginConfig() ?? new WeatherWidgetConfiguration();
            this.config.Initialize(this.pluginInterface);

            var sqpackPath = Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), "sqpack");

            this.weatherService = new FFXIVWeatherLuminaService(new Cyalume(sqpackPath, new LuminaOptions
            {
                DefaultExcelLanguage = this.config.Lang,
            }));

            this.ui = new WeatherWidgetUi(this.config, this.weatherService);
            this.pluginInterface.UiBuilder.OnBuildUi      += this.ui.Draw;
            this.pluginInterface.UiBuilder.OnBuildUi      += this.ui.DrawConfig;
            this.pluginInterface.UiBuilder.OnOpenConfigUi += (sender, e) => this.ui.IsConfigVisible = true;

            this.commandManager = new PluginCommandManager <WeatherWidget>(this, this.pluginInterface);
        }