예제 #1
0
 private void file_Build_ListItem_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (file_Build_ListItem.SelectedItem != null)
     {
         string name  = file_Build_ListItem.SelectedItem.ToString();
         int    index = _listApps.FindIndex(x => x.Name == name);
         if (index >= 0)
         {
             _app = _listApps[index];
             project_BindUI();
         }
     }
 }
예제 #2
0
        private static void ReadFile()
        {
            if (!File.Exists(_file))
            {
                WriteFile();
                return;
            }

            using (Stream file = File.OpenRead(_file))
            {
                _app = Serializer.Deserialize <oApp>(file);
            }
        }
예제 #3
0
        public static List <string> get_DefineDefault()
        {
            oApp app = null;

            if (!File.Exists(_file))
            {
                return(null);
            }

            using (Stream file = File.OpenRead(_file))
                app = Serializer.Deserialize <oApp>(file);
            return(app.Defines);
        }
예제 #4
0
        void build_AddNew()
        {
            if (!Directory.Exists(m_explorer_PathCurrent))
            {
                MessageBox.Show("Please chose folder contain source CPP in tab Explorer!", _CONST.APP_NAME);
                return;
            }
            string defValue = Path.GetFileName(m_explorer_PathCurrent);
            string name     = Prompt.ShowDialog("Input build file name:", _CONST.APP_NAME, defValue);

            if (!string.IsNullOrEmpty(name))
            {
                string _file = Path.Combine(m_build_PathRoot, name + ".bgcc");
                if (!File.Exists(_file))
                {
                    _app = new oApp()
                    {
                        Name = name, PathRootCpp = m_explorer_PathCurrent
                    };
                    if (tabGCC.Tag != null)
                    {
                        _app.update_GCC((oGCC)tabGCC.Tag);
                    }
                    if (tabDefine.Tag != null)
                    {
                        _app.set_Define((List <string>)tabDefine.Tag);
                    }

                    using (Stream ms = new FileStream(_file, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write))
                        Serializer.Serialize(ms, _app);
                    project_loadInit();
                    int index = _listApps.FindIndex(x => x.Name == name);
                    if (index >= 0)
                    {
                        _app = _listApps[index];
                        project_BindUI();
                    }
                }
                else
                {
                    MessageBox.Show("File " + name + ".bgcc exist, Input other name...", _CONST.APP_NAME);
                    build_AddNew();
                }
            }
        }
예제 #5
0
 void project_loadInit()
 {
     _listApps = Directory.GetFiles(m_build_PathRoot, "*.bgcc")
                 .Select(x => Serializer.Deserialize <oApp>(File.OpenRead(x)))
                 .Where(x => x != null && Directory.Exists(x.PathRootCpp))
                 .ToList();
     file_Build_ListItem.DataSource = null;
     file_Build_ListItem.DataSource = _listApps.Select(x => x.Name).ToArray();
     if (_listApps.Count > 0)
     {
         _app = _listApps[0];
         project_BindUI();
     }
     else
     {
         fileBrowser1.SelectPath(@"C:\", true);
     }
 }