Exemple #1
0
 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);
 }
Exemple #2
0
        private void UpdateSubFolderOptions(ItemCheckEventArgs e)
        {
            if (m_tabControl.SelectedTab == null)
            {
                m_tabControl.SelectedIndex = 0;
            }

            CoreDll.PathType pathType       = (CoreDll.PathType)m_tabControl.SelectedTab.Tag;
            CheckedListBox   checkedListBox = GetCurrentCheckedListBox();

            CorePathWithSubFolder[] path = GetCurrentPath();

            if (checkedListBox != null)
            {
                if (checkedListBox.SelectedIndex != -1)
                {
                    if (checkedListBox == m_searchCheckedList)
                    {
                        if (e.NewValue == CheckState.Unchecked)
                        {
                            path[checkedListBox.SelectedIndex].enableSubFolder = false;
                        }
                        else
                        {
                            path[checkedListBox.SelectedIndex].enableSubFolder = true;
                        }
                    }
                }
            }
        }
Exemple #3
0
        private void UpdateButtonEnabling()
        {
            if (m_tabControl.SelectedTab == null)
            {
                m_tabControl.SelectedIndex = 0;
            }

            CoreDll.PathType pathType = (CoreDll.PathType)m_tabControl.SelectedTab.Tag;
            ListBox          listBox  = GetCurrentListBox();

            CorePathWithSubFolder[] path = GetCurrentPath();

            if (listBox == null || path == null ||
                listBox.SelectedIndex < 0 || listBox.SelectedIndex >= path.Length)
            {
                m_changeButton.Enabled = false;
                m_removeButton.Enabled = false;
            }
            else
            {
                m_changeButton.Enabled = true;
                if (listBox == m_searchCheckedList && path.Length == 1)
                {
                    m_removeButton.Enabled = false;
                }
                else
                {
                    m_removeButton.Enabled = true;
                }
            }

            m_okButton.Enabled = !m_oldCoreOptions.Equals(m_newCoreOptions);
        }
Exemple #4
0
 public bool SetLocation(IEnumerable <Location> locations, CoreDll.PathType pathType)
 {
     _dll.adClearLocations(pathType);
     foreach (Location item in locations)
     {
         _dll.adAddLocations(pathType, item);
     }
     return(true);
 }
Exemple #5
0
        private bool SetPath(CoreDll.PathType pathType, CorePathWithSubFolder[] path)
        {
            char[] buffer = new char[path.Length * (CoreDll.MAX_PATH_EX + 1)];
            for (int i = 0; i < path.Length; i++)
            {
                path[i].path.CopyTo(0, buffer, i * (CoreDll.MAX_PATH_EX + 1), path[i].path.Length);
                buffer[(CoreDll.MAX_PATH_EX + 1) * i + CoreDll.MAX_PATH_EX] = path[i].enableSubFolder ? (char)1 : (char)0;
            }

            return(m_dll.adPathWithSubFolderSetW(m_handle,
                                                 pathType,
                                                 Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0),
                                                 new IntPtr(path.Length)) == CoreDll.Error.Ok);
        }