Пример #1
0
        public void wirteGridData()
        {
            //加入日志
            string           d        = DateTime.Now.ToString("yyyy-MM-dd");
            string           dataPath = FileKit.dataPath + "\\" + d + ".json";
            List <DataModel> list     = new List <DataModel>();

            foreach (DataGridViewRow m in dataGridView.Rows)
            {
                string sort        = Convert.ToString(m.Cells["sort"].Value);
                string phone       = Convert.ToString(m.Cells["phone"].Value);
                string starttime   = Convert.ToString(m.Cells["starttime"].Value);
                string inpath      = Convert.ToString(m.Cells["inpath"].Value);
                string outpath     = Convert.ToString(m.Cells["outpath"].Value);
                string transStatus = Convert.ToString(m.Cells["transStatus"].Value);
                string ftpStatus   = Convert.ToString(m.Cells["ftpStatus"].Value);

                DataModel model = new DataModel();
                model.phone       = phone;
                model.starttime   = starttime;
                model.sort        = Convert.ToInt32(sort);
                model.inpath      = inpath;
                model.outpath     = outpath;
                model.transStatus = transStatus;
                model.ftpStatus   = ftpStatus;

                list.Add(model);
            }

            FileKit.createFile(JsonConvert.SerializeObject(list), dataPath);
        }
Пример #2
0
        private void renameFileResult(object[] result)
        {
            ExplorerFileInfo file = (ExplorerFileInfo)this.listViewExplorer.SelectedItems[0].Tag;

            file.FileName     = currentEditAfterLabel;
            file.FileFullPath = Path.Combine(FileKit.GetUpFolder(file.FileFullPath), file.FileName);
        }
Пример #3
0
        private void listView_DoubleClick(object sender, EventArgs e)
        {
            if (tbTemplete.SelectedTab == null)
            {
                return;
            }
            ListView lv = tbTemplete.SelectedTab.Tag as ListView;

            if (lv == null)
            {
                return;
            }
            if (lv.SelectedItems.Count == 0)
            {
                return;
            }
            DocTemplete tpl = lv.SelectedItems[0].Tag as DocTemplete;

            if (tpl == null)
            {
                return;
            }
            if (!Directory.Exists(GObj.TEMP_DIR))
            {
                Directory.CreateDirectory(GObj.TEMP_DIR);
            }
            string path = string.Format(@"{0}\{1}", GObj.TEMP_DIR, tpl.TempleteName);

            if (FileKit.Write(path, tpl.TempleteData, System.IO.FileMode.OpenOrCreate))
            {
                Process.Start(path);
            }
        }
Пример #4
0
        private ListViewItem createListViewItem(ExplorerFileInfo file)
        {
            ListViewItem item = new ListViewItem(file.FileName);

            item.ImageKey = FileKit.GetFileIconName(this.imageListFile, file);
            item.SubItems.Add(file.FileSize > 0 ? FileKit.FormatFileSize(file.FileSize) : "");
            item.SubItems.Add(file.CreateDateTime.ToString("yyyy-MM-dd HH:mm"));
            item.SubItems.Add(file.IsFolder ? "文件夹" : "文件");
            item.Tag = file;
            return(item);
        }
Пример #5
0
        public void OnCloudStorageTextUpdated(string text)
        {
#if !UNITY_EDITOR && UNITY_WEBGL
            var path = FileKit.GetCloudStoragePath();
            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            System.IO.File.WriteAllText(string.Format("{0}/{1}", path, "example.txt"), text);
#endif
        }
Пример #6
0
        /// <summary>
        /// 个性摆拍
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPhoto_Click(object sender, EventArgs e)
        {
            string photoPath = FileKit.selectPic(TextKit.selectImageText);

            if (string.IsNullOrEmpty(photoPath))
            {
                return;
            }
            this.pbPhotoPath = photoPath;
            this.pbPhoto.Load(photoPath);
        }
