using SampleFramework;\r
using System.Runtime.Serialization;\r
using System.Xml;\r
+using System.Web;\r
\r
namespace DTXMania\r
{\r
\r
public void SaveConfig()\r
{\r
- CDTXMania.SerializeXML(strEXEのあるフォルダ + "Config.xml", ConfigIni);\r
+\r
+ #region [ Skinパスの絶対パス→相対パス変換 ]\r
+ string _strSystemSkinSubfolderPath = ConfigIni.strSystemSkinSubfolderPath.Value;\r
+ Uri uriRoot = new Uri( System.IO.Path.Combine( this.strEXEのあるフォルダ, "System" + System.IO.Path.DirectorySeparatorChar ) );\r
+ if ( ConfigIni.strSystemSkinSubfolderPath.Value != null && ConfigIni.strSystemSkinSubfolderPath.Value.Length == 0 )\r
+ {\r
+ // Config.iniが空の状態でDTXManiaをViewerとして起動・終了すると、strSystemSkinSubfolderFullName が空の状態でここに来る。\r
+ // → 初期値として Default/ を設定する。\r
+ ConfigIni.strSystemSkinSubfolderPath.Value = System.IO.Path.Combine( this.strEXEのあるフォルダ, "System" + System.IO.Path.DirectorySeparatorChar + "Default" + System.IO.Path.DirectorySeparatorChar );\r
+ }\r
+\r
+ // 起動直後は(Loadの前にSaveを通るため)Skinパスには初期値の相対パスが入っている場合がある。\r
+ // そのため、以下の処理を通すために、いったん絶対パスに変換\r
+ if ( !System.IO.Path.IsPathRooted( ConfigIni.strSystemSkinSubfolderPath.Value ) )\r
+ {\r
+ ConfigIni.strSystemSkinSubfolderPath.Value =\r
+ Path.Combine( Path.Combine( this.strEXEのあるフォルダ, "System" ), ConfigIni.strSystemSkinSubfolderPath );\r
+ }\r
+\r
+ Uri uriPath = new Uri( System.IO.Path.Combine( ConfigIni.strSystemSkinSubfolderPath.Value, "." + System.IO.Path.DirectorySeparatorChar ) );\r
+ string relPath = uriRoot.MakeRelativeUri( uriPath ).ToString(); // 相対パスを取得\r
+ relPath = System.Web.HttpUtility.UrlDecode( relPath ); // デコードする\r
+ relPath = relPath.Replace( '/', System.IO.Path.DirectorySeparatorChar ); // 区切り文字が\ではなく/なので置換する\r
+ ConfigIni.strSystemSkinSubfolderPath.Value = relPath;\r
+ #endregion\r
+ CDTXMania.SerializeXML( strEXEのあるフォルダ + "Config.xml", ConfigIni );\r
+\r
+ // 元の絶対パスに戻す\r
+ ConfigIni.strSystemSkinSubfolderPath.Value = _strSystemSkinSubfolderPath;\r
}\r
\r
public void LoadConfig()\r
ConfigIni = new CConfigXml();\r
SaveConfig();\r
}\r
+ // Skinパスの相対パスを、絶対パスに変換\r
+ if ( !System.IO.Path.IsPathRooted( ConfigIni.strSystemSkinSubfolderPath.Value ) )\r
+ {\r
+ ConfigIni.strSystemSkinSubfolderPath.Value =\r
+ Path.Combine( Path.Combine( this.strEXEのあるフォルダ, "System" ), ConfigIni.strSystemSkinSubfolderPath );\r
+ }\r
}\r
}\r
\r