コード例 #1
0
ファイル: Program.cs プロジェクト: titusxp/buzzle
        private static void LoadDatabase()
        {
            //Connect to the server
            var connectionString = "Data Source=localhost\\sqlexpress;Initial Catalog=master;Integrated Security=SSPI";
            var con = new SqlConnection(connectionString);
            ServerConnection serverConnection = new ServerConnection(con);
            Server sqlServer = new Server(serverConnection);

            System.IO.FileInfo mdf = new System.IO.FileInfo(@"Buzzle.mdf");
            System.IO.FileInfo ldf = new System.IO.FileInfo(@"Buzzle_log.LDF");

            var dbPath = sqlServer.MasterDBPath;
            var databasePath = dbPath + @"\Buzzle.mdf";
            var databaseLogPath = dbPath + @"\Buzzle_log.LDF";

            File.Copy(mdf.FullName, databasePath, true);
            File.Copy(ldf.FullName, databaseLogPath, true);

            var databasename = mdf.Name.ToLower().Replace(@".mdf", @"");

            System.Collections.Specialized.StringCollection databasefiles = new System.Collections.Specialized.StringCollection();
            databasefiles.Add(databasePath);
            databasefiles.Add(databaseLogPath);

            sqlServer.AttachDatabase(databasename, databasefiles);
        }
コード例 #2
0
ファイル: LimitTest3.cs プロジェクト: uvbs/Holodeck
        public override void executeTest( )
        {
            Holodeck.HolodeckProcess.Start ();

            Holodeck.HolodeckPane.File_NewProject ();
            Holodeck.NewProjectPane1.Reset ();
            Holodeck.NewProjectPane1.SetProjectLocation ("C:\\LimitTest.hdp");
            Holodeck.NewProjectPane1.Next ();
            Holodeck.NewProjectPane2.Reset ();

            string applicationToLaunchPath = System.Environment.SystemDirectory + "\\..\\notepad.exe";

            Holodeck.NewProjectPane2.SetApplicationName (applicationToLaunchPath);
            Holodeck.NewProjectPane2.Next ();
            Holodeck.NewProjectPane3.Reset ();
            Holodeck.NewProjectPane3.SetPauseApplication (true);
            Holodeck.NewProjectPane3.Finish ();

            Holodeck.HolodeckPane.SelectLimitsPane ();

            Holodeck.HolodeckPane.Application_Resume ();
            Holodeck.LimitsPane.SetDiskUnits (Holodeck.LimitsPane.Unit.Byte);
            Holodeck.LimitsPane.SetDiskLimit(5); // Set Disk Limits to 5 bytes

            System.Collections.Specialized.StringCollection keyList = new System.Collections.Specialized.StringCollection ();
            keyList.Add ("1234567");
            keyList.Add ("%f");
            keyList.Add ("s");
            keyList.Add ("c:\\1.txt");
            keyList.Add ("{ENTER}");
            System.Threading.Thread.Sleep (1000);

            Holodeck.HolodeckProcess.SendKeysToApp ("Untitled - Notepad", keyList);
            /*
            try
            {
                keyList.Clear ();
                keyList.Add ("{ENTER}");
                Holodeck.HolodeckProcess.SendKeysToApp ("Notepad", keyList);

            }
            catch (Holodeck.HolodeckExceptions.CannotFindApplication e) // We couldn't find error dialog -> Holodeck didn't set the limits properly
            {
                // TODO: quit the application properly
                // TODO: exit Holodeck
                throw e;
            }*/
        }
コード例 #3
0
		public System.Collections.Specialized.StringCollection Extract()
		{
			String strPattern = "([A-Za-z0-9](([_\\.\\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\\.\\-]?[a-zA-Z0-9]+)*)\\.([A-Za-z]{2,}))";
			System.Collections.Specialized.StringCollection collAddresses = new System.Collections.Specialized.StringCollection();
			NodeFilter filter = new RegexFilter(strPattern, true);
			NodeList nodes = m_obParser.Parse(filter);
			if (null != nodes &&
				0 != nodes.Size())
			{
				RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Multiline;
				Regex obRegex = new Regex(strPattern, options);
				for(Int32 i = 0; i < nodes.Size(); i++)
				{
					INode obNode = nodes.ElementAt(i);
					String strText = obNode.GetText();

					Match m = obRegex.Match(strText);
					while(m.Success)
					{
						collAddresses.Add(m.Groups[0].Value);
						// Advance to the next match.
						m = m.NextMatch();
					}
				}
			}

			return collAddresses;
		}
コード例 #4
0
 public static ClientAPISettings settings()
 {
     var clientApiSettings = new ClientAPISettings();
             //clientApiSettings.HTTPS_ADDRESS_FOR_FILE_TRANSFER = "localhost";
             var checksumPillars = new System.Collections.Specialized.StringCollection { "checksum2" };
             var pillars = new System.Collections.Specialized.StringCollection();
             //pillars.Add("sbtape2");
             //pillars.Add("reference2");
             pillars.Add("jonas-testpillar");
             pillars.Add("kims-testpillar");
             //pillars.Add("kbpillar2");
             clientApiSettings.CHECKSUMPILLAR_IDS = pillars;
             clientApiSettings.CLIENT_ID = "Jonas-client";
             clientApiSettings.CLIENT_QUEUE = @"queue://jonas_test_client";
             //b.CLIENT_TOPIC_QUEUE = "topic://sa_test_client";
             clientApiSettings.COLLECTION_DESTINATION = "topic://integrationtest1";
             clientApiSettings.COLLECTION_ID = "integrationtest1";
             //b.COLLECTION_SETTINGS_XSD_FILE_PATH = @"C:\BitMagStuff\xsdFiles\bitrepository-repository-settings-10\xsd\RepositorySettings.xsd";
             //b.COMMON_QUEUE = "";
             clientApiSettings.DEFAULT_CHECKSUM_TYPE = "MD5";
             clientApiSettings.IDENTIFICATION_TIMEOUT = 7000;
             clientApiSettings.MAX_EXECUTING_ITEMS = 10;
             clientApiSettings.MAX_NUMBER_OF_REQUEST_RETRIES = 3;
             clientApiSettings.MESSAGE_BUS_CONFIGURATION_NAME = "Integration Test Broker Network A";
             clientApiSettings.MESSAGE_XSD_FILE_PATH = @"D:\bitrepository-message-xml-24\xsd\BitRepositoryMessages.xsd";
             clientApiSettings.PILLAR_IDS = pillars;
             const int port = 443;
             //clientApiSettings.ACTIVEMQ_BROKER = @"ssl://*****:*****@"ssl://217.198.211.150:61616?transport.clientcertfilename=D:/Downloads/Apache/apache-activemq-5.5.1/conf/client.cer&transport.acceptInvalidBrokerCert=true";
             //clientApiSettings.ACTIVEMQ_BROKER = @"tcp://*****:*****@"[a-zA-Z_\.\-0-9]+";
             clientApiSettings.XML_NAMESPACE = "http://bitrepository.org/BitRepositoryMessages.xsd";
             clientApiSettings.XSD_MINIMUM_VERSION = "24";
             clientApiSettings.XSD_VERSION = "24";
             clientApiSettings.OPERATION_TIMEOUT = 120000; // 2 min.
             clientApiSettings.PRIVATE_CERTIFICATE_THUMBPRINT = "B60843F8A3BFBD2944EAF9043D9C2443B936A981";
             clientApiSettings.PUBLIC_CERTIFICATE_THUMBPRINT = "B60843F8A3BFBD2944EAF9043D9C2443B936A981";
             clientApiSettings.USER_CERTIFICATES_STORE = "My";
             clientApiSettings.WEBDAV_HTTP_PORT = port;
             clientApiSettings.WEBDAV_BASEFOLDERNAME = "dav";
             clientApiSettings.WEBDAV_URI_SCHEME = "HTTPS";
             clientApiSettings.WEBDAV_IP_ADDRESS = "217.198.211.150";
             clientApiSettings.WEBDAV_CLIENT_CERTIFICATE_THUMBPRINT = "147cafe2c7d0b07d3a61653977a87ff7fe91f5c6";
             return clientApiSettings;
 }
コード例 #5
0
 private void CopyAsFile(System.Drawing.Imaging.ImageFormat format,
     String FileExtension)
 {
     String temp = saveAsTempFile(format, FileExtension);
     System.Collections.Specialized.StringCollection files = new
         System.Collections.Specialized.StringCollection();
     files.Add(temp);
     Clipboard.SetFileDropList(files);
 }
コード例 #6
0
 public void CSharpStringCollectionNotCompiles()
 {
     Stream stream = GetCSharpBadSample();
     using (StreamReader sr = new StreamReader(stream))
     {
         System.Collections.Specialized.StringCollection references = new System.Collections.Specialized.StringCollection();
         references.Add("System.dll");
         CompilerAssert.NotCompiles(CompilerAssert.CSharpCompiler, references, sr.ReadToEnd());
     }
 }
