Esempio n. 1
0
        private void WebTabAddButton_Click(object sender, EventArgs e)
        {
            if (WebTabTitleTextBox.Text.Length != 0 &&
                WebTabURLTextBox.Text.Length != 0)
            {
                MOG_PropertiesIni project = MOG_ControllerProject.GetProject().GetConfigFile();
                if (project != null)
                {
                    project.PutSectionString("WebTabs", WebTabTitleTextBox.Text);
                    project.PutString("WebTab_" + WebTabTitleTextBox.Text, "Title", WebTabTitleTextBox.Text);
                    project.PutString("WebTab_" + WebTabTitleTextBox.Text, "URL", WebTabURLTextBox.Text);
                    project.PutString("WebTab_" + WebTabTitleTextBox.Text, "POSITION", "-1");
                    project.Save();

                    ListViewItem item = new ListViewItem(WebTabTitleTextBox.Text);
                    item.SubItems.Add(WebTabURLTextBox.Text);
                    item.SubItems.Add("");

                    WebTabTabsListView.Items.Add(item);

                    SavePositionSettings(project);
                }
            }
        }
Esempio n. 2
0
        private MOG_PropertiesIni Post(string targetFolder, MOG_PropertiesIni fileList)
        {
            bool title = false;
            MOG_PropertiesIni copiedFiles    = new MOG_PropertiesIni();
            string            fullTargetPath = mSourceBinaries + "\\" + targetFolder + "\\" + mArchiveVersion;

            Console.WriteLine("----------------------------------------");
            Console.WriteLine("Create " + targetFolder + " VERSION: " + mArchiveVersion);

            // Make our target directory
            DosUtils.DirectoryCreate(fullTargetPath);

            Console.WriteLine("---------------------------");
            Console.WriteLine("Posting new " + targetFolder + " version");
            Console.WriteLine("---------------------------");

            if (fileList.SectionExist("Files"))
            {
                for (int i = 0; i < fileList.CountKeys("Files"); i++)
                {
                    string label    = fileList.GetKeyByIndexSLOW("Files", i);
                    string filename = fileList.GetKeyNameByIndexSLOW("Files", i);
                    string path     = MOG_Tokens.GetFormattedString(Path.GetDirectoryName(filename), "{BuildType}=" + mBuildType);
                    string file     = Path.GetFileName(filename);

                    if (!title && mVerbose)
                    {
                        Console.WriteLine(label);
                        title = true;
                    }

                    // Copy the files
                    foreach (FileInfo fileHandle in DosUtils.FileGetList(path, file))
                    {
                        if (!title && !mVerbose)
                        {
                            Console.WriteLine(label);
                            title = true;
                        }

                        try
                        {
                            fileHandle.CopyTo(fullTargetPath + "\\" + fileHandle.Name, true);
                            copiedFiles.PutSectionString("FILES", fullTargetPath + "\\" + fileHandle.Name);
                            Console.WriteLine("	POSTED: " +
                                              "<" +
                                              fileHandle.LastWriteTime.ToShortDateString().ToString() +
                                              " " +
                                              fileHandle.LastWriteTime.ToShortTimeString().ToString() +
                                              ">\t" +
                                              fileHandle.Name);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("	ERROR POSTING: " + fileHandle.Name);
                            Console.WriteLine("		ERROR MESSAGE: "+ e.Message);
                        }
                    }

                    title = false;
                    Console.WriteLine("");
                }
            }

            return(copiedFiles);
        }