Ejemplo n.º 1
0
        private void shoot()
        {
            var shell = new WshShellClass();

            shell.SendKeys("^+{F11}", ref wait);
        }
Ejemplo n.º 2
0
        //stopButton:Ctrl+Shift+F12を送り、jsonファイルを作成
        private void stopButton_Click(object sender, RoutedEventArgs e)
        {
            //swが動いていなければreturn
            if (sw.IsRunning == false)
            {
                return;
            }

            var shell = new WshShellClass();
            object wait = 0;

            //Ctrl+Shift+F12を送る
            //他と接続されていたらそれにも送る
            shell.SendKeys("^+{F12}", ref wait);
            if (st != null)
            {
                if (st.CanWrite)
                {
                    Byte[] sendBytes = Encoding.UTF8.GetBytes("撮影終了");
                    st.Write(sendBytes, 0, sendBytes.Length);
                }
            }
            if (st2 != null)
            {
                if (st2.CanWrite)
                {
                    Byte[] sendBytes = Encoding.UTF8.GetBytes("撮影終了");
                    st2.Write(sendBytes, 0, sendBytes.Length);
                }
            }

            sw.Stop();

            System.Threading.Thread.Sleep(1000);

            //renameに入力した名前にリネーム
            string ren = path + "\\" + lastName;
            string re = path + "\\" + s + num + ".wmv";
            if(System.IO.File.Exists(re)){
                System.IO.File.Delete(re);
            }
            System.IO.File.Move(ren, re);

            //jsonファイルの書き出し
            //syncListにsyncPointListを取得
            var syncList = new List<string>(syncPointList.Text.Trim().Split('\n'));
            var jsonFileName = s + num + ".json";

            //書式
            var outputJson = "{\n";

            //現段階ではWMVで撮影することにしか対応していない
            //ほかの形式でも対応できるようにしたい
            outputJson += "\"tag\" : \"" + s+num +".wmv" + "\",\n";
            outputJson += "\"url\" : [\"" + s+num +".wmv" + "\"],\n";
            outputJson += "\"viewpoint\" : [\"" + "正面" + "\"],\n";
            outputJson += "\"sync\" : [\n";
            foreach (var value in syncList)
            {
                //syncListの中身がなくなるまでoutputjsonに格納
                if (value != "")
                {
                    outputJson += "\"" + value + "\"";
                    //最後の同期ポイント以外は後ろに,をつける
                    if (syncList.IndexOf(value) != syncList.Count - 1)
                    {
                        outputJson += ",";
                    }
                }
                outputJson += "\n";
            }
            outputJson += "],\n";
            outputJson += "\"rectangle\" : [],\n";
            outputJson += "\"text\" : []\n";
            outputJson += "}";

            Debug.WriteLine(path);

            //jsonファイルの作成
            using (var fileJson = new StreamWriter(path + "\\" + jsonFileName))
            {
                fileJson.Write(outputJson);
            }

            num++;

            rename.Text = s + num + "の撮影待機中";
        }
Ejemplo n.º 3
0
        //stopButton:Ctrl+Shift+F12を送り、jsonファイルを作成
        private void stopButton_Click(object sender, RoutedEventArgs e)
        {
            //swが動いていなければreturn
            if (sw.IsRunning == false)
            {
                return;
            }



            var    shell = new WshShellClass();
            object wait  = 0;

            //Ctrl+Shift+F12を送る
            //他と接続されていたらそれにも送る
            shell.SendKeys("^+{F12}", ref wait);
            if (st != null)
            {
                if (st.CanWrite)
                {
                    Byte[] sendBytes = Encoding.UTF8.GetBytes("撮影終了");
                    st.Write(sendBytes, 0, sendBytes.Length);
                }
            }
            if (st2 != null)
            {
                if (st2.CanWrite)
                {
                    Byte[] sendBytes = Encoding.UTF8.GetBytes("撮影終了");
                    st2.Write(sendBytes, 0, sendBytes.Length);
                }
            }


            sw.Stop();

            System.Threading.Thread.Sleep(1000);

            //renameに入力した名前にリネーム
            string ren = path + "\\" + lastName;
            string re  = path + "\\" + s + num + ".wmv";

            if (System.IO.File.Exists(re))
            {
                System.IO.File.Delete(re);
            }
            System.IO.File.Move(ren, re);

            //jsonファイルの書き出し
            //syncListにsyncPointListを取得
            var syncList     = new List <string>(syncPointList.Text.Trim().Split('\n'));
            var jsonFileName = s + num + ".json";

            //書式
            var outputJson = "{\n";

            //現段階ではWMVで撮影することにしか対応していない
            //ほかの形式でも対応できるようにしたい
            outputJson += "\"tag\" : \"" + s + num + ".wmv" + "\",\n";
            outputJson += "\"url\" : [\"" + s + num + ".wmv" + "\"],\n";
            outputJson += "\"viewpoint\" : [\"" + "正面" + "\"],\n";
            outputJson += "\"sync\" : [\n";
            foreach (var value in syncList)
            {
                //syncListの中身がなくなるまでoutputjsonに格納
                if (value != "")
                {
                    outputJson += "\"" + value + "\"";
                    //最後の同期ポイント以外は後ろに,をつける
                    if (syncList.IndexOf(value) != syncList.Count - 1)
                    {
                        outputJson += ",";
                    }
                }
                outputJson += "\n";
            }
            outputJson += "],\n";
            outputJson += "\"rectangle\" : [],\n";
            outputJson += "\"text\" : []\n";
            outputJson += "}";

            Debug.WriteLine(path);

            //jsonファイルの作成
            using (var fileJson = new StreamWriter(path + "\\" + jsonFileName))
            {
                fileJson.Write(outputJson);
            }

            num++;

            rename.Text = s + num + "の撮影待機中";
        }
Ejemplo n.º 4
0
 private void shoot()
 {
     var shell = new WshShellClass();
     shell.SendKeys("^+{F11}", ref wait);
 }