本文整理汇总了C#中Manifest类的典型用法代码示例。如果您正苦于以下问题:C# Manifest类的具体用法?C# Manifest怎么用?C# Manifest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Manifest类属于命名空间,在下文中一共展示了Manifest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init(Manifest m, Dictionary<string, string> info)
{
var sheet = new Sheet(SheetType.BGRA, info["Image"]);
var res = Game.Renderer.Resolution;
bounds = new Rectangle(0, 0, res.Width, res.Height);
sprite = new Sprite(sheet, new Rectangle(0, 0, 1024, 480), TextureChannel.Alpha);
}
示例2: ManifestModel
public ManifestModel(Manifest manifest)
{
this.ID = manifest.ID;
this.Date = manifest.Date;
this.Cost = manifest.Cost;
this.Remark = manifest.Remark;
}
示例3: Create
public Manifest Create(Manifest manifest)
{
try
{
if (ApiUrl == string.Empty)
{
throw new Exception(Errors.ERR_CONFIGM_MISSING_APIURL);
}
var uriBuilder = new UriBuilder(ApiUrl + "/manifests");
if (DevKey != string.Empty)
{
uriBuilder.Query = "subscription-key=" + DevKey;
}
var strManifest = ModelManager.ModelToJson(manifest);
var json = Rest.Post(uriBuilder.Uri, strManifest);
manifest = ModelManager.JsonToModel<Manifest>(json);
}
catch (Exception err)
{
var errString = string.Format(Errors.ERR_CONFIGM_MODEL_NOT_CREATED, manifest.name) + ", " + err.Message;
if (err.InnerException != null)
errString += ", " + err.InnerException.Message;
throw new Exception(errString);
}
return manifest;
}
示例4: ManifestValidatesManifestFiles
public void ManifestValidatesManifestFiles()
{
// Arrange
var manifest = new Manifest
{
Metadata = new ManifestMetadata
{
Id = "Foobar",
Version = "1.0",
Authors = "test-author",
Description = "desc",
},
Files = new List<ManifestFile> {
new ManifestFile {
Source = "|",
Target = "<"
},
new ManifestFile {
Source = @"foo\bar\|>",
Target = "lib"
},
new ManifestFile {
Source = @"foo\**\*.cs",
Exclude = "Exclude|"
}
}
};
// Act and Assert
ExceptionAssert.Throws<ValidationException>(() => Manifest.Validate(manifest),
"Source path '|' contains invalid characters.\r\nTarget path '<' contains invalid characters.\r\nSource path 'foo\\bar\\|>' contains invalid characters.\r\nExclude path 'Exclude|' contains invalid characters.");
}
示例5: DotNetNugDirectory
public DotNetNugDirectory(DirectoryName directoryName)
: base(directoryName)
{
var manifestFile = GetChildFile("MANIFEST.json");
var manifestContent = manifestFile.ReadToEnd();
_manifest = JsonUtil.Get<Manifest>(manifestContent);
}
示例6: Init
public override void Init(Manifest m, Dictionary<string, string> info)
{
loadInfo = info;
// Avoid standard loading mechanisms so we
// can display loadscreen as early as possible
r = Game.Renderer;
if (r == null) return;
sheet = new Sheet(SheetType.BGRA, Platform.ResolvePath(loadInfo["Image"]));
var res = r.Resolution;
bounds = new Rectangle(0, 0, res.Width, res.Height);
borderTop = new Sprite(sheet, new Rectangle(161, 128, 62, 33), TextureChannel.Alpha);
borderBottom = new Sprite(sheet, new Rectangle(161, 223, 62, 33), TextureChannel.Alpha);
borderLeft = new Sprite(sheet, new Rectangle(128, 161, 33, 62), TextureChannel.Alpha);
borderRight = new Sprite(sheet, new Rectangle(223, 161, 33, 62), TextureChannel.Alpha);
cornerTopLeft = new Sprite(sheet, new Rectangle(128, 128, 33, 33), TextureChannel.Alpha);
cornerTopRight = new Sprite(sheet, new Rectangle(223, 128, 33, 33), TextureChannel.Alpha);
cornerBottomLeft = new Sprite(sheet, new Rectangle(128, 223, 33, 33), TextureChannel.Alpha);
cornerBottomRight = new Sprite(sheet, new Rectangle(223, 223, 33, 33), TextureChannel.Alpha);
nodLogo = new Sprite(sheet, new Rectangle(0, 256, 256, 256), TextureChannel.Alpha);
gdiLogo = new Sprite(sheet, new Rectangle(256, 256, 256, 256), TextureChannel.Alpha);
evaLogo = new Sprite(sheet, new Rectangle(256, 64, 128, 64), TextureChannel.Alpha);
nodPos = new float2(bounds.Width / 2 - 384, bounds.Height / 2 - 128);
gdiPos = new float2(bounds.Width / 2 + 128, bounds.Height / 2 - 128);
evaPos = new float2(bounds.Width - 43 - 128, 43);
brightBlock = new Sprite(sheet, new Rectangle(320, 0, 16, 35), TextureChannel.Alpha);
dimBlock = new Sprite(sheet, new Rectangle(336, 0, 16, 35), TextureChannel.Alpha);
versionText = m.Mod.Version;
}
示例7: DigestMismatchException
/// <summary>
/// Creates a new digest mismatch exception.
/// </summary>
/// <param name="expectedDigest">The digest value the <see cref="Store.Model.Implementation"/> was supposed to have.</param>
/// <param name="actualDigest">The digest value that was actually calculated.</param>
/// <param name="expectedManifest">The <see cref="Manifest"/> that resulted in the <paramref name="expectedDigest"/>; may be <seealso langword="null"/>.</param>
/// <param name="actualManifest">The <see cref="Manifest"/> that resulted in the <paramref name="actualDigest"/>.</param>
public DigestMismatchException(string expectedDigest = null, string actualDigest = null, Manifest expectedManifest = null, Manifest actualManifest = null)
: base(GetMessage(expectedDigest, actualDigest, expectedManifest, actualManifest))
{
ExpectedDigest = expectedDigest;
ActualDigest = actualDigest;
ExpectedManifest = expectedManifest;
ActualManifest = actualManifest;
}
示例8: CreateSuccess
public static ManifestLoadResult CreateSuccess(string path, Manifest m)
{
return new ManifestLoadResult
{
Path = path,
Manifest = m
};
}
示例9: ModContentPromptLogic
public ModContentPromptLogic(Widget widget, Manifest mod, ModContent content, Action continueLoading)
{
var panel = widget.Get("CONTENT_PROMPT_PANEL");
var headerTemplate = panel.Get<LabelWidget>("HEADER_TEMPLATE");
var headerLines = !string.IsNullOrEmpty(content.InstallPromptMessage) ? content.InstallPromptMessage.Replace("\\n", "\n").Split('\n') : new string[0];
var headerHeight = 0;
foreach (var l in headerLines)
{
var line = (LabelWidget)headerTemplate.Clone();
line.GetText = () => l;
line.Bounds.Y += headerHeight;
panel.AddChild(line);
headerHeight += headerTemplate.Bounds.Height;
}
panel.Bounds.Height += headerHeight;
panel.Bounds.Y -= headerHeight / 2;
var advancedButton = panel.Get<ButtonWidget>("ADVANCED_BUTTON");
advancedButton.Bounds.Y += headerHeight;
advancedButton.OnClick = () =>
{
Ui.OpenWindow("CONTENT_PANEL", new WidgetArgs
{
{ "mod", mod },
{ "content", content },
{ "onCancel", Ui.CloseWindow }
});
};
var quickButton = panel.Get<ButtonWidget>("QUICK_BUTTON");
quickButton.IsVisible = () => !string.IsNullOrEmpty(content.QuickDownload);
quickButton.Bounds.Y += headerHeight;
quickButton.OnClick = () =>
{
var modFileSystem = new FileSystem.FileSystem(Game.Mods);
modFileSystem.LoadFromManifest(mod);
var downloadYaml = MiniYaml.Load(modFileSystem, content.Downloads, null);
modFileSystem.UnmountAll();
var download = downloadYaml.FirstOrDefault(n => n.Key == content.QuickDownload);
if (download == null)
throw new InvalidOperationException("Mod QuickDownload `{0}` definition not found.".F(content.QuickDownload));
Ui.OpenWindow("PACKAGE_DOWNLOAD_PANEL", new WidgetArgs
{
{ "download", new ModContent.ModDownload(download.Value) },
{ "onSuccess", continueLoading }
});
};
var backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
backButton.Bounds.Y += headerHeight;
backButton.OnClick = Ui.CloseWindow;
Game.RunAfterTick(Ui.ResetTooltips);
}
示例10: ModData
public ModData( params string[] mods )
{
Manifest = new Manifest( mods );
ObjectCreator = new ObjectCreator( Manifest );
LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen.Value);
LoadScreen.Init(Manifest.LoadScreen.NodesDict.ToDictionary(x => x.Key, x => x.Value.Value));
LoadScreen.Display();
WidgetLoader = new WidgetLoader( this );
}
示例11: ModData
public ModData( params string[] mods )
{
Manifest = new Manifest( mods );
ObjectCreator = new ObjectCreator( Manifest );
LoadScreen = ObjectCreator.CreateObject<ILoadScreen>(Manifest.LoadScreen);
LoadScreen.Init();
LoadScreen.Display();
WidgetLoader = new WidgetLoader( this );
}
示例12: ModContentLogic
public ModContentLogic(Widget widget, Manifest mod, ModContent content, Action onCancel)
{
this.content = content;
var panel = widget.Get("CONTENT_PANEL");
var modFileSystem = new FileSystem.FileSystem(Game.Mods);
modFileSystem.LoadFromManifest(mod);
var sourceYaml = MiniYaml.Load(modFileSystem, content.Sources, null);
foreach (var s in sourceYaml)
sources.Add(s.Key, new ModContent.ModSource(s.Value));
var downloadYaml = MiniYaml.Load(modFileSystem, content.Downloads, null);
foreach (var d in downloadYaml)
downloads.Add(d.Key, new ModContent.ModDownload(d.Value));
modFileSystem.UnmountAll();
scrollPanel = panel.Get<ScrollPanelWidget>("PACKAGES");
template = scrollPanel.Get<ContainerWidget>("PACKAGE_TEMPLATE");
var headerTemplate = panel.Get<LabelWidget>("HEADER_TEMPLATE");
var headerLines = !string.IsNullOrEmpty(content.HeaderMessage) ? content.HeaderMessage.Replace("\\n", "\n").Split('\n') : new string[0];
var headerHeight = 0;
foreach (var l in headerLines)
{
var line = (LabelWidget)headerTemplate.Clone();
line.GetText = () => l;
line.Bounds.Y += headerHeight;
panel.AddChild(line);
headerHeight += headerTemplate.Bounds.Height;
}
panel.Bounds.Height += headerHeight;
panel.Bounds.Y -= headerHeight / 2;
scrollPanel.Bounds.Y += headerHeight;
var discButton = panel.Get<ButtonWidget>("CHECK_DISC_BUTTON");
discButton.Bounds.Y += headerHeight;
discButton.IsVisible = () => discAvailable;
discButton.OnClick = () => Ui.OpenWindow("DISC_INSTALL_PANEL", new WidgetArgs
{
{ "afterInstall", () => { } },
{ "sources", sources },
{ "content", content }
});
var backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
backButton.Bounds.Y += headerHeight;
backButton.OnClick = () => { Ui.CloseWindow(); onCancel(); };
PopulateContentList();
Game.RunAfterTick(Ui.ResetTooltips);
}
示例13: InstallModLogic
public InstallModLogic(Widget widget, Manifest mod)
{
var panel = widget.Get("INSTALL_MOD_PANEL");
var mods = mod.RequiresMods.Where(m => !Game.IsModInstalled(m)).Select(m => "{0} ({1})".F(m.Key, m.Value));
var text = string.Join(", ", mods);
panel.Get<LabelWidget>("MOD_LIST").Text = text;
panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = Ui.CloseWindow;
}
示例14: ManifestEditorDialog
public ManifestEditorDialog(Manifest manifest, EditorMode mode = EditorMode.View)
{
InitializeComponent();
this.Icon = new Icon("Graphics\\EliteDangerousIcon.ico");
this.manifest = manifest;
this.mode = mode;
if (mode == EditorMode.View)
SetUpViewer();
}
示例15: ToManifest
public Manifest ToManifest()
{
Manifest manifest = new Manifest()
{
ID = this.ID,
Date = this.Date,
Cost = this.Cost,
Remark = this.Remark
};
return manifest;
}