예제 #1
0
        public void GetData(Action <object, Exception> callback)
        {
            var uodataManager = UODataManager.GetInstance(new Uri(@"C:\Ultima\Client\Ultima Online 2D Client"), UODataType.ClassicAdventuresOnHighSeas,
                                                          Language.English, null, false);

            callback(uodataManager, null);
        }
예제 #2
0
        public void TestMethod1()
        {
            var _manager = UODataManager.GetInstance(new Uri(@"C:\The Miracle"), UODataType.ClassicMondainsLegacy, Language.English);
            UltimaMapDataProvider provider = new UltimaMapDataProvider();
            var map = _manager.GetMapFacet(4);

            provider.mapIndex(4, _manager.GetMapFacet(4));
            var bmp = EssenceUDK.MapMaker.MapMaking.BitmapReader.ExportAltitude(provider, (int)map.Width, (int)map.Height, null);

            bmp.Save(Path.Combine(@"C:\Users\Fabio\Desktop\map", "test.bmp"), ImageFormat.Bmp);
        }
        public ViewModelOptionWindow()
        {
            AppMessages.DialogAnwer.Register(this, DialogResultHandler);
            CommandSelectDirectory = new RelayCommand(
                () => AppMessages.DialogRequest.Send(new MessageDialogRequest("OpenOptionFolder")));

            CommandApply = new RelayCommand(() =>
            {
                try
                {
                    if (ApplicationController.manager != null)
                    {
                        ApplicationController.manager.Dispose();
                        ApplicationController.manager = null;
                    }
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    ApplicationController.manager =
                        UODataManager.GetInstance(new Uri(SelectedFolder),
                                                  _data, Language.English);
                    AppMessages.OptionAnswer.Send(new OptionMessage()
                    {
                        Success = true
                    });
                }
                catch (Exception e)
                {
                    AppMessages.DialogRequest.Send(new MessageDialogRequest(e.Message));
                }
                var serializer = new XmlSerializer(GetType());
                using (var File = new FileStream("options.xml", FileMode.Create))
                {
                    serializer.Serialize(File, this);
                }
            }, () => !string.IsNullOrEmpty(SelectedFolder));

            CommandCancel = new RelayCommand(() => AppMessages.OptionAnswer.Send(new OptionMessage()
            {
                Success = false
            }));


            if (!ClientInfoSources.Any() || ClientInfoSources[0] == null)
            {
                return;
            }
            SelectedFolder        = ClientInfoSources[0].DirectoryPath;
            SelectedDataTypeIndex = (int)DataSelector(ClientInfoSources[0].ProductVersion);
        }
예제 #4
0
        private void btnLoadMuls_Click(object sender, RoutedEventArgs e)
        {
            try {
                UOManager = null;
                var datauri = new Uri(tbPath.Text);
                var dataopt = new UODataOptions();
                dataopt.majorFacet[0] = new FacetDesc("FacetMap-0", (ushort)nudM0W.Value, (ushort)nudM0H.Value, (ushort)nudM0W.Value, (ushort)nudM0H.Value);
                dataopt.majorFacet[1] = new FacetDesc("FacetMap-1", (ushort)nudM1W.Value, (ushort)nudM1H.Value, (ushort)nudM1W.Value, (ushort)nudM1H.Value);
                dataopt.majorFacet[2] = new FacetDesc("FacetMap-2", (ushort)nudM2W.Value, (ushort)nudM2H.Value, (ushort)nudM2W.Value, (ushort)nudM2H.Value);
                dataopt.majorFacet[3] = new FacetDesc("FacetMap-3", (ushort)nudM3W.Value, (ushort)nudM3H.Value, (ushort)nudM3W.Value, (ushort)nudM3H.Value);
                dataopt.majorFacet[4] = new FacetDesc("FacetMap-4", (ushort)nudM4W.Value, (ushort)nudM4H.Value, (ushort)nudM4W.Value, (ushort)nudM4H.Value);
                dataopt.majorFacet[5] = new FacetDesc("FacetMap-5", (ushort)nudM5W.Value, (ushort)nudM5H.Value, (ushort)nudM5W.Value, (ushort)nudM5H.Value);
                var _manager = UODataManager.GetInstance(datauri,

                                                         UODataType.ClassicMondainsLegacy, UOLang.English, dataopt, true);
                UOManager = _manager;
            } catch (Exception ex) {
                UOManager = null;
                MessageBox.Show("While loading data exception was raised.\nCheck path, map sizes and make sure that all data muls are present.");
            }
        }