Exemplo n.º 1
0
 void getPath()
 {
     audioFolderPath  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).Replace("\\", "/");
     audioFolderPath += "/My Games/Containment Breach VR/Custom Radio Tracks/";
     System.IO.Directory.CreateDirectory(audioFolderPath);
     Debug.Log(audioFolderPath);
 }
Exemplo n.º 2
0
    public static string getGameDataPath()
    {
        string gameDataPath;

        #if UNITY_STANDALONE_WIN
        gameDataPath =
            Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).Replace("\\", "/");
        gameDataPath += "/My Games/Mindys/Saves";
        #else
        savedGamesPath = Application.persistentDataPath + "/";
        #endif
        return(gameDataPath);
    }
    /// <inheritdoc />
    public void Execute(object?parameter)
    {
        var loaderConfig = IoC.Get <LoaderConfig>();
        var shell        = (IShellLink) new ShellLink();

        var appLocation = ApplicationConfig.GetAbsoluteAppLocation(_config);

        shell.SetDescription($"Launch {_config?.Config.AppName} via Reloaded II");
        shell.SetPath($"\"{loaderConfig.LauncherPath}\"");
        shell.SetArguments($"{Constants.ParameterLaunch} \"{appLocation}\"");
        shell.SetWorkingDirectory(Path.GetDirectoryName(loaderConfig.LauncherPath) !);

        if (_config != null)
        {
            var hasIcon = _config.Config.TryGetApplicationIcon(_config.Path, out var logoPath);
            if (hasIcon)
            {
                // Make path for icon.
                string newPath = Path.ChangeExtension(logoPath, ".ico");

                // Convert to ICO.
                _iconConverter.TryConvertToIcon(logoPath, newPath);
                shell.SetIconLocation(newPath, 0);
            }
            else
            {
                shell.SetIconLocation(appLocation, 0);
            }
        }

        // Save the shortcut.
        var file = (IPersistFile)shell;
        var link = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), $"{_config?.Config.AppName} (Reloaded).lnk");

        file.Save(link, false);

        Actions.DisplayMessagebox?.Invoke(Resources.AddAppShortcutCreatedTitle.Get(),
                                          $"{Resources.AddAppShortcutCreatedMessage.Get()} {link}",
                                          new Actions.DisplayMessageBoxParams()
        {
            StartupLocation = Actions.WindowStartupLocation.CenterScreen
        });
    }
Exemplo n.º 4
0
 private static bool IsNodeVersionInstalled(string version)
 {
     string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);
     return (!String.IsNullOrEmpty(version)) &&
            FileSystemHelpers.FileExists(Path.Combine(programFiles, "nodejs", version, "node.exe"));
 }
Exemplo n.º 5
0
        internal static string ResolveMSBuildPath()
        {
            string windir = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.Windows);

            return(Path.Combine(windir, @"Microsoft.NET", "Framework", "v4.0.30319", "MSBuild.exe"));
        }
Exemplo n.º 6
0
        internal override string ResolveFSharpCPath()
        {
            string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);

            return(Path.Combine(programFiles, @"Microsoft SDKs", "F#", "3.1", "Framework", "v4.0", "Fsc.exe"));
        }
Exemplo n.º 7
0
        internal override string ResolveNpmGlobalPrefix()
        {
            string appDataDirectory = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ApplicationData);

            return(Path.Combine(appDataDirectory, "npm"));
        }
Exemplo n.º 8
0
        internal override string ResolveMSBuildPath()
        {
            string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);

            return(Path.Combine(programFiles, "MSBuild", "14.0", "Bin", "MSBuild.exe"));
        }
Exemplo n.º 9
0
 string GetDocsPath()
 {
     return(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
 }
Exemplo n.º 10
0
        internal override string ResolveMSBuild15Dir()
        {
            string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);

            return(Path.Combine(programFiles, "MSBuild-15.3-preview", "MSBuild", "15.0", "Bin"));
        }
Exemplo n.º 11
0
 public string RootAppPath()
 {
     return(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
 }
Exemplo n.º 12
0
        public string GetDatabasePath(string dbName)
        {
            var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), DatabaseConfig.DatabaseName);

            return(path);
        }
