/// <summary> /// Package_Json转换为Table /// </summary> /// <param name="packageJsonnString"></param> public void Package_JsonToTable(string packageJsonnString) { if (string.IsNullOrWhiteSpace(packageJsonnString)) { return; } List <Package> packageList = JsonConvert.DeserializeObject <List <Package> >(packageJsonnString); if (packageList == null || packageList.Count == 0) { return; } _packageTable.Clear(); PackageConfig config = new PackageConfig(); foreach (Package item in packageList) { DataRow row = _packageTable.NewRow(); row[config.Oid] = item.Oid; row[config.Name] = item.Name; row[config.IsChecked] = item.IsChecked; row[config.Order] = item.Order; row[config.Code] = item.Code; _packageTable.Rows.Add(row); } bindGrid(dataGridView2, _packageTable, new int[] { 0 }); }
public IEnumerable <PackageReference> GetPackageReferences() { PackageConfig packageConfig = new PackageConfig(ConfigFileName); packageConfig.Load(); return(packageConfig.PackageReferences); }
/// <summary> /// Package_Table转换为JSON /// </summary> /// <returns></returns> public string Package_TableToJson() { string result = string.Empty; if (dataGridView2.DataSource == null) { return(result); } DataTable dt = (DataTable)dataGridView2.DataSource; if (dt == null || dt.Rows.Count <= 0) { return(result); } PackageConfig config = new PackageConfig(); List <Package> packList = new List <Package>(); foreach (DataRow row in dt.Rows) { Package package = new Package(); package.Oid = row[config.Oid] == DBNull.Value ? 0 : Convert.ToInt32(row[config.Oid]); package.Name = row[config.Name] == DBNull.Value ? "" : (string)row[config.Name]; package.IsChecked = row[config.IsChecked] == DBNull.Value ? false : Convert.ToBoolean(row[config.IsChecked]); package.Order = row[config.Order] == DBNull.Value ? 0 : Convert.ToInt32(row[config.Order]); package.Code = row[config.Code] == DBNull.Value ? "" : (string)row[config.Code]; packList.Add(package); } result = JsonConvert.SerializeObject(packList); return(result); }
public GemServer(string profileName, ServerConfig serverConfig, PackageConfig packageConfig) { //validate server config Guard.That(serverConfig).IsNotNull(); Guard.That(packageConfig).IsNotNull(); GemNetwork.ActiveProfile = profileName; //setup authentication if (serverConfig.RequireAuthentication) { RequireAuthentication(); } else { Profile(GemNetwork.ActiveProfile).OnIncomingConnection((srvr, netconnection, msg) => { netconnection.Approve(); GemNetworkDebugger.Append.Info(String.Format("Approved {0} {3} Sender: {1}{3} Message: {2}", netconnection, msg.Sender, msg.Message, Environment.NewLine)); }); } this.serverConfig = serverConfig; this.PackageConfig = packageConfig; server = GemNetwork.Server; messageProcessor = new ServerMessageProcessor(server); asyncMessageProcessor = new ParallelTaskStarter(TimeSpan.Zero); }
public bool FromConfig(PackageConfig config) { if (config == null || string.IsNullOrEmpty(config.Name) || !string.IsNullOrEmpty(Key) && Key != config.Name) { return(false); } if (string.IsNullOrEmpty(Name)) { Name = config.Name; } if (string.IsNullOrEmpty(Key)) { Key = config.Name; } CurrentVersion = config.Version; if (NetworkVersions == null) { NetworkVersions = new Dictionary <PackageConfig.Platform, string>(); } foreach (var platform in config.NetworkSdkVersions.Keys) { if (!NetworkVersions.ContainsKey(platform)) { NetworkVersions[platform] = config.NetworkSdkVersions[platform]; } } return(true); }
/// <summary> /// Connect to the server /// </summary> public void Connect(ConnectionConfig connectionDetails, PackageConfig packageConfig, ConnectionApprovalMessage approvalMessage) { this.connectionDetails = connectionDetails; this.PackageConfig = packageConfig; var config = new NetPeerConfiguration(connectionDetails.ServerName); config.EnableMessageType(NetIncomingMessageType.Data); config.EnableMessageType(NetIncomingMessageType.WarningMessage); config.EnableMessageType(NetIncomingMessageType.VerboseDebugMessage); config.EnableMessageType(NetIncomingMessageType.ErrorMessage); config.EnableMessageType(NetIncomingMessageType.Error); config.EnableMessageType(NetIncomingMessageType.DebugMessage); config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse); client = new NetClient(config); client.Start(); //encrypt passwords ? //INetEncryption algo = new NetTripleDESEncryption(encryptionKey); //handshake.Encrypt(algo); //Create the approval message var handshake = CreateMessage(); approvalMessage.Encode(handshake); client.Connect(connectionDetails.ServerIP, handshake); }
static void Main(string[] args) { try { MergeLog.Loginformation("Main - Start"); //Create Mutex object & its related varibale to avoid running multiple instances const string appName = "SingleCSVInstanceApp"; bool createdNew; mutex = new Mutex(true, appName, out createdNew); MergeLog.Loginformation("Mutex thread created."); if (!createdNew) { //Prompt the message to enduser and close the current instance MessageBox.Show("Application is already running."); MergeLog.Loginformation("Mutex thread identified already win form instance is running."); return; } //Identify the Windows form exe is launched with/without parameters if (args.Length > 0) { //Declare client object and which will create all required object at runtime BusinessClient businessClient = new BusinessClient(); //Read the saved selection of CSV files and destination paths MergeCSVData data = PackageConfig.ReadMergeCSVData(); //Validating saved tool configuration values if (string.IsNullOrEmpty(data.CSVFilePath1.Trim()) || string.IsNullOrEmpty(data.CSVFilePath2.Trim()) || string.IsNullOrEmpty(data.HeaderExists.Trim()) || string.IsNullOrEmpty(data.JsonFilePath.Trim())) { //Prompt the validation message to enduser and close the current instance MessageBox.Show("Invalid Configuration values. Please use UI execution.", "MergeCSVTool"); MergeLog.Loginformation("Invalid Configuration values."); return; } // Call the merge method businessClient.MergeCsvToJson(data); MessageBox.Show("Given CSV files are merged successfully.", "MergeCSVTool"); } else { //Open Merge win form Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MergeCSVToJson()); } MergeLog.Loginformation("Main - End"); } catch (Exception ex) { MergeLog.LogError(ex); MessageBox.Show(ex.Message, "MergeCSVTool"); } }
public Packager(AspNetCorePackager aspNetCorePackager, IHandleFiles fileHandler, PackageConfig packageConfig, AppConfig baseConfig, ConsoleWriter log, Hack hack) { _aspNetCorePackager = aspNetCorePackager; _fileHandler = fileHandler; _packageConfig = packageConfig; _baseConfig = baseConfig; _log = log; _hack = hack; }
/// <summary> /// 初始化PackageConfig /// </summary> public void InitPackageTable() { PackageConfig package = new PackageConfig(); _packageTable = new DataTable(); _packageTable.Columns.Add(package.Oid, typeof(int)); _packageTable.Columns.Add(package.Name, typeof(string)); _packageTable.Columns.Add(package.IsChecked, typeof(bool)); _packageTable.Columns.Add(package.Order, typeof(int)); _packageTable.Columns.Add(package.Code, typeof(string)); bindGrid(dataGridView2, _packageTable, new int[] { 0 }); }
private void MergeCSVToJson_Load(object sender, EventArgs e) { openCSVFileDlg.Filter = "CSV files (*.csv)|*.csv"; openCSVFileDlg.FileName = ""; MergeCSVData data = PackageConfig.ReadMergeCSVData(); txtCSVFilePath1.Text = data.CSVFilePath1; txtCSVFilePath2.Text = data.CSVFilePath2; txtJsonFolderPath.Text = data.JsonFilePath; chkHeader.Checked = (data.HeaderExists == string.Empty) ? false : Convert.ToBoolean(data.HeaderExists); }
public void ItHandlesASingleCertOnASingleEndpoint() { // g var packageConfig = new PackageConfig { Https = new List <HttpsConfig> { new HttpsConfig { ApplicationTypeName = "MyApp", CertThumbprint = "MyCert", ServiceManifestName = "MyService", EndpointName = "MyEndpoint" } } }; var appManifest = new ApplicationManifest { ServiceManifestImports = new List <ServiceManifestImport> { new ServiceManifestImport { ServiceManifestRef = new ServiceManifestRef { ServiceManifestName = "MyService" } } } }; var endpointHandler = new HandleEndpointCert(); // w endpointHandler.SetEndpointCerts(packageConfig, appManifest, "MyApp"); // t var endpointBindingPolicy = appManifest .ServiceManifestImports.First() .Policies .EndpointBindingPolicy.First(); endpointBindingPolicy.EndpointRef.Should().Be("MyEndpoint"); endpointBindingPolicy.CertificateRef.Should().Be("Certificate0"); var endpointCertificate = appManifest.Certificates.EndpointCertificates.First(); endpointCertificate.Name.Should().Be("Certificate0"); endpointCertificate.X509FindValue.Should().Be("MyCert"); }
private void CollectAndSaveConfigDetails() { try { mergeCSVData = new MergeCSVData(); mergeCSVData.CSVFilePath1 = txtCSVFilePath1.Text; mergeCSVData.CSVFilePath2 = txtCSVFilePath2.Text; mergeCSVData.JsonFilePath = txtJsonFolderPath.Text; mergeCSVData.HeaderExists = chkHeader.Checked.ToString(); PackageConfig.WriteMergeCSVData(mergeCSVData); } catch (Exception e) { MergeLog.LogError(e); throw e; } }
//自动打AB包 public static void BuildAB(PackageConfig packageConfig) { PlatformType platformType = PlatformType.PC; bool isBuildExe = false; bool isContainAB = true; switch (packageConfig.platformType) { case PackageConfig.PlatformType.Andriod: platformType = PlatformType.Android; break; case PackageConfig.PlatformType.IOS: platformType = PlatformType.IOS; break; } BuildHelper.Build(platformType, packageConfig.buildAssetBundleOptions, packageConfig.buildOptions, isBuildExe, isContainAB); }
/// <summary> /// Initializes a new instance of GemClient. /// </summary> /// <param name="profile">The profile the client's configuration is set</param> /// <param name="connectionConfig">The configuration for the connection</param> /// <param name="packageConfig">The configuration for the outgoing messages</param> public GemClient(string profile, ConnectionConfig connectionConfig, PackageConfig packageConfig) { Guard.That(connectionConfig).IsNotNull(); Guard.That(packageConfig).IsNotNull(); PackageConfig = packageConfig; connectionDetails = connectionConfig; GemNetwork.ActiveProfile = profile; //TODO: check if the client is already connected this.client = GemNetwork.Client; this.client.PackageConfig = PackageConfig; RegisterServerNotificationPackages(profile); messageProcessor = new ClientMessageProcessor(client); asyncMessageProcessor = new ParallelTaskStarter(TimeSpan.Zero); }
public ServiceHashCalculator( ConsoleWriter log, PackageConfig packageConfig, IHandleFiles fileHandler, ManifestHandler manifestHandler, ManifestLoader <ApplicationManifest> appManifestLoader, ManifestLoader <ServiceManifest> serviceManifestLoader, HandleEnciphermentCert handleEnciphermentCert, HandleEndpointCert handleEndpointCert) { _log = log; _packageConfig = packageConfig; _fileHandler = fileHandler; _manifestHandler = manifestHandler; _appManifestLoader = appManifestLoader; _serviceManifestLoader = serviceManifestLoader; _handleEnciphermentCert = handleEnciphermentCert; _handleEndpointCert = handleEndpointCert; }
public ManifestHandler( AppConfig baseConfig, PackageConfig packageConfig, ManifestLoader <ApplicationManifest> appManifestLoader, ManifestLoader <ServiceManifest> serviceManifestLoader, HandleEnciphermentCert handleEnciphermentCert, HandleEndpointCert handleEndpointCert, ApplicationManifestHandler appManifestHandler, ServiceManifestHandler serviceManifestHandler) { _baseConfig = baseConfig; _packageConfig = packageConfig; _appManifestLoader = appManifestLoader; _serviceManifestLoader = serviceManifestLoader; _handleEnciphermentCert = handleEnciphermentCert; _handleEndpointCert = handleEndpointCert; _appManifestHandler = appManifestHandler; _serviceManifestHandler = serviceManifestHandler; }
public void Test() { // g var packageConfig = new PackageConfig { Encipherment = new List <Encipherment> { new Encipherment { ApplicationTypeName = "MyApp", CertName = "MyCert", CertThumbprint = "MyThumb", Name = "MyCustomName" } } }; var appManifest = new ApplicationManifest(); var enciphermentHandler = new HandleEnciphermentCert(); // w enciphermentHandler.SetEnciphermentCerts(packageConfig, appManifest, "MyApp"); // t var securityAccessPolicy = appManifest.Policies.SecurityAccessPolicies.SecurityAccessPolicy.First(); securityAccessPolicy.ResourceRef.Should().Be("MyCert"); securityAccessPolicy.GrantRights.Should().Be("Read"); securityAccessPolicy.PrincipalRef.Should().Be("MyCustomName"); securityAccessPolicy.ResourceType.Should().Be("Certificate"); var user = appManifest.Principals.Users.User.First(); user.AccountType.Should().Be("NetworkService"); user.Name.Should().Be("MyCustomName"); var certificate = appManifest.Certificates.SecretsCertificate.First(); certificate.Name.Should().Be("MyCert"); certificate.X509FindType.Should().Be("FindByThumbprint"); certificate.X509FindValue.Should().Be("MyThumb"); }
void LoadPackageConfig() { string path = Application.dataPath + "/" + PackagePlatform.packageConfigPath; if (string.IsNullOrEmpty(path)) { Debug.Log("打包配置文件未找到"); return; } string str = File.ReadAllText(path); PackageConfig pc = JsonUtility.FromJson <PackageConfig>(str); mainVersion = pc.mainVersion; minorVersion = pc.minorVersion; rawScenePath = pc.rawScenePath; rawCodePath = pc.rawCodePath; rawConfigPath = pc.rawConfigPath; rawDataTablePath = pc.rawDataTablePath; }
public bool Connect(ServerConfig serverConfig, PackageConfig packageConfig) { this.PackageConfig = packageConfig; this.serverConfig = serverConfig; if (netServer != null) { GemNetworkDebugger.Append.Error("Server already started"); return(false); } var config = new NetPeerConfiguration(serverConfig.Name) { Port = serverConfig.Port, MaximumConnections = serverConfig.MaxConnections, EnableUPnP = serverConfig.EnableUPnP, ConnectionTimeout = serverConfig.ConnectionTimeout, MaximumHandshakeAttempts = serverConfig.MaxConnectionAttempts }; config.EnableMessageType(NetIncomingMessageType.Data); config.EnableMessageType(NetIncomingMessageType.WarningMessage); config.EnableMessageType(NetIncomingMessageType.VerboseDebugMessage); config.EnableMessageType(NetIncomingMessageType.ErrorMessage); config.EnableMessageType(NetIncomingMessageType.Error); config.EnableMessageType(NetIncomingMessageType.DebugMessage); config.EnableMessageType(NetIncomingMessageType.ConnectionApproval); config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest); this.netServer = new NetServer(config); try { this.netServer.Start(); GemNetworkDebugger.Append.Info("Server started"); return(true); } catch (Exception ex) { GemNetworkDebugger.Append.Error("Failed to start the server. Reason {0}", ex.Message); return(false); } }
static List <AssetBundleBuild> GeneratorAssetbundleEntry() { string path = Application.dataPath + "/" + PackagePlatform.packageConfigPath; if (string.IsNullOrEmpty(path)) { return(null); } string str = File.ReadAllText(path); Dict <string, ABEntry> abEntries = new Dict <string, ABEntry>(); PackageConfig apc = JsonUtility.FromJson <PackageConfig>(str); AssetBundlePackageInfo[] bundlesInfo = apc.bundles; for (int i = 0; i < bundlesInfo.Length; i++) { ABEntry entry = new ABEntry(); entry.bundleInfo = bundlesInfo[i]; if (!abEntries.ContainsKey(entry.bundleInfo.name)) { abEntries.Add(entry.bundleInfo.name, entry); } } List <AssetBundleBuild> abbList = new List <AssetBundleBuild>(); foreach (var rEntryItem in abEntries) { abbList.AddRange(rEntryItem.Value.ToABBuild()); } return(abbList); }
public NonSecureClusterConnection(PackageConfig packageConfig, ConsoleWriter log) : base(log) { _packageConfig = packageConfig; }
public SfProjectHandler(ManifestParser appManifestHandler, AppConfig baseConfig, PackageConfig packageConfig) { _appManifestHandler = appManifestHandler; _baseConfig = baseConfig; _packageConfig = packageConfig; }
void Awake() { packageConfig = (PackageConfig)target; }
public PackageConfigFileFinder(PackageConfig packageConfig) { _packageConfig = packageConfig; }
public static void RegisterPackageConfig(Container container, PackageConfig config) { container.RegisterSingleton(config); }
public SecureClusterConnection(IHandleFiles blobService, PackageConfig packageConfig, ConsoleWriter log) : base(log) { _blobService = blobService; _packageConfig = packageConfig; }
private bool HasVersion() { Debug("CheckNewVersion ..."); var url = ProcessConfig.SourceUrl; if (url[url.Length - 1] != '/') url += "/"; string packageXml = HttpDownloader.Get(url + PackageDescFileName); _lastConfig = packageXml.ToXmlReader().Deserialize<PackageConfig>(); if (_fileManager.InstalledVersion != _lastConfig.Version) { Debug("CheckNewVersion end, found new version = " + _lastConfig.Version); _fileManager.SavePackageDesc(packageXml); return true; } else Debug("CheckNewVersion end, not found new version"); return false; }
public void SetEndpointCerts( PackageConfig packageConfig, ApplicationManifest appManifest, string appTypeName) { var httpsCerts = packageConfig .Https .Where(x => x.ApplicationTypeName.Equals(appTypeName)) .OrderBy(x => x.CertThumbprint) .ToList(); if (!httpsCerts.Any()) { return; } if (appManifest.Certificates == null) { appManifest.Certificates = new Certificates(); } if (appManifest.Certificates.EndpointCertificates == null) { appManifest.Certificates.EndpointCertificates = new List <EndpointCertificate>(); } var certList = appManifest.Certificates.EndpointCertificates; var distinctThumbprints = httpsCerts .GroupBy(x => x.CertThumbprint); distinctThumbprints.ForEach((certGroup, i) => { var certificate = certGroup.First(); var certName = $"Certificate{i}"; certList.Add(new EndpointCertificate { Name = certName, X509FindValue = certificate.CertThumbprint }); certGroup.ForEach(cert => { var importNodeList = appManifest .ServiceManifestImports .Where(x => x.ServiceManifestRef.ServiceManifestName.Equals(cert.ServiceManifestName)) .ToList(); if (!importNodeList.Any()) { return; } var importNode = importNodeList.First(); if (importNode.Policies == null) { importNode.Policies = new Policies(); } if (importNode.Policies.EndpointBindingPolicy == null) { importNode.Policies.EndpointBindingPolicy = new List <EndpointBindingPolicy>(); } var binding = new EndpointBindingPolicy { CertificateRef = certName, EndpointRef = cert.EndpointName }; importNode.Policies.EndpointBindingPolicy.Add(binding); }); }); appManifest.Certificates.EndpointCertificates = certList; }
static void Main(string[] args) { Logger.Debug("Updater proc ..."); try { if (args == null && args.Length != 1) throw new ArgumentException("Входная папка не задана"); _mgr = new FileManager(args[0]); _package = _mgr.LoadPackageDesc().ToXmlReader().Deserialize<PackageConfig>(); if (_mgr.InstalledVersion == _mgr.DownloadedVersion) { Logger.Debug("Service already updated!"); return; } StartAndWaitAction("OnBeforeUpdateAction", _package.OnBeforeUpdateAction); TryUpdate(); StartAndWaitAction("OnSuccessUpdateAction", _package.OnSuccessUpdateAction); } catch (Exception ex) { Logger.Error("Updater proc: " + ex); StartAndWaitAction("OnErrorUpdateAction", _package.OnErrorUpdateAction); } Logger.Debug("Updater proc: end"); }
public void SetEnciphermentCerts( PackageConfig packageConfig, ApplicationManifest appManifest, string appTypeName) { var encipherments = packageConfig .Encipherment .Where(x => EncipherNameEqualsAppName(x, appTypeName)) .ToList(); if (!encipherments.Any()) { return; } if (appManifest.Principals == null) { appManifest.Principals = new Principals(); } if (appManifest.Principals.Users == null) { appManifest.Principals.Users = new Users(); } if (appManifest.Principals.Users.User == null) { appManifest.Principals.Users.User = new List <User>(); } if (appManifest.Policies == null) { appManifest.Policies = new Policies(); } if (appManifest.Policies.SecurityAccessPolicies == null) { appManifest.Policies.SecurityAccessPolicies = new SecurityAccessPolicies(); } if (appManifest.Policies.SecurityAccessPolicies.SecurityAccessPolicy == null) { appManifest.Policies.SecurityAccessPolicies.SecurityAccessPolicy = new List <SecurityAccessPolicy>(); } if (appManifest.Certificates == null) { appManifest.Certificates = new Certificates(); } if (appManifest.Certificates.SecretsCertificate == null) { appManifest.Certificates.SecretsCertificate = new List <SecretsCertificate>(); } foreach (var encipherment in encipherments) { var user = new User { Name = encipherment.Name, AccountType = "NetworkService" }; var policy = new SecurityAccessPolicy { GrantRights = "Read", PrincipalRef = encipherment.Name, ResourceRef = encipherment.CertName, ResourceType = "Certificate" }; var secretCert = new SecretsCertificate { Name = encipherment.CertName, X509FindValue = encipherment.CertThumbprint, X509FindType = "FindByThumbprint" }; appManifest.Principals.Users.User.Add(user); appManifest.Policies.SecurityAccessPolicies.SecurityAccessPolicy.Add(policy); appManifest.Certificates.SecretsCertificate.Add(secretCert); } }