コード例 #1
0
ファイル: frmSearch.cs プロジェクト: arunagiritm/cygwinsearch
        private void frmSearch_Load(object sender, EventArgs e)
        {

            panel2.Dock = DockStyle.Fill;
            panel1.Visible = false;
            string scriptxmlpath = ConfigurationManager.AppSettings["scriptxmlpath"].ToString();
            txtCygwinPath.Text = ConfigurationManager.AppSettings["cygwinpath"].ToString();
            txtCodePath.Text = ConfigurationManager.AppSettings["codepath"].ToString();
            txtScriptPath.Text = ConfigurationManager.AppSettings["scriptshellpath"].ToString();
            txtEditorPath.Text = ConfigurationManager.AppSettings["editorpath"].ToString();
            cygwinmodel = CygwinHelper.GetScriptDetails(scriptxmlpath);

            //cmbscript.Text = "findInJava";
            //txtparam1.Text = "member";
            //txtparam2.Text = "member";
            foreach (ScriptCommand cmd in cygwinmodel.commands)
            {
                cmbscript.Items.Add(cmd.name);
            }

            if (ConfigurationManager.AppSettings["firsttime"] == "1")
            {
                MessageBox.Show("Set configuration setting on first run");
                CygwinHelper.WriteAppsettingToConfig("firsttime", "0");
                cygwinConfigToolStripMenuItem_Click(new object(), new EventArgs());
            }
        }
コード例 #2
0
        public static CygwinModel  GetScriptDetails(string filename)
        {
            CygwinModel cygwinModel = new CygwinModel();
            try
            {
                XmlSerializer xs = new XmlSerializer(cygwinModel.GetType());
                using (TextReader reader = new StreamReader(filename))
                {
                    cygwinModel = (CygwinModel)xs.Deserialize(reader);
                }
            }
            catch (Exception)
            {

                throw;
            }
            return cygwinModel;
        }
コード例 #3
0
        public static Boolean SaveScriptDetails(CygwinModel cygwinModel, string filename)
        {
            try
            {

                XmlSerializer xs = new XmlSerializer(cygwinModel.GetType());
                using (TextWriter writer = new StreamWriter(filename))
                {
                    xs.Serialize(writer, cygwinModel);
                }
            }
            catch (Exception)
            {

                throw;
            }
            return true;
        }