Exemplo n.º 1
0
        public override xdr.Asset ToXdr()
        {
            var thisXdr = new xdr.Asset();

            thisXdr.Discriminant = AssetType.Create(AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE);
            return(thisXdr);
        }
Exemplo n.º 2
0
 private static Stellar.Generated.Asset GetAsset(KeyPair master, string assetCode)
 {
     return(new Stellar.Generated.Asset
     {
         Discriminant = AssetType.Create(AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4),
         AlphaNum4 = new Stellar.Generated.Asset.AssetAlphaNum4
         {
             AssetCode = ASCIIEncoding.ASCII.GetBytes(assetCode),
             Issuer = master.AccountId
         }
     });
 }
Exemplo n.º 3
0
        public override xdr.Asset ToXdr()
        {
            xdr.Asset thisXdr = new xdr.Asset();
            thisXdr.Discriminant = AssetType.Create(AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12);
            xdr.Asset.AssetAlphaNum12 credit = new xdr.Asset.AssetAlphaNum12();
            credit.AssetCode = Util.PaddedByteArray(Code, 12);
            AccountID accountID = new AccountID();

            accountID.InnerValue = Issuer.XdrPublicKey;
            credit.Issuer        = accountID;
            thisXdr.AlphaNum12   = credit;
            return(thisXdr);
        }
Exemplo n.º 4
0
        public override xdr.Asset ToXdr()
        {
            var thisXdr = new xdr.Asset();

            thisXdr.Discriminant = AssetType.Create(AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12);
            var credit = new xdr.Asset.AssetAlphaNum12();

            credit.AssetCode = new AssetCode12(Util.PaddedByteArray(Code, 12));
            var accountID = new AccountID();

            accountID.InnerValue = KeyPair.FromAccountId(Issuer).XdrPublicKey;
            credit.Issuer        = accountID;
            thisXdr.AlphaNum12   = credit;
            return(thisXdr);
        }
Exemplo n.º 5
0
    private void UpdateWorkUnit(string in_wwuFullPath, string in_wwuType, string in_relativePath)
    {
        var PathAndIcons      = new System.Collections.Generic.LinkedList <AkWwiseProjectData.PathElement>();
        var currentPathInProj = string.Empty;

        //Add physical folders to the hierarchy if the work unit isn't in the root folder
        var physicalPath = in_relativePath.Split(System.IO.Path.DirectorySeparatorChar);

        for (var i = physicalPath.Length - 2; i > 0; i--)
        {
            PathAndIcons.AddFirst(
                new AkWwiseProjectData.PathElement(physicalPath[i], WwiseObjectType.PhysicalFolder));
            currentPathInProj = System.IO.Path.Combine(physicalPath[i], currentPathInProj);
        }

        //Parse the work unit file
        RecurseWorkUnit(AssetType.Create(in_wwuType), new System.IO.FileInfo(in_wwuFullPath), currentPathInProj,
                        in_relativePath.Remove(in_relativePath.LastIndexOf(System.IO.Path.DirectorySeparatorChar)), PathAndIcons);
    }
Exemplo n.º 6
0
    private void UpdateWorkUnit(string in_parentRelativePath, string in_wwuFullPath, string in_wwuType,
                                string in_relativePath)
    {
        var wwuRelPath = in_parentRelativePath;

        var PathAndIcons = new System.Collections.Generic.LinkedList <AkWwiseProjectData.PathElement>();

        //We need to build the work unit's hierarchy to display it in the right place in the picker
        var currentPathInProj = string.Empty;

        while (!wwuRelPath.Equals(string.Empty))
        {
            //Add work unit name to the hierarchy
            var wwuName = System.IO.Path.GetFileNameWithoutExtension(wwuRelPath);
            currentPathInProj = System.IO.Path.Combine(wwuName, currentPathInProj);
            //Add work unit icon to the hierarchy
            PathAndIcons.AddFirst(new AkWwiseProjectData.PathElement(wwuName, WwiseObjectType.WorkUnit));

            //Get the physical path of the parent work unit if any
            var list  = AkWwiseProjectInfo.GetData().GetWwuListByString(in_wwuType);
            var index = list.BinarySearch(new AkWwiseProjectData.WorkUnit {
                PhysicalPath = wwuRelPath
            });
            wwuRelPath = (list[index] as AkWwiseProjectData.WorkUnit).ParentPhysicalPath;
        }

        //Add physical folders to the hierarchy if the work unit isn't in the root folder
        var physicalPath = in_relativePath.Split(System.IO.Path.DirectorySeparatorChar);

        for (var i = physicalPath.Length - 2; i > 0; i--)
        {
            PathAndIcons.AddFirst(
                new AkWwiseProjectData.PathElement(physicalPath[i], WwiseObjectType.PhysicalFolder));
            currentPathInProj = System.IO.Path.Combine(physicalPath[i], currentPathInProj);
        }

        //Parse the work unit file
        RecurseWorkUnit(AssetType.Create(in_wwuType), new System.IO.FileInfo(in_wwuFullPath), currentPathInProj,
                        in_relativePath.Remove(in_relativePath.LastIndexOf(System.IO.Path.DirectorySeparatorChar)), PathAndIcons,
                        in_parentRelativePath);
    }
