public BaseDataContainer GetRoleList()
        {
            BaseDataContainer container = new BaseDataContainer();

            container.RoleDtoList = this.GetAll().ToList();
            return(container);
        }
        private static void OpenTranslationProjectHelper(StreamReader reader, BaseDataContainer cur)
        {
            // append loading progress
            AppendProgress(cur.name);
            string line = reader.ReadLine();

            while (line.Length != 0 && line[0] != '}')
            {
                if (line[0] == '{')
                {
                    BaseDataElement file;
                    // single file
                    if (line[1] == '#')
                    {
                        file = new SingleFileData(line.Substring(2), cur);
                    }
                    // folder
                    else
                    {
                        file = new FolderData(line.Substring(1), cur);
                    }
                    cur.AddChild(file);
                    OpenTranslationProjectHelper(reader, file);
                }
                line = reader.ReadLine();
            }
        }
        private static AssemblyTypeData ReadType(TypeDefinition type, BaseDataContainer dir)
        {
            AssemblyTypeData typeData = new AssemblyTypeData(type.FullName, dir);

            foreach (var method in type.Methods)
            {
                AssemblyMethodData methodData = ReadMethod(method, typeData);
                if (methodData != null)
                {
                    typeData.methods.Add(methodData);
                }
            }
            foreach (var nestedType in type.NestedTypes)
            {
                AssemblyTypeData nestedTypeData = ReadType(nestedType, dir);
                if (nestedTypeData != null)
                {
                    typeData.nestedTypes.Add(nestedTypeData);
                }
            }
            if (typeData.nestedTypes.Count == 0 && typeData.methods.Count == 0)
            {
                return(null);
            }
            return(typeData);
        }
        private static void ScanFiles(string path, BaseDataContainer curFolder)
        {
            // iterate over all files in the current directory
            // read information intoa SingleFileData and add it to projectData
            foreach (string filename in Directory.EnumerateFiles(path))
            {
                // append loading progress
                AppendProgress(filename);

                // load file
                SingleFileData fileData = new SingleFileData(Path.GetFileName(filename), curFolder);
                TextFinder.TextFinder.FindText(filename, fileData.texts);
                if (fileData.texts.Count > 0)
                {
                    curFolder.AddChild(fileData);
                }
            }

            // iterate over all directories and scan recursively
            foreach (string dirname in Directory.EnumerateDirectories(path))
            {
                // append loading progress
                AppendProgress(dirname);

                // load folder
                FolderData folder = new FolderData(Path.GetFileName(dirname), curFolder);
                ScanFiles(dirname, folder);
                if (folder.children.Count > 0)
                {
                    curFolder.AddChild(folder);
                }
            }
        }
Exemplo n.º 5
0
        public BaseDataContainer GetRequestStateList()
        {
            BaseDataContainer      container = new BaseDataContainer();
            UserRequestTDataAccess da        = new UserRequestTDataAccess();

            container.RequestStateList.AddRange(da.GetStateList());
            return(container);
        }
Exemplo n.º 6
0
        public BaseDataContainer GetDeviceList(int perid, int objTypeId)
        {
            BaseDataContainer   container = new BaseDataContainer();
            PersonelTDataAccess pDa       = new PersonelTDataAccess();
            var lst = pDa.GetDeviceList(perid, objTypeId);

            container.DeviceList = lst;
            return(container);
        }
        public BaseDataContainer GetObjectTypeList()
        {
            BaseDataContainer container = new BaseDataContainer();
            var lst = this.Repository.Context.Objecttypes.ToList();

            foreach (var item in lst)
            {
                var dto = ObjecttypeRepository.GetDto(item);
                container.ObjecttypeDtoList.Add(dto);
            }
            return(container);
        }
Exemplo n.º 8
0
 public AssemblyTypeData(string name, BaseDataContainer dir) : base(name, dir)
 {
     nestedTypes = new List <AssemblyTypeData>();
     methods     = new List <AssemblyMethodData>();
     children    = new CompositeCollection();
     children.Add(new CollectionContainer {
         Collection = nestedTypes
     });
     children.Add(new CollectionContainer {
         Collection = methods
     });
 }
