如果这个问题不是很清楚,我很抱歉,如果是,请告诉我我需要更新/详细说明,谢谢!
当我更新另一个字符串时,我的字符串似乎不会自行更新。对不起,但这很难用文字解释,尤其是对我来说,我的英语不是很好,所以我很抱歉。这是我目前的代码:
public class Paths
{
/// <summary>
/// The current selected server.
/// </summary>
public static string SelectedServer { get; set; }
/// <summary>
/// The location of the current selected server.
/// </summary>
public static string SelectedServerLocation { get; set; }
/// <summary>
/// The path of the application itself.
/// </summary>
public static string Root { get; set; }
/// <summary>
/// The path of the Microcraft folder.
/// </summary>
public static string MicrocraftFolder { get; set; }
/// <summary>
/// The path of the Server Files folder.
/// </summary>
public static string ServersFolder { get; set; }
/// <summary>
/// The location of the minecraft.jar file.
/// </summary>
public static string MinecraftJar { get; set; }
/// <summary>
/// The location of the bukkit.jar file.
/// </summary>
public static string BukkitJar { get; set; }
/// <summary>
/// The location of the bukkit.yml file.
/// </summary>
public static string BukkitYml { get; set; }
/// <summary>
/// The location of the server.properties file.
/// </summary>
public static string ServerProperties { get; set; }
/// <summary>
/// The location of the root xml file.
/// </summary>
public static string XmlRoot { get; set; }
/// <summary>
/// The location of the server xml file.
/// </summary>
public static string XmlServer { get; set; }
public Paths()
{
if (string.IsNullOrEmpty(SelectedServer))
{
Xml.Setting.path = Environment.CurrentDirectory + "\\microcraft\\settings.xml";
SelectedServer = Xml.Setting.GetSetting("Servers/Current", "T4G Demo");
}
Root = string.Format("{0}\\", Environment.CurrentDirectory);
MicrocraftFolder = string.Format("{0}microcraft\\", Root);
ServersFolder = string.Format("{0}servers\\", MicrocraftFolder);
SelectedServerLocation = string.Format("{0}{1}", ServersFolder, SelectedServer);
MinecraftJar = string.Format("{0}{1}\\minecraft.jar", ServersFolder, SelectedServer);
BukkitJar = string.Format("{0}{1}\\bukkit.jar", ServersFolder, SelectedServer);
BukkitYml = string.Format("{0}{1}\\bukkit.yml", ServersFolder, SelectedServer);
ServerProperties = string.Format("{0}{1}\\server.properties", ServersFolder, SelectedServer);
XmlRoot = string.Format("{0}settings.xml", MicrocraftFolder);
XmlServer = string.Format("{0}{1}\\settings.xml", MicrocraftFolder, SelectedServer);
}
}
这就是我编辑/调用字符串的方式:
Servers.Paths.SelectedServer = SelectedServer;
Xml.Setting.path = Servers.Paths.XmlServer;
但是Servers.Paths.XmlServer
新的不是更新SelectedServer
:(。