예제 #1
0
        public EditorINIData GetEditorData()
        {
            EditorINIData data = new EditorINIData(TemplateIndex);

            foreach (TableBlock block in Blocks)
            {
                data.Blocks.Add(block.Block);
            }

            return(data);
        }
예제 #2
0
        public ArchtypeManager(string file, int templateIndex)
        {
            if (file != null)
            {
                FileManager   fileManager = new FileManager(file);
                EditorINIData iniContent  = fileManager.Read(FileEncoding.Automatic, templateIndex);
                TableData     solarArch   = new TableData(iniContent);

                CreateContentTable(solarArch.Blocks);
            }
        }
예제 #3
0
        void monitor_Changed(object sender, FileSystemEventArgs e)
        {
            FileManager   fileManager = new FileManager(File);
            EditorINIData iniContent  = fileManager.Read(FileEncoding.Automatic, templateIndex);

            Data = new TableData(iniContent);

            view.Dispatcher.Invoke(new Action(delegate()
            {
                ShowData();
            }));
        }
예제 #4
0
        public ArchetypeManager(string file, int templateIndex)
        {
            if (file == null)
            {
                return;
            }

            FileManager   fileManager = new FileManager(file);
            EditorINIData iniContent  = fileManager.Read(FileEncoding.Automatic, templateIndex);

            CreateContentTable(iniContent.Blocks);
        }
예제 #5
0
        public TableData(EditorINIData data)
        {
            Blocks        = new List <TableBlock>();
            TemplateIndex = data.TemplateIndex;

            MaxId = data.Blocks.Count;

            for (int i = 0; i < MaxId; ++i)
            {
                Blocks.Add(new TableBlock(i, i, data.Blocks[i], TemplateIndex));
            }
        }
예제 #6
0
        public void Copy()
        {
            EditorINIData data = new EditorINIData(Data.TemplateIndex);

            foreach (TableBlock tableData in objectListView1.SelectedObjects)
            {
                data.Blocks.Add(tableData.Block);
            }

            Clipboard.Copy(data, typeof(EditorINIData));

            OnDocumentChanged(this);
        }
예제 #7
0
        public TableData(EditorINIData data)
        {
            Blocks        = new List <TableBlock>();
            TemplateIndex = data.TemplateIndex;

            foreach (EditorINIBlock block in data.Blocks)
            {
                int id = 0;
                if (this.Blocks.Count > 0)
                {
                    id = this.Blocks[this.Blocks.Count - 1].ID + 1;
                }

                this.Blocks.Add(new TableBlock(id, block, TemplateIndex));
            }
        }
예제 #8
0
        void DisplayFile(string file, int templateIndex)
        {
            if (templateIndex == -1)
            {
                templateIndex = Helper.Template.Data.Files.IndexOf("System");
            }

            FileManager   fileManager = new FileManager(file);
            EditorINIData iniContent  = fileManager.Read(FileEncoding.Automatic, templateIndex);

            Data = new TableData(iniContent);
            File = file;
            this.templateIndex = templateIndex;

            ShowData();
        }
예제 #9
0
        public void Paste()
        {
            EditorINIData editorData = (EditorINIData)Clipboard.Paste(typeof(EditorINIData));

            if (editorData.TemplateIndex == Data.TemplateIndex)
            {
                int id = GetNewBlockId();

                List <TableBlock> blocks = new List <TableBlock>();
                for (int i = 0; i < editorData.Blocks.Count; ++i)
                {
                    blocks.Add(new TableBlock(id + i, Data.MaxId++, editorData.Blocks[i], Data.TemplateIndex));
                }

                AddBlocks(blocks);
            }
        }
예제 #10
0
        public frmTableEditor(int templateIndex, string file)
        {
            InitializeComponent();

            LoadIcons();
            _undoManager.DataChanged += UndoManager_DataChanged;

            if (file != null)
            {
                FileManager fileManager = new FileManager(file)
                {
                    ReadWriteComments = true,     // always read comments
                };
                EditorINIData iniContent = fileManager.Read(FileEncoding.Automatic, templateIndex);

                Data    = new TableData(iniContent);
                _isBINI = fileManager.IsBINI;

                SetFile(file);
            }
            else
            {
                Data = new TableData
                {
                    TemplateIndex = templateIndex
                };

                SetFile(string.Empty);
            }

            objectListView1.CellToolTip.InitialDelay          = 1000;
            objectListView1.UnfocusedHighlightBackgroundColor = objectListView1.HighlightBackgroundColorOrDefault;
            objectListView1.UnfocusedHighlightForegroundColor = objectListView1.HighlightForegroundColorOrDefault;

            SimpleDropSink dropSink = objectListView1.DropSink as SimpleDropSink;

            if (dropSink != null)
            {
                dropSink.CanDropBetween = true;
                dropSink.CanDropOnItem  = false;
            }

            RefreshSettings();
        }