Пример #1
0
        private void loadConfig()
        {
            // Open file
            // TODO: add option to select file
            parser.OpenFile();


            // initialize rs_web_api_port watcher
            rs_web_api_port_changed = false;



            // instance properties Class
            rsProps = new RecorderProperties();

            try
            {
                // Read Values from XML
                parser.ReadValues(rsProps);
            }
            catch (Exception e)
            {
                if (e.Message == "Object reference not set to an instance of an object.")
                {
                    MessageBox.Show("Versions below 13.2 are not supported by RecorderConfigV2. Please use recorderconfigmanager");
                }
                else
                {
                    MessageBox.Show(e.Message);
                }
            }

            // Show Values in the GUI
            showValues(rsProps);
        }
Пример #2
0
        public void ReadValues(RecorderProperties rsProps)
        {
            // Info

            rsProps.version = xDoc.SelectSingleNode("/recorderconfig/version").InnerText;
            rsProps.file    = file;
            // RS
            rsProps.id          = xDoc.SelectSingleNode("/recorderconfig/recorder/id").InnerText;
            rsProps.displayName = xDoc.SelectSingleNode("/recorderconfig/recorder/displayname").InnerText;

            rsProps.rsWebApiPort = xDoc.SelectSingleNode("/recorderconfig/webapi/port").InnerText;

            rsProps.rsWebApiAddress = xDoc.SelectSingleNode("/recorderconfig/webapi/publicUri").InnerText;
            // WORKARROUND TO NOT SHOW PORT IN GUI; FOR SOME REASON THE PORT IS ATTACHED TO THE ADDRESS IN THE XML
            rsProps.rsWebApiAddress = rsProps.rsWebApiAddress.Substring(0, rsProps.rsWebApiAddress.IndexOf(":"));

            rsProps.rsWebServerAddress = xDoc.SelectSingleNode("/recorderconfig/webserver/host").InnerText;
            rsProps.rsWebServerPort    = xDoc.SelectSingleNode("/recorderconfig/webserver/port").InnerText;

            // MS
            rsProps.msWebApiAddress            = xDoc.SelectSingleNode("/recorderconfig/server/address").InnerText;
            rsProps.msWebApiPort               = xDoc.SelectSingleNode("/recorderconfig/server/webapiport").InnerText;
            rsProps.authorizationServerAddress = xDoc.SelectSingleNode("/recorderconfig/server/authorizationserveraddress").InnerText;

            // Pipeline Settings
            rsProps.maxFramesInQueue          = xDoc.SelectSingleNode("/recorderconfig/pipeline/maxframesinqueue").InnerText;
            rsProps.maxBytesInQueue           = xDoc.SelectSingleNode("/recorderconfig/pipeline/maxbytesinqueue").InnerText;
            rsProps.maxActiveTimeForPipeline2 = xDoc.SelectSingleNode("/recorderconfig/pipeline/maxactivetimepipeline2").InnerText;

            //Archiving Threads
            rsProps.deleteThreadPoolSize      = xDoc.SelectSingleNode("/recorderconfig/database/database_server/thread_pools/delete_thread_pool_size").InnerText;
            rsProps.lowPriorityArchiveThread  = xDoc.SelectSingleNode("/recorderconfig/database/database_server/thread_pools/low_priority_archive_thread_pool_size").InnerText;
            rsProps.highPriorityArchiveThread = xDoc.SelectSingleNode("/recorderconfig/database/database_server/thread_pools/high_priority_archive_thread_pool_size").InnerText;

            //Disk Utilization
            rsProps.mediaFileReadBuffer  = xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_utilization/media_block_files/read_buffer_size").InnerText;
            rsProps.mediaFileWriteBuffer = xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_utilization/media_block_files/write_buffer_size").InnerText;
            rsProps.chunkFileReadBuffer  = xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_utilization/chunk_files/read_buffer_size").InnerText;
            rsProps.chunkFileWriteBuffer = xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_utilization/chunk_files/write_buffer_size").InnerText;

            //Disk Usage Monitor
            rsProps.forceArchiveLimit = xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_usage_monitor/force_archive_limit_in_mb").InnerText;
            rsProps.forceDeleteLimit  = xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_usage_monitor/force_delete_limit_in_mb").InnerText;

            try
            {
                rsProps.maxVideoStreamsPerProxy = xDoc.SelectSingleNode("/recorderconfig/recorder/proxyServerSplitting").Attributes.GetNamedItem("maxVideoStreamsPerProxy").InnerText;
            }
            catch (Exception e)
            {
                rsProps.maxVideoStreamsPerProxy = "100";
            }
        }
