/// <summary>
            /// Here we want to register all the EntityDescriptors that need to be serialized for network play.
            ///
            /// Remember! This needs to in sync across different clients and server as the values are serialized across
            /// the network also want this to not change so we can save to a DB
            /// </summary>
            internal SerializationDescriptorMap()
            {
                _descriptors = new Dictionary <uint, ISerializableEntityDescriptor>();
                _factories   = new Dictionary <uint, IDeserializationFactory>();

                using (new StandardProfiler("Assemblies Scan"))
                {
                    List <Assembly> assemblies = AssemblyUtility.GetCompatibleAssemblies();

                    Type d1 = typeof(DefaultVersioningFactory <>);
                    foreach (Assembly assembly in assemblies)
                    {
                        foreach (Type type in AssemblyUtility.GetTypesSafe(assembly))
                        {
                            if (type != null && type.IsClass && type.IsAbstract == false && type.BaseType != null &&
                                type.BaseType.IsGenericType && type.BaseType.GetGenericTypeDefinition()
                                == typeof(SerializableEntityDescriptor <>))
                            {
                                var descriptor = Activator.CreateInstance(type) as ISerializableEntityDescriptor;

                                RegisterEntityDescriptor(descriptor, type, d1);
                            }
                        }
                    }
                }
            }
