예제 #1
0
 public void onModifyExpDlgClosing(string _iName, ExportInfo info)
 {
     if (exportInfoDict.ContainsKey(_iName))
     {
         exportInfoDict[_iName] = info;
         string expinfopath = FguiLocation + "\\settings\\exportinfo.json";
         File.WriteAllText(expinfopath, JsonConvert.SerializeObject(exportInfoDict));
     }
 }
예제 #2
0
        private void modifyExportPath(ExportInfo info)
        {
            List <string> dirs = Directory.GetDirectories(FguiLocation, "*", SearchOption.TopDirectoryOnly).ToList();

            foreach (string dir in dirs)
            {
                string lastfolderName = Path.GetFileName(dir);
                if (Global.ContainStr(lastfolderName, "assets"))
                {
                    List <string> sdirs = Directory.GetDirectories(dir, "*", SearchOption.TopDirectoryOnly).ToList();
                    if (sdirs.Count < 1)
                    {
                        return;
                    }
                    string[] fileEntries = Directory.GetFiles(sdirs[0], "*.xml");
                    foreach (string fileName in fileEntries)
                    {
                        string curFile = Path.GetFileName(fileName).Split('.')[0];
                        if (!Global.ContainStr(curFile, "package"))
                        {
                            continue;
                        }
                        //Console.WriteLine(fileName);
                        XDocument xmlFile = XDocument.Load(fileName);
                        var       query   = from c in xmlFile.Elements("packageDescription").Elements("publish") select c;
                        foreach (XElement book in query)
                        {
                            book.Attribute("name").Value = info.PackageName;
                        }
                        xmlFile.Save(fileName);
                    }
                }

                if (Global.ContainStr(lastfolderName, "settings"))
                {
                    string settingjsonpath = dir + "/Publish.json";
                    if (!File.Exists(settingjsonpath))
                    {
                        continue;
                    }
                    //Console.WriteLine(settingjsonpath);
                    JObject publishjson = JObject.Parse(File.ReadAllText(settingjsonpath));
                    publishjson["path"]       = info.ExportPath;
                    publishjson["branchPath"] = info.ExportPath_Branch;
                    using (FileStream fs = File.Open(settingjsonpath, FileMode.OpenOrCreate))
                        using (StreamWriter sw = new StreamWriter(fs))
                            using (JsonTextWriter jw = new JsonTextWriter(sw))
                            {
                                jw.Formatting = Formatting.Indented;
                                //jw.IndentChar = '\t';
                                //jw.Indentation = 1;
                                publishjson.WriteTo(jw);
                            }
                }
            }
        }
예제 #3
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (isFairyRunning())
            {
                MessageBox.Show("請先關閉 FairyGui Editor 以繼續");
                return;
            }

            foreach (var proc in Process.GetProcessesByName("FairyGUI-Editor"))
            {
                proc.Kill();
            }
            if (exeLocation.Length < 1)
            {
                MessageBox.Show("請先執行場景資源掃描以繼續");
                return;
            }
            if (!File.Exists(exeLocation))
            {
                return;
            }

            string     selstr  = combo_exp.Items[combo_exp.SelectedIndex].ToString();
            ExportInfo expinfo = new ExportInfo();

            if (selstr.Length > 0)
            {
                expinfo = exportInfoDict[selstr];
            }

            modifyExportPath(expinfo);

            // open the export target folder
            string tgtdir = retrieveDir(FguiLocation, expinfo.ExportPath_Branch.Replace('\\', '/'));

            if (Directory.Exists(tgtdir))
            {
                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    Arguments = tgtdir,
                    FileName  = "explorer.exe"
                };
                Process.Start(startInfo);
            }

            // Start Export Thread
            ParameterizedThreadStart starterp = new ParameterizedThreadStart(startexportThread);
            Thread           a    = new Thread(starterp);
            ExportThreadParm parm = new ExportThreadParm();

            parm.selstr            = selstr;
            parm.ExportPath_Branch = expinfo.ExportPath_Branch;
            a.Start(parm);
        }
예제 #4
0
 public modifyPackageForm(string iName, ExportInfo info, FguiToolkitForm parentform)
 {
     InitializeComponent();
     this.FormClosing    += Form1_Closing;
     this.exportInfo      = info;
     this._iName          = iName;
     _parentform          = parentform;
     txtGroupName.Text    = iName;
     txtPkgName.Text      = this.exportInfo.PackageName;
     txtExpPath.Text      = this.exportInfo.ExportPath;
     txtBrExpPath.Text    = this.exportInfo.ExportPath_Branch;
     txtGroupName.Enabled = false;
     KeyPreview           = true;
     this.KeyDown        += new KeyEventHandler(Form1_KeyDown);
 }
예제 #5
0
        private void btnModifyExp_Click(object sender, EventArgs e)
        {
            if (this.combo_exp.Items.Count < 1)
            {
                return;
            }
            string            _iName = this.combo_exp.Items[this.combo_exp.SelectedIndex].ToString();
            ExportInfo        info   = exportInfoDict[_iName];
            modifyPackageForm mf     = new modifyPackageForm(_iName, info, this);

            mf.TopMost       = true;
            mf.StartPosition = FormStartPosition.Manual;
            mf.Location      = new Point(this.Location.X, this.Location.Y + 10);
            mf.ShowDialog();
        }
예제 #6
0
        private void Form1_Closing(object sender, FormClosingEventArgs e)
        {
            StringBuilder sb           = new StringBuilder(255);
            int           t            = Global.GetPrivateProfileString("FGUI", "Location", "", sb, 255, Application.StartupPath + "\\Config.ini");
            string        FguiLocation = sb.ToString();

            if (FguiLocation.Length > 0)
            {
                ExportInfo expinfo = new ExportInfo();

                expinfo.PackageName               = txtPkgName.Text;
                expinfo.ExportPath                = txtExpPath.Text;
                expinfo.ExportPath_Branch         = txtBrExpPath.Text;
                exportInfoDict[txtGroupName.Text] = expinfo;
                string expinfopath = FguiLocation + "\\settings\\exportinfo.json";
                File.WriteAllText(expinfopath, JsonConvert.SerializeObject(exportInfoDict));
                _parentform.onAddExpDlgClosing(exportInfoDict);
            }
        }