本文整理汇总了C#中IShellContext类的典型用法代码示例。如果您正苦于以下问题:C# IShellContext类的具体用法?C# IShellContext怎么用?C# IShellContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IShellContext类属于命名空间,在下文中一共展示了IShellContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoRun
protected override void DoRun(IShellContext context)
{
var db = GetDatabaseStructure(context);
if (Table != null && Tables != null) throw new Exception("DBSH-00085 SetTableProperty: both of Table and tables attribute is set");
if (Table == null && Tables == null) throw new Exception("DBSH-00086 SetTableProperty: none of Table and tables attribute is set");
string value = context.Replace(Value);
if (Table != null)
{
var table = db.FindTableLike(Table);
if (table != null)
{
table.Properties[Name] = value;
}
}
if (Tables != null)
{
foreach (var table in db.Tables)
{
if (Regex.Match(table.Name, Tables).Success)
{
table.Properties[Name] = value;
}
}
}
}
示例2: DoRun
protected override void DoRun(IShellContext context)
{
using (var conn = GetConnectionProvider(context).Connect())
{
GetModel(context).Prepare(conn);
}
}
示例3: CdlFileWriter
ICdlWriter ITabularDataTarget.CreateWriter(TableInfo rowFormat, CopyTableTargetOptions options, IShellContext context, DataFormatSettings sourceDataFormat)
{
string file = GetName(context);
file = context.ResolveFile(file, ResolveFileMode.Output);
context.OutputMessage("Writing file " + Path.GetFullPath(file));
return new CdlFileWriter(file, rowFormat);
}
示例4: CdlFileReader
ICdlReader ITabularDataSource.CreateReader(IShellContext context)
{
TableInfo table;
BinaryReader br;
OpenRead(out table, out br, context);
return new CdlFileReader(table, br);
}
示例5: DoRun
protected override void DoRun(IShellContext context)
{
var dbs = GetDatabaseStructure(context);
var model = new DataSetModel(dbs, context, GetConnectionProvider(context).Factory);
model.KeepUndefinedReferences = KeepUndefinedReferences;
context.SetVariable(GetDataSetVariableName(context), model);
}
示例6: DoRun
protected override void DoRun(IShellContext context)
{
context.OutputMessage("Opening MS Excel");
var model = ExcelModel.CreateNewWindow();
model.DataFormat = DataFormat;
context.SetVariable(GetExcelVariableName(context), model);
}
示例7: DoRun
protected override void DoRun(IShellContext context)
{
string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Input);
var model = ExcelModel.OpenFile(file);
model.DataFormat = DataFormat;
context.SetVariable(GetExcelVariableName(context), model);
}
示例8: DataSetModel
public DataSetModel(DatabaseInfo targetDatabase, IShellContext context, IDatabaseFactory factory)
{
_targetDatabase = targetDatabase;
_context = context;
_factory = factory;
_dda = _factory.CreateDataAdapter();
}
示例9: DoRun
protected override void DoRun(IShellContext context)
{
GetModel(context).LoadReference(
new NameWithSchema(context.Replace(Schema), context.Replace(Table)),
context.Replace(Column),
new NameWithSchema(context.Replace(RefSchema), context.Replace(RefTable)));
}
示例10: CreateWriter
public ICdlWriter CreateWriter(TableInfo rowFormat, CopyTableTargetOptions options, IShellContext context, DataFormatSettings sourceDataFormat)
{
string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Output);
var fw = new StreamWriter(file);
var provider = GetConnectionProvider(context);
return new SqlFileWriter(fw, provider.Factory);
}
示例11: DoRun
protected override void DoRun(IShellContext context)
{
string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Output);
if (Expression != null && Value != null) throw new Exception("DBSH-00078 SaveToFile: both Expression and Value is set");
if (Expression == null && Value == null) throw new Exception("DBSH-00079 SaveToFile: none of Expression and Value is set");
if (Expression != null)
{
object obj = context.Evaluate(Expression);
if (obj is byte[])
{
var bytes = (byte[]) obj;
using (var fw = System.IO.File.OpenWrite(file))
{
fw.Write(bytes, 0, bytes.Length);
}
}
else
{
using (var fw = new StreamWriter(file, false, Encoding))
{
fw.Write(obj.ToString());
}
}
}
if (Value!=null)
{
string val = context.Replace(Value);
using (var fw = new StreamWriter(file, false, Encoding))
{
fw.Write(val);
}
}
}
示例12: RunContainer
//public override void EnumChildren(Action<IShellElement> enumFunc)
//{
// base.EnumChildren(enumFunc);
// foreach (var item in Commands) YieldChild(enumFunc, item);
//}
protected void RunContainer(IShellContext context)
{
foreach(var item in Commands)
{
item.Run(context);
}
}
示例13: OpenDbfRead
private SocialExplorer.IO.FastDBF.DbfFile OpenDbfRead(IShellContext context)
{
var dbf = new SocialExplorer.IO.FastDBF.DbfFile(Encoding);
var name = context.ResolveFile(context.Replace(Name), ResolveFileMode.Input);
dbf.Open(name, System.IO.FileMode.Open);
return dbf;
}
示例14: DoRun
protected override void DoRun(IShellContext context)
{
string file = context.ResolveFile(context.Replace(File), ResolveFileMode.Output);
context.OutputMessage("Writing file " + Path.GetFullPath(file));
var model = ExcelModel.CreateFile(file);
model.DataFormat = DataFormat;
context.SetVariable(GetExcelVariableName(context), model);
}
示例15: ColumnMapperReader
public ColumnMapperReader(ICdlReader source, TableInfo outputFormat, List<IColumnMapping> columnMap, List<int> counts, IShellContext context )
: base(outputFormat)
{
_source = source;
_columnMap = columnMap;
_counts = counts;
_context = context;
}