Esempio n. 2
0
    static ImportSettingData()
    {
        // 加载配置文件
        Setting = AssetDatabase.LoadAssetAtPath <ImportSetting>(EditorDefine.ImporterSettingFilePath);
        if (Setting == null)
        {
            Debug.LogWarning($"Create new ImportSetting.asset : {EditorDefine.ImporterSettingFilePath}");
            Setting = ScriptableObject.CreateInstance <ImportSetting>();
            EditorTools.CreateFileDirectory(EditorDefine.ImporterSettingFilePath);
            AssetDatabase.CreateAsset(Setting, EditorDefine.ImporterSettingFilePath);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
        else
        {
            Debug.Log("Load ImportSetting.asset ok");
        }

        // Clear
        CacheTypes.Clear();
        CacheProcessor.Clear();

        // 获取所有资源处理器类型
        List <Type> result = AssemblyUtility.GetAssignableTypes(typeof(IAssetProcessor));

        for (int i = 0; i < result.Count; i++)
        {
            Type type = result[i];
            if (CacheTypes.ContainsKey(type.Name) == false)
            {
                CacheTypes.Add(type.Name, type);
            }
        }
    }
Esempio n. 3
0
        /// <summary>
        /// 反编译器入口方法。
        /// </summary>
        /// <param name="args">参数列表(未使用)</param>
        static void Main(string[] args)
        {
            string gamePath = GetSteamGameInstallLocation(STEAM_GAME_ID);

            Console.WriteLine($"使用游戏路径: {gamePath}");

            string originalAssemblyPath = GetAssemblyPath(gamePath);
            string originalAssemblyHash = HashUtility.GetFileSHA256(originalAssemblyPath);

            Console.WriteLine($"游戏 Assembly 散列: {originalAssemblyHash}");

            string monoLibraryPath = GetMonoPath(gamePath);

            byte[] unpackedAssemblyData = AssemblyUtility.LoadImage(monoLibraryPath, originalAssemblyPath);
            string UNPACKED_FILENAME    = string.Format(UNPACKED_FILENAME_TEMPLATE, originalAssemblyHash);
            string unpackedAssemblyPath = originalAssemblyPath.Replace(ORIGINAL_FILENAME, UNPACKED_FILENAME);

            Console.WriteLine($"写入脱壳后的 Assembly 到: {unpackedAssemblyPath}");
            File.WriteAllBytes(unpackedAssemblyPath, unpackedAssemblyData);

            string decompiledDirectory = Path.Combine(Directory.GetCurrentDirectory(), "TaiwuDecompiler-" + UNPACKED_FILENAME);

            Console.WriteLine("\n开始反编译……");
            DecompileAssembly(unpackedAssemblyPath, decompiledDirectory);

            // FIXME: 未来重写 WholeProjectDecompiler,导出合适的工程文件。
            Console.WriteLine("\n执行清理……");
            CleanupSource(decompiledDirectory);

            Console.WriteLine($"完成!反编译源码已保存至:{decompiledDirectory}");
            Console.WriteLine("按任意键退出……");
            Console.ReadKey();
        }
        public static void GetFormatters(IMessagePackProvider provider, IMessagePackContext context, IDictionary <Type, IMessagePackFormatter> formatters, int formatterType, Assembly assembly = null)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (formatters == null)
            {
                throw new ArgumentNullException(nameof(formatters));
            }

            foreach (Type type in AssemblyUtility.GetBrowsableTypes <MessagePackFormatterAttribute>(assembly))
            {
                var attribute = type.GetCustomAttribute <MessagePackFormatterAttribute>(false);

                if (attribute.Type == formatterType && TypesUtility.TryCreateType(type, new object[] { provider, context }, out IMessagePackFormatter formatter))
                {
                    formatters.Add(formatter.TargetType, formatter);
                }
            }
        }
        /// <summary>
        /// Registers all types derived from a base type
        /// </summary>
        /// <typeparam name="T"></typeparam>
        public static void RegisterAllDerivedTypes <T>(this IUnityContainer container)
        {
            // if an object was already mapped to another type but is derived from the registering type, don't register a new instance
            // for it, but instead register the existing instance with the registering type
            List <ContainerRegistration> alreadyMappedTypes =
                container.Registrations.Where(registration => typeof(T).IsAssignableFrom(registration.MappedToType) &&
                                              registration.LifetimeManagerType == typeof(ContainerControlledLifetimeManager)).ToList();

            IEnumerable <Assembly> assemblyList = AssemblyUtility.GetAssemblies();

            // get all listener types
            List <List <Type> > derivedTypes =
                assemblyList.Select(assembly => assembly.GetTypes()
                                    .Where(t => typeof(T).IsAssignableFrom(t) && !t.IsInterface).ToList()).ToList();

            // register all listener types
            derivedTypes.ForEach(derivedTypeInnerList =>
                                 derivedTypeInnerList.ForEach(derivedType =>
            {
                ContainerRegistration existingRegistration = alreadyMappedTypes.FirstOrDefault(registration => registration.MappedToType == derivedType);
                if (existingRegistration != null)
                {
                    T resolved = (T)container.Resolve(existingRegistration.RegisteredType, existingRegistration.Name);
                    container.RegisterInstance <T>(string.IsNullOrEmpty(existingRegistration.Name) ? existingRegistration.RegisteredType.Name : existingRegistration.Name, resolved);
                }
                else
                {
                    container.RegisterType(typeof(T), derivedType, derivedType.FullName, new ContainerControlledLifetimeManager());
                }
            }));
        }
        private IEnumerator Start()
        {
            var states = new OperateStateBase[operateStateTypeNames.Length];

            for (int i = 0; i < operateStateTypeNames.Length; i++)
            {
                Type type = AssemblyUtility.GetTypeByName(operateStateTypeNames[i]);
                if (type == null)
                {
                    continue;
                }
                states[i] = (OperateStateBase)Activator.CreateInstance(type);
                if (states[i] == null)
                {
                    continue;
                }
                if (startOperateStateTypeName == operateStateTypeNames[i])
                {
                    startOperateState = states[i];
                }
            }
            if (startOperateState == null)
            {
                yield break;
            }
            operateSystem.Initialize(fsmSystem, states);
            yield return(new WaitForEndOfFrame());

            operateSystem.Start(startOperateState.GetType());
        }
Esempio n. 7
0
        public void RegisterItemPoolByReflection()
        {
            Type[] itemTypes = AssemblyUtility.GetDerivedTypes(typeof(ActionItem));
            if (itemTypes == null || itemTypes.Length == 0)
            {
                return;
            }

            Dictionary <Type, Type> dataToItemTypeDic = new Dictionary <Type, Type>();

            foreach (var itemType in itemTypes)
            {
                ActionItemBindDataAttribute attr = itemType.GetCustomAttribute <ActionItemBindDataAttribute>();
                if (attr == null)
                {
                    continue;
                }

                dataToItemTypeDic.Add(attr.DataType, itemType);
            }

            foreach (var kvp in dataToItemTypeDic)
            {
                ObjectPool itemPool = new ObjectPool(() =>
                {
                    return(Activator.CreateInstance(kvp.Value));
                }, null, (actionItem) =>
                {
                    ((ActionItem)actionItem).DoReset();
                }, 0);

                RegisterItemPool(kvp.Key, itemPool);
            }
        }