Exemplo n.º 13
0
        public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);

            string regValue = "";

            RegistryHelper registry = new RegistryHelper();

            registry.BaseRegistryKey = Registry.LocalMachine;
            registry.SubKey         += @"System\CurrentControlSet\Control\Session Manager\Environment";
            regValue = registry.ReadKey("PATH");

            string installDir = Context.Parameters["myDir"];

            if (regValue != null)
            {
                // BDS: 13-11-2006
                // Saving the original value and restoring it during the uninstallation would
                // loose the PATH information set by other software installed after WSCF.
                // Therefore I'm saving the installation directory to our state saver and later
                // using it to remove it from the PATH variable.
                // Consequently this line will soon become obsolete.
                stateSaver.Add("OriginalPathRegValue", regValue);
                stateSaver.Add("InstallDir", installDir);
                string newPathValue = regValue + ";" + installDir;
                registry.WriteKey("PATH", newPathValue);
            }
            // What happens if this value is null is not defined.

            EnvironmentHelper.BroadCast();

            // BDS: Write the installation directory into the registry.
            // Write the .addin file to the selected folder.
            try
            {
                RegistryKey subkey = Registry.LocalMachine.CreateSubKey(
                    RegistrySubKey);

                subkey.SetValue(Path, installDir);

                // Write the .addin file.
                ResourceManager rm = new ResourceManager("Thinktecture.Tools.Web.Services.Wscf.Environment.Properties.Resources",
                                                         Assembly.GetExecutingAssembly());
                string settings = rm.GetString("WSCF");

                string asmPath = installDir;

                if (!installDir.EndsWith(@"\"))
                {
                    asmPath += @"\";
                }

                asmPath += @"Thinktecture.Tools.Web.Services.ContractFirst.dll";
                settings = settings.Replace(@"@@ASM@@", asmPath);

                string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
                settings = settings.Replace(@"@@FNVER@@", version);

                string configDir = null;
                if (Context.Parameters[@"ALLUSERS"] == @"1")
                {
                    configDir = FxEnvironment.GetEnvironmentVariable(@"ALLUSERSPROFILE");

                    if (configDir == null)
                    {
                        throw new InstallException("All Users directory not found.");
                    }

                    configDir += @"\Application Data\Microsoft\MSEnvShared\Addins";

                    if (!Directory.Exists(configDir))
                    {
                        Directory.CreateDirectory(configDir);
                    }
                }
                else
                {
                    configDir  = FxEnvironment.GetFolderPath(FxEnvironment.SpecialFolder.ApplicationData);
                    configDir += @"\Microsoft\MSEnvShared\Addins";

                    if (!Directory.Exists(configDir))
                    {
                        Directory.CreateDirectory(configDir);
                    }
                }

                string       addinFile = configDir + @"\WSCF.addin";
                StreamWriter writer    = new StreamWriter(addinFile, false, Encoding.Unicode);
                writer.Write(settings);
                writer.Flush();
                writer.Close();

                stateSaver.Add(@"AddinFilePath", addinFile);
            }
            catch (SecurityException)
            {
                MessageBox.Show(@"You must have write permission to the HKEY_LOCAL_MACHINE registry key in order to install this software.");
                throw new InstallException(@"Access denied.");
            }
            catch (Exception ex)
            {
                throw new InstallException(@"Unknown error:" + ex.Message);
            }
        }
Exemplo n.º 14
0
 public string GetFolderPath(Env.SpecialFolder folder, Env.SpecialFolderOption option)
 {
     return(Env.GetFolderPath(folder, option));
 }
Exemplo n.º 15
0
 public string GetFolderPath(Env.SpecialFolder folder)
 {
     return(Env.GetFolderPath(folder));
 }
 public AndroidDataService()
 {
     scoreFilePath = System.IO.Path.Combine(
         Environment.GetFolderPath(Environment.SpecialFolder.Personal),
         "ScoreData");
 }
Exemplo n.º 17
0
        public string GetLocalFilePath(string filename)
        {
            var path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            return(Path.Combine(path, filename));
        }
Exemplo n.º 18
0
 private static void SaveLastRefreshes()
 {
     File.WriteAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), JSONFilename), JsonConvert.SerializeObject(LastRefreshes));
 }
