Beispiel #1
0
        public async Task <AssetBundle> LoadAssetBundle(string assetPath)
        {
            assetInfo.AssetPath = assetPath;
            string path = string.Format($"{ResUtility.GetAssetBundlesPath()}/{assetInfo.AssetPath}");

            return(await AssetBundle.LoadFromFileAsync(path));
        }
    protected void rptAttSubitems_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Att.FileData fileData = (Att.FileData)e.Item.DataItem;

        HtmlAnchor btnDownload = (HtmlAnchor)e.Item.FindControl("btnDownload");

        btnDownload.HRef  = string.Format("~/FileAtt.ashx?attid={0}&l={1}", fileData.AttId, c.qsLangNo);
        btnDownload.Title = fileData.FileName;

        HtmlImage imgExt = (HtmlImage)e.Item.FindControl("imgExt");

        imgExt.Src = "images/FileExtIcon/" + ResUtility.GetExtIconFileName(fileData.FileName);
        imgExt.Alt = ResUtility.GetExtIconText(fileData.FileName);

        Literal ltrDownload = (Literal)e.Item.FindControl("ltrDownload");

        ltrDownload.Text = string.Format("{0} ({1})", Resources.Lang.Att_lblDownload, fileData.FileExt.ToLower().Replace(".", ""));

        Literal ltrFileSize = (Literal)e.Item.FindControl("ltrFileSize");

        ltrFileSize.Text = fileData.FileSizeDesc;

        Literal ltrReadCount = (Literal)e.Item.FindControl("ltrReadCount");

        ltrReadCount.Text = fileData.ReadCount.ToString();

        Literal ltrMdfDate = (Literal)e.Item.FindControl("ltrMdfDate");

        ltrMdfDate.Text = fileData.MdfDate.ToString("yyyy-MM-dd HH:mm:ss");
    }
Beispiel #3
0
    protected IEnumerator LoadWWW()
    {
        string url = ResUtility.GetResAbsolutePath() + m_path;

        m_req = new WWW(url);
        yield return(m_req);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!artPicMgr.Initialize(c.qsPicId, c.qsArtId))
        {
            string errMsg = ResUtility.GetErrMsgOfAttFileErrState(artPicMgr.GetErrState());
            Master.ShowErrorMsg(errMsg);
            return;
        }

        if (!IsPostBack)
        {
            // Authenticate
            if (!empAuth.CanEditThisPage())
            {
                string jsClose = "closeThisForm();";
                ClientScript.RegisterStartupScript(this.GetType(), "invalid", jsClose, true);
                return;
            }

            LoadUIData();
            DisplayArticlePictureData();
            txtSortNo.Focus();
        }

        LoadTitle();
    }
