private static void AddNexus(AccountSvc svc, int companyId) { FetchRequest nexusFetch = new FetchRequest(); nexusFetch.Filters = "CompanyId=" + companyId; nexusFetch.Filters = "CompanyId=1,EndDate='12/31/9999'";//Gets master list of possible nexus NexusFetchResult databaseNexus = svc.NexusFetch(nexusFetch); Nexus[] to_add = {databaseNexus.Nexuses[2], databaseNexus.Nexuses[7], databaseNexus.Nexuses[10] }; //I've just selected some values to add at random, this would be informed by your user input matched against the master list to find the // correct jurisdiction. You should compare the Nexus.JurisName. You don't have to add US nexus to add states throught the API, it adds the country nexus automatically. foreach (Nexus n in to_add) { Nexus newNexus = new Nexus(); newNexus = n; newNexus.CompanyId = companyId; newNexus.NexusId = 0; //Always set to 0 for a new nexus, otherwise use the fetched NexusId value to edit an existing nexus. newNexus.EffDate = DateTime.Today.AddYears(-1); //I'm setting the default start/end dates the same way the Admin Console will, user should specify. newNexus.EndDate = DateTime.MaxValue; newNexus.LocalNexusTypeId = LocalNexusTypeId.Selected; //This may vary based on the jurisdiction and needs of the client. NexusSaveResult res = svc.NexusSave(newNexus); if (res.ResultCode.Equals(SeverityLevel.Success)) { Console.WriteLine("Nexus saved for: " + newNexus.JurisName); } else{ Console.WriteLine("Nexus NOT saved for: " + newNexus.JurisName + " //Error: " + res.Messages[0].Summary); } } }
/// <summary> /// Sets the necessary variables /// </summary> /// <param name="_ServerIP">IP of the server to connect to</param> /// <param name="_Port">Port of the server to connect to</param> /// <param name="_FileName">Filename where the data has to be saved</param> /// <param name="_Nexus">Pointer to the central Nexus</param> /// <param name="_FileLength">The raw binary file lengt of the file to be received</param> public BinaryClient(string _ServerIP, int _Port, string _FileName, Nexus.Nexus _Nexus, long _FileLength) { FileName = _FileName; Port = _Port; ServerIP = _ServerIP; Nexus = _Nexus; FileLength = _FileLength; }
internal static CustomerDto Map(Nexus.Customer customer) { CustomerDto tmpCustomerData = null; if (customer != null) { tmpCustomerData = new CustomerDto(); tmpCustomerData.Id = customer.Id; tmpCustomerData.Name = customer.Name; tmpCustomerData.Address = customer.Address; } return tmpCustomerData; }
/// <summary> /// Gets the unparser to use to create an XML representation of the given <see cref="XmlScript"/>. /// </summary> /// <param name="p_xscScript">The <see cref="XmlScript"/> to unparse.</param> /// <returns>The unparser to use to unparse the given XML Script.</returns> protected override IUnparser GetUnparser(Nexus.Client.ModManagement.Scripting.XmlScript.XmlScript p_xscScript) { switch (p_xscScript.Version.ToString()) { case "1.0": case "2.0": case "3.0": case "4.0": throw new ParserException(String.Format("XML Script version {0} does not support the current game mode. Use verion 5.0 or later.", p_xscScript.Version)); case "5.0": return new SkyrimUnparser50(p_xscScript); } throw new ParserException("Unrecognized XML Script version (" + p_xscScript.Version + "). Perhaps a newer version of the mod manager is required."); }
/// <summary> /// Gets the editor to use to edit the <see cref="XmlScript"/> prerequisites. /// </summary> /// <param name="p_xscScript">The <see cref="XmlScript"/> whose prerequisites are to be edited.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit <see cref="XmlScript"/> prerequisites. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing the prerequisites.</returns> public virtual NodeEditor GetPrerequisitesEditor(Nexus.Client.ModManagement.Scripting.XmlScript.XmlScript p_xscScript, IList<VirtualFileSystemItem> p_lstModFiles) { CPLTextEditorVM vmlCplTextEditor = new CPLTextEditorVM(new FO3CplHighlightingStrategy(ScriptType.GetCplParserFactory()), ScriptType.GetCplParserFactory()); List<KeyValuePair<string, string>> lstVersionNames = new List<KeyValuePair<string, string>>(); lstVersionNames.Add(new KeyValuePair<string, string>("FOSE Version", "foseVersion")); lstVersionNames.Add(new KeyValuePair<string, string>("Game Version", "gameVersion")); lstVersionNames.Add(new KeyValuePair<string, string>("Mod Manager Version", "managerVersion")); List<CplConditionEditor> lstConditionEditors = new List<CplConditionEditor>(); lstConditionEditors.Add(new CplPluginConditionEditor(p_lstModFiles)); lstConditionEditors.Add(new CplVersionConditionEditor(lstVersionNames)); CPLEditorVM vmlCplEditor = new CPLEditorVM(vmlCplTextEditor, lstConditionEditors, ConditionOperator.And); FO3CplConverter cvtConverter = new FO3CplConverter(ScriptType.GetCplParserFactory()); PrerequisitesEditorVM vmlPrerequisitesEditor = new PrerequisitesEditorVM(vmlCplEditor, cvtConverter, p_xscScript); return new ConditionEditor(vmlPrerequisitesEditor); }
/// <summary> /// Gets the unparser to use to create an XML representation of the given <see cref="XmlScript"/>. /// </summary> /// <param name="p_xscScript">The <see cref="XmlScript"/> to unparse.</param> /// <returns>The unparser to use to unparse the given XML Script.</returns> protected override IUnparser GetUnparser(Nexus.Client.ModManagement.Scripting.XmlScript.XmlScript p_xscScript) { switch (p_xscScript.Version.ToString()) { case "1.0": return new Fallout3Unparser10(p_xscScript); case "2.0": return new Fallout3Unparser20(p_xscScript); case "3.0": return new Fallout3Unparser30(p_xscScript); case "4.0": return new Fallout3Unparser40(p_xscScript); case "5.0": return new Fallout3Unparser50(p_xscScript); } throw new ParserException("Unrecognized XML Script version (" + p_xscScript.Version + "). Perhaps a newer version of the mod manager is required."); }
public bool PlatformExists(string name) { return(Nexus.PlatformExists(RootStorage, name)); }
public bool TokenExists(string symbol) { return(Nexus.TokenExists(RootStorage, symbol)); }
private void UpdateList(ListView list, object text, Nexus.Client c = null) { if (InvokeRequired) { Invoke(new UpdateListDelegate(UpdateList), list, text, c); return; } if (c != null) { ListViewItem LVI = new ListViewItem((string)text); LVI.Tag = c; list.Items.Add(LVI); } else { string[] shit = (string[])text; ListViewItem lvi = new ListViewItem(shit[0]); lvi.SubItems.Add(shit[1]); list.Items.Add(lvi); } }
public string[] GetFeeds() { return(Nexus.GetFeeds(this.RootStorage)); }
public string[] GetContracts() { return(Nexus.GetContracts(this.RootStorage)); }
private void Remove(ListView list, Nexus.Client c) { if (InvokeRequired) { Invoke(new RemoveDelegate(Remove), list, c); return; } foreach (ListViewItem item in list.Items) if (((Nexus.Client)item.Tag) == c) list.Items.Remove(item); SendUsers(c.Channel, new string[] {c.Username, "has disconnected."}); }
public IChain GetChainParent(string name) { var parentName = Nexus.GetParentChainByName(name); return(this.GetChainByName(parentName)); }
/// <summary> /// Gets the editor to use to edit the <see cref="XmlScript"/> prerequisites. /// </summary> /// <param name="p_xscScript">The <see cref="XmlScript"/> whose prerequisites are to be edited.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit <see cref="XmlScript"/> prerequisites. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing the prerequisites.</returns> public override NodeEditor GetPrerequisitesEditor(Nexus.Client.ModManagement.Scripting.XmlScript.XmlScript p_xscScript, IList<VirtualFileSystemItem> p_lstModFiles) { FO3CplConverter cvtConverter = new FO3CplConverter(ScriptType.GetCplParserFactory()); CPLEditorVM vmlCplEditor = CreateCPLEditorVM(p_lstModFiles); PrerequisitesEditorVM vmlPrerequisitesEditor = new PrerequisitesEditorVM(vmlCplEditor, cvtConverter, p_xscScript); return new ConditionEditor(vmlPrerequisitesEditor); }
public static Color4 ToSharpDXColor(Nexus.Color c) { return new Color4(c.R / 255.0f, c.G / 255.0f, c.B / 255.0f, c.A / 255.0f); }
/// <summary> /// Gets the editor to use to edit the <see cref="XmlScript"/>'s install step order. /// </summary> /// <param name="p_xscScript">The <see cref="XmlScript"/> whose install step order is to be edited.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit the <see cref="XmlScript"/>'s install step order. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing the install step order.</returns> public override NodeEditor GetInstallStepOrderEditor(Nexus.Client.ModManagement.Scripting.XmlScript.XmlScript p_xscScript, IList<VirtualFileSystemItem> p_lstModFiles) { InstallStepsEditorVM vmlStepsEditor = new InstallStepsEditorVM(p_xscScript); return new InstallStepsEditor(vmlStepsEditor); }
private void MainForm_Load(object sender, EventArgs e) { string[] ports = SerialPort.GetPortNames(); foreach( string s in ports ) { Logger.Info( "{0}", s ); } mSensorManager = Nexus.Instance; mSensorManager.InitializationComplete += new Nexus.InitializationCompleteHandler( mSensorManager_NexusInitializedEvent ); mSensorManager.SensorStatusChanged += new Nexus.SensorStatusChangedHandler( mSensorManager_SensorStatusChanged ); mSensorManager.initialize(); }
void c_Status(Nexus.Client c, Nexus.State state) { switch (state) { case Nexus.State.Disconnected: Remove(lvUsers, c); break; } }
public bool ArchiveExists(Hash hash) { return(Nexus.ArchiveExists(hash)); }
private void SendNewUser(Nexus.Client client) { List<string> connected = new List<string>(); foreach (ListViewItem item in lvUsers.Items) if (((Nexus.Client)item.Tag).Channel == client.Channel) connected.Add(item.SubItems[0].Text); foreach (ListViewItem item in lvUsers.Items) if (((Nexus.Client)item.Tag).Channel == client.Channel && !(((Nexus.Client)item.Tag).Username == client.Username)) { ((Nexus.Client)item.Tag).Send(Nexus.Serialize(new object[] { (int)Nexus.Headers.NewUser, client.Username })); } }
public bool ChainExists(string name) { return(Nexus.ChainExists(this.RootStorage, name)); }
/// <summary> /// Gets the editor to use to edit the <see cref="XmlScript"/>'s install step order. /// </summary> /// <param name="p_xscScript">The <see cref="XmlScript"/> whose install step order is to be edited.</param> /// <param name="p_lstModFiles">The list of files in the mod to which the <see cref="XmlScript"/> /// being edited belongs.</param> /// <returns>The editor to use to edit the <see cref="XmlScript"/>'s install step order. <c>null</c> is returned if the /// current <see cref="XmlScript"/> does not support editing the install step order.</returns> public virtual NodeEditor GetInstallStepOrderEditor(Nexus.Client.ModManagement.Scripting.XmlScript.XmlScript p_xscScript, IList<VirtualFileSystemItem> p_lstModFiles) { return null; }
public bool HasAddressScript(Address from) { return(Nexus.HasAddressScript(this.RootStorage, from)); }
public bool OrganizationExists(string name) { return(Nexus.OrganizationExists(RootStorage, name)); }
public IChain GetChainByName(string name) { return(Nexus.GetChainByName(name)); }
public bool RemoveMember(string organization, Address admin, Address target) { var org = Nexus.GetOrganizationByName(RootStorage, organization); return(org.RemoveMember(this, admin, target)); }
public string[] GetPlatforms() { return(Nexus.GetPlatforms(this.RootStorage)); }
// fetches a chain-governed value public BigInteger GetGovernanceValue(string name) { var value = Nexus.GetGovernanceValue(this.RootStorage, name); return(value); }
public string[] GetOrganizations() { return(Nexus.GetOrganizations(this.RootStorage)); }
void server_Incoming(Nexus.Client c, byte[] d) { try { object[] data = (object[])Nexus.Deserialize(d); switch ((int)data[0]) { case (int)Nexus.Headers.SendLogin: GetQuery("select * from users"); c.LoggedIn = CheckLogin(data[1].ToString().ToLower().Trim(), data[2].ToString()); if (c.LoggedIn) { c.Username = data[1].ToString(); c.Send(Nexus.Serialize(new object[] { (int)Nexus.Headers.LoginSuccess })); c.Status += c_Status; UpdateList(lvUsers, data[1].ToString(), c); c.Channel = (int)Nexus.Channels.Lounge; SendUsers(c.Channel); Thread.Sleep(10); //TODO: Fix that the right way. //c.Send(Nexus.Serialize(new object[] { (int)Nexus.Headers.NewUser, c.Username })); Invoke(new SendNewUserDelegate(SendNewUser), c); Thread.Sleep(10); c.Send(Nexus.Serialize(new object[] { (int)Nexus.Headers.Channels, GetChannels() })); if ((bool)MOTD[0]) c.Send(Nexus.Serialize(new object[] { 2, MOTD[1] })); } else { c.Send(Nexus.Serialize(new object[] { (int)Nexus.Headers.LoginFail })); } break; case (int)Nexus.Headers.Message: if (c.LoggedIn) { if (!(string.IsNullOrEmpty(data[1].ToString().Trim()))) { UpdateList(lvMessages, new string[] { c.Username, data[1].ToString() }); foreach (Nexus.Client client in server.Connections) if (client != c && client.Channel == c.Channel) client.Send(Nexus.Serialize(new object[] { 1, c.Username, data[1].ToString() })); } } break; case (int)Nexus.Headers.SendRegister: if (!CheckRegister(data[1].ToString()) && data[1].ToString().Length <= 24) { c.Send(Nexus.Serialize(new object[] { (int)Nexus.Headers.RegisterSuccess })); InsertUser(data[1].ToString(), data[2].ToString()); } else c.Send(Nexus.Serialize(new object[] { (int)Nexus.Headers.RegisterFail })); break; case (int)Nexus.Headers.Channels: c.Send(Nexus.Serialize(new object[] { (int)Nexus.Headers.Channels, GetChannels() })); break; case (int)Nexus.Headers.SelectChannel: int oldChannel = c.Channel; string chanName = Enum.GetName(typeof(Nexus.Channels), (int)data[1]).Replace("VB_NET", "VB.NET").Replace("CSharp", "C#"); c.Channel = (int)data[1]; SendUsers(c.Channel, new string[] { c.Username, "has joined this channel." }); SendUsers(oldChannel, new string[] { c.Username, "has moved to " + chanName }); break; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); c.Disconnect(); /* Get the f**k out. */ } }
public IOrganization GetOrganization(string name) { return(Nexus.GetOrganizationByName(RootStorage, name)); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_xscScript">The script to unparse.</param> public Fallout3Unparser30(Nexus.Client.ModManagement.Scripting.XmlScript.XmlScript p_xscScript) : base(p_xscScript) { }
public void MigrateMember(string organization, Address admin, Address source, Address destination) { var org = Nexus.GetOrganizationByName(RootStorage, organization); org.Migrate(this, admin, source, destination); }
public void SwapTokens(string sourceChain, Address from, string targetChain, Address to, string symbol, BigInteger value, byte[] rom, byte[] ram) { var Runtime = this; Runtime.Expect(sourceChain != targetChain, "source chain and target chain must be different"); Runtime.Expect(Runtime.TokenExists(symbol), "invalid token"); var token = Runtime.GetToken(symbol); Runtime.Expect(token.Flags.HasFlag(TokenFlags.Transferable), "must be transferable token"); if (token.IsFungible()) { Runtime.Expect(rom == null, "fungible tokens cant have rom"); Runtime.Expect(ram == null, "fungible tokens cant have ram"); } else { Runtime.Expect(rom != null & rom.Length > 0, "nft rom is missing"); Runtime.Expect(ram != null, "nft ram is missing"); } if (PlatformExists(sourceChain)) { Runtime.Expect(sourceChain != DomainSettings.PlatformName, "invalid platform as source chain"); if (token.IsFungible()) { Nexus.MintTokens(this, token, from, to, sourceChain, value); } else { Nexus.MintToken(this, token, from, to, sourceChain, value, rom, ram); } } else if (PlatformExists(targetChain)) { Runtime.Expect(targetChain != DomainSettings.PlatformName, "invalid platform as target chain"); Nexus.BurnTokens(this, token, from, to, targetChain, value); var swap = new ChainSwap(DomainSettings.PlatformName, sourceChain, Transaction.Hash, targetChain, targetChain, Hash.Null); this.Chain.RegisterSwap(this.Storage, to, swap); } else if (sourceChain == this.Chain.Name) { Runtime.Expect(IsNameOfParentChain(targetChain) || IsNameOfChildChain(targetChain), "target must be parent or child chain"); Runtime.Expect(to.IsUser, "destination must be user address"); Runtime.Expect(IsWitness(from), "invalid witness"); /*if (tokenInfo.IsCapped()) * { * var sourceSupplies = new SupplySheet(symbol, this.Runtime.Chain, Runtime.Nexus); * var targetSupplies = new SupplySheet(symbol, targetChain, Runtime.Nexus); * * if (IsAddressOfParentChain(targetChainAddress)) * { * Runtime.Expect(sourceSupplies.MoveToParent(this.Storage, amount), "source supply check failed"); * } * else // child chain * { * Runtime.Expect(sourceSupplies.MoveToChild(this.Storage, targetChain.Name, amount), "source supply check failed"); * } * }*/ if (token.IsFungible()) { Nexus.BurnTokens(this, token, from, to, targetChain, value); } else { Nexus.BurnToken(this, token, from, to, targetChain, value); } var swap = new ChainSwap(DomainSettings.PlatformName, sourceChain, Transaction.Hash, DomainSettings.PlatformName, targetChain, Hash.Null); this.Chain.RegisterSwap(this.Storage, to, swap); } else if (targetChain == this.Chain.Name) { Runtime.Expect(IsNameOfParentChain(sourceChain) || IsNameOfChildChain(sourceChain), "source must be parent or child chain"); Runtime.Expect(!to.IsInterop, "destination cannot be interop address"); Runtime.Expect(IsWitness(to), "invalid witness"); if (token.IsFungible()) { Nexus.MintTokens(this, token, from, to, sourceChain, value); } else { Nexus.MintToken(this, token, from, to, sourceChain, value, rom, ram); } } else { throw new ChainException("invalid swap chain source and destinations"); } }
public bool IsWitness(Address address) { if (address.IsInterop) { return(false); } if (address == Address.Null) { return(false); } if (address == this.Chain.Address /*|| address == this.Address*/) { return(false); } if (address == this.EntryAddress) { return(true); } using (var m = new ProfileMarker("validatedWitnesses.Contains")) if (validatedWitnesses.Contains(address)) { return(true); } if (address.IsSystem) { var org = Nexus.GetOrganizationByAddress(RootStorage, address); if (org != null) { this.ConsumeGas(10000); var result = org.IsWitness(Transaction); if (result) { validatedWitnesses.Add(address); } return(result); } else { return(address == CurrentContext.Address); } } if (this.Transaction == null) { return(false); } bool accountResult; if (address.IsUser && Nexus.HasGenesis && OptimizedHasAddressScript(RootStorage, address)) { using (var m = new ProfileMarker("InvokeTriggerOnAccount")) accountResult = InvokeTriggerOnAccount(address, AccountTrigger.OnWitness, address); } else { using (var m = new ProfileMarker("Transaction.IsSignedBy")) accountResult = this.Transaction.IsSignedBy(address); } if (accountResult) { validatedWitnesses.Add(address); } return(accountResult); }
public void WriteToken(string tokenSymbol, BigInteger tokenID, byte[] ram) { var nft = ReadToken(tokenSymbol, tokenID); Nexus.WriteNFT(this, tokenSymbol, tokenID, nft.CurrentChain, nft.CurrentOwner, nft.ROM, ram, true); }
public bool FeedExists(string name) { return(Nexus.FeedExists(RootStorage, name)); }
public TokenContent ReadToken(string tokenSymbol, BigInteger tokenID) { return(Nexus.ReadNFT(this, tokenSymbol, tokenID)); }
public bool ContractExists(string name) { return(Nexus.ContractExists(RootStorage, name)); }
public bool IsPlatformAddress(Address address) { return(Nexus.IsPlatformAddress(RootStorage, address)); }
public IArchive GetArchive(Hash hash) { return(Nexus.GetArchive(hash)); }
public IToken GetToken(string symbol) { return(Nexus.GetTokenInfo(RootStorage, symbol)); }
public int GetIndexOfChain(string name) { return(Nexus.GetIndexOfChain(name)); }
public IFeed GetFeed(string name) { return(Nexus.GetFeedInfo(RootStorage, name)); }
public Address LookUpName(string name) { return(Nexus.LookUpName(this.RootStorage, name)); }
public IPlatform GetPlatformByName(string name) { return(Nexus.GetPlatformInfo(RootStorage, name)); }
public IChain GetChainByAddress(Address address) { return(Nexus.GetChainByAddress(address)); }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_xscScript">The script to unparse.</param> public SkyrimUnparser50(Nexus.Client.ModManagement.Scripting.XmlScript.XmlScript p_xscScript) : base(p_xscScript) { }