Esempio n. 8
0
        public static void CreateItemPool(string spaceName, string outputDir, string templateFilePath)
        {
            Type[] itemTypes = AssemblyUtility.GetDerivedTypes(typeof(ActionItem));
            if (itemTypes == null || itemTypes.Length == 0)
            {
                Debug.LogError($"ActionItemPoolCreator::CreateItemPool->ActionItem is not found!");
                return;
            }

            Dictionary <Type, Type> dataToItemTypeDic = new Dictionary <Type, Type>();

            foreach (var itemType in itemTypes)
            {
                ActionItemBindDataAttribute attr = itemType.GetCustomAttribute <ActionItemBindDataAttribute>();
                if (attr == null)
                {
                    Debug.LogError($"ActionItemPoolCreator::CreateItemPool->Attribute is not found.itemType = {itemType.FullName}");
                    continue;
                }

                dataToItemTypeDic.Add(attr.DataType, itemType);
            }

            StringContextContainer context = new StringContextContainer();

            context.Add("spaceName", spaceName);
            context.Add("dataToItemTypeDic", dataToItemTypeDic);

            string templateContent = File.ReadAllText(templateFilePath);

            string outputFilePath = $"{outputDir}/ActionItemPoolRegister.cs";
            string outputContent  = TemplateEngine.Execute(context, templateContent, new string[0]);

            File.WriteAllText(outputFilePath, outputContent);
        }
Esempio n. 9
0
        public SparebeatClient(string cacheDirectory = null)
        {
            CacheDirectory = cacheDirectory;

            _client = new HttpClient
            {
                BaseAddress = new Uri("https://sparebeat.com")
            };

            var userAgent = $"Sparebeat/{AssemblyUtility.GetVersion()} ({RuntimeInformation.OSDescription})";

            _client.DefaultRequestHeaders.UserAgent.ParseAdd(userAgent);

            _serializerOptions = new JsonSerializerOptions
            {
                IgnoreNullValues     = true,
                DictionaryKeyPolicy  = JsonNamingPolicy.CamelCase,
                PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
                Converters           =
                {
                    new Int32Converter(),
                    new INoteConverter()
                }
            };
        }
        private void OnComponentAdded(ReorderableList list)
        {
            // Create the generic menu
            GenericMenu componentMenu = new GenericMenu();
            // Get all the types that inherit from Weaver Component
            IList <Type> componentTypes = AssemblyUtility.GetInheirtingTypesFromUserAssemblies <WeaverComponent>();

            // Loop over them all
            for (int i = 0; i < componentTypes.Count; i++)
            {
                Type type = componentTypes[i];
                // Check if we already have that type
                if (m_HasInstanceOfTypeMethod.Invoke(type).AreEqual(false))
                {
                    GUIContent menuLabel = new GUIContent(type.Assembly.GetName().Name + "/" + type.Name);
                    componentMenu.AddItem(menuLabel, false, OnTypeAdded, type);
                }
            }

            if (componentMenu.GetItemCount() == 0)
            {
                componentMenu.AddDisabledItem(new GUIContent("[All Components Added]"));
            }

            // We are just trying to align the menu to the plus box.
            Rect menuDisplayRect = m_Position;

            menuDisplayRect.height = EditorGUIUtility.singleLineHeight;
            menuDisplayRect.y     += m_Position.height - EditorGUIUtility.singleLineHeight;
            menuDisplayRect.x     += EditorGUIUtility.currentViewWidth - 100;
            componentMenu.DropDown(menuDisplayRect);
        }
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="assemblyName">窗口类所在的程序集</param>
    public void Initialize(string assemblyName)
    {
        if (string.IsNullOrEmpty(assemblyName))
        {
            throw new ArgumentNullException();
        }
        _assemblyName = assemblyName;

        List <Type> types = AssemblyUtility.GetAssignableAttributeTypes(assemblyName, typeof(UIWindow), typeof(WindowAttribute));

        for (int i = 0; i < types.Count; i++)
        {
            System.Type     type      = types[i];
            WindowAttribute attribute = Attribute.GetCustomAttribute(type, typeof(WindowAttribute)) as WindowAttribute;

            // 判断是否重复
            if (_types.ContainsKey(attribute.WindowType))
            {
                throw new Exception($"Window type {attribute.WindowType} already exist.");
            }

            // 添加到集合
            _types.Add(attribute.WindowType, type);
        }
    }
        private void OnWeavedAssemblyElementAdded(ReorderableList list)
        {
            GenericMenu menu = new GenericMenu();

            IList <Assembly> cachedAssemblies = AssemblyUtility.GetUserCachedAssemblies();

            for (int x = 0; x < cachedAssemblies.Count; x++)
            {
                bool foundMatch = false;
                for (int y = 0; y < m_WeavedAssemblies.arraySize; y++)
                {
                    SerializedProperty current   = m_WeavedAssemblies.GetArrayElementAtIndex(y);
                    SerializedProperty assetPath = current.FindPropertyRelative("m_RelativePath");
                    if (cachedAssemblies[x].Location.IndexOf(assetPath.stringValue, StringComparison.Ordinal) > 0)
                    {
                        foundMatch = true;
                        break;
                    }
                }
                if (!foundMatch)
                {
                    GUIContent content     = new GUIContent(cachedAssemblies[x].GetName().Name);
                    string     projectPath = FileUtility.SystemToProjectPath(cachedAssemblies[x].Location);
                    menu.AddItem(content, false, OnWeavedAssemblyAdded, projectPath);
                }
            }

            if (menu.GetItemCount() == 0)
            {
                menu.AddDisabledItem(new GUIContent("[All Assemblies Added]"));
            }

            menu.ShowAsContext();
        }
