public FileInfo Package(string templateProjectDirectory, PackagingMode mode) { switch (mode) { case PackagingMode.VisualStudio: Packager = new VisualStudioPackager(); break; case PackagingMode.Minimal: Packager = new MinimalPackager(); break; default: throw new ArgumentOutOfRangeException(nameof(mode), mode, null); } var files = Packager.GetContentFiles(templateProjectDirectory); SetContentFiles(files); using (var stream = new FileStream(Path.Combine(templateProjectDirectory, "TemplatePackage.nuspec"), FileMode.Create)) { //NuSpec.Save(stream, validate: true); } //NuSpec.Save(new FileStream(Path.Combine(templateProjectDirectory, "TemplatePackage.nuspec"), FileMode.Create), validate: true); var package = BuildPackage(templateProjectDirectory); return(package); }
private void InitKcpServer() { this.packager = new CShaperPackager(); this.kServer = new KService(new IPEndPoint(IPAddress.Any, 3900)) { OnReadCallback = this.OnServiceReadCallback, OnErrorCallback = this.OnServiceErrorCallback }; }
public GamepadServer() { try { jc = new AndroidJavaClass("org.unity.UnityAPIBridge"); } catch (Exception) { //如果加载sdk失败,则启动脚本Server,且实例化对应的解包器 uServer = new UServer(); kServer = new KServer(3899) { OnReciveCallBack = OnReciveMessage }; packager = new CShaperPackager(); } }
public DistributedTaskDefinitionsController( IJsonApiContext jsonApiContext, IResourceService <DistributedTaskDefinition> taskDefinitionResourceService, ILoggerFactory loggerFactory, IPathsProvider pathsProvider, IProblemPluginFacadeProvider problemPluginFacadeProvider, IFileStorage fileStorage, IPackager packager, IJsonApiResponseFactory jsonApiResponseFactory ) : base(jsonApiContext, taskDefinitionResourceService, loggerFactory) { _taskDefinitionResourceService = taskDefinitionResourceService; _pathsProvider = pathsProvider; _problemPluginFacadeProvider = problemPluginFacadeProvider; _fileStorage = fileStorage; _packager = packager; _jsonApiResponseFactory = jsonApiResponseFactory; _logger = loggerFactory.CreateLogger <DistributedTaskDefinitionsController>(); }
/// <summary> /// 手柄消息回调 /// </summary> /// <param name="data"></param> public void NetKeyEvent(string data) { if (!firstMessage) { //当第一次收到消息回调时,先确定新旧版本的sdk解析器 if (data.IndexOf('-') > 0) { packager = new SdkPackager1(); } else { packager = new SdkPackager2(); } firstMessage = true; } IMessage msg = packager.Decode(data); App.Make <IEventDispatcher>().Dispatch(new GamepadEventArgs(msg)); }
// ------------------------------------------------------------------- /// <summary> /// Takes the tree of submittable items and sends those that should be /// included (based on the target assignment) to the specified stream, /// using the packager defined for the target assignment. /// </summary> /// <remarks> /// Users implementing a user interface for this submitter core need /// not call this method; rather, it is exposed as public so that /// custom protocol handlers can call it from within their Submit /// method in order to transfer the final submitted package to its /// destination. /// </remarks> /// <param name="stream"> /// The System.IO.Stream to write the package contents to. /// </param> public void PackageContentsIntoStream(Stream stream) { IPackager packager = PackagerRegistry.CreatePackagerInstance(assignment.Packager); Dictionary <string, string> parameters = assignment.PackagerParameters; packager.StartPackage(stream, parameters); foreach (ISubmittableItem item in new DepthFirstTraversal <ISubmittableItem>(submittableItems, delegate(ISubmittableItem i) { return(i.Children); })) { if (!assignment.IsFileExcluded(item.Filename)) { packager.AddSubmittableItem(item); } } packager.EndPackage(); }
/// <summary> /// 接收sdk的回调消息 /// </summary> /// <param name="data"></param> public void ReciveMessage(string data) { if (!initSdk) { //当第一次收到消息回调时,先确定新旧版本的sdk解析器 if (data.IndexOf('-') > 0) { packager = new SdkPackager1(); } else { packager = new SdkPackager2(); } initSdk = true; } IMessage msg = packager.Decode(data); if (msg != null) { Callback?.Invoke(msg); } }
public void Register(IPackager packager, string name) { _packagers.Add(name, packager); }
static int Main(string[] args) { try { var extra = _options.Parse(args); if (extra.Count != 0) { Console.Error.WriteLine($"Invalid option: {extra[0]}"); PrintUsage(); return(1); } } catch (OptionException) { PrintUsage(); return(2); } int errcode; if (!CheckBasicOptions(args, out errcode)) { return(errcode); } GroupLoader.LoaderParams parms = new GroupLoader.LoaderParams { PrimLimit = Convert.ToInt32(_primLimit), Checks = (GroupLoader.LoaderChecks)Convert.ToInt16(_checks) }; ExpLib.Init(); GroupDisplayData data = null; List <GroupDisplayData> multiGroups = null; if (_stream) { string input = Console.In.ReadToEnd(); data = GroupLoader.Instance.LoadFromXML(input, parms); } else if (_xmlFile != null) { string input = File.ReadAllText(_xmlFile); data = GroupLoader.Instance.LoadFromXML(input, parms); } else if (_aggrDir != null) { multiGroups = new List <GroupDisplayData>(); var dirList = Directory.EnumerateFiles(_aggrDir, "*.xml"); foreach (var file in dirList) { string input = File.ReadAllText(file); multiGroups.Add(GroupLoader.Instance.LoadFromXML(input, parms)); } } else if (_userId != UUID.Zero && _invItemId != UUID.Zero) { data = GroupLoader.Instance.Load(_userId, _invItemId, parms); } else { Console.Error.WriteLine("Either stream, file, aggregation, or userid and invitemid are required parameters"); PrintUsage(); return(5); } IExportFormatter formatter = ExportFormatterFactory.Instance.Get(_formatter); ExportResult res = multiGroups != null?formatter.Export(multiGroups) : formatter.Export(data); Console.Out.WriteLine($"Scene Statistics:\n\n" + $"Concrete objects: {res.Stats.ConcreteCount}\n" + $"Instanced objects: {res.Stats.InstanceCount}\n" + $"Unique submeshes: {res.Stats.SubmeshCount}\n" + $"Concrete primitives: {res.Stats.PrimCount}\n" + $"Unique textures: {res.Stats.TextureCount}\n"); //sort the prim and face stats var sortedGroupsByPrimCount = res.Stats.GroupsByPrimCount.OrderByDescending(o => o.Item2); var sortedGroupsBySubmeshCount = res.Stats.GroupsBySubmeshCount.OrderByDescending(o => o.Item2); //top 10 Console.Out.WriteLine("Top 10 groups by prim count"); foreach (var grp in sortedGroupsByPrimCount.Take(10)) { Console.Out.WriteLine($"{grp.Item2} {grp.Item1}"); } Console.Out.WriteLine(); Console.Out.WriteLine("Top 10 groups by submesh count"); foreach (var grp in sortedGroupsBySubmeshCount.Take(10)) { Console.Out.WriteLine($"{grp.Item2} {grp.Item1}"); } Console.Out.WriteLine(); PackagerParams pp = new PackagerParams { Direct = _direct }; IPackager packager = PackagerFactory.Instance.Get(_packager); packager.CreatePackage(res, _outputDir, pp); ExpLib.ShutDown(); return(0); }