Beispiel #5
0
        /// <summary>
        /// デバイスを列挙します。
        /// </summary>
        public void EnumDevice()
        {
            this.Devices.Clear();
            foreach (var device in PortableDevice.EnumDevice(this._client))
            {
                this.Devices.Add(new PortableDeviceViewModel(device));
            }

            this.RaisePropertyChanged("Devices");

            if (this.Devices.Count == 0)
            {
                MessageBox.Show(ResUtility.GetString("Strings.Message.DeviceNotFound"), ResUtility.GetString("Strings.Common.Info"), MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Beispiel #6
0
    public void GetRes(string name, EResType type, ResCallBack callback, object param)
    {
        string path = ResUtility.GetResRelativePath(type) + name;

        if (m_resPool.ContainsKey(path))
        {
            callback(m_resPool[path], param);
        }
        else
        {
            IResLoader loader = GetLoader(path, type);
            loader.AddCallBack(callback, param);

            m_activeLoader[path] = loader;

            loader.StartLoad();
        }
    }
Beispiel #7
0
 /// <summary>
 /// インスタンスを初期化します。
 /// </summary>
 public void Initialize()
 {
     this._client = new WpdClient(ResUtility.GetString("Strings.Common.AppName"), 1, 0);
     this.Devices = new ObservableCollection <PortableDeviceViewModel>();
 }
        /// <summary>
        /// 初始化本地文件信息
        /// </summary>
        public bool InitLoaclFilesInfo(bool isText, string filesInfos = null)
        {
            localFileInfosDic.Clear();
            if (!Directory.Exists(RuntimeResPath.GetLocalDataPath))
            {
                Directory.CreateDirectory(RuntimeResPath.GetLocalDataPath);
            }

            string fileTextPath = string.Empty;

            if (!isText)
            {
                if (filesInfos == null)
                {
                    fileTextPath = RuntimeResPath.GetLocalDataPath + "files.txt";
                }
                else
                {
                    fileTextPath = filesInfos;
                }
            }


            if (isText || File.Exists(fileTextPath))
            {
                string filesText = string.Empty;
                if (isText)
                {
                    filesText = filesInfos;
                }
                else
                {
                    filesText = ResUtility.ReadFile(fileTextPath);
                }
                string[] filesInfo = filesText.Split('\n');

                if (filesInfo.Length <= 0)
                {
                    MyDebug.LogErrorFormat(" files.txt 文件为空.请注意!:{0}", fileTextPath);
                    return(false);
                }
                else
                {
                    for (int i = 0; i < filesInfo.Length; i++)
                    {
                        if (string.IsNullOrEmpty(filesInfo[i]))
                        {
                            continue;
                        }
                        string[] infos   = filesInfo[i].Split('|');
                        string   file    = infos[0];
                        string   filemd5 = infos[1];
                        if (!localFileInfosDic.ContainsKey(file))
                        {
                            localFileInfosDic.Add(file, filemd5);
                        }
                        else
                        {
                            MyDebug.LogErrorFormat("文件重复!!!!!请检查  file:{0}", file);
                        }

                        string localFile = (RuntimeResPath.GetLocalDataPath + file).Trim();
                        string dir       = Path.GetDirectoryName(localFile);
                        if (!Directory.Exists(dir))
                        {
                            Directory.CreateDirectory(dir);
                        }
                    }
                    isInitLocalFile = true;
                    return(true);
                }
            }
            else
            {
                MyDebug.LogErrorFormat(" files.txt 文件不存在.请检查!:{0}", fileTextPath);
                return(false);
            }
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Master.ShowErrorMsg("");

        if (!IsValid)
        {
            return;
        }

        if (c.qsAct == ConfigFormAction.add && !fuPickedFile.HasFile)
        {
            return;
        }

        try
        {
            bool result = false;
            txtPicSubjectZhTw.Text = txtPicSubjectZhTw.Text.Trim();
            txtPicSubjectEn.Text   = txtPicSubjectEn.Text.Trim();

            artPicMgr.SortNo           = Convert.ToInt32(txtSortNo.Text);
            artPicMgr.AttSubjectZhTw   = txtPicSubjectZhTw.Text;
            artPicMgr.AttSubjectEn     = txtPicSubjectEn.Text;
            artPicMgr.IsShowInLangZhTw = chkIsShowInLangZhTw.Checked;
            artPicMgr.IsShowInLangEn   = chkIsShowInLangEn.Checked;

            result = artPicMgr.SaveData(fuPickedFile, c.GetEmpAccount());

            if (result)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", StringUtility.GetNoticeOpenerJs("Picture"), true);
            }
            else
            {
                string errMsg = ResUtility.GetErrMsgOfAttFileErrState(artPicMgr.GetErrState());

                if (errMsg == "")
                {
                    errMsg = Resources.Lang.ErrMsg_SaveFailed;
                }

                Master.ShowErrorMsg(errMsg);
            }

            //新增後端操作記錄
            string description = string.Format(".{0} .儲存網頁照片/Save article picture[{1}][{2}]" +
                                               " 有檔案/has file[{3}] PicId[{4}] 結果/result[{5}]",
                                               Title, txtPicSubjectZhTw.Text, txtPicSubjectEn.Text,
                                               fuPickedFile.HasFile, artPicMgr.AttId, result);

            empAuth.InsertBackEndLogData(new BackEndLogData()
            {
                EmpAccount  = c.GetEmpAccount(),
                Description = description,
                IP          = c.GetClientIP()
            });
        }
        catch (Exception ex)
        {
            c.LoggerOfUI.Error("", ex);
            Master.ShowErrorMsg(ex.Message);
        }
    }