Пример #7
0
 private void listViewExplorer_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ListViewKit.hasSelectedItem(this.listViewExplorer))
     {
         ExplorerFileInfo file = (ExplorerFileInfo)this.listViewExplorer.SelectedItems[0].Tag;
         // 预览图上显示
         this.labelFileName.Text       = file.FileName;
         this.labelFileDatetime.Text   = "创建时间:" + file.CreateDateTime.ToString("yyyy-MM-dd HH:mm");
         this.labelFileSize.Text       = file.FileSize > 0 ? "文件大小:" + FileKit.FormatFileSize(file.FileSize) : "";
         this.pictureBoxFileIcon.Image = FileKit.GetFileIconImage(this.imageListLargeIcon, file);
     }
 }
Пример #8
0
        private void buttonBackFolder_Click(object sender, EventArgs e)
        {
            string path = FileKit.GetUpFolder(currentExplorerPath);

            if (path != null)
            {
                getNodeList(path, false, new TaskInfo.EventResultHandler(getExplorerListResult));
                this.buttonBackFolder.Enabled = true;
                if (path == "/")
                {
                    this.buttonBackFolder.Enabled = false;
                }
                this.currentExplorerPath = path;
            }
        }
Пример #9
0
        //部门上传
        private void button5_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.textBox2.Text))
            {
                MessageBox.Show("请选择上传文件!", "系统提示");
                return;
            }
            //获得目录编号,其子文件,都在父编号添加数据
            var t = comboBox2.SelectedItem as Department;

            if (t != null)
            {
                if (comboBox2.SelectedItem as Department == null)
                {
                    return;
                }
                _depid = (comboBox2.SelectedItem as Department).DepartmentID;
                var fname = comboBox2.Text.Trim();
                _fname = fname;
                string aFirstName = this.textBox2.Text.Substring(this.textBox2.Text.LastIndexOf("\\") + 1, (this.textBox2.Text.LastIndexOf(".") - this.textBox2.Text.LastIndexOf("\\") - 1));   //文件名
                string aLastName  = this.textBox2.Text.Substring(this.textBox2.Text.LastIndexOf(".") + 1, (this.textBox2.Text.Length - this.textBox2.Text.LastIndexOf(".") - 1));               //扩展名
                byte[] tmpfile    = FileKit.GetFileData(this.textBox2.Text);
                File   file       = new File
                {
                    FileName       = aFirstName,
                    FileCreateTime = DateTime.Now,
                    FileExt        = aLastName,
                    FileData       = tmpfile,
                    FilePID        = -1,
                    FileSize       = tmpfile.Length,
                    UserID         = LoginUser.UserId
                };
                NewFileId = new FileBLL().AddFileDep(file, _depid);
                if (NewFileId > 0)
                {
                    _status           = "department";
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("文件添加失败!", "系统提示");
                }
            }
            else
            {
                MessageBox.Show("请选择对应目录!", "系统提示");
            }
        }
Пример #10
0
        public void OnPreloadFileButtonClicked()
        {
            var result = FileKit.PreloadFile("StreamingAssets/big.file");

            if (result == Trail.Result.Ok)
            {
                Debug.LogFormat("Preload file succeeded");
            }
            else
            {
#if UNITY_EDITOR
                Debug.LogFormat("Preload file can't be called in Editor");
#else
                Debug.LogFormat("Preload file failed: {0}", result.ToString());
#endif
            }
        }
Пример #11
0
        public void OnSyncCloudStorageButtonClicked()
        {
            FileKit.SyncCloudStorage((result) => {
                if (result == Trail.Result.Ok)
                {
                    Debug.LogFormat("Sync cloud storage succeeded");
                }
                else
                {
#if UNITY_EDITOR
                    Debug.LogFormat("Sync cloud storage can't be called in Editor");
#else
                    Debug.LogFormat("Sync cloud storage failed: {0}", result.ToString());
#endif
                }
            });
        }
Пример #12
0
        public void OnGetFileSizeButtonClicked()
        {
            int size;
            var result = FileKit.GetFileSize("StreamingAssets/big.file", out size);

            if (result == Trail.Result.Ok)
            {
                Debug.LogFormat("Get file size succeeded: {0} bytes", size);
            }
            else
            {
#if UNITY_EDITOR
                Debug.LogFormat("Get file can't be called in Editor");
#else
                Debug.LogFormat("Get file size failed: {0}", result.ToString());
#endif
            }
        }