コード例 #7
0
ファイル: frmBlacklist.cs プロジェクト: Shyvanita/idle_master
 public void SaveBlacklist()
 {
     System.Collections.Specialized.StringCollection blacklist = new System.Collections.Specialized.StringCollection();
     foreach (String appid in lstBlacklist.Items)
     {
         blacklist.Add(appid);
     }
     Properties.Settings.Default.blacklist = blacklist;
     Properties.Settings.Default.Save();
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: niuniuliu/CSharp
    public Form1()
    {
      InitializeComponent();

      // Init ListView and folder collection
      folderCol = new System.Collections.Specialized.StringCollection();
      CreateHeadersAndFillListView();
      PaintListView(@"C:\");
      folderCol.Add(@"C:\");

    }
コード例 #9
0
ファイル: Form15.cs プロジェクト: 777ondro/sw-en
        public Form15()
        {
            InitializeComponent();

            // Init ListView and folder collection
            folderCol = new System.Collections.Specialized.StringCollection();
            CreateHeadersAndFillListView();
            PaintListView(@"C:\");
            folderCol.Add(@"C:\");

            this.lwFilesAndFolders.ItemActivate += new System.EventHandler(this.lwFilesAndFolders_ItemActivate);
        }
コード例 #10
0
        protected void btnAddListValidation_Click(object sender, EventArgs e)
        {
            // ExStart:AddListValidation
            // Accessing the cells collection of the worksheet that is currently active
            GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];

            // Access "B1" cell and add some text
            GridCell cell = sheet.Cells[0, 1];
            cell.PutValue("Select Course:");

            // Accessing "C1" cell
            cell = sheet.Cells[0, 2];

            // Creating List validation for the "C1" cell
            var validation = cell.CreateValidation(GridValidationType.List, true);

            // Adding values to List validation
            var values = new System.Collections.Specialized.StringCollection();
            values.Add("Fortran");
            values.Add("Pascal");
            values.Add("C++");
            values.Add("Visual Basic");
            values.Add("Java");
            values.Add("C#");
            validation.ValueList = values;
            // ExEnd:AddListValidation 
        }
コード例 #11
0
ファイル: SettingsPanel.cs プロジェクト: RH-Code/GAPP
 public void Apply()
 {
     System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();
     foreach (ListViewItem lvi in listView1.Items)
     {
         if (lvi.Checked)
         {
             sc.Add(lvi.Tag as string);
         }
     }
     Properties.Settings.Default.Startup = sc;
     Properties.Settings.Default.Save();
 }
コード例 #12
0
ファイル: search.cs プロジェクト: itktc/projectktc-v2
        public static string BuildMultiColumnFilter(string filterExpression, DataColumnCollection coloumns)
        {
            System.Collections.Specialized.StringCollection coloumNames = new System.Collections.Specialized.StringCollection();

                foreach (DataColumn col in coloumns)
                {

                    coloumNames.Add(col.ColumnName);

                }

                return BuildMultiColumnFilter(filterExpression, coloumNames);
        }
        protected void btnAddDropDownListValidation_Click(object sender, EventArgs e)
        {
            // ExStart:AddDropDownListValidation
            // Accessing the cells collection of the worksheet that is currently active
            GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];

            // Access "B1" cell and add some text
            GridCell cell = sheet.Cells[0, 1];
            cell.PutValue("Select Degree:");

            // Accessing "C1" cell
            cell = sheet.Cells[0, 2];

            // Creating DropDownList validation for the "C1" cell
            var validation = cell.CreateValidation(GridValidationType.DropDownList, true);
                        
            // Adding values to DropDownList validation
            var values = new System.Collections.Specialized.StringCollection();
            values.Add("Bachelor");
            values.Add("Master");
            values.Add("Doctor");
            validation.ValueList = values;
            // ExEnd:AddDropDownListValidation
        }
コード例 #14
0
ファイル: settings.cs プロジェクト: julian202/LukMachine
        private void button2_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.LowPumpSetting = textBox1.Text;
              Properties.Settings.Default.MediumPumpSetting = textBox2.Text;
              Properties.Settings.Default.HighPumpSetting = textBox3.Text;

              System.Collections.Specialized.StringCollection pressures = new System.Collections.Specialized.StringCollection();
              System.Collections.Specialized.StringCollection fluids = new System.Collections.Specialized.StringCollection();

              //look at each item and see if there is something there to save
              foreach (DataGridViewRow dRow in dataGridView2.Rows)
              {
            try
            {
              if (dRow.Cells[0].Value.ToString() != "" && dRow.Cells[1].Value.ToString() != "")
            pressures.Add(dRow.Cells[0].Value.ToString() + ":" + dRow.Cells[1].Value.ToString());
            }
            catch (NullReferenceException ex)
            {
              //show error and return
              //MessageBox.Show("Invalid entry for Pressure Unit on line " + (dRow.Index + 1).ToString() + "!", COMMS.Instance.appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
              //return;
            }
              }
              //make sure we save any good values user has entered here too...
              foreach (DataGridViewRow dRow in dataGridView3.Rows)
              {
            try
            {
              if (dRow.Cells[0].Value.ToString() != "" && dRow.Cells[1].Value.ToString() != "")
            fluids.Add(dRow.Cells[0].Value.ToString() + ":" + dRow.Cells[1].Value.ToString());
            }
            catch (NullReferenceException ex)
            {
              //show error and return
              //MessageBox.Show("Invalid entry for Fluid/viscosity on line " + (dRow.Index + 1).ToString() + "!", COMMS.Instance.appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
              //return;
            }
              }

              Properties.Settings.Default.pressureUnits = pressures;
              Properties.Settings.Default.fluids = fluids;
              Properties.Settings.Default.COMM = comboBox1.Text;
              Properties.Settings.Default.Save();
              Close();
        }
コード例 #15
0
        } //  ExtractAllFilesFromZipPackageOverwrite()

        public System.Collections.Specialized.StringCollection RetrieveListOfFilesInZipFile(string ZipFilePath)
        {
            System.Collections.Specialized.StringCollection fileList = null;

            try
            {
                //  Instantiate the List that will be used to store the file names so that they can be sent to the calling method.
                fileList = new System.Collections.Specialized.StringCollection();


                //  Retrieve the List the Files from the Zip Package.
                using (Ionic.Zip.ZipFile inputZipFile = Ionic.Zip.ZipFile.Read(ZipFilePath))
                {
                    foreach (Ionic.Zip.ZipEntry currentEntry in inputZipFile)
                    {
                        fileList.Add(currentEntry.FileName);
                    }
                }


                //  Return the list of file names to the calling method.
                return(fileList);
            }
            catch (System.Exception caught)
            {
                //  Let the User know that this method failed.
                if (ErrorMessage != null)
                {
                    ProcessMessage("The MaintTools.ZipFileManager.RetrieveListOfFilesInZipFile() Method failed with error message:  " + caught.Message);
                }

                //  Return NULL Pointer to the calling method to indicate that this process failed.
                return(null);
            }
            finally
            {
                //  If the File List was instantiated, close it.
                if (fileList != null)
                {
                    fileList = null;
                }
            }
        } //  RetrieveListOfFilesInZipFile()
コード例 #16
0
 private void _media_BeginDragn(object sender, MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         var selectedMediaFiles = GetSelectedMedia();
         if ((selectedMediaFiles == null) || (selectedMediaFiles.Count == 0))
         {
             return;
         }
         System.Collections.Specialized.StringCollection pathes = new System.Collections.Specialized.StringCollection();
         foreach (var mf in selectedMediaFiles)
         {
             pathes.Add(mf.FullName);
         }
         DataObject dragObj = new DataObject();
         dragObj.SetFileDropList(pathes);
         DragDrop.DoDragDrop(this._media, dragObj, DragDropEffects.Copy);
     }
 }
コード例 #17
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            // Save custome defined scopes.

            System.Collections.Specialized.StringCollection customeDefinedScopes = new System.Collections.Specialized.StringCollection();

            foreach (var scope in checkedListBox_Scopes.Items)
            {
                if (!IsPredefinedScope(scope.ToString()))
                {
                    customeDefinedScopes.Add(scope.ToString());
                }
            }

            Properties.Settings.Default.CustomDefinedScopes = customeDefinedScopes;
            Properties.Settings.Default.Save();

            DialogResult = DialogResult.OK;
        }
コード例 #18
0
ファイル: Form1.cs プロジェクト: maziesmith/CSharpLearning
        private void lvFilesFolders_ItemActivate(object sender, EventArgs e)
        {
            var lw       = (System.Windows.Forms.ListView)sender;
            var fileName = lw.SelectedItems[0].Tag.ToString();

            if (lw.SelectedItems[0].ImageIndex != 0)
            {
                try
                {
                    System.Diagnostics.Process.Start(fileName);
                }
                catch { return; }
            }
            else
            {
                PaintListView(fileName);
                _folderCol.Add(fileName);
            }
        }
コード例 #19
0
        private void LisVMenu_ItemActivate(object sender, EventArgs e)
        {
            System.Windows.Forms.ListView lw = (System.Windows.Forms.ListView)sender;
            string filename = lw.SelectedItems[0].Tag.ToString();

            if (lw.SelectedItems[0].ImageIndex != 0)
            {
                try
                {
                    System.Diagnostics.Process.Start(filename);
                }
                catch { return; }
            }
            else
            {
                DibujarListView(filename);
                carpetacol.Add(filename);
            }
        }
コード例 #20
0
        //---------------------------------------------------------------------
        internal override bool SocketReceive(int ByteCount_in)
        {
            string s = null;

            s         = LastLine_;
            LastLine_ = "";
            s        += System.Text.Encoding.ASCII.GetString(RecvBuffer.Bytes, 0, ByteCount_in);
            int i = s.IndexOf("\n");

            while ((i >= 0))
            {
                Lines_.Add(s.Substring(0, i));
                //Audit.TraceMessage("D", "SMTP_Client_SocketHandler::SocketReceive", "Received : '" & Lines_.Item(Lines_.Count - 1) & "'")
                s = s.Remove(0, i + 2);
                i = s.IndexOf("\n");
            }
            LastLine_ = s;
            return(true);
        }
コード例 #21
0
        private void UpdateSelectedMembers()
        {
            //get keys of selected visible members
            System.Collections.Specialized.StringCollection chkList   = new System.Collections.Specialized.StringCollection();
            System.Collections.Specialized.StringCollection radioList = new System.Collections.Specialized.StringCollection();

            for (int j = 0; j < Request.Form.Count; j++)
            {
                string mKey = Request.Form.Keys[j];
                string mVal = Request.Form[j];


                if (mKey.StartsWith(_selControl.UniqueID + ":m:"))
                {
                    if (mVal == "on")                  //checkboxes
                    {
                        int index = mKey.IndexOf(":");
                        index = mKey.IndexOf(":", index + 1) + 1;
                        string uniqueName = mKey.Substring(index, mKey.Length - index);
                        chkList.Add(uniqueName);
                    }
                    else if (mVal.StartsWith("m"))                   //radios
                    {
                        int    index      = mVal.IndexOf(":") + 1;
                        string identifier = mVal.Substring(index, mVal.Length - index);
                        radioList.Add(identifier);
                    }
                }
            }


            try
            {
                _contr.AddMembersAndRemoveSiblings(chkList, true);
                _contr.AddMembersAndRemoveSiblings(radioList, false);
            }
            catch (Exception exc)
            {
                this.ShowException(exc);
                return;
            }
        }
コード例 #22
0
        private static List <string> GetFilesDir(DirectoryInfo root)
        {
            FileInfo[]      files   = null;
            DirectoryInfo[] subDirs = null;

            // Сначала обрабатываю все файлы непосредственно в этой папке
            try
            {
                files = root.GetFiles("*.*");
            }
            // Это вызывается, если один из файлов требует разрешения больше
            // чем приложение предоставляет.
            catch (UnauthorizedAccessException e)
            {
                // Этот код выдает сообщение и продолжает работать.
                // Вы можете попытаться повысить Ваш уровень доступа и получить доступ к файлу.
                log.Add(e.Message);
            }

            catch (DirectoryNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }

            if (files != null)
            {
                foreach (FileInfo file in files)
                {
                    getAllFiles.Add(file.FullName.Substring(head.Length + 1));
                }

                // Теперь ищу все подкаталоги в этом каталоге.
                subDirs = root.GetDirectories();

                foreach (DirectoryInfo dirInfo in subDirs)
                {
                    // Рекурсивный вызов для каждого подкаталога.
                    GetFilesDir(dirInfo);
                }
            }
            return(getAllFiles);
        }
