Ejemplo n.º 1
0
        private bool LoadSkills(Settings.V1._ApiKey a_ApiKey, UInt32 a_UserID, Dictionary <UInt32, UInt32> a_Result)
        {
            String      errorHeader = "Failed to load skills";
            XmlDocument xmlReply    = EveApi.MakeRequest("char/CharacterSheet.xml.aspx", a_ApiKey, a_UserID, errorHeader);

            if (null == xmlReply)
            {
                return(false);
            }

            try
            {
                XmlNodeList skillNodes = xmlReply.SelectNodes("/eveapi/result/rowset[@name='skills']/row");
                foreach (XmlNode currNode in skillNodes)
                {
                    UInt32 typeID = UInt32.Parse(currNode.Attributes["typeID"].Value);
                    UInt32 level  = UInt32.Parse(currNode.Attributes["level"].Value);
                    a_Result[typeID] = level;
                }
            }
            catch (System.Exception a_Exception)
            {
                ErrorMessageBox.Show(errorHeader + ":\n" + "Failed to parse EVE API reply:\n" + a_Exception.Message);
                return(false);
            }

            // Safety check for possible XML format change
            if (0 == a_Result.Count)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        private void UpdateSingleUser(string a_KeyID, string a_Verification)
        {
            Settings.V1._ApiKey tempKey = new Settings.V1._ApiKey();
            UInt32.TryParse(a_KeyID, out tempKey.KeyID);
            tempKey.Verification = a_Verification;

            string      errorHeader = "Failed to update user " + a_KeyID;
            XmlDocument xmlReply    = EveApi.MakeRequest("account/Characters.xml.aspx", tempKey, 0, errorHeader);

            if (null == xmlReply)
            {
                return;
            }

            XmlNodeList characterNodes = xmlReply.GetElementsByTagName("row");

            if (0 == characterNodes.Count)
            {
                ErrorMessageBox.Show(errorHeader + "No characters found");
                return;
            }

            DeleteCharactersFromUser(a_KeyID);

            foreach (XmlNode characterNode in characterNodes)
            {
                ListViewItem newItem = LstCharacters.Items.Add(a_KeyID);
                newItem.SubItems.Add(characterNode.Attributes["characterID"].Value);
                newItem.SubItems.Add(characterNode.Attributes["name"].Value);
                newItem.SubItems.Add(characterNode.Attributes["corporationName"].Value);
            }
        }
        //--------------------------------
        #region Patching

        private void OnPatch(object sender = null, RoutedEventArgs e = null)
        {
            MessageBoxResult result;

            if (!ValidPathTest())
            {
                return;
            }
            if (!File.Exists(Patcher.ExePath))
            {
                TriggerMessageBox.Show(this, MessageIcon.Warning, "Could not find Terraria executable!", "Missing Exe");
                return;
            }
            result = TriggerMessageBox.Show(this, MessageIcon.Question, "Are you sure you want to patch the current Terraria executable?", "Patch Terraria", MessageBoxButton.YesNo);
            if (result == MessageBoxResult.No)
            {
                return;
            }
            try {
                Patcher.Patch();
                SaveItemModificationsXml();
                TriggerMessageBox.Show(this, MessageIcon.Info, "Terraria successfully patched!", "Terraria Patched");
            }
            catch (AlreadyPatchedException) {
                TriggerMessageBox.Show(this, MessageIcon.Error, "This executable has already been patched by Item Modifier! Use Restore & Patch instead.", "Already Patched");
            }
            catch (Exception ex) {
                result = TriggerMessageBox.Show(this, MessageIcon.Error, "An error occurred while patching Terraria! Would you like to see the error?", "Patch Error", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    ErrorMessageBox.Show(ex, true);
                }
                return;
            }
        }
Ejemplo n.º 4
0
        private void OnRestore(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result;

            if (!ValidPathTest(false))
            {
                return;
            }
            result = TriggerMessageBox.Show(this, MessageIcon.Question, "Are you sure you want to restore the current Terraria executable to its backup?", "Restore Terraria", MessageBoxButton.YesNo);
            if (result == MessageBoxResult.No)
            {
                return;
            }
            if (!File.Exists(LocalizationPacker.BackupPath))
            {
                TriggerMessageBox.Show(this, MessageIcon.Warning, "Could not find Terraria backup!", "Missing Backup");
                return;
            }
            try {
                LocalizationPacker.Restore();
                TriggerMessageBox.Show(this, MessageIcon.Info, "Terraria successfully restored!", "Terraria Restored");
            }
            catch (Exception ex) {
                result = TriggerMessageBox.Show(this, MessageIcon.Error, "An error occurred while restoring Terraria! Would you like to see the error?", "Restore Error", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    ErrorMessageBox.Show(ex, true);
                }
            }
        }
Ejemplo n.º 5
0
        private void LoadMarketPrices(bool a_Silent, bool a_DeleteOld)
        {
            try
            {
                Settings.V2._PriceSettings settings = m_Engine.m_Settings.PriceLoad.Items;
                IPriceProvider             provider = PriceProviderAuto.GetPriceProvider(settings);

                if (a_DeleteOld)
                {
                    m_MarketPrices.DropPrices(provider);
                }

                m_MarketPrices.LoadPrices(provider, settings, a_Silent);
            }
            catch (System.Exception a_Exception)
            {
                ErrorMessageBox.Show("Failed to load market prices:\n" + a_Exception.Message);
            }

            UpdateLstRefinery();
            UpdateStatus();

            if (0 != m_MarketPrices.GetQueueSize())
            {
                m_RunningListUpdates = ListUpdates.Prices;
            }
        }
Ejemplo n.º 6
0
        private void TlbBtnExport_Click(object sender, EventArgs e)
        {
            SaveFileDialog fileDialog = new SaveFileDialog();

            fileDialog.Title            = "Select location for exported file";
            fileDialog.Filter           = "Comma-separated values (*.csv)|*.csv|Html (*.htm)|*.htm";
            fileDialog.FilterIndex      = 2;
            fileDialog.RestoreDirectory = true;
            if (DialogResult.OK != fileDialog.ShowDialog())
            {
                return;
            }

            try
            {
                Exporter.ExportedData data = GetExportedData();

                switch (fileDialog.FilterIndex)
                {
                case 1:
                    Exporter.ExportAsCsv(fileDialog.FileName, data);
                    break;

                case 2:
                    Exporter.ExportAsHtml(fileDialog.FileName, data);
                    break;
                }
            }
            catch (System.Exception a_Exception)
            {
                ErrorMessageBox.Show("Failed to export data:\n" + a_Exception.Message);
            }
        }
Ejemplo n.º 7
0
        private Boolean TestEveDatabaseTables()
        {
            List <String> tableList;

            try
            {
                tableList = GetDatabaseTables(m_DbConnection);
            }
            catch (System.Exception a_Exception)
            {
                ErrorMessageBox.Show("Database error:\n" + a_Exception.Message);
                return(false);
            }

            String errorMessage = "Your database is missing the following tables:\n";
            bool   hasAllTables = true;

            foreach (String requiredTable in GetUsedTableNames())
            {
                if (!tableList.Contains(requiredTable))
                {
                    hasAllTables  = false;
                    errorMessage += (requiredTable + "\n");
                }
            }

            if (!hasAllTables)
            {
                ErrorMessageBox.Show(errorMessage);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 8
0
        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            var log = LoggerFactory.CreateLogger();

            log.Error("应用程序错误", e.Exception);
            ErrorMessageBox.Show("应用程序错误", e.Exception);
        }
        private void OnUpdateContent(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result;

            if (!ValidPathTest())
            {
                return;
            }
            result = TriggerMessageBox.Show(this, MessageIcon.Question, "Are you sure you want to update the rupee content files?", "Update Rupees", MessageBoxButton.YesNo);
            if (result == MessageBoxResult.No)
            {
                return;
            }
            try {
                ContentReplacer.Replace();
                ContentReplacer.SaveXmlConfiguration();
                TriggerMessageBox.Show(this, MessageIcon.Info, "Rupee content files successfully updated!", "Rupees Updated");
            }
            catch (Exception ex) {
                result = TriggerMessageBox.Show(this, MessageIcon.Error, "An error occurred while updating rupee content files! Would you like to see the error?", "Patch Error", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    ErrorMessageBox.Show(ex, true);
                }
                return;
            }
        }
Ejemplo n.º 10
0
        private void OnUnpack(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBoxResult.No;

            if (!ValidPathTest() || !ValidPathTest2(false))
            {
                return;
            }
            result = TriggerMessageBox.Show(this, MessageIcon.Question, "Are you sure you want to unpack localizations from the current Terraria executable?", "Unpack Localizations", MessageBoxButton.YesNo);
            if (result == MessageBoxResult.No)
            {
                return;
            }
            try {
                LocalizationPacker.Unpack();
                result = TriggerMessageBox.Show(this, MessageIcon.Info, "Localizations successfully unpacked! Would you like to open the output folder?", "Localizations Unpacked", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    Process.Start(LocalizationPacker.OutputDirectory);
                }
            }
            catch (Exception ex) {
                result = TriggerMessageBox.Show(this, MessageIcon.Error, "An error occurred while unpacking localizations! Would you like to see the error?", "Unpack Error", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    ErrorMessageBox.Show(ex, true);
                }
                return;
            }
        }
        private void OnAddMidi(object sender, RoutedEventArgs e)
        {
            Stop();
            loaded = false;

            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter      = "Midi Files|*.mid;*.midi|All Files|*.*";
            dialog.FilterIndex = 0;
            var result = dialog.ShowDialog(this);

            if (result.HasValue && result.Value)
            {
                Midi midi = new Midi();
                if (midi.Load(dialog.FileName))
                {
                    Config.Midis.Add(midi);
                    Config.MidiIndex = Config.MidiCount - 1;
                    listMidis.Items.Add(midi.ProperName);
                    listMidis.SelectedIndex = Config.MidiIndex;
                    listMidis.ScrollIntoView(listMidis.Items[Config.MidiIndex]);
                    UpdateMidi();
                }
                else
                {
                    var result2 = TriggerMessageBox.Show(this, MessageIcon.Error, "Error when loading the selected midi! Would you like to see the error?", "Load Error", MessageBoxButton.YesNo);
                    if (result2 == MessageBoxResult.Yes)
                    {
                        ErrorMessageBox.Show(midi.LoadException, true);
                    }
                }
            }

            loaded = true;
        }
Ejemplo n.º 12
0
 /// <summary>
 ///  Called to avoid referencing assemblies before the assembly resolver can be added.
 /// </summary>
 private void Initialize()
 {
     ErrorMessageBox.ProgramName   = "WinDirStat.Net";
     ErrorMessageBox.HyperlinkName = "GitHub Page";
     ErrorMessageBox.HyperlinkUri  = new Uri(@"https://github.com/trigger-death/WinDirStat.Net");
     ErrorMessageBox.ErrorIcon     = new BitmapImage(new Uri("pack://application:,,,/Resources/App.ico"));
     ErrorMessageBox.GlobalHook(this);
 }
Ejemplo n.º 13
0
 /// <summary>
 ///  Called to avoid referencing assemblies before the assembly resolver can be added.
 /// </summary>
 private void Initialize()
 {
     ErrorMessageBox.ProgramName   = "Grisaia Extract Sprite Viewer";
     ErrorMessageBox.HyperlinkName = "GitHub Page";
     ErrorMessageBox.HyperlinkUri  = new Uri(@"https://github.com/trigger-death/GrisaiaSpriteViewer");
     ErrorMessageBox.ErrorIcon     = new BitmapImage(new Uri("pack://application:,,,/Resources/AppError.ico"));
     ErrorMessageBox.GlobalHook(this);
 }
Ejemplo n.º 14
0
		private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) {
			if (e.Exception != lastException) {
				lastException = e.Exception;
				if (ErrorMessageBox.Show(e.Exception))
					Environment.Exit(0);
				e.Handled = true;
			}
		}
        private void OnRestoreAndPatch(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result;

            if (!ValidPathTest())
            {
                return;
            }
            if (!File.Exists(Patcher.BackupPath))
            {
                TriggerMessageBox.Show(this, MessageIcon.Error, "Could not find Terraria backup!", "Missing Backup");
                return;
            }
            result = TriggerMessageBox.Show(this, MessageIcon.Question, "Are you sure you want to restore Terraria from its backup and then patch it?", "Patch & Restore Terraria", MessageBoxButton.YesNo);
            if (result == MessageBoxResult.No)
            {
                return;
            }
            if (File.Exists(Patcher.ExePath) && IL.GetAssemblyVersion(Patcher.BackupPath) < IL.GetAssemblyVersion(Patcher.ExePath))
            {
                result = TriggerMessageBox.Show(this, MessageIcon.Warning, "The backed up Terraria executable is an older game version. Are you sure you want to restore it?", "Older Version", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.No)
                {
                    return;
                }
            }
            if (!CheckSupportedVersion(Patcher.BackupPath))
            {
                return;
            }
            try {
                Patcher.Restore(false);
            }
            catch (Exception ex) {
                result = TriggerMessageBox.Show(this, MessageIcon.Error, "An error occurred while restoring Terraria! Would you like to see the error?", "Restore Error", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    ErrorMessageBox.Show(ex, true);
                }
                return;
            }
            try {
                Patcher.Patch();
                ContentReplacer.Replace();
                ContentReplacer.SaveXmlConfiguration();
                TriggerMessageBox.Show(this, MessageIcon.Info, "Terraria successfully restored and patched!", "Terraria Repatched");
            }
            catch (AlreadyPatchedException) {
                TriggerMessageBox.Show(this, MessageIcon.Error, "The backup executable has already been patched by Rupee Replacer!", "Already Patched");
            }
            catch (Exception ex) {
                result = TriggerMessageBox.Show(this, MessageIcon.Error, "An error occurred while patching Terraria! Would you like to see the error?", "Patch Error", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    ErrorMessageBox.Show(ex, true);
                }
            }
        }
Ejemplo n.º 16
0
		private void OnAppDomainUnhandledException(object sender, UnhandledExceptionEventArgs e) {
			if (e.ExceptionObject != lastException) {
				lastException = e.ExceptionObject;
				Dispatcher.Invoke(() => {
					if (ErrorMessageBox.Show(e.ExceptionObject))
						Environment.Exit(0);
				});
			}
		}
Ejemplo n.º 17
0
        private void OnHostError(Server server, Exception ex)
        {
            var result = TriggerMessageBox.Show(this, MessageIcon.Error, "A host error occurred. Would you like to see the error?", "Host Error", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                ErrorMessageBox.Show(ex);
            }
        }
Ejemplo n.º 18
0
		private void OnTaskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) {
			if (e.Exception != lastException) {
				lastException = e.Exception;
				Dispatcher.Invoke(() => {
					if (ErrorMessageBox.Show(e.Exception))
						Environment.Exit(0);
				});
			}
		}
        protected bool save_to_mets(SobekCM_Item bibPackage, string destination_folder)
        {
            bibPackage.METS_Header.RecordStatus_Enum = METS_Record_Status.COMPLETE;

            // Saves the data members in the SobekCM.Resource_Object to a METS file
            try
            {
                // Set some values
                bibPackage.METS_Header.Creator_Organization = bibPackage.Bib_Info.Source.Code + "," + bibPackage.Bib_Info.Source.Statement;
                if (MetaTemplate_UserSettings.AddOns_Enabled.Contains("FCLA"))
                {
                    PALMM_Info palmmInfo = bibPackage.Get_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY) as PALMM_Info;
                    if (palmmInfo == null)
                    {
                        palmmInfo = new PALMM_Info();
                        bibPackage.Add_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY, palmmInfo);
                    }

                    if ((palmmInfo.toPALMM) && (palmmInfo.PALMM_Project.Length > 0))
                    {
                        string creator_org_to_remove = String.Empty;
                        foreach (string thisString in bibPackage.METS_Header.Creator_Org_Notes)
                        {
                            if (thisString.IndexOf("projects=") >= 0)
                            {
                                creator_org_to_remove = thisString;
                                break;
                            }
                        }
                        if (creator_org_to_remove.Length > 0)
                        {
                            bibPackage.METS_Header.Replace_Creator_Org_Notes(creator_org_to_remove, "projects=" + palmmInfo.PALMM_Project);
                        }
                        else
                        {
                            bibPackage.METS_Header.Add_Creator_Org_Notes("projects=" + palmmInfo.PALMM_Project);
                        }
                    }
                }


                // Determine the filename
                string mets_file = destination_folder + "\\" + bibPackage.BibID + "_" + bibPackage.VID + MetaTemplate_UserSettings.METS_File_Extension;

                // Save the actual file
                METS_File_ReaderWriter metsWriter = new METS_File_ReaderWriter();
                string writing_error = String.Empty;
                metsWriter.Write_Metadata(mets_file, bibPackage, null, out writing_error);

                return(true);
            }
            catch (Exception e)
            {
                ErrorMessageBox.Show("Error encountered while creating METS file!\n\n" + e.Message, "METS Editor Batch Import Error", e);
                return(false);
            }
        }