Пример #3
0
        /// <summary>
        /// Show the values readed from the XML in the GUI
        /// </summary>
        /// <param name="rsProps"></param>
        private void showValues(RecorderProperties rsProps)
        {
            // Info
            labelOpenFile.Text = rsProps.file;
            labelVersion.Text  = rsProps.version;

            //RS
            textBox_id.Text          = rsProps.id;
            textBox_displayname.Text = rsProps.displayName;
            textBoxAuthorizationserveraddress.Text      = rsProps.authorizationServerAddress;
            textBoxRecordingServerWebApiAddress.Text    = rsProps.rsWebApiAddress;
            textBoxRecordingServerWebApiPort.Text       = rsProps.rsWebApiPort;
            textBoxRecordingServerWebServerAddress.Text = rsProps.rsWebServerAddress;
            textBoxRecordingServerWebServerPort.Text    = rsProps.rsWebServerPort;

            //MS
            textBoxMsServerWebApiAddress.Text = rsProps.msWebApiAddress;
            textBoxMsServerWebApiPort.Text    = rsProps.msWebApiPort;

            //PIPELINE
            textBoxMaxFramesInQueue.Text          = rsProps.maxFramesInQueue;
            textBoxMaxBytesinQueue.Text           = rsProps.maxBytesInQueue;
            textBoxMaxActiveTimeForPipeline2.Text = rsProps.maxActiveTimeForPipeline2;


            //Archiving Threads
            textBoxDeleteThreadPoolSize.Text       = rsProps.deleteThreadPoolSize;
            textBoxLowPriorityArchiveThreads.Text  = rsProps.lowPriorityArchiveThread;
            textBoxHighPriorityArchiveThreads.Text = rsProps.highPriorityArchiveThread;

            //Disk Utilization
            textBoxMediaFileReadBuffer.Text  = rsProps.mediaFileReadBuffer;
            textBoxMediaFileWriteBuffer.Text = rsProps.mediaFileWriteBuffer;
            textBoxChunkFileReadBuffer.Text  = rsProps.chunkFileReadBuffer;
            textBoxChunkFileWriteBuffer.Text = rsProps.chunkFileWriteBuffer;


            //Disk Usage Monitor
            textBoxForceArchiveLimit.Text = rsProps.forceArchiveLimit;
            textBoxForceDeleteLimit.Text  = rsProps.forceDeleteLimit;

            rs_web_api_port_changed = false;


            //Proxy Split

            TextBoxmaxVideoStreamsPerProxy.Text = rsProps.maxVideoStreamsPerProxy;
        }
Пример #4
0
        /// <summary>
        /// Fetch the values from GUI
        /// </summary>
        /// <param name="rsProps"></param>
        private void fetchValues(RecorderProperties rsProps)
        {
            //RS
            rsProps.id                 = textBox_id.Text;
            rsProps.displayName        = textBox_displayname.Text;
            rsProps.rsWebApiAddress    = textBoxRecordingServerWebApiAddress.Text;
            rsProps.rsWebApiPort       = textBoxRecordingServerWebApiPort.Text;
            rsProps.rsWebServerAddress = textBoxRecordingServerWebServerAddress.Text;
            rsProps.rsWebServerPort    = textBoxRecordingServerWebServerPort.Text;

            // MS
            rsProps.msWebApiAddress            = textBoxMsServerWebApiAddress.Text;
            rsProps.msWebApiPort               = textBoxMsServerWebApiPort.Text;
            rsProps.authorizationServerAddress = textBoxAuthorizationserveraddress.Text;


            //PIPELINE
            rsProps.maxFramesInQueue          = textBoxMaxFramesInQueue.Text;
            rsProps.maxBytesInQueue           = textBoxMaxBytesinQueue.Text;
            rsProps.maxActiveTimeForPipeline2 = textBoxMaxActiveTimeForPipeline2.Text;

            //Archiving Threads
            rsProps.deleteThreadPoolSize      = textBoxDeleteThreadPoolSize.Text;
            rsProps.lowPriorityArchiveThread  = textBoxLowPriorityArchiveThreads.Text;
            rsProps.highPriorityArchiveThread = textBoxHighPriorityArchiveThreads.Text;

            //Disk Utilization
            rsProps.mediaFileReadBuffer  = textBoxMediaFileReadBuffer.Text;
            rsProps.mediaFileWriteBuffer = textBoxMediaFileWriteBuffer.Text;
            rsProps.chunkFileReadBuffer  = textBoxChunkFileReadBuffer.Text;
            rsProps.chunkFileWriteBuffer = textBoxChunkFileWriteBuffer.Text;


            //Disk Usage Monitor
            rsProps.forceArchiveLimit = textBoxForceArchiveLimit.Text;
            rsProps.forceDeleteLimit  = textBoxForceDeleteLimit.Text;


            // Proxy Split
            rsProps.maxVideoStreamsPerProxy = TextBoxmaxVideoStreamsPerProxy.Text;
        }
