コード例 #1
0
        /// <summary>
        /// 获取互动课件配置首页html
        /// </summary>
        /// <param name="s"></param>
        public void wareEntry_n(string s)
        {
            clr_pageInit nam  = DecodeJson <clr_pageInit>(s);
            string       Func = nam.cbId;
            string       json = "";

            try
            {
                string        warep1     = @"Page\data\" + nam.UserID + "\\" + nam.BookID + "\\resource\\page" + nam.PageID.PadLeft(3, '0');
                DirectoryInfo TheFolder1 = new DirectoryInfo(warep1);
                FileInfo      file       = TheFolder1.GetFiles(nam.FileID + "*", SearchOption.TopDirectoryOnly).FirstOrDefault();
                if (!file.FullName.Contains(".zip"))
                {
                    wareEntry wareEntry = new wareEntry {
                        Url = file.FullName, Json = json
                    };
                    string wareEntry1 = EnSerialize <wareEntry>(wareEntry);
                    //string re = EnSerialize<LocalFunMsg>(GetLocalFunMsg(wareEntry));
                    LocalFunMsg re  = GetLocalFunMsg(wareEntry1);
                    string      res = EnSerialize <LocalFunMsg>(re);
                    JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + Func + "'," + res + ");");
                }
                else
                {
                    string          warep          = @"Page\data\" + nam.UserID + "\\" + nam.BookID + "\\resource\\page" + nam.PageID.PadLeft(3, '0') + "\\" + nam.FileID;
                    string          folderFullName = warep;
                    DirectoryInfo   TheFolder      = new DirectoryInfo(folderFullName);
                    DirectoryInfo[] directory      = TheFolder.GetDirectories();
                    folderFullName = AppDomain.CurrentDomain.BaseDirectory + warep + "\\" + directory[0].Name + "\\" + directory[0].Name + ".html";
                    string configJson = directory[0].FullName + "\\config.json";
                    if (File.Exists(configJson))
                    {
                        json = GetConfigStr(configJson);
                    }
                    wareEntry wareEntry = new wareEntry {
                        Url = folderFullName, Json = json
                    };
                    string wareEntry1 = EnSerialize <wareEntry>(wareEntry);
                    //string re = EnSerialize<LocalFunMsg>(GetLocalFunMsg(wareEntry));
                    LocalFunMsg re  = GetLocalFunMsg(wareEntry1);
                    string      res = EnSerialize <LocalFunMsg>(re);
                    JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + Func + "'," + res + ");");
                }
            }
            catch (Exception ex)
            {
                LocalFunMsg fas = GetLocalFunMsg("", 1, false, ex.Message);
                JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + Func + "'," + fas + ");");
            }
        }
コード例 #2
0
        public static void SendMsg(string s)
        {
            Message nam = JsEvent.DecodeJson <Message>(s);

            try
            {
                string re = EnSerialize <LocalFunMsg>(GetLocalFunMsg(nam.data));
                JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + nam.cbId + "'," + re + ");");
            }
            catch (Exception ex)
            {
                LocalFunMsg fas = GetLocalFunMsg("", 1, false, ex.Message);
                JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + nam.cbId + "'," + fas + ");");
            }
        }
コード例 #3
0
        public void getTeachPage_n(string s)
        {
            clr_pageInit nam  = DecodeJson <clr_pageInit>(s);
            string       Func = nam.cbId;

            try
            {
                string folderFullName = AppDomain.CurrentDomain.BaseDirectory + @"Page\data\" + nam.UserID + "\\" + nam.UserID + nam.BookID + nam.ClassID + ".json";
                string json           = null;
                if (File.Exists(folderFullName))
                {
                    json = GetConfigStr(folderFullName);
                }
                LocalFunMsg re  = GetLocalFunMsg(json);
                string      res = EnSerialize <LocalFunMsg>(re);
                JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + Func + "'," + res + ");");
            }
            catch (Exception ex)
            {
                LocalFunMsg fas = GetLocalFunMsg("", 1, false, ex.Message);
                JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + Func + "'," + fas + ");");
            }
        }
コード例 #4
0
        /// <summary>
        /// 获取电子书dbjs
        /// </summary>
        /// <param name="s"></param>
        public void getDbJsById_n(string s)
        {
            clr_pageInit nam = DecodeJson <clr_pageInit>(s);

            try
            {
                string          bookFullName   = AppDomain.CurrentDomain.BaseDirectory + @"Page\data\" + nam.UserID + "\\" + nam.BookID;
                DirectoryInfo   TheFolder      = new DirectoryInfo(bookFullName);
                DirectoryInfo[] directory      = TheFolder.GetDirectories();
                string          folderFullName = null;
                for (int i = 0; i < directory.Length; i++)
                {
                    if (File.Exists(bookFullName + "\\" + directory[i] + "\\db.js"))
                    {
                        folderFullName = bookFullName + "\\" + directory[i] + "\\db.js";
                        break;
                    }
                }
                string json = "";
                if (File.Exists(folderFullName))
                {
                    json = GetConfigStr(folderFullName);
                    json = Regex.Split(json, "var dbJson='")[1];
                    json = Regex.Split(json, "';")[0];
                }
                //string re = EnSerialize<LocalFunMsg>(GetLocalFunMsg(json));
                LocalFunMsg re  = GetLocalFunMsg(json);
                string      res = EnSerialize <LocalFunMsg>(re);
                JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + nam.cbId + "'," + res + ");");
            }
            catch (Exception ex)
            {
                LocalFunMsg fas = GetLocalFunMsg("", 1, false, ex.Message);
                JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + nam.cbId + "'," + fas + ");");
            }
        }