private CorePathWithSubFolder[] GetPath(CoreDll.PathType pathType) { CorePathWithSubFolder[] pathWSF = new CorePathWithSubFolder[0]; IntPtr[] size = new IntPtr[1]; string[] path = new string[0]; if (m_dll.adPathGetW(m_handle, pathType, new IntPtr(1), Marshal.UnsafeAddrOfPinnedArrayElement(size, 0)) == CoreDll.Error.OutputBufferIsTooSmall) { char[] buffer = new char[(CoreDll.MAX_PATH_EX + 1) * size[0].ToInt32()]; if (m_dll.adPathGetW(m_handle, pathType, Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0), Marshal.UnsafeAddrOfPinnedArrayElement(size, 0)) == CoreDll.Error.Ok) { pathWSF = new CorePathWithSubFolder[size[0].ToInt32()]; for (int i = 0; i < size[0].ToInt32(); ++i) { pathWSF[i] = new CorePathWithSubFolder(); pathWSF[i].path = BufferToString(buffer, i * (CoreDll.MAX_PATH_EX + 1), CoreDll.MAX_PATH_EX); if (buffer[(CoreDll.MAX_PATH_EX + 1) * i + CoreDll.MAX_PATH_EX] == (char)1) { pathWSF[i].enableSubFolder = true; } else { pathWSF[i].enableSubFolder = false; } } } } return(pathWSF); }
/// <summary> /// Устанавливает опции в ядре из текущих, для передачи в dll. /// </summary> /// <param name="core"></param> /// <param name="onePath"></param> public void Set(CoreLib core, bool onePath) { core.searchOptions = searchOptions.Clone(); core.compareOptions = compareOptions.Clone(); core.defectOptions = defectOptions.Clone(); core.advancedOptions = advancedOptions.Clone(); if (onePath) { CorePathWithSubFolder[] tmpSearch = new CorePathWithSubFolder[1]; CorePathWithSubFolder[] tmpOther = new CorePathWithSubFolder[0]; if (searchPath.Length > 0 && Directory.Exists(searchPath[0].path)) { tmpSearch[0] = searchPath[0]; } else { tmpSearch[0].path = Application.StartupPath; } core.searchPath = tmpSearch; core.ignorePath = tmpOther; core.validPath = tmpOther; core.deletePath = tmpOther; } else { core.searchPath = searchPath; core.ignorePath = ignorePath; core.validPath = validPath; core.deletePath = deletePath; } }
public static void PathCopy(CorePathWithSubFolder[] source, ref CorePathWithSubFolder[] destination) { destination = new CorePathWithSubFolder[source.GetLength(0)]; for (int i = 0; i < source.GetLength(0); ++i) { destination[i] = source[i]; } }
public void SetDefault(CoreLib core, bool onePath) { CoreOptions old = new CoreOptions(); old.Get(core, onePath); core.SetDefaultOptions(); Get(core, onePath); old.Set(core, onePath); ignorePath = new CorePathWithSubFolder[1]; ignorePath[0] = new CorePathWithSubFolder(); ignorePath[0].path = Resources.DataPath; }
private CorePathWithSubFolder[] GetActualPath(string[] path) { List <CorePathWithSubFolder> actualPath = new List <CorePathWithSubFolder>(); string[] actualExtensions = m_oldCoreOptions.searchOptions.GetActualExtensions(); //список поддерживаемых расширений for (int i = 0; i < path.Length; ++i) { if (Directory.Exists(path[i])) { CorePathWithSubFolder sfPath = new CorePathWithSubFolder(); sfPath.path = path[i]; sfPath.enableSubFolder = true; actualPath.Add(sfPath); } else { FileInfo fileInfo = new FileInfo(path[i]); if (fileInfo.Extension.Length > 1) { string extension = fileInfo.Extension.ToUpper().Substring(1); for (int j = 0; j < actualExtensions.Length; ++j) { if (extension == actualExtensions[j]) //если расширение из списка поддерживаемых { CorePathWithSubFolder sfPath = new CorePathWithSubFolder(); sfPath.path = path[i]; sfPath.enableSubFolder = false; actualPath.Add(sfPath); break; } } } } } return((CorePathWithSubFolder[])actualPath.ToArray()); }
public static CorePathWithSubFolder[] PathClone(CorePathWithSubFolder[] path) { CorePathWithSubFolder[] clone = new CorePathWithSubFolder[0]; PathCopy(path, ref clone); return(clone); }
public bool Equals(CorePathWithSubFolder pathWithSubFolder) { return (enableSubFolder == pathWithSubFolder.enableSubFolder && path == pathWithSubFolder.path); }
public CorePathWithSubFolder(CorePathWithSubFolder pathWithSubFolder) { enableSubFolder = pathWithSubFolder.enableSubFolder; path = pathWithSubFolder.path; }