本文整理汇总了C#中PartInfo类的典型用法代码示例。如果您正苦于以下问题:C# PartInfo类的具体用法?C# PartInfo怎么用?C# PartInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PartInfo类属于命名空间,在下文中一共展示了PartInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
internal void Add(MessagePartDescription part, XmlMemberMapping memberMapping, XmlMembersMapping membersMapping, bool isEncoded)
{
PartInfo partInfo = new PartInfo();
partInfo.MemberMapping = memberMapping;
partInfo.MembersMapping = membersMapping;
partInfo.IsEncoded = isEncoded;
partInfoTable[part] = partInfo;
}
示例2: Dispose
/// <summary>
/// Disposes the provided parts.
/// </summary>
public void Dispose(PartInfo[] parts)
{
using (LogGroup logGroup = LogGroup.Start("Disposing the parts.", NLog.LogLevel.Debug))
{
foreach (PartInfo part in parts)
{
PartState.Parts.Remove(
PartState.Parts[part.Key]
);
}
}
}
示例3: ParsePartition
protected void ParsePartition(byte[] aEBR, UInt32 aLoc)
{
byte xSystemID = aEBR[aLoc + 4];
// SystemID = 0 means no partition
//TODO: Extended Partition Table
if (xSystemID == 0x5 || xSystemID == 0xF || xSystemID == 0x85)
{
//Another EBR Detected
}
else if (xSystemID != 0)
{
UInt32 xStartSector = aEBR.ToUInt32(aLoc + 8);
UInt32 xSectorCount = aEBR.ToUInt32(aLoc + 12);
var xPartInfo = new PartInfo(xSystemID, xStartSector, xSectorCount);
Partitions.Add(xPartInfo);
}
}
示例4: CreateMockParts
/// <summary>
/// Creates mock parts that can be used during testing.
/// </summary>
public void CreateMockParts(PartFileNamer namer)
{
PartInfo info1 = new PartInfo();
info1.Action = "Create";
info1.TypeName = "User";
info1.PartFilePath = "Parts/User-Create.ascx";
string part1Path = namer.CreatePartFilePath(info1);
if (!Directory.Exists(Path.GetDirectoryName(part1Path)))
Directory.CreateDirectory(Path.GetDirectoryName(part1Path));
using (StreamWriter writer = File.CreateText(part1Path))
{
writer.Write("[mock content]");
writer.Close();
}
}
示例5: AddContent
public void AddContent(PartInfo rel, Stream sourceStream)
{
PartInfo parentPart = GetPart(rel.RelatedTo);
PartInfo clonedPart = new PartInfo(this, rel);
string sContentType;
if (ContentIsInternalType(rel.Type))
{
sContentType = rel.GetContentType();
clonedPart.Target = RemoveLeadingSlash(clonedPart.Target);
parentPart.AddRelatedItem(clonedPart);
if (m_partsMap.ContainsKey(clonedPart.AbsolutePath()) && sourceStream == null)
{ // we have already added this content via a relationship elsewhere, don't need to write it
return;
}
m_partsMap.Add(clonedPart.AbsolutePath(), clonedPart);
if (sourceStream != null)
{
string partName = clonedPart.AbsolutePath();
AddZipEntry(partName, sourceStream);
if (rel.ContentTypeOverriden())
m_contentTypes.Add("/" + partName, sContentType);
}
}
else
{//we should only get here for external rels - so there should never be an additional stream to add
parentPart.AddRelatedItem(clonedPart);
sContentType = rel.Type;
if (m_partsMap.ContainsKey(clonedPart.Target))
{ // we have already added this content via a relationship elsewhere, don't need to write it
return;
}
m_partsMap.Add(clonedPart.Target, clonedPart);
if (sourceStream != null)
{
throw new System.InvalidOperationException("Sourcestream is not null for supposedly external hyperlink part");
}
}
}
示例6: SaveInfoToFile
/// <summary>
/// Saves the provided parts info to file.
/// </summary>
/// <param name="parts">An array of the parts to save to file.</param>
public void SaveInfoToFile(PartInfo[] parts)
{
// Logging disabled to boost performance
//using (LogGroup logGroup = LogGroup.StartDebug("Saving the provided parts to XML file."))
//{
string path = FileNamer.PartsInfoFilePath;
//LogWriter.Debug("Path : " + path);
if (!Directory.Exists(Path.GetDirectoryName(path)))
Directory.CreateDirectory(Path.GetDirectoryName(path));
using (StreamWriter writer = File.CreateText(path))
{
XmlSerializer serializer = new XmlSerializer(parts.GetType());
serializer.Serialize(writer, parts);
writer.Close();
}
//}
}
示例7: ParsePartition
protected void ParsePartition(byte[] aMBR, UInt32 aLoc) {
byte xSystemID = aMBR[aLoc + 4];
// SystemID = 0 means no partition
if (xSystemID == 0x5 || xSystemID == 0xF || xSystemID == 0x85)
{
//Extended Partition Detected
//DOS only knows about 05, Windows 95 introduced 0F, Linux introduced 85
//Search for logical volumes
//http://thestarman.pcministry.com/asm/mbr/PartTables2.htm
EBRLocation = aMBR.ToUInt32(aLoc + 8);
}
else if (xSystemID != 0) {
UInt32 xStartSector = aMBR.ToUInt32(aLoc + 8);
UInt32 xSectorCount = aMBR.ToUInt32(aLoc + 12);
var xPartInfo = new PartInfo(xSystemID, xStartSector, xSectorCount);
Partitions.Add(xPartInfo);
}
}
示例8: AddMessageHeaderForParameter
private void AddMessageHeaderForParameter(MessageHeaders headers, PartInfo headerPart, MessageVersion messageVersion, object parameterValue, bool isXmlElement)
{
string str;
bool flag;
bool flag2;
MessageHeaderDescription headerDescription = (MessageHeaderDescription) headerPart.Description;
object headerValue = OperationFormatter.GetContentOfMessageHeaderOfT(headerDescription, parameterValue, out flag, out flag2, out str);
if (isXmlElement)
{
if (headerValue != null)
{
XmlElement element = (XmlElement) headerValue;
headers.Add(new OperationFormatter.XmlElementMessageHeader(this, messageVersion, element.LocalName, element.NamespaceURI, flag, str, flag2, element));
}
}
else
{
headers.Add(new DataContractSerializerMessageHeader(headerPart, headerValue, flag, str, flag2));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:DataContractSerializerOperationFormatter.cs
示例9: Initialize
/// <summary>
/// Initializes the parts and loads all parts to state.
/// </summary>
public void Initialize()
{
using (LogGroup logGroup = LogGroup.StartDebug("Initializing the web parts."))
{
if (StateAccess.IsInitialized && !PartState.IsInitialized)
{
PartInfo[] parts = new PartInfo[]{};
bool pageIsAccessible = Page != null;
// Only scan for parts if the page component is accessible (otherwise they can't be loaded through LoadControl)
// and when the parts have NOT yet been mapped
if (pageIsAccessible && !IsCached)
{
LogWriter.Debug("Is not cached. Scanning from type attributes.");
parts = FindParts();
Saver.SaveInfoToFile(parts);
Initialize(parts);
}
else if(IsCached)
{
LogWriter.Debug("Is cached. Loading from XML.");
parts = LoadParts();
Initialize(parts);
}
}
else
LogWriter.Debug("State is not initialized. Skipping.");
}
}
示例10: SerializeParameters
private void SerializeParameters(XmlDictionaryWriter writer, PartInfo[] parts, object[] parameters)
{
if (parts.Length != parameters.Length)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
new ArgumentException(SR.Format(SR.SFxParameterCountMismatch, "parts", parts.Length, "parameters", parameters.Length), "parameters"));
for (int i = 0; i < parts.Length; i++)
{
PartInfo part = parts[i];
SerializeParameter(writer, part, parameters[part.Description.Index]);
}
}
示例11: SerializeParameter
private void SerializeParameter(XmlDictionaryWriter writer, PartInfo part, object graph)
{
writer.WriteStartElement(part.DictionaryName, part.DictionaryNamespace);
if (graph == null)
{
writer.WriteStartAttribute(_xsiNilLocalName, _xsiNilNamespace);
writer.WriteValue(true);
writer.WriteEndAttribute();
}
else
part.WriteValue(writer, graph);
writer.WriteEndElement();
}
示例12: DeserializeParameter
private object DeserializeParameter(XmlDictionaryReader reader, PartInfo part)
{
if (reader.AttributeCount > 0 &&
reader.MoveToAttribute(_xsiNilLocalName.Value, _xsiNilNamespace.Value) &&
reader.ReadContentAsBoolean())
{
reader.Skip();
return null;
}
return part.ReadValue(reader);
}
示例13: SerializeParameters
private void SerializeParameters(XmlDictionaryWriter writer, PartInfo[] parts, object[] parameters)
{
for (int i = 0; i < parts.Length; i++)
{
PartInfo part = parts[i];
object graph = parameters[part.Description.Index];
this.SerializeParameter(writer, part, graph);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:DataContractSerializerOperationFormatter.cs
示例14: BuildPartitionInfo
Dictionary<Block, PartInfo> BuildPartitionInfo() {
var partInfo = new Dictionary<Block, PartInfo>();
foreach (var block in blockGraph.Nodes) {
if (uni.IsUniform(impl.Name, block))
continue;
var parts = block.Cmds.Cast<Cmd>().TakeWhile(
c => c is AssumeCmd &&
QKeyValue.FindBoolAttribute(((AssumeCmd)c).Attributes, "partition"));
Expr pred = null;
if (parts.Count() > 0) {
pred = parts.Select(a => ((AssumeCmd)a).Expr).Aggregate(Expr.And);
block.Cmds =
new List<Cmd>(block.Cmds.Cast<Cmd>().Skip(parts.Count()).ToArray());
} else {
continue;
}
Block realDest = block;
if (block.Cmds.Count == 0) {
var gc = block.TransferCmd as GotoCmd;
if (gc != null && gc.labelTargets.Count == 1)
realDest = gc.labelTargets[0];
}
partInfo[block] = new PartInfo(pred, realDest);
}
return partInfo;
}
示例15: DeserializeParameters
private void DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, object[] parameters)
{
if (parts.Length != parameters.Length)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
new ArgumentException(SR.Format(SR.SFxParameterCountMismatch, "parts", parts.Length, "parameters", parameters.Length), "parameters"));
int nextPartIndex = 0;
while (reader.IsStartElement())
{
for (int i = nextPartIndex; i < parts.Length; i++)
{
PartInfo part = parts[i];
if (IsPartElement(reader, part))
{
parameters[part.Description.Index] = DeserializeParameter(reader, parts[i]);
nextPartIndex = i + 1;
}
else
parameters[part.Description.Index] = null;
}
if (reader.IsStartElement())
OperationFormatter.TraceAndSkipElement(reader);
}
}