示例#1
0
        public static string Open(string Title, IDEComponent.ComponentType Type, string Data, int[] Index, string Event)
        {
            string r = Data;

            if (IDEConfig.IsDefaultEditor)
            {
                using (var form = new CodeEditor())
                {
                    form.Text = Title;
                    form.SetData(Data);
                    var result = form.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        r = form.GetData();
                    }
                    form.Close();
                }
            }
            else
            {
                string path = GameConfig.path + @"\Codes";
                switch (Type)
                {
                case IDEComponent.ComponentType.Object:
                    path += @"\Objects\obj";
                    break;

                case IDEComponent.ComponentType.Room:
                    path += @"\Rooms\room";
                    break;

                case IDEComponent.ComponentType.Script:
                    path += @"\Scripts\script";
                    break;

                case IDEComponent.ComponentType.UI:
                    path += @"\UIs\ui";
                    break;

                case IDEComponent.ComponentType.UIComponent:
                    path += @"\UIs\ui" + Index[1] + @"\components\component";
                    break;
                }
                path += Event == null ? Index[0].ToString() + ".js" : Index[0].ToString() + @"\" + Event + ".js";
                System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                startInfo.FileName = IDEConfig.CodeEditors[IDEConfig.CodeEditorIndex];
                switch (Path.GetFileNameWithoutExtension(startInfo.FileName).ToLower())
                {
                default:
                    startInfo.Arguments = path;
                    break;

                case "brackets":
                    startInfo.WorkingDirectory = Path.GetDirectoryName(path);
                    startInfo.Arguments        = "\"" + Path.GetFileName(path) + "\"";
                    break;
                }
                System.Diagnostics.Process.Start(startInfo);
            }
            return(r);
        }
示例#2
0
 public static string Open(string Title, IDEComponent.ComponentType Type, string Data, int Index, string Event)
 {
     return(Open(Title, Type, Data, new int[] { Index }, Event));
 }