本文整理汇总了C#中Importer类的典型用法代码示例。如果您正苦于以下问题:C# Importer类的具体用法?C# Importer怎么用?C# Importer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Importer类属于命名空间,在下文中一共展示了Importer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDevirtualizedAttribute
/// <summary>
/// Create the DevirtualizedAttribute TypeDef, with a "default .ctor" that
/// calls the base type's .ctor (System.Attribute).
/// </summary>
/// <returns>TypeDef</returns>
TypeDef CreateDevirtualizedAttribute()
{
var importer = new Importer(this.Module);
var attributeRef = this.Module.CorLibTypes.GetTypeRef("System", "Attribute");
var attributeCtorRef = importer.Import(attributeRef.ResolveTypeDefThrow().FindMethod(".ctor"));
var devirtualizedAttr = new TypeDefUser(
"eazdevirt.Injected", "DevirtualizedAttribute", attributeRef);
//devirtualizedAttr.Attributes = TypeAttributes.Public | TypeAttributes.AutoLayout
// | TypeAttributes.Class | TypeAttributes.AnsiClass;
var emptyCtor = new MethodDefUser(".ctor", MethodSig.CreateInstance(this.Module.CorLibTypes.Void),
MethodImplAttributes.IL | MethodImplAttributes.Managed,
MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName |
MethodAttributes.ReuseSlot | MethodAttributes.HideBySig);
var instructions = new List<Instruction>();
instructions.Add(OpCodes.Ldarg_0.ToInstruction());
instructions.Add(OpCodes.Call.ToInstruction(attributeCtorRef)); // Call the constructor .ctor
instructions.Add(OpCodes.Ret.ToInstruction());
emptyCtor.Body = new CilBody(false, instructions, new List<ExceptionHandler>(), new List<Local>());
devirtualizedAttr.Methods.Add(emptyCtor);
return devirtualizedAttr;
}
示例2: foreach
internal static bool ScanMediaDirectories
(
string[] mediaFolders,
ref IList<string> extensionsToIgnore,
string[] filmLocations, string[] tvShowsLocations,string[] musicLocations,
string[] videoExtensions, string[] audioExtensions,
IEnumerable<string> combinedSceneTags,
IEnumerable<string> videoExtensionsCommon, Importer importer
)
{
string pluginpath = Debugger.GetPluginPath();
foreach (string importRootFolder in mediaFolders)
if (
!CalculateExaminationtimeAndScanMediaFolder
(MediaSectionsAllocator.MoviesSection,
MediaSectionsAllocator.TvEpisodesSection,
MediaSectionsAllocator.MusicSection,
ref extensionsToIgnore, filmLocations,
tvShowsLocations, musicLocations,
videoExtensions, audioExtensions,
importRootFolder, pluginpath, combinedSceneTags,
videoExtensionsCommon )
)
return false;
return true;
}
示例3: Load
public static ImportNotificationOverview Load(ImportNotification notification,
ImportNotificationAssessment assessment,
Exporter exporter,
Importer importer,
Producer producer,
FacilityCollection facilities,
Shipment shipment,
TransportRoute transportRoute,
WasteOperation wasteOperation,
WasteType wasteType)
{
return new ImportNotificationOverview
{
Notification = notification,
Assessment = assessment,
Exporter = exporter,
Importer = importer,
Producer = producer,
Facilities = facilities,
Shipment = shipment,
TransportRoute = transportRoute,
WasteOperation = wasteOperation,
WasteType = wasteType
};
}
示例4: BinaryTreeMustSortTheSameAsSortedDictionary
public void BinaryTreeMustSortTheSameAsSortedDictionary()
{
// Arrange
var asm = Assembly.GetExecutingAssembly();
var importer = new Importer(asm.GetManifestResourceStream("ClientImport.Tests.records.txt"), ',');
var dictionary = new SortedDictionary<string, IPerson>();
var tree = new BinarySearchTree<string, IPerson>();
//Act
importer.Data
.ToList()
.ForEach(record =>
{
var person = new Person
{
FirstName = record.FirstName,
Surname = record.Surname,
Age = Convert.ToInt16(record.Age)
};
var key = PersonRepository.BuildKey(person, SortKey.SurnameFirstNameAge);
if (tree.Find(key) == null)
tree.Add(key, person);
}
);
tree
.ToList()
.Shuffle() //Shuffle result from binary tree, to test sorting
.ForEach(r => dictionary.Add(PersonRepository.BuildKey(r.KeyValue.Value, SortKey.SurnameFirstNameAge), r.KeyValue.Value));
var expected = dictionary.Select(r => r.Value).ToList();
var actual = tree.Select(n => n.KeyValue.Value).ToList();
// Assert
CollectionAssert.AreEqual(expected, actual);
}
示例5: Inform
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Showes process results with details in message window.
/// </summary>
/// <param name="importer">Importer object.</param>
/// <param name="geocoder">Geocoder object (can be NULL).</param>
/// <param name="storage">Storage object</param>
/// <param name="status">Status text.</param>
public void Inform(Importer importer, Geocoder geocoder, Storage storage, string status)
{
Debug.Assert(!string.IsNullOrEmpty(status)); // not empty
Debug.Assert(null != importer); // created
Debug.Assert(null != storage); // created
var details = new List<MessageDetail>();
// add statistic
string statistic = _CreateStatistic(importer, geocoder, storage);
Debug.Assert(!string.IsNullOrEmpty(statistic));
var statisticDetail = new MessageDetail(MessageType.Information, statistic);
details.Add(statisticDetail);
// add geocoder exception
if ((null != geocoder) &&
(null != geocoder.Exception))
{
details.Add(_GetServiceMessage(geocoder.Exception));
}
// add steps deatils
details.AddRange(importer.Details);
if (null != geocoder)
details.AddRange(geocoder.Details);
details.AddRange(storage.Details);
// show status with details
App.Current.Messenger.AddMessage(status, details);
}
示例6: Parser
public Parser(int optimization, IStylizer stylizer, Importer importer, bool noCache = false)
{
Stylizer = stylizer;
Importer = importer;
Tokenizer = new Tokenizer(optimization);
NoCache = noCache;
}
示例7: StandardExportInterfacesShouldWork
public void StandardExportInterfacesShouldWork()
{
// Export all interfaces except IDisposable, Export contracts on types without interfaces. except for disposable types
var builder = new ConventionBuilder();
builder.ForTypesMatching((t) => true).ExportInterfaces();
builder.ForTypesMatching((t) => t.GetTypeInfo().ImplementedInterfaces.Where((iface) => iface != typeof(System.IDisposable)).Count() == 0).Export();
var container = new ContainerConfiguration()
.WithPart<Standard>(builder)
.WithPart<Dippy>(builder)
.WithPart<Derived>(builder)
.WithPart<BareClass>(builder)
.CreateContainer();
var importer = new Importer();
container.SatisfyImports(importer);
Assert.NotNull(importer.First);
Assert.True(importer.First.Count() == 3);
Assert.NotNull(importer.Second);
Assert.True(importer.Second.Count() == 3);
Assert.NotNull(importer.Third);
Assert.True(importer.Third.Count() == 3);
Assert.NotNull(importer.Fourth);
Assert.True(importer.Fourth.Count() == 3);
Assert.NotNull(importer.Fifth);
Assert.True(importer.Fifth.Count() == 3);
Assert.Null(importer.Base);
Assert.Null(importer.Derived);
Assert.Null(importer.Dippy);
Assert.Null(importer.Standard);
Assert.Null(importer.Disposable);
Assert.NotNull(importer.BareClass);
}
示例8: Main
static void Main(string[] args)
{
string source;
string destination;
Options options = new Options();
if (CommandLine.Parser.Default.ParseArguments(args, options))
{
source = options.Source;
destination = options.Destination;
}
else
{
Console.WriteLine("Source: ");
source = Console.ReadLine();
Console.WriteLine("Destination: ");
destination = Console.ReadLine();
}
Importer importer = new Importer();
importer.ImportFiles(source, destination);
Console.WriteLine("Press any key to exit...");
Console.ReadLine();
}
示例9: btnAddExampleContent_Click
/// <summary>
///
/// </summary>
protected void btnAddExampleContent_Click(object sender, EventArgs e)
{
Importer z = new Importer();
// z.ExportContentTree(1068, "HelpandExample.content");
z.ImportContentTree("HelpandExample.content");
importMessage.Text = "Example Content Imported - You should see this on the content node.";
}
示例10: ImporterViewModel
public ImporterViewModel(Importer importer)
{
Address = new AddressViewModel(importer.Address);
BusinessName = importer.BusinessName;
Contact = new ContactViewModel(importer.Contact);
RegistrationNumber = importer.RegistrationNumber;
Type = importer.Type;
}
示例11: ImporterCallsConverterOnce
public void ImporterCallsConverterOnce()
{
var importer = new Importer(_source, _converter, _destination);
importer.Run();
_converter.Received(1).ConvertData(Arg.Any<DataTable>());
}
示例12: ImporterViewModel
public ImporterViewModel(Importer importer)
{
Name = importer.Business.Name;
address = new AddressViewModel(importer.Address);
ContactPerson = importer.Contact.FullName;
Telephone = importer.Contact.Telephone.ToFormattedContact();
Fax = importer.Contact.Fax.ToFormattedContact();
Email = importer.Contact.Email;
RegistrationNumber = importer.Business.RegistrationNumber;
}
示例13: CanCreateImporter
public void CanCreateImporter()
{
var business = ObjectFactory.CreateEmptyBusiness();
var address = ObjectFactory.CreateDefaultAddress();
var contact = ObjectFactory.CreateEmptyContact();
var importer = new Importer(Guid.NewGuid(), address, business, contact);
Assert.NotNull(importer);
}
示例14: Import
private Import(string path, Importer importer)
{
Importer = importer;
var regex = new Regex(@"\.(le|c)ss$");
Path = regex.IsMatch(path) ? path : path + ".less";
Css = Path.EndsWith("css");
if(!Css)
Importer.Import(this);
}
示例15: DestinationReceivesConvertedData
public void DestinationReceivesConvertedData()
{
DataTable originalData = new DataTable("table1");
DataTable convertedData = new DataTable("table2");
_source.GetData().Returns(originalData);
_converter.ConvertData(originalData).Returns(convertedData);
var importer = new Importer(_source, _converter, _destination);
importer.Run();
Assert.NotEqual(originalData, convertedData);
_destination.Received(1).Receive(convertedData);
}