예제 #1
0
        private static void PersistModuleToFile(string folder, IModule module, IObjectTree tree)
        {
            string fileName = Path.Combine(folder, module.Name + ".module");

            using (StreamWriter writer = new StreamWriter(fileName))
            {
                writer.Write("#");
                foreach (string dependent in module.Dependents)
                {
                    writer.Write(dependent);
                    writer.Write(',');
                }

                writer.WriteLine();
                foreach (IEntity entity in module.Entities)
                {
                    IDefinition node = tree.Find(module.Name, entity.Name);
                    if (node == null)
                    {
                        continue;
                    }

                    uint[] id = node.GetNumericalForm();

                    /* 0: id
                     * 1: type
                     * 2: name
                     * 3: parent name
                     */
                    writer.WriteLine(ObjectIdentifier.Convert(id) + "," + entity.GetType() + "," + entity.Name + "," + entity.Parent);
                }

                writer.Close();
            }
        }
예제 #2
0
        private static Definition ParseLine(string line, string module)
        {
            string[] content = line.Split(',');

            /* 0: id
             * 1: type
             * 2: name
             * 3: parent name
             */
            uint[] id = ObjectIdentifier.Convert(content[0]);
            return(new Definition(id, content[2], content[3], module, content[1]));
        }