Exemplo n.º 1
0
 private void LoadLegacyElement(ChordSheet sheet)
 {
     for (int i = 0, count = sheet.Chords.Count; i < count; ++i)
     {
         AddNewChord(sheet.Chords[i]);
     }
 }
Exemplo n.º 2
0
 public void ExportChordFileConstructorTest()
 {
     ExportChordFile target = new ExportChordFile();
     target.ExportFilePath = @"C:\Users\wangji\Desktop\手簿 Data for Test\chord_result.xls";
     target.TemplateFilePath = @"C:\Users\wangji\Desktop\手簿 Data for Test\Chord_Template.xls";
     string path = @"C:\Users\wangji\Desktop\手簿 Data for Test\收敛手簿 2013-10-10.txt";
     ChordSheet sheet =new ChordSheet();
     ChordSheet.PrjName = "test for chord sheet report";
     sheet.Lines.Add(new ReadChordFile().ReadTxt(path));
     sheet.Lines.Add(new ReadChordFile().ReadTxt(path));
     target.Export(sheet);
 }
Exemplo n.º 3
0
        public static string ReadChord(string[] files, string prjName, int RecNo)
        {
            ReadChordFile read = new ReadChordFile();
            ChordSheet sheet = new ChordSheet();
            ChordSheet.PrjName = prjName;
            ChordSheet.RecordNo = RecNo;
            sheet.Lines = read.ReadTxtList(files);

            string exportname = string.Format("{0}工程全站仪收敛观测记录{1}次", prjName, RecNo);
            string templateUrl = HttpContext.Current.Request.ApplicationPath + "/Template/Chord_Template.xls";
            string exportUrl = HttpContext.Current.Request.ApplicationPath + "/Export/" + exportname + ".xls";
            string templetepath = HttpContext.Current.Server.MapPath(templateUrl);
            string exportpath = HttpContext.Current.Server.MapPath(exportUrl);

            ExportChordFile ex = new ExportChordFile();
            ex.TemplateFilePath = templetepath;
            ex.ExportFilePath = exportpath;
            ex.Export(sheet);
            return exportname + ".xls";
        }
Exemplo n.º 4
0
    private void LoadElements(ChordSheet sheet)
    {
        ClearChords();
        ClearMelodies();
        if ((sheet.ElementTypes == null || sheet.ElementTypes.Count == 0) && sheet.Chords.Count > 0)
        {
            LoadLegacyElement(sheet);
            LoadPanel.CloseWindow();
            return;
        }

        int chordIndex  = 0;
        int melodyIndex = 0;
        int labelIndex  = 0;

        for (int i = 0, count = sheet.ElementTypes.Count; i < count; ++i)
        {
            switch (sheet.ElementTypes[i])
            {
            case ElementType.Chord:
                AddNewChord(sheet.Chords[chordIndex]);
                chordIndex++;
                break;

            case ElementType.Melody:
                AddNewMelody(sheet.MelodyDiagrams[melodyIndex]);
                melodyIndex++;
                break;

            case ElementType.Label:
                AddNewLabel(sheet.Labels[labelIndex]);
                labelIndex++;
                break;
            }
        }

        LoadPanel.CloseWindow();
    }
Exemplo n.º 5
0
    private void OnSheetsRetrievedForSave(ChordSheetCollection sheetCollection)
    {
        ChordSheet newSheet = new ChordSheet();

        newSheet.Chords          = new List <Chord>();
        newSheet.MelodyDiagrams  = new List <MelodyDiagramModel>();
        newSheet.Labels          = new List <string>();
        newSheet.ElementTypesInt = new List <int>();
        for (int i = 0, count = chords.Count; i < count; ++i)
        {
            newSheet.Chords.Add(chords[i].CurrentChord);
        }

        for (int i = 0, count = melodies.Count; i < count; ++i)
        {
            newSheet.MelodyDiagrams.Add(melodies[i].GetModel());
        }

        for (int i = 0, count = labels.Count; i < count; ++i)
        {
            newSheet.Labels.Add(labels[i].LabelField.text);
        }

        int numChildren = ScrollContainer.childCount;

        for (int i = 0; i < numChildren; ++i)
        {
            Transform child = ScrollContainer.GetChild(i);
            if (child.GetComponent <ChordDiagram>() != null)
            {
                newSheet.ElementTypesInt.Add((int)ElementType.Chord);
            }
            else if (child.GetComponent <MelodyDiagram>() != null)
            {
                newSheet.ElementTypesInt.Add((int)ElementType.Melody);
            }
            else if (child.GetComponent <LabelElement>() != null)
            {
                newSheet.ElementTypesInt.Add((int)ElementType.Label);
            }
        }

        if (sheetCollection == null)
        {
            sheetCollection = ChordSheetCollection.Create();
        }

        int sheetIndex = sheetCollection.SheetNames.IndexOf(currentSheetName);

        if (sheetIndex < 0)
        {
            sheetCollection.SheetNames.Add(currentSheetName);
            sheetCollection.Sheets.Add(newSheet);
        }
        else
        {
            sheetCollection.Sheets[sheetIndex] = newSheet;
        }

        string sheetJson = JsonUtility.ToJson(sheetCollection);

        WebRequestManager.PostData(sheetJson, OnSaveComplete);
    }