Exemplo n.º 7
0
    private bool CreateWorkUnit(string in_relativePath, string in_wwuType, string in_fullPath)
    {
        var ParentID = string.Empty;

        try
        {
            using (var reader = System.Xml.XmlReader.Create(in_fullPath))
            {
                reader.MoveToContent();

                //We check if the current work unit has a parent and save its guid if its the case
                while (!reader.EOF && reader.ReadState == System.Xml.ReadState.Interactive)
                {
                    if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.Name.Equals("WorkUnit"))
                    {
                        if (reader.GetAttribute("PersistMode").Equals("Nested"))
                        {
                            ParentID = reader.GetAttribute("OwnerID");
                        }
                        break;
                    }

                    reader.Read();
                }
            }
        }
        catch (System.Exception e)
        {
            UnityEngine.Debug.Log("WwiseUnity: A changed Work unit wasn't found. It must have been deleted " + in_fullPath);
            return(false);
        }

        if (!string.IsNullOrEmpty(ParentID))
        {
            var parentGuid = System.Guid.Empty;

            try
            {
                parentGuid = new System.Guid(ParentID);
            }
            catch
            {
                UnityEngine.Debug.LogWarning("WwiseUnity: \"OwnerID\" in <" + in_fullPath + "> cannot be converted to a GUID (" + ParentID + ")");
                return(false);
            }

            var    list                     = AkWwiseProjectInfo.GetData().GetWwuListByString(in_wwuType);
            var    PathAndIcons             = new System.Collections.Generic.LinkedList <AkWwiseProjectData.PathElement>();
            string PathInProj               = string.Empty;
            AkWwiseProjectData.WorkUnit wwu = null;

            if (parentGuid != System.Guid.Empty)
            {
                for (var i = 0; i < list.Count; i++)
                {
                    wwu = list[i] as AkWwiseProjectData.WorkUnit;
                    if (wwu.Guid.Equals(parentGuid))
                    {
                        PathInProj   = wwu.ParentPath;
                        PathAndIcons = new System.Collections.Generic.LinkedList <AkWwiseProjectData.PathElement>(wwu.PathAndIcons);
                        break;
                    }
                    else
                    {
                        var WwuChildren = wwu.GetChildrenArrayList();
                        foreach (AkWwiseProjectData.AkInformation child in WwuChildren)
                        {
                            if (child.Guid.Equals(parentGuid))
                            {
                                PathInProj   = child.Path;
                                PathAndIcons = new System.Collections.Generic.LinkedList <AkWwiseProjectData.PathElement>(child.PathAndIcons);
                                break;
                            }
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(PathInProj))
            {
                RecurseWorkUnit(AssetType.Create(in_wwuType), new System.IO.FileInfo(in_fullPath), PathInProj,
                                in_relativePath.Remove(in_relativePath.LastIndexOf(System.IO.Path.DirectorySeparatorChar)), PathAndIcons,
                                wwu.PhysicalPath);
                return(true);
            }

            //Not found.  Wait for it to load
            return(false);
        }

        //Root Wwu
        UpdateWorkUnit(in_fullPath, in_wwuType, in_relativePath);
        return(true);
    }