public frmNewQuizWizard(ref IniLoader iniIn)
 {
     InitializeComponent();
     ini = iniIn;
     txtNameKeyword.Text = "default";
     cbxUpdateType.SelectedIndex = 1;
 }
        public frmQuizManager(TriviaQuizData quizIn)
        {
            InitializeComponent();

            quizData = quizIn;
            ini = quizIn.Ini;
            unsavedChanges = false;
            currentKeyword = quizData.Keyword;

            FinishInit();
        }
        public frmQuizManager(ref frmNewQuizWizard quizWizardIn, ref IniLoader iniIn)
        {
            InitializeComponent();

            ini = iniIn;
            if (quizWizardIn.WizardUsed) quizData = new TriviaQuizData(ref quizWizardIn, ref ini);
            else quizData = null;
            unsavedChanges = quizWizardIn.WizardUsed;
            currentKeyword = null;

            FinishInit();
        }
Esempio n. 4
0
        private void abrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Filter           = "All files (*.*)|*.*|Disp Script (*.ds)|*.disp|Disp Project (*.dsp)|*.dsp|Disp Program (*.dp)|*.dp|Disp Project (*.dsproj)|*.dsproj";
            openFileDialog1.FilterIndex      = 2;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                int    counter = 0;
                string line;


                FileName = openFileDialog1.FileName;

                if (FileName.EndsWith(".dsproj"))
                {
                    IniFile inifile      = IniLoader.LoadInitiator(FileName);
                    Section project      = inifile.Search("Project");
                    Key     name         = project.Search("Name");
                    Key     FileNameMain = project.Search("FileName");

                    MainFile = FileNameMain.Value;

                    ProjectName = name.Value;


                    ProjectDir = Directory.GetParent(FileName).ToString();

                    rootNode            = treeView1.Nodes.Add(ProjectName);
                    rootNode.ImageIndex = 2;

                    LoadFiles();
                }
                else
                {
                    System.IO.StreamReader file = new System.IO.StreamReader(FileName);

                    while ((line = file.ReadLine()) != null)
                    {
                        //rtbProgram.AppendText(line + Environment.NewLine);
                        counter++;
                    }

                    file.Close();
                }

                Salvo = true;
            }
        }
        public TriviaQuestionData(TriviaQuestionData questionIn)
        {
            ini = questionIn.Ini;
            question = questionIn.Question;
            category = questionIn.Category;
            maxAttempts = questionIn.MaxAttempts;
            timeLimit = questionIn.TimeLimit;
            questionValue = questionIn.QuestionValue;
            ansType = questionIn.AnsType;
            someOfCount = questionIn.SomeOfCount;
            anstokens = new ArrayList();
            for (int X = 0; X < questionIn.ACount; X++) anstokens.Add(questionIn.A(X));

            unsavedChanges = questionIn.UnsavedChanges;
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            if (args.Length == 1 && File.Exists(args[0]) && Path.GetExtension(args[0]).ToLower() == ".xml")
            {
                string exeDir     = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\";
                string firstLevel = Path.GetFileNameWithoutExtension(args[0]);

                //Try to open the ini
                IniLoader gIni = new IniLoader(exeDir + "Content\\WIZZ.ini");
                gIni.ModifyValue("startOnLevel", firstLevel);
                gIni.ModifyValue("showMenuOnStart", "false");
                gIni.WriteOutModified(exeDir + "Content\\WIZZ.ini");
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            if (args.Length == 1 && File.Exists(args[0]) && Path.GetExtension(args[0]).ToLower() == ".xml")
            {
                string exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\";
                string firstLevel = Path.GetFileNameWithoutExtension(args[0]);

                //Try to open the ini
                IniLoader gIni = new IniLoader(exeDir + "Content\\WIZZ.ini");
                gIni.ModifyValue("startOnLevel", firstLevel);
                gIni.ModifyValue("showMenuOnStart", "false");
                gIni.WriteOutModified(exeDir + "Content\\WIZZ.ini");
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
Esempio n. 8
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            this.FormMain.ProjectDir  = txtCaminhoProjeto.Text;
            this.FormMain.ProjectName = txtNomeProjeto.Text;

            Directory.CreateDirectory(txtCaminhoProjeto.Text);

            Project     proj   = new Project(txtNomeProjeto.Text, "main.ds", Disp._Model.Project.PROJECT_TYPE.FULL, "1.0.0.0", "");
            VersionInfo info   = new VersionInfo();
            Script      script = new Script();

            IniFile inifile = Project.LoadDefault(proj, info, script);

            IniLoader.RecordInitiator(inifile, Path.Combine(txtCaminhoProjeto.Text, "project.dsproj"));

            this.FormMain.LoadProject();

            this.Dispose();
        }
        public TriviaQuestionData(ref IniLoader iniIn, string qSection, int qNum)
        {
            string qTemplate = "q" + qNum.ToString();
            int answers;

            ini = iniIn;

            question = ini.GetIniString(qSection, qTemplate + "question", "Missing question...");
            category = ini.GetIniString(qSection, qTemplate + "cat", "");
            maxAttempts = ini.GetIniInteger(qSection, qTemplate + "maxattempts", -1);
            timeLimit = ini.GetIniInteger(qSection, qTemplate + "timelimit", -1);
            questionValue = ini.GetIniInteger(qSection, qTemplate + "value", -1);
            ansType = DetermineAnswerType(ini.GetIniString(qSection, qTemplate + "atype", "anyof"));
            answers = ini.GetIniInteger(qSection, qTemplate + "acount", 1);
            someOfCount = ini.GetIniInteger(qSection, qTemplate + "aneed", -1);
            anstokens = new ArrayList();

            if (ansType == AnswerType.Unknown)
            {
                MessageBox.Show("Unrecognized answer type in question #" + (qNum + 1).ToString() + ". Defaulting to \"Any Of\".",
                                "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ansType = AnswerType.AnyOf;
            }

            if (answers > 26 && ansType == AnswerType.MultipleChoice)
            {
                MessageBox.Show("There are over 26 answers to multiple choice question #" + (qNum + 1).ToString() +
                                ". This quiz will not load in Parlour Trivia unless the number of answers is reduced.",
                                "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            if (answers < 1)
            {
                MessageBox.Show("There are no answers to question #" + (qNum + 1).ToString() + ".",
                                "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else for (int X = 0; X < answers; X++)
                    anstokens.Add(ini.GetIniString(qSection, qTemplate + "a" + X.ToString(), "Missing answer..."));

            unsavedChanges = false;
        }
Esempio n. 10
0
    /// <summary>
    /// LoadContent will be called once per game and is the place to load
    /// all of your content.
    /// </summary>
    protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures.

        IniLoader gIni = new IniLoader("Content\\WIZZ.ini");
        string    firstLevel;

        gIni.GetString("startOnLevel", out firstLevel, "MAIN");
        gIni.GetBool("drawNormals", out drawNormals, false);
        string levelPath;

        gIni.GetString("levelPath", out levelPath, Constants.LEVEL_PATH);

        spriteBatch = new SpriteBatch(GraphicsDevice);
        testLevel   = GLEED2D.Level.FromFile(levelPath + firstLevel + ".xml", Content);
        Utilities.Init(Content);

        SuperHackyLevelParsing();

        m_player = (Player)EntityManager.get().Create(EntityManager.ENT_TYPE.PLAYER);
        m_player.Init(Content);
        m_player.Spawn();
        // TODO: use this.Content to load your game content here
    }
        public TriviaQuestionData()
        {
            ini = null;
            question = "";
            category = "";
            maxAttempts = -1;
            timeLimit = -1;
            questionValue = -1;
            ansType = AnswerType.AnyOf;
            someOfCount = 1;
            anstokens = new ArrayList();

            unsavedChanges = false;
        }
Esempio n. 12
0
    /// <summary>
    /// LoadContent will be called once per game and is the place to load
    /// all of your content.
    /// </summary>
    protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures.

            IniLoader gIni = new IniLoader("Content\\WIZZ.ini");
            string firstLevel;

            gIni.GetString("startOnLevel", out firstLevel,"MAIN");
            gIni.GetBool("drawNormals", out drawNormals, false);
            string levelPath;
            gIni.GetString("levelPath", out levelPath, Constants.LEVEL_PATH);

            spriteBatch = new SpriteBatch(GraphicsDevice);
            testLevel = GLEED2D.Level.FromFile(levelPath + firstLevel + ".xml", Content);
            Utilities.Init(Content);

            SuperHackyLevelParsing();

            m_player = (Player)EntityManager.get().Create(EntityManager.ENT_TYPE.PLAYER);
            m_player.Init(Content);
            m_player.Spawn();
            // TODO: use this.Content to load your game content here
    }