Пример #13
0
        public void OnReadFileButtonClicked()
        {
            FileKit.ReadFile("StreamingAssets/big.file", (result, buffer, length) =>
            {
                if (result == Trail.Result.Ok)
                {
                    Debug.LogFormat("Read file succeeded: {0} bytes", length);
                }
                else
                {
#if UNITY_EDITOR
                    Debug.LogFormat("Read file can't be called in Editor");
#else
                    Debug.LogFormat("Read file failed: {0}", result.ToString());
#endif
                }
            });
        }
Пример #14
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            var model = new InfoContentPage();
            BindKit.FillModelFromContainer(this.editor, model);
            model.Title = this.ContentTitle.Text;

            if (!string.IsNullOrEmpty(this.Thumb.FileName))
            {
                //清理老图像
                if (!string.IsNullOrEmpty(this.PreviewThumb.ImageUrl))
                {
                    var f = new FileInfo(Server.MapPath(this.PreviewThumb.ImageUrl));
                    if (f.Exists)
                    {
                        f.Delete();
                    }
                }
                //更新新图
                model.Thumb = FileKit.SaveZoomImage(this.Thumb.PostedFile, 1024, 1024);
            }

            if (this.Id.Value == "")
            {
                model.GroupCode  = this.GroupCode;
                model.CategoryId = 0;
                model.Click      = 0;
                model.CreateDate = DateTime.Now;
                model.IsEnabled  = 1;
                model.Author     = this.CurrentUserName;

                _bus.Insert(model);
            }
            else
            {
                _bus.Update(model, null);
            }

            ShowThumb(model.Thumb);

            this.promptControl.ShowSuccess("保存成功!");
        }
    }
Пример #15
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            var model = new InfoAdv();
            BindKit.FillModelFromContainer(this.editor, model);

            if (!string.IsNullOrEmpty(this.AdvImage.FileName))
            {
                //清理老图像
                if (!string.IsNullOrEmpty(this.PreviewImage.ImageUrl))
                {
                    var f = new FileInfo(Server.MapPath(this.PreviewImage.ImageUrl));
                    if (f.Exists)
                    {
                        f.Delete();
                    }
                }
                //更新新图
                model.Image = FileKit.SaveThumbnailImage(this.AdvImage.PostedFile, 1024, 1024);
            }

            if (this.Id.Value == "")
            {
                //model.Type = "";
                model.Click      = 0;
                model.IsEnabled  = 1;
                model.CreateDate = DateTime.Now;
                model.Creator    = this.CurrentUserName;

                this.Id.Value = _bus.InsertIdentity(model).ToString();
            }
            else
            {
                _bus.Update(model, null);
            }

            ShowThumb(model.Image);

            this.promptControl.ShowSuccess("保存成功!");
        }
    }
Пример #16
0
        public bool AddTemplate(string path, out DocType type)
        {
            type = DocType.Word;
            if (string.IsNullOrWhiteSpace(path))
            {
                return(false);
            }
            if (!System.IO.File.Exists(path))
            {
                return(false);
            }
            string fileName = path.Substring(path.LastIndexOf('\\') + 1);
            string fileExt  = fileName.Substring(fileName.LastIndexOf('.') + 1);

            switch (fileExt)
            {
            case "doc":
            case "docx":
                type = DocType.Word;
                break;

            case "ppt":
            case "pptx":
                type = DocType.PPT;
                break;

            case "xls":
            case "xlsx":
                type = DocType.Excel;
                break;
            }
            byte[]      data = FileKit.GetFileData(path);
            DocTemplete t    = new DocTemplete
            {
                TempleteName = fileName,
                TempleteExt  = fileExt,
                TempleteData = data,
                TempleteType = (int)type
            };

            return(Service.InsertTemplete(t));
        }
Пример #17
0
        private void pbOut_Click(object sender, EventArgs e)
        {
            string title = TextKit.selectVideoText;
            //获取文件路路径
            string videoPath = FileKit.select(title);

            if (string.IsNullOrEmpty(videoPath))
            {
                return;
            }
            pbOutPath = videoPath;
            string prewPic = VideoHandleKit.getPrewPic(videoPath);

            if (FileKit.isexist(prewPic))
            {
                this.pbOut.Load(prewPic);
            }
            else
            {
                MessageBox.Show(TextKit.thrumnailNotFoundMsg);
            }
        }