Exemplo n.º 19
0
        public PowerShellExecutionResults run_host(ChocolateyConfiguration config, string chocoPowerShellScript, Action <Pipeline> additionalActionsBeforeScript)
        {
            // since we control output in the host, always set these true
            Environment.SetEnvironmentVariable("ChocolateyEnvironmentDebug", "true");
            Environment.SetEnvironmentVariable("ChocolateyEnvironmentVerbose", "true");

            var    result       = new PowerShellExecutionResults();
            string commandToRun = wrap_script_with_module(chocoPowerShellScript, config);
            var    host         = new PoshHost(config);

            this.Log().Debug(() => "Calling built-in PowerShell host with ['{0}']".format_with(commandToRun.escape_curly_braces()));

            var initialSessionState = InitialSessionState.CreateDefault();

            // override system execution policy without accidentally setting it
            initialSessionState.AuthorizationManager = new AuthorizationManager("choco");
            using (var runspace = RunspaceFactory.CreateRunspace(host, initialSessionState))
            {
                runspace.Open();

                // this will affect actual execution policy
                //RunspaceInvoke invoker = new RunspaceInvoke(runspace);
                //invoker.Invoke("Set-ExecutionPolicy ByPass");

                using (var pipeline = runspace.CreatePipeline())
                {
                    // The powershell host itself handles the following items:
                    // * Write-Debug
                    // * Write-Host
                    // * Write-Verbose
                    // * Write-Warning
                    //
                    // the two methods below will pick up Write-Output and Write-Error

                    // Write-Output
                    pipeline.Output.DataReady += (sender, args) =>
                    {
                        PipelineReader <PSObject> reader = sender as PipelineReader <PSObject>;

                        if (reader != null)
                        {
                            while (reader.Count > 0)
                            {
                                host.UI.WriteLine(reader.Read().to_string().escape_curly_braces());
                            }
                        }
                    };

                    // Write-Error
                    pipeline.Error.DataReady += (sender, args) =>
                    {
                        PipelineReader <object> reader = sender as PipelineReader <object>;

                        if (reader != null)
                        {
                            while (reader.Count > 0)
                            {
                                host.UI.WriteErrorLine(reader.Read().to_string().escape_curly_braces());
                            }
                        }
                    };

                    var documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments, Environment.SpecialFolderOption.DoNotVerify);
                    var currentUserCurrentHostProfile = _fileSystem.combine_paths(documentsFolder, "WindowsPowerShell\\Microsoft.PowerShell_profile.ps1");
                    var recreateProfileScript         = @"
if ((Test-Path(""{0}"")) -and ($profile -eq $null -or $profile -eq '')) {{
  $global:profile = ""{1}""
}}
".format_with(documentsFolder, currentUserCurrentHostProfile);

                    pipeline.Commands.Add(new Command(recreateProfileScript, isScript: true, useLocalScope: false));

                    // The PowerShell Output Redirection bug affects System.Management.Automation
                    // it appears with v3 more than others. It is already known to affect v2
                    // this implements the redirection fix from the post below, fixed up with some comments
                    // http://www.leeholmes.com/blog/2008/07/30/workaround-the-os-handles-position-is-not-what-filestream-expected/
                    const string outputRedirectionFixScript = @"
try {
  $bindingFlags = [Reflection.BindingFlags] ""Instance,NonPublic,GetField""
  $objectRef = $host.GetType().GetField(""externalHostRef"", $bindingFlags).GetValue($host)
  $bindingFlags = [Reflection.BindingFlags] ""Instance,NonPublic,GetProperty""
  $consoleHost = $objectRef.GetType().GetProperty(""Value"", $bindingFlags).GetValue($objectRef, @())
  [void] $consoleHost.GetType().GetProperty(""IsStandardOutputRedirected"", $bindingFlags).GetValue($consoleHost, @())
  $bindingFlags = [Reflection.BindingFlags] ""Instance,NonPublic,GetField""
  $field = $consoleHost.GetType().GetField(""standardOutputWriter"", $bindingFlags)
  $field.SetValue($consoleHost, [Console]::Out)
  [void] $consoleHost.GetType().GetProperty(""IsStandardErrorRedirected"", $bindingFlags).GetValue($consoleHost, @())
  $field2 = $consoleHost.GetType().GetField(""standardErrorWriter"", $bindingFlags)
  $field2.SetValue($consoleHost, [Console]::Error)
} catch {
  Write-Output ""Unable to apply redirection fix""
}
";
                    pipeline.Commands.Add(new Command(outputRedirectionFixScript, isScript: true, useLocalScope: false));

                    if (additionalActionsBeforeScript != null)
                    {
                        additionalActionsBeforeScript.Invoke(pipeline);
                    }

                    pipeline.Commands.Add(new Command(commandToRun, isScript: true, useLocalScope: false));

                    try
                    {
                        pipeline.Invoke();
                    }
                    catch (RuntimeException ex)
                    {
                        var errorStackTrace = ex.StackTrace;
                        var record          = ex.ErrorRecord;
                        if (record != null)
                        {
                            // not available in v1
                            //errorStackTrace = record.ScriptStackTrace;
                            var scriptStackTrace = record.GetType().GetProperty("ScriptStackTrace");
                            if (scriptStackTrace != null)
                            {
                                var scriptError = scriptStackTrace.GetValue(record, null).to_string();
                                if (!string.IsNullOrWhiteSpace(scriptError))
                                {
                                    errorStackTrace = scriptError;
                                }
                            }
                        }
                        this.Log().Error("ERROR: {0}{1}".format_with(ex.Message.escape_curly_braces(), !config.Debug ? string.Empty : "{0} {1}".format_with(Environment.NewLine, errorStackTrace.escape_curly_braces())));
                    }
                    catch (Exception ex)
                    {
                        // Unfortunately this doesn't print line number and character. It might be nice to get back to those items unless it involves tons of work.
                        this.Log().Error("ERROR: {0}{1}".format_with(ex.Message.escape_curly_braces(), !config.Debug ? string.Empty : "{0} {1}".format_with(Environment.NewLine, ex.StackTrace.escape_curly_braces())));
                    }

                    if (pipeline.PipelineStateInfo != null)
                    {
                        switch (pipeline.PipelineStateInfo.State)
                        {
                        // disconnected is not available unless the assembly version is at least v3
                        //case PipelineState.Disconnected:
                        case PipelineState.Running:
                        case PipelineState.NotStarted:
                        case PipelineState.Failed:
                        case PipelineState.Stopping:
                        case PipelineState.Stopped:
                            if (host.ExitCode == 0)
                            {
                                host.SetShouldExit(1);
                            }
                            host.HostException = pipeline.PipelineStateInfo.Reason;
                            break;

                        case PipelineState.Completed:
                            if (host.ExitCode == -1)
                            {
                                host.SetShouldExit(0);
                            }
                            break;
                        }
                    }
                }
            }

            this.Log().Debug("Built-in PowerShell host called with ['{0}'] exited with '{1}'.".format_with(commandToRun.escape_curly_braces(), host.ExitCode));

            result.ExitCode             = host.ExitCode;
            result.StandardErrorWritten = host.StandardErrorWritten;

            return(result);
        }
