示例#1
0
        private static bool OnOpenAsset(int instanceID, int line)
        {
            if (ScriptEditorSettings.ServerURL == null)
            {
                return(false);
            }
            string text  = Path.GetFullPath(Application.dataPath + "/../" + AssetDatabase.GetAssetPath(instanceID)).Replace('\\', '/');
            string text2 = text.ToLower();

            if (!text2.EndsWith(".cs") && !text2.EndsWith(".js") && !text2.EndsWith(".boo"))
            {
                return(false);
            }
            if (!PairingRestHandler.IsScriptEditorRunning() || !RestRequest.Send("/openfile", string.Concat(new object[]
            {
                "{ \"file\" : \"",
                text,
                "\", \"line\" : ",
                line,
                " }"
            }), 5000))
            {
                ScriptEditorSettings.ServerURL = null;
                ScriptEditorSettings.Name      = null;
                ScriptEditorSettings.ProcessId = -1;
                return(false);
            }
            return(true);
        }
示例#2
0
        private static bool OnOpenAsset(int instanceID, int line)
        {
            if (ScriptEditorSettings.ServerURL == null)
            {
                return(false);
            }
            string str   = Path.GetFullPath(Application.dataPath + "/../" + AssetDatabase.GetAssetPath(instanceID)).Replace('\\', '/');
            string lower = str.ToLower();

            if (!lower.EndsWith(".cs") && !lower.EndsWith(".js") && !lower.EndsWith(".boo"))
            {
                return(false);
            }
            if (PairingRestHandler.IsScriptEditorRunning())
            {
                if (RestRequest.Send("/openfile", "{ \"file\" : \"" + str + "\", \"line\" : " + (object)line + " }", 5000))
                {
                    return(true);
                }
            }
            ScriptEditorSettings.ServerURL = (string)null;
            ScriptEditorSettings.Name      = (string)null;
            ScriptEditorSettings.ProcessId = -1;
            return(false);
        }
 static RestServiceRegistration()
 {
     OpenDocumentsRestHandler.Register();
     ProjectStateRestHandler.Register();
     AssetRestHandler.Register();
     PairingRestHandler.Register();
     PlayModeRestHandler.Register();
 }