本文整理汇总了C#中ContextType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ContextType.ToString方法的具体用法?C# ContextType.ToString怎么用?C# ContextType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContextType
的用法示例。
在下文中一共展示了ContextType.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public Context Create(ContextType type)
{
switch (type)
{
case ContextType.Empty:
return EmptyContext();
case ContextType.Stub:
return StubContext();
case ContextType.PublishAndConsume:
return PublishConsumeContext();
default:
throw new NotImplementedException(type.ToString());
}
}
示例2: Save
public bool Save(string DestinationThemeDir,bool OverwriteFile, bool CreateSymlinks)
{
char Sep = Path.DirectorySeparatorChar;
string newpath = DestinationThemeDir + Sep + GetSizeDir() + Sep + contextToStr(Context) + Sep ;
string newfilename = newpath + FdoName + Path.GetExtension(Filename);
try{
if (Context == ContextType.cNone){
Context = guessContextFromStr(Path.GetFullPath(Filename));
Console.WriteLine("Guessing the icon "+Filename+", belongs probably to "+ Context.ToString());
}
if (!Directory.Exists(newpath))
Directory.CreateDirectory(Path.GetFullPath(newpath));
//Console.WriteLine("Old: "+Filename+",New: "+ newfilename);
if (Filename == "")
Pixbuf.Save(newfilename,CUtility.ImageTypeToStr(Type));
else
File.Copy(Filename, newfilename,OverwriteFile); //File.Move
//Has to be included in the icon-class if this unit will be the base of a icon-generator-app
//For now, it's ok to copy it while saving
string IconFile = Path.ChangeExtension(Filename,"icon");
if (File.Exists(IconFile))
File.Copy(IconFile, Path.ChangeExtension(newfilename,"icon"),OverwriteFile); //File.Move
//for max compatibility
if (CreateSymlinks){
foreach (string link in LinkedNames)
CUtility.Execute("ln","-s "+newfilename+" "+newpath + link + Path.GetExtension(Filename));
}
} catch (Exception e) {
Console.WriteLine("Warning: "+e.Message);
}
return true;
}
示例3: switchOn
/// <summary>
/// Switcher of used context.
/// </summary>
/// <param name="context">New context for using.</param>
/// <returns>Self reference.</returns>
public IManager switchOn(ContextType context)
{
if(this.Context != context) {
Log.Trace("Config-Manager: switched context '{0}'", context.ToString());
}
this.Context = context;
configure(UserConfig.Data);
return this;
}