Exemplo n.º 20
0
 private void CreateDB()
 {
     DB = new SQLiteAsyncConnection(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "eyegregator.db"));
     DB.CreateTableAsync <RSSSources> ().ContinueWith(t => LoadRSSSources(), uiScheduler);
 }
Exemplo n.º 21
0
        private void InitConfig()
        {
            var tempResult = true;

            try
            {
                Log.Info("Начало поиска лицензии");
                var myAl = new Globals();
                _activeLock = myAl.NewInstance();
                _activeLock.SoftwareName    = "RealEstateDirectory";
                _activeLock.SoftwareVersion = "1.0";
                _activeLock.TrialType       = IActiveLock.ALTrialTypes.trialNone;

                _activeLock.SoftwareCode =
                    @"RSA1024<RSAKeyValue><Modulus>0srdjuOxJjnOC2Y9gQexlzvdHAbilsjf3er5asn889Pj/N6GjaLLE6p1R+QO3AHZQ6QP5U1/WURRoPSzE+5lvv/H03g2k/LuCEoUwednDm6eaFiS/v3/QpsI1DyQ8rFIr0HciNfDqCpFOq4gTXry8Pc4dGE6aAKFH1M0xRh3zrk=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";

                _activeLock.LockType = IActiveLock.ALLockTypes.lockFingerprint | IActiveLock.ALLockTypes.lockWindows |
                                       IActiveLock.ALLockTypes.lockBaseboardID | IActiveLock.ALLockTypes.lockMotherboard;
                _activeLock.AutoRegisterKeyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RealEstateDirectory\\RealEstateDirectory1.0.all");
                _activeLock.KeyStoreType        = IActiveLock.LicStoreType.alsFile;
                string keyStorePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RealEstateDirectory\\lic.lic");
                _activeLock.KeyStorePath     = keyStorePath;
                _activeLock.SoftwarePassword = Convert.ToChar(99).ToString() + Convert.ToChar(111).ToString() +
                                               Convert.ToChar(111).ToString() + Convert.ToChar(108).ToString();
                _activeLockEventNotifier = _activeLock.EventNotifier;

                var path =
                    System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
                _activeLock.Init(path, ref keyStorePath);
            }
            catch (Exception ex)
            {
                Log.ErrorException("Лицензия не определена", ex);
                LoadRubrics();
                tempResult = false;
            }

            if (tempResult)
            {
                var    answer = "";
                string str1 = "", str2 = "", str3 = "", str4 = "", str5 = "", str6 = "", str7 = "", str8 = "", str9 = "", str10 = "", str11 = "";

                try
                {
                    _activeLock.Acquire(ref answer, ref str1, ref str2, ref str3, ref str4, ref str5, ref str6, ref str7, ref str8, ref str9, ref str10, ref str11);
                }
                catch (Exception ex)
                {
                    Log.ErrorException("Лицензия отсутсвует", ex);
                    LoadRubrics();
                    tempResult = false;
                }
            }

            if (!tempResult)
            {
                _appShutdown = true;
                Log.Info("Приложение закрывается - не пройдена проверка лицензии");
                Current.Shutdown();
            }
        }