Esempio n. 13
0
        /// <summary>
        ///     Initialize a new Mod with a path to a mod file.
        /// </summary>
        /// <param name="path">The path to a mod file</param>
        public Mod(string path) : base(Path.GetFileNameWithoutExtension(path))
        {
            modInfo = ModInfo.Load(path);

            contentType  = modInfo.content;
            contentTypes = modInfo.contentTypes;

            var modDirectory      = Path.GetDirectoryName(path);
            var platformDirectory = Path.Combine(modDirectory, Application.platform.GetModPlatform().ToString());

            var assets = Path.Combine(platformDirectory, modInfo.name.ToLower() + ".assets");
            var scenes = Path.Combine(platformDirectory, modInfo.name.ToLower() + ".scenes");

            assemblyFiles  = AssemblyUtility.GetAssemblies(modDirectory, AssemblyFilter.ModAssemblies);
            assetsResource = new AssetBundleResource(name + " assets", assets);
            scenesResource = new AssetBundleResource(name + " scenes", scenes);

            isValid = true;

            Initialize();

            VerifyAssemblies();

            CheckResources();
        }
Esempio n. 14
0
        /// <summary>
        /// 加载配置文件
        /// </summary>
        private static void LoadSettingData()
        {
            // 加载配置文件
            _setting = AssetDatabase.LoadAssetAtPath <AssetImporterSetting>(EditorDefine.AssetImporterSettingFilePath);
            if (_setting == null)
            {
                Debug.LogWarning($"Create new {nameof(AssetImporterSetting)}.asset : {EditorDefine.AssetImporterSettingFilePath}");
                _setting = ScriptableObject.CreateInstance <AssetImporterSetting>();
                EditorTools.CreateFileDirectory(EditorDefine.AssetImporterSettingFilePath);
                AssetDatabase.CreateAsset(Setting, EditorDefine.AssetImporterSettingFilePath);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
            else
            {
                Debug.Log($"Load {nameof(AssetImporterSetting)}.asset ok");
            }

            // 清空缓存集合
            _cacheTypes.Clear();
            _cacheProcessor.Clear();

            // 获取所有资源处理器类型
            List <Type> types = AssemblyUtility.GetAssignableTypes(AssemblyUtility.UnityDefaultAssemblyEditorName, typeof(IAssetProcessor));

            types.Add(typeof(DefaultProcessor));
            for (int i = 0; i < types.Count; i++)
            {
                Type type = types[i];
                if (_cacheTypes.ContainsKey(type.Name) == false)
                {
                    _cacheTypes.Add(type.Name, type);
                }
            }
        }
Esempio n. 15
0
        private void LocalStorage_StorageBeforeLoad()
        {
            Log.WriteLine("BeforeLoad");
            Serialization.Deserialize <List <VersionRecorder> >(PathHelper.VersionRecorders)
            .WhenNotDefault(_ => CompositeStorage.VersionRecorders = _);

            Serialization.Deserialize <Dictionary <string, int> >(PathHelper.CellTypeIDs)
            .WhenNotDefault(_ => CompositeStorage.CellTypeIDs = _);

            Serialization.Deserialize <List <int> >(PathHelper.IDIntervals)
            .WhenNotDefault(_ => CompositeStorage.IDIntervals = _);

            if (CompositeStorage.VersionRecorders != default(List <VersionRecorder>))
            {
                var asm = CompositeStorage.VersionRecorders
                          .Select(each => $"{each.Namespace}.dll"
                                  .By(PathHelper.DLL)
                                  .By(Assembly.LoadFrom))
                          .ToList();

                CompositeStorage.StorageSchema
                    = asm.Select(_ => AssemblyUtility.GetAllClassInstances <IStorageSchema>(assembly: _).First()).ToList();

                CompositeStorage.GenericCellOperations
                    = asm.Select(_ => AssemblyUtility.GetAllClassInstances <IGenericCellOperations>(assembly: _).First()).ToList();
            }
        }
 private void ApplyModifiedProperties()
 {
     _hasModifiedProperties = false;
     serializedObject.ApplyModifiedProperties();
     AssemblyUtility.DirtyAllScripts();
     serializedObject.Update();
 }
Esempio n. 17
0
        private static void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton <ICommander, Commander>();

            AssemblyUtility.GetControllerTypes().ToList()
            .ForEach(controller => services.AddSingleton(controller));
        }
