/*private string FindRpmSpecManager () * { * string RpmSpecMan = "Not Found"; * if (Environment.OSVersion.Platform == PlatformID.Unix) { * RpmSpecMan = UnixShell.StartProcess("which","rpmspecmanager","/",true); * } * else { * RpmSpecMan = "rpmspecmanager.exe"; * } * return RpmSpecMan; * }*/ private void LblDownload_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { saveFileDialog1.FileName = LblFsName.Text; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { SourceProjectPackageFile.GetSourceProjectPackageFile(Package, LblFsName.Text, saveFileDialog1.FileName, 4096, FsByteSize); } }
private void BckGrWork_DoWork(object sender, DoWorkEventArgs e) { ProgressStruc ToSend = new ProgressStruc(); BckGrWork.ReportProgress(0, SetProgressStruc(ToSend, "Total", "I will Create the link", 1)); Branch.PostBranch(CmBxSubPrjText, CmBxSubPkgText, CmbxCurSubPrjText, TxtPkgDestText); BckGrWork.ReportProgress(1, SetProgressStruc(ToSend, "Total", "Link created", 1)); if (MessageBox.Show(string.Format("Done! Do you want to imediatly branch also all files of {0} in {1}", CmBxSubPrjText + ":" + CmBxSubPkgText, CmbxCurSubPrjText + ":" + TxtPkgDestText), "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { BckGrWork.ReportProgress(1, SetProgressStruc(ToSend, "Total", "Get the list of file(s)", 3)); string PkgSourceDir = VarGlobal.MonoOBSFrameworkTmpDir + CmBxSubPkgText + Path.DirectorySeparatorChar.ToString(); if (!Directory.Exists(PkgSourceDir)) { Directory.CreateDirectory(PkgSourceDir); } StringBuilder Result = GetSourceProjectPackage.GetFileList(CmBxSubPrjText, CmBxSubPkgText); List <string> FsLs = ReadXml.GetAllFirstAttrValue(Result.ToString(), "directory", "name"); BckGrWork.ReportProgress(2, SetProgressStruc(ToSend, "Total", "Find " + FsLs.Count + " file(s)", 3)); int Cnt = 1; if (FsLs.Count > 0) { List <string> CurItem = new List <string>(); foreach (string item in FsLs) { BckGrWork.ReportProgress(Cnt, SetProgressStruc(ToSend, "Cur" , string.Format("Download file {0} {1}/{2}", item, Cnt, FsLs.Count), FsLs.Count)); Cnt += 1; CurItem.Clear(); CurItem.Add(item); SourceProjectPackageFile.GetSourceProjectPackageFiles( CmBxSubPrjText, CmBxSubPkgText, CurItem, PkgSourceDir, 4096); BckGrWork.ReportProgress(Cnt, SetProgressStruc(ToSend, "Cur" , "File downloaded", FsLs.Count)); } Cnt = 1; foreach (string FsPathName in Directory.GetFiles(PkgSourceDir)) { BckGrWork.ReportProgress(Cnt, SetProgressStruc(ToSend, "Cur" , string.Format("Upload file {0} {1}/{2}", FsLs[Cnt], Cnt, FsLs.Count), FsLs.Count)); Cnt += 1; PutSourceProjectPackageFile.PutFile(CmbxCurSubPrjText, TxtPkgDestText, FsPathName); BckGrWork.ReportProgress(Cnt, SetProgressStruc(ToSend, "Cur" , "Uploaded !", FsLs.Count)); } } BckGrWork.ReportProgress(3, SetProgressStruc(ToSend, "Total", "Done !", 3)); } }
private void EditShowAFs() { string TmpFs = VarGlobal.MonoOBSFrameworkTmpDir + LblFsName.Text; string RpmSpecMan = VarGlobale.RpmSpecMPath; if (RpmSpecMan.IndexOf("rpmspecmanager", StringComparison.InvariantCultureIgnoreCase) > -1 & LblFsName.Text.EndsWith(".spec") == true & File.Exists(VarGlobale.RpmSpecMPath) == true) { StringBuilder SpecCont = new StringBuilder(SourceProjectPackageFile.GetSourceProjectPackageFile(Package, LblFsName.Text).ToString()); //if(!VarGlobal.LessVerbose)Console.WriteLine(SpecCont.ToString()); File.WriteAllText(TmpFs, SpecCont.ToString()); System.Diagnostics.Process PSpec = new System.Diagnostics.Process(); PSpec.StartInfo.FileName = RpmSpecMan; PSpec.StartInfo.Arguments = (char)(34) + TmpFs + (char)(34); PSpec.Start(); //PSpec.WaitForExit(); while (PSpec.HasExited == false) { Application.DoEvents(); } } else { Forms.EditShowFile Editor = new MonoOSC.Forms.EditShowFile(); Editor.SetFsName = LblFsName.Text; Editor.SetText = "Downloading " + LblFsName.Text; Editor.SetText = SourceProjectPackageFile.GetSourceProjectPackageFile(Package, LblFsName.Text).ToString(); Cursor = Cursors.Default; Editor.ShowDialog(); string XmlTemplate = Editor.SetText; File.WriteAllText(TmpFs, XmlTemplate); } if (MessageBox.Show("Update file on the server ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!string.IsNullOrEmpty(File.ReadAllText(TmpFs))) { try { MessageBox.Show(PutSourceProjectPackageFile.PutFile(Package, TmpFs).ToString(), "Result Info", MessageBoxButtons.OK, MessageBoxIcon.Information); File.Delete(TmpFs); } catch (Exception Ex) { if (!VarGlobal.LessVerbose) { Console.WriteLine(Ex.Message + Environment.NewLine + Ex.StackTrace); } } finally { File.Delete(TmpFs); } } } }