示例#1
0
文件: MainForm.cs 项目: emm274/fcObj
        private void MapToJsonItem_Click(object sender, EventArgs e)
        {
            string filter = String.Format("Files (*.{0})|*.{0}", "dm");
            string title = "Экспорт карты в json";
            string path;
            bool rc = XFiles.dialFile(ref fdataDir, filter, title, null, true, out path);

            if (rc)
            {
                tsLoaderMap loader = new tsLoaderMap();

                string json = Path.ChangeExtension(path, ".json");
                string msg = Path.GetFileName(json);

                message(String.Format("Export to json \"{0}\"", msg));

                string branch = "export";
                string comment = Path.GetFileName(json);

                loader.message = task_msg;
                loader.workDir(fworkDir);
                loader.exec(path, null, json, branch, comment);
            }
        }
示例#2
0
文件: MainForm.cs 项目: emm274/fcObj
        void load_map(bool updates, string ext, string title)
        {
            lbMsg.Clear();

            string branch = selectedBranch();
            if (branch == null)
                message("Не указана ветка!");
            else
            {
                string filter = String.Format("Files (*.{0})|*.{0}",ext);
                string path;
                bool rc = XFiles.dialFile(ref fdataDir, filter, title, null, true, out path);

                if (rc)
                {
                    tsLoaderMap loader = new tsLoaderMap();

                    string main = null;
                    if (updates) {
                        filter = "Files (*.dm)|*.dm";
                        string title1 = "Базовая карта для "+Path.GetFileName(path);

                        string fname = loader.GetBaseMap(path);
                        rc = XFiles.dialFile(ref fdataDir, filter, title1, fname, true, out main);
                    }

                    if (rc) {
                        DateTime now = DateTime.Now;
                        string msg = Path.GetFileName(path)+" "+now.ToString();

                        EnterText dlg = new EnterText(fini);
                        dlg.Caption = "commit";
                        dlg.Title = branch;
                        dlg.text = msg;

                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            string comment = dlg.text;

                            message(String.Format("{0}: +commit \"{1}\"", branch, comment));

                            string json = Path.ChangeExtension(path, ".json");

                            loader.message = task_msg;
                            loader.workDir(fworkDir);
                            rc = loader.exec(path, main, json, branch, comment);

                            if (rc) fdb.commit(branch, json, after_commit);
                        }
                    }
                }
            }
        }