Ejemplo n.º 20
0
        void InkCanvas_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                Point curCursorPosition = e.GetPosition(_currentInkCanvas);

                if (e.RightButton == MouseButtonState.Pressed)
                {
                    //"Select" some near point on the canvas

                    UpdateStrokeAndSetToNull();
                    if (_curEditorMode == EditorMode.Polygon)
                    {
                        foreach (InkCanvas inkCanvas in _canvasList.Children)
                        {
                            foreach (Stroke stroke in inkCanvas.Strokes)
                            {
                                for (int pointIndex = 0; pointIndex < stroke.StylusPoints.Count; pointIndex++)
                                {
                                    StylusPoint stylusPoint       = stroke.StylusPoints[pointIndex];
                                    double      distanceOf2Points = ((Vector)(FromStylusPointToPoint(stylusPoint) - curCursorPosition)).Length;
                                    if (distanceOf2Points < _maxEndPointDistance * 2)
                                    {
                                        SelectPoint(pointIndex);
                                        _Stroke        = stroke;
                                        _curEditorMode = EditorMode.MovingPoint;
                                    }
                                }
                            }
                        }
                    }
                }
                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    if (_curEditorMode == EditorMode.Polygon)
                    {
                        curCursorPosition = GetCorrectCursorPosition(curCursorPosition);
                        AddNewPointToStroke(curCursorPosition);
                    }
                    else if (_curEditorMode == EditorMode.MovingPoint)
                    {
                        _curEditorMode    = EditorMode.Polygon;
                        curCursorPosition = e.GetPosition(_currentInkCanvas);
                        if (_Stroke != null)
                        {
                            //move selected point to the new location
                            _Stroke.StylusPoints[_curPointIndex] = new StylusPoint(curCursorPosition.X, curCursorPosition.Y);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageBox.Show(ex);
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// show error message box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static Task ShowError(Window sender, string message)
        {
            var errorMessageBox = new ErrorMessageBox(null, message)
            {
                Width  = MESSAGE_BOX_WIDTH,
                Height = MESSAGE_BOX_HEIGHT
            };

            return(errorMessageBox.ShowDialog(sender));
        }
Ejemplo n.º 22
0
        protected void DynamicCardCommonContainer_CardSaving(object sender, EventArgs e)
        {
            var dynamicCardControl = sender as DynamicCardControl;

            if (dynamicCardControl.CurrentMode != Mode.ReadOnly)
            {
                var deletingObjects = new Dictionary <string, Int32>();

                foreach (Card card in dynamicCardControl.Cards.Values)
                {
                    var xml = XmlCardSerializer.Serialize(card, dynamicCardControl.CurrentMode, dynamicCardControl.LastInsertedInstanceID);

                    var query = string.Format("DECLARE @instanceID objID EXEC [model].[BObjectSave] @xml = '{0}', @instanceID = @instanceID OUTPUT SELECT @instanceID as '@instanceID'", xml);

#if trueWWW
                    var table = Storage.GetDataTable(query);
                    if (table.Rows[0][0] != DBNull.Value)
                    {
                        dynamicCardControl.LastInsertedInstanceID = Convert.ToInt32(table.Rows[0][0]);
                    }
#else
                    try
                    {
                        var table = Storage.GetDataTable(query);
                        if (table.Rows[0][0] != DBNull.Value)
                        {
                            dynamicCardControl.LastInsertedInstanceID = Convert.ToInt32(table.Rows[0][0]);
                        }
                    }
                    catch (Exception ex)
                    {
                        Reset(dynamicCardControl);
                        ErrorMessageBox.Show();
                        (ErrorMessageBox.FindControl("ErrorLabel") as Label).Text = ex.Message;
                        //CreateErroreDialog.Show();
                    }
#endif
                }

                Storage.ClearBusinessContents();

                Storage.BusinessContentIsChanged = true;

                if (dynamicCardControl.CurrentMode == Mode.Edit)
                {
                    Reset(dynamicCardControl);
                }
                else if (dynamicCardControl.CurrentMode == Mode.Create && dynamicCardControl.LastInsertedInstanceID != -1)
                {
                    dynamicCardControl.ChangeMode(Mode.ReadOnly);
                    Reset(dynamicCardControl);
                    reloadCard(dynamicCardControl.LastInsertedInstanceID);
                }
            }
        }
Ejemplo n.º 23
0
 private void buttonScaleSubtract_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         LevelEditorManager.Instance.Scale(false);
     }
     catch (Exception ex)
     {
         ErrorMessageBox.Show(ex);
     }
 }
