예제 #1
0
        public static string TryFindIdePath()
        {
            if (EnvironmentUtils.IsRunningOnMac())
            {
                return(GetForMac());
            }

            if (EnvironmentUtils.IsRunningOnWindows())
            {
                return(GetForWindows());
            }

            throw new ApplicationException("unsupported platform : " + Environment.OSVersion.Platform);
        }
예제 #2
0
        public void Sync(string selectedFile = "")
        {
            var resFolder      = Path.Combine(_xamarinProjectPath, ResFolderName);
            var ideaProjectDir = _androidProjectTemplateManager.CreateProjectFromTemplate(
                xamarinResourcesDir: resFolder,
                sdkPath: args.AndroidSDKPath,
                templatePath: args.CustomTemplatePath
                );

            AppendLog("created project dir: {0}", ideaProjectDir);

            //if (!string.IsNullOrEmpty(selectedFile))
            //{
            //    arguments += string.Format(" --line 1 \"{0}\"", selectedFile);
            //}

            AppendLog("Opening Android Studio");
            Process p;

            if (EnvironmentUtils.IsRunningOnMac())
            {
                var path = string.Format("{0}{1}", args.AndroidStudioPath, "/Contents/MacOS/studio");
                if (!File.Exists(path))
                {
                    path = string.Format("{0}{1}", args.AndroidStudioPath, "/Contents/MacOS/idea");
                }

                p = Process.Start(new ProcessStartInfo(
                                      path,
                                      ideaProjectDir.Replace(" ", "\\ ")
                                      )
                {
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardError  = true,
                    RedirectStandardOutput = true,
                });
            }
            else
            {
                string arguments = String.Format("\"{0}\"", ideaProjectDir);
                p = Process.Start(args.AndroidStudioPath, arguments);                  //TODO: specify exact file
            }
            p?.WaitForExit();
            AppendLog("closed Android Studio, deleting temp project");
            DeleteProject(ideaProjectDir);
        }
        public void OpenTempateFolder()
        {
            ExtractTemplateIfNotExtracted();

            if (EnvironmentUtils.IsRunningOnWindows())
            {
                Process.Start("explorer.exe", TemplateDirectory);
            }
            else
            {
                Process proc = new System.Diagnostics.Process();
                proc.StartInfo.FileName               = "open";
                proc.StartInfo.Arguments              = "\\'" + TemplateDirectory + "\\'";
                proc.StartInfo.UseShellExecute        = false;
                proc.StartInfo.RedirectStandardOutput = true;
                proc.StartInfo.RedirectStandardError  = true;
                proc.StartInfo.CreateNoWindow         = true;
                proc.Start();
            }
        }