void WriteConfig(FigmaConfig figmaConfig, string filePath)
 {
     Console.WriteLine("Writting config in: {0}", filePath);
     if (File.Exists(filePath))
     {
         File.Delete(filePath);
     }
     try
     {
         File.WriteAllText(filePath, JsonConvert.SerializeObject(figmaConfig));
         Console.WriteLine("DONE.");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
        void IInspectorTabModule.Load(IInspectorWindow inspectorWindow, ITabWrapper tab)
        {
            this.inspectorWindow = inspectorWindow;
            var path = Path.GetDirectoryName(GetType().Assembly.Location);

            configFilePath = Path.Combine(path, "user.cfg");
            config         = ReadConfig(configFilePath);

            var toolbarTab     = tab.NativeObject as NSTabView;
            var figmaStackView = NativeViewHelper.CreateVerticalStackView(translatesAutoresizingMaskIntoConstraints: true);

            var figmaTokenStackView = NativeViewHelper.CreateHorizontalStackView(translatesAutoresizingMaskIntoConstraints: true);

            figmaStackView.AddArrangedSubview(figmaTokenStackView);

            figmaTokenStackView.AddArrangedSubview(NativeViewHelper.CreateLabel("Your personal access token:", translatesAutoresizingMaskIntoConstraints: true));
            tokenTextField = NativeViewHelper.CreateTextEntry(config.Token, translatesAutoresizingMaskIntoConstraints: true);
            figmaTokenStackView.AddArrangedSubview(tokenTextField);
            tokenTextField.Activated += DataChanged;

            var figmaDocumentStackView = NativeViewHelper.CreateHorizontalStackView(translatesAutoresizingMaskIntoConstraints: true);

            figmaStackView.AddArrangedSubview(figmaDocumentStackView);
            figmaDocumentStackView.AddArrangedSubview(NativeViewHelper.CreateLabel("File:", translatesAutoresizingMaskIntoConstraints: true));
            fileTextField            = NativeViewHelper.CreateTextEntry(config.File, translatesAutoresizingMaskIntoConstraints: true);
            fileTextField.Activated += DataChanged;
            figmaDocumentStackView.AddArrangedSubview(fileTextField);

            var figmaWindowNameStackView = NativeViewHelper.CreateHorizontalStackView(translatesAutoresizingMaskIntoConstraints: true);

            figmaStackView.AddArrangedSubview(figmaWindowNameStackView);

            figmaWindowNameStackView.AddArrangedSubview(NativeViewHelper.CreateLabel("Node Name:", translatesAutoresizingMaskIntoConstraints: true));
            nodeTextField            = NativeViewHelper.CreateTextEntry(config.NodeName, translatesAutoresizingMaskIntoConstraints: true);
            nodeTextField.Activated += DataChanged;

            figmaWindowNameStackView.AddArrangedSubview(nodeTextField);

            var figmaWindowContainerIdStackView = NativeViewHelper.CreateHorizontalStackView(translatesAutoresizingMaskIntoConstraints: true);

            figmaStackView.AddArrangedSubview(figmaWindowContainerIdStackView);

            figmaWindowContainerIdStackView.AddArrangedSubview(NativeViewHelper.CreateLabel("View Name:", translatesAutoresizingMaskIntoConstraints: true));
            viewTextField            = NativeViewHelper.CreateTextEntry(config.ViewName, translatesAutoresizingMaskIntoConstraints: true);
            viewTextField.Activated += DataChanged;

            figmaWindowContainerIdStackView.AddArrangedSubview(viewTextField);

            figmaCompute = new NSButton()
            {
                TranslatesAutoresizingMaskIntoConstraints = true
            };
            figmaStackView.AddArrangedSubview(figmaCompute);
            figmaCompute.Title = "Load in selected view";

            //Separator
            figmaStackView.AddArrangedSubview(new NSView());

            //////
            var tabFigmaPanel = new NSTabViewItem();

            tabFigmaPanel.View  = figmaStackView;
            tabFigmaPanel.Label = "Figma";

            toolbarTab.Add(tabFigmaPanel);

            figmaCompute.Activated += FigmaCompute_Activated;
        }