Пример #5
0
        public void WriteValues(RecorderProperties rsProps)
        {
            int i = 0;

            while (File.Exists(@"C:\ProgramData\Milestone\XProtect Recording Server\RecorderConfig (" + i + ").xml"))
            {
                i++;
            }

            xDoc.Save(@"C:\ProgramData\Milestone\XProtect Recording Server\RecorderConfig (" + i + ").xml");

            // RS
            xDoc.SelectSingleNode("/recorderconfig/recorder/id").InnerText          = rsProps.id;
            xDoc.SelectSingleNode("/recorderconfig/recorder/displayname").InnerText = rsProps.displayName;
            xDoc.SelectSingleNode("/recorderconfig/webapi/port").InnerText          = rsProps.rsWebApiPort;
            xDoc.SelectSingleNode("/recorderconfig/webapi/publicUri").InnerText     = rsProps.rsWebApiAddress + ":" + rsProps.rsWebApiPort;


            xDoc.SelectSingleNode("/recorderconfig/webserver/host").InnerText = rsProps.rsWebServerAddress;
            xDoc.SelectSingleNode("/recorderconfig/webserver/port").InnerText = rsProps.rsWebServerPort;

            // MS
            xDoc.SelectSingleNode("/recorderconfig/server/address").InnerText    = rsProps.msWebApiAddress;
            xDoc.SelectSingleNode("/recorderconfig/server/webapiport").InnerText = rsProps.msWebApiPort;
            xDoc.SelectSingleNode("/recorderconfig/server/authorizationserveraddress").InnerText = rsProps.authorizationServerAddress;


            // Pipeline Settings
            xDoc.SelectSingleNode("/recorderconfig/pipeline/maxframesinqueue").InnerText       = rsProps.maxFramesInQueue;
            xDoc.SelectSingleNode("/recorderconfig/pipeline/maxbytesinqueue").InnerText        = rsProps.maxBytesInQueue;
            xDoc.SelectSingleNode("/recorderconfig/pipeline/maxactivetimepipeline2").InnerText = rsProps.maxActiveTimeForPipeline2;

            //Archiving Threads
            xDoc.SelectSingleNode("/recorderconfig/database/database_server/thread_pools/delete_thread_pool_size").InnerText = rsProps.deleteThreadPoolSize;
            xDoc.SelectSingleNode("/recorderconfig/database/database_server/thread_pools/low_priority_archive_thread_pool_size").InnerText  = rsProps.lowPriorityArchiveThread;
            xDoc.SelectSingleNode("/recorderconfig/database/database_server/thread_pools/high_priority_archive_thread_pool_size").InnerText = rsProps.highPriorityArchiveThread;

            //Disk Utilization
            xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_utilization/media_block_files/read_buffer_size").InnerText  = rsProps.mediaFileReadBuffer;
            xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_utilization/media_block_files/write_buffer_size").InnerText = rsProps.mediaFileWriteBuffer;
            xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_utilization/chunk_files/read_buffer_size").InnerText        = rsProps.chunkFileReadBuffer;
            xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_utilization/chunk_files/write_buffer_size").InnerText       = rsProps.chunkFileWriteBuffer;


            //Disk Usage Monitor
            xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_usage_monitor/force_archive_limit_in_mb").InnerText = rsProps.forceArchiveLimit;
            xDoc.SelectSingleNode("/recorderconfig/database/database_server/disk_usage_monitor/force_delete_limit_in_mb").InnerText  = rsProps.forceDeleteLimit;


            try
            {
                xDoc.SelectSingleNode("/recorderconfig/recorder/proxyServerSplitting").Attributes.GetNamedItem("maxVideoStreamsPerProxy").InnerText = rsProps.maxVideoStreamsPerProxy;
            }
            catch (Exception)
            {
                XmlNode      maxVideoStreamsPerProxy_node = xDoc.CreateNode(XmlNodeType.Element, "proxyServerSplitting", null);
                XmlAttribute attr = xDoc.CreateAttribute("maxVideoStreamsPerProxy");
                attr.Value = rsProps.maxVideoStreamsPerProxy;
                maxVideoStreamsPerProxy_node.Attributes.SetNamedItem(attr);
                xDoc.SelectSingleNode("/recorderconfig/recorder").AppendChild(maxVideoStreamsPerProxy_node);
            }



            try
            {
                xDoc.Save(@"C:\ProgramData\Milestone\XProtect Recording Server\RecorderConfig.xml");
            }

            catch {
                MessageBox.Show("ERROR SAVING");
            }
        }
Пример #6
0
 internal MS_Tester(TestsHelper testHelper, RecorderProperties rsProps)
 {
     this.testHelper = testHelper;
     this.rsProps    = rsProps;
     InitializeComponent();
 }