예제 #1
0
        public static ProcessResult Initialize(string path = null)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                path = Fabric.DefaultInstallPath;
            }

            if (!Fabric.IsComputeEmulatorStarted && !Fabric.IsStorageEmulatorStarted)
            {
                string csrunPath;

                if (Fabric.IsInstallPathValid(path, out csrunPath))
                {
                    path = Path.Combine(Path.GetDirectoryName(csrunPath), "devstore", "DSInit.exe");

                    lock (Fabric.InitializeLock)
                    {
                        if (!Fabric.IsComputeEmulatorStarted && !Fabric.IsStorageEmulatorStarted)
                        {
                            using (ProcessWrapper pw = new ProcessWrapper(path, "/silent /forceCreate"))
                            {
                                return pw.Execute(20000);
                            }
                        }
                    }
                }
            }

            return new ProcessResult(-1, path);
        }
예제 #2
0
        public static ProcessResult Start(string path = null)
        {
            ProcessResult result = Fabric.Initialize(path);

            if (result.ExitCode <= 0)
            {
                if (string.IsNullOrWhiteSpace(path))
                {
                    path = Fabric.DefaultInstallPath;
                }

                string csrunPath;

                if (Fabric.IsInstallPathValid(path, out csrunPath))
                {
                    path = csrunPath;

                    using (ProcessWrapper pw = new ProcessWrapper(path, "/devfabric:start"))
                    {
                        result = pw.Execute();
                    }

                    if (result.ExitCode <= 0)
                    {
                        using (ProcessWrapper pw = new ProcessWrapper(path, "/devstore:start"))
                        {
                            result = pw.Execute();
                        }
                    }
                }
            }

            return result ?? new ProcessResult(-1, path);
        }