Ejemplo n.º 24
0
 private void buttonOpen_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         LevelEditorManager.Instance.Open();
     }
     catch (Exception ex)
     {
         ErrorMessageBox.Show(ex);
     }
 }
Ejemplo n.º 25
0
 public void SaveSettings()
 {
     try
     {
         SettingsStorage.Save(m_Settings);
     }
     catch (System.Exception a_Exception)
     {
         ErrorMessageBox.Show("Failed to save settings:\n" + a_Exception.Message);
     }
 }
        private void OnRestore(object sender = null, RoutedEventArgs e = null)
        {
            MessageBoxResult result;
            bool             cleanup = false;

            if (!ValidPathTest())
            {
                return;
            }
            if (!File.Exists(Patcher.BackupPath))
            {
                TriggerMessageBox.Show(this, MessageIcon.Warning, "Could not find Terraria backup!", "Missing Backup");
                return;
            }
            result = TriggerMessageBox.Show(this, MessageIcon.Question, "Would you like to restore the current Terraria executable to its backup and cleanup the required files or just restore the backup?", "Restore Terraria", MessageBoxButton.YesNoCancel, "Cleanup & Restore", "Restore Only");
            if (result == MessageBoxResult.Cancel)
            {
                return;
            }
            cleanup = result == MessageBoxResult.Yes;
            if (File.Exists(Patcher.ExePath) && IL.GetAssemblyVersion(Patcher.BackupPath) < IL.GetAssemblyVersion(Patcher.ExePath))
            {
                result = TriggerMessageBox.Show(this, MessageIcon.Warning, "The backed up Terraria executable is an older game version. Are you sure you want to restore it?", "Older Version", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.No)
                {
                    return;
                }
            }
            try {
                Patcher.Restore(cleanup);
                // Clean up directory and remove config file
                if (cleanup)
                {
                    string configPath = Path.Combine(Patcher.ExeDirectory, ItemModifier.ConfigName);
                    string logPath    = Path.Combine(Patcher.ExeDirectory, ErrorLogger.LogName);
                    if (File.Exists(configPath))
                    {
                        File.Delete(configPath);
                    }
                    if (File.Exists(logPath))
                    {
                        File.Delete(logPath);
                    }
                }
                TriggerMessageBox.Show(this, MessageIcon.Info, "Terraria successfully restored!", "Terraria Restored");
            }
            catch (Exception ex) {
                result = TriggerMessageBox.Show(this, MessageIcon.Error, "An error occurred while restoring Terraria! Would you like to see the error?", "Restore Error", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    ErrorMessageBox.Show(ex, true);
                }
            }
        }
Ejemplo n.º 27
0
 private void buttonLayer3_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         LevelEditorManager.Instance.SelectCanvas(3);
     }
     catch (Exception ex)
     {
         ErrorMessageBox.Show(ex);
     }
 }
Ejemplo n.º 28
0
 private void buttonRemoveLast_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         LevelEditorManager.Instance.RemoveLastStroke();
     }
     catch (Exception ex)
     {
         ErrorMessageBox.Show(ex);
     }
 }
Ejemplo n.º 29
0
 public List <Table> GetSchema(List <Table> tables, TableSchemaProcessHandler processHandler)
 {
     try
     {
         return(InternalGetSchemas(tables, processHandler));
     }
     catch (Exception exp)
     {
         ErrorMessageBox.Show("获取数据架构时出错。", exp);
         return(null);
     }
 }
Ejemplo n.º 30
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     try
     {
         SaveSettings();
     }
     catch (Exception ex)
     {
         ErrorMessageBox.Show(ex);
         throw;
     }
 }