public static Result MountContentStorage(this FileSystemClient fs, U8Span mountName, ContentStorageId storageId)
        {
            Result      rc;
            Span <byte> logBuffer = stackalloc byte[0x40];

            if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
            {
                Tick start = fs.Hos.Os.GetSystemTick();
                rc = Mount(fs, mountName, storageId);
                Tick end = fs.Hos.Os.GetSystemTick();

                var idString = new IdString();
                var sb       = new U8StringBuilder(logBuffer, true);

                sb.Append(LogName).Append(mountName).Append(LogQuote)
                .Append(LogContentStorageId).Append(idString.ToString(storageId));

                fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
            }
            else
            {
                rc = Mount(fs, mountName, storageId);
            }
            fs.Impl.AbortIfNeeded(rc);
            if (rc.IsFailure())
            {
                return(rc);
            }

            if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
            {
                fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
            }

            return(Result.Success);
Example #2
0
        protected override CompositorWorkspace SetupCompositor()
        {
            var compositorManager = _root.CompositorManager2;

            CompositorNodeDef   nodeDef   = compositorManager.GetNodeDefinition("ExampleShadows_Node");
            CompositorTargetDef targetDef = nodeDef.GetTargetPass(0);

            Debug.Assert(
                targetDef.RenderTargetName == IdString.FromString("rt_renderwindow"),
                "Media compositor file was modified. Make sure C++ code is in sync with those changes!");

            var passScene = targetDef.GetCompositorPass(1) as CompositorPassSceneDef;

            Debug.Assert(passScene != null,
                         "Media compositor file was modified. Make sure C++ code is in sync with those changes!");

            passScene.ShadowNodeName = _pssm ? "ExampleShadows_PssmShadowNode" : "ExampleShadows_FocusedShadowNode";

            const string workspaceName = "ShadowsV2Workspace";

            if (!compositorManager.HasWorkspaceDefinition(workspaceName))
            {
                CompositorWorkspaceDef workspaceDef = compositorManager.AddWorkspaceDefinition(workspaceName);
                workspaceDef.ConnectOutput("ExampleShadows_Node", 0);
            }

            return(compositorManager.AddWorkspace(_sceneManager, _window, _camera, workspaceName, true));
        }
Example #3
0
        public static Result MountSystemSaveData(this FileSystemClient fs, U8Span mountName,
                                                 SaveDataSpaceId spaceId, ulong saveDataId, UserId userId)
        {
            Result      rc;
            Span <byte> logBuffer = stackalloc byte[0x90];

            if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
            {
                Tick start = fs.Hos.Os.GetSystemTick();
                rc = Mount(fs, mountName, spaceId, saveDataId, userId);
                Tick end = fs.Hos.Os.GetSystemTick();

                var idString = new IdString();
                var sb       = new U8StringBuilder(logBuffer, true);
                sb.Append(LogName).Append(mountName)
                .Append(LogSaveDataSpaceId).Append(idString.ToString(spaceId))
                .Append(LogSaveDataId).AppendFormat(saveDataId, 'X')
                .Append(LogUserId).AppendFormat(userId.Id.High, 'X', 16).AppendFormat(userId.Id.Low, 'X', 16);

                fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
            }
            else
            {
                rc = Mount(fs, mountName, spaceId, saveDataId, userId);
            }

            fs.Impl.AbortIfNeeded(rc);
            return(rc);
Example #4
0
        public void SfmtGetAttributesTest()
        {
            using var sfmt = new SfmtPrimitiveState();
            InitGenRand(sfmt, 1234);

            IdString.Is("SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6");
            MinArraySize32.Is(624);
            MinArraySize64.Is(312);
        }
Example #5
0
        public static Result GetEntryType(this FileSystemClient fs, out DirectoryEntryType type, U8Span path)
        {
            UnsafeHelpers.SkipParamInit(out type);

            Result             rc;
            U8Span             subPath;
            FileSystemAccessor fileSystem;
            Span <byte>        logBuffer = stackalloc byte[0x300];

            if (fs.Impl.IsEnabledAccessLog())
            {
                Tick start = fs.Hos.Os.GetSystemTick();
                rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
                Tick end = fs.Hos.Os.GetSystemTick();

                var idString = new IdString();
                var sb       = new U8StringBuilder(logBuffer, true);
                sb.Append(LogPath).Append(path).Append(LogEntryType)
                .Append(idString.ToString(AccessLogImpl.DereferenceOutValue(in type, rc)));
                logBuffer = sb.Buffer;

                fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
            }
            else
            {
                rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
            }
            fs.Impl.AbortIfNeeded(rc);
            if (rc.IsFailure())
            {
                return(rc);
            }

            if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
            {
                Tick start = fs.Hos.Os.GetSystemTick();
                rc = fileSystem.GetEntryType(out type, subPath);
                Tick end = fs.Hos.Os.GetSystemTick();

                var idString = new IdString();
                var sb       = new U8StringBuilder(logBuffer, true);
                sb.Append(LogPath).Append(path).Append(LogEntryType)
                .Append(idString.ToString(AccessLogImpl.DereferenceOutValue(in type, rc)));
                logBuffer = sb.Buffer;

                fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
            }
            else
            {
                rc = fileSystem.GetEntryType(out type, subPath);
            }
            fs.Impl.AbortIfNeeded(rc);
            return(rc);
        }
Example #6
0
 internal bool Unregister(string xrmServerDetails, string entityLogicalName, Guid id, Collection <string> errors, SolutionComponentType solutionComponentType)
 {
     try
     {
         Result = false;
         using (xrmService = GetService(xrmServerDetails))
         {
             try
             {
                 if (solutionComponentType != SolutionComponentType.SDKMessageProcessingStepSecureConfig)
                 {
                     RetrieveDependenciesForDeleteRequest retrieveDependenciesForDeleteRequest = new RetrieveDependenciesForDeleteRequest();
                     retrieveDependenciesForDeleteRequest.ComponentType = (int)solutionComponentType;
                     retrieveDependenciesForDeleteRequest.ObjectId      = id;
                     RetrieveDependenciesForDeleteResponse retrieveDependenciesForDeleteResponse = (RetrieveDependenciesForDeleteResponse)xrmService.Execute(retrieveDependenciesForDeleteRequest);
                     if (retrieveDependenciesForDeleteResponse.EntityCollection.Entities.Count == 0)
                     {
                         xrmService.Retrieve(entityLogicalName, id, new ColumnSet(true));
                         xrmService.Delete(entityLogicalName, id);
                     }
                     else
                     {
                         errors.Add(solutionComponentType.ToString() + " with id = " + id.ToString() + "exists!");
                     }
                 }
                 else
                 {
                     xrmService.Retrieve(entityLogicalName, id, new ColumnSet(true));
                     xrmService.Delete(entityLogicalName, id);
                 }
             }
             catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> e)
             {
                 IdString = id.ToString().Trim();
                 IdString = IdString.Replace("{", string.Empty);
                 IdString = IdString.Replace("}", string.Empty);
                 if (e.Message == entityLogicalName + " With Id = " + id.ToString().Trim() + " Does Not Exist")
                 {
                     errors.Add(e.Message);
                 }
                 else
                 {
                     throw;
                 }
             }
         }
         Result = true;
         return(Result);
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }
Example #7
0
        private static Result MountBis(this FileSystemClientImpl fs, U8Span mountName, BisPartitionId partitionId,
                                       U8Span rootPath)
        {
            Result rc;

            if (fs.IsEnabledAccessLog(AccessLogTarget.System))
            {
                Tick start = fs.Hos.Os.GetSystemTick();
                rc = Mount(fs, mountName, partitionId);
                Tick end = fs.Hos.Os.GetSystemTick();

                Span <byte> logBuffer = stackalloc byte[0x300];
                var         idString  = new IdString();
                var         sb        = new U8StringBuilder(logBuffer, true);

                sb.Append(LogName).Append(mountName).Append(LogQuote)
                .Append(LogBisPartitionId).Append(idString.ToString(partitionId))
                .Append(LogPath).Append(rootPath).Append(LogQuote);

                fs.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
            }
            else
            {
                rc = Mount(fs, mountName, partitionId);
            }

            fs.AbortIfNeeded(rc);
            if (rc.IsFailure())
            {
                return(rc);
            }

            if (fs.IsEnabledAccessLog(AccessLogTarget.System))
            {
                fs.EnableFileSystemAccessorAccessLog(mountName);
            }

            return(Result.Success);
Example #8
0
        public static Result MountGameCardPartition(this FileSystemClient fs, U8Span mountName, GameCardHandle handle,
                                                    GameCardPartition partitionId)
        {
            Result      rc;
            Span <byte> logBuffer = stackalloc byte[0x60];

            if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
            {
                Tick start = fs.Hos.Os.GetSystemTick();
                rc = Mount(fs, mountName, handle, partitionId);
                Tick end = fs.Hos.Os.GetSystemTick();

                var idString = new IdString();
                var sb       = new U8StringBuilder(logBuffer, true);

                sb.Append(LogName).Append(mountName).Append(LogQuote)
                .Append(LogGameCardHandle).AppendFormat(handle.Value)
                .Append(LogGameCardPartition).Append(idString.ToString(partitionId));

                fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
            }
            else
            {
                rc = Mount(fs, mountName, handle, partitionId);
            }
            fs.Impl.AbortIfNeeded(rc);
            if (rc.IsFailure())
            {
                return(rc);
            }

            if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
            {
                fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
            }

            return(Result.Success);
Example #9
0
        public ExtMeta(byte[] ext, Encoding encoding)
        {
            var  num_items = Util.GetUInt32(ext, 8);
            uint pos       = 12;

            for (var i = 0; i < num_items; i++)
            {
                var id   = Util.GetUInt32(ext, pos);
                var size = Util.GetUInt32(ext, pos + 4);
                if (IdMapping.Id_map_strings.ContainsKey(id))
                {
                    var a = encoding.GetString(Util.SubArray(ext, pos + 8, size - 8));

                    if (IdString.ContainsKey(id))
                    {
                        IdString[id].Add(a);
                    }
                    else
                    {
                        IdString.Add(id, new List <string> {
                            a
                        });
                    }
                }
                else if (IdMapping.Id_map_values.ContainsKey(id))
                {
                    ulong a = 0;
                    switch (size)
                    {
                    case 9:
                        a = Util.GetUInt8(ext, pos + 8);
                        break;

                    case 10:
                        a = Util.GetUInt16(ext, pos + 8);
                        break;

                    case 12:
                        a = Util.GetUInt32(ext, pos + 8);
                        break;

                    case 16:
                        a = Util.GetUInt64(ext, pos + 8);
                        break;

                    default:
                        Logger.Warn("unexpected size:" + size);
                        break;
                    }

                    if (IdValue.ContainsKey(id))
                    {
                        Logger.Debug("Meta id duplicate:{0}\nPervious:{1}  \nLatter:{2}", IdMapping.Id_map_values[id], IdValue[id], a);
                    }
                    else
                    {
                        IdValue.Add(id, a);
                    }
                }
                else if (IdMapping.Id_map_hex.ContainsKey(id))
                {
                    var a = Util.ToHexString(ext, pos + 8, size - 8);

                    if (IdHex.ContainsKey(id))
                    {
                        Logger.Debug("Meta id duplicate:{0}\nPervious:{1}  \nLatter:{2}", IdMapping.Id_map_hex[id], IdHex[id], a);
                    }
                    else
                    {
                        IdHex.Add(id, a);
                    }
                }
                else
                {
                    // Unknown id
                }

                pos += size;
            }
        }
Example #10
0
 public List <string> StringList(uint key)
 {
     return(IdString.TryGetValue(key, out var value) ? value : new List <string>());
 }
Example #11
0
 public string StringOrNull(uint key)
 {
     return(IdString.TryGetValue(key, out var value) ? value.FirstOrDefault() : null);
 }
Example #12
0
        public static Result MountContent(this FileSystemClient fs, U8Span mountName, U8Span path,
                                          ContentType contentType)
        {
            Result      rc;
            Span <byte> logBuffer = stackalloc byte[0x300];

            if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
            {
                Tick start = fs.Hos.Os.GetSystemTick();
                rc = PreMount(contentType);
                Tick end = fs.Hos.Os.GetSystemTick();

                var idString = new IdString();
                var sb       = new U8StringBuilder(logBuffer, true);

                sb.Append(LogName).Append(mountName).Append(LogQuote)
                .Append(LogPath).Append(path).Append(LogQuote)
                .Append(LogContentType).Append(idString.ToString(contentType));

                fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(sb.Buffer));
            }
            else
            {
                rc = PreMount(contentType);
            }
            fs.Impl.AbortIfNeeded(rc);
            if (rc.IsFailure())
            {
                return(rc);
            }

            const ulong programId = 0;

            if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
            {
                Tick start = fs.Hos.Os.GetSystemTick();
                rc = MountContentImpl(fs, mountName, path, programId, contentType);
                Tick end = fs.Hos.Os.GetSystemTick();

                var idString = new IdString();
                var sb       = new U8StringBuilder(logBuffer, true);

                sb.Append(LogName).Append(mountName).Append(LogQuote)
                .Append(LogPath).Append(path).Append(LogQuote)
                .Append(LogProgramId).AppendFormat(programId, 'X')
                .Append(LogContentType).Append(idString.ToString(contentType));

                fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
            }
            else
            {
                rc = MountContentImpl(fs, mountName, path, 0, contentType);
            }
            fs.Impl.AbortIfNeeded(rc);
            if (rc.IsFailure())
            {
                return(rc);
            }

            if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
            {
                fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
            }

            return(Result.Success);
Example #13
0
    void Awake()
    {
        IdString a = new IdString("ss");

        Debug.Log((string)a);
    }