本文整理汇总了C#中Core.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Core.GetString方法的具体用法?C# Core.GetString怎么用?C# Core.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var registerIis = values.GetBool("RegisterIis");
var hosttName = values.GetString("HostName");
var location = values.GetString("DestinationFolder");
var umbracoRelativePath = parameters["umbracoRelativePath"];
if (registerIis)
{
// Get IIS reference
var serverManager = new ServerManager();
// Create new AppPool or use existing
var appPool = serverManager.ApplicationPools.FirstOrDefault(x => x.Name == arguments.Name) ??
serverManager.ApplicationPools.Add(arguments.Name);
// Umbraco is .NET 4.0
appPool.ManagedRuntimeVersion = "v4.0";
// Add site and configure
var physicalPath = System.IO.Path.Combine(location, umbracoRelativePath);
serverManager.Sites.Add(arguments.Name, physicalPath, 80);
serverManager.Sites[arguments.Name].ApplicationDefaults.ApplicationPoolName = arguments.Name;
serverManager.Sites[arguments.Name].Bindings.Clear();
serverManager.Sites[arguments.Name].Bindings.Add("*:80:" + hosttName, "http");
serverManager.Sites[arguments.Name].ServerAutoStart = true;
// Commit
serverManager.CommitChanges();
}
return new GeneratorActionResult(true, "");
}
示例2: ExecuteAction
public virtual GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var cloneUrl = values.GetString("CloneUrl");
var location = values.GetString("DestinationFolder");
try
{
GitCommandRunner.RunCommand(string.Format("clone {0} ./", cloneUrl), location);
}
catch (Exception ex)
{
return new GeneratorActionResult(false, ex.Message);
}
return new GeneratorActionResult(true, "");
}
示例3: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
var cloneUrl = values.GetString("MercurialCloneUrl");
if (Directory.Exists(location))
{
var repo = new Repository(location);
repo.CloneGui(new CloneGuiCommand { Source = cloneUrl, WaitForGuiToClose = true });
}
else
{
return new GeneratorActionResult(false, "Directory doesn't exist!");
}
return new GeneratorActionResult(true, "");
}
示例4: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
RemoveFile(Path.Combine(location, "Template.xml"));
return new GeneratorActionResult(true, "");
}
示例5: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
var repo = new Repository(location);
repo.Push(new PushCommand().WithTimeout(60 * 60));
return new GeneratorActionResult(true, "");
}
示例6: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
var repo = new Repository(location);
repo.Add(new AddCommand().WithPaths(location));
repo.Commit(string.Format(MercurialCommitMessage, Environment.UserName));
return new GeneratorActionResult(true, "");
}
示例7: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
var repo = new Repository(location);
if (repo.Manifest().Any())
{
return new GeneratorActionResult(false, "Repository has commits, and is therefor not empty!");
}
return new GeneratorActionResult(true, "");
}
示例8: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
var connectionString = parameters["connectionString"];
var databasePrefix = parameters["databasePrefix"];
var databaseScriptName = parameters["databaseScriptName"];
var databaseServerName = parameters["databaseServerName"];
var databaseUsername = parameters["databaseUsername"];
var databasePassword = parameters["databasePassword"];
using (var sqlConnection = new SqlConnection(connectionString))
{
using (var sqlCommand = new SqlCommand(string.Format(DatabaseCreateStatement, string.Format(DatabaseNameFormat, databasePrefix, arguments.Name))
, sqlConnection))
{
sqlCommand.Connection.Open();
sqlCommand.ExecuteNonQuery();
sqlCommand.Connection.Close();
}
}
var databaseScriptFilePath = System.IO.Path.Combine(location, databaseScriptName);
var osqlCommand = string.Concat(string.Format(DatabaseOsqlCommand, databaseServerName, databaseUsername, databasePassword), " -d ", string.Format(DatabaseNameFormat, databasePrefix, arguments.Name),
" -i \"", databaseScriptFilePath, "\"");
using (var process = new Process()
{
StartInfo = new ProcessStartInfo()
{
Arguments = osqlCommand,
WindowStyle = ProcessWindowStyle.Normal,
CreateNoWindow = false,
FileName = "osql.exe"
}
})
{
process.Start();
process.WaitForExit(300 * 1000);
if (!process.HasExited)
{
process.Kill();
throw new Exception("OSQL process was niet klaar binnen 5 minuten");
}
}
return new GeneratorActionResult(true, "");
}
示例9: ExecuteAction
public virtual GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
try
{
GitCommandRunner.RunCommand("add -A", location);
GitCommandRunner.RunCommand(string.Format("commit -m \"{0}\"", string.Format(GitCommitMessage, Environment.UserName)), location);
}
catch (Exception ex)
{
return new GeneratorActionResult(false, ex.Message);
}
return new GeneratorActionResult(true, "");
}
示例10: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
url = parameters["url"];
token = parameters["token"];
try
{
values.Add("CloneUrl", GetCloneUrl(values.GetString("projectId")));
}
catch (Exception ex)
{
return new GeneratorActionResult(false, ex.Message);
}
return new GeneratorActionResult(true, "");
}
示例11: ExecuteAction
public virtual GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
try
{
GitCommandRunner.RunCommand("config --global http.postBuffer 1548576000", location);
GitCommandRunner.RunCommand("push --all origin", location);
}
catch (Exception ex)
{
return new GeneratorActionResult(false, ex.Message);
}
return new GeneratorActionResult(true, "");
}
示例12: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
var copier = new DirectoryRenamerCopier(arguments.TemplateInformation.TemplatePath, location)
{
ExcludeExtensions = arguments.TemplateInformation.ExcludeExtensions.Select(x => x.FileExtension).ToList(),
RemoveExtensions = arguments.TemplateInformation.RemoveExtensions.Select(x => x.FileExtension).ToList(),
RenameExtensions = arguments.TemplateInformation.RenameExtensions.Select(x => x.FileExtension).ToList(),
UtfExtensions = arguments.TemplateInformation.RenameExtensions.Where(x => x.UseUtf8Encoding).Select(x => x.FileExtension).ToList(),
RenameWords = arguments.TemplateInformation.Renames
};
if (copier.StartRenaming())
return new GeneratorActionResult(true, "");
else
return new GeneratorActionResult(false, "");
}
示例13: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var editHostsFile = values.GetBool("EditHostsFile");
var hostName = values.GetString("HostName");
if (editHostsFile)
{
// Create backup
System.IO.File.WriteAllText(string.Concat(HostFileWriter.HostFilePath, ".backup"),
System.IO.File.ReadAllText(HostFileWriter.HostFilePath, Encoding.UTF8),
Encoding.UTF8);
var hostEditor = new HostFileWriter();
hostEditor.AddOrUpdateEntry(hostName, "127.0.0.1", String.Concat("Dev URL for ", arguments.Name));
hostEditor.Save();
}
return new GeneratorActionResult(true, "");
}
示例14: ExecuteAction
public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
{
var location = values.GetString("DestinationFolder");
var iisExpressUrl = parameters.ContainsKey("iisExpressUrl") ? parameters["iisExpressUrl"] : "";
var copier = new DirectoryRenamerCopier(arguments.TemplateInformation.TemplatePath, location)
{
ExcludeExtensions = arguments.TemplateInformation.ExcludeExtensions.Select(x => x.FileExtension).ToList(),
RemoveExtensions = arguments.TemplateInformation.RemoveExtensions.Select(x => x.FileExtension).ToList(),
RenameExtensions = arguments.TemplateInformation.RenameExtensions.Select(x => x.FileExtension).ToList(),
UtfExtensions = arguments.TemplateInformation.RenameExtensions.Where(x => x.UseUtf8Encoding).Select(x => x.FileExtension).ToList(),
RenameWords = arguments.TemplateInformation.Renames
};
copier.RenameWords.Add(iisExpressUrl, string.Format("http://localhost:{0}/", GetRandomPort()));
if (copier.StartRenaming())
return new GeneratorActionResult(true, "");
else
return new GeneratorActionResult(false, "");
}
示例15: CheckMove
private void CheckMove(Core.DataAccess destination, Core.Type srcType, Diagnostics.Span srcSpan)
{
if (!TypeResolver.ValidateDataAccess(this.session, this.funct, destination))
{
this.foundErrors = true;
return;
}
var destType = TypeResolver.GetDataAccessType(this.session, this.funct, destination);
if (destType == null)
return;
if (!srcType.IsConvertibleTo(destType) &&
ShouldDiagnose(srcType) &&
ShouldDiagnose(destType))
{
this.foundErrors = true;
var destReg = destination as Core.DataAccessRegister;
if (destReg != null && destReg.registerIndex == 0)
{
this.session.AddMessage(
Diagnostics.MessageKind.Error,
Diagnostics.MessageCode.IncompatibleTypes,
"returning '" + srcType.GetString(this.session) + "' " +
"but expecting '" + destType.GetString(this.session) + "'",
srcSpan,
destination.span);
}
else
{
this.session.AddMessage(
Diagnostics.MessageKind.Error,
Diagnostics.MessageCode.IncompatibleTypes,
"moving '" + srcType.GetString(this.session) + "' " +
"into '" + destType.GetString(this.session) + "'",
srcSpan,
destination.span);
}
}
}