iT邦幫忙

0

visual stuido有辦法救回被覆蓋或是刪除的程式碼嗎

  • 分享至 

  • xImage

我寫程式寫一天有點累,忘記在import其他專案用到還是不小心刪除
總之我寫一天的程式碼就不見了QQ,請問有人有解嗎

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

2
暐翰
iT邦大師 1 級 ‧ 2019-06-02 23:29:25
最佳解答

Q1: Copy/Paste覆蓋?
Q2: 我的檔案還沒關,代表從一開始就沒有關閉過?(假如沒有關閉Ctrl+Z可以回復的)


假如檔案有關閉過
但是新的專案還沒有編譯運行過
可以去bin資料夾找出先前運行的dll檔案,使用ILSpy反編譯回code(雖然會醜陋了點)

看更多先前的回應...收起先前的回應...
小魚 iT邦大師 1 級 ‧ 2019-06-02 23:34:18 檢舉

如果是.Net倒是有軟體可以很漂亮地反編譯dll...

e6319a5b iT邦新手 4 級 ‧ 2019-06-02 23:34:31 檢舉

...我已經關掉了,我試過網路上的磁碟回復,結果CODE有一部分是亂碼

e6319a5b iT邦新手 4 級 ‧ 2019-06-02 23:35:26 檢舉

是什麼QAQ

小魚 iT邦大師 1 級 ‧ 2019-06-02 23:35:38 檢舉

那應該是殺掉檔案的回復吧,
但是你的情況不一樣,
看還有沒有機會反編譯吧...

e6319a5b iT邦新手 4 級 ‧ 2019-06-02 23:38:19 檢舉

我只剩EXE

e6319a5b iT邦新手 4 級 ‧ 2019-06-02 23:40:52 檢舉

既然,我從磁碟回復可以看見有部分亂碼的CODE是不是有方法能復原呢...

暐翰 iT邦大師 1 級 ‧ 2019-06-02 23:44:27 檢舉

EXE也可以反編譯的 e6319a5b

暐翰 iT邦大師 1 級 ‧ 2019-06-02 23:45:14 檢舉

這段code有沒有資安問題,假如沒有可以提供出來讓大家幫你解決

e6319a5b iT邦新手 4 級 ‧ 2019-06-02 23:46:43 檢舉

