コード例 #1
0
        // 修改setting.tjs
        static void ModifySetting(string dataPath, string title, int sw, int sh, int dh, int dw)
        {
            // 更新setting
            string settingFile = Path.Combine(dataPath, WizardConfig.UI_SETTING);

            // 临时创建一个属性对象用于读取setting
            ProjectProperty info = new ProjectProperty();

            info.LoadSetting(settingFile);
            TjsDict setting = info.setting;

            if (setting != null)
            {
                setting.SetString("title", title);
                setting.SetNumber("width", dw);
                setting.SetNumber("height", dh);

                // 修正缩略图宽度
                int tw = info.thumbnailwidth;
                if (tw > 0)
                {
                    tw = tw * dw / sw;
                    setting.SetValue("savedata/thumbnailwidth", new TjsString(tw.ToString()));
                }

                setting.Save(settingFile, Encoding.Unicode);
            }
        }
コード例 #2
0
        // 修改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);
            }
        }