Esempio n. 1
0
        private void OutputCFormatFile(UInt16[] colorsHex, String fileName)//
        {
            if (checkBoxBinFormat.Checked == false)
            {
                return;
            }

            UInt16        index = 0;
            String        fn    = Path.GetFileNameWithoutExtension(fileName);
            StringBuilder sb    = new StringBuilder();

            sb.Append("// AhHua@HedyMed\r\n\r\n");
            sb.Append("// ");
            sb.Append(fn);
            sb.Append("\r\n");


            // 转换
            if (colorsHex[1] > 64 || colorsHex[0] > 128)
            {
                MessageBox.Show("文件超限!");
                return;
            }
            MonoFile monoFile = toMonoFile(colorsHex);

            // 换名字
            sb.Append("const UINT16 monoPicAhHua[" + monoFile.dataLen + "+2" + "] = { 0x");
            sb.Append(monoFile.colLen.ToString("X2") + ", 0x");
            sb.Append(monoFile.rowLen.ToString("X2") + ", // WIDTH & HEIGHT");

            for (int x = 0; x < monoFile.dataLen; x++)
            {
                if (index % 16 == 0)
                {
                    sb.Append("\r\n\t");
                }
                sb.Append("0x" + monoFile.datas[index++].ToString("X2"));
                if (index <= monoFile.dataLen - 1)
                {
                    sb.Append(", ");
                }
            }
            sb.Append(" };\r\n");

            fileName = fileName.Substring(0, fileName.Length - 4);
            StreamWriter sw = new System.IO.StreamWriter(fileName + ".c");

            sw.Write(sb.ToString());
            sw.Close();
            OutputBinaryFile(colorsHex, fileName);
        }
Esempio n. 2
0
        public string LoadMonoPopup()
        {
            IVsUIShell uiShell = (IVsUIShell)Package.PublicGetService(typeof(SVsUIShell));
            Guid       clsid   = Guid.Empty;
            int        result;

            uiShell.ShowMessageBox(0, ref clsid, "Mono File Not Found",
                                   "Mono file not found. Would you like to load an existing file?", string.Empty, 0,
                                   OLEMSGBUTTON.OLEMSGBUTTON_YESNO, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST, OLEMSGICON.OLEMSGICON_INFO, 0, out result);

            if (result == 6)
            {
                return(MonoFile.SelectMonoFile());
            }
            return(null);
        }
Esempio n. 3
0
        /////////////////////////////////////////////////////////////////////////////
        // Overridden Package Implementation
        #region Package Members

        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Instance = this;
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            m_writer = OutputWriter.Instance;

            var teamPage = (TeamSettingsPage)PublicGetDialogPage(typeof(TeamSettingsPage));
            var extPage  = (ExtensionSettingsPage)PublicGetDialogPage(typeof(ExtensionSettingsPage));
            var depPage  = (DependencySettingsPage)PublicGetDialogPage(typeof(DependencySettingsPage));

            SettingsProvider.SetSettingsPages(teamPage, extPage, depPage);


            m_deployButton = new DeployDebugButton(this, (int)PkgCmdIDList.cmdidDeployCode, false);
            m_debugButton  = new DeployDebugButton(this, (int)PkgCmdIDList.cmdidDebugCode, true);

            m_killButton = new KillButton(this);


            string monoFolder = WPILibFolderStructure.CreateMonoFolder();

            string monoFile = monoFolder + Path.DirectorySeparatorChar + DeployProperties.MonoVersion;

            m_monoFile = new MonoFile(monoFile);

            m_installMonoButton  = new InstallMonoButton(this, m_monoFile);
            m_downloadMonoButton = new DownloadMonoButton(this, m_monoFile, m_installMonoButton);
            m_saveMonoButton     = new SaveMonoButton(this, m_monoFile);


            m_aboutButton      = new AboutButton(this);
            m_netConsoleButton = new NetConsoleButton(this);
            m_settingsButton   = new SettingsButton(this);

            m_setMainRobotButton = new SetMainRobotButton(this);
        }
Esempio n. 4
0
 public InstallMonoButton(Frc_ExtensionPackage package, MonoFile monoFile)
     : base(package, false, GuidList.guidFRC_ExtensionCmdSet, (int)PkgCmdIDList.cmdidInstallMono)
 {
     m_monoFile = monoFile;
 }
Esempio n. 5
0
 public SaveMonoButton(Frc_ExtensionPackage package, MonoFile monoFile)
     : base(package, true, GuidList.guidFRC_ExtensionCmdSet, (int)PkgCmdIDList.cmdidSaveMonoFile)
 {
     m_monoFile = monoFile;
 }
Esempio n. 6
0
 public DownloadMonoButton(Frc_ExtensionPackage package, MonoFile monoFile, InstallMonoButton installButton)
     : base(package, false, GuidList.guidFRC_ExtensionCmdSet, (int)PkgCmdIDList.cmdidDownloadMono)
 {
     m_monoFile      = monoFile;
     m_installButton = installButton;
 }