22bf4b86040a557e938fd4db53f57bc6dee3d4db
l class WinForm4GradeQuery : Form
{
private bool isPercentage = true;
private bool LEFT = true;
private bool RIGHT = false;
public double AVERAGE;
public int MAXVALUE;
public int MINVALUE;
private string pieChartTitle = "Student Grade Level";

    public ToolStripButton[] toolStripButton_Level_Category, toolStripButton_Statistics
                            , toolStripButton_Sorting, toolStripButton_Main_Panel
                            , toolStripButton_Query_Approach;
    public StudentScoreGrading[]studentScoreGrading;
    public List<GradeRecordUsingThrow> completedGradeRecordList;
    public List<string> RecordStudentScoreList;
    public ReadCompletedRecordsModel readCompletedRecordsModel_CS2200;
    public ToolStripDropDownButton Level_Category, Statistics, Sorting, Main_Panel, Query_Approach;

    public DataGridView dataGridView;//?€閬?
    public ListBox ListBox4Right;//銝?閬?交???
    public Button bt_showTitle;

    public TextBox[] tb_4showStudentData;

    public Dictionary<string,int> Dic_Level_Category, Dic_Statistics, Dic_Sorting, Dic_Main_Panel, Dic_Query_Approach;

    public string[] GRADELEVEL;
    private string[] STATISTICS= {"Average","Highest","Lowest","Above_Average","Below_Average" };
    private string[] SORTING = { "Ascending", "Descending" };
    private string[] MAIN_PANEL = {"Read_Chart_File","Read_Record_File","Set_Profile",
                                    "Process_RecordBook","Display_Level_Distribution",
                                    "Save_Log_File","Reset_All","Exit"};
    private string[] QUERY_APPROACH = { "ListBox","DataGridView"};

   


    public string savefilepath = @"..\..\..\Test\C#\log.txt";

    public double MIDTERMRATE, FINALEXAMRATE, REGULARRATE;

    public string TEACHERNAME, COURSENAME;

    public List<GradeRecordUsingThrow> DesignationLVpeople;
    private MainPanelMenuModels mainPanelMenu;
    private const bool VISABLE = true;//??閬?
    private const bool NOTVISABLE = false;//??閬?
   



    public WinForm4GradeQuery()
    {
        InitializeComponent();
        registrationComponents();
        setComponents();
    }

    private void registrationComponents()
    {
        tb_4showStudentData = new TextBox[] { tb_QRshowAverage, tb_QRshowLV, tb_QRshowMax, tb_QRshowMin, tb_QRshowNumbers,
            tb_QRshowRange, tb_QRshow_AboveAverage, tb_QRshow_BelowAverage };
        dataGridView = dg_right;
        ListBox4Right = lb_showStudentData_Right;
        bt_showTitle = bt_showTitle4ListBox;
    }

    private void setComponents()
    {           
        InitializeObjects();
        setDataGridView();
        setGroupBoxToVisableOrNot(false);

        setComponentToDic(STATISTICS, Dic_Statistics);
        setComponentToDic(SORTING, Dic_Sorting);
        setComponentToDic(MAIN_PANEL, Dic_Main_Panel);
        setComponentToDic(QUERY_APPROACH, Dic_Query_Approach);

        Initialize_ToolStripComboBox(Statistics_ButtonClick, StatisticsButtonProcess, NOTVISABLE, ref Statistics, ref toolStripButton_Statistics, STATISTICS, "Statistics");
        Initialize_ToolStripComboBox(Sorting_ButtonClick, null, NOTVISABLE, ref Sorting, ref toolStripButton_Sorting, SORTING, "Sorting");
        Initialize_ToolStripComboBox(Main_Panel_ButtonClick, Main_Panel_ButtonProcess, VISABLE, ref Main_Panel, ref toolStripButton_Main_Panel, MAIN_PANEL, "Main_Panel");
        Initialize_ToolStripComboBox(Query_Approach_ButtonClick, null, NOTVISABLE, ref Query_Approach,
            ref toolStripButton_Query_Approach, QUERY_APPROACH, "Query_Approach");
    }
    public void reset()
    {
        ts_items.Items.Clear();
        dg_right.Rows.Clear();
        dg_right.Visible = false;
        gp_Choice_for_Drawing_Chart.Enabled = false;
        lb_showStudentData_Left.Items.Clear();
        lb_showStudentData_Right.Items.Clear();
        lb_showStudentData_Right.Visible = true;
        setComponents();

        TextBox[] textBoxes = new TextBox[] { tb_getCourseName,tb_getFinalRate,tb_getMidRate,tb_getRegularRate,tb_getTeacherName,
            tb_GradeFinal,tb_GradeLevel,tb_GradeMid,tb_GradeRegular,tb_GradeRegular,tb_GradeSemester,tb_QRshowAverage,
            tb_QRshowLV,tb_QRshowMax,tb_QRshowMin,tb_QRshowNumbers,tb_QRshowRange,tb_QRshow_AboveAverage,tb_QRshow_BelowAverage};
        foreach(TextBox textBox in textBoxes)
        {
            textBox.Text = "";
        }
    }


    private void setComponentToDic(string[] target,Dictionary<string, int> keyValuePairs)
    {

        for (int i = 0; i < target.Length; i++)
        {
            keyValuePairs.Add(target[i], i);
        }

        
    }


    public void updaete_LBshowStudentData(bool left,List<GradeRecordUsingThrow>_gradeRecords)
    {
        ListBox listBox = left ? lb_showStudentData_Left : lb_showStudentData_Right;
        listBox.Items.Clear();
        foreach (GradeRecordUsingThrow gradeRecord in _gradeRecords)
        {
            listBox.Items.Add(gradeRecord.ToStringNoRates());
        }

    }


    public void turn_ONLevel_Category()
    {
        setComponentToDic(GRADELEVEL, Dic_Level_Category);
        Initialize_ToolStripComboBox(Level_Category_ButtonClick, null,NOTVISABLE,ref Level_Category,
            ref toolStripButton_Level_Category, GRADELEVEL, "Level_Category");
    }
    private void InitializeObjects()
    {
        gp_Choice_for_Drawing_Chart.Enabled = false;
        RecordStudentScoreList = new List<string>();
        Dic_Level_Category = new Dictionary<string, int>();
        Dic_Statistics= new Dictionary<string, int>();
        Dic_Sorting = new Dictionary<string, int>();
        Dic_Main_Panel = new Dictionary<string, int>();
        Dic_Query_Approach = new Dictionary<string, int>();

        completedGradeRecordList = new List<GradeRecordUsingThrow>();
        readCompletedRecordsModel_CS2200 = new ReadCompletedRecordsModel(this, fileChooserCompleteRecords);
        mainPanelMenu = new MainPanelMenuModels(this);
    }
    public void setGroupBoxToVisableOrNot(bool b)
    {
        gpBasicProfile.Visible = b;
        gpProfileControl.Visible = b;
        gpRate.Visible = b;
    }
            
    private void bt_InputBox_Click(object sender, EventArgs e)
    {
        string callerDataArray="";
        string callerLabelsArray="";
        for (int i=0;i< studentScoreGrading.Length;i++)
        {
            callerDataArray += studentScoreGrading[i].theLVStudents.Count;
            callerLabelsArray += studentScoreGrading[i].LEVEL;
            if (i!= studentScoreGrading.Length - 1)
            {
                callerDataArray += "\t";
                callerLabelsArray += "\t";
            }
        }
        ZedGraph4AnyIssueBookForm zedGraph4AnyIssueBookForm = new ZedGraph4AnyIssueBookForm(callerDataArray, callerLabelsArray, pieChartTitle, isPercentage);
        zedGraph4AnyIssueBookForm.Show();
    }

    private delegate void Del(object sender, EventArgs e);
    private delegate void DelButtonProcess(bool b);
    #region ??隞亙????身摰?

    private void Initialize_ToolStripComboBox(Del del, DelButtonProcess delButtonProcess,bool ToolStripDropDownButtonVisable, ref ToolStripDropDownButton toolStripDropDownButton,
        ref ToolStripButton[] toolStripButton, string[]strContent,string title)
    {
        toolStripDropDownButton = new ToolStripDropDownButton();
        toolStripDropDownButton.Visible = ToolStripDropDownButtonVisable;
        toolStripDropDownButton.BackColor = Color.White;
        ToolStripDropDown dropDown = new ToolStripDropDown();
        toolStripDropDownButton.DropDown = dropDown;
        toolStripDropDownButton.Text = title;
        toolStripButton = new ToolStripButton[strContent.Length];
        for (int i = 0; i < strContent.Length; i++)
        {
            toolStripButton[i] = new ToolStripButton();
            toolStripButton[i].Text = strContent[i];
            toolStripButton[i].Click += new EventHandler(del);
        }
        delButtonProcess?.Invoke(false);
        dropDown.Items.AddRange(toolStripButton);
        ts_items.Items.Add(toolStripDropDownButton);
    }
    private string getTheClickedItemName(object sender)
    {         
        Object senderButton = (object)sender;
        return senderButton.ToString();
    }


    private void Level_Category_ButtonClick(object sender, EventArgs e)
    {
        #region ?? Level_Category->銝剔?蝑???
        
        string thestrindex = getTheClickedItemName(sender);
        mainPanelMenu.Level_Category_ButtonIsClick(thestrindex);
        #endregion

    }
    private void Statistics_ButtonClick(object sender, EventArgs e)
    {
        #region ?? Statistics->銝剔???
        string thestrindex = getTheClickedItemName(sender);
        MessageBox.Show(thestrindex);
        mainPanelMenu.Statistics_ButtonIsClick(thestrindex);
        #endregion
    }

   

    private void Sorting_ButtonClick(object sender, EventArgs e)
    {
        #region ?? Sorting->銝剔???
        string thestrindex = getTheClickedItemName(sender);
        MessageBox.Show(thestrindex);
        mainPanelMenu.Sorting_ButtonIsClick(thestrindex);
        #endregion
    }
    private void Main_Panel_ButtonClick(object sender, EventArgs e)
    {
        #region ?? Main_Panel->銝剔???
        string thestrindex = getTheClickedItemName(sender);
        mainPanelMenu.Main_Panel_ButtonIsClick(thestrindex);
        #endregion
    }

    private void Query_Approach_ButtonClick(object sender, EventArgs e)
    {
        #region ?? Query_Approach->銝剔???
        string thestrindex = getTheClickedItemName(sender);
        mainPanelMenu.Query_Approach_ButtonIsClick(thestrindex);
        #endregion
    }



    public void StatisticsButtonProcess(bool b)
    {
        toolStripButton_Statistics[Dic_Statistics["Above_Average"]].Enabled = b;
        toolStripButton_Statistics[Dic_Statistics["Below_Average"]].Enabled = b;

    }



    public void Main_Panel_ButtonProcess( bool b)
    {
        toolStripButton_Main_Panel[Dic_Main_Panel["Set_Profile"]].Visible = b;
        toolStripButton_Main_Panel[Dic_Main_Panel["Save_Log_File"]].Visible = b;
        toolStripButton_Main_Panel[Dic_Main_Panel["Process_RecordBook"]].Visible = b;
        toolStripButton_Main_Panel[Dic_Main_Panel["Display_Level_Distribution"]].Visible = b;
    }


    #endregion

    private void btnSetProfile_Click(object sender, EventArgs e)
    {         
        TEACHERNAME = tb_getTeacherName.Text;
        COURSENAME = tb_getCourseName.Text;
        MIDTERMRATE = Double.Parse(tb_getMidRate.Text);
        FINALEXAMRATE = Double.Parse(tb_getFinalRate.Text);
        REGULARRATE = Double.Parse(tb_getRegularRate.Text);
        decimal sum = Math.Round((decimal)(MIDTERMRATE+FINALEXAMRATE+ REGULARRATE), 2);

        if ((sum)!=1)
        {
            MIDTERMRATE = -1;
            FINALEXAMRATE = -1;
            REGULARRATE = -1;
            MessageBox.Show("瘥??詨?韏瑚?敹?蝑1");
        }
        else
        {
            Level_Category.Visible = true;
            MessageBox.Show("Mid:"+ MIDTERMRATE+"   Final:"+ FINALEXAMRATE+"  Regular"+ REGULARRATE);
            MessageBox.Show("?曉?臬??沌rocess_RecordBook");
            toolStripButton_Main_Panel[Dic_Main_Panel["Process_RecordBook"]].Visible = true;
            toolStripButton_Main_Panel[Dic_Main_Panel["Display_Level_Distribution"]].Visible = true;
            gp_Choice_for_Drawing_Chart.Enabled = true;
            foreach (GradeRecordUsingThrow grade in completedGradeRecordList)//?∠瘥?閮? ?蜀
            {
                grade.calculateSemesterMark(REGULARRATE, MIDTERMRATE, FINALEXAMRATE);
            }
            Count_eachLevel();
        }

    }
    private void Count_eachLevel()
    {
        foreach (StudentScoreGrading scoreGrading in studentScoreGrading)
        {
            scoreGrading.theLVStudents = GradeBookAdv_CS2200.selectLevel(completedGradeRecordList, scoreGrading.MAX, scoreGrading.MIN).ToList();//using Linq
        }
    }



    public void Show_eachLevel()
    {
      
        lb_showStudentData_Right.Items.Clear();
        for (int i = 0; i < studentScoreGrading.Length; i++)
        {
            string temp = "";
            temp = studentScoreGrading[i].LEVELAndRange;
            for (int c = 0; c < studentScoreGrading[i].theLVStudents.Count; c++)
            {

                temp += "*";
            }

            RecordStudentScoreList.Add(studentScoreGrading[i].LEVELAndRange);
            lb_showStudentData_Right.Items.Add(temp);
        }
        bt_showTitle4ListBox.Text = "Display Level Distribution";

    }

    public void ListBoxAddOneRow(bool left,string text)
    {
        ListBox listBox = left ? lb_showStudentData_Left : lb_showStudentData_Right;
        listBox.Items.Clear();
        listBox.Items.Add(text);
    }
    private void setDataGridView()
    {
        dg_right.ColumnCount = 7;
        dg_right.ColumnHeadersVisible = true;

        //set the colum header style
        DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();

        columnHeaderStyle.BackColor = Color.Beige;
        columnHeaderStyle.Font = new Font("Verdana", 9, FontStyle.Bold);
        dg_right.ColumnHeadersDefaultCellStyle = columnHeaderStyle;

        //set the column header names
        dg_right.Columns[0].HeaderText = "Class ID";
        dg_right.Columns[1].HeaderText = "Student ID";
        dg_right.Columns[2].HeaderText = "First Name";
        dg_right.Columns[3].HeaderText = "Last Name";
        dg_right.Columns[4].HeaderText = "Regular";
        dg_right.Columns[5].HeaderText = "MidTerm";
        dg_right.Columns[6].HeaderText = "Final-Exam";
    }
    public void AddItemsToDataGridView(List<GradeRecordUsingThrow>recordUsingThrows)
    {
        dg_right.Rows.Clear();

        foreach (GradeRecordUsingThrow gradeRecordUsingThrow in recordUsingThrows)
        {
            dg_right.Rows.Add(gradeRecordUsingThrow.StudentID,
                              gradeRecordUsingThrow.ClassID,
                              gradeRecordUsingThrow.FirstName,
                              gradeRecordUsingThrow.LastName,
             ?       儠趲稰??釔E勳f?韕ck&抁v-;9.IH?m?U?沀?RV?牟虎膮睆精??u?

#>?6犝橙x?荒n?|x????r\滐?忣姦?]?_(6?璋爟奻餳瓡?!鱐@贈??橶W爁愄3?S讔?琵'AI?4?鏍 精~醹?紙賡&貗蓲?勷姻淀Y?㏑點?岸?Q3NB丞?Y????瑍qF??瀛?R瀅翠?}|p樅'?3??獗?枷/QbM裖b?8^?)燁磔?1顣?味r矙鵏∥:}?悴o?膙#p貼?蝆?0拇㏑D ?|譐??>齶0c??8G呶綼訴L箙H瞏![??鍇?L?腠N?v暝??3FF-X9?鍔>???c*!滼G繫,E恦q? >bjc#彌

e6319a5b iT邦新手 4 級 ‧ 2019-06-02 23:47:27 檢舉

還是說要用什麼通訊軟體傳給您嗎?

暐翰 iT邦大師 1 級 ‧ 2019-06-02 23:54:02 檢舉

e6319a5b 寄我的信箱 shps951002@gmail.com
或是傳連結給小魚大大

e6319a5b iT邦新手 4 級 ‧ 2019-06-02 23:58:09 檢舉

已傳訊給您

暐翰 iT邦大師 1 級 ‧ 2019-06-03 00:04:56 檢舉

不是cs檔案,是exe檔案 e6319a5b
我等等跟家人出去,回來再處理

暐翰 iT邦大師 1 級 ‧ 2019-06-03 03:08:14 檢舉

我回信了,你看一下 e6319a5b

e6319a5b iT邦新手 4 級 ‧ 2019-06-03 07:58:06 檢舉

感謝您

0
小魚
iT邦大師 1 級 ‧ 2019-06-02 23:05:50

解決方法:
再花一天補回來.
因為你是針對同一個檔案在操作,
基本上是沒有救了,
除非是用編輯器本身的復原功能,
所以寫程式記得要常常做儲存和備份的動作...

e6319a5b iT邦新手 4 級 ‧ 2019-06-02 23:09:35 檢舉

請問這句是指:編輯器本身的復原功能?
我的檔案還沒關

小魚 iT邦大師 1 級 ‧ 2019-06-02 23:28:53 檢舉

Ctrl-Z,
(就是上面的 復原 Ctrl-Z 和 取消復原 Ctrl-Y 兩個按鈕)
只針對開啟的那個檔案,
做回復的動作,
(意思是你要復原其他檔案,
就要切換到那個檔案下,
再按上面的指令,
不過如果檔案的視窗已經關閉應該是無法復原了)
但是編輯器的回復還是有限制的,
我猜可能是跟記憶體大小有關吧...

我要發表回答

立即登入回答