Ejemplo n.º 1
0
        protected virtual void  OnEnable()
        {
            Metrics.UseTool(17);             // NGSyncFolders

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            Utility.RegisterWindow(this);
            Utility.LoadEditorPref(this, NGEditorPrefs.GetPerProjectPrefix());
            Utility.RestoreIcon(this, NGSyncFoldersWindow.TitleColor);

            this.slavesList = new ReorderableList(null, typeof(Project), true, true, this.showSlaves, false);
            this.slavesList.drawHeaderCallback  = this.OnDrawHeaderSlaves;
            this.slavesList.elementHeight       = this.showSlaves == true ? NGSyncFoldersWindow.SlaveHeight : 0F;
            this.slavesList.drawElementCallback = this.OnDrawSlave;
            this.slavesList.onAddCallback       = this.OnAddSlave;

            this.filtersList = new ReorderableList(null, typeof(string), true, true, this.showFilters, false);
            this.filtersList.drawHeaderCallback  = this.OnDrawHeaderFilters;
            this.filtersList.elementHeight       = this.showFilters == true ? NGSyncFoldersWindow.FilterHeight : 0F;
            this.filtersList.drawElementCallback = this.OnDrawFilter;
            this.filtersList.onAddCallback       = this.OnAddFilter;

            //this.profile.master.WatchFileChanged += this.ReplicateOnSlaves;

            this.minSize        = new Vector2(370F, 200F);
            this.wantsMouseMove = true;

            HQ.SettingsChanged += this.Repaint;
            Utility.RegisterIntervalCallback(this.Repaint, 250);
            Undo.undoRedoPerformed += this.RepaintAndClearCaches;
        }
Ejemplo n.º 2
0
        protected virtual void  OnDisable()
        {
            for (int i = 0; i < this.filters.Count; i++)
            {
                Utility.SaveEditorPref(this.filters[i], NGEditorPrefs.GetPerProjectPrefix());
            }

            Selection.selectionChanged -= this.UpdateSelection;
            Undo.undoRedoPerformed     -= this.Repaint;
        }
Ejemplo n.º 3
0
        protected virtual void  OnDisable()
        {
            Utility.UnregisterWindow(this);
            //this.profile.master.WatchFileChanged -= this.ReplicateOnSlaves;

            //this.profile.master.Dispose();
            //for (int i = 0; i < this.profile.slaves.Count; i++)
            //	this.profile.slaves[i].Dispose();

            Utility.SaveEditorPref(this, NGEditorPrefs.GetPerProjectPrefix());
            HQ.SettingsChanged -= this.Repaint;
            Utility.UnregisterIntervalCallback(this.Repaint);
            Undo.undoRedoPerformed -= this.RepaintAndClearCaches;
        }
Ejemplo n.º 4
0
        public LogsExporterDrawer(EditorWindow window, List <Row> rows)
        {
            this.window       = window;
            this.rows         = rows;
            this.exporters    = Utility.CreateNGTInstancesOf <ILogExporter>();
            this.previewLabel = "Preview              (" + this.rows.Count + " element" + (this.rows.Count > 1 ? "s" : string.Empty) + ")";

            this.names = new string[this.exporters.Length];
            for (int i = 0; i < this.exporters.Length; i++)
            {
                this.names[i] = Utility.NicifyVariableName(this.exporters[i].GetType().Name);
            }

            string rawUsedOutputs = NGEditorPrefs.GetString(ExportLogsWindow.UsedOutputsKeyPref, null);

            if (string.IsNullOrEmpty(rawUsedOutputs) == false)
            {
                string[] splittedTypes = rawUsedOutputs.Split(ExportLogsWindow.UsedOutputsSeparator);

                for (int i = 0; i < splittedTypes.Length; i++)
                {
                    Type t = Type.GetType(splittedTypes[i]);

                    if (t != null)
                    {
                        this.usedOutputs.Add(Activator.CreateInstance(t) as ILogExportSource);
                    }
                }
            }

            if (this.usedOutputs.Count == 0)
            {
                for (int i = 0; i < LogsExporterDrawer.DefaultExportSources.Length; i++)
                {
                    this.usedOutputs.Add(Activator.CreateInstance(LogsExporterDrawer.DefaultExportSources[i]) as ILogExportSource);
                }
            }

            Utility.LoadEditorPref(this, NGEditorPrefs.GetPerProjectPrefix());

            for (int i = 0; i < this.exporters.Length; i++)
            {
                this.exporters[i].OnEnable();
            }

            this.horizontalScrollbar = new HorizontalScrollbar(0F, 18F, this.window.position.width, 4F);

            this.UpdatePreview();
        }
Ejemplo n.º 5
0
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGRenamerWindow.TitleColor);

            Metrics.UseTool(11);             // NGRenamer

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            foreach (Type type in Utility.EachNGTSubClassesOf(typeof(TextFilter)))
            {
                this.filters.Add(Activator.CreateInstance(type, new object[] { this }) as TextFilter);
                Utility.LoadEditorPref(this.filters[this.filters.Count - 1], NGEditorPrefs.GetPerProjectPrefix());
            }

            this.filters.Sort((a, b) => b.priority - a.priority);

            Selection.selectionChanged += this.UpdateSelection;
            Undo.undoRedoPerformed     += this.Repaint;
        }
Ejemplo n.º 6
0
        public void     Save()
        {
            StringBuilder buffer = Utility.GetBuffer();

            for (int i = 0; i < this.usedOutputs.Count; i++)
            {
                if (i > 0)
                {
                    buffer.Append(ExportLogsWindow.UsedOutputsSeparator);
                }
                buffer.Append(this.usedOutputs[i].GetType().GetShortAssemblyType());
            }

            NGEditorPrefs.SetString(ExportLogsWindow.UsedOutputsKeyPref, Utility.ReturnBuffer(buffer));

            Utility.SaveEditorPref(this, NGEditorPrefs.GetPerProjectPrefix());

            for (int i = 0; i < this.exporters.Length; i++)
            {
                this.exporters[i].OnDestroy();
            }
        }
Ejemplo n.º 7
0
        protected override void OnDisable()
        {
            base.OnDisable();

            Utility.SaveEditorPref(this, NGEditorPrefs.GetPerProjectPrefix());
        }
Ejemplo n.º 8
0
        protected override void OnEnable()
        {
            base.OnEnable();

            Utility.LoadEditorPref(this, NGEditorPrefs.GetPerProjectPrefix());
        }