private bool StopLogging()
        {
            timer1.Enabled = false;

            pathSelector.Enabled     = true;
            m_SessionNameBox.Enabled = true;

            m_StartButton.Enabled      = true;
            m_LoggingPeriodBox.Enabled = true;
            m_StopButton.Enabled       = false;

            if (m_Logger == null)
            {
                return(false);
            }

            m_Logger.Exception -= DisplayException;
            m_Logger.Stopped   -= m_Logger_Stopped;

            m_Logger.Stop();

            lastSessionDirectory = m_Logger.SessionDirectory;

            TimeSpan span = m_Logger.LoggingTime;

            m_ClockPanel.CurrentTime = span;

            m_ClockPanel.Invalidate();

            m_Logger = null;

            openDirectory.Enabled = true;

            return(true);
        }
Exemple #2
0
        Tuple <Session, FileSaver> CreateSession(string ppidExtra)
        {
            GameObject    gameObject    = new GameObject();
            FileSaver     fileSaver     = gameObject.AddComponent <FileSaver>();
            SessionLogger sessionLogger = gameObject.AddComponent <SessionLogger>();
            Session       session       = gameObject.AddComponent <Session>();

            fileSaver.storagePath = "example_output";

            sessionLogger.AttachReferences(
                session
                );

            session.dataHandlers = new DataHandler[] { fileSaver };

            sessionLogger.Initialise();

            fileSaver.verboseDebug = true;

            string experimentName = "unit_test";
            string ppid           = "test_behaviour_" + ppidExtra;

            session.Begin(experimentName, ppid);

            // generate trials
            session.CreateBlock(2);
            session.CreateBlock(3);

            return(new Tuple <Session, FileSaver>(session, fileSaver));
        }