コード例 #23
0
        private static void LoadPluginAssemblies()
        {
            var  pluginAssemblies = new System.Collections.Specialized.StringCollection();
            bool updateNeeded     = false;

            foreach (string pluginAssembly in Settings.Default.PluginAssemblies)
            {
                try
                {
                    var assembly = Assembly.LoadFrom(pluginAssembly);

                    FindPlugins(assembly);
                    pluginAssemblyList.Add(assembly);

                    pluginAssemblies.Add(pluginAssembly);
                }
                catch (FileNotFoundException ex)
                {
                    Console.Error.WriteLine(ex);
                    MessageBox.Show(string.Format(Resources.Culture, Resources.AssemblyNotFoundErrorMessage, pluginAssembly), Resources.AssemblyLoadErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    updateNeeded = true;
                }
                catch (BadImageFormatException ex)
                {
                    Console.Error.WriteLine(ex);
                    MessageBox.Show(string.Format(Resources.Culture, Resources.AssemblyArchitectureErrorMessage, pluginAssembly), Resources.AssemblyLoadErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    updateNeeded = true;
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(ex);
                    MessageBox.Show(string.Format(Resources.Culture, Resources.AssemblyLoadErrorMessage, pluginAssembly, ex), Resources.AssemblyLoadErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    updateNeeded = true;
                }
            }

            if (updateNeeded)
            {
                Settings.Default.PluginAssemblies = pluginAssemblies;
                Settings.Default.Save();
            }
        }
コード例 #24
0
ファイル: FrmFillDownload.cs プロジェクト: xlgwr/TT_Samples
        private void btnSaveSettings_Click(object sender, EventArgs e)
        {
            Properties.filldownload.Default.ApiURL = txtURL.Text;
            Properties.filldownload.Default.Secret = txtSecret.Text;
            Properties.filldownload.Default.Env    = txtEnvironment.Text;

            Properties.filldownload.Default.Frequency = txtFrequency.Text;

            Properties.filldownload.Default.OutputFolder = txtOutput.Text;

            Properties.filldownload.Default.StartTime = dtpStartTime.Value.TimeOfDay;
            Properties.filldownload.Default.EndTime   = dtpEndTime.Value.TimeOfDay;

            if (dtpStartDate.Checked)
            {
                Properties.filldownload.Default.StartDate = dtpStartDate.Value;
            }
            else
            {
                Properties.filldownload.Default.StartDate = default(DateTime);
            }

            Properties.filldownload.Default.RunSunday    = chkSunday.Checked;
            Properties.filldownload.Default.RunMonday    = chkMonday.Checked;
            Properties.filldownload.Default.RunTuesday   = chkTuesday.Checked;
            Properties.filldownload.Default.RunWednesday = chkWednesday.Checked;
            Properties.filldownload.Default.RunThurday   = chkThursday.Checked;
            Properties.filldownload.Default.RunFriday    = chkFriday.Checked;
            Properties.filldownload.Default.RunSaturday  = chkSaturday.Checked;

            Properties.filldownload.Default.FileMode = (FileMode)cbFileMode.SelectedItem;

            var columns = new System.Collections.Specialized.StringCollection();

            foreach (var col in clbColumns.CheckedItems)
            {
                columns.Add(col.ToString());
            }
            Properties.filldownload.Default.Columns = columns;

            Properties.filldownload.Default.Save();
        }
コード例 #25
0
    static void WalkDirectoryTree(System.IO.DirectoryInfo root)
    {
        System.IO.FileInfo[]      files   = null;
        System.IO.DirectoryInfo[] subDirs = null;
        // First, process all the files directly under this folder
        try
        {
            files = root.GetFiles("*.*");
        }
        // This is thrown if even one of the files requires permissions greater
        // than the application provides.
        catch (UnauthorizedAccessException e)
        {
            // This code just writes out the message and continues to recurse.
            // You may decide to do something different here. For example, you
            // can try to elevate your privileges and access the file again.
            log.Add(e.Message);
        }
        catch (System.IO.DirectoryNotFoundException e)
        {
            Console.WriteLine(e.Message);
        }

        if (files != null)
        {
            foreach (System.IO.FileInfo fi in files)
            {
                // In this example, we only access the existing FileInfo object. If we
                // want to open, delete or modify the file, then
                // a try-catch block is required here to handle the case
                // where the file has been deleted since the call to TraverseTree().
                Console.WriteLine(fi.FullName);
            }
            // Now find all the subdirectories under this directory.
            subDirs = root.GetDirectories();
            foreach (System.IO.DirectoryInfo dirInfo in subDirs)
            {
                // Resursive call for each subdirectory.
                WalkDirectoryTree(dirInfo);
            }
        }
    }
コード例 #26
0
 private void SaveModules()
 {
     System.Collections.Specialized.StringCollection modsettings = new System.Collections.Specialized.StringCollection();
     foreach (ListViewItem lvw in lvwModules.Items)
     {
         String modstr = "";
         foreach (ListViewItem.ListViewSubItem subitm in lvw.SubItems)
         {
             modstr += subitm.Text + "|";
         }
         if (modstr.Trim() != "")
         {
             modstr = modstr.Substring(0, modstr.Length - 1);
             modsettings.Add(modstr);
         }
     }
     Properties.Settings.Default["Modules"] = modsettings;
     Properties.Settings.Default.Save();
     Properties.Settings.Default.Reload();
 }
コード例 #27
0
        /// <summary>
        /// Extracts the constant from a condition
        /// </summary>
        /// <returns>The extracted variable</returns>
        public int?GetConstFromCondition()
        {
            Validate();
            System.Collections.Specialized.StringCollection refvarIDs = new System.Collections.Specialized.StringCollection();
            Match matchResult = Regex.Match(TACtext, "ID_[A-F0-9]{8}(?:-[A-F0-9]{4}){3}-[A-F0-9]{12}", RegexOptions.None);

            while (matchResult.Success)
            {
                refvarIDs.Add(matchResult.Value);
                matchResult = matchResult.NextMatch();
            }
            if (refvarIDs.Count == 3)
            {
                return(null);
            }
            else
            {
                return(Convert.ToInt32(TACtext.Split(' ')[3]));
            }
        }
コード例 #28
0
        //复制选定内容至剪切板
        private void copyToClipboard()
        {
            string path = CurrentPath;

            if (path.Length > 3)  //当前路径加斜杠
            {
                path += "\\";
            }
            System.Collections.Specialized.StringCollection strcoll = new System.Collections.Specialized.StringCollection();
            foreach (var item in lb.SelectedItems)
            {
                var    m = (MyListBoxItem)item;
                string p = path + m.MyText;
                strcoll.Add(p);
            }
            if (strcoll.Count != 0)
            {
                Clipboard.SetFileDropList(strcoll);
            }
        }
コード例 #29
0
ファイル: IOFunctions.cs プロジェクト: lucyy-mc/Explode
        public static void CutEntries(FormMain form, ListView.SelectedListViewItemCollection items)
        {
            System.Collections.Specialized.StringCollection paths = new System.Collections.Specialized.StringCollection();
            foreach (ListViewItem k in items)
            {
                paths.Add(form.CurrentDirectory + k.Text);
            }

            byte[]       moveEffect = { 2, 0, 0, 0 };
            MemoryStream dropEffect = new MemoryStream();

            dropEffect.Write(moveEffect, 0, moveEffect.Length);

            DataObject dataObj = new DataObject("Preferred DropEffect", dropEffect);

            dataObj.SetFileDropList(paths);

            Clipboard.Clear();
            Clipboard.SetDataObject(dataObj, true);
        }
コード例 #30
0
ファイル: DB.cs プロジェクト: mVentory/mVentorySqlExporter
        /// <summary>
        /// Build and return a single string of CSV values for every field.
        /// </summary>
        /// <param name="arCsvColumnsAll"></param>
        /// <param name="arDbFields"></param>
        /// <param name="dbReader"></param>
        /// <returns></returns>
        static string BuildCsvString(SqlDataReader dbReader)
        {
            var oCSV = new System.Collections.Specialized.StringCollection(); //name-value collection of the output

            //Loop through the list of DB fields and extract what needs to be extracted
            for (int i = 0; i < dbReader.FieldCount; i++)
            {
                string sValue = dbReader[i].ToString(); //Get the actual value

                if (sValue != "")                       //Clean up the value, if any. More clean up functionality will be added as needed.
                {
                    sValue = sValue.Trim();
                }

                oCSV.Add(sValue); //Add to the collection of values for this row
            }

            //return a properly formatted CSV row
            return(buildCSVRow(oCSV));
        }
コード例 #31
0
        private void AddDFFContent(System.Collections.Specialized.StringCollection DFFFiletext, string strPath)
        {
            Boolean bFound = false;

            foreach (string s in DFFFiletext)
            {
                if (s.Contains(strPath))
                {
                    bFound = true;
                    break;
                }
            }
            if (bFound)
            {
            }
            else
            {
                DFFFiletext.Add(strPath + "\t" + strPath.Replace("TEMPLATE\\FEATURES\\", ""));
            }
        }
コード例 #32
0
        /// <summary>
        /// copier
        /// </summary>
        public void CopySelectedFilesToClipboard()
        {
            System.Collections.Specialized.StringCollection stc;
            stc = new System.Collections.Specialized.StringCollection();
            foreach (ListViewItem lvi in containerImage.SelectedItems)
            {
                stc.Add(lvi.Name);
            }

            try
            {
                Clipboard.SetFileDropList(stc);
            }
            catch (Exception ex)
            {
                string msg = "Impossible de copier le/les fichier(s) sélectionné(s)!";
                MessageBox.Show(msg, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
コード例 #33
0
        private void copy()
        {
            string filePath = textBox1.Text.Trim();

            if (File.Exists(filePath))
            {
                System.Collections.Specialized.StringCollection strcoll = new System.Collections.Specialized.StringCollection();

                strcoll.Add(filePath);


                //strcoll.Add(dirPath);
                Clipboard.SetFileDropList(strcoll);
                MessageBox.Show("已复制到剪切板");
            }
            else
            {
                MessageBox.Show("不存在的文件路径");
            }
        }
コード例 #34
0
 private void SaveModules()
 {
     System.Collections.Specialized.StringCollection modsettings = new System.Collections.Specialized.StringCollection();
     foreach (ListViewItem lvw in lvwModules.Items)
     {
         String modstr = "";
         foreach (ListViewItem.ListViewSubItem subitm in lvw.SubItems)
         {
             modstr += subitm.Text + "|";
         }
         if(modstr.Trim() != "")
         {
             modstr = modstr.Substring(0, modstr.Length - 1);
             modsettings.Add(modstr);
         }                
     }
     Properties.Settings.Default["Modules"] = modsettings;
     Properties.Settings.Default.Save();
     Properties.Settings.Default.Reload();
 }
コード例 #35
0
        private void  制ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //打开文件位置
            var lvwFiles = AllFiles;

            if (lvwFiles.SelectedItems.Count > 0)
            {
                string path = lvwFiles.SelectedItems[0].Tag.ToString();
                //path = Directory.Exists(path) ? path : new FileInfo(path).Directory.FullName;
                try
                {
                    System.Collections.Specialized.StringCollection strcoll = new System.Collections.Specialized.StringCollection();
                    strcoll.Add(path);
                    Clipboard.SetFileDropList(strcoll);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #36
0
ファイル: Form1.cs プロジェクト: the-edge01/TaskBarNotes
        private void save()
        {
            System.Collections.Specialized.StringCollection sc_name = new System.Collections.Specialized.StringCollection();
            System.Collections.Specialized.StringCollection sc_text = new System.Collections.Specialized.StringCollection();
            ntl.Clear();
            for (int i = 0; i < tabpage.Count; i++)
            {
                //save to NTL for future reference in code
                ntl.Add(new NameText(tabpage[i].Text, textbox[i].Text));

                //save to disk
                sc_name.Add(tabpage[i].Text);
                sc_text.Add(textbox[i].Text);
            }

            Properties.Settings.Default.TaskNotesName = sc_name;
            Properties.Settings.Default.TaskNotes     = sc_text;

            Properties.Settings.Default.WindowSize = this.Size;
            Properties.Settings.Default.Save();
        }
コード例 #37
0
 /// <summary>
 /// Add or removes path from the folderList_.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="add"></param>
 protected virtual void ExchangePath(string path, bool add)
 {
     if (add)
     {
         if (!folderList_.Contains(path))
         {
             folderList_.Add(path);
             // notfiy add
             OnSelectedDirectoriesChanged(new SelectedDirectoriesChangedEventArgs(path, System.Windows.Forms.CheckState.Checked));
         }
     }
     else
     {
         if (folderList_.Contains(path))
         {
             folderList_.Remove(path);
             // notfiy remove
             OnSelectedDirectoriesChanged(new SelectedDirectoriesChangedEventArgs(path, System.Windows.Forms.CheckState.Unchecked));
         }
     }
 }
コード例 #38
0
ファイル: MainWindow.cs プロジェクト: ChrisTheisen/Searcher
        private void SelectedToClipboard()
        {
            System.Collections.Specialized.StringCollection FilePaths = new System.Collections.Specialized.StringCollection();
            foreach (DataGridViewRow Row in grdResults.SelectedRows)
            {
                string FilePath = Path.Combine(Row.Cells["Path"].Value.ToString(), Row.Cells["Name"].Value.ToString());
                if (File.Exists(FilePath))
                {
                    if (!File.Exists(FilePath))
                    {
                        return;
                    }

                    // combine the arguments together
                    FilePaths.Add(FilePath);
                }
            }

            Clipboard.SetFileDropList(FilePaths);
            lblStatus.Text = FilePaths.Count + " Files copied to clipboard";
        }
コード例 #39
0
        /// <summary>
        /// Reset cache provider
        /// </summary>
        public override void Reset()
        {
            var keys = new System.Collections.Specialized.StringCollection();

            foreach (var item in _cache)
            {
                var x = (DictionaryEntry)item;
                keys.Add(x.Key.ToString());
            }
            if (keys.Count > 0)
            {
                foreach (var key in keys)
                {
                    if (key.StartsWith(_keyPrefix))
                    {
                        // Utils.Log(key);
                        _cache.Remove(key);
                    }
                }
            }
        }
コード例 #40
0
 private void  制ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         al.Clear();
         path = bc.Mpath() + "\\" + listView1.SelectedItems[0].Text;
         for (int i = 0; i < listView1.SelectedItems.Count; i++)
         {
             al.Add(bc.Mpath() + "\\" + listView1.SelectedItems[i].Text);
         }
         System.Collections.Specialized.StringCollection files = new System.Collections.Specialized.StringCollection();
         files.Add(path);
         Clipboard.SetFileDropList(files);
         MyPath = path;
         T      = 1;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #41
0
            /*
             * [DllImport("user32.dll")]
             * static extern bool OpenClipboard(IntPtr hWndNewOwner);
             * [DllImport("user32.dll")]
             * static extern bool EmptyClipboard();
             * [DllImport("user32.dll")]
             * static extern IntPtr SetClipboardData(uint uFormat, IntPtr hMem);
             * [DllImport("user32.dll")]
             * static extern bool CloseClipboard();
             * [DllImport("gdi32.dll")]
             * static extern IntPtr CopyEnhMetaFile(IntPtr hemfSrc, IntPtr hNULL);
             * [DllImport("gdi32.dll")]
             * static extern bool DeleteEnhMetaFile(IntPtr hemf);
             *
             * /// <summary>
             * /// Microsoft Knowledge Base Article - 323530 PRB: Metafiles on Clipboard Are Not Visible to All Applications
             * /// </summary>
             * /// <param name="hWnd"></param>
             * /// <param name="mf"></param>
             * /// <returns></returns>
             * static bool PutEnhMetafileOnClipboard(IntPtr hWnd, Metafile mf)
             * {
             * bool bResult = false;
             * IntPtr hEMF, hEMF2;
             * hEMF = mf.GetHenhmetafile(); // invalidates mf
             * if (!hEMF.Equals(new IntPtr(0)))
             * {
             *  hEMF2 = CopyEnhMetaFile(hEMF, new IntPtr(0));
             *  if (!hEMF2.Equals(new IntPtr(0)))
             *  {
             *    if (OpenClipboard(hWnd))
             *    {
             *      if (EmptyClipboard())
             *      {
             *        IntPtr hRes = SetClipboardData(14 , hEMF2); // 14==CF_ENHMETAFILE
             *        bResult = hRes.Equals(hEMF2);
             *        CloseClipboard();
             *     }
             *    }
             *  }
             *  DeleteEnhMetaFile(hEMF);
             * }
             * return bResult;
             * }
             */


            static public void Run(GraphController ctrl)
            {
                // System.Drawing.Imaging.Metafile mf = Altaxo.Graph.Procedures.Export.GetMetafile(ctrl.Doc);
                // PutEnhMetafileOnClipboard(ctrl.View.Form.Handle, mf);

                System.Windows.Forms.DataObject dao = new System.Windows.Forms.DataObject();
                string filepath = System.IO.Path.GetTempPath();
                string filename = filepath + "AltaxoClipboardMetafile.emf";

                if (System.IO.File.Exists(filename))
                {
                    System.IO.File.Delete(filename);
                }
                Metafile mf = Altaxo.Graph.Procedures.Export.SaveAsMetafile(ctrl.Doc, filename, 300);

                System.Collections.Specialized.StringCollection coll = new System.Collections.Specialized.StringCollection();
                coll.Add(filename);
                dao.SetFileDropList(coll);
                dao.SetData(typeof(Metafile), mf);
                System.Windows.Forms.Clipboard.SetDataObject(dao);
            }
コード例 #42
0
        internal void ExceptionChange()
        {
            if (activeWindow.process != null)
            {
                int index = exceptionList.IndexOf(activeWindow.process.ProcessName);

                if (index != -1)
                {
                    exceptionList.RemoveAt(index);
                }
                else
                {
                    exceptionList.Add(activeWindow.process.ProcessName);
                }

                foreach (SanebarWindow sanebarWindow in sanebarWindows)
                {
                    sanebarWindow.ChangeFocus(true, true);
                }
            }
        }
コード例 #43
0
        public static void SaveFormsGeometry(System.Collections.Specialized.StringCollection stringCollection, Form form)
        {
            if (stringCollection == null)
            {
                return;
            }

            // The form's tag holds a string that identifies this window.  I did it this way to make it independent of
            // the form's title.
            var tagName = form.Tag as string;

            if (tagName == null)
            {
                return;
            }
            var tagNameWithSep = tagName + "|";

            // Find the first string in the collection that starts with this string immediately followed by '|'
            int index = -1;

            for (int x = 0; x < stringCollection.Count; x++)
            {
                if (stringCollection[x].StartsWith(tagNameWithSep))
                {
                    index = x;
                    break;
                }
            }

            var newString = tagNameWithSep + GeometryToString(form);

            if (index == -1)
            {
                stringCollection.Add(newString);
            }
            else
            {
                stringCollection[index] = newString;
            }
        }
コード例 #44
0
        private void Save_BTN_Click(object sender, EventArgs e)
        {
            System.Collections.Specialized.StringCollection roles = new System.Collections.Specialized.StringCollection();
            foreach (string item in Roles_TB.Lines)
            {
                if (item.Length > 0)
                {
                    roles.Add(item.Trim());
                }
            }
            Properties.Settings.Default.Roles = roles;

            System.Collections.Specialized.StringCollection mfas = new System.Collections.Specialized.StringCollection();
            foreach (string item in Mfa_TB.Lines)
            {
                if (item.Length > 0)
                {
                    mfas.Add(item.Trim());
                }
            }
            Properties.Settings.Default.MFADevices = mfas;


            System.Collections.Specialized.StringCollection tags = new System.Collections.Specialized.StringCollection();
            foreach (string item in Tags_TB.Lines)
            {
                if (item.Length > 0)
                {
                    tags.Add(item.Trim());
                }
            }
            Properties.Settings.Default.Tags = tags;


            Properties.Settings.Default.EC2SavedProperties = EC2Items_TB.Text.Trim();

            Properties.Settings.Default.Save();

            this.Close();
        }
コード例 #45
0
 protected override void Execute(CodeActivityContext context)
 {
     try
     {
         string _text = Text.Get(context);
         if (!IsFile)
         {
             Thread td = new Thread(() =>
             {
                 Clipboard.SetDataObject(_text, true);
             });
             td.TrySetApartmentState(ApartmentState.STA);
             td.IsBackground = true;
             td.Start();
         }
         else
         {
             Thread td = new Thread(() =>
             {
                 System.Collections.Specialized.StringCollection strcoll = new System.Collections.Specialized.StringCollection();
                 strcoll.Add(_text);
                 Clipboard.SetFileDropList(strcoll);
             });
             td.TrySetApartmentState(ApartmentState.STA);
             td.IsBackground = true;
             td.Start();
         }
     }
     catch (Exception e)
     {
         SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message);
         if (ContinueOnError.Get(context))
         {
         }
         else
         {
             throw;
         }
     }
 }
コード例 #46
0
        public bool AddPassword(string ipw)
        {
            if (string.IsNullOrEmpty(ipw))
                return false;

            if (Settings.Default.RarPasswords == null)
            {
                var res = new System.Collections.Specialized.StringCollection();
                res.Add(ipw);
                Settings.Default.RarPasswords = res;
                return true;
            }
            else
            {
                if (!Settings.Default.RarPasswords.Contains(ipw))
                {
                    Settings.Default.RarPasswords.Add(ipw);
                    return true;
                }
            }

            return false;
        }
コード例 #47
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if ("".Equals(cboNamespace.Text))
            {
                MessageBox.Show("Enter a namespace first");
                return;
            }

            // save namespaces
            try
            {
                System.Collections.Specialized.StringCollection strColl = new System.Collections.Specialized.StringCollection();

                foreach (string s in cboNamespace.Items.SourceCollection )
                {
                    if (s.Length > 0)
                    {
                        strColl.Add(s);
                    }
                }
                if (!strColl.Contains(cboNamespace.Text))
                {
                    strColl.Insert(0,cboNamespace.Text);
                }
                DictionaryInspector.Properties.Settings.Default.selectedNamespaces = strColl;
                DictionaryInspector.Properties.Settings.Default.Save();
            }
            catch
            {
            }

            // open window
            MainWindow window = new MainWindow(cboNamespace.Text, int.Parse(txtPort.Text));
            window.Show();
            this.Close();
        }
コード例 #48
0
ファイル: BaseEngine.cs プロジェクト: blmarket/filehatchery
        private void DeleteFiles()
        {
            System.Collections.Specialized.StringCollection files = new System.Collections.Specialized.StringCollection();
            IEnumerable<IBrowserItem> itemset = Browser.CurSelItems;

            foreach (IBrowserItem item in itemset)
            {
                files.Add(item.FullPath);
            }

            ShellLib.ShellFileOperation fo = new ShellLib.ShellFileOperation();

            string[] filearray = new string[files.Count];
            files.CopyTo(filearray, 0);
            fo.Operation = ShellLib.ShellFileOperation.FileOperations.FO_DELETE;
            fo.OwnerWindow = Program.form.Handle;
            fo.SourceFiles = filearray;

            fo.OperationFlags = ShellLib.ShellFileOperation.ShellFileOperationFlags.FOF_NO_CONNECTED_ELEMENTS
                | ShellLib.ShellFileOperation.ShellFileOperationFlags.FOF_WANTNUKEWARNING;

            bool retVal = fo.DoOperation();

            Browser.Refresh();

            if (retVal == false)
            {
                throw new Exception("Shell File Operation Failed");
            }
        }
コード例 #49
0
        private static void MigrateSettings()
        {
            try
            {
                // Added this check to prevent an error being logged if there is no previous version
                // of settings to migrate.
                if (Properties.Settings.Default.GetPreviousVersion("FirstRun") != null)
                {
                    Properties.Settings.Default.Upgrade();
                    //Properties.Settings.Default.ebs_DATADUMPConnectionString = (string)
                    //    Properties.Settings.Default.GetPreviousVersion("ebs_DATADUMPConnectionString");
                    //Properties.Settings.Default.EMMA_DatabaseConnectionString = (string)
                    //    Properties.Settings.Default.GetPreviousVersion("EMMA_DatabaseConnectionString");
                    Properties.Settings.Default.FirstRun = (bool)
                        Properties.Settings.Default.GetPreviousVersion("FirstRun");
                    #region Main window settings
                    try
                    {
                        Properties.Settings.Default.WindowState = (System.Windows.Forms.FormWindowState)
                            Properties.Settings.Default.GetPreviousVersion("WindowState");
                    }
                    catch
                    {
                        Properties.Settings.Default.WindowState = System.Windows.Forms.FormWindowState.Maximized;
                    }
                    try
                    {
                        Properties.Settings.Default.WindowPos = (System.Drawing.Point)
                            Properties.Settings.Default.GetPreviousVersion("WindowPos");
                    }
                    catch
                    {
                        Properties.Settings.Default.WindowPos = new System.Drawing.Point(0, 0);
                    }
                    try
                    {
                        Properties.Settings.Default.WindowSize = (System.Drawing.Size)
                            Properties.Settings.Default.GetPreviousVersion("WindowSize");
                    }
                    catch
                    {
                        Properties.Settings.Default.WindowSize = new System.Drawing.Size(800, 600);
                    }
                    #endregion
                    #region Auto update settings
                    try
                    {
                        Properties.Settings.Default.AutoUpdate =
                            (bool)Properties.Settings.Default.GetPreviousVersion("AutoUpdate");
                    }
                    catch
                    {
                        Properties.Settings.Default.AutoUpdate = true;
                    }
                    try
                    {
                        Properties.Settings.Default.BetaUpdates =
                            (bool)Properties.Settings.Default.GetPreviousVersion("BetaUpdates");
                    }
                    catch
                    {
                        Properties.Settings.Default.BetaUpdates = false;
                    }
                    try
                    {
                        Properties.Settings.Default.UpdateServers =
                            (System.Collections.Specialized.StringCollection)
                            Properties.Settings.Default.GetPreviousVersion("UpdateServers");
                    }
                    catch
                    {
                        System.Collections.Specialized.StringCollection defaults =
                            new System.Collections.Specialized.StringCollection();
                        defaults.Add("www.starfreeze.com");
                        defaults.Add("www.eve-files.com");
                        Properties.Settings.Default.UpdateServers = defaults;
                    }
                    try
                    {
                        Properties.Settings.Default.LastEMMAUpdateCheck =
                            (DateTime)Properties.Settings.Default.GetPreviousVersion("LastEMMAUpdateCheck");
                    }
                    catch
                    {
                        Properties.Settings.Default.LastEMMAUpdateCheck = new DateTime(2000, 1, 1);
                    }
                    try
                    {
                        Properties.Settings.Default.DoDocCheck =
                            (bool)Properties.Settings.Default.GetPreviousVersion("DoDocCheck");
                    }
                    catch
                    {
                        Properties.Settings.Default.DoDocCheck = true;
                    }
                    try
                    {
                        Properties.Settings.Default.DocumentationVersion =
                            (int)Properties.Settings.Default.GetPreviousVersion("DocumentationVersion");
                    }
                    catch
                    {
                        Properties.Settings.Default.DocumentationVersion = Globals.CurrentDocVersion - 1;
                    }
                    #endregion
                    #region Connection check settings
                    try
                    {
                        Properties.Settings.Default.SkipConnectionCheck =
                            (bool)Properties.Settings.Default.GetPreviousVersion("SkipConnectionCheck");
                    }
                    catch
                    {
                        Properties.Settings.Default.SkipConnectionCheck = false;
                    }
                    #endregion
                }

                Properties.Settings.Default.Migrated = true;
                Properties.Settings.Default.Save();
            }
            catch (Exception ex)
            {
                new EMMAException(ExceptionSeverity.Error, "Problem migrating settings from previous version", ex);
            }
        }
コード例 #50
0
ファイル: Program.cs プロジェクト: cros107/CrystalBoy
		private static void LoadPluginAssemblies()
		{
			var pluginAssemblies = new System.Collections.Specialized.StringCollection();
			bool updateNeeded = false;

			foreach (string pluginAssembly in Settings.Default.PluginAssemblies)
			{
				try
				{
					var assembly = Assembly.LoadFrom(pluginAssembly);

					FindPlugins(assembly);
					pluginAssemblyList.Add(assembly);

					pluginAssemblies.Add(pluginAssembly);
				}
				catch (FileNotFoundException ex)
				{
					Console.Error.WriteLine(ex);
					MessageBox.Show(string.Format(Resources.Culture, Resources.AssemblyNotFoundErrorMessage, pluginAssembly), Resources.AssemblyLoadErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					updateNeeded = true;
				}
				catch (BadImageFormatException ex)
				{
					Console.Error.WriteLine(ex);
					MessageBox.Show(string.Format(Resources.Culture, Resources.AssemblyArchitectureErrorMessage, pluginAssembly), Resources.AssemblyLoadErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					updateNeeded = true;
				}
				catch (Exception ex)
				{
					Console.Error.WriteLine(ex);
					MessageBox.Show(string.Format(Resources.Culture, Resources.AssemblyLoadErrorMessage, pluginAssembly, ex), Resources.AssemblyLoadErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					updateNeeded = true;
				}
			}

			if (updateNeeded)
			{
				Settings.Default.PluginAssemblies = pluginAssemblies;
				Settings.Default.Save();
			}
		}
コード例 #51
0
ファイル: Util.cs プロジェクト: Erls-Corporation/MPTagThat
        /// <summary>
        ///   Creates a relative path from one file or folder to another.
        /// </summary>
        /// <param name = "fromDirectory">
        ///   Contains the directory that defines the 
        ///   start of the relative path.
        /// </param>
        /// <param name = "toPath">
        ///   Contains the path that defines the
        ///   endpoint of the relative path.
        /// </param>
        /// <returns>
        ///   The relative path from the start
        ///   directory to the end path.
        /// </returns>
        /// <exception cref = "ArgumentNullException"></exception>
        public static string RelativePathTo(string fromDirectory, string toPath)
        {
            if (fromDirectory == null)
            throw new ArgumentNullException("fromDirectory");

              if (toPath == null)
            throw new ArgumentNullException("toPath");

              bool isRooted = Path.IsPathRooted(fromDirectory) && Path.IsPathRooted(toPath);

              if (isRooted)
              {
            bool isDifferentRoot = String.Compare(Path.GetPathRoot(fromDirectory), Path.GetPathRoot(toPath), true) != 0;

            if (isDifferentRoot)
              return toPath;
              }

              StringCollection relativePath = new StringCollection();
              string[] fromDirectories = fromDirectory.Split(Path.DirectorySeparatorChar);

              string[] toDirectories = toPath.Split(Path.DirectorySeparatorChar);

              int length = Math.Min(fromDirectories.Length, toDirectories.Length);

              int lastCommonRoot = -1;

              // find common root
              for (int x = 0; x < length; x++)
              {
            if (String.Compare(fromDirectories[x], toDirectories[x], true) != 0)
              break;

            lastCommonRoot = x;
              }

              if (lastCommonRoot == -1)
            return toPath;

              // add relative folders in from path
              for (int x = lastCommonRoot + 1; x < fromDirectories.Length; x++)
            if (fromDirectories[x].Length > 0)
              relativePath.Add("..");

              // add to folders to path
              for (int x = lastCommonRoot + 1; x < toDirectories.Length; x++)
            relativePath.Add(toDirectories[x]);

              // create relative path
              string[] relativeParts = new string[relativePath.Count];
              relativePath.CopyTo(relativeParts, 0);

              string newPath = String.Join(Path.DirectorySeparatorChar.ToString(), relativeParts);

              return newPath;
        }
コード例 #52
0
        public void SetSort(System.Collections.Specialized.StringCollection Identifiers)
        {
            bool axis0done=false, axis1done=false;
            bool axis0tupleChanged=false, axis1tupleChanged=false;
            System.Collections.Specialized.StringCollection newAxis0SortMems=new System.Collections.Specialized.StringCollection();
            System.Collections.Specialized.StringCollection newAxis1SortMems=new System.Collections.Specialized.StringCollection();

            // remove all sorts if no members selected
            if(Identifiers.Count==0)
            {
                _report.Axes[0].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.NONE;
                _report.Axes[1].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.NONE;
                return;
            }

            for(int i=0;i<Identifiers.Count;i++)
            {
                short axisOrdinal=-1;
                int pos=-1;
                int mpos=-1;
                this.CellsetPositionFromIdentifier(Identifiers[i] , ref axisOrdinal , ref pos, ref mpos);

                //assign order from all members of selected tuple
                if(axisOrdinal==0)
                {
                    if(axis0done)
                        continue; //cannot have multiple tuples in order

                    for(int j=0;j<_report.Cellset.Axis0TupleMemCount;j++)
                        newAxis0SortMems.Add(_report.Cellset.GetCellsetMember(0 , j , pos).UniqueName);

                    axis0done=true;
                }
                else
                {
                    if(axis1done)
                        continue; //cannot have multiple tuples in order

                    for(int j=0;j<_report.Cellset.Axis1TupleMemCount;j++)
                        newAxis1SortMems.Add(_report.Cellset.GetCellsetMember(1 , j , pos).UniqueName);

                    axis1done=true;
                }
            }

            // axis 0
            if(axis0done)
            {
                for(int j=0;j<_report.Axes[0].Hierarchies.Count;j++)
                {
                    Hierarchy hier=_report.Axes[0].Hierarchies[j];
                    string sortUN=newAxis0SortMems[j];
                    if(hier.OrderTupleMember!=sortUN)
                    {
                        hier.OrderTupleMember=sortUN;
                        axis0tupleChanged=true;
                    }
                }
                if(axis0tupleChanged)
                    _report.Axes[0].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.BDESC;
                else if(_report.Axes[0].Order==FI.BusinessObjects.Olap.Axis.OrderEnum.NONE)
                    _report.Axes[0].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.BDESC;
                else if(_report.Axes[0].Order==FI.BusinessObjects.Olap.Axis.OrderEnum.BASC)
                    _report.Axes[0].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.BDESC;
                else if(_report.Axes[0].Order==FI.BusinessObjects.Olap.Axis.OrderEnum.BDESC)
                    _report.Axes[0].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.BASC;
            }

            // axis 1
            if(axis1done)
            {
                for(int j=0;j<_report.Axes[1].Hierarchies.Count;j++)
                {
                    Hierarchy hier=_report.Axes[1].Hierarchies[j];
                    string sortUN=newAxis1SortMems[j];
                    if(hier.OrderTupleMember!=sortUN)
                    {
                        hier.OrderTupleMember=sortUN;
                        axis1tupleChanged=true;
                    }
                }
                if(axis1tupleChanged)
                    _report.Axes[1].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.BDESC;
                else if(_report.Axes[1].Order==FI.BusinessObjects.Olap.Axis.OrderEnum.NONE)
                    _report.Axes[1].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.BDESC;
                else if(_report.Axes[1].Order==FI.BusinessObjects.Olap.Axis.OrderEnum.BASC)
                    _report.Axes[1].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.BDESC;
                else if(_report.Axes[1].Order==FI.BusinessObjects.Olap.Axis.OrderEnum.BDESC)
                    _report.Axes[1].Order=FI.BusinessObjects.Olap.Axis.OrderEnum.BASC;
            }
        }
コード例 #53
0
ファイル: Form1.cs プロジェクト: cugni/pds
        private void ReceiveClip()
        {
            String text;
            System.Collections.Specialized.StringCollection paths = new System.Collections.Specialized.StringCollection();
            NetworkStream netstream = tcpClip.GetStream();
            int j;
            bool abort = false;

            while (Connected==true)
            {
                try
                {
                    string what = str.ReadLine();

                    if (MessageBox.Show("E' stata condivisa una clipboard.\n Accettarla, sovrascrivendo la clipboard attuale?", "Clipboard condivisa", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (what.Substring(0, 4).Equals("File"))
                        {
                            string Reason = "Ricevendo Clipboard...";
                            this.Invoke(new DisableClipboardCallback(this.DisableClipboard), new object[] { Reason });
                            paths.Clear();
                            string qta = what.Substring(4, 1);
                            for (j = 0; j < int.Parse(qta); j++)
                            {
                                string tmp = str.ReadLine();
                                if (tmp.Equals("Abort"))
                                {
                                    abort = true;
                                    break;
                                }
                                abort = false;
                                string fileName = tmp.Substring(6);
                                byte[] clientData = Convert.FromBase64String(str.ReadLine());
                                BinaryWriter bWrite = new BinaryWriter(File.Open(Path.GetFullPath(@".\File ricevuti\") + fileName, FileMode.Create));
                                bWrite.Write(clientData, 4 + fileName.Length, clientData.Length - 4 - fileName.Length);
                                bWrite.Close();
                                paths.Add(Path.GetFullPath(@".\File ricevuti\") + fileName);
                                //SetClipboard(fileName);
                            }
                            Reason = "Condividi Clipboard";
                            this.Invoke(new DisableClipboardCallback(this.EnableClipboard), new object[] { Reason });
                            if (abort == false)
                                this.Invoke(new UpdateClipboardCallback(UpdateClipboard), new object[] { paths });
                        }

                        else if (what.Substring(0, 4).Equals("Text")) // text
                        {
                            string Reason = "Ricevendo Clipboard...";
                            this.Invoke(new DisableClipboardCallback(this.DisableClipboard), new object[] { Reason });
                            byte[] bytes = new byte[tcpClip.ReceiveBufferSize];

                            // Read can return anything from 0 to numBytesToRead.
                            // This method blocks until at least one byte is read.
                            netstream.Read(bytes, 0, (int)tcpClip.ReceiveBufferSize);
                            string textcrc = Encoding.ASCII.GetString(bytes);
                            text = TrimFromZero(textcrc);
                            IDataObject ido = new DataObject();
                            ido.SetData(text);
                            Clipboard.SetDataObject(ido, true);
                            Reason = "Condividi Clipboard";
                            this.Invoke(new DisableClipboardCallback(this.EnableClipboard), new object[] { Reason });
                            //MessageBox.Show(text);
                        }

                        else if (what.Substring(0, 4).Equals("Imag")) // bitmap
                        {
                            string Reason = "Ricevendo Clipboard...";
                            this.Invoke(new DisableClipboardCallback(this.DisableClipboard), new object[] { Reason });
                            Stream stm = tcpClip.GetStream();
                            IFormatter formatter = new BinaryFormatter();
                            Bitmap bitm = (Bitmap)formatter.Deserialize(stm);
                            Clipboard.SetImage(bitm);
                            Reason = "Condividi Clipboard";
                            this.Invoke(new DisableClipboardCallback(this.EnableClipboard), new object[] { Reason });
                        }

                    }
                }

                catch (Exception e)
                {
                    //MessageBox.Show(e.ToString());
                    break;
                }
            }
        }
コード例 #54
0
ファイル: BaseEngine.cs プロジェクト: blmarket/filehatchery
        private void SetDropFileList(bool cut)
        {
            try
            {
                System.Collections.Specialized.StringCollection files = new System.Collections.Specialized.StringCollection();

                IEnumerable<IBrowserItem> itemset = Browser.CurSelItems;

                foreach (IBrowserItem item in itemset)
                {
                    files.Add(item.FullPath);
                }

                DataObject data = new DataObject();

                data.SetFileDropList(files);

                MemoryStream stream = new MemoryStream();
                BinaryWriter writer = new BinaryWriter(stream);
                if (cut)
                {
                    writer.Write((int)DragDropEffects.Move);
                }
                else
                {
                    writer.Write((int)DragDropEffects.Copy);
                }
                data.SetData("Preferred DropEffect", stream);

                Clipboard.Clear();
                Clipboard.SetDataObject(data);
            }
            catch (Exception EE)
            {
                MessageBox.Show(EE.Message);
            }
        }
コード例 #55
0
ファイル: SharedgeForm.cs プロジェクト: qbolec/Sharedge
 void OnDragFile(string filename)
 {
     var dataObject = new DataObject();
       var path = Path.Combine(TheState.TransferCenter.IncomingDirectory, filename);
       var filePaths = new System.Collections.Specialized.StringCollection();
       filePaths.Add(path);
       dataObject.SetFileDropList(filePaths);
       this.DoDragDrop(dataObject, DragDropEffects.Move | DragDropEffects.Copy);
 }
コード例 #56
0
        /// <summary>
        /// Updates any locators in the specified File Geodatabase that use the specified Feature Class as Primary Reference Table.  Any Alternate Names Tables that exist for the
        /// specified Feature Class will be copied from the specified Enterprise Geodatabase (InputWorkspace) to the File Geodatabase.
        /// </summary>
        /// <param name="OutputFileGeodatabasePathName">
        /// The Full Path to the Output File Geodatabase that contains the Locators that are to be rebuilt.
        /// </param>
        /// <param name="FeatureClassName">
        /// The Name of the Feature Class that has been updated in the Output File Geodatabase.
        /// </param>
        /// <param name="InputWorkspace">
        /// An ESRI ArcGIS Workspace Object that points to the Enterprise Geodatabase that is being used as the source for updating the Output File Geodatabase datasets.
        /// </param>
        /// <param name="InputWorkspaceDBSchemaOwnerName">
        /// The Name of the Schema Owner in the source Enterprise Geodatabase.
        /// </param>
        /// <returns>
        /// TRUE if all locators in which the udpated feature class participates have been rebuilt successfully.
        /// FALSE if the locators were not successfully rebuilt.
        /// </returns>
        public bool UpdateFileGeodatabaseLocators(string OutputFileGeodatabasePathName, string FeatureClassName, ESRI.ArcGIS.Geodatabase.IWorkspace InputWorkspace, string InputWorkspaceDBSchemaOwnerName)
        {
            ESRI.ArcGIS.Geodatabase.IWorkspace              geodatabaseWorkspace         = null;
              ESRI.ArcGIS.Location.ILocatorManager            locatorManager               = null;
              ESRI.ArcGIS.Geodatabase.ILocatorWorkspace2      locatorWorkspace             = null;
              ESRI.ArcGIS.Geodatabase.IEnumLocatorName        locatorNamesEnum             = null;
              System.Collections.Specialized.StringCollection copiedReferenceTables        = null;
              ESRI.ArcGIS.Geodatabase.ILocatorName            currentLocatorName           = null;
              ESRI.ArcGIS.Geodatabase.ILocator                currentLocator               = null;
              ESRI.ArcGIS.Location.IReferenceDataTables       locatorReferenceTables       = null;
              ESRI.ArcGIS.Location.IEnumReferenceDataTable    locatorReferenceTablesEnum   = null;
              ESRI.ArcGIS.Location.IReferenceDataTable2       currentLocatorReferenceTable = null;
              ESRI.ArcGIS.Geodatabase.IFeatureWorkspace       geodatabaseFeatureWorkspace  = null;
              ESRI.ArcGIS.Geodatabase.ITable                  deleteTable                  = null;
              ESRI.ArcGIS.Geodatabase.IDataset                deleteDataset                = null;
              ESRI.ArcGIS.Geodatabase.IFeatureWorkspace       inputFeatureWorkspace        = null;
              ESRI.ArcGIS.Geodatabase.ITable                  inputAlternateNameTable      = null;
              ESRI.ArcGIS.Geodatabase.IDataset                inputTableDataset            = null;
              ESRI.ArcGIS.Geodatabase.IWorkspaceFactory       inputWorkspaceFactory        = null;
              ESRI.ArcGIS.Geoprocessing.GeoProcessor          geoProcessorObject           = null;
              ESRI.ArcGIS.esriSystem.IVariantArray            tableToTableParams           = null;
              ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult   geoprocessorResult           = null;
              ESRI.ArcGIS.Geoprocessing.GeoProcessor          rebuildGeoprocessorObject    = null;
              ESRI.ArcGIS.esriSystem.IVariantArray            rebuildLocatorParams         = null;
              ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult   rebuildGeoprocessorResult    = null;

              try
              {
            //  Let the user know what is happening.
            if (ProcessMessage != null)
            {
              ProcessMessage("       - Initializing the process to rebuild any locators and determining if the specified Feature Class is a reference dataset for any locators in the File Geodatabase...");
            }

            //  Open the Locator Workspace.
            geodatabaseWorkspace = EstablishFileGeodatabaseConnection(OutputFileGeodatabasePathName);
            //  Make sure the Output File Geodatabase Workspace Connection was established successfully before moving on.
            if (geodatabaseWorkspace == null)
            {
              //  Let the user know that the connection could not be established.
              if (ErrorMessage != null)
              {
            ErrorMessage("Failed to open the Output File Geodatabase Workspace - " + OutputFileGeodatabasePathName + ".  Aborting the Locator Rebuild!");
              }
              //  Return FALSE to the calling method to indicate that this method failed.
              return false;
            }
            locatorManager = new ESRI.ArcGIS.Location.LocatorManagerClass();
            locatorWorkspace = (ESRI.ArcGIS.Geodatabase.ILocatorWorkspace2)locatorManager.GetLocatorWorkspace(geodatabaseWorkspace);

            //  Get the list of Address Locator Names from the File Geodatabase.
            locatorNamesEnum = locatorWorkspace.get_LocatorNames(ESRI.ArcGIS.Geodatabase.esriLocatorQuery.esriLocator, "Address");

            //  Create a List of Reference Tables that are copied by this process so that they will not be copied multiple times if it is used by multiple locators.
            copiedReferenceTables = new System.Collections.Specialized.StringCollection();

            //  Go through the list of associated locators and rebuild them.
            currentLocatorName = locatorNamesEnum.Next();
            while (currentLocatorName != null)
            {
              //  If there is a valid Locator Name, rebuild the locator.
              if (currentLocatorName.Name.Length > 1)
              {
            //  Let the User know that the locator is being rebuilt.
            if (ProcessMessage != null)
            {
              ProcessMessage("          + Determining if the " + FeatureClassName + " Feature Class participates in the " + currentLocatorName.Name.ToString() + " Locator...");
            }
            //  Open the Current Locator.
            currentLocator = locatorWorkspace.GetLocator(currentLocatorName.Name);

            //  If the Current Locator is a composite Locator, skip it.
            if (!(currentLocator is ESRI.ArcGIS.Location.ICompositeLocator))
            {
              //  Determine if the specified Feature Class is a reference Dataset for the locator.
              locatorReferenceTables = (ESRI.ArcGIS.Location.IReferenceDataTables)currentLocator;
              locatorReferenceTablesEnum = locatorReferenceTables.Tables;
              locatorReferenceTablesEnum.Reset();
              //  Retrieve the First Table from the Locator.
              currentLocatorReferenceTable = (ESRI.ArcGIS.Location.IReferenceDataTable2)locatorReferenceTablesEnum.Next();
              //  Default the Found the Locator Indicator to FALSE.
              bool foundIt = false;
              //  If the Updated Feature Class is the Primary Table for this locator, the locator needs to be rebuilt so default the 'FoundIt' indicator to true.
              while (currentLocatorReferenceTable != null)
              {
                //  Determine if the current table is the specified Feature Class Business Table.
                if (currentLocatorReferenceTable.DisplayName.ToUpper() == "PRIMARY TABLE")
                {
                  ESRI.ArcGIS.Geodatabase.IDatasetName currentFeatureClassName = null;
                  currentFeatureClassName = (ESRI.ArcGIS.Geodatabase.IDatasetName)currentLocatorReferenceTable.Name;
                  if (currentFeatureClassName.Name.ToString().ToUpper() == FeatureClassName.ToUpper())
                  {
                    //  Set the found the locator indicator to TRUE.
                    foundIt = true;
                  }
                }
                //  Retrieve the Next Table from the Locator.
                currentLocatorReferenceTable = (ESRI.ArcGIS.Location.IReferenceDataTable2)locatorReferenceTablesEnum.Next();
              }
              //  If the specified Feature Class does participate in the current Locator, rebuild the Locator.
              if (foundIt)
              {
                //  Let the User know that the locator is being rebuilt.
                if (ProcessMessage != null)
                {
                  ProcessMessage("          + Starting the rebuild of the " + currentLocatorName.Name.ToString() + " Locator...");
                }
                //  Reset the Locator Reference Tables enumerator.
                locatorReferenceTablesEnum.Reset();
                //  Retrieve the First Table from the Locator.
                currentLocatorReferenceTable = (ESRI.ArcGIS.Location.IReferenceDataTable2)locatorReferenceTablesEnum.Next();
                //  Go through the Locator Reference Tables and rebuild any Alternate Name Tables that are associated with the locator.
                while (currentLocatorReferenceTable != null)
                {
                  if (currentLocatorReferenceTable.DisplayName.ToUpper() == "ALTERNATE NAME TABLE")
                  {
                    ESRI.ArcGIS.Geodatabase.IDatasetName currentTableName = null;
                    currentTableName = (ESRI.ArcGIS.Geodatabase.IDatasetName)currentLocatorReferenceTable.Name;
                    //  Alternate Name Tables have the string "_ALT" inserted in the name before the "_PDX" so, remove the "_PDX" from the Feature Class Name so that it can be
                    //  found in the Alternate Table Name.
                    string searchName = FeatureClassName;
                    if (searchName.Substring(searchName.Length - 3).ToUpper() == "PDX")
                    {
                      searchName = searchName.Substring(0, searchName.Length - 4);
                    }
                    //  If the current Alternate Name Table is associated with this locator, delete it and  copy the most current version from the source Geodatabase.
                    if (currentTableName.Name.ToString().ToUpper().IndexOf(searchName.ToUpper()) != -1)
                    {
                      //  If the Table Name includes some prefix information (Database Name and Table Owner Name), drop it for attempting to find the table in the search Geodatabase.
                      string tableSearchName = currentTableName.Name.ToString();
                      if (tableSearchName.ToUpper().IndexOf(searchName.ToUpper()) > 0)
                      {
                        //  Drop the prefix from the Table Name.
                        tableSearchName = tableSearchName.Substring(tableSearchName.IndexOf(searchName.ToUpper()));
                      }
                      //  If the Table has not already been updated by this process, update it.
                      if (!copiedReferenceTables.Contains(tableSearchName))
                      {
                        //  Let the user know which locator is being rebuilt.
                        if (ProcessMessage != null)
                        {
                          ProcessMessage("             < Deleting the - " + tableSearchName + " Alternate Name Table for the " + currentLocatorName.Name + " locator...");
                        }
                        geodatabaseFeatureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)geodatabaseWorkspace;
                        deleteTable = geodatabaseFeatureWorkspace.OpenTable(currentTableName.Name.ToString());
                        deleteDataset = (ESRI.ArcGIS.Geodatabase.IDataset)deleteTable;
                        deleteDataset.Delete();
                        //  Release the Delete Objects to remove locks on the reference table.
                        if (deleteDataset != null)
                        {
                          System.Runtime.InteropServices.Marshal.ReleaseComObject(deleteDataset);
                        }
                        if (deleteTable != null)
                        {
                          System.Runtime.InteropServices.Marshal.ReleaseComObject(deleteTable);
                        }
                        //  Attempt to open the Source Table in the Input Geodatabase.
                        inputFeatureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)InputWorkspace;

                        inputAlternateNameTable = (ESRI.ArcGIS.Geodatabase.ITable)inputFeatureWorkspace.OpenTable(InputWorkspaceDBSchemaOwnerName + "." + tableSearchName);
                        inputTableDataset = (ESRI.ArcGIS.Geodatabase.IDataset)inputAlternateNameTable;
                        //  If the Table was opened successfully, Attempt to Copy it to the File Geodatabase.
                        string temporaryDirectory = null;
                        if (inputAlternateNameTable != null)
                        {
                          //  Determine in which directory the Temporary SDE Connection File should
                          //  be created.
                          if (System.IO.Directory.Exists(@"D:\Temp"))
                          {
                            //  Set the Temporary Directory to 'D:\TEMP\'.
                            temporaryDirectory = @"D:\Temp\";
                          }
                          else
                          {
                            //  Check to see if there is a 'C:\TEMP' Directory.
                            if (System.IO.Directory.Exists(@"C:\Temp"))
                            {
                              //  Set the Temporary Directory to 'C:\Temp\'
                              temporaryDirectory = @"C:\Temp\";
                            }
                            else
                            {
                              //  Set the Temporary Directory to 'C:\'.
                              temporaryDirectory = @"C:\";
                            }
                          }
                          //  Create a Connection File for the Input Enterprise Geodatabase Connection.
                          inputWorkspaceFactory = InputWorkspace.WorkspaceFactory;
                          inputWorkspaceFactory.Create(temporaryDirectory, "inputConnection.sde", InputWorkspace.ConnectionProperties, 0);
                          string connectionFile = temporaryDirectory + "\\inputConnection.sde";
                          //  Let the user know which locator is being rebuilt.
                          if (ProcessMessage != null)
                          {
                            ProcessMessage("             < Copying the - " + tableSearchName + " Alternate Name Table for the " + currentLocatorName.Name + " locator from the Source Geodatabase...");
                          }
                          //  Establish a Table Copy Geoprocessing Object to Copy the Enterprise
                          //  Enterprise Geodatabase Alternate Name Table to the File Geodatabase.
                          geoProcessorObject = new ESRI.ArcGIS.Geoprocessing.GeoProcessor();
                          tableToTableParams = new ESRI.ArcGIS.esriSystem.VarArray();
                          tableToTableParams.Add(connectionFile + @"\" + inputTableDataset.Name);
                          tableToTableParams.Add(OutputFileGeodatabasePathName);
                          tableToTableParams.Add(tableSearchName);
                          //  Copy the Enterprise Geodatabase Alternate Name table to the File
                          //  Geodatabase.
                          geoprocessorResult = (ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult)geoProcessorObject.Execute("TableToTable_conversion", tableToTableParams, null);
                          //  Delete the Connection File since it is no longer needed.
                          if (System.IO.File.Exists(temporaryDirectory + "\\inputConnection.sde"))
                          {
                            //  Delete the file.
                            System.IO.File.Delete(temporaryDirectory + "\\inputConnection.sde");
                          }
                          if (geoProcessorObject != null)
                          {
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(geoProcessorObject);
                          }
                          if (tableToTableParams != null)
                          {
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(tableToTableParams);
                          }
                          if (geoprocessorResult != null)
                          {
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(geoprocessorResult);
                          }
                          //  Add the current table to the list of Tables that have been copied.
                          copiedReferenceTables.Add(tableSearchName);
                        }
                      }
                    }
                  }
                  //  Get the next Reference Table from the enumerator.
                  currentLocatorReferenceTable = (ESRI.ArcGIS.Location.IReferenceDataTable2)locatorReferenceTablesEnum.Next();
                }
                //  Let the user know which locator is being rebuilt.
                if (ProcessMessage != null)
                {
                  ProcessMessage("             < Rebuilding the - " + currentLocatorName.Name + " locator...");
                }
                //  Build the Parameter Set necessary to Rebuild the Locator.
                rebuildLocatorParams = new ESRI.ArcGIS.esriSystem.VarArray();
                rebuildLocatorParams.Add(OutputFileGeodatabasePathName + "\\" + currentLocatorName.Name);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(currentLocatorName);
                if (currentLocatorReferenceTable != null)
                {
                  System.Runtime.InteropServices.Marshal.ReleaseComObject(currentLocatorReferenceTable);
                }
                if (currentLocator != null)
                {
                  System.Runtime.InteropServices.Marshal.ReleaseComObject(currentLocator);
                }
                //  Attempt to rebuild the Locator.
                rebuildGeoprocessorObject = new ESRI.ArcGIS.Geoprocessing.GeoProcessor();
                rebuildGeoprocessorResult = (ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult)rebuildGeoprocessorObject.Execute("RebuildAddressLocator_geocoding", rebuildLocatorParams, null);
                //  Present the results of the process to the user.
                if (rebuildGeoprocessorResult.Status == ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded)
                {
                  //  Let the user know that the Locator was rebuilt successfully.
                  if (ProcessMessage != null)
                  {
                    ProcessMessage("               + Successfully rebuilt the - " + currentLocatorName.Name + " locator...");
                    if (rebuildGeoprocessorObject.MessageCount > 0)
                    {
                      ProcessMessage("               + The messages from the process were -");
                      for (int i = 0; i <= rebuildGeoprocessorObject.MessageCount - 1; i++)
                      {
                        ProcessMessage("                  - " + rebuildGeoprocessorObject.GetMessage(i));
                      }
                    }
                  }
                }
                else
                {
                  //  Let the user know that the Locator Failed to Rebuild.
                  if (ProcessMessage != null)
                  {
                    ProcessMessage("");
                    ProcessMessage("FAILED to rebuild the - " + currentLocatorName.Name + " locator...");
                    if (rebuildGeoprocessorObject.MessageCount > 0)
                    {
                      ProcessMessage("   + The messages from the process were -");
                      for (int i = 0; i <= rebuildGeoprocessorObject.MessageCount - 1; i++)
                      {
                        ProcessMessage("      - " + rebuildGeoprocessorObject.GetMessage(i));
                      }
                    }
                  }
                  //  Return FALSE to the calling method to indicate that this process failed.
                  return false;
                }
              }
            }
            else
            {
              //  Retrieve the list of locators that exist in the Composite Locator.
              ESRI.ArcGIS.Location.ICompositeLocator currentCompositeLocator = (ESRI.ArcGIS.Location.ICompositeLocator)currentLocator;
              string[] locatorNames = currentCompositeLocator.LocatorNames as string[];
              ESRI.ArcGIS.Geodatabase.ILocator[] locators = new ESRI.ArcGIS.Geodatabase.ILocator[locatorNames.Length];
              int i = 0;
              foreach (string currentSubLocatorName in locatorNames)
              {
                locators[i] = currentCompositeLocator.get_Locator(currentSubLocatorName);
                i++;
              }
              //  Determine if the Updated Feature Class participates in any of the locators in the Composite Locator.
              bool foundIt = false;
              foreach (ESRI.ArcGIS.Geodatabase.ILocator currentSubLocator in locators)
              {
                //  If the Current Locator is a Composite Locator, ignore it.
                if (!(currentSubLocator is ESRI.ArcGIS.Location.ICompositeLocator))
                {
                  //  Determine if the specified Feature Class is a reference Dataset for the locator.
                  locatorReferenceTables = (ESRI.ArcGIS.Location.IReferenceDataTables)currentSubLocator;
                  locatorReferenceTablesEnum = locatorReferenceTables.Tables;
                  locatorReferenceTablesEnum.Reset();
                  //  Retrieve the First Table from the Locator.
                  currentLocatorReferenceTable = (ESRI.ArcGIS.Location.IReferenceDataTable2)locatorReferenceTablesEnum.Next();
                  //  Go through the Primary Tables participating in the Locator and determine if the Updated Feature Class Table is one of them.
                  while ((currentLocatorReferenceTable != null) && (!foundIt))
                  {
                    //  Determine if the current table is the specified Feature Class Business Table.
                    if (currentLocatorReferenceTable.DisplayName.ToUpper() == "PRIMARY TABLE")
                    {
                      ESRI.ArcGIS.Geodatabase.IDatasetName currentFeatureClassName = null;
                      currentFeatureClassName = (ESRI.ArcGIS.Geodatabase.IDatasetName)currentLocatorReferenceTable.Name;
                      if (currentFeatureClassName.Name.ToString().ToUpper() == FeatureClassName.ToUpper())
                      {
                        //  Set the found the locator indicator to TRUE.
                        foundIt = true;
                      }
                    }
                    //  Retrieve the Next Table from the Locator.
                    currentLocatorReferenceTable = (ESRI.ArcGIS.Location.IReferenceDataTable2)locatorReferenceTablesEnum.Next();
                  }
                }
              }
              //  If the Updated Feature Class is a member of the Composite Locator, rebuild it.
              if (foundIt)
              {
                //  Let the user know which locator is being rebuilt.
                if (ProcessMessage != null)
                {
                  ProcessMessage("             < Rebuilding the - " + currentLocatorName.Name + " locator...");
                }
                //  Build the Parameter Set necessary to Rebuild the Locator.
                rebuildLocatorParams = new ESRI.ArcGIS.esriSystem.VarArray();
                rebuildLocatorParams.Add(OutputFileGeodatabasePathName + "\\" + currentLocatorName.Name);
                //  Attempt to rebuild the Locator.
                rebuildGeoprocessorObject = new ESRI.ArcGIS.Geoprocessing.GeoProcessor();
                rebuildGeoprocessorResult = (ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult)rebuildGeoprocessorObject.Execute("RebuildAddressLocator_geocoding", rebuildLocatorParams, null);
                //  Present the results of the process to the user.
                if (rebuildGeoprocessorResult.Status == ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded)
                {
                  //  Let the user know that the Locator was rebuilt successfully.
                  if (ProcessMessage != null)
                  {
                    ProcessMessage("               + Successfully rebuilt the - " + currentLocatorName.Name + " locator...");
                    if (rebuildGeoprocessorObject.MessageCount > 0)
                    {
                      ProcessMessage("               + The messages from the process were -");
                      for (int y = 0; y <= rebuildGeoprocessorObject.MessageCount - 1; y++)
                      {
                        ProcessMessage("                  - " + rebuildGeoprocessorObject.GetMessage(y));
                      }
                    }
                  }
                }
                else
                {
                  //  Let the user know that the Locator Failed to Rebuild.
                  if (ProcessMessage != null)
                  {
                    ProcessMessage("");
                    ProcessMessage("FAILED to rebuild the - " + currentLocatorName.Name + " locator...");
                    if (rebuildGeoprocessorObject.MessageCount > 0)
                    {
                      ProcessMessage("   + The messages from the process were -");
                      for (int y = 0; y <= rebuildGeoprocessorObject.MessageCount - 1; y++)
                      {
                        ProcessMessage("      - " + rebuildGeoprocessorObject.GetMessage(y));
                      }
                    }
                  }
                  //  Return FALSE to the calling method to indicate that this process failed.
                  return false;
                }
              }
            }

              }

              //  Retrieve the next Locator Name Object from the Locator Names Enumerator.
              currentLocatorName = locatorNamesEnum.Next();

            }

            //  If the process made it to here, it was successful so return TRUE to the calling routine.
            return true;

              }
              catch (System.Runtime.InteropServices.COMException comCaught)
              {
            //  Determine the Line Number from which the exception was thrown.
            System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(comCaught, true);
            System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount - 1);
            int lineNumber = stackFrame.GetFileLineNumber();

            //  Let the User know that this process failed.
            if (ErrorMessage != null)
            {
              ErrorMessage("The FeatureClassUtilities.UpdateFileGeodatabaseLocators() Method failed with error message:  " + comCaught.Message + "(" + comCaught.ErrorCode + " Line:  " + lineNumber.ToString() + ")!");
            }

            //  Return FALSE to the calling routine to indicate that this process failed.
            return false;

              }
              catch (System.Exception caught)
              {
            //  Determine the Line Number from which the exception was thrown.
            System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace(caught, true);
            System.Diagnostics.StackFrame stackFrame = stackTrace.GetFrame(stackTrace.FrameCount - 1);
            int lineNumber = stackFrame.GetFileLineNumber();

            //  Let the User know that this process failed.
            if (ErrorMessage != null)
            {
              ErrorMessage("The FeatureClassUtilities.UpdateFileGeodatabaseLocators() Method failed with error message:  " + caught.Message + " (Line:  " + lineNumber.ToString() + ")!");
            }

            //  Return FALSE to the calling routine to indicate that this process failed.
            return false;

              }
              finally
              {
            //  If the Geoprocessor Result Object was instantiated, close it.
            if (geoprocessorResult != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(geoprocessorResult);
            }
            //  If the Table to Table Variant Array was instantiated, close it.
            if (tableToTableParams != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(tableToTableParams);
            }
            //  If the Geoprocessor Object was instantiated, close it.
            if (geoProcessorObject != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(geoProcessorObject);
            }
            //  If the InputWorkspace Factory Object was instantiated, close it.
            if (inputWorkspaceFactory != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(inputWorkspaceFactory);
            }
            //  If the Input Table Dataset Object was instantiated, close it.
            if (inputTableDataset != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(inputTableDataset);
            }
            //  If the Input Alternate Name Table Object was instantiated, close it.
            if (inputAlternateNameTable != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(inputAlternateNameTable);
            }
            //  If the Input Feature Workspace Object was instantiated, close it.
            if (inputFeatureWorkspace != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(inputFeatureWorkspace);
            }
            //  If the Delete Dataset Object was instantiated, close it.
            if (deleteDataset != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(deleteDataset);
            }
            //  If the Delete Table Object was instantiated, close it.
            if (deleteTable != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(deleteTable);
            }
            //  If the Geodatabase Feature Workspace Object was instantiated, close it.
            if (geodatabaseFeatureWorkspace != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(geodatabaseFeatureWorkspace);
            }
            //  If the Current Locator Reference Table Object was instantiated, close it.
            if (currentLocatorReferenceTable != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(currentLocatorReferenceTable);
            }
            //  If the Locator Reference Tables Enumerator was instantiated, close it.
            if (locatorReferenceTablesEnum != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(locatorReferenceTablesEnum);
            }
            //  If the Locator Reference Tables Object was instantiated, close it.
            if (locatorReferenceTables != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(locatorReferenceTables);
            }
            //  If the Current Locator Object was instantiated, close it.
            if (currentLocator != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(currentLocator);
            }
            //  If the Current Locator Name Object was instantiated, close it.
            if (currentLocatorName != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(currentLocatorName);
            }
            //  If the Locatore Names Enumerator Object was instantiated, close it.
            if (locatorNamesEnum != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(locatorNamesEnum);
            }
            //  If the Locator Workspace Object was instantiated, close it.
            if (locatorWorkspace != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(locatorWorkspace);
            }
            //  If the Locator Manager Object was instantiated, close it.
            if (locatorManager != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(locatorManager);
            }
            //  If the Geodatabase Workspace Object was instantiated, close it.
            if (geodatabaseWorkspace != null)
            {
              System.Runtime.InteropServices.Marshal.ReleaseComObject(geodatabaseWorkspace);
            }

              }
        }
コード例 #57
0
        void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (!IsMouseCaptured)
            {
                dragStart = e.GetPosition(this);
                ShellObjectCollection collection = new ShellObjectCollection();
                System.Collections.IList list =
                    (DropDataList.SelectedItems.Count > 0) ?
                        DropDataList.SelectedItems : DropDataList.Items;

                foreach (ShellObject shellObject in list)
                {
                    collection.Add(shellObject);
                }

                if (collection.Count > 0)
                {
                    // This builds a DataObject from a "Shell IDList Array" formatted memory stream.
                    // This allows drag/clipboard operations with non-file based ShellObjects (i.e., 
                    // control panel, libraries, search query results)
                    dataObject = new DataObject(
                        "Shell IDList Array",
                        collection.BuildShellIDList());

                    // Also build a file drop list
                    System.Collections.Specialized.StringCollection paths = new System.Collections.Specialized.StringCollection();
                    foreach (ShellObject shellObject in collection)
                    {
                        if (shellObject.IsFileSystemObject)
                        {
                            paths.Add(shellObject.ParsingName);
                        }
                    }
                    if (paths.Count > 0)
                        dataObject.SetFileDropList(paths);
                }
            }
        }
コード例 #58
0
        public void Remove(System.Collections.Specialized.StringCollection Identifiers)
        {
            ArrayList memList=new ArrayList();

            for(int i=0;i<Identifiers.Count;i++)
            {
                short axisOrdinal=-1;
                int pos=-1;
                int mpos=-1;
                this.CellsetPositionFromIdentifier(Identifiers[i] , ref axisOrdinal , ref pos, ref mpos);

                CellsetMember cstMem=_report.Cellset.GetCellsetMember( (byte)axisOrdinal  , mpos, pos);
                memList.Add(cstMem);
            }

            // remove members
            System.Collections.Specialized.StringCollection parentList=new System.Collections.Specialized.StringCollection();
            for(int i=0;i<memList.Count;i++)
            {
                CellsetMember cstMem=(CellsetMember)memList[i];
                Hierarchy hier=_report.Schema.GetHierarchyFromMemberUniqueName(cstMem.UniqueName);

                // get member, remove if exisits
                DataMember dmem=(DataMember)hier.GetMember(cstMem.UniqueName);
                if(dmem!=null)
                {
                    dmem.Hierarchy.RemoveMember(dmem);
                    continue;
                }

                // if not found by unique name, check if member was part of MemberChildrenSet (autoselect),
                // in this case we convert it to not-autoselect
                if(cstMem.LevelDepth==0)
                    continue;
                SchemaMember parentMem=_report.Schema.GetMemberParent(hier, cstMem.UniqueName);
                if(parentMem!=null)
                {
                    if(parentList.Contains(parentMem.UniqueName))
                        continue; // parent already handled

                    parentList.Add(parentMem.UniqueName);
                    MemberChildrenSet mcs=hier.CalculatedMembers.GetMemberChildrenSet(parentMem.UniqueName);
                    if(mcs!=null)
                    {
                        // add children
                        hier.RemoveMember(mcs);
                        hier.AddMemberChildren(parentMem.UniqueName, false);
                    }
                }
            }

            // finally remove members
            for(int i=0;i<memList.Count;i++)
            {
                CellsetMember cstMem=(CellsetMember)memList[i];
                Hierarchy hier=_report.Schema.GetHierarchyFromMemberUniqueName(cstMem.UniqueName);

                hier.DataMembers.Remove(cstMem.UniqueName);
            }
        }
コード例 #59
0
        protected ArrayList GetUniqueTransitionEvents(bool qualifiedEvent)
        {
            Hashtable uniqueEventNames = new Hashtable ();
            ArrayList list = new ArrayList ();
            foreach (ITransitionGlyph trans in _Transitions)
            {
                System.Collections.Specialized.StringCollection eventNames = new System.Collections.Specialized.StringCollection ();

                string eventNameOnly = null;
                if (qualifiedEvent)
                {
                    eventNameOnly = trans.QualifiedEvent;
                }
                else
                {
                    eventNameOnly = trans.EventSignal;
                }

                eventNames.Add (eventNameOnly);

                if (IsNotEmptyString (trans.Action))
                {
                    string[] signals = ParseActionForSignals (trans.Action);
                    eventNames.AddRange (signals);
                }

                foreach (string eventName in eventNames)
                {
                    if (!uniqueEventNames.Contains (eventName))
                    {
                        list.Add (eventName);
                        uniqueEventNames.Add (eventName, "");
                    }
                }
            }
            list.Sort ();
            return list;
        }
コード例 #60
0
ファイル: Form1.cs プロジェクト: joshuaphendrix/Imagizer
        private void panel1_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop,false);

            System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();

            foreach(string s in files)
                foreach(string t in getFiles(s,this.chkSubFolders.Checked))
                    sc.Add(t);

            foreach(string s in sc)
            {
                foreach(string filter in this.txtFilter.Text.Split(",".ToCharArray(),StringSplitOptions.RemoveEmptyEntries))
                {
                    if(s.Trim().ToLower().Contains(filter))
                    {
                        this.lstFiles.Items.Add(s);
                        break;
                    }
                }

            }
        }