Esempio n. 18
0
    void AddAssembly(
        string assemblyFileName,
        string?configFileName)
    {
        if (!FileExists(assemblyFileName))
        {
            throw new ArgumentException($"assembly not found: {assemblyFileName}");
        }
        if (configFileName != null && !FileExists(configFileName))
        {
            throw new ArgumentException($"config file not found: {configFileName}");
        }

        var targetFramework = AssemblyUtility.GetTargetFramework(assemblyFileName);
        var projectAssembly = new XunitProjectAssembly(Project)
        {
            AssemblyFileName = GetFullPath(assemblyFileName),
            ConfigFileName   = GetFullPath(configFileName),
            TargetFramework  = targetFramework
        };

        ConfigReader.Load(projectAssembly.Configuration, projectAssembly.AssemblyFileName, projectAssembly.ConfigFileName);

        Project.Add(projectAssembly);
    }
Esempio n. 19
0
        /// <summary>
        /// 例外ログを書き出す
        /// </summary>
        /// <param name="ex">例外</param>
        static void SaveExceptionLog(Exception ex)
        {
            Log           exceptionLog = new Log(PocketLadioDeuxInfo.ExceptionLogFilePath);
            StringBuilder error        = new StringBuilder();

            Assembly entryAsm = OpenNETCF.Reflection.Assembly2.GetEntryAssembly();

            error.Append("Application:        " +
                         AssemblyUtility.GetTitle(entryAsm) + " " + AssemblyUtility.GetVersion(entryAsm).ToString() + "\r\n");
            error.Append("Date:               " + System.DateTime.Now.ToString("G") + "\r\n");
            error.Append("OS:                 " + Environment.OSVersion.ToString() + "\r\n");
            error.Append("Culture:            " + System.Globalization.CultureInfo.CurrentCulture.Name + "\r\n");
            if (ex != null)
            {
                error.Append("Exception class:    " + ex.GetType().ToString() + "\r\n");
                error.Append("Exception ToString: " + ex.ToString() + "\r\n");
                error.Append("Exception message:  " + "\r\n");
                error.Append(ex.Message);
                error.Append("Exception stack     : " + "\r\n");
                error.Append(ex.StackTrace);
            }
            error.Append("\r\n");
            error.Append("\r\n");

            exceptionLog.LogThis(error.ToString(), Log.LogPrefix.date);
        }