Exemplo n.º 9
0
        public BaseDataContainer GetWorkListByServiceCatJob(int serviceCatJobId, bool loadParents)
        {
            BaseDataTDataAccess           da      = new BaseDataTDataAccess();
            ServiceCategoryJobTDataAccess scJobDa = new ServiceCategoryJobTDataAccess();
            var scjob        = scJobDa.GetSingle(it => it.ServiceCatJobId == serviceCatJobId);
            var serviceCatId = scjob.Servicecategoryid.Value;
            ServiceCategoryTDataAccess scDa = new ServiceCategoryTDataAccess();
            var serviceCat            = scDa.GetSingle(it => it.ServiceCatId == serviceCatId);
            List <SdWorkDto> workList = new List <SdWorkDto>();

            workList = da.GetWorks(serviceCatId);
            if (loadParents)
            {
                if (serviceCat.Parentid.HasValue != null)
                {
                    SdServiceCategoryDto temp = scDa.GetSingle(it => it.ServiceCatId == serviceCat.Parentid.Value);
                    while (temp != null)
                    {
                        var tworkList = da.GetWorks(temp.ServiceCatId);
                        if (tworkList != null)
                        {
                            workList.AddRange(tworkList);
                        }
                        if (temp.Parentid.HasValue)
                        {
                            temp = scDa.GetSingle(it => it.ServiceCatId == temp.Parentid.Value);
                        }
                        else
                        {
                            temp = null;
                        }
                    }
                }
            }


            BaseDataContainer container = new BaseDataContainer()
            {
                WorkList = workList
            };

            return(container);
        }
        public static void ApplyTranslation(string path, BaseDataContainer curFolder)
        {
            foreach (BaseDataElement file in curFolder.children)
            {
                string curPath = Path.Combine(path, file.name);
                // folder
                if (file is FolderData)
                {
                    ApplyTranslation(curPath, file as FolderData);
                    continue;
                }

                // file
                string[] lines   = File.ReadAllLines(curPath);
                string[] parts   = null;
                int      curLine = -1;
                foreach (TextEntry entry in (file as SingleFileData).texts)
                {
                    // new line
                    if (curLine != (entry.line - 1))
                    {
                        // join the parts and update the previous line
                        if (curLine >= 0 && parts != null)
                        {
                            lines[curLine] = string.Join("\"", parts);
                        }
                        // update currently processing line and split to parts
                        curLine = entry.line - 1;
                        parts   = lines[curLine].Split('"');
                    }

                    // only update if translation is made; otherwise remain the same
                    if (entry.translation != null && entry.translation.Length > 0)
                    {
                        parts[2 * entry.index + 1] = entry.translation;
                    }
                }

                lines[curLine] = string.Join("\"", parts);

                File.WriteAllLines(curPath, lines);
            }
        }
 private static void SaveTranslationProjectHelper(StreamWriter writer, BaseDataContainer curFolder)
 {
     // iterate over all file instances in the current folder
     foreach (BaseDataElement file in curFolder.children)
     {
         AppendProgress(file.name);
         writer.WriteLine(FileData2Text(file));
         // folder : recurse
         if (file is FolderData)
         {
             SaveTranslationProjectHelper(writer, file as FolderData);
         }
         // file : iterate over all text entries
         else
         {
             foreach (TextEntry entry in (file as SingleFileData).texts)
             {
                 writer.WriteLine(TextEntry2Text(entry));
             }
         }
         writer.WriteLine("}");
     }
     writer.Flush();
 }
 public SingleFileData(string name, BaseDataContainer dir) : base(name, dir)
 {
     texts = new ObservableCollection <TextFinder.TextEntry>();
 }
 public FolderData(string name, BaseDataContainer dir) : base(name, dir)
 {
     children = new List <BaseDataElement>();
 }