Exemple #3
0
 /// <summary>
 /// Session Constructor
 /// </summary>
 public Session()
 {
     // Add the delegate event handlers
     m_sessionLogger      = new SessionLogger(MessageHandler);
     m_loginSuccessNotify = new LoginNotify(HandleLoginSuccessful);
     m_disconnectNotify   = new DisconnectNotify(HandleDisconnectNotify);
 }
        private void go(string[] args)
        {
            try
            {
                var path = args[0];

                FileInfo info = new FileInfo(path);
                if (!info.Exists)
                {
                    Console.WriteLine("Source file does not exist");
                    return;
                }

                totalMaximumBytes += new FileInfo(path).Length;

                var connectionInfo = new SDCardFileConnectionInfo();
                connectionInfo.FilePath = path;

                var connection = new Connection(connectionInfo);

                var directory = args[1];
                var logger    = new SessionLogger(SessionSettings.CreateForFileAndPath(directory, info), connection);

                logger.Start();

                connection.Message += new MessageEvent(ConnectionMessage);
                connection.Connect();

                logger.Stop();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        public static ISessionLog GetSessionLogger()
        {
            CheckIfConnectionStringExists();
            ISessionLog logger = new SessionLogger();

            return(logger);
        }
 public SpellCheckerVerifier(bool isPrespellChecker, PersianSpellChecker engine, SessionLogger sessionLogger)
     : base(1, 1)
 {
     m_engine            = engine;
     m_sessionLogger     = sessionLogger;
     m_isPrespellChecker = isPrespellChecker;
 }
        /// <summary>
        /// Initializes the source table.
        /// </summary>
        private void InitSourceTable()
        {
            SessionLogger.Information(@"Creating source data table structure for Target ""{0}"" from table ""{1}""", typeof(T).FullName, TargetTableName);
            TargetTableSource = new DataTable();
            var sql = string.Format("SELECT  * from [{0}]", TargetTableName);

            using (var conn = new SqlConnection(ConfigService.ConnectionSettings.ConnectionString))
            {
                conn.Open();
                using (var da = new SqlDataAdapter(sql, conn))
                {
                    da.FillSchema(TargetTableSource, SchemaType.Source);
                }
                conn.Close();
            }
            var idCol = TargetTableSource.Columns["Id"];

            if (idCol != null)
            {
                // if the table has an "Id" column, assume that it's an IDENTITY column and we're not providing values (i.e.: all of our values are 0 and will fail the unique constraint)
                TargetTableSource.PrimaryKey = null;
                idCol.Unique = false;
            }
            SessionLogger.Information(@"Source data table structure created for Target ""{0}"" from table ""{1}""", typeof(T).FullName, TargetTableName);
        }
        void Start()
        {
            gameObject    = new GameObject();
            fileSaver     = gameObject.AddComponent <FileSaver>();
            sessionLogger = gameObject.AddComponent <SessionLogger>();
            session       = gameObject.AddComponent <Session>();

            session.dataHandlers = new DataHandler[] { fileSaver };

            sessionLogger.AttachReferences(
                session
                );

            sessionLogger.Initialise();
            fileSaver.storagePath  = "example_output";
            fileSaver.verboseDebug = true;

            session.Begin(experimentName, ppid);
            session.customHeaders.Add("observation");
            session.customHeaders.Add("null_observation");

            // generate trials
            session.CreateBlock(2);
            session.CreateBlock(3);
        }
Exemple #9
0
        public void SetUp()
        {
            gameObject    = new GameObject();
            fileIOManager = gameObject.AddComponent <FileIOManager>();
            sessionLogger = gameObject.AddComponent <SessionLogger>();
            session       = gameObject.AddComponent <Session>();

            session.AttachReferences(
                fileIOManager
                );

            sessionLogger.AttachReferences(
                fileIOManager,
                session
                );

            sessionLogger.Initialise();

            fileIOManager.debug = true;
            fileIOManager.Begin();

            string experimentName = "unit_test";
            string ppid           = "test_trials";

            session.Begin(experimentName, ppid, "example_output");
            session.customHeaders.Add("observation");
            session.customHeaders.Add("null_observation");

            // generate trials
            session.CreateBlock(2);
            session.CreateBlock(3);
        }
        /// <summary>
        /// Creates the database schema for a <see cref="DynamicTarget"/>
        /// </summary>
        /// <returns></returns>
        public override int Create()
        {
            try
            {
                var dynamicTarget = Target as DynamicTarget;
                if (dynamicTarget == null)
                {
                    return(0);
                }

                // create table for target type
                SchemaBuilder.CreateTable(dynamicTarget.DbSchemaName, table => table
                                          .DatasetRecord()
                                          .DatasetReferenceRecord()
                                          .AddColumns(dynamicTarget.Columns.ToArray())
                                          );
                // create FK to datasets table
                SchemaBuilder.CreateForeignKey(
                    string.Format("FK_{0}_Datasets", dynamicTarget.DbSchemaName),
                    dynamicTarget.DbSchemaName,
                    new[] { "Dataset_id" },
                    typeof(Dataset).GetCustomAttribute <EntityTableNameAttribute>().TableName,
                    new[] { "Id" });
            }
            catch (Exception exc)
            {
                SessionLogger.Write(exc);
                return(0);
            }

            return(1);
        }
Exemple #11
0
        Session CreateSession(string ppidExtra)
        {
            GameObject    gameObject    = new GameObject();
            FileIOManager fileIOManager = gameObject.AddComponent <FileIOManager>();
            SessionLogger sessionLogger = gameObject.AddComponent <SessionLogger>();
            Session       session       = gameObject.AddComponent <Session>();

            session.AttachReferences(
                fileIOManager
                );

            sessionLogger.AttachReferences(
                fileIOManager,
                session
                );

            sessionLogger.Initialise();

            fileIOManager.debug = true;
            fileIOManager.Begin();

            string experimentName = "unit_test";
            string ppid           = "test_behaviour_" + ppidExtra;

            session.Begin(experimentName, ppid, "example_output");

            // generate trials
            session.CreateBlock(2);
            session.CreateBlock(3);

            return(session);
        }
Exemple #12
0
 private void Awake()
 {
     uiController               = GetComponent <UiController>();
     boardController            = GetComponent <BoardController>();
     npcController              = GetComponent <NpcController>();
     sessionLogger              = GetComponent <SessionLogger>();
     sessionLogger.goldRewarded = (int)playerGoldCount;
 }
Exemple #13
0
 private void Awake()
 {
     npcController    = GetComponent <NpcController>(); //fetch world controllers
     uiController     = GetComponent <UiController>();
     playerController = GetComponent <PlayerController>();
     sessionLogger    = GetComponent <SessionLogger>();
     translator       = GetComponent <Translator>();
 }
 public void GetWorldControllers()
 {
     boardController      = GetComponent <BoardController>();
     playerController     = GetComponent <PlayerController>();
     npcController        = GetComponent <NpcController>();
     sessionLogger        = GetComponent <SessionLogger>();
     combatLogger         = GetComponent <CombatLogger>();
     dialogueManager      = GetComponent <DialogueManager>();
     objectPoolController = GetComponent <ObjectPoolController>();
     translator           = GetComponent <Translator>();
     hudCanvas            = GameObject.Find("HUDCanvas");
 }
Exemple #15
0
 public Form_CollaborativeNotepad()
 {
     InitializeComponent();
     //initialize title
     Form_CollaborativeNotepad_Title = this.Text;
     setTitleWithCompilationMode();
     //initialize logger
     sessionLogger = SessionLogger.CreateSessionLogger();
     //initialize combo box
     initialize_ComboBox_PropertySetsServerUrls();
     write_RichTextBox_Logger_PropertySetsServerUrls();
     //initialize settings
     initializeSettings();
     applyCurrentSettings();
     //initialize cef browser
     initializeCefBrowser();
 }
        /// <summary>
        /// Initializes the bulk copy.
        /// </summary>
        private void InitBulkCopy()
        {
            ColumnMappings = new List <SqlBulkCopyColumnMapping>();
            SessionLogger.Information(@"Building Bulk Insert Map for Target ""{0}"" into table ""{1}""",
                                      typeof(T).FullName, TargetTableName);

            foreach (var col in TargetTableSource.Columns.OfType <DataColumn>())
            {
                if (!col.AutoIncrement)
                {
                    var mapping = new SqlBulkCopyColumnMapping(col.ColumnName, col.ColumnName);
                    ColumnMappings.Add(mapping);
                }
            }

            SessionLogger.Information(@"Bulk Insert Mapped for Target ""{0}"" into table ""{1}""", typeof(T).FullName, TargetTableName);
        }
        private bool StartLogging(SessionSettings settings)
        {
            if (ActiveConnections.Count == 0)
            {
                this.ShowError("No connection.");

                return(false);
            }

            if (m_Logger != null)
            {
                this.ShowError("Already logging.");

                return(false);
            }

            pathSelector.Enabled     = false;
            m_SessionNameBox.Enabled = false;

            m_StartButton.Enabled      = false;
            m_LoggingPeriodBox.Enabled = false;
            m_StopButton.Enabled       = true;
            openDirectory.Enabled      = false;

            try
            {
                m_Logger = new SessionLogger(settings, ActiveConnections.ToArray());

                m_Logger.Exception += DisplayException;
                m_Logger.Stopped   += m_Logger_Stopped;

                m_Logger.Start();

                timer1.Enabled = true;

                return(true);
            }
            catch (Exception ex)
            {
                StopLogging();

                DisplayException(ex);

                return(false);
            }
        }
Exemple #18
0
        public Session(PeerSession s, X509Certificate2 nodeCert)
        {
            logger        = new SessionLogger(this);
            this.Id       = s.Id;
            this.Kind     = s.Kind;
            this.Budget   = s.Budget;
            this.FromNode = s.FromNode;
            this.ToNode   = s.ToNode;
            this.TaskId   = s.TaskId;
            this.GuidKey  = System.Guid.NewGuid().ToByteArray();
            this.Secret   = s.Secret;
            //myKeyPairCrypto = csp;
            cert = nodeCert;
            AuthenticatedEvent = new ManualResetEvent(false);

            if (this.Kind == SessionType.Store)
            {
                this.Budget = 0;                 // bug?? do we have to initialize to 0 when receiving/storing?
                // client-side flags are not relevant here since the client data processing is not initialized by the Session.
                if (s.Flags.HasFlag(DataProcessingFlags.CChecksum))
                {
                    s.Flags ^= DataProcessingFlags.CChecksum;
                }
                if (s.Flags.HasFlag(DataProcessingFlags.CCompress))
                {
                    s.Flags ^= DataProcessingFlags.CCompress;
                }
                if (s.Flags.HasFlag(DataProcessingFlags.CDedup))
                {
                    s.Flags ^= DataProcessingFlags.CDedup;
                }
                if (s.Flags.HasFlag(DataProcessingFlags.CEncrypt))
                {
                    s.Flags ^= DataProcessingFlags.CEncrypt;
                }
                this.Flags = s.Flags;
                pipeline   = new Node.DataProcessing.DataPipeline(Node.DataProcessing.PipelineMode.Read, this.Flags);
                logger.Log(Severity.DEBUG, "Creating storage session (" + this.Kind.ToString() + ") with client node #" + this.FromNode.Id + " (" + this.FromNode.IP + ":<UNAVAILABLE>)");
            }
            else if (this.Kind == SessionType.Backup)
            {
                this.CryptoKey = System.Guid.NewGuid().ToByteArray();
                logger.Log(Severity.DEBUG, "Creating client session #" + this.Id + " with storage node #" + this.ToNode.Id + " (" + this.ToNode.IP + ":" + this.ToNode.ListenPort + ")");
            }
        }
Exemple #19
0
        public void SessionEndEvent()
        {
            gameObject    = new GameObject();
            fileIOManager = gameObject.AddComponent <FileIOManager>();
            sessionLogger = gameObject.AddComponent <SessionLogger>();
            session       = gameObject.AddComponent <Session>();

            session.AttachReferences(
                fileIOManager
                );

            sessionLogger.AttachReferences(
                fileIOManager,
                session
                );

            session.onSessionEnd.AddListener(UseSession);

            sessionLogger.Initialise();

            fileIOManager.debug = true;
            fileIOManager.Begin();

            string experimentName = "unit_test";
            string ppid           = "test_trials";

            session.Begin(experimentName, ppid, "example_output");
            session.customHeaders.Add("observation");

            // generate trials
            session.CreateBlock(2);
            session.CreateBlock(3);

            int i = 0;

            foreach (var trial in session.Trials)
            {
                trial.Begin();
                trial.result["observation"] = ++i;
                trial.End();
            }

            session.End();
        }
Exemple #20
0
        public void SetUp()
        {
            gameObject    = new GameObject();
            fileSaver     = gameObject.AddComponent <FileSaver>();
            sessionLogger = gameObject.AddComponent <SessionLogger>();
            session       = gameObject.AddComponent <Session>();

            sessionLogger.AttachReferences(
                session
                );

            fileSaver.storagePath = "example_output";

            session.dataHandlers = new DataHandler[] { fileSaver };

            sessionLogger.Initialise();

            fileSaver.verboseDebug = true;
        }
        public void SetUp()
        {
            gameObject    = new GameObject();
            fileIOManager = gameObject.AddComponent <FileIOManager>();
            sessionLogger = gameObject.AddComponent <SessionLogger>();
            session       = gameObject.AddComponent <Session>();

            session.AttachReferences(
                fileIOManager,
                sessionLogger
                );

            sessionLogger.AttachReferences(
                fileIOManager,
                session
                );

            sessionLogger.Initialise();

            fileIOManager.debug = true;
            fileIOManager.Begin();

            string experimentName = "unit_test";
            string ppid           = "test_trackers";

            session.Begin(experimentName, ppid, "example_output");


            for (int i = 0; i < 5; i++)
            {
                GameObject trackedObject = new GameObject();
                Tracker    tracker       = trackedObject.AddComponent <PositionRotationTracker>();
                tracker.objectName = string.Format("Tracker_{0}", i);

                session.trackedObjects.Add(tracker);
                tracked.Add(trackedObject);
            }


            // generate trials
            session.CreateBlock(10);
        }
        public void SetUp()
        {
            gameObject    = new GameObject();
            fileIOManager = gameObject.AddComponent <FileIOManager>();
            sessionLogger = gameObject.AddComponent <SessionLogger>();
            session       = gameObject.AddComponent <Session>();

            session.AttachReferences(
                fileIOManager
                );

            sessionLogger.AttachReferences(
                fileIOManager,
                session
                );

            sessionLogger.Initialise();

            fileIOManager.debug = true;
        }
        public PinglishVerifier() : base(0, 0)
        {
            #region Transliteration Config

            var config = new PinglishConverterConfig();

            config.ExceptionWordDicPath = SettingsHelper.GetFullPath(
                Constants.ExceptionWordsFileName, VirastyarFilePathTypes.AllUsersFiles);
            config.GoftariDicPath = SettingsHelper.GetFullPath(
                Constants.GoftariDicFileName, VirastyarFilePathTypes.AllUsersFiles);
            config.StemDicPath = SettingsHelper.GetFullPath(
                Constants.StemFileName, VirastyarFilePathTypes.AllUsersFiles);

            config.XmlDataPath = SettingsHelper.GetFullPath(
                Constants.PinglishFileName, VirastyarFilePathTypes.AllUsersFiles);

            #endregion

            m_pinglishConverter = new PinglishConverter(config, PruneType.Stem, false);

            this.m_sessionLogger = new SessionLogger();
        }
        public void SetUp()
        {
            gameObject    = new GameObject();
            fileSaver     = gameObject.AddComponent <FileSaver>();
            sessionLogger = gameObject.AddComponent <SessionLogger>();
            session       = gameObject.AddComponent <Session>();

            sessionLogger.AttachReferences(
                session
                );

            session.dataHandlers = new DataHandler[] { fileSaver };

            sessionLogger.Initialise();

            fileSaver.storagePath  = "example_output";
            fileSaver.verboseDebug = true;

            string experimentName = "unit_test";
            string ppid           = "test_trackers";

            session.Begin(experimentName, ppid);


            for (int i = 0; i < 5; i++)
            {
                GameObject trackedObject = new GameObject();
                Tracker    tracker       = trackedObject.AddComponent <PositionRotationTracker>();
                tracker.objectName = string.Format("Tracker_{0}", i);

                session.trackedObjects.Add(tracker);
                tracked.Add(trackedObject);
            }


            // generate trials
            session.CreateBlock(10);
        }
 /// <summary>
 /// Attach a navigation failed event handler to every region
 /// </summary>
 /// <param name="regions"></param>
 private void MonitorRegions(IEnumerable <IRegion> regions)
 {
     foreach (var region in regions)
     {
         Debug.WriteLine("RegionNavigationService: {0:X}", region.NavigationService.GetHashCode()); // prove that they're all unique
         var r = region;
         region.NavigationService.NavigationFailed += (s, e) =>
         {
             var msg = $"Error navigating to view {e.NavigationContext.Uri} for region {r.Name}";
             SessionLogger.Write(e.Error, msg);
             EventManager.GetEvent <GenericNotificationEvent>().Publish(msg);
         };
         region.NavigationService.Navigating += (s, e) =>
         {
             SessionLogger.Debug("Loading view: '{1}' for region '{0}'", r.Name,
                                 e.NavigationContext.Uri);
         };
         region.NavigationService.Navigated += (s, e) =>
         {
             SessionLogger.Debug("Loading complete: view '{1}' for region '{0}'", r.Name,
                                 e.NavigationContext.Uri);
         };
     }
 }
Exemple #26
0
 void Completed()
 {
     SessionLogger.LogComplete(this);
     Disable();
 }
Exemple #27
0
 void Started()
 {
     SaveSessionData();
     SessionLogger.Log(this);
 }
        private void ReadThread()
        {
            try
            {
                string[] paths = GetPaths();

                m_TotalMaximumBytes  = 0;
                m_TotalProgressBytes = 0;

                m_MaximumBytes  = 0;
                m_ProgressBytes = 0;

                foreach (string path in paths)
                {
                    m_TotalMaximumBytes += new FileInfo(path).Length;
                }

                foreach (string path in paths)
                {
                    try
                    {
                        FileInfo info = new FileInfo(path);

                        m_TotalProgressBytes += m_ProgressBytes;

                        m_CurrentFile = info.Name;

                        m_MaximumBytes  = info.Length;
                        m_ProgressBytes = 0;

                        string directory = directorySelector.SelectedPath;

                        using (m_Connection = new Connection(new SDCardFileConnectionInfo()
                        {
                            FilePath = path
                        }))
                            using (m_Logger = new SessionLogger(SessionSettings.CreateForFileAndPath(directory, info), m_Connection))
                            {
                                m_Logger.Start();

                                m_Connection.Message += new MessageEvent(m_Connection_Message);
                                m_Connection.Connect();

                                m_Logger.Stop();
                            }
                    }
                    catch (Exception ex)
                    {
                        this.InvokeShowError(ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                this.InvokeShowError(ex.Message);
            }
            finally
            {
                //IsRunning = false;
                this.Invoke(new Action(Done));
            }
        }