@@ -56,6 +56,22 @@ public ContentFolder()
5656 Name = "" ;
5757 Path = "" ;
5858 }
59+
60+ public static bool isWrongPath ( string path , GettextResourceManager catalog )
61+ {
62+ if ( path . ToLower ( ) . Contains ( Application . StartupPath . ToLower ( ) ) )
63+ {
64+ // check added because a succesful Update operation will empty the Open Rails folder and lose any content stored within it.
65+ MessageBox . Show ( catalog . GetString
66+ ( $ "Cannot use content from any folder which lies inside the Open Rails program folder { Application . StartupPath } \n \n ")
67+ , "Invalid content location"
68+ , MessageBoxButtons . OK
69+ , MessageBoxIcon . Error ) ;
70+ return true ;
71+ }
72+
73+ return false ;
74+ }
5975 }
6076
6177 public OptionsForm ( UserSettings settings , UpdateManager updateManager , bool initialContentSetup )
@@ -728,7 +744,7 @@ private void textBoxContentName_TextChanged(object sender, EventArgs e)
728744 var current = bindingSourceContent . Current as ContentFolder ;
729745 if ( current != null && current . Name != textBoxContentName . Text )
730746 {
731- if ( isWrongPath ( current . Path , catalog ) )
747+ if ( ContentFolder . isWrongPath ( current . Path , catalog ) )
732748 {
733749 DeleteContent ( ) ;
734750 return ;
@@ -786,22 +802,6 @@ private void checkPerformanceTuner_Click(object sender, EventArgs e)
786802 labelPerformanceTunerTarget . Enabled = checkPerformanceTuner . Checked ;
787803 }
788804
789- public static bool isWrongPath ( string path , GettextResourceManager catalog )
790- {
791- if ( path . ToLower ( ) . Contains ( Application . StartupPath . ToLower ( ) ) )
792- {
793- // check added because a succesful Update operation will empty the Open Rails folder and lose any content stored within it.
794- MessageBox . Show ( catalog . GetString
795- ( $ "Cannot use content from any folder which lies inside the Open Rails program folder { Application . StartupPath } \n \n ")
796- , "Invalid content location"
797- , MessageBoxButtons . OK
798- , MessageBoxIcon . Error ) ;
799- return true ;
800- }
801-
802- return false ;
803- }
804-
805805 #region Help for Options
806806 // The icons all share the same code which assumes they are named according to a simple scheme as follows:
807807 // 1. To add a new Help Icon, copy an existing one and paste it onto the tab.
0 commit comments