Пример #18
0
        static void Main(string[] args)
        {
            Console.WriteLine("安全狗启动!开始监视BlueSky应用程序!...");
            bool bRun;

            try
            {
                System.Threading.Mutex m = new System.Threading.Mutex(true, "bc342945-3e75-430a-8948-0e2dcfa958be", out bRun);
                if (!bRun)
                {
                    m.WaitOne();
                }
            }
            finally
            {
                try
                {
                    Thread.Sleep(2000);
                    Console.WriteLine("准备清理文件");
                    var path = string.Format("{0}\\temp", Application.StartupPath);
                    //KillProcess();
                    if (Directory.Exists(path))
                    {
                        FileKit.DeleteFolder(path);
                        Console.WriteLine("安全狗已为主人自动清空了文件!");
                    }
                    else
                    {
                        Directory.CreateDirectory(path);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("删除文件发生异常:{0}", e.Message);
                }
            }
        }
Пример #19
0
        public void monitorQueue()
        {
            Thread videoThread = new Thread(delegate()
            {
                while (1 > 0)
                {
                    if (QueueKit.q.Count > 0)
                    {
                        DataModel data      = (DataModel)QueueKit.q.Dequeue();
                        string phonePath    = "";
                        DataGridViewRow row = dataGridView.Rows[data.sort];

                        DataGridViewTextBoxCell phone       = (DataGridViewTextBoxCell)row.Cells["phone"];
                        DataGridViewTextBoxCell transStatus = (DataGridViewTextBoxCell)row.Cells["transStatus"];
                        transStatus.Value = "转码中";
                        phonePath         = phone.Value.ToString();
                        wirteGridData();

                        CmdKit.RunCmd(data.op);

                        transStatus.Value = TextKit.transStatusSuccess;
                        wirteGridData();
                        QueueKit.qftp.Enqueue(data);
                    }
                    Thread.Sleep(50);
                }
            });

            videoThread.Start();

            Thread ftpThread = new Thread(delegate()
            {
                while (1 > 0)
                {
                    if (QueueKit.qftp.Count > 0)
                    {
                        DataModel data = (DataModel)QueueKit.qftp.Dequeue();

                        DataGridViewRow row = dataGridView.Rows[data.sort];

                        DataGridViewTextBoxCell phone     = (DataGridViewTextBoxCell)row.Cells["phone"];
                        DataGridViewTextBoxCell ftpStatus = (DataGridViewTextBoxCell)row.Cells["ftpStatus"];
                        ftpStatus.Value = "上传中";

                        wirteGridData();

                        List <FtpModel> ftp = JsonConvert.DeserializeObject <List <FtpModel> >(FileKit.getData(FileKit.ftpPath));
                        foreach (FtpModel m in ftp)
                        {
                            FtpKit.FtpServerIP = m.ftpip;
                            FtpKit.FtpUserID   = m.ftpuser;
                            FtpKit.FtpPassword = m.ftppassword;
                            string path        = System.IO.Directory.GetCurrentDirectory() + @"\ffmpeg\output\" + data.phone;
                            FtpKit.MakeDir(m.ftpdir + data.phone);

                            string mp4path = path + ".mp4";
                            FtpKit.FtpUploadBroken(mp4path, m.ftpdir + data.phone);
                            string jsonpath = path + ".json";
                            if (FileKit.isexist(jsonpath))
                            {
                                FtpKit.FtpUploadBroken(jsonpath, m.ftpdir + data.phone);
                            }
                            string jpgpath = path + ".jpg";
                            if (FileKit.isexist(jpgpath))
                            {
                                FtpKit.FtpUploadBroken(jpgpath, m.ftpdir + data.phone);
                            }
                        }

                        ftpStatus.Value = TextKit.ftpStatusSuccess;
                        wirteGridData();
                    }
                    Thread.Sleep(50);
                }
            });

            ftpThread.Start();
        }
Пример #20
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            List <DataModel> data = JsonConvert.DeserializeObject <List <DataModel> >(FileKit.getData(FileKit.dataPath + "\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".json"));

            if (data != null)
            {
                foreach (DataModel m in data)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    //排序
                    DataGridViewTextBoxCell sort = new DataGridViewTextBoxCell();
                    sort.Value = m.sort;
                    row.Cells.Add(sort);

                    //手机号
                    DataGridViewTextBoxCell phoneCell = new DataGridViewTextBoxCell();
                    phoneCell.Value = m.phone;
                    row.Cells.Add(phoneCell);

                    DataGridViewTextBoxCell starttime = new DataGridViewTextBoxCell();
                    starttime.Value = m.starttime;
                    row.Cells.Add(starttime);


                    DataGridViewTextBoxCell transcodeCell = new DataGridViewTextBoxCell();
                    transcodeCell.Value = m.transStatus;
                    row.Cells.Add(transcodeCell);

                    DataGridViewTextBoxCell ftpCell = new DataGridViewTextBoxCell();
                    ftpCell.Value = m.ftpStatus;
                    row.Cells.Add(ftpCell);

                    DataGridViewTextBoxCell inPathCell = new DataGridViewTextBoxCell();
                    inPathCell.Value = m.inpath;
                    row.Cells.Add(inPathCell);


                    DataGridViewTextBoxCell outPathCell = new DataGridViewTextBoxCell();
                    outPathCell.Value = m.outpath;
                    row.Cells.Add(outPathCell);

                    dataGridView.Rows.Add(row);

                    DataModel dataQueueModel = new DataModel();
                    dataQueueModel.phone     = m.phone;
                    dataQueueModel.starttime = m.starttime;
                    dataQueueModel.op        = m.phone + " " + m.inpath + " " + m.outpath;;
                    dataQueueModel.sort      = m.sort - 1;
                    //未转码成功,重新转码
                    if (m.transStatus != TextKit.transStatusSuccess)
                    {
                        //获取个人摆拍
                        if (!string.IsNullOrEmpty(m.photo))
                        {
                            //copy个性摆拍
                            System.IO.File.Copy(m.photo, System.IO.Directory.GetCurrentDirectory() + @"\ffmpeg\output\" + m.phone + ".jpg");
                        }
                        transcodeCell.Value = "等待转码";
                        ftpCell.Value       = "等待资源";
                        QueueKit.q.Enqueue(dataQueueModel);
                    }
                    else
                    {
                        //未上传成功,重新上传
                        if (m.ftpStatus != TextKit.ftpStatusSuccess)
                        {
                            UploadDataModel uploadModel = new UploadDataModel();
                            uploadModel.phone     = m.phone;
                            uploadModel.starttime = m.starttime;
                            uploadModel.mac       = MacKit.GetMacString();
                            FileKit.createFile(JsonConvert.SerializeObject(m), System.IO.Directory.GetCurrentDirectory() + @"\ffmpeg\output\" + m.phone + ".json");

                            ftpCell.Value = "等待资源";
                            QueueKit.qftp.Enqueue(dataQueueModel);
                        }
                    }
                }
            }

            monitorQueue();
        }
Пример #21
0
        void Start()
        {
            if (!TrailConfig.InitializeSDKAtStartup && alwaysInitializeSDKAtStartup)
            {
                Debug.LogWarning("[TrailSDK] - Automatic Initialization is <color=red>disabled</color>, will manually call SDK.Init();");
                SDK.Init();
            }

            SDK.OnInitialized += (Trail.Result result) =>
            {
                if (result != Trail.Result.Ok)
                {
                    Debug.LogErrorFormat("Trail SDK init failed: {0}", result.ToString());
                    return;
                }

                Debug.LogFormat("Trail SDK init succeeded");
                if (!TrailConfig.InitializeSDKAtStartup)
                {
                    var finishGameLoadTaskResult = SDK.FinishGameLoadTask();
                    if (finishGameLoadTaskResult != Trail.Result.Ok)
                    {
                        Debug.LogErrorFormat("Failed to finish game load task: {0}", finishGameLoadTaskResult);
                    }
                }

                this.GameUserID.text = string.Format("Game user ID: {0}", AuthKit.GetGameUserID());
                this.PlayToken.text  = string.Format("Play token: {0}", AuthKit.GetPlayToken());
                SDK.OnFocusChanged  += (this.OnGameActiveStatusChanged);
                this.OnGameActiveStatusChanged(SDK.IsGameFocused);

                PerformanceKit.OnDisplayResolutionChanged += OnBrowserResolutionChanged;
                OnBrowserResolutionChanged(Trail.Resolution.Zero);

                Debug.Log(string.Format("Is loading invite: {0}", PartyKit.IsInviteLoading()));
                var partyData = PartyKit.GetPartyData();
                for (int i = 0; i < partyData.Count; i++)
                {
                    var field = partyData[i];
                    Debug.Log(string.Format("Party data: {0}  -  Key: {1} - Value: {2}", i, field.Key, field.Value));
                }

                PartyKit.OnPartyDataUpdated += OnPartyDataUpdated;

                SDK.StartupArg[] args;
                SDK.GetStartupArgs(out args);

                for (int i = 0; i < args.Length; ++i)
                {
                    var arg = args[i];
                    Debug.Log(string.Format("Startup Arg #{0}: Name: \"{1}\", Length {2}",
                                            i, arg.Name, arg.Value.Length));
                }

                string cloudStoragePath;
                FileKit.GetCloudStoragePath(out cloudStoragePath);
                Debug.Log("Cloud storage path: " + cloudStoragePath);

                AuthKit.GetFingerprint((res, fingerprint) => {
                    if (res.IsOk())
                    {
                        Debug.Log("Fingerprint: " + fingerprint);
                    }
                    else
                    {
                        Debug.LogErrorFormat("Failed to get fingerprint: {0}",
                                             res.ToString());
                    }
                });

#if !UNITY_EDITOR && UNITY_WEBGL
                var path = FileKit.GetCloudStoragePathFormatted("example.txt");
                if (System.IO.File.Exists(path))
                {
                    inputField.text = System.IO.File.ReadAllText(path);
                }
#endif
            };

            UnityEngine.Object.DontDestroyOnLoad(this.gameObject);
        }
Пример #22
0
        /// <summary>
        /// 立即提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            string phone = txtPhone.Text;
            string date  = txtDate.Text;

            if (string.IsNullOrEmpty(phone))
            {
                MessageBox.Show(TextKit.failMsg, "操作提示");
                return;
            }
            if (!ValidateKit.isMobile(phone))
            {
                MessageBox.Show(TextKit.failMobileMsg, "操作提示");
                return;
            }
            DataGridViewRow row = new DataGridViewRow();
            //排序
            DataGridViewTextBoxCell sort = new DataGridViewTextBoxCell();

            sort.Value = Convert.ToInt32(dataGridView.Rows.Count + 1);
            row.Cells.Add(sort);

            //手机号
            DataGridViewTextBoxCell phoneCell = new DataGridViewTextBoxCell();

            phoneCell.Value = phone;
            row.Cells.Add(phoneCell);

            DataGridViewTextBoxCell starttime = new DataGridViewTextBoxCell();

            starttime.Value = date;
            row.Cells.Add(starttime);


            DataGridViewTextBoxCell transcodeCell = new DataGridViewTextBoxCell();

            transcodeCell.Value = "等待转码";
            row.Cells.Add(transcodeCell);

            DataGridViewTextBoxCell upCell = new DataGridViewTextBoxCell();

            upCell.Value = "等待资源";
            row.Cells.Add(upCell);

            DataGridViewTextBoxCell inPathCell = new DataGridViewTextBoxCell();

            inPathCell.Value = this.pbInPath;
            row.Cells.Add(inPathCell);


            DataGridViewTextBoxCell outPathCell = new DataGridViewTextBoxCell();

            outPathCell.Value = this.pbOutPath;
            row.Cells.Add(outPathCell);

            dataGridView.Rows.Add(row);

            DataModel data = new DataModel();

            data.phone     = phone;
            data.starttime = date;
            data.op        = phone + " " + pbInPath + " " + pbOutPath;;
            data.sort      = dataGridView.Rows.Count - 1;
            //获取个人摆拍
            if (!string.IsNullOrEmpty(this.pbPhotoPath))
            {
                data.photo = this.pbPhotoPath;
                //copy个性摆拍
                System.IO.File.Copy(data.photo, System.IO.Directory.GetCurrentDirectory() + @"\ffmpeg\output\" + data.phone + ".jpg");
            }
            UploadDataModel m = new UploadDataModel();

            m.phone     = data.phone;
            m.starttime = data.starttime;
            m.mac       = MacKit.GetMacString();
            FileKit.createFile(JsonConvert.SerializeObject(m), System.IO.Directory.GetCurrentDirectory() + @"\ffmpeg\output\" + data.phone + ".json");

            txtPhone.Text    = "";
            txtDate.Text     = "";
            pbIn.Image       = global::VideoApplication.Properties.Resources._in;
            pbOut.Image      = global::VideoApplication.Properties.Resources._out;
            pbPhoto.Image    = global::VideoApplication.Properties.Resources.image;
            this.pbInPath    = "";
            this.pbOutPath   = "";
            this.pbPhotoPath = "";

            wirteGridData();
            QueueKit.q.Enqueue(data);
        }
Пример #23
0
        /// <summary>
        /// 保存规则
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSetting_Click(object sender, EventArgs e)
        {
            List <SettingModel> data = new List <SettingModel>();
            int           code       = 0;
            StringBuilder sb         = new StringBuilder(@"@echo off");

            sb.Append("\r\n");
            sb.Append(VideoHandleKit.ffmpegfile);
            sb.Append("\r\n");

            string filelist      = string.Empty;
            int    totalDuration = 0;

            foreach (DataGridViewRow m in dataGridView.Rows)
            {
                SettingModel model    = new SettingModel();
                string       sort     = Convert.ToString(m.Cells["sort"].Value);
                string       type     = Convert.ToString(m.Cells["videotype"].Value);
                string       stime    = Convert.ToString(m.Cells["stime"].Value);
                string       duration = Convert.ToString(m.Cells["duration"].Value);
                if (!ValidateKit.IsTime(stime))
                {
                    code = 1;
                    break;
                }
                if (!ValidateKit.isNumber(duration))
                {
                    code = 2;
                    break;
                }
                model.sort     = sort;
                model.type     = type;
                model.stime    = stime;
                model.duration = duration;
                totalDuration += Convert.ToInt32(model.duration);
                string paramter = "%2";
                //判断车内车外
                if (model.type == TextKit.videoOutValue)
                {
                    paramter = "%3";
                }
                string filename = "tmp/" + model.sort + ".ts";
                sb.Append("ffmpeg -y -ss " + model.stime + " -i " + paramter + " -t " + model.duration + " -vcodec copy -an tmp/t.mp4 -loglevel 16");
                sb.Append("\r\n");
                sb.Append("ffmpeg -y -i tmp/t.mp4 -b:v 1024k -s 1080x640 -f mpegts " + filename + " -loglevel 16");
                sb.Append("\r\n");
                if (!string.IsNullOrEmpty(filelist))
                {
                    filelist += "|";
                }
                filelist += filename;
                data.Add(model);
            }
            if (code == 0)
            {
                //保存文件
                FileKit.setData(data);

                //ffmpeg -y -ss 0 -i bg.mp3 -t 52 -acodec copy tmp/1.mp3 -loglevel 16
                sb.AppendFormat("ffmpeg -y -ss 0 -i bg.mp3 -t {0} -acodec copy tmp/b.mp3 -loglevel 16", totalDuration);
                sb.Append("\r\n");
                sb.Append("ffmpeg -y -i \"concat:" + filelist + "\" -i tmp/b.mp3 -c copy tmp/body.ts -loglevel 16");
                sb.Append("\r\n");
                sb.Append("ffmpeg -y -i \"concat:header.ts|tmp/body.ts|footer.ts\" -vcodec h264 tmp/finish.mp4 -loglevel 16");
                sb.Append("\r\n");
                sb.Append(@"move %CD%\tmp\finish.mp4  %CD%\output\%1.mp4");
                FileKit.setData(sb.ToString(), "ffmpeg/e.bat");

                MessageBox.Show(TextKit.successMsg, "操作提示");
                this.Hide();
            }
            else
            {
                MessageBox.Show(TextKit.failMsg, "操作提示");
            }
        }
Пример #24
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            var model = new InfoContentPage();
            BindKit.FillModelFromContainer(this.editor, model);

            if (!string.IsNullOrEmpty(this.Thumb.FileName))
            {
                //清理老图像
                if (!string.IsNullOrEmpty(this.PreviewThumb.ImageUrl))
                {
                    var f = new FileInfo(Server.MapPath(this.PreviewThumb.ImageUrl));
                    if (f.Exists)
                    {
                        f.Delete();
                    }
                }
                //更新新图
                if (this.Thumb.PostedFile.ContentLength > 0)
                {
                    if (FileKit.IsImage(this.Thumb.PostedFile.FileName))
                    {
                        model.Thumb = FileKit.SaveZoomImage(this.Thumb.PostedFile, 1024, 1024);
                    }
                    else
                    {
                        this.Alert("您上传的不是图片!");
                    }
                }
                ShowThumb(model.Thumb);
            }

            if (Request.QueryString["m"] == "content")
            {
                model.Title = this.InfoTitle.Text;
                if (!_infoBus.Update(model, "GroupCode='" + this.GroupCode + "'"))
                {
                    model.GroupCode  = this.GroupCode;
                    model.CategoryId = 0;
                    model.Click      = 0;
                    model.CreateDate = DateTime.Now;
                    model.IsEnabled  = 1;
                    model.Author     = this.CurrentUserName;
                    model.Id         = _infoBus.InsertIdentity(model);
                    BindKit.BindModelToContainer(this.editor, model);
                }
            }
            else
            {
                if (string.IsNullOrEmpty(this.Id.Value) || this.Id.Value == "0")
                {
                    model.Title      = this.InfoTitle.Text;
                    model.GroupCode  = this.GroupCode;
                    model.CategoryId = 0;
                    model.Click      = 0;
                    model.CreateDate = DateTime.Now;
                    model.IsEnabled  = 1;
                    model.Author     = this.CurrentUserName;

                    //_infoBus.Insert(model);
                    model.Id      = _infoBus.InsertIdentity(model);
                    this.Id.Value = model.Id.ToString();
                }
                else
                {
                    model.Title = this.InfoTitle.Text;
                    _infoBus.Update(model, null);
                }
            }
            this.promptControl.ShowSuccess("保存成功!");
        }
    }
Пример #25
0
        private void SettingForm_Load(object sender, EventArgs e)
        {
            List <SettingModel> data = JsonConvert.DeserializeObject <List <SettingModel> >(FileKit.getData(FileKit.settingPath));

            if (data == null)
            {
                return;
            }
            foreach (SettingModel m in data)
            {
                DataGridViewRow row = new DataGridViewRow();
                //排序
                DataGridViewTextBoxCell sort = new DataGridViewTextBoxCell();
                sort.Value = Convert.ToInt32(m.sort);
                row.Cells.Add(sort);

                //视频
                DataGridViewComboBoxCell comboxcell = new DataGridViewComboBoxCell();
                comboxcell.FlatStyle = FlatStyle.Flat;
                DataTable dt = new DataTable();
                dt.Columns.Add("value", System.Type.GetType("System.String"));
                dt.Columns.Add("text", System.Type.GetType("System.String"));
                DataRow dr = dt.NewRow();
                dr["value"] = TextKit.videoInValue;
                dr["text"]  = TextKit.videoIn;
                dt.Rows.Add(dr);
                dr          = dt.NewRow();
                dr["value"] = TextKit.videoOutValue;
                dr["text"]  = TextKit.videoOut;
                dt.Rows.Add(dr);

                comboxcell.DataSource    = dt;
                comboxcell.DisplayMember = "text";
                comboxcell.ValueMember   = "value";
                comboxcell.Value         = m.type;
                row.Cells.Add(comboxcell);

                DataGridViewTextBoxCell stime = new DataGridViewTextBoxCell();
                stime.Value = m.stime;
                row.Cells.Add(stime);

                DataGridViewTextBoxCell duration = new DataGridViewTextBoxCell();
                duration.Value = m.duration;
                row.Cells.Add(duration);

                DataGridViewLinkCell play = new DataGridViewLinkCell();

                play.Value = "播放";
                row.Cells.Add(play);

                dataGridView.Rows.Add(row);
            }
        }