Esempio n. 20
0
        public bool TryEnable(HarmonyInstance harmony)
        {
            try
            {
                var otherAssembly = Assembly.Load(OtherModAssemblyName);
                if (otherAssembly != null)
                {
                    var version = new AssemblyName(otherAssembly.FullName).Version;
                    if (version == OtherModVersion || OtherModVersion == null)
                    {
                        var assembly = AssemblyUtility.FindModAssembly(ThisModName, IntegrationAssemblyPath);
                        if (assembly != null)
                        {
                            harmony.PatchAll(assembly);
                            Log.Message("Frontier Developments Shields :: enabled " + OtherModName + " support");
                            return(true);
                        }
                        else
                        {
                            Log.Warning("Frontier Developments Shields :: unable to load " + OtherModName + " support assembly");
                        }
                    }
                    else
                    {
                        Log.Warning("Frontier Developments Shields :: " + OtherModName + " " + version +
                                    "is loaded and " + OtherModVersion + " is required, not enabling support");
                    }
                }
            }
            catch (Exception)
            {
            }

            return(false);
        }
Esempio n. 21
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // フォームのテキストバーを設定
            this.Text = AssemblyUtility.GetTitle(Assembly.GetExecutingAssembly());

            SwitchEnableUpdateButton();

            // 設定の復元
            LoadFormSetting();

            timelineTwitterListView.SmallImageList = twitterAccount.ProfileSmallImageList;
            timelineTwitterListView.LargeImageList = twitterAccount.ProfileLargeImageList;

            // タイマーを有効にする
            fetchTimelineTimer.Enabled = true;

            if (automaticaryCheck == true)
            {
                automaticaryUpdateMenuItem.Checked = true;
                EnableAutomaticaryCheck();
            }
            else
            {
                automaticaryUpdateMenuItem.Checked = false;
            }
        }
