0

The title sounds like a bit unclear and I am not sure about the terminology. But my problem is: I am now implementing the license verification function of our software, which consists of several modules. For example, the function call is something like License.IsModuleEnabled(m As Module) (the code is in VB.NET)

Now the thing is, it is common for one module to require another module as a prerequisite, for example, for ModuleA to run, ModuleB must be enabled as well. So in Module class I have a public number called RequiredModules which is a list of Module. So the IsModuleEnabled() function would look something like this:

Public Function(m As Module)
   ...     
   For Each module In m.RequiredModules
       If Not IsModuleEnabled(module) Then Return False
   End For
   ...
End Function

The problem is obvious (but the solution is not to me): if ModuleA requires ModuleB, and ModuleB requires ModuleA, the function would go to a dead loop.

Those modules they are parallel to each other so I don't have a clue how to manage such a verification function. Our current solution is that only some "basic" modules can be listed in the RequiredModules, but for long term, to have all modules possible to appear in the list would be better.

4

1 回答 1

0

有一个集合列出所有模块的许可证已经验证,并在调用潜在的冗余验证之前检查这个集合。如果集合中没有值,请进行验证并在其中添加已验证模块的名称。

有另一个类似的设置来列出模块,因为验证故意失败了,所以在这种情况下我们也不会陷入无限循环。

如果验证并行发生,这也应该起作用,因为知识在集合中不断积累,直到足以打破循环。

于 2013-08-30T15:20:09.920 回答