Exemplo n.º 22
0
        public void Execute()
        {
            #region cfg

            var xml = @"
    <add name='CombineInput' mode='default'>

      <entities>

        <add name='Feeding'>
          <fields>
            <add name='Id' type='byte' primary-key='true' />
            <add name='When' type='datetime' />
            <add name='PetId' type='byte' />
          </fields>
          <rows>
            <add Id='1' When='2017-02-03 9:00 AM' PetId='1' />
            <add Id='2' When='2017-02-03 9:05 AM' PetId='2' />
            <add Id='3' When='2017-02-03 1:30 PM' PetId='1' />
            <add Id='4' When='2017-02-03 5:00 PM' PetId='1' />
            <add Id='5' When='2017-02-03 5:03 PM' PetId='2' />
          </rows>
        </add>

        <add name='Pet'>
            <fields>
                <add name='Id' type='byte' primary-key='true' />
                <add name='Name' />
            </fields>
            <rows>
                <add Id='1' Name='Lucy' />
                <add Id='2' Name='Hammond' />
            </rows>
        </add>

      </entities>

      <relationships>
        <add left-entity='Feeding' left-field='PetId' right-entity='Pet' right-field='Id' />
      </relationships>
    </add>";

            #endregion

            var provider = "sqlite";
            var ext      = "sqlite3";

            var process = ProcessFactory.Create(xml, @"Shorthand.xml");

            if (!process.Errors().Any())
            {
                var originalOutput = process.Output().Clone();

                if (process.Entities.Count > 1 && !process.OutputIsRelational())
                {
                    process.Output().Provider = provider;
                    var file = new FileInfo(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Transformalize"), process.Name + "." + ext));
                    process.Output().File = file.FullName;
                    Console.WriteLine(file.FullName);
                    process.Flatten = provider == "sqlce";
                    process.Mode    = "init";

                    if (!file.Exists)
                    {
                        if (!Directory.Exists(file.DirectoryName))
                        {
                            Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Transformalize"));
                        }
                    }

                    using (var scope = DefaultContainer.Create(process, new DebugLogger())) {
                        scope.Resolve <IProcessController>().Execute();
                    }

                    var threshold = process.Entities.Min(e => e.BatchId) - 1;

                    var reversed = new Process {
                        Name        = process.Name,
                        ReadOnly    = true,
                        Connections = new List <Connection>(2)
                        {
                            new Connection {
                                Name = "input", Provider = provider, File = file.FullName
                            },
                            originalOutput
                        },
                        Entities = new List <Entity>(1)
                        {
                            new Entity {
                                Name = provider == "sqlce" ? process.Flat : process.Star,
                                CalculateHashCode = false,
                                Connection        = "input",
                                Fields            = process.GetStarFields().SelectMany(f => f).Select(field => new Field {
                                    Name       = field.Alias,
                                    Alias      = field.Alias,
                                    Type       = field.Type,
                                    Input      = true,
                                    PrimaryKey = field.Name == Transformalize.Constants.TflKey
                                }).ToList(),
                                Filter = new List <Filter> {
                                    new Filter {
                                        Field    = Transformalize.Constants.TflBatchId,
                                        Operator = "greaterthan",
                                        Value    = threshold.ToString()
                                    }
                                }
                            }
                        }
                    };

                    reversed.Check();
                    if (reversed.Errors().Any())
                    {
                        foreach (var error in reversed.Errors())
                        {
                            Console.WriteLine(error);
                        }
                    }

                    using (var scope = DefaultContainer.Create(reversed, new DebugLogger())) {
                        scope.Resolve <IProcessController>().Execute();
                        if (originalOutput.Provider == "internal")
                        {
                            process.Rows = reversed.Entities.First().Rows;
                        }
                        Assert.AreEqual(5, process.Rows.Count);
                    }
                }
            }
        }
Exemplo n.º 23
0
        internal override string ResolveSQLCmdPath()
        {
            string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);

            return(Path.Combine(programFiles, "Microsoft SQL Server", "110", "Tools", "Binn", "sqlcmd.exe"));
        }
