Exemplo n.º 1
0
        private bool mUserWasDisconnected; // User was disconnected due to server/network crash

        #endregion Fields

        #region Constructors

        public Network(UserManager prUserManager, QuestionManager prQuestionManager, 
            AnswerManager prAnswerManager, IOProcessor prIOProcessor, ChatManager prChatManager)
        {
            mIOProcessor = prIOProcessor;
            mQuestionManager = prQuestionManager;
            mUserManager = prUserManager;
            mAnswerManager = prAnswerManager;
            mChatManager = prChatManager;
            mTutor = new User();
        }
Exemplo n.º 2
0
    private void Save(string filePath)
    {
        var views  = _worldObjectContainer.GetComponentsInChildren <IWorldObjectView>();
        var models = new IWorldObjectModel[views.Length];

        for (int i = 0; i < views.Length; i++)
        {
            models[i] = views[i].Model;
        }

        IOProcessor.Save(filePath, models);
    }
Exemplo n.º 3
0
        private bool ReadCountries()
        {
            Towns             = new Town[Constants.Dimension, Constants.Dimension];
            NumberOfCountries = 0;
            m_countries       = new List <Country>();

            NumberOfCountries = IOProcessor.ReadNumberOfCountries();
            if (NumberOfCountries == 0)
            {
                return(false);
            }
            else if (NumberOfCountries < 0)
            {
                Errors.WriteFatalError("ReadNumberOfCountries()");
                return(false);
            }

            for (int i = 0; i < NumberOfCountries; i++)
            {
                Country country = IOProcessor.ReadCountry(i);

                if (country.IsEmpty())
                {
                    Errors.WriteFatalError($"ReadCountry({i})");
                    return(false);
                }

                //setting all country`s towns on map
                for (int x = country.FirstCoord.X; x <= country.SecondCoord.X; x++)
                {
                    for (int y = country.FirstCoord.Y; y <= country.SecondCoord.Y; y++)
                    {
                        if (Towns[x, y] != null)
                        {
                            Errors.WriteFatalError("Logical error: can`t set Town again.");
                            return(false);
                        }

                        Towns[x, y] = new Town(new Point(x, y), country, NumberOfCountries);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 4
0
        public DSystem()
        {
            _scheduler = new Scheduler();

            _cp  = new CentralProcessor(this);
            _iop = new IOProcessor(this);
            _memoryController   = new MemoryController();
            _displayController  = new DisplayController(this);
            _hardDrive          = new SA1000Drive(this);
            _shugartController  = new ShugartController(this, _hardDrive);
            _ethernetController = new EthernetController(this);

            try
            {
                _frameTimer = new FrameTimer(38.7);
            }
            catch
            {
                // Not supported on this platform.
                _frameTimer = null;
            }
        }
Exemplo n.º 5
0
    private void Load(string filePath)
    {
        JSONArray jsonArray = IOProcessor.Load(filePath);

        for (int i = 0; i < jsonArray.Count; i++)
        {
            JSONNode          node = jsonArray[i];
            IWorldObjectModel model;
            if (node["type"].Value == WorldObjectType.LIGHT.ToString())
            {
                model = new LightModel();
            }
            else
            {
                model = new ShapeModel();
            }
            model.FromJSON(node);

            var objInstace = AddViewInstance(model.Type);
            objInstace.Model = model;
        }
    }
Exemplo n.º 6
0
 internal void setHandle(Main main)
 {
     mfm = main;
     iop = mfm.iop;
     iop.SetMainHandle(mfm);
 }
Exemplo n.º 7
0
 internal void SetActiveScript(MyInput.Keyboard_Classes.KeyProcessor kp)
 {
     ScriptName = kp.getscript();
     this.iop   = mfm.iop;
 }
Exemplo n.º 8
0
        public frmMain()
        {
            InitializeComponent();

            mMessageLogger = new MessageLogger();
            mChatManager = new ChatManager();
            mUserManager = new UserManager(mMessageLogger);
            mQuestionManager = new QuestionManager(mUserManager);
            mAnswerManager = new AnswerManager();
            mIOProcessor = new IOProcessor(mMessageLogger, mUserManager,
                mQuestionManager, mAnswerManager, mChatManager);

            //mIOProcessor = new IOProcessor(mMessageLogger, mUserManager);
            mNetwork = new Network(mMessageLogger, mUserManager, mQuestionManager, mAnswerManager, mIOProcessor);

            // Load the registered tutors
            if (!mUserManager.LoadTutors("tutors.xml"))
            {
                mMessageLogger.NewMessage("Can't load file \"tutors.xml\" or the contents in it. " +
                    "Please use the admin tool to recreate it", mMessageLogger.MESSAGE_ERROR);
            }

            mUser = new User();

            mRunning = true;

            mDictionarySerialiser = new DictionarySerialiserMethods();

            // Attempt to load questions from the questions.xml file
            if (LoadQuestions("questions.xml") == false)
            {
                // Add some demo questions if none could be loaded from a file
                question iDemoQuestion = new question();

                // Multi-choice
                iDemoQuestion.QuestionID = 0;
                iDemoQuestion.Question = "How many days in a week?";
                iDemoQuestion.QuestionType = "MC";
                iDemoQuestion.PossibleAnswers = new string[4] { "Ten", "Three", "Seven", "Nine" };
                iDemoQuestion.Answer = "Seven";
                mQuestionManager.AddNewQuestion(iDemoQuestion);

                // True/False
                iDemoQuestion = new question();
                iDemoQuestion.QuestionID = 1;
                iDemoQuestion.Question = "Fire burns?";
                iDemoQuestion.QuestionType = "TF";
                iDemoQuestion.PossibleAnswers = new string[4] { "True", "False", "", "" };
                iDemoQuestion.Answer = "True";
                mQuestionManager.AddNewQuestion(iDemoQuestion);

                // Short Answer
                iDemoQuestion = new question();
                iDemoQuestion.QuestionID = 2;
                iDemoQuestion.Question = "What is 5x5?";
                iDemoQuestion.QuestionType = "SA";
                iDemoQuestion.PossibleAnswers = new string[4] { "", "", "", "" };
                iDemoQuestion.Answer = "";
                mQuestionManager.AddNewQuestion(iDemoQuestion);
            }
            mTimer = new System.Timers.Timer(1000);
            mTimer.Elapsed += new ElapsedEventHandler(TimeElapsed);
            mTimer.Enabled = true;
        }
Exemplo n.º 9
0
 public void setHandle(Main mf)
 {
     mfm = mf;
     iop = mf.iop;
     iop.SetMainHandle(mfm);
 }
Exemplo n.º 10
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //MessageBox.Show("This version of MyInput Beta is for use by \r\nMyanmar Posts and Telecommunications\r\nfor demonstration purpose at ICT Week.\r\nAll other rights reserved.\r\nCopyright 2000-2010\r\nTechnomation Studios.");
            //UserInterface.Glass.ExtendGlassIntoClientArea(this, 0, 0, Width, Height);
            kp  = new KeyProcessor("NULL");
            iop = new IOProcessor(kp);
            iop.SetMainHandle(this);
            imp = new IMEProcessor(kime, this, iop);
            //kl = new KeyboardLayout("NULL");
            dkstate = "none";
            cfg     = new Config("MyInput\\");
            //cfg.Write("embed-crypt", EmbeddingControl.createPublicKey("589114946"));
            int    xxx     = Screen.GetWorkingArea(this).Width - this.Width + 1;
            int    yyy     = Screen.GetWorkingArea(this).Height - this.Height;
            string left    = cfg.Read("mfx", xxx.ToString());
            string percent = cfg.Read("ypercent", Pixel2Percent(yyy, Screen.GetWorkingArea(this).Height).ToString());

            this.Top     = Percent2Pixel(Convert.ToDouble(percent), Screen.GetWorkingArea(this).Height);
            this.Left    = Convert.ToInt32(left);
            togglekey    = Convert.ToInt32(cfg.Read("toggle", "119"));
            scrkey       = Convert.ToInt32(cfg.Read("scriptshortcut", "122"));
            osk          = Convert.ToInt32(cfg.Read("osk", "121"));
            enableenable = Convert.ToBoolean(cfg.Read("enableenable", "true"));
            toggleenable = Convert.ToBoolean(cfg.Read("toggleenable", "true"));
            screnable    = Convert.ToBoolean(cfg.Read("screnable", "true"));
            autohide     = Convert.ToBoolean(cfg.Read("autoshow", "true"));
            oskenable    = Convert.ToBoolean(cfg.Read("oskenable", "true"));
            virtualize   = Convert.ToBoolean(cfg.Read("virtualize", "true"));
            Layouts      = new ArrayList();
            Scripts      = new ArrayList();
            string[] s = System.IO.Directory.GetFiles("Layouts\\");
            foreach (string x in s)
            {
                if (x.EndsWith(".keylayout"))
                {
                    string         ss = Directory.GetCurrentDirectory() + "\\" + x;
                    KeyboardLayout kl = new KeyboardLayout(ss);
                    if (kl.getname() != null)
                    {
                        Layout l = new Layout();
                        l.name    = kl.getname();
                        l.isIME   = false;
                        l.scripts = kl.getScripts();
                        Layouts.Add(l);
                    }
                    kl = null;
                }
                else if (x.EndsWith(".dll"))
                {
                    Layout l = new Layout();
                    l.name    = x.Substring(x.LastIndexOf("\\") + 1);
                    l.name    = l.name.Substring(0, l.name.IndexOf("."));
                    l.isIME   = true;
                    l.scripts = null;
                    Layouts.Add(l);
                }
            }
            s = System.IO.Directory.GetFiles("Scripts\\");
            foreach (string x in s)
            {
                string ss = Directory.GetCurrentDirectory() + "\\" + x;
                if (ss.EndsWith(".ikl"))
                {
                    ss = ss.Substring(ss.LastIndexOf("\\") + 1);
                    ss = ss.Substring(0, ss.Length - 4);
                    if (!ScriptExists(ss))
                    {
                        Scripts.Add(ss);
                    }
                }
                else if (ss.EndsWith(".ikb"))
                {
                    ss = ss.Substring(ss.LastIndexOf("\\") + 1);
                    ss = ss.Substring(0, ss.Length - 4);
                    if (!ScriptExists(ss))
                    {
                        Scripts.Add(ss);
                    }
                }
            }

            foreach (string sx in Scripts)
            {
                ToolStripMenuItem i = new ToolStripMenuItem(sx);
                i.Click += ScriptClick;
                scripts_menu.Items.Add(i);
            }

            foreach (Layout l in Layouts)
            {
                ToolStripMenuItem i = new ToolStripMenuItem(l.name);
                i.Click += LayoutClick;
                layouts.Items.Add(i);
            }


            string lay = cfg.Read("layout", "Type Writer");
            string scr = cfg.Read("script", "MM Unicode");

            if (LayoutExists(lay))
            {
                laybtn.Text = lay;
            }
            else
            {
                laybtn.Text = "Type Writer";
            }
            if (ScriptExists(scr))
            {
                UpdateScript(scr);
            }
            else
            {
                UpdateScript("MM Unicode");
            }
            System.GC.Collect();
            if (!true)
            {
                try
                {
                    string sss = cfg.Read("embed-crypt");
                    if (EmbeddingControl.isValid(sss))
                    {
                        embedcrypt.Enabled = true;
                        actv.Enabled       = false;
                        scrbtn.Enabled     = false;
                        laybtn.Enabled     = false;
                        //glassButton4.Enabled = false;
                    }
                    else
                    {
                        //internet();
                    }
                }
                catch (Exception ex)
                {
                    //internet();
                }
            }
            else
            {
                enablekey = Convert.ToInt32(cfg.Read("enable", "120"));
            }
            this.Refresh();
            Program.kh.SetHandle(this);
            Program.kh.Initiate();
        }