Esempio n. 22
0
        private static bool VerifyAssemblies()
        {
            List <string> assemblies = AssemblyUtility.GetAssemblies(assetsDirectory, AssemblyFilter.ModAssemblies);

            foreach (string scriptAssembly in scriptAssemblies)
            {
                string scriptAssemblyFile = Path.Combine(assemblyDirectory, scriptAssembly);

                if (File.Exists(scriptAssemblyFile))
                {
                    assemblies.Add(scriptAssemblyFile);
                }
            }

            List <string> messages = new List <string>();

            AssemblyVerifier.VerifyAssemblies(assemblies, messages);

            foreach (var message in messages)
            {
                LogUtility.LogWarning(message);
            }

            if (messages.Count > 0)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 23
0
        /// <summary>
        /// アプリケーションのメイン エントリ ポイントです。
        /// </summary>
        static void Main()
        {
            try
            {
                Application.Run(new MainForm());

                // 終了時処理
                try
                {
                    PodcasCoSpecificProcess.ExitDisable();
                }
                catch (IOException)
                {
                    MessageBox.Show("設定ファイルが書き込めませんでした", "設定ファイル書き込みエラー");
                }
            }
            catch (Exception ex)
            {
                // ログに例外情報を書き込む
                Log           exceptionLog = new Log(AssemblyUtility.GetExecutablePath() + @"\" + PodcasCoInfo.ExceptionLogFile);
                StringBuilder error        = new StringBuilder();

                error.Append("Application:       " +
                             PodcasCoInfo.ApplicationName + " " + PodcasCoInfo.VersionNumber + "\r\n");
                error.Append("Date:              " +
                             System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "\r\n");
                error.Append("OS:                " +
                             Environment.OSVersion.ToString() + "\r\n");
                error.Append("Culture:           " +
                             System.Globalization.CultureInfo.CurrentCulture.Name + "\r\n");
                error.Append("Exception class:   " +
                             ex.GetType().ToString() + "\r\n");
                error.Append("ToString:   " +
                             ex.ToString() + "\r\n");
                error.Append("Exception message: "
                             + "\r\n");
                error.Append(ex.Message);

                Exception innnerEx = ex.InnerException;
                while (innnerEx != null)
                {
                    error.Append(innnerEx.Message);
                    error.Append("\r\n");
                    innnerEx = innnerEx.InnerException;
                }

                error.Append("\r\n");
                error.Append("\r\n");

                exceptionLog.LogThis(error.ToString(), Log.LogPrefix.date);

#if DEBUG
                // デバッガで例外内容を確認するため、例外をアプリケーションの外に出す
                throw ex;
#else
                Trace.Assert(false, "予期しないエラーが発生したため、終了します");
#endif
            }
        }
Esempio n. 24
0
 private void _ScanForAutoRegisteredModules()
 {
     Log.WriteLine("Scanning for auto-registered communication modules.");
     foreach (var m in AssemblyUtility.GetAllClassTypes <CommunicationModule, AutoRegisteredCommunicationModuleAttribute>())
     {
         m_RegisteredModuleTypes.Add(m);
     }
 }
Esempio n. 25
0
 /// <summary>
 /// TwitterAway起動時のチェック処理。
 /// </summary>
 public static void StartUpCheck()
 {
     // MiscPocketCompactLibrary.dllが見つからない場合は例外を投げる
     if (File.Exists(AssemblyUtility.GetExecutablePath() + @"\MiscPocketCompactLibrary.dll") == false)
     {
         throw new DllNotFoundException("Not found MiscPocketCompactLibrary.dll.");
     }
 }
Esempio n. 26
0
        static private void EngineApp_AppCreateBefore()
        {
            //preload NeoAxis.CoreExtension.dll
            AssemblyUtility.RegisterAssembly(typeof(CanvasRendererUtility).Assembly, "");

            //preload Project.dll
            AssemblyUtility.RegisterAssembly(typeof(Project.SimulationApp).Assembly, "");
        }
Esempio n. 27
0
        public static void ExitLevel() // wip, proof of concept
        {
            var allocatedAddress = Allocator.Default.AllocateMemory(1);

            Writer.Default.Write(allocatedAddress, 7);
            AssemblyUtility.CallFunction((ulong)Processes.Default.OpenedProcess.MainModule.BaseAddress + 0x30890, Reader.Default.Read <ulong>((ulong)Processes.Default.OpenedProcess.MainModule.BaseAddress + 0x003E2528, out _), allocatedAddress);
            // maybe this can get the function's return value https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getexitcodethread
        }
Esempio n. 28
0
        /// <summary>接続設定ファイルのパスを取得します。</summary>
        /// <returns>接続設定ファイルのパスを表す文字列。</returns>
        private string getSettingFilePath()
        {
            var execPath = AssemblyUtility.GetExecutingPath();

            return(Path.Combine(execPath,
                                DbConnectionSettingLoader.FLD_SETTING_FOLDER_NAME,
                                DbConnectionSettingLoader.FLE_SETTING_FILE_NAME));
        }
Esempio n. 29
0
 /// <summary>
 /// Gets all the configuration instances
 /// </summary>
 /// <returns></returns>
 internal static List <ConfigurationInstance> GetConfigurationInstances()
 {
     return(AssemblyUtility.GetAllTypes()
            .Where(_ => _.IsClass && !_.IsAbstract)
            .Select(CreateConfigurationEntryTuple)
            .Where(_ => _ != null)
            .ToList());
 }
Esempio n. 30
0
        public void TryGetBrowsableAssembly()
        {
            bool result = AssemblyUtility.TryGetBrowsableAssembly("TestAssembly", out Assembly assembly);

            Assert.True(result);
            Assert.NotNull(assembly);
            Assert.AreEqual("TestAssembly", assembly.GetName().Name);
        }