Exemplo n.º 24
0
        internal static string ResolveNpmJsPath()
        {
            string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);

            return(Path.Combine(programFiles, "nodejs", "node_modules", "npm", "bin", "npm-cli.js"));
        }
Exemplo n.º 25
0
        internal static string ResolveGitInstallDirPath()
        {
            // look up whether x86 or x64 of git was installed.
            // if both exists, x64 will be used (assuming it is newly installed).
            string programFiles = SystemEnvironment.GetEnvironmentVariable(ProgramFiles64bitKey) ?? SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFiles);
            string path         = Path.Combine(programFiles, "Git");

            if (Directory.Exists(path) && File.Exists(Path.Combine(path, "cmd", "git.exe")))
            {
                return(path);
            }

            programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);
            path         = Path.Combine(programFiles, "Git");
            if (Directory.Exists(path) && File.Exists(Path.Combine(path, "cmd", "git.exe")))
            {
                return(path);
            }

            throw new InvalidOperationException(Resources.Error_FailedToLocateGit);
        }
Exemplo n.º 26
0
        internal static string ResolveNpmPath()
        {
            string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);

            return(Path.Combine(programFiles, "nodejs", "npm.cmd"));
        }
Exemplo n.º 27
0
        private static string ResolveRelativePathToProgramFiles(string relativeX86Path, string relativeX64Path, string errorMessage)
        {
            string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);
            string path         = Path.Combine(programFiles, relativeX86Path);

            if (!File.Exists(path))
            {
                programFiles = SystemEnvironment.GetEnvironmentVariable(ProgramFiles64bitKey) ?? SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFiles);
                path         = Path.Combine(programFiles, relativeX64Path);
            }

            if (!File.Exists(path))
            {
                throw new InvalidOperationException(errorMessage);
            }

            return(path);
        }
Exemplo n.º 28
0
        internal static string ResolveHgPath()
        {
            string programFiles32 = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);
            string path           = Path.Combine(programFiles32, "Mercurial", "hg.exe");

            if (!File.Exists(path))
            {
                string programFiles = SystemEnvironment.GetEnvironmentVariable(ProgramFiles64bitKey) ?? SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFiles);
                path = Path.Combine(programFiles, "Mercurial", "hg.exe");

                if (!File.Exists(path))
                {
                    throw new InvalidOperationException(Resources.Error_FailedToLocateHg);
                }
            }

            return(path);
        }
Exemplo n.º 29
0
        internal static string ResolveVsTestPath()
        {
            string programFiles = SystemEnvironment.GetFolderPath(SystemEnvironment.SpecialFolder.ProgramFilesX86);

            return(Path.Combine(programFiles, "Microsoft Visual Studio 11.0", "Common7", "IDE", "CommonExtensions", "Microsoft", "TestWindow", "vstest.console.exe"));
        }
Exemplo n.º 30
0
 public string GetLocalFilePath(string fileName)
 {
     return(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), fileName));
 }