// 修改UI布局文件 static void ModifyLayout(string dataPath, int sw, int sh, int dh, int dw) { // 更新layout string[] layouts = Directory.GetFiles(dataPath, WizardConfig.UI_LAYOUT); foreach (string layout in layouts) { TjsDict setting = TjsValue.Load(layout) as TjsDict; if (setting != null) { ModifyDict(setting, sw, sh, dw, dh); // 对这个文件里的按钮作特殊处理 if (layout.ToLower().EndsWith("uislpos.tjs")) { double scaleX = (double)dw / sw; double scaleY = (double)dh / sh; TjsHelper.ScaleButton(setting, "back", scaleX, scaleY); TjsHelper.ScaleButton(setting, "up", scaleX, scaleY); TjsHelper.ScaleButton(setting, "down", scaleX, scaleY); } } setting.Save(layout, Encoding.Unicode); } }
public void LoadSetting(string file) { setting = null; if (File.Exists(file)) { setting = TjsValue.Load(file) as TjsDict; } }