コード例 #1
0
 /// <summary>
 /// —оздать объект
 /// </summary>
 private void CreateObject()
 {
     try
     {
         using (FormCFolder frm_cf = new FormCFolder("—озать папку"))
         {
             if (isSelectedLV(listView_Local))
             {
                 string view_tree_name = listView_Local.SelectedItems[0].Text;
                 if (view_tree_name.Contains(FileCrypt.not_crypted_mess))
                 {
                     view_tree_name = view_tree_name.Remove(view_tree_name.IndexOf(FileCrypt.not_crypted_mess)).Trim();
                 }
                 frm_cf.InputText = view_tree_name;
             }
             if (frm_cf.ShowDialog() == DialogResult.OK)
             {
                 string path_d = CurrLocalPath;
                 path_d = PrefSettings.FixDrivePath(path_d);
                 Directory.CreateDirectory(Path.Combine(path_d, frm_cf.InputText));
             }
         }
         RefreshExp();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + " | " + ex.TargetSite, "ќшибка");
     }
 }
コード例 #2
0
ファイル: GuitarModel.cs プロジェクト: webprofusion/scalex
        public GuitarModel(PrefSettings appSettings)
        {
            FrettingHand                = FrettingHandOrientation.LeftHand;
            FrettingFingers             = 4;
            StartingFretPos             = 0;
            MaximumScalePositionStretch = 6;
            MaximumChordPositionStretch = 5;
            FretsWithMarkers            = new List <int> {
                3, 5, 7, 9, 12, 15, 17, 19, 21, 24
            };
            GuitarModelSettings = appSettings;
            RefreshStringSettings();

            //populate additional scales based on defined chord arpeggios
            int chordID = 10000;

            foreach (var chord in this.GetAllChordDefinitions())
            {
                chord.ID   = chordID;
                chord.Name = chord.Name + " (Arpeggio)";
                this.AllScales.Add(chord);
                chordID++;
            }
        }
コード例 #3
0
        /// <summary>
        /// ѕереименовать объект
        /// </summary>
        private void RenameSelectedObject()
        {
            if (isSelectedLV(listView_Local))
            {
                switch (listView_Local.SelectedItems[0].Name)
                {
                case "File":
                case "Directory":
                {
                    try
                    {
                        string real_fs_full_name = listView_Local.SelectedItems[0].Tag.ToString();
                        string view_tree_name    = listView_Local.SelectedItems[0].Text;
                        using (FormCFolder frm_cf = new FormCFolder("ѕереименовать " + view_tree_name))
                        {
                            if (view_tree_name.Contains(FileCrypt.not_crypted_mess))
                            {
                                view_tree_name = view_tree_name.Remove(view_tree_name.IndexOf(FileCrypt.not_crypted_mess)).Trim();
                            }
                            frm_cf.InputText = view_tree_name;

                            if (frm_cf.ShowDialog() == DialogResult.OK)
                            {
                                string path_d = CurrLocalPath;
                                path_d = PrefSettings.FixDrivePath(path_d);

                                switch (listView_Local.SelectedItems[0].Name)
                                {
                                case "File":
                                {
                                    File.Move(real_fs_full_name, Path.Combine(path_d, frm_cf.InputText));
                                }
                                break;

                                case "Directory":
                                {
                                    if (listView_Local.SelectedItems[0].Text != "..")
                                    {
                                        Directory.Move(real_fs_full_name, Path.Combine(path_d, frm_cf.InputText));
                                    }
                                }
                                break;

                                default:
                                    break;
                                }
                            }
                        }
                        RefreshExp();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message + " | " + ex.TargetSite, "ќшибка");
                    }
                }
                break;

                default:
                    break;
                }
            }
        }
コード例 #4
0
        private void GetDirs(string init_dir, ListView l_view)
        {
            l_view.Items.Clear();

            if (init_dir.Length == 0 /* || init_dir.Length == 2*/)
            {
                comboBox_drive.Items.Clear();
                DriveInfo[] dinf = DriveInfo.GetDrives();
                foreach (DriveInfo dic in dinf)
                {
                    string vol_label             = string.Empty;
                    string disk_litera           = string.Empty;
                    string disk_avial_free_space = string.Empty;
                    string disk_total_size       = string.Empty;

                    if (dic.Name == "A:\\")
                    {
                        disk_litera = "A:\\";
                        vol_label   = " (ƒисковод гибких дисков)";
                    }
                    else
                    {
                        disk_litera = dic.Name;
                        if (dic.IsReady)
                        {
                            vol_label             = "  (" + dic.VolumeLabel + ")";
                            disk_total_size       = "–азмер:    " + FileSize.PrintFileSize(dic.TotalSize) + Environment.NewLine;
                            disk_total_size      += "«ан¤то:     " + FileSize.PrintFileSize(dic.TotalSize - dic.AvailableFreeSpace) + Environment.NewLine;
                            disk_avial_free_space = "ƒоступно: " + FileSize.PrintFileSize(dic.AvailableFreeSpace);
                        }
                    }

                    ListViewItem li = new ListViewItem();
                    li.Name        = "Drive";
                    li.Text        = disk_litera + vol_label;
                    li.ToolTipText = disk_total_size + disk_avial_free_space;
                    li.Tag         = Path.Combine(init_dir, dic.Name.Remove(dic.Name.LastIndexOf("\\")));
                    li.Group       = l_view.Groups["listViewGroupDrives"];
                    li.ImageIndex  = 0;
                    li.SubItems.Add(dic.DriveType.ToString());
                    l_view.Items.Add(li);
                    AddDrivesInCb(comboBox_drive, li.Tag.ToString(), li.Text);
                }
                init_expl_dir           = string.Empty;
                l_view.ShowItemToolTips = true;
                создатьѕапкуToolStripMenuItem.Enabled = false;
            }
            else
            {
                создатьѕапкуToolStripMenuItem.Enabled = true;
                l_view.ShowItemToolTips = false;
                ListViewItem liUp = new ListViewItem();
                liUp.Name = init_dir;
                liUp.Text = "..";

                if (init_dir.Length > 2)
                {
                    liUp.Tag = init_dir.Remove(init_dir.LastIndexOf("\\"));
                }
                else
                {
                    liUp.Tag = string.Empty;
                }
                liUp.Name       = "Directory";
                liUp.Group      = l_view.Groups["listViewGroupFolders"];
                liUp.ImageIndex = 1;
                l_view.Items.Add(liUp);

                init_dir = PrefSettings.FixDrivePath(init_dir);

                DirectoryInfo di = new DirectoryInfo(init_dir);
                try
                {
                    foreach (DirectoryInfo dic in di.GetDirectories())
                    {
                        ListViewItem li = new ListViewItem();
                        li.Name = "Directory";
                        string FolderName = dic.Name;
                        //–асшифровка нужна? ѕровер¤ем!
                        if (_isEncryptedNames)
                        {
                            FolderName = cn.DecryptFName(FolderName, _pwd_key, PrefSettings.prefix);
                        }
                        li.Text       = FolderName;
                        li.Tag        = Path.Combine(init_dir, dic.Name);
                        init_expl_dir = init_dir;
                        li.Group      = l_view.Groups["listViewGroupFolders"];

                        if (!FolderName.Contains(FileCrypt.not_crypted_mess))
                        {
                            li.ImageIndex = 1;
                        }
                        else
                        {
                            li.ImageIndex = 2;
                        }
                        l_view.Items.Add(li);
                    }

                    foreach (FileInfo dic in di.GetFiles())
                    {
                        ListViewItem li = new ListViewItem();
                        li.Name = "File";
                        string FileName = dic.Name;
                        //–асшифровка нужна? ѕровер¤ем!
                        if (_isEncryptedNames)
                        {
                            FileName = cn.DecryptFName(FileName, _pwd_key, PrefSettings.prefix);
                        }
                        li.Text  = FileName;
                        li.Tag   = Path.Combine(init_dir, dic.Name);
                        li.Group = l_view.Groups["listViewGroupFiles"];
                        if (!FileName.Contains(FileCrypt.not_crypted_mess))
                        {
                            //
                            li.ImageIndex = 3;
                        }
                        else
                        {
                            //
                            li.ImageIndex = 4;
                        }
                        li.SubItems.Add(FileSize.PrintFileSize(dic.Length));
                        l_view.Items.Add(li);
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    //i.e.: System Volyme Information
                }
                catch (IOException)
                {
                    //i.e.: File is Folder
                }
                catch (SecurityException)
                {
                }
                catch (ArgumentNullException)
                {
                }
            }
        }
コード例 #5
0
        }                                    //TODO: move to guitar model

        public GuitarString(PrefSettings appSettings)
        {
            NumberOfFrets = appSettings.NumberFrets;
            FrettedNotes  